switch to luasnip, added better snipplets
This commit is contained in:
commit
7f9c18536b
19
init.lua
Normal file
19
init.lua
Normal file
@ -0,0 +1,19 @@
|
||||
require("bootstrap")
|
||||
require("plugins")
|
||||
require("config.lsp-config")
|
||||
require("config.winsep")
|
||||
require("config.bindings")
|
||||
require("ui.startscreen")
|
||||
require("ui.status")
|
||||
require("ui.highlight")
|
||||
|
||||
--{{{ vim cmd
|
||||
vim.cmd(":set showtabline=2")
|
||||
vim.cmd(":set ignorecase")
|
||||
vim.cmd(":set smartcase")
|
||||
vim.cmd(":set number")
|
||||
vim.cmd(":set clipboard+=unnamedplus")
|
||||
vim.cmd(":set relativenumber")
|
||||
vim.cmd("set foldmethod=marker")
|
||||
vim.opt.fillchars:append { eob = " " }
|
||||
--}}}
|
15
lazy-lock.json
Normal file
15
lazy-lock.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"colorful-winsep.nvim": { "branch": "main", "commit": "e1b72c498f25c1fc37a7e9913332c137f753a90a" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
||||
}
|
12
lua/bootstrap.lua
Normal file
12
lua/bootstrap.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
28
lua/config/bindings.lua
Normal file
28
lua/config/bindings.lua
Normal file
@ -0,0 +1,28 @@
|
||||
--tab navigation
|
||||
vim.keymap.set("n", "<A-1>", "1gt")
|
||||
vim.keymap.set("n", "<A-2>", "2gt")
|
||||
vim.keymap.set("n", "<A-3>", "3gt")
|
||||
vim.keymap.set("n", "<A-4>", "4gt")
|
||||
vim.keymap.set("n", "<A-5>", "5gt")
|
||||
vim.keymap.set("n", "<A-6>", "6gt")
|
||||
vim.keymap.set("n", "<A-7>", "7gt")
|
||||
vim.keymap.set("n", "<A-8>", "8gt")
|
||||
vim.keymap.set("n", "<A-9>", "9gt")
|
||||
vim.keymap.set("n", "<A-0>", ":tablast<cr>")
|
||||
vim.keymap.set("n", "<C-t>", ":tab new<cr>")
|
||||
--move between splits with hjkl
|
||||
vim.keymap.set("n", "<A-l>", ":wincmd l<cr>")
|
||||
vim.keymap.set("n", "<A-k>", ":wincmd k<cr>")
|
||||
vim.keymap.set("n", "<A-j>", ":wincmd j<cr>")
|
||||
vim.keymap.set("n", "<A-h>", ":wincmd h<cr>")
|
||||
--misc
|
||||
vim.keymap.set("n", "<C-w>", ":q<cr>") --ctrl+w shortcut of :q
|
||||
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<cr>") --open file tree
|
||||
vim.keymap.set("n", "<A-cr>", ":tabnew +term<cr>") --create terminal in new tab
|
||||
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --exit terminal mode with esc
|
||||
vim.keymap.set("n", "<A-ESC>", ":tabnew | terminal htop<cr>") --open htop in new tab
|
||||
vim.keymap.set("n", "<A-t>", ":tabnew | terminal termusic<cr>") --open termusic (a music player) in new tab
|
||||
vim.keymap.set("n", "<A-m>", ":tabnew | terminal gomuks<cr>") --open gomuks (a matrix client) in new tab
|
||||
vim.keymap.set("n", "<A-r>", ":tabnew | terminal ranger<cr>") --open ranger (a file manager) in new tab
|
||||
vim.keymap.set("n", "<A-V>", ":split new<cr>") --create a new split
|
||||
vim.keymap.set("n", "<A-v>", ":vs new<cr>") --create a vplit
|
82
lua/config/lsp-config.lua
Normal file
82
lua/config/lsp-config.lua
Normal file
@ -0,0 +1,82 @@
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
require('lspconfig')['clangd'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['csharp_ls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['lua_ls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['bashls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
15
lua/config/winsep.lua
Normal file
15
lua/config/winsep.lua
Normal file
@ -0,0 +1,15 @@
|
||||
require("colorful-winsep").setup({
|
||||
-- highlight for Window separator
|
||||
-- timer refresh rate
|
||||
interval = 30,
|
||||
-- This plugin will not be activated for filetype in the following table.
|
||||
no_exec_files = { "packer", "TelescopePrompt", "mason", "CompetiTest", "NvimTree" },
|
||||
-- Symbols for separator lines, the order: horizontal, vertical, top left, top right, bottom left, bottom right.
|
||||
symbols = { "━", "┃", "┏", "┓", "┗", "┛" },
|
||||
close_event = function()
|
||||
-- Executed after closing the window separator
|
||||
end,
|
||||
create_event = function()
|
||||
-- Executed after creating the window separator
|
||||
end,
|
||||
})
|
84
lua/plugins.lua
Normal file
84
lua/plugins.lua
Normal file
@ -0,0 +1,84 @@
|
||||
local plugins = {
|
||||
-- {{{ lsp stuff
|
||||
-- {{{ basic lsp
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
event = "VeryLazy"
|
||||
}
|
||||
}, -- }}}
|
||||
|
||||
-- {{{ snipplets
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
}, -- }}}
|
||||
-- }}}
|
||||
|
||||
-- {{{ editor
|
||||
-- {{{ prints possible shortcuts upon button press
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
lazy = true
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 0
|
||||
require("which-key").setup(opts)
|
||||
end
|
||||
}, -- }}}
|
||||
|
||||
-- {{{ auto closes ()
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}, -- }}}
|
||||
-- }}}
|
||||
|
||||
-- {{{ ui
|
||||
--better borders for split screen
|
||||
{
|
||||
"nvim-zh/colorful-winsep.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function ()
|
||||
require('colorful-winsep').setup()
|
||||
end
|
||||
},
|
||||
|
||||
--start screen
|
||||
{
|
||||
'goolord/alpha-nvim',
|
||||
},
|
||||
-- }}}
|
||||
|
||||
-- {{{ misc
|
||||
-- }}}
|
||||
}
|
||||
plugins.lazy = true
|
||||
require("lazy").setup(plugins)
|
256
lua/ui/highlight.lua
Normal file
256
lua/ui/highlight.lua
Normal file
@ -0,0 +1,256 @@
|
||||
vim.cmd([[
|
||||
" noctu.vim - Vim color scheme for 16-color terminals
|
||||
" --------------------------------------------------------------
|
||||
" Author: Noah Frederick (http://noahfrederick.com/)
|
||||
" Version: 1.8.0
|
||||
" --------------------------------------------------------------
|
||||
" Scheme setup {{{
|
||||
set background=dark
|
||||
hi! clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let g:colors_name = "noctu"
|
||||
|
||||
"}}}
|
||||
" Vim UI {{{
|
||||
hi Normal ctermfg=7
|
||||
hi Cursor ctermfg=7 ctermbg=1
|
||||
hi CursorLine ctermbg=1 cterm=NONE
|
||||
hi MatchParen ctermfg=7 ctermbg=NONE cterm=underline
|
||||
hi Pmenu ctermfg=13 ctermbg=0
|
||||
hi PmenuThumb ctermbg=7
|
||||
hi PmenuSBar ctermbg=8
|
||||
hi PmenuSel ctermfg=0 ctermbg=4
|
||||
hi ColorColumn ctermbg=0
|
||||
hi SpellBad ctermfg=1 ctermbg=NONE cterm=underline
|
||||
hi SpellCap ctermfg=10 ctermbg=NONE cterm=underline
|
||||
hi SpellRare ctermfg=11 ctermbg=NONE cterm=underline
|
||||
hi SpellLocal ctermfg=13 ctermbg=NONE cterm=underline
|
||||
hi NonText ctermfg=8
|
||||
hi LineNr ctermfg=8 ctermbg=NONE
|
||||
hi CursorLineNr ctermfg=11 ctermbg=0
|
||||
hi Visual ctermfg=0 ctermbg=12
|
||||
hi IncSearch ctermfg=0 ctermbg=13 cterm=NONE
|
||||
hi Search ctermfg=0 ctermbg=10
|
||||
hi StatusLine ctermfg=7 ctermbg=NONE cterm=bold
|
||||
hi StatusLineNC ctermfg=1 ctermbg=NONE cterm=bold
|
||||
hi VertSplit ctermfg=7 ctermbg=0 cterm=NONE
|
||||
hi TabLine ctermfg=8 ctermbg=0 cterm=NONE
|
||||
hi TabLineSel ctermfg=1 ctermbg=0
|
||||
hi Folded ctermfg=6 ctermbg=0 cterm=bold
|
||||
hi Conceal ctermfg=6 ctermbg=NONE
|
||||
hi Directory ctermfg=12
|
||||
hi Title ctermfg=3 cterm=bold
|
||||
hi ErrorMsg ctermfg=15 ctermbg=1
|
||||
hi DiffAdd ctermfg=0 ctermbg=2
|
||||
hi DiffChange ctermfg=0 ctermbg=3
|
||||
hi DiffDelete ctermfg=0 ctermbg=1
|
||||
hi DiffText ctermfg=0 ctermbg=11 cterm=bold
|
||||
hi User1 ctermfg=1 ctermbg=0
|
||||
hi User2 ctermfg=4 ctermbg=0
|
||||
hi User3 ctermfg=2 ctermbg=0
|
||||
hi User4 ctermfg=3 ctermbg=0
|
||||
hi User5 ctermfg=5 ctermbg=0
|
||||
hi User6 ctermfg=6 ctermbg=0
|
||||
hi User7 ctermfg=7 ctermbg=0
|
||||
hi User8 ctermfg=8 ctermbg=0
|
||||
hi User9 ctermfg=15 ctermbg=5
|
||||
hi! link CursorColumn CursorLine
|
||||
hi! link SignColumn LineNr
|
||||
hi! link WildMenu Visual
|
||||
hi! link FoldColumn SignColumn
|
||||
hi! link WarningMsg ErrorMsg
|
||||
hi! link MoreMsg Title
|
||||
hi! link Question MoreMsg
|
||||
hi! link ModeMsg MoreMsg
|
||||
hi! link TabLineFill StatusLineNC
|
||||
hi! link SpecialKey NonText
|
||||
|
||||
"}}}
|
||||
" Generic syntax {{{
|
||||
hi Delimiter ctermfg=7
|
||||
hi Comment ctermfg=8
|
||||
hi Underlined ctermfg=4 cterm=underline
|
||||
hi Type ctermfg=4
|
||||
hi String ctermfg=11
|
||||
hi Keyword ctermfg=2
|
||||
hi Todo ctermfg=14 ctermbg=NONE cterm=bold,underline
|
||||
hi Function ctermfg=4
|
||||
hi Identifier ctermfg=7 cterm=NONE
|
||||
hi Statement ctermfg=2 cterm=bold
|
||||
hi Constant ctermfg=13
|
||||
hi Number ctermfg=12
|
||||
hi Boolean ctermfg=4
|
||||
hi Special ctermfg=13
|
||||
hi Ignore ctermfg=0
|
||||
hi PreProc ctermfg=8 cterm=bold
|
||||
hi! link Operator Delimiter
|
||||
hi! link Error ErrorMsg
|
||||
|
||||
"}}}
|
||||
" HTML {{{
|
||||
hi htmlTagName ctermfg=2
|
||||
hi htmlTag ctermfg=2
|
||||
hi htmlArg ctermfg=10
|
||||
hi htmlH1 cterm=bold
|
||||
hi htmlBold cterm=bold
|
||||
hi htmlItalic cterm=underline
|
||||
hi htmlUnderline cterm=underline
|
||||
hi htmlBoldItalic cterm=bold,underline
|
||||
hi htmlBoldUnderline cterm=bold,underline
|
||||
hi htmlUnderlineItalic cterm=underline
|
||||
hi htmlBoldUnderlineItalic cterm=bold,underline
|
||||
hi! link htmlLink Underlined
|
||||
hi! link htmlEndTag htmlTag
|
||||
|
||||
"}}}
|
||||
" XML {{{
|
||||
hi xmlTagName ctermfg=4
|
||||
hi xmlTag ctermfg=12
|
||||
hi! link xmlString xmlTagName
|
||||
hi! link xmlAttrib xmlTag
|
||||
hi! link xmlEndTag xmlTag
|
||||
hi! link xmlEqual xmlTag
|
||||
|
||||
"}}}
|
||||
" JavaScript {{{
|
||||
hi! link javaScript Normal
|
||||
hi! link javaScriptBraces Delimiter
|
||||
|
||||
"}}}
|
||||
" PHP {{{
|
||||
hi phpSpecialFunction ctermfg=5
|
||||
hi phpIdentifier ctermfg=11
|
||||
hi phpParent ctermfg=8
|
||||
hi! link phpVarSelector phpIdentifier
|
||||
hi! link phpHereDoc String
|
||||
hi! link phpDefine Statement
|
||||
|
||||
"}}}
|
||||
" Markdown {{{
|
||||
hi! link markdownHeadingRule NonText
|
||||
hi! link markdownHeadingDelimiter markdownHeadingRule
|
||||
hi! link markdownLinkDelimiter Delimiter
|
||||
hi! link markdownURLDelimiter Delimiter
|
||||
hi! link markdownCodeDelimiter NonText
|
||||
hi! link markdownLinkTextDelimiter markdownLinkDelimiter
|
||||
hi! link markdownUrl markdownLinkText
|
||||
hi! link markdownAutomaticLink markdownLinkText
|
||||
hi! link markdownCodeBlock String
|
||||
hi markdownCode cterm=bold
|
||||
hi markdownBold cterm=bold
|
||||
hi markdownItalic cterm=underline
|
||||
|
||||
"}}}
|
||||
" Ruby {{{
|
||||
hi! link rubyDefine Statement
|
||||
hi! link rubyLocalVariableOrMethod Identifier
|
||||
hi! link rubyConstant Constant
|
||||
hi! link rubyInstanceVariable Number
|
||||
hi! link rubyStringDelimiter rubyString
|
||||
|
||||
"}}}
|
||||
" Git {{{
|
||||
hi gitCommitBranch ctermfg=3
|
||||
hi gitCommitSelectedType ctermfg=10
|
||||
hi gitCommitSelectedFile ctermfg=2
|
||||
hi gitCommitUnmergedType ctermfg=9
|
||||
hi gitCommitUnmergedFile ctermfg=1
|
||||
hi! link gitCommitFile Directory
|
||||
hi! link gitCommitUntrackedFile gitCommitUnmergedFile
|
||||
hi! link gitCommitDiscardedType gitCommitUnmergedType
|
||||
hi! link gitCommitDiscardedFile gitCommitUnmergedFile
|
||||
|
||||
"}}}
|
||||
" Vim {{{
|
||||
hi! link vimSetSep Delimiter
|
||||
hi! link vimContinue Delimiter
|
||||
hi! link vimHiAttrib Constant
|
||||
|
||||
"}}}
|
||||
" LESS {{{
|
||||
hi lessVariable ctermfg=11
|
||||
hi! link lessVariableValue Normal
|
||||
|
||||
"}}}
|
||||
" NERDTree {{{
|
||||
hi! link NERDTreeHelp Comment
|
||||
hi! link NERDTreeExecFile String
|
||||
|
||||
"}}}
|
||||
" Vimwiki {{{
|
||||
hi! link VimwikiHeaderChar markdownHeadingDelimiter
|
||||
hi! link VimwikiList markdownListMarker
|
||||
hi! link VimwikiCode markdownCode
|
||||
hi! link VimwikiCodeChar markdownCodeDelimiter
|
||||
|
||||
"}}}
|
||||
" Help {{{
|
||||
hi! link helpExample String
|
||||
hi! link helpHeadline Title
|
||||
hi! link helpSectionDelim Comment
|
||||
hi! link helpHyperTextEntry Statement
|
||||
hi! link helpHyperTextJump Underlined
|
||||
hi! link helpURL Underlined
|
||||
|
||||
"}}}
|
||||
" CtrlP {{{
|
||||
hi! link CtrlPMatch String
|
||||
hi! link CtrlPLinePre Comment
|
||||
|
||||
"}}}
|
||||
" Mustache {{{
|
||||
hi mustacheSection ctermfg=14 cterm=bold
|
||||
hi mustacheMarker ctermfg=6
|
||||
hi mustacheVariable ctermfg=14
|
||||
hi mustacheVariableUnescape ctermfg=9
|
||||
hi mustachePartial ctermfg=13
|
||||
|
||||
"}}}
|
||||
" Shell {{{
|
||||
hi shDerefSimple ctermfg=11
|
||||
hi! link shDerefVar shDerefSimple
|
||||
|
||||
"}}}
|
||||
" Syntastic {{{
|
||||
hi SyntasticWarningSign ctermfg=3 ctermbg=NONE
|
||||
hi SyntasticErrorSign ctermfg=1 ctermbg=NONE
|
||||
hi SyntasticStyleWarningSign ctermfg=2 ctermbg=NONE
|
||||
hi SyntasticStyleErrorSign ctermfg=4 ctermbg=NONE
|
||||
|
||||
"}}}
|
||||
" Netrw {{{
|
||||
hi netrwExe ctermfg=9
|
||||
hi netrwClassify ctermfg=8 cterm=bold
|
||||
|
||||
"}}}
|
||||
" Ledger {{{
|
||||
hi ledgerAccount ctermfg=11
|
||||
hi! link ledgerMetadata Comment
|
||||
hi! link ledgerTransactionStatus Statement
|
||||
|
||||
"}}}
|
||||
" Diff {{{
|
||||
hi diffAdded ctermfg=2
|
||||
hi diffRemoved ctermfg=1
|
||||
hi! link diffFile PreProc
|
||||
hi! link diffLine Title
|
||||
|
||||
"}}}
|
||||
" Plug {{{
|
||||
hi plugSha ctermfg=3
|
||||
|
||||
"}}}
|
||||
" Blade {{{
|
||||
hi! link bladeStructure PreProc
|
||||
hi! link bladeParen phpParent
|
||||
hi! link bladeEchoDelim PreProc
|
||||
|
||||
"}}}
|
||||
|
||||
" vim: fdm=marker:sw=2:sts=2:et
|
||||
|
||||
]])
|
177
lua/ui/startscreen.lua
Normal file
177
lua/ui/startscreen.lua
Normal file
@ -0,0 +1,177 @@
|
||||
local alpha = require("alpha")
|
||||
|
||||
local col = function(strlist, opts)
|
||||
-- strlist is a TABLE of TABLES, representing columns of text
|
||||
-- opts is a text display option
|
||||
|
||||
-- column spacing
|
||||
local padding = 12
|
||||
-- fill lines up to the maximim length with 'fillchar'
|
||||
local fillchar = ' '
|
||||
-- columns padding char (for testing)
|
||||
local padchar = ' '
|
||||
|
||||
-- define maximum string length in a table
|
||||
local maxlen = function(str)
|
||||
local max = 0
|
||||
for i in pairs(str) do
|
||||
if #str[i] > max then
|
||||
max = #str[i]
|
||||
end
|
||||
end
|
||||
return max
|
||||
end
|
||||
|
||||
-- add as much right-padding to align the text block
|
||||
local pad = function(str, max)
|
||||
local strlist = {}
|
||||
for i in pairs(str) do
|
||||
if #str[i] < max then
|
||||
local newstr = str[i] .. string.rep(fillchar, max-#str[i])
|
||||
table.insert(strlist, newstr)
|
||||
else
|
||||
table.insert(strlist, str[i])
|
||||
end
|
||||
end
|
||||
return strlist
|
||||
end
|
||||
|
||||
-- this is a table for text strings
|
||||
local values = {}
|
||||
-- process all the lines
|
||||
for i=1,maxlen(strlist) do
|
||||
local str = ''
|
||||
-- process all the columns but last, because we dont wand extra padding
|
||||
-- after last column
|
||||
for column=1,#strlist-1 do
|
||||
local maxstr = maxlen(strlist[column])
|
||||
local padded = pad(strlist[column], maxstr)
|
||||
if strlist[column][i] == nil then
|
||||
str = str .. string.rep(fillchar, maxstr) .. string.rep(padchar, padding)
|
||||
else
|
||||
str = str .. padded[i] .. string.rep(padchar, padding)
|
||||
end
|
||||
end
|
||||
|
||||
-- lets process the last column, no extra padding
|
||||
do
|
||||
local maxstr = maxlen(strlist[#strlist])
|
||||
local padded = pad(strlist[#strlist], maxstr)
|
||||
if strlist[#strlist][i] == nil then
|
||||
str = str .. string.rep(fillchar, maxlen(strlist[#strlist]))
|
||||
else
|
||||
str = str .. padded[i]
|
||||
end
|
||||
end
|
||||
|
||||
-- insert result into output table
|
||||
table.insert(values, { type = "text", val = str, opts = opts })
|
||||
end
|
||||
|
||||
return values
|
||||
end
|
||||
|
||||
local window_managment = {
|
||||
|
||||
"ALT-ENT new tab terminal",
|
||||
"ALT-NUM move to tab n",
|
||||
"ALT-v horizontal split",
|
||||
"ALT-v vertical split",
|
||||
}
|
||||
|
||||
local text_managment = {
|
||||
"CTRL-t new file",
|
||||
"CTRL-w :q",
|
||||
"CTRL-n open file manager"
|
||||
}
|
||||
|
||||
|
||||
local applications = {
|
||||
"ALT+ESC htop",
|
||||
"ALT+t termusic",
|
||||
"ALT+r ranger",
|
||||
"ALT+m matrix",
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
local head = {
|
||||
type = "text",
|
||||
val = {
|
||||
[[ .█▄╥ _▄K¥▄ ]],
|
||||
[[ █ '▀▄_ ▄▄ ╓▄▀" ▀▌ ]],
|
||||
[[ █ "▀▄, ▓ ▀▀▄ ▄▀- █ ]],
|
||||
[[ ▐▌ ▀▄▌▀▀▀▀'""▀▀█ ▀▄ _▄▀ ▓ ]],
|
||||
[[ ▓ "▓╥ "▓_.▓▀ ╫ ]],
|
||||
[[ )▌ ▀█ ╫ ]],
|
||||
[[ ▐∩ █ ]],
|
||||
[[ ▐∩ ▐▌ ]],
|
||||
[[ ▐µ █▌ ]],
|
||||
[[ ▓ ╨▓▓█▄▄╥_ ,▄▄█████▄ █ ]],
|
||||
[[ ▐▄ `"▀▀██▄ ▐███▌╓_ .▓" ]],
|
||||
[[ "▓▄ _▄▄███▀' ▄▄▄▄┐ "▀▀█████▄ .▄K▀▀▀▀█ ]],
|
||||
[[▐▌▀▀▀▀ª ▀▀' "▀▄, _ _╥▄▀ ]],
|
||||
[[ ▓▄ _╥µ __ ,▄▄ ]µ ` ╫▌@╨ ▀▌ ]],
|
||||
[[ "▀▄` ▓K" *▌▄▄▀" "▀▀▓▀ ▀▄ ]],
|
||||
[[ █. ▐▌ j▌ _ █ ]],
|
||||
[[ █ , ▀▄ ▐▌ ▄▓"▀▀▀▀" ]],
|
||||
[[ ▐█K▀▀"▀¥██▌▄▄_ ╨▓_ _█ ,▄▄K▀▀ ]],
|
||||
[[ ▐▌ "▀W "▀" "█µ ]],
|
||||
[[ ▐█ "▓_ ]],
|
||||
[[ _▓▀ ▀▄ ]],
|
||||
[[ j█____ _ ▀▄ ]],
|
||||
[[ ''"▓" ▓⌐ ]],
|
||||
[[ █ ▐▌ ]],
|
||||
[[ ▀ ▀ ]],
|
||||
|
||||
},
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "Type",
|
||||
},
|
||||
}
|
||||
|
||||
local foot = {
|
||||
type = "text",
|
||||
val = "footer",
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "Number",
|
||||
},
|
||||
}
|
||||
|
||||
local block1 = {
|
||||
type = "group",
|
||||
val = col({window_managment, text_managment}, { position = "center", hl = {{ "Title", 0, 7 }, {"Comment", 7, 37}, {"Title", 37, 44}, {"Comment", 44, -1}}}),
|
||||
opts = {
|
||||
spacing = 0
|
||||
},
|
||||
}
|
||||
|
||||
local block2 = {
|
||||
type = "group",
|
||||
val = col({applications}, { position = "center", hl = {{"Comment", 7, -1}, { "Title", 0, 7 }} }),
|
||||
opts = {
|
||||
spacing = 0
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local opts = {
|
||||
layout = {
|
||||
{ type = "padding", val = 2 },
|
||||
head,
|
||||
{ type = "padding", val = 2 },
|
||||
block1,
|
||||
{ type = "padding", val = 2 },
|
||||
block2,
|
||||
},
|
||||
opts = {
|
||||
noautocmd = true,
|
||||
margin = 5,
|
||||
},
|
||||
}
|
||||
alpha.setup(opts)
|
||||
|
49
lua/ui/status.lua
Normal file
49
lua/ui/status.lua
Normal file
@ -0,0 +1,49 @@
|
||||
vim.cmd([[
|
||||
set laststatus=3
|
||||
set statusline=
|
||||
set statusline+=%1*
|
||||
set statusline+=%{StatuslineMode()}
|
||||
set statusline+=\
|
||||
set statusline+=|
|
||||
set statusline+=\
|
||||
set statusline+=%2*
|
||||
set statusline+=%F
|
||||
set statusline+=%=
|
||||
set statusline+=%3*
|
||||
set statusline+=%l
|
||||
set statusline+=\
|
||||
set statusline+=/
|
||||
set statusline+=\
|
||||
set statusline+=%L
|
||||
set statusline+=\
|
||||
set statusline+=\
|
||||
set statusline+=|
|
||||
set statusline+=\
|
||||
set statusline+=%{strftime('%c')}
|
||||
hi User1 ctermbg=black ctermfg=blue guibg=black guifg=blue
|
||||
hi User9 ctermbg=black ctermfg=white guibg=black guifg=white
|
||||
hi User2 ctermbg=black ctermfg=green guibg=black guifg=green
|
||||
hi User3 ctermbg=black ctermfg=white guibg=black guifg=white
|
||||
|
||||
function! StatuslineMode()
|
||||
let l:mode=mode()
|
||||
if l:mode==#"n"
|
||||
return "NORMAL"
|
||||
elseif l:mode==?"v"
|
||||
return "VISUAL"
|
||||
elseif l:mode==#"i"
|
||||
return "INSERT"
|
||||
elseif l:mode==#"R"
|
||||
return "REPLACE"
|
||||
elseif l:mode==?"s"
|
||||
return "SELECT"
|
||||
elseif l:mode==#"t"
|
||||
return "TERMINAL"
|
||||
elseif l:mode==#"c"
|
||||
return "COMMAND"
|
||||
elseif l:mode==#"!"
|
||||
return "SHELL"
|
||||
endif
|
||||
endfunction
|
||||
:call timer_start(1000, {-> execute(':let &stl=&stl')}, {'repeat': -1})
|
||||
]])
|
Loading…
Reference in New Issue
Block a user