diff options
-rw-r--r-- | ftplugin/cmake.lua (renamed from lua/lsp/cmake-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/cpp.lua (renamed from lua/lsp/clangd.lua) | 0 | ||||
-rw-r--r-- | ftplugin/css.lua (renamed from lua/lsp/css-ls.lua) | 1 | ||||
-rw-r--r-- | ftplugin/css.vim | 1 | ||||
-rw-r--r-- | ftplugin/dart.lua (renamed from lua/lsp/dart-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/docker.lua (renamed from lua/lsp/docker-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/elixir.lua (renamed from lua/lsp/elixir-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/elm.lua (renamed from lua/lsp/elm-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/go.lua (renamed from lua/lsp/go-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/graphql.lua (renamed from lua/lsp/graphql-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/html.lua (renamed from lua/lsp/html-ls.lua) | 1 | ||||
-rw-r--r-- | ftplugin/html.vim | 1 | ||||
-rw-r--r-- | ftplugin/java.lua (renamed from lua/lsp/java-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/javascript.lua (renamed from lua/lsp/js-ts-ls.lua) | 1 | ||||
-rw-r--r-- | ftplugin/javascript.vim | 1 | ||||
-rw-r--r-- | ftplugin/javascriptreact.lua | 68 | ||||
-rw-r--r-- | ftplugin/javascriptreact.vim | 1 | ||||
-rw-r--r-- | ftplugin/json.lua (renamed from lua/lsp/json-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/kotlin.lua (renamed from lua/lsp/kotlin-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/latex.lua (renamed from lua/lsp/latex-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/lua.lua (renamed from lua/lsp/lua-ls.lua) | 30 | ||||
-rw-r--r-- | ftplugin/php.lua (renamed from lua/lsp/php-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/python.lua (renamed from lua/lsp/python-ls.lua) | 49 | ||||
-rw-r--r-- | ftplugin/ruby.lua (renamed from lua/lsp/ruby-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/rust.lua (renamed from lua/lsp/rust-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/sh.lua | 33 | ||||
-rw-r--r-- | ftplugin/tf.lua (renamed from lua/lsp/terraform-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/typescript.lua | 68 | ||||
-rw-r--r-- | ftplugin/typescriptreact.lua | 88 | ||||
-rw-r--r-- | ftplugin/vim.lua (renamed from lua/lsp/vim-ls.lua) | 0 | ||||
-rw-r--r-- | ftplugin/vue.lua (renamed from lua/lsp/vue-ls.lua) | 1 | ||||
-rw-r--r-- | ftplugin/yaml.lua (renamed from lua/lsp/yaml-ls.lua) | 1 | ||||
-rw-r--r-- | ftplugin/yaml.vim | 1 | ||||
-rw-r--r-- | ftplugin/zsh.lua | 40 | ||||
-rw-r--r-- | init.lua | 34 | ||||
-rw-r--r-- | lua/default-config.lua | 46 | ||||
-rw-r--r-- | lua/lsp/angular-ls.lua | 1 | ||||
-rw-r--r-- | lua/lsp/bash-ls.lua | 6 | ||||
-rw-r--r-- | lua/lsp/efm-general-ls.lua | 61 | ||||
-rw-r--r-- | lua/lsp/emmet-ls.lua | 2 | ||||
-rw-r--r-- | lua/lsp/svelte-ls.lua | 1 | ||||
-rw-r--r-- | lua/lsp/tailwindcss-ls.lua | 1 | ||||
-rw-r--r-- | lua/lv-autopairs/init.lua | 1 | ||||
-rw-r--r-- | lua/plugins.lua | 3 | ||||
-rw-r--r-- | lv-config.lua | 4 |
45 files changed, 404 insertions, 142 deletions
diff --git a/lua/lsp/cmake-ls.lua b/ftplugin/cmake.lua index a9647118..a9647118 100644 --- a/lua/lsp/cmake-ls.lua +++ b/ftplugin/cmake.lua diff --git a/lua/lsp/clangd.lua b/ftplugin/cpp.lua index 594c375b..594c375b 100644 --- a/lua/lsp/clangd.lua +++ b/ftplugin/cpp.lua diff --git a/lua/lsp/css-ls.lua b/ftplugin/css.lua index f68256a4..4affb45e 100644 --- a/lua/lsp/css-ls.lua +++ b/ftplugin/css.lua @@ -6,3 +6,4 @@ require'lspconfig'.cssls.setup { }, on_attach = require'lsp'.common_on_attach } +vim.cmd("setl ts=2 sw=2") diff --git a/ftplugin/css.vim b/ftplugin/css.vim deleted file mode 100644 index eadd3f51..00000000 --- a/ftplugin/css.vim +++ /dev/null @@ -1 +0,0 @@ -setl ts=2 sw=2 diff --git a/lua/lsp/dart-ls.lua b/ftplugin/dart.lua index fe4898e8..fe4898e8 100644 --- a/lua/lsp/dart-ls.lua +++ b/ftplugin/dart.lua diff --git a/lua/lsp/docker-ls.lua b/ftplugin/docker.lua index b477a239..b477a239 100644 --- a/lua/lsp/docker-ls.lua +++ b/ftplugin/docker.lua diff --git a/lua/lsp/elixir-ls.lua b/ftplugin/elixir.lua index 418b4c4d..418b4c4d 100644 --- a/lua/lsp/elixir-ls.lua +++ b/ftplugin/elixir.lua diff --git a/lua/lsp/elm-ls.lua b/ftplugin/elm.lua index 3572a607..3572a607 100644 --- a/lua/lsp/elm-ls.lua +++ b/ftplugin/elm.lua diff --git a/lua/lsp/go-ls.lua b/ftplugin/go.lua index b2d6a82a..b2d6a82a 100644 --- a/lua/lsp/go-ls.lua +++ b/ftplugin/go.lua diff --git a/lua/lsp/graphql-ls.lua b/ftplugin/graphql.lua index 0bd97ed5..0bd97ed5 100644 --- a/lua/lsp/graphql-ls.lua +++ b/ftplugin/graphql.lua diff --git a/lua/lsp/html-ls.lua b/ftplugin/html.lua index f3027fb8..26f149d5 100644 --- a/lua/lsp/html-ls.lua +++ b/ftplugin/html.lua @@ -7,3 +7,4 @@ require'lspconfig'.html.setup { on_attach = require'lsp'.common_on_attach, capabilities = capabilities } +vim.cmd("setl ts=2 sw=2") diff --git a/ftplugin/html.vim b/ftplugin/html.vim deleted file mode 100644 index eadd3f51..00000000 --- a/ftplugin/html.vim +++ /dev/null @@ -1 +0,0 @@ -setl ts=2 sw=2 diff --git a/lua/lsp/java-ls.lua b/ftplugin/java.lua index 0b151b66..0b151b66 100644 --- a/lua/lsp/java-ls.lua +++ b/ftplugin/java.lua diff --git a/lua/lsp/js-ts-ls.lua b/ftplugin/javascript.lua index 6fe4dd63..173f6693 100644 --- a/lua/lsp/js-ts-ls.lua +++ b/ftplugin/javascript.lua @@ -65,3 +65,4 @@ if O.lang.tsserver.autoformat then } }) end +vim.cmd("setl ts=2 sw=2") diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim deleted file mode 100644 index eadd3f51..00000000 --- a/ftplugin/javascript.vim +++ /dev/null @@ -1 +0,0 @@ -setl ts=2 sw=2 diff --git a/ftplugin/javascriptreact.lua b/ftplugin/javascriptreact.lua new file mode 100644 index 00000000..173f6693 --- /dev/null +++ b/ftplugin/javascriptreact.lua @@ -0,0 +1,68 @@ +-- npm install -g typescript typescript-language-server +-- require'snippets'.use_suggested_mappings() +-- local capabilities = vim.lsp.protocol.make_client_capabilities() +-- capabilities.textDocument.completion.completionItem.snippetSupport = true; +-- local on_attach_common = function(client) +-- print("LSP Initialized") +-- require'completion'.on_attach(client) +-- require'illuminate'.on_attach(client) +-- end +require'lspconfig'.tsserver.setup { + cmd = { + DATA_PATH .. + "/lspinstall/typescript/node_modules/.bin/typescript-language-server", + "--stdio" + }, + filetypes = { + "javascript", "javascriptreact", "javascript.jsx", "typescript", + "typescriptreact", "typescript.tsx" + }, + on_attach = require'lsp'.tsserver_on_attach, + -- This makes sure tsserver is not used for formatting (I prefer prettier) + -- on_attach = require'lsp'.common_on_attach, + root_dir = require('lspconfig/util').root_pattern("package.json", + "tsconfig.json", + "jsconfig.json", ".git"), + settings = {documentFormatting = false}, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.lang.tsserver.diagnostics.virtual_text, + signs = O.lang.tsserver.diagnostics.signs, + underline = O.lang.tsserver.diagnostics.underline, + update_in_insert = true + + }) + } +} + +if O.lang.tsserver.autoformat then + require('lv-utils').define_augroups({ + _javascript_autoformat = { + { + + 'BufWritePre', '*.js', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _javascriptreact_autoformat = { + { + 'BufWritePre', '*.jsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescript_autoformat = { + { + 'BufWritePre', '*.ts', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescriptreact_autoformat = { + { + 'BufWritePre', '*.tsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + } + }) +end +vim.cmd("setl ts=2 sw=2") diff --git a/ftplugin/javascriptreact.vim b/ftplugin/javascriptreact.vim deleted file mode 100644 index 11332b5c..00000000 --- a/ftplugin/javascriptreact.vim +++ /dev/null @@ -1 +0,0 @@ -setl commentstring={/*%s*/} ts=2 sw=2 diff --git a/lua/lsp/json-ls.lua b/ftplugin/json.lua index 3a565095..3a565095 100644 --- a/lua/lsp/json-ls.lua +++ b/ftplugin/json.lua diff --git a/lua/lsp/kotlin-ls.lua b/ftplugin/kotlin.lua index fcbb736b..fcbb736b 100644 --- a/lua/lsp/kotlin-ls.lua +++ b/ftplugin/kotlin.lua diff --git a/lua/lsp/latex-ls.lua b/ftplugin/latex.lua index 179c143c..179c143c 100644 --- a/lua/lsp/latex-ls.lua +++ b/ftplugin/latex.lua diff --git a/lua/lsp/lua-ls.lua b/ftplugin/lua.lua index 4257605f..cfcd9b92 100644 --- a/lua/lsp/lua-ls.lua +++ b/ftplugin/lua.lua @@ -39,3 +39,33 @@ if O.lang.lua.autoformat then }) end +local lua_arguments = {} + +local luaFormat = { + formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80", + formatStdin = true +} + +local lua_fmt = { + formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", + formatStdin = true +} + +if O.lang.lua.formatter == 'lua-format' then + table.insert(lua_arguments, luaFormat) +elseif O.lang.lua.formatter == 'lua-fmt' then + table.insert(lua_arguments, lua_fmt) +end + +require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"lua"}, + settings = { + rootMarkers = {".git/"}, + languages = { + lua = lua_arguments, + } + } +} diff --git a/lua/lsp/php-ls.lua b/ftplugin/php.lua index abc90092..abc90092 100644 --- a/lua/lsp/php-ls.lua +++ b/ftplugin/php.lua diff --git a/lua/lsp/python-ls.lua b/ftplugin/python.lua index e2ccf42e..7ae0d6fd 100644 --- a/lua/lsp/python-ls.lua +++ b/ftplugin/python.lua @@ -1,3 +1,52 @@ +local python_arguments = {} + +-- TODO replace with path argument +local flake8 = { + LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"} +} + +local isort = {formatCommand = "isort --quiet -", formatStdin = true} + +local yapf = {formatCommand = "yapf --quiet", formatStdin = true} +local black = {formatCommand = "black --quiet -", formatStdin = true} + +if O.lang.python.linter == 'flake8' then table.insert(python_arguments, flake8) end + +if O.lang.python.isort then table.insert(python_arguments, isort) end + +if O.lang.python.formatter == 'yapf' then + table.insert(python_arguments, yapf) +elseif O.lang.python.formatter == 'black' then + table.insert(python_arguments, black) +end + +require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "yaml", "markdown", "vue"}, + settings = { + rootMarkers = {".git/", "requirements.txt"}, + languages = { + python = python_arguments, + } + } +} + + + + + + + + + + + + + -- npm i -g pyright require'lspconfig'.pyright.setup { cmd = { diff --git a/lua/lsp/ruby-ls.lua b/ftplugin/ruby.lua index f46a71f8..f46a71f8 100644 --- a/lua/lsp/ruby-ls.lua +++ b/ftplugin/ruby.lua diff --git a/lua/lsp/rust-ls.lua b/ftplugin/rust.lua index d210cadb..d210cadb 100644 --- a/lua/lsp/rust-ls.lua +++ b/ftplugin/rust.lua diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua new file mode 100644 index 00000000..7d9312f6 --- /dev/null +++ b/ftplugin/sh.lua @@ -0,0 +1,33 @@ +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup { + cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, + on_attach = require'lsp'.common_on_attach, + filetypes = { "sh", "zsh" } +} + +-- sh +local sh_arguments = {} + +local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} + +local shellcheck = { + LintCommand = 'shellcheck -f gcc -x', + lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'} +} + +if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end + +if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end + +require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"sh"}, + settings = { + rootMarkers = {".git/"}, + languages = { + sh = sh_arguments, + } + } +} diff --git a/lua/lsp/terraform-ls.lua b/ftplugin/tf.lua index a2e751a4..a2e751a4 100644 --- a/lua/lsp/terraform-ls.lua +++ b/ftplugin/tf.lua diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua new file mode 100644 index 00000000..173f6693 --- /dev/null +++ b/ftplugin/typescript.lua @@ -0,0 +1,68 @@ +-- npm install -g typescript typescript-language-server +-- require'snippets'.use_suggested_mappings() +-- local capabilities = vim.lsp.protocol.make_client_capabilities() +-- capabilities.textDocument.completion.completionItem.snippetSupport = true; +-- local on_attach_common = function(client) +-- print("LSP Initialized") +-- require'completion'.on_attach(client) +-- require'illuminate'.on_attach(client) +-- end +require'lspconfig'.tsserver.setup { + cmd = { + DATA_PATH .. + "/lspinstall/typescript/node_modules/.bin/typescript-language-server", + "--stdio" + }, + filetypes = { + "javascript", "javascriptreact", "javascript.jsx", "typescript", + "typescriptreact", "typescript.tsx" + }, + on_attach = require'lsp'.tsserver_on_attach, + -- This makes sure tsserver is not used for formatting (I prefer prettier) + -- on_attach = require'lsp'.common_on_attach, + root_dir = require('lspconfig/util').root_pattern("package.json", + "tsconfig.json", + "jsconfig.json", ".git"), + settings = {documentFormatting = false}, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.lang.tsserver.diagnostics.virtual_text, + signs = O.lang.tsserver.diagnostics.signs, + underline = O.lang.tsserver.diagnostics.underline, + update_in_insert = true + + }) + } +} + +if O.lang.tsserver.autoformat then + require('lv-utils').define_augroups({ + _javascript_autoformat = { + { + + 'BufWritePre', '*.js', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _javascriptreact_autoformat = { + { + 'BufWritePre', '*.jsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescript_autoformat = { + { + 'BufWritePre', '*.ts', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescriptreact_autoformat = { + { + 'BufWritePre', '*.tsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + } + }) +end +vim.cmd("setl ts=2 sw=2") diff --git a/ftplugin/typescriptreact.lua b/ftplugin/typescriptreact.lua new file mode 100644 index 00000000..40c68c51 --- /dev/null +++ b/ftplugin/typescriptreact.lua @@ -0,0 +1,88 @@ +-- npm install -g typescript typescript-language-server +-- require'snippets'.use_suggested_mappings() +-- local capabilities = vim.lsp.protocol.make_client_capabilities() +-- capabilities.textDocument.completion.completionItem.snippetSupport = true; +-- local on_attach_common = function(client) +-- print("LSP Initialized") +-- require'completion'.on_attach(client) +-- require'illuminate'.on_attach(client) +-- end +require'lspconfig'.tsserver.setup { + cmd = { + DATA_PATH .. + "/lspinstall/typescript/node_modules/.bin/typescript-language-server", + "--stdio" + }, + filetypes = { + "javascript", "javascriptreact", "javascript.jsx", "typescript", + "typescriptreact", "typescript.tsx" + }, + on_attach = require'lsp'.tsserver_on_attach, + -- This makes sure tsserver is not used for formatting (I prefer prettier) + -- on_attach = require'lsp'.common_on_attach, + root_dir = require('lspconfig/util').root_pattern("package.json", + "tsconfig.json", + "jsconfig.json", ".git"), + settings = {documentFormatting = false}, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.lang.tsserver.diagnostics.virtual_text, + signs = O.lang.tsserver.diagnostics.signs, + underline = O.lang.tsserver.diagnostics.underline, + update_in_insert = true + + }) + } +} + +if O.lang.tsserver.autoformat then + require('lv-utils').define_augroups({ + _javascript_autoformat = { + { + + 'BufWritePre', '*.js', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _javascriptreact_autoformat = { + { + 'BufWritePre', '*.jsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescript_autoformat = { + { + 'BufWritePre', '*.ts', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }, + _typescriptreact_autoformat = { + { + 'BufWritePre', '*.tsx', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + } + }) +end +vim.cmd("setl ts=2 sw=2") + +local nvim_lsp = require'lspconfig' +local configs = require'lspconfig/configs' +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +configs.emmet_ls = { + default_config = { + cmd = {'emmet-ls', '--stdio'}; + filetypes = {'html', 'css', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}; + root_dir = function() + return vim.loop.cwd() + end; + settings = {}; + }; +} + +nvim_lsp.emmet_ls.setup{ + -- on_attach = on_attach; +} diff --git a/lua/lsp/vim-ls.lua b/ftplugin/vim.lua index 39beb119..39beb119 100644 --- a/lua/lsp/vim-ls.lua +++ b/ftplugin/vim.lua diff --git a/lua/lsp/vue-ls.lua b/ftplugin/vue.lua index f18fe2ab..66fba01e 100644 --- a/lua/lsp/vue-ls.lua +++ b/ftplugin/vue.lua @@ -1,4 +1,3 @@ - require('lspconfig').vuels.setup { cmd = {DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio"}, on_attach = require'lsp'.common_on_attach, diff --git a/lua/lsp/yaml-ls.lua b/ftplugin/yaml.lua index 3fbc41e4..7b6f9a25 100644 --- a/lua/lsp/yaml-ls.lua +++ b/ftplugin/yaml.lua @@ -3,3 +3,4 @@ require'lspconfig'.yamlls.setup{ cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"}, on_attach = require'lsp'.common_on_attach, } +vim.cmd("setl ts=2 sw=2 ts=2 ai et") diff --git a/ftplugin/yaml.vim b/ftplugin/yaml.vim deleted file mode 100644 index dcb1b038..00000000 --- a/ftplugin/yaml.vim +++ /dev/null @@ -1 +0,0 @@ -setl ts=2 sw=2 ts=2 ai et diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua new file mode 100644 index 00000000..7e99ebd3 --- /dev/null +++ b/ftplugin/zsh.lua @@ -0,0 +1,40 @@ +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup { + cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, + on_attach = require'lsp'.common_on_attach, + filetypes = { "sh", "zsh" } +} + +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup { + cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, + on_attach = require'lsp'.common_on_attach, + filetypes = { "sh", "zsh" } +} + +-- sh +local sh_arguments = {} + +local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} + +local shellcheck = { + LintCommand = 'shellcheck -f gcc -x', + lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'} +} + +if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end + +if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end + +require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"zsh"}, + settings = { + rootMarkers = {".git/"}, + languages = { + sh = sh_arguments, + } + } +} @@ -8,39 +8,5 @@ require('keymappings') require('lv-galaxyline') require('lv-treesitter') require('lv-which-key') - --- LSP require('lsp') --- TODO should I put this in the filetype files? -if O.lang.java.active then require('lsp.java-ls') end -if O.lang.clang.active then require('lsp.clangd') end -if O.lang.sh.active then require('lsp.bash-ls') end -if O.lang.cmake.active then require('lsp.cmake-ls') end -if O.lang.css.active then require('lsp.css-ls') end -if O.lang.dart.active then require('lsp.dart-ls') end -if O.lang.docker.active then require('lsp.docker-ls') end -if O.lang.efm.active then require('lsp.efm-general-ls') end -if O.lang.elm.active then require('lsp.elm-ls') end if O.lang.emmet.active then require('lsp.emmet-ls') end -if O.lang.graphql.active then require('lsp.graphql-ls') end -if O.lang.go.active then require('lsp.go-ls') end -if O.lang.html.active then require('lsp.html-ls') end -if O.lang.json.active then require('lsp.json-ls') end -if O.lang.kotlin.active then require('lsp.kotlin-ls') end -if O.lang.latex.active then require('lsp.latex-ls') end -if O.lang.lua.active then require('lsp.lua-ls') end -if O.lang.php.active then require('lsp.php-ls') end -if O.lang.python.active then require('lsp.python-ls') end -if O.lang.ruby.active then require('lsp.ruby-ls') end -if O.lang.rust.active then require('lsp.rust-ls') end -if O.lang.svelte.active then require('lsp.svelte-ls') end -if O.lang.terraform.active then require('lsp.terraform-ls') end -if O.lang.tailwindcss.active then require('lsp.tailwindcss-ls') end -if O.lang.vim.active then require('lsp.vim-ls') end -if O.lang.yaml.active then require('lsp.yaml-ls') end -if O.lang.elixir.active then require('lsp.elixir-ls') end -if O.lang.tsserver.active then - require('lsp.js-ts-ls') - require('lsp.angular-ls') - require('lsp.vue-ls') -end diff --git a/lua/default-config.lua b/lua/default-config.lua index 407e4c1f..efb94f01 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -67,7 +67,6 @@ O = { lang = { python = { - active = false, linter = '', -- @usage can be 'yapf', 'black' formatter = '', @@ -85,11 +84,9 @@ O = { } }, dart = { - active = false, sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot' }, lua = { - active = false, -- @usage can be 'lua-format' formatter = '', autoformat = false, @@ -100,7 +97,6 @@ O = { } }, sh = { - active = false, -- @usage can be 'shellcheck' linter = '', -- @usage can be 'shfmt' @@ -113,7 +109,6 @@ O = { } }, tsserver = { - active = false, -- @usage can be 'eslint' linter = '', -- @usage can be 'prettier' @@ -126,7 +121,6 @@ O = { } }, json = { - active = false, -- @usage can be 'prettier' formatter = '', autoformat = false, @@ -137,14 +131,12 @@ O = { } }, tailwindcss = { - active = false, filetypes = { 'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' } }, clang = { - active = false, diagnostics = { virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, @@ -152,7 +144,6 @@ O = { } }, ruby = { - active = false, diagnostics = { virtualtext = {spacing = 0, prefix = "ï„‘"}, signs = true, @@ -160,13 +151,12 @@ O = { }, filetypes = {'rb', 'erb', 'rakefile'} }, - go = {active = false}, - elixir = {active = false}, - vim = {active = false}, - yaml = {active = false}, - terraform = {active = false}, + go = {}, + elixir = {}, + vim = {}, + yaml = {}, + terraform = {}, rust = { - active = false, linter = '', formatter = '', autoformat = false, @@ -176,21 +166,19 @@ O = { underline = true } }, - svelte = {active = false}, - php = {active = false}, - latex = {active = false}, - kotlin = {active = false}, - html = {active = false}, - elm = {active = false}, - emmet = {active = false}, - graphql = {active = false}, - efm = {active = true}, - docker = {active = false}, - cmake = {active = false}, - java = {active = false}, + svelte = {}, + php = {}, + latex = {}, + kotlin = {}, + html = {}, + elm = {}, + emmet = {active = true}, + graphql = {}, + efm = {}, + docker = {}, + cmake = {}, + java = {}, css = { - active = false, - formatter = '', autoformat = false, virtual_text = true diff --git a/lua/lsp/angular-ls.lua b/lua/lsp/angular-ls.lua index 9f5e6245..64a66c21 100644 --- a/lua/lsp/angular-ls.lua +++ b/lua/lsp/angular-ls.lua @@ -1,3 +1,4 @@ +-- TODO find correct root filetype -- :LspInstall angular require'lspconfig'.angularls.setup { cmd = {DATA_PATH .. "/lspinstall/angular/node_modules/@angular/language-server/bin/ngserver", "--stdio"}, diff --git a/lua/lsp/bash-ls.lua b/lua/lsp/bash-ls.lua deleted file mode 100644 index 7b430a6e..00000000 --- a/lua/lsp/bash-ls.lua +++ /dev/null @@ -1,6 +0,0 @@ --- npm i -g bash-language-server -require'lspconfig'.bashls.setup { - cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, - on_attach = require'lsp'.common_on_attach, - filetypes = { "sh", "zsh" } -} diff --git a/lua/lsp/efm-general-ls.lua b/lua/lsp/efm-general-ls.lua index d85bc216..8b4b8449 100644 --- a/lua/lsp/efm-general-ls.lua +++ b/lua/lsp/efm-general-ls.lua @@ -1,62 +1,4 @@ -- Example configuations here: https://github.com/mattn/efm-langserver --- TODO this file needs to be refactored eache lang should be it's own file --- python -local python_arguments = {} - --- TODO replace with path argument -local flake8 = { - LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", - lintStdin = true, - lintFormats = {"%f:%l:%c: %m"} -} - -local isort = {formatCommand = "isort --quiet -", formatStdin = true} - -local yapf = {formatCommand = "yapf --quiet", formatStdin = true} -local black = {formatCommand = "black --quiet -", formatStdin = true} - -if O.lang.python.linter == 'flake8' then table.insert(python_arguments, flake8) end - -if O.lang.python.isort then table.insert(python_arguments, isort) end - -if O.lang.python.formatter == 'yapf' then - table.insert(python_arguments, yapf) -elseif O.lang.python.formatter == 'black' then - table.insert(python_arguments, black) -end - --- lua -local lua_arguments = {} - -local luaFormat = { - formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80", - formatStdin = true -} - -local lua_fmt = { - formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", - formatStdin = true -} - -if O.lang.lua.formatter == 'lua-format' then - table.insert(lua_arguments, luaFormat) -elseif O.lang.lua.formatter == 'lua-fmt' then - table.insert(lua_arguments, lua_fmt) -end - --- sh -local sh_arguments = {} - -local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} - -local shellcheck = { - LintCommand = 'shellcheck -f gcc -x', - lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'} -} - -if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end - -if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end -- tsserver/web javascript react, vue, json, html, css, yaml local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true} @@ -96,9 +38,6 @@ require"lspconfig".efm.setup { settings = { rootMarkers = {".git/"}, languages = { - python = python_arguments, - lua = lua_arguments, - sh = sh_arguments, javascript = tsserver_args, javascriptreact = tsserver_args, typescript = tsserver_args, diff --git a/lua/lsp/emmet-ls.lua b/lua/lsp/emmet-ls.lua index 6531ccf0..46d6c90d 100644 --- a/lua/lsp/emmet-ls.lua +++ b/lua/lsp/emmet-ls.lua @@ -6,7 +6,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true configs.emmet_ls = { default_config = { cmd = {'emmet-ls', '--stdio'}; - filetypes = {'html', 'css'}; + filetypes = {'html', 'css', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}; root_dir = function() return vim.loop.cwd() end; diff --git a/lua/lsp/svelte-ls.lua b/lua/lsp/svelte-ls.lua index 753f7046..b9e8a5f8 100644 --- a/lua/lsp/svelte-ls.lua +++ b/lua/lsp/svelte-ls.lua @@ -1,3 +1,4 @@ +-- TODO what is a svelte filetype require'lspconfig'.svelte.setup { cmd = {DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio"}, on_attach = require'lsp'.common_on_attach diff --git a/lua/lsp/tailwindcss-ls.lua b/lua/lsp/tailwindcss-ls.lua index 923eb5d5..87cd924c 100644 --- a/lua/lsp/tailwindcss-ls.lua +++ b/lua/lsp/tailwindcss-ls.lua @@ -1,3 +1,4 @@ +-- TODO what is a tailwindcss filetype local lspconfig = require 'lspconfig' lspconfig.tailwindcss.setup { diff --git a/lua/lv-autopairs/init.lua b/lua/lv-autopairs/init.lua index 458f0d57..fb1300a2 100644 --- a/lua/lv-autopairs/init.lua +++ b/lua/lv-autopairs/init.lua @@ -1,4 +1,3 @@ -local remap = vim.api.nvim_set_keymap local npairs = require('nvim-autopairs') local Rule = require('nvim-autopairs.rule') diff --git a/lua/plugins.lua b/lua/plugins.lua index ccd1efa7..c15b0b27 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -35,10 +35,11 @@ return require("packer").startup(function(use) -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) use {"neovim/nvim-lspconfig"} use {"glepnir/lspsaga.nvim", event = "BufRead"} - use {"kabouzeid/nvim-lspinstall", event = "BufRead"} + use {"kabouzeid/nvim-lspinstall"} -- Telescope use {"nvim-lua/popup.nvim"} use {"nvim-lua/plenary.nvim"} + use {"tjdevries/astronauta.nvim"} use { "nvim-telescope/telescope.nvim", config = [[require('lv-telescope')]], diff --git a/lv-config.lua b/lv-config.lua index 43408208..1746b9dd 100644 --- a/lv-config.lua +++ b/lv-config.lua @@ -49,7 +49,6 @@ O.lang.clang.diagnostics.underline = false -- add things like O.python.formatter.isort.exec_path O.lang.python.formatter = 'yapf' -- O.python.linter = 'flake8' -O.lang.python.active = true O.lang.python.isort = true O.lang.python.autoformat = true O.lang.python.diagnostics.virtual_text = true @@ -59,9 +58,9 @@ O.lang.python.analysis.type_checking = "off" O.lang.python.analysis.auto_search_paths = true O.lang.python.analysis.use_library_code_types = true + -- lua -- TODO look into stylua -O.lang.lua.active = true O.lang.lua.formatter = 'lua-format' -- O.lua.formatter = 'lua-format' O.lang.lua.autoformat = false @@ -72,7 +71,6 @@ O.lang.tsserver.linter = nil O.lang.tsserver.autoformat = true -- json -O.lang.json.active = false O.lang.json.autoformat = true -- ruby |