diff --git a/init.lua b/init.lua index a968659..e74f054 100755 --- a/init.lua +++ b/init.lua @@ -22,8 +22,7 @@ env = vim.env -- environment variables local modules = { 'general', 'keymap', - 'ui', - 'native-lsp' + 'ui' } local async diff --git a/lua/keymap/init.lua b/lua/keymap/init.lua index 568b57d..62f468b 100755 --- a/lua/keymap/init.lua +++ b/lua/keymap/init.lua @@ -275,28 +275,64 @@ 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/native-lsp/init.lua b/lua/native-lsp/init.lua deleted file mode 100644 index 71912b3..0000000 --- a/lua/native-lsp/init.lua +++ /dev/null @@ -1,181 +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/neovim/nvim-lspconfig -local lspconfig = require 'lspconfig' - -function lsp_init() - -- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md - local lsp_filetype = { - ['ada'] = {'als'}, - ['aspnetcorerazor'] = {'tailwindcss'}, - ['astro'] = {'tailwindcss'}, - ['astro-markdown'] = {'tailwindcss'}, - ['beancount'] = {'beancount'}, - ['bib'] = {'texlab'}, - ['bicep'] = {'bicep'}, - ['blade'] = {'tailwindcss'}, - ['c'] = {'ccls','clangd','sourcekit'}, - ['clojure'] = {'clojure_lsp'}, - ['cmake'] = {'cmake'}, - -- = {'config'}, - ['cpp'] = {'ccls','clangd','sourcekit'}, - ['crystal'] = {'crystalline','scry'}, - ['css'] = {'cssls','stylelint_lsp','tailwindcss'}, - ['d'] = {'serve_d'}, - ['dart'] = {'dartls'}, - ['dhall'] = {'dhall_lsp_server'}, - ['django-html'] = {'tailwindcss'}, - ['Dockerfile'] = {'dockerls'}, - ['dockerfile'] = {'dockerls'}, - ['dot'] = {'dotls'}, - -- = {'diagnostics'}, - ['edge'] = {'tailwindcss'}, - ['edn'] = {'clojure_lsp'}, - ['eelixir'] = {'elixirls','tailwindcss'}, - -- = {'efm'}, - ['elixir'] = {'elixirls'}, - ['elm'] = {'elmls'}, - ['ejs'] = {'tailwindcss'}, - ['erb'] = {'tailwindcss'}, - ['erlang'] = {'erlangls'}, - ['eruby'] = {'tailwindcss'}, - ['fortran'] = {'fortls'}, - ['fsharp'] = {'fsautocomplete'}, - ['gd'] = {'gdscript'}, - ['gdscript'] = {'gdscript'}, - ['gdscript3'] = {'gdscript'}, - ['genie'] = {'vala_ls'}, - ['go'] = {'gopls'}, - ['gohtml'] = {'tailwindcss'}, - ['gomod'] = {'gopls'}, - ['graphql'] = {'graphql'}, - ['groovy'] = {'groovyls'}, - ['haml'] = {'tailwindcss'}, - ['handlebars'] = {'ember','tailwindcss'}, - ['haskell'] = {'ghcide','hie','hls'}, - ['haxe'] = {'haxe_language_server'}, - ['hbs'] = {'tailwindcss'}, - -- = {'health'}, - ['help'] = {}, - ['html'] = {'angular','html','tailwindcss'}, - ['html-eex'] = {'tailwindcss'}, - ['jade'] = {'tailwindcss'}, - ['java'] = {'java_language_server','jdtls'}, - ['javascript'] = {'denols','ember','flow','rome','stylelint_lsp','tsserver','tailwindcss'}, - ['javascriptreact'] = {'denols','flow','rome','stylelint_lsp','tsserver','tailwindcss'}, - ['javascript.jsx'] = {'denols','flow','tsserver'}, - ['json'] = {'jsonls','rome'}, - ['julia'] = {'julials'}, - ['kotlin'] = {'kotlin_language_server'}, - ['leaf'] = {'tailwindcss'}, - ['lean'] = {'leanls'}, - ['lean3'] = {'lean3ls'}, - ['less'] = {'cssls','stylelint_lsp','tailwindcss'}, - ['lhaskell'] = {'ghcide','hls'}, - -- = {'lspinfo'}, - ['liquid'] = {'tailwindcss'}, - ['lua'] = {'sumneko_lua'}, - ['markdown'] = {'zeta_note','tailwindcss'}, - ['mdx'] = {'tailwindcss'}, - ['mint'] = {'mint'}, - ['mustache'] = {'tailwindcss'}, - ['mysql'] = {'sqlls','sqls'}, - ['nim'] = {'nimls'}, - ['nix'] = {'rnix'}, - ['njk'] = {'tailwindcss'}, - ['nunjucks'] = {'tailwindcss'}, - ['objc'] = {'ccls','clangd'}, - ['objcpp'] = {'ccls','clangd'}, - ['objective-c'] = {'sourcekit'}, - ['objective-cpp'] = {'sourcekit'}, - ['ocaml'] = {'ocamlls','ocamllsp'}, - ['ocaml.menhir'] = {'ocamllsp'}, - ['ocaml.interface'] = {'ocamllsp'}, - ['ocaml.ocamllex'] = {'ocamllsp'}, - ['perl'] = {'perlls','perlpls'}, - ['php'] = {'intelephense','phpactor','tailwindcss'}, - ['prisma'] = {'prismals'}, - ['ps1'] = {'powershell_es'}, - ['puppet'] = {'puppet'}, - ['purescript'] = {'purescriptls'}, - ['python'] = {'jedi_language_server','pylsp','pyright'}, - ['ql'] = {'codeqlls'}, - ['r'] = {'r_language_server'}, - ['racket'] = {'racket_langserver'}, - ['razor'] = {'tailwindcss'}, - ['reason'] = {'ocamlls','ocamllsp','tailwindcss'}, - ['rescript'] = {'rescript','tailwindcss'}, - ['rmd'] = {'r_language_server'}, - ['ruby'] = {'solargraph','sorbet'}, - ['rust'] = {'rls','rust_analyzer'}, - ['sass'] = {'tailwindcss'}, - ['scala'] = {'metals'}, - ['scheme'] = {'racket_langserver'}, - ['scss'] = {'cssls','stylelint_lsp','tailwindcss'}, - ['sh'] = {'bashls'}, - ['slim'] = {'tailwindcss'}, - ['stylus'] = {'tailwindcss'}, - ['sql'] = {'sqlls','sqls'}, - ['sugarss'] = {'stylelint_lsp','tailwindcss'}, - ['svelte'] = {'svelte','tailwindcss'}, - ['swift'] = {'source'}, - ['systemverilog'] = {'svls'}, - ['tex'] = {'texlab'}, - ['terraform'] = {'tflint','teraformls'}, - ['twig'] = {'tailwindcss'}, - ['typescript'] = {'angular', 'denols','ember','rome','stylelint_lsp','tsserver','tailwindcss'}, - ['typescriptreact'] = {'angular', 'denols','rome','stylelint_lsp','tsserver','tailwindcss'}, - ['typescript.tsx'] = {'angular', 'denols','rome','tsserver'}, - -- = {'util'}, - ['vala'] = {'vala_ls'}, - ['verilog'] = {'svls'}, - ['vim'] = {'vimls'}, - ['vlang'] = {'vls'}, - ['vue'] = {'stylelint_lsp','vuels','tailwindcss'}, - ['wxss'] = {'stylelint_lsp'}, - ['yaml'] = {'ansiblels','yamlls'}, - ['zig'] = {'zls'}, - ['zir'] = {'zls'} - } - - for _,server in pairs(lsp_filetype[bo.filetype]) do - lspconfig[server].setup {} - end -end - -function lsp_format() - local function format_file() - if bo.filetype == x then - vim.lsp.formatting_sync(nil, 100) - end - end - - for _,file in pairs({'javascript', 'python'}) do - format_file(file) - end -end - -cmd('autocmd BufRead * lua lsp_init()') -cmd('autocmd BufWritePre * lua lsp_format()') - - -require 'nvim-compe.lua' 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/scripts/install_bashls_server.sh b/scripts/install_bashls_server.sh deleted file mode 100644 index fab818a..0000000 --- a/scripts/install_bashls_server.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep 'npm' - -if response == 'y' then - npm -i -g bash-language-server -fi diff --git a/scripts/install_ccls_server.sh b/scripts/install_ccls_server.sh deleted file mode 100644 index 5f0056b..0000000 --- a/scripts/install_ccls_server.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep 'CMake' -query_dep 'C++17' -query_dep ' - -if response == 'y' then - cd builds - git clone --depth=1 --recursive https://github.com/MaskRay/ccls - cd ccls - cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/path/to/clang+llvm-xxx - cmake --build Release -fi diff --git a/scripts/install_clangd_server.sh b/scripts/install_clangd_server.sh deleted file mode 100644 index 0e5e707..0000000 --- a/scripts/install_clangd_server.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -printf 'Install from clang-tools or similar ' -printf 'with your OS or from releases on LLVM site\n' diff --git a/scripts/install_pylsp_server.sh b/scripts/install_pylsp_server.sh deleted file mode 100644 index 9f2ada2..0000000 --- a/scripts/install_pylsp_server.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep 'pip' - -if response == 'y' then - pip install python-lsp-server -fi diff --git a/scripts/install_pyright_server.sh b/scripts/install_pyright_server.sh deleted file mode 100644 index 383039b..0000000 --- a/scripts/install_pyright_server.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep 'npm' - -if response == 'y' then - npm -i -g pyright -fi diff --git a/scripts/install_sumneko_lua.sh b/scripts/install_sumneko_lua.sh deleted file mode 100644 index cd5b854..0000000 --- a/scripts/install_sumneko_lua.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep 'ninja' -query_dep 'C++17' - -if $response == 'y' then - mkdir -p builds - cd builds - git clone https://github.com/sumneko/lua-language-server - cd lua-language-server - git submodule update --init --recursive - cd 3rd/luamake - compile/install.sh - cd ../.. - ./3rd/luamake/luamake rebuild -fi diff --git a/scripts/install_zls_server.sh b/scripts/install_zls_server.sh deleted file mode 100644 index f8fbd3d..0000000 --- a/scripts/install_zls_server.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -source scripts/query_dependencies.sh -query_dep "xz or xz-utils" - -if response == 'y' then - mkdir -p builds/zls - cd builds/zls - curl -L https://github.com/zigtools/zls/releases/download/0.1.0/x86_64-linux.tar.xz | tar -xJ --strip-components=1 -C . -fi diff --git a/scripts/query_dependency.sh b/scripts/query_dependency.sh deleted file mode 100644 index 1cef7d5..0000000 --- a/scripts/query_dependency.sh +++ /dev/null @@ -1,7 +0,0 @@ -function query_dep(){ - printf 'Did you install ' - printf $1 - printf '?\n (y/N)' - response='n' - read response -} 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