diff --git a/README.md b/README.md index d2cee99..b091c6a 100644 --- a/README.md +++ b/README.md @@ -5,40 +5,21 @@ My vim config written in lua designed for *smol boi minimal vibes* Most of the code is in separate modules. Each will later be its own true plugin. -### Installation - -Install the package manager `paq` to start: +## OLD +### TODO +Remove colemak w/ opt-in ```sh -git clone --depth=1 https://github.com/savq/paq-nvim.git \ - "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim +sh -c 'curl -fLo \ +"${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ +https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +``` +`pip3 install --user pynvim`` + +```vim +:PlugInstall +:UpdateRemotePlugins ``` -#### LSP servers - -Scripts are supplied in `scripts/` for each server I use. Run these for the -corresponding server that you would like to be installed. - -The process in no way is automated or "purely in lua or vimscript", but it more -just holds your hand a bit. There may be plans in the future to automate this -with our own package manager. But I might start writing my own editor by that -point. So we'll see. - -If you'd like to add a new LSP server, feel free. Just make sure to ask the -user if all dependencies are installed. Currently, this is achieved using -`query_dep` in `query_dependency.sh`. All it does is ask the user if the -dependency is installed and quits the install script if any dependency is not -installed. *(don't even remind me how hacky that is)* - -However, a proper package management system would be more prefered. So never -feel like this pattern is in any way enforced. I can't be biased toward which -packages for which package managers will get maintained. And I can't be -bothered to write a package for every package manager that ever exists. If it -bothers you enough, change it to specifically work with your system. And maybe -contribute so others maybe follow suit. - - -### Configure - -Make sure to set your layout in `keymap/init.lua` -to whichever layout you prefer. +> /usr/share/dict/words +Install `words` diff --git a/init.lua b/init.lua index 562a6b1..ffd2462 100755 --- a/init.lua +++ b/init.lua @@ -1,44 +1,3 @@ --- see `:help` for any questions --- use `&` to show value of vimscript variable - - --- API -- -o = vim.o -- options -go = vim.go -- only-global options -bo = vim.bo -- buffer local options -wo = vim.wo -- window local options - -cmd = vim.cmd -- vim commands -fn = vim.fn -- vim functions -opt = vim.opt -- vim option object - -g = vim.g -- global variables -b = vim.b -- buffer local variables -w = vim.w -- window local variables -t = vim.t -- tab local variables -v = vim.v -- variables -env = vim.env -- environment variables - -local modules = { - 'ui', - 'general', - 'keymap', - 'plugins', - 'native-lsp', - 'indent-blankline', - 'gitsigns-nvim', - 'lightbulb' -} - -local async -async = vim.loop.new_async( - vim.schedule_wrap( - function() - for i = 1, #modules, 1 do - pcall(require, modules[i]) - end - async:close() - end - ) -) -async:send() +require('general') +require('keymap') +require('ui') diff --git a/lua/general.lua b/lua/general.lua index f4c1475..6443d94 100755 --- a/lua/general.lua +++ b/lua/general.lua @@ -3,24 +3,24 @@ -- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options +local o = vim.o -- options +local go = vim.go -- only-global options +local bo = vim.bo -- buffer local options +local wo = vim.wo -- window local options --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object +local cmd = vim.cmd -- vim commands +local fn = vim.fn -- vim functions +local opt = vim.opt -- vim option object --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables +local g = vim.g -- global variables +local b = vim.b -- buffer local variables +local w = vim.w -- window local variables +local t = vim.t -- tab local variables +local v = vim.v -- variables +local env = vim.env -- environment variables -g.mapleader = ' ' +vim.g.mapleader = ' ' o.mouse = '' -- mouse off diff --git a/lua/gitsigns-nvim.lua b/lua/gitsigns-nvim.lua deleted file mode 100644 index 4c294f4..0000000 --- a/lua/gitsigns-nvim.lua +++ /dev/null @@ -1,65 +0,0 @@ -require('gitsigns').setup { - signs = { - add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : 'Gitsigns next_hunk'"}, - ['n [c'] = { expr = true, "&diff ? '[c' : 'Gitsigns prev_hunk'"}, - - ['n hs'] = 'Gitsigns stage_hunk', - ['v hs'] = ':Gitsigns stage_hunk', - ['n hu'] = 'Gitsigns undo_stage_hunk', - ['n hr'] = 'Gitsigns reset_hunk', - ['v hr'] = ':Gitsigns reset_hunk', - ['n hR'] = 'Gitsigns reset_buffer', - ['n hp'] = 'Gitsigns preview_hunk', - ['n hb'] = 'lua require"gitsigns".blame_line{full=true}', - ['n hS'] = 'Gitsigns stage_buffer', - ['n hU'] = 'Gitsigns reset_buffer_index', - - -- Text objects - ['o ih'] = ':Gitsigns select_hunk', - ['x ih'] = ':Gitsigns select_hunk' - }, - watch_gitdir = { - interval = 1000, - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter_opts = { - relative_time = false - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - yadm = { - enable = false - }, -} diff --git a/lua/indent-blankline.lua b/lua/indent-blankline.lua deleted file mode 100644 index 6c3b3a5..0000000 --- a/lua/indent-blankline.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("indent_blankline").setup { - -- for example, context is off by default, use this to turn it on - show_current_context = true, - show_current_context_start = true, -} diff --git a/lua/keymap/init.lua b/lua/keymap/init.lua index 568b57d..d9a1026 100755 --- a/lua/keymap/init.lua +++ b/lua/keymap/init.lua @@ -4,21 +4,21 @@ require('keymap/functional') -- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options +local o = vim.o -- options +local go = vim.go -- only-global options +local bo = vim.bo -- buffer local options +local wo = vim.wo -- window local options --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object +local cmd = vim.cmd -- vim commands +local fn = vim.fn -- vim functions +local opt = vim.opt -- vim option object --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables +local g = vim.g -- global variables +local b = vim.b -- buffer local variables +local w = vim.w -- window local variables +local t = vim.t -- tab local variables +local v = vim.v -- variables +local env = vim.env -- environment variables local layouts = { @@ -267,36 +267,65 @@ end -- All layouts: Plugin Bindings -- --- Package manager -function pm_sync() - require('plugins') - cmd('PaqSync') -end -map('n', 'p', ':lua pm_sync()', {noremap = true}) - -- LSP -local lsp_commands = { - new = {'h','d','D','r','f','n','i','s','S','<','>','a'}, - old = { - 'buf.hover', -- h - 'buf.definition', -- d - 'buf.declaration', -- D - 'buf.references', -- r - 'buf.formatting', -- f - 'buf.rename', -- n - 'buf.implementation', -- i - 'buf.document_symbol', -- s - 'buf.signature_help', -- S - 'diagnostic.goto_prev', -- < - 'diagnostic.goto_next', -- > - 'buf.code_action' -- a +function lsp_shortcuts() + local lsp_commands = { + new = {'d','r','f','t','x','a','c','C','h','s','m'}, + old = { + '#textDocument_definition', -- d + '#textDocument_rename', -- r + '#textDocument_formatting', -- f + '#textDocument_typeDefinition', -- t + '#textDocument_references', -- x + '_workspace_applyEdit', -- a + '#textDocument_completion', -- c + '#textDocument_codeAction', -- C + '#textDocument_hover', -- h + '_textDocument_documentSymbol', -- s + '_contextMenu' -- m + } } -} -for i = 1, #lsp_commands.new do - for _,f in pairs(modes_map({'n'})) do - f('l'..lsp_commands.new[i], - 'lua vim.lsp.'..lsp_commands.old[i]..'()', - {noremap = true} - ) + for i = 1, #lspcommands.new do + for _,f in pairs(modes_map({'n'})) do + f('l'..key_pair.new[i], + ':call LanguageClient'..key_pair.old[i]..'()', {noremap = true}) + end end end + +-- NERDTree defaults +map('n', 'n', ':NERDTree', {noremap = true}) +vim.g.NERDTreeMapActivateNode = 'o' -- o +vim.g.NERDTreeMapPreview = 'go' -- go +vim.g.NERDTreeMapOpenInTab = 't' -- t +vim.g.NERDTreeMapOpenInTabSilent = 'T' -- T +vim.g.NERDTreeMapOpenVSplit = 'v' -- s +vim.g.NERDTreeMapPreviewVSplit = 'V' -- gs +vim.g.NERDTreeMapCustomOpen = '' -- +vim.g.NERDTreeMapOpenRecursively = 'O' -- O +vim.g.NERDTreeMapCloseDir = 'x' -- x +vim.g.NERDTreeMapCloseChildren = 'X' -- X +vim.g.NERDTreeMapOpenExpl = '' -- e +vim.g.NERDTreeMapDeleteBookmark = 'd' -- D +vim.g.NERDTreeMapJumpRoot = 'P' -- P +vim.g.NERDTreeMapJumpParent = 'p' -- p +vim.g.NERDTreeMapUpdir = 'h' -- u +vim.g.NERDTreeMapUpdirKeepOpen = 'H' -- U +vim.g.NERDTreeMapRefresh = 'r' -- r +vim.g.NERDTreeMapRefreshRoot = 'R' -- R +vim.g.NERDTreeMapMenu = 'm' -- m +vim.g.NERDTreeMapChdir = 'c' -- cd +vim.g.NERDTreeMapCWD = 'C' -- CD +vim.g.NERDTreeMapToggleHidden = '.' -- I +vim.g.NERDTreeMapToggleFilters = 'F' -- f +vim.g.NERDTreeMapToggleFiles = 'f' -- F +vim.g.NERDTreeMapToggleBookmarks = 'b' -- B +vim.g.NERDTreeMapQuit = 'q' -- q +vim.g.NERDTreeMapToggleZoom = 'z' -- A +vim.g.NERDTreeMapHelp = '?' -- ? + +-- Limelight +map('n', 'ul', ':call LimelightToggle()', {noremap = true}) + +-- Transparent +map('n', 'ut', ':TransparentToggle', {noremap = true}) diff --git a/lua/lightbulb.lua b/lua/lightbulb.lua deleted file mode 100644 index ef03877..0000000 --- a/lua/lightbulb.lua +++ /dev/null @@ -1 +0,0 @@ -require('nvim-lightbulb').update_lightbulb() diff --git a/lua/native-lsp/init.lua b/lua/native-lsp/init.lua deleted file mode 100644 index 3666541..0000000 --- a/lua/native-lsp/init.lua +++ /dev/null @@ -1,41 +0,0 @@ --- see `:help` for any questions --- use `&` to show value of vimscript variable - - --- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options - --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object - --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables - -require("native-lsp/nvim-lsp-installer") - -local lspconfig = require('lspconfig') - -local on_attach = function(_, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - require('completion').on_attach() -end - -local servers = {'zls'} -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = on_attach, - } -end - -opt.completeopt = "menu,menuone,noselect" -g.completion_enable_auto_popup = 1 - -require("native-lsp/nvim-cmp") diff --git a/lua/native-lsp/nvim-cmp.lua b/lua/native-lsp/nvim-cmp.lua deleted file mode 100644 index 62ad48c..0000000 --- a/lua/native-lsp/nvim-cmp.lua +++ /dev/null @@ -1,154 +0,0 @@ -local cmp = require("cmp") -local luasnip = require("luasnip") - -if not luasnip then - return -end - -local lsp_symbols = { - Text = "  (Text) ", - Method = "  (Method)", - Function = "  (Function)", - Constructor = "  (Constructor)", - Field = " ﴲ (Field)", - Variable = "  (Variable)", - Class = "  (Class)", - Interface = "  (Interface)", - Module = "  (Module)", - Property = " 襁 (Property)", - Unit = "  (Unit)", - Value = "  (Value)", - Enum = " 練 (Enum)", - Keyword = "  (Keyword)", - Snippet = "  (Snippet)", - Color = "  (Color)", - File = "  (File)", - Reference = "  (Reference)", - Folder = "  (Folder)", - EnumMember = "  (EnumMember)", - Constant = "  (Constant)", - Struct = "  (Struct)", - Event = "  (Event)", - Operator = "  (Operator)", - TypeParameter = "  (TypeParameter)" -} - -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - - mapping = { - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - }, - - formatting = { - format = function(entry, item) - item.kind = lsp_symbols[item.kind] .. " " .. item.kind - -- set a name for each source - item.menu = ({ - spell = "[Spell]", - buffer = "[Buffer]", - calc = "[Calc]", - emoji = "[Emoji]", - nvim_lsp = "[LSP]", - path = "[Path]", - look = "[Look]", - treesitter = "[treesitter]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[Latex]", - cmp_tabnine = "[Tab9]" - })[entry.source.name] - return item - end - }, - - sources = { - { name = 'nvim_lsp' }, - { name = 'cmp_tabnine' }, - { name = 'luasnip' }, - { name = 'path' }, - { name = 'latex_symbols'}, - { name = 'treesitter' }, - { name = 'buffer' }, - { - name = 'look', - keyword_length = 2, - option = { - convert_case = true, - loud = true - } - }, - { name = 'emoji' }, - { name = 'calc' } - }, - - cmp.setup.cmdline('-', { - sources = { - { name = 'path' }, - { name = 'cmdline' }, - { name = 'nvim_lua' }, - { name = 'buffer' } - } - }), - - cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } - }), - - cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }), -}) - -local tabnine = require('cmp_tabnine.config') - -tabnine:setup({ - max_lines = 1000; - max_num_results = 20; - sort = true; - run_on_every_keystroke = true; - snippet_placeholder = '..'; - ignored_file_types = { -- default is not to ignore - -- uncomment to ignore in lua: - -- lua = true - }; -}) diff --git a/lua/native-lsp/nvim-compe.lua b/lua/native-lsp/nvim-compe.lua deleted file mode 100644 index 72b5926..0000000 --- a/lua/native-lsp/nvim-compe.lua +++ /dev/null @@ -1,95 +0,0 @@ --- see `:help` for any questions --- use `&` to show value of vimscript variable - - --- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options - --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object - --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables - --- dependent on https://github.com/hrsh7th/nvim-compe - -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - incomplete_delay = 400; - max_abbr_width = 100; - max_kind_width = 100; - max_menu_width = 100; - documentation = false; - - source = { - path = true; - buffer = true; - calc = true; - vsnip = true; - nvim_lsp = true; - nvim_lua = true; - spell = true; - tags = true; - snippets_nvim = true; - treesitter = true; - }; -} -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -local check_back_space = function() - local col = fn.col('.') - 1 - if col == 0 or fn.getline('.'):sub(col, col):match('%s') then - return true - else - return false - end -end - --- Use (s-)tab to: ---- move to prev/next item in completion menuone ---- jump to prev/next snippet's placeholder -_G.tab_complete = function() - if fn.pumvisible() == 1 then - return t "" - elseif fn.call("vsnip#available", {1}) == 1 then - return t "(vsnip-expand-or-jump)" - elseif check_back_space() then - return t "" - else - return fn['compe#complete']() - end -end -_G.s_tab_complete = function() - if fn.pumvisible() == 1 then - return t "" - elseif fn.call("vsnip#jumpable", {-1}) == 1 then - return t "(vsnip-jump-prev)" - else - -- If is not working in your terminal, change it to - return t "" - end -end - -map("i", "", "v:lua.tab_complete()", {expr = true}) -map("s", "", "v:lua.tab_complete()", {expr = true}) -map("i", "", "v:lua.s_tab_complete()", {expr = true}) -map("s", "", "v:lua.s_tab_complete()", {expr = true}) - -map('i', '', 'compe#confirm("")', { expr = true }) -map('i', '', 'compe#complete()', { expr = true }) diff --git a/lua/native-lsp/nvim-lsp-installer.lua b/lua/native-lsp/nvim-lsp-installer.lua deleted file mode 100644 index 3e74c80..0000000 --- a/lua/native-lsp/nvim-lsp-installer.lua +++ /dev/null @@ -1,75 +0,0 @@ -local lsp_installer = require("nvim-lsp-installer") - - -local lang_servers = { - "bashls", - "ccls", - "clangd", - "cmake", - "cssls", - "cssmodules_ls", - "diagnosticls", - "dockerls", - "dotls", - "efm", - --"eslint", - "emmet_ls", - --"grammarly", - "graphql", - "html", - --"hls", - "jsonls", - --"jdtls", - --"quick_lint_js", - "tsserver", - --"ltex", - "texlab", - "sumneko_lua", - "remark_ls", - --"zk", - "puppet", - --"jedi_language_server", - "pyright", - --"pylsp", - "sqlls", - --"sqls", - --"svelte", - "taplo", - --"tailwindcss", - --"tflint", -- going to use tsserver first - "lemminx", - "yamlls", - "zls", -} - -for _, name in pairs(lang_servers) do - local server_is_found, server = lsp_installer.get_server(name) - if server_is_found then - if not server:is_installed() then - print("Installing " .. name) - server:install() - end - end -end - - - -lsp_installer.on_server_ready(function(server) - local opts = {} - opts.on_attach = on_attach - opts.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) - - server:setup(opts) - vim.cmd [[ do User LspAttachBuffers ]] -end) - - -lsp_installer.settings({ - ui = { - icons = { - server_installed = "✓", - server_pending = "➜", - server_uninstalled = "✗" - } - } -}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index 1816eb1..0000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1,58 +0,0 @@ -require "paq" { - -- let paq manage itself - "savq/paq-nvim"; - - -- lsp - "neovim/nvim-lspconfig"; - {"williamboman/nvim-lsp-installer", branch="dont-prepare-root-dir"}; - - -- cmp - "hrsh7th/nvim-cmp"; - "hrsh7th/cmp-nvim-lsp"; - "hrsh7th/cmp-buffer"; - "hrsh7th/cmp-path"; - "hrsh7th/cmp-cmdline"; - "hrsh7th/cmp-nvim-lua"; - "hrsh7th/cmp-calc"; - "hrsh7th/cmp-emoji"; - "hrsh7th/cmp-latex-symbols"; - "octaltree/cmp-look"; - {"tzachar/cmp-tabnine", run="./install.sh"}; - - -- lua snips - "L3MON4D3/LuaSnip"; - "saadparwaiz1/cmp_luasnip"; - - -- diagnostics - "folke/trouble.nvim"; - "kyazdani42/nvim-web-devicons"; - - -- pandoc - "vim-pandoc/vim-pandoc"; - - -- zig ls - "zigtools/zls"; - - -- theme - "rakr/vim-one"; - - "mattn/emmet-vim"; - --{"lervag/vimtex", opt=true}; - - -- tree sitter - "nvim-treesitter/nvim-treesitter"; - "nvim-treesitter/nvim-treesitter-textobjects"; - "ray-x/cmp-treesitter"; - - "lukas-reineke/indent-blankline.nvim"; - - "kosayoda/nvim-lightbulb"; - - "turbio/bracey.vim"; - - -- git symbols - "lewis6991/gitsigns.nvim"; - "nvim-lua/plenary.nvim"; -} - -cmd 'PaqSync' diff --git a/lua/tree-sitter.lua b/lua/tree-sitter.lua deleted file mode 100644 index 6866e67..0000000 --- a/lua/tree-sitter.lua +++ /dev/null @@ -1,26 +0,0 @@ -cmd [[ -TSInstall bash -TSInstall bibtex -TSInstall c -TSInstall cmake -TSInstall cpp -TSInstall css -TSInstall dockerfile -TSInstall dot -TSInstall graphql -TSInstall html -TSInstall http -TSInstall javascript -TSInstall latex -TSInstall llvm -TSInstall lua -TSInstall make -TSInstall python -TSInstall regex -TSInstall verilog -TSInstall vim -TSInstall yaml -TSInstall zig -TSUpdate -]] - diff --git a/lua/ui/init.lua b/lua/ui/init.lua index 92a0402..352eca9 100755 --- a/lua/ui/init.lua +++ b/lua/ui/init.lua @@ -4,21 +4,21 @@ require('ui/statusbar') -- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options +local o = vim.o -- options +local go = vim.go -- only-global options +local bo = vim.bo -- buffer local options +local wo = vim.wo -- window local options --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object +local cmd = vim.cmd -- vim commands +local fn = vim.fn -- vim functions +local opt = vim.opt -- vim option object --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables +local g = vim.g -- global variables +local b = vim.b -- buffer local variables +local w = vim.w -- window local variables +local t = vim.t -- tab local variables +local v = vim.v -- variables +local env = vim.env -- environment variables @@ -30,8 +30,8 @@ o.showmatch = true -- matching bracket -- Completion Menu ---o.wildmenu = true ---o.wildmode = 'list:longest,full' +o.wildmenu = true +o.wildmode = 'list:longest,full' -- Character Representation @@ -104,9 +104,6 @@ autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929 autocmd BufEnter * match OverLength /\%71v.*/ ]]) --rewrite in lua --- Theme -o.background = "light" -cmd('colorscheme one') --WIP -- Filetype: txt, md, tex diff --git a/lua/ui/statusbar.lua b/lua/ui/statusbar.lua index 5613408..30b742a 100755 --- a/lua/ui/statusbar.lua +++ b/lua/ui/statusbar.lua @@ -2,21 +2,21 @@ -- use `&` to show value of vimscript variable -- API -- --- o = vim.o -- options --- go = vim.go -- only-global options --- bo = vim.bo -- buffer local options --- wo = vim.wo -- window local options +local o = vim.o -- options +local go = vim.go -- only-global options +local bo = vim.bo -- buffer local options +local wo = vim.wo -- window local options --- cmd = vim.cmd -- vim commands --- fn = vim.fn -- vim functions --- opt = vim.opt -- vim option object +local cmd = vim.cmd -- vim commands +local fn = vim.fn -- vim functions +local opt = vim.opt -- vim option object --- g = vim.g -- global variables --- b = vim.b -- buffer local variables --- w = vim.w -- window local variables --- t = vim.t -- tab local variables --- v = vim.v -- variables --- env = vim.env -- environment variables +local g = vim.g -- global variables +local b = vim.b -- buffer local variables +local w = vim.w -- window local variables +local t = vim.t -- tab local variables +local v = vim.v -- variables +local env = vim.env -- environment variables --Later generalize into plugin @@ -31,30 +31,27 @@ local function file_state() return "" end ---local function diagnostics() --- --local buffer_number = vim.fn.bufnr('%') --- local severity_levels = { --- -- level,prefix --- errors = {'Error', 'E:'}, --- warnings = {'Warning', 'W:'}, --- info = {'Information', 'I:'}, --- hints = {'Hint', 'H:'} --- } --- local out = '' --- for _,v in pairs(severity_levels) do --- local d = vim.diagnostic.get( --- 0, --- ) --- --local d = vim.lsp.diagnostic.get_count( --- -- buffer_number, --- -- v[1] -- level --- --) --- if d > 0 then --- out = out .. v[2] .. d .. ' ' --- end --- end --- return out ---end +local function diagnostics() + local buffer_number = vim.fn.bufnr('%') + local severity_levels = { + -- level,prefix + errors = {'Error', 'E:'}, + warnings = {'Warning', 'W:'}, + info = {'Information', 'I:'}, + hints = {'Hint', 'H:'} + } + local out = '' + for _,v in pairs(severity_levels) do + local d = vim.lsp.diagnostic.get_count( + buffer_number, + v[1] -- level + ) + if d > 0 then + out = out .. v[2] .. d .. ' ' + end + end + return out +end local function highlight(group, color) cmd('highlight ' .. group .. ' cterm='..color .. ' gui='..color) @@ -103,7 +100,7 @@ function status_bar() return table.concat(sections({ -- Stage Left {'%f', file_state()}, - --{diagnostics()}, + {diagnostics()}, '%=', -- Stage Right { diff --git a/startup.log b/startup.log deleted file mode 100644 index 0589a8b..0000000 --- a/startup.log +++ /dev/null @@ -1,61 +0,0 @@ - - -times in msec - clock self+sourced self: sourced script - clock elapsed: other lines - -000.009 000.009: --- NVIM STARTING --- -000.390 000.381: locale set -000.893 000.503: inits 1 -000.922 000.029: window checked -000.926 000.004: parsing arguments -001.077 000.151: expanding arguments -001.145 000.068: inits 2 -002.189 001.044: init highlight -002.193 000.004: waiting for UI -003.196 001.003: done waiting for UI -003.214 000.018: initialized screen early for UI -009.728 006.314 006.314: sourcing /root/.config/nvim/init.lua -009.754 000.225: sourcing vimrc file(s) -021.196 011.354 011.354: sourcing /usr/share/nvim/runtime/filetype.vim -021.810 000.059 000.059: sourcing /usr/share/nvim/runtime/ftplugin.vim -022.532 000.071 000.071: sourcing /usr/share/nvim/runtime/indent.vim -023.771 000.494 000.494: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim -024.549 001.396 000.902: sourcing /usr/share/nvim/runtime/syntax/synload.vim -024.743 001.696 000.300: sourcing /usr/share/nvim/runtime/syntax/syntax.vim -027.150 001.163 001.163: sourcing /usr/share/nvim/runtime/plugin/fzf.vim -027.554 000.358 000.358: sourcing /usr/share/nvim/runtime/plugin/gzip.vim -027.613 000.015 000.015: sourcing /usr/share/nvim/runtime/plugin/health.vim -027.739 000.105 000.105: sourcing /usr/share/nvim/runtime/plugin/man.vim -028.694 000.303 000.303: sourcing /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim -028.887 001.115 000.812: sourcing /usr/share/nvim/runtime/plugin/matchit.vim -029.133 000.223 000.223: sourcing /usr/share/nvim/runtime/plugin/matchparen.vim -030.083 000.921 000.921: sourcing /usr/share/nvim/runtime/plugin/netrwPlugin.vim -030.916 000.298 000.298: sourcing /usr/share/nvim/runtime/autoload/remote/host.vim -031.432 000.282 000.282: sourcing /usr/share/nvim/runtime/autoload/remote/define.vim -031.611 001.158 000.578: sourcing /root/.local/share/nvim/rplugin.vim -031.621 001.461 000.303: sourcing /usr/share/nvim/runtime/plugin/rplugin.vim -032.032 000.341 000.341: sourcing /usr/share/nvim/runtime/plugin/shada.vim -032.207 000.069 000.069: sourcing /usr/share/nvim/runtime/plugin/spellfile.vim -032.550 000.299 000.299: sourcing /usr/share/nvim/runtime/plugin/tarPlugin.vim -032.756 000.151 000.151: sourcing /usr/share/nvim/runtime/plugin/tohtml.vim -032.819 000.027 000.027: sourcing /usr/share/nvim/runtime/plugin/tutor.vim -033.183 000.330 000.330: sourcing /usr/share/nvim/runtime/plugin/zipPlugin.vim -033.746 004.235: loading plugins -034.276 000.302 000.302: sourcing /root/.local/share/nvim/site/pack/paqs/start/nvim-compe/plugin/compe.vim -044.324 009.813 009.813: sourcing /root/.local/share/nvim/site/pack/paqs/start/nvim-lspconfig/plugin/lspconfig.vim -044.861 001.001: loading packages -045.173 000.192 000.192: sourcing /root/.local/share/nvim/site/pack/paqs/start/nvim-compe/after/plugin/compe.vim -045.910 000.857: loading after plugins -045.931 000.021: inits 3 -053.990 008.060: reading ShaDa -055.259 000.842 000.842: sourcing /usr/share/nvim/runtime/scripts.vim -055.858 001.026: reading stdin -055.865 000.007: opening buffers -055.920 000.055: BufEnter autocommands -055.924 000.004: editing files in windows -056.040 000.116: VimEnter autocommands -056.043 000.003: UIEnter autocommands -056.045 000.002: before starting main loop -056.731 000.686: first screen update -056.736 000.005: --- NVIM STARTED --- diff --git a/test/startup_log.sh b/test/startup_log.sh deleted file mode 100755 index 5485f44..0000000 --- a/test/startup_log.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -rm startup.log -nvim --startuptime startup.log -cat startup.log