summaryrefslogtreecommitdiff
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/c.lua42
-rw-r--r--ftplugin/clojure.lua1
-rw-r--r--ftplugin/cmake.lua10
-rw-r--r--[l---------]ftplugin/cpp.lua2
-rw-r--r--ftplugin/cs.lua11
-rw-r--r--ftplugin/css.lua17
-rw-r--r--ftplugin/dart.lua30
-rw-r--r--ftplugin/dockerfile.lua11
-rw-r--r--ftplugin/elixir.lua13
-rw-r--r--ftplugin/elm.lua14
-rw-r--r--ftplugin/erlang.lua1
-rw-r--r--ftplugin/euphoria3.lua14
-rw-r--r--ftplugin/fish.lua1
-rw-r--r--ftplugin/go.lua30
-rw-r--r--ftplugin/graphql.lua7
-rw-r--r--ftplugin/html.lua18
-rw-r--r--ftplugin/java.lua97
-rw-r--r--ftplugin/javascript.lua2
-rw-r--r--ftplugin/javascriptreact.lua4
-rw-r--r--ftplugin/json.lua36
-rw-r--r--ftplugin/julia.lua1
-rw-r--r--ftplugin/kotlin.lua39
-rw-r--r--ftplugin/lua.lua48
-rw-r--r--ftplugin/php.lua42
-rw-r--r--ftplugin/puppet.lua1
-rw-r--r--ftplugin/python.lua88
-rw-r--r--ftplugin/r.lua2
l---------ftplugin/rmd.lua1
-rw-r--r--ftplugin/ruby.lua34
-rw-r--r--ftplugin/rust.lua113
l---------ftplugin/sbt.lua1
-rw-r--r--ftplugin/scala.lua1
-rw-r--r--ftplugin/sh.lua53
-rw-r--r--ftplugin/svelte.lua1
-rw-r--r--ftplugin/swift.lua1
-rw-r--r--ftplugin/tex.lua39
-rw-r--r--ftplugin/tf.lua26
-rw-r--r--ftplugin/thing.pp0
-rw-r--r--ftplugin/typescript.lua4
-rw-r--r--ftplugin/typescriptreact.lua4
-rw-r--r--ftplugin/vim.lua10
-rw-r--r--ftplugin/vue.lua11
-rw-r--r--ftplugin/yaml.lua25
-rw-r--r--ftplugin/zig.lua18
-rw-r--r--ftplugin/zsh.lua37
45 files changed, 58 insertions, 903 deletions
diff --git a/ftplugin/c.lua b/ftplugin/c.lua
index 8beaae5d..3f931e4a 100644
--- a/ftplugin/c.lua
+++ b/ftplugin/c.lua
@@ -1,40 +1,4 @@
-O.formatters.filetype["c"] = {
- function()
- return {
- exe = O.lang.c.formatter.exe,
- args = O.lang.c.formatter.args,
- stdin = not (O.lang.c.formatter.stdin ~= nil),
- }
- end,
-}
-O.formatters.filetype["cpp"] = O.formatters.filetype["c"]
+require("lsp").setup "c"
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-
-if require("lv-utils").check_lsp_client_active "clangd" then
- return
-end
-
-local clangd_flags = { "--background-index" }
-
-if O.lang.clang.cross_file_rename then
- table.insert(clangd_flags, "--cross-file-rename")
-end
-
-table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion)
-
-require("lspconfig").clangd.setup {
- cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.clang.diagnostics.virtual_text,
- signs = O.lang.clang.diagnostics.signs,
- underline = O.lang.clang.diagnostics.underline,
- update_in_insert = true,
- }),
- },
-}
+-- TODO get from dap
+-- require("lang.c").dap()
diff --git a/ftplugin/clojure.lua b/ftplugin/clojure.lua
new file mode 100644
index 00000000..683720a5
--- /dev/null
+++ b/ftplugin/clojure.lua
@@ -0,0 +1 @@
+require("lsp").setup "clojure"
diff --git a/ftplugin/cmake.lua b/ftplugin/cmake.lua
index 35369a15..56d30106 100644
--- a/ftplugin/cmake.lua
+++ b/ftplugin/cmake.lua
@@ -1,9 +1 @@
-if require("lv-utils").check_lsp_client_active "cmake" then
- return
-end
-
-require("lspconfig").cmake.setup {
- cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "cmake" },
-}
+require("lsp").setup "cmake"
diff --git a/ftplugin/cpp.lua b/ftplugin/cpp.lua
index d2be5311..6028ea49 120000..100644
--- a/ftplugin/cpp.lua
+++ b/ftplugin/cpp.lua
@@ -1 +1 @@
-c.lua \ No newline at end of file
+require("lsp").setup "cpp"
diff --git a/ftplugin/cs.lua b/ftplugin/cs.lua
index e0a0f62a..6c349494 100644
--- a/ftplugin/cs.lua
+++ b/ftplugin/cs.lua
@@ -1,10 +1 @@
-if require("lv-utils").check_lsp_client_active "omnisharp" then
- return
-end
-
--- C# language server (csharp/OmniSharp) setup
-require("lspconfig").omnisharp.setup {
- on_attach = require("lsp").common_on_attach,
- root_dir = require("lspconfig").util.root_pattern(".sln", ".git"),
- cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },
-}
+require("lsp").setup "cs"
diff --git a/ftplugin/css.lua b/ftplugin/css.lua
index 9cd7cc71..094ed2a3 100644
--- a/ftplugin/css.lua
+++ b/ftplugin/css.lua
@@ -1,16 +1 @@
-if not require("lv-utils").check_lsp_client_active "cssls" then
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
- -- npm install -g vscode-css-languageserver-bin
- require("lspconfig").cssls.setup {
- cmd = {
- "node",
- DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
- capabilities = capabilities,
- }
-end
-
-vim.cmd "setl ts=2 sw=2"
+require("lsp").setup "css"
diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua
index f9b68e9d..9f0ccfa0 100644
--- a/ftplugin/dart.lua
+++ b/ftplugin/dart.lua
@@ -1,29 +1 @@
-O.formatters.filetype["dart"] = {
- function()
- return {
- exe = O.lang.dart.formatter.exe,
- args = O.lang.dart.formatter.args,
- stdin = not (O.lang.dart.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "dartls" then
- return
-end
-
-require("lspconfig").dartls.setup {
- cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
- on_attach = require("lsp").common_on_attach,
- init_options = {
- closingLabels = false,
- flutterOutline = false,
- onlyAnalyzeProjectsWithOpenFiles = false,
- outline = false,
- suggestFromUnimportedLibraries = true,
- },
-}
+require("lsp").setup "dart"
diff --git a/ftplugin/dockerfile.lua b/ftplugin/dockerfile.lua
index e0fa97af..72ec7f90 100644
--- a/ftplugin/dockerfile.lua
+++ b/ftplugin/dockerfile.lua
@@ -1,10 +1 @@
-if require("lv-utils").check_lsp_client_active "dockerls" then
- return
-end
-
--- npm install -g dockerfile-language-server-nodejs
-require("lspconfig").dockerls.setup {
- cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
- on_attach = require("lsp").common_on_attach,
- root_dir = vim.loop.cwd,
-}
+require("lsp").setup "docker"
diff --git a/ftplugin/elixir.lua b/ftplugin/elixir.lua
index f3869ee5..f16f71fa 100644
--- a/ftplugin/elixir.lua
+++ b/ftplugin/elixir.lua
@@ -1,14 +1,9 @@
-if require("lv-utils").check_lsp_client_active "elixirls" then
- return
-end
-
-require("lspconfig").elixirls.setup {
- cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
-}
+require("lsp").setup "elixir"
+-- TODO: do we need this?
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
--- vim.cmd([[
+-- vim.cmd [[
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
-- au BufRead,BufNewFile mix.lock set filetype=elixir
--- ]])
+-- ]]
diff --git a/ftplugin/elm.lua b/ftplugin/elm.lua
index d1d6ee12..38fda314 100644
--- a/ftplugin/elm.lua
+++ b/ftplugin/elm.lua
@@ -1,13 +1 @@
-if require("lv-utils").check_lsp_client_active "elmls" then
- return
-end
-
-require("lspconfig").elmls.setup {
- cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },
- init_options = {
- elmAnalyseTrigger = "change",
- elmFormatPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-format",
- elmPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm",
- elmTestPath = DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-test",
- },
-}
+require("lsp").setup "elm"
diff --git a/ftplugin/erlang.lua b/ftplugin/erlang.lua
new file mode 100644
index 00000000..c6426dba
--- /dev/null
+++ b/ftplugin/erlang.lua
@@ -0,0 +1 @@
+require("lsp").setup "erlang"
diff --git a/ftplugin/euphoria3.lua b/ftplugin/euphoria3.lua
index b59a265a..391c51ad 100644
--- a/ftplugin/euphoria3.lua
+++ b/ftplugin/euphoria3.lua
@@ -1,15 +1,9 @@
-if require("lv-utils").check_lsp_client_active "elixirls" then
- return
-end
-
--- TODO: Remove this at some point
-require("lspconfig").elixirls.setup {
- cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
-}
+require("lsp").setup "erlang"
+-- TODO: do we need this?
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
--- vim.cmd([[
+-- vim.cmd [[
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
-- au BufRead,BufNewFile mix.lock set filetype=elixir
--- ]])
+-- ]]
diff --git a/ftplugin/fish.lua b/ftplugin/fish.lua
new file mode 100644
index 00000000..575ec434
--- /dev/null
+++ b/ftplugin/fish.lua
@@ -0,0 +1 @@
+require("lsp").setup "fish"
diff --git a/ftplugin/go.lua b/ftplugin/go.lua
index 47de932f..218b634c 100644
--- a/ftplugin/go.lua
+++ b/ftplugin/go.lua
@@ -1,29 +1 @@
-O.formatters.filetype["go"] = {
- function()
- return {
- exe = O.lang.go.formatter.exe,
- args = O.lang.go.formatter.args,
- stdin = not (O.lang.go.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-
-if not require("lv-utils").check_lsp_client_active "gopls" then
- require("lspconfig").gopls.setup {
- cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
- settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
- root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
- init_options = { usePlaceholders = true, completeUnimported = true },
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-vim.opt_local.tabstop = 4
-vim.opt_local.shiftwidth = 4
-vim.opt_local.softtabstop = 4
-vim.opt_local.expandtab = false
+require("lsp").setup "go"
diff --git a/ftplugin/graphql.lua b/ftplugin/graphql.lua
index c9ce5437..83e8878d 100644
--- a/ftplugin/graphql.lua
+++ b/ftplugin/graphql.lua
@@ -1,6 +1 @@
-if require("lv-utils").check_lsp_client_active "graphql" then
- return
-end
-
--- npm install -g graphql-language-service-cli
-require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
+require("lsp").setup "graphql"
diff --git a/ftplugin/html.lua b/ftplugin/html.lua
index fa60e0a6..c60394c0 100644
--- a/ftplugin/html.lua
+++ b/ftplugin/html.lua
@@ -1,17 +1 @@
-if not require("lv-utils").check_lsp_client_active "html" then
- -- npm install -g vscode-html-languageserver-bin
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
-
- require("lspconfig").html.setup {
- cmd = {
- "node",
- DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
- capabilities = capabilities,
- }
-end
-
-vim.cmd "setl ts=2 sw=2"
+require("lsp").setup "html"
diff --git a/ftplugin/java.lua b/ftplugin/java.lua
index 7db90f0e..dcb46ca2 100644
--- a/ftplugin/java.lua
+++ b/ftplugin/java.lua
@@ -1,96 +1 @@
-vim.cmd "let proj = FindRootDirectory()"
-local root_dir = vim.api.nvim_get_var "proj"
-
--- use the global prettier if you didn't find the local one
-local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
-if vim.fn.executable(prettier_instance) ~= 1 then
- prettier_instance = O.lang.tsserver.formatter.exe
-end
-
-O.formatters.filetype["java"] = {
- function()
- return {
- exe = prettier_instance,
- -- TODO: allow user to override this
- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
- stdin = true,
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-
-if require("lv-utils").check_lsp_client_active "jdtls" then
- return
-end
-
-if O.lang.java.java_tools.active then
- -- find_root looks for parent directories relative to the current buffer containing one of the given arguments.
- if vim.fn.has "mac" == 1 then
- WORKSPACE_PATH = "/Users/" .. USER .. "/workspace/"
- elseif vim.fn.has "unix" == 1 then
- WORKSPACE_PATH = "/home/" .. USER .. "/workspace/"
- else
- print "Unsupported system"
- end
- JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/jdtls"
-
- require("jdtls").start_or_attach {
- on_attach = require("lsp").common_on_attach,
- cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
- }
-
- vim.api.nvim_set_keymap(
- "n",
- "<leader>la",
- ":lua require('jdtls').code_action()<CR>",
- { noremap = true, silent = true }
- )
- vim.api.nvim_set_keymap(
- "n",
- "<leader>lR",
- ":lua require('jdtls').code_action(false, 'refactor')<CR>",
- { noremap = true, silent = true }
- )
-
- vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"
- vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
- -- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
- vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
- -- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
-else
- local util = require "lspconfig/util"
-
- require("lspconfig").jdtls.setup {
- on_attach = require("lsp").common_on_attach,
- cmd = { DATA_PATH .. "/lspinstall/java/jdtls.sh" },
- filetypes = { "java" },
- root_dir = util.root_pattern { ".git", "build.gradle", "pom.xml" },
- -- init_options = {bundles = bundles}
- -- on_attach = require'lsp'.common_on_attach
- }
-end
-
--- local bundles = {
--- vim.fn.glob(
--- CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
--- };
-
--- require('jdtls').start_or_attach({
--- on_attach = on_attach,
--- cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"},
--- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
--- init_options = {bundles = bundles}
--- })
-
--- TODO: setup autoformat stuff later
--- _java = {
--- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
--- {
--- 'FileType', 'java',
--- 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'
--- }
--- }
+require("lsp").setup "java"
diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua
index fc59ab68..37b95c71 100644
--- a/ftplugin/javascript.lua
+++ b/ftplugin/javascript.lua
@@ -1 +1 @@
-require "lsp.tsserver-ls"
+require("lsp").setup "javascript"
diff --git a/ftplugin/javascriptreact.lua b/ftplugin/javascriptreact.lua
index f74b54e9..90920166 100644
--- a/ftplugin/javascriptreact.lua
+++ b/ftplugin/javascriptreact.lua
@@ -1,3 +1 @@
-require "lsp.tsserver-ls"
-
-vim.cmd "setl ts=2 sw=2"
+require("lsp").setup "javascriptreact"
diff --git a/ftplugin/json.lua b/ftplugin/json.lua
index cb73995c..18368cf9 100644
--- a/ftplugin/json.lua
+++ b/ftplugin/json.lua
@@ -1,35 +1 @@
-O.formatters.filetype["json"] = {
- function()
- return {
- exe = O.lang.json.formatter.exe,
- args = O.lang.json.formatter.args,
- stdin = not (O.lang.json.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "jsonls" then
- return
-end
-
--- npm install -g vscode-json-languageserver
-require("lspconfig").jsonls.setup {
- cmd = {
- "node",
- DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
-
- commands = {
- Format = {
- function()
- vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
- end,
- },
- },
-}
+require("lsp").setup "json"
diff --git a/ftplugin/julia.lua b/ftplugin/julia.lua
new file mode 100644
index 00000000..9840be1f
--- /dev/null
+++ b/ftplugin/julia.lua
@@ -0,0 +1 @@
+require("lsp").setup "julia"
diff --git a/ftplugin/kotlin.lua b/ftplugin/kotlin.lua
index 8d034e6f..a0e6d5d6 100644
--- a/ftplugin/kotlin.lua
+++ b/ftplugin/kotlin.lua
@@ -1,38 +1 @@
-if require("lv-utils").check_lsp_client_active "kotlin_language_server" then
- return
-end
-
---- default config for gradle-projects of the
---- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
----
---- This server requires vim to be aware of the kotlin-filetype.
---- You could refer for this capability to:
---- https://github.com/udalov/kotlin-vim (recommended)
---- Note that there is no LICENSE specified yet.
-
-local util = require "lspconfig/util"
-
-local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server"
-if vim.fn.has "win32" == 1 then
- bin_name = bin_name .. ".bat"
-end
-
-local root_files = {
- "settings.gradle", -- Gradle (multi-project)
- "settings.gradle.kts", -- Gradle (multi-project)
- "build.xml", -- Ant
- "pom.xml", -- Maven
-}
-
-local fallback_root_files = {
- "build.gradle", -- Gradle
- "build.gradle.kts", -- Gradle
-}
-
-require("lspconfig").kotlin_language_server.setup {
- cmd = { bin_name },
- on_attach = require("lsp").common_on_attach,
- root_dir = function(fname)
- return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
- end,
-}
+require("lsp").setup "kotlin"
diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua
index eb7b9944..2ed88315 100644
--- a/ftplugin/lua.lua
+++ b/ftplugin/lua.lua
@@ -1,47 +1 @@
-O.formatters.filetype["lua"] = {
- function()
- return {
- exe = O.lang.lua.formatter.exe,
- args = O.lang.lua.formatter.args,
- stdin = not (O.lang.lua.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if not require("lv-utils").check_lsp_client_active "sumneko_lua" then
- -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
- local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
- local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
-
- require("lspconfig").sumneko_lua.setup {
- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
- on_attach = require("lsp").common_on_attach,
- settings = {
- Lua = {
- runtime = {
- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
- version = "LuaJIT",
- -- Setup your lua path
- path = vim.split(package.path, ";"),
- },
- diagnostics = {
- -- Get the language server to recognize the `vim` global
- globals = { "vim" },
- },
- workspace = {
- -- Make the server aware of Neovim runtime files
- library = {
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- },
- maxPreload = 100000,
- preloadFileSize = 1000,
- },
- },
- },
- }
-end
+require("lsp").setup "lua"
diff --git a/ftplugin/php.lua b/ftplugin/php.lua
index 054dff79..4eabcf71 100644
--- a/ftplugin/php.lua
+++ b/ftplugin/php.lua
@@ -1,41 +1 @@
-O.formatters.filetype["php"] = {
- function()
- return {
- exe = O.lang.php.formatter.exe,
- args = O.lang.php.formatter.args,
- stdin = not (O.lang.php.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "intelephense" then
- return
-end
-
-require("lspconfig").intelephense.setup {
- cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.php.diagnostics.virtual_text,
- signs = O.lang.php.diagnostics.signs,
- underline = O.lang.php.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- filetypes = O.lang.php.filetypes,
- settings = {
- intelephense = {
- format = {
- braces = O.lang.php.format.braces,
- },
- environment = {
- phpVersion = O.lang.php.environment.php_version,
- },
- },
- },
-}
+require("lsp").setup "php"
diff --git a/ftplugin/puppet.lua b/ftplugin/puppet.lua
new file mode 100644
index 00000000..f8521762
--- /dev/null
+++ b/ftplugin/puppet.lua
@@ -0,0 +1 @@
+require("lsp").setup "puppet"
diff --git a/ftplugin/python.lua b/ftplugin/python.lua
index d2ade7e2..3e79e6bc 100644
--- a/ftplugin/python.lua
+++ b/ftplugin/python.lua
@@ -1,85 +1,3 @@
-O.formatters.filetype["python"] = {
- function()
- return {
- exe = O.lang.python.formatter.exe,
- args = O.lang.python.formatter.args,
- stdin = not (O.lang.python.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-
-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 not require("lv-utils").check_lsp_client_active "efm" then
- require("lspconfig").efm.setup {
- -- init_options = {initializationOptions},
- cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
- init_options = { documentFormatting = true, codeAction = false },
- root_dir = require("lspconfig").util.root_pattern(".git/", "requirements.txt"),
- filetypes = { "python" },
- settings = {
- rootMarkers = { ".git/", "requirements.txt" },
- languages = {
- python = python_arguments,
- },
- },
- }
-end
-
-if not require("lv-utils").check_lsp_client_active "pyright" then
- -- npm i -g pyright
- require("lspconfig").pyright.setup {
- cmd = {
- DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver",
- "--stdio",
- },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.python.diagnostics.virtual_text,
- signs = O.lang.python.diagnostics.signs,
- underline = O.lang.python.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- settings = {
- python = {
- analysis = {
- typeCheckingMode = O.lang.python.analysis.type_checking,
- autoSearchPaths = O.lang.python.analysis.auto_search_paths,
- useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types,
- },
- },
- },
- }
-end
-
-if O.plugin.dap.active then
- local dap_install = require "dap-install"
- dap_install.config("python_dbg", {})
-end
+require("lsp").setup "python"
+-- TODO get from dap
+-- require("lang.python").dap()
diff --git a/ftplugin/r.lua b/ftplugin/r.lua
new file mode 100644
index 00000000..296d3c86
--- /dev/null
+++ b/ftplugin/r.lua
@@ -0,0 +1,2 @@
+-- R -e 'install.packages("languageserver",repos = "http://cran.us.r-project.org")'
+require("lsp").setup "r"
diff --git a/ftplugin/rmd.lua b/ftplugin/rmd.lua
new file mode 120000
index 00000000..401cef17
--- /dev/null
+++ b/ftplugin/rmd.lua
@@ -0,0 +1 @@
+r.lua \ No newline at end of file
diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua
index ff7e7c8b..7e968917 100644
--- a/ftplugin/ruby.lua
+++ b/ftplugin/ruby.lua
@@ -1,32 +1,2 @@
-O.formatters.filetype["ruby"] = {
- function()
- return {
- exe = O.lang.ruby.formatter.exe,
- args = O.lang.ruby.formatter.args,
- stdin = not (O.lang.ruby.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "solargraph" then
- return
-end
-
--- If you are using rvm, make sure to change below configuration
-require("lspconfig").solargraph.setup {
- cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" },
- on_attach = require("lsp").common_on_attach,
- handlers = {
- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = O.lang.ruby.diagnostics.virtual_text,
- signs = O.lang.ruby.diagnostics.signs,
- underline = O.lang.ruby.diagnostics.underline,
- update_in_insert = true,
- }),
- },
- filetypes = O.lang.ruby.filetypes,
-}
+-- also support sorbet
+require("lsp").setup "ruby"
diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua
index dd34483e..f1623f25 100644
--- a/ftplugin/rust.lua
+++ b/ftplugin/rust.lua
@@ -1,111 +1,4 @@
-O.formatters.filetype["rust"] = {
- function()
- return {
- exe = O.lang.rust.formatter.exe,
- args = O.lang.rust.formatter.args,
- stdin = not (O.lang.rust.formatter.stdin ~= nil),
- }
- end,
-}
+require("lsp").setup "rust"
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "rust_analyzer" then
- return
-end
-
-if O.lang.rust.rust_tools.active then
- local opts = {
- tools = { -- rust-tools options
- -- automatically set inlay hints (type hints)
- -- There is an issue due to which the hints are not applied on the first
- -- opened file. For now, write to the file to trigger a reapplication of
- -- the hints or just run :RustSetInlayHints.
- -- default: true
- autoSetHints = true,
-
- -- whether to show hover actions inside the hover window
- -- this overrides the default hover handler
- -- default: true
- hover_with_actions = true,
-
- runnables = {
- -- whether to use telescope for selection menu or not
- -- default: true
- use_telescope = true,
-
- -- rest of the opts are forwarded to telescope
- },
-
- inlay_hints = {
- -- wheter to show parameter hints with the inlay hints or not
- -- default: true
- show_parameter_hints = true,
-
- -- prefix for parameter hints
- -- default: "<-"
- parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,
-
- -- prefix for all the other hints (type, chaining)
- -- default: "=>"
- other_hints_prefix = O.lang.rust.rust_tools.other_hints_prefix,
-
- -- whether to align to the lenght of the longest line in the file
- max_len_align = false,
-
- -- padding from the left if max_len_align is true
- max_len_align_padding = 1,
-
- -- whether to align to the extreme right or not
- right_align = false,
-
- -- padding from the right if right_align is true
- right_align_padding = 7,
- },
-
- hover_actions = {
- -- the border that is used for the hover window
- -- see vim.api.nvim_open_win()
- border = {
- { "â•­", "FloatBorder" },
- { "─", "FloatBorder" },
- { "â•®", "FloatBorder" },
- { "│", "FloatBorder" },
- { "╯", "FloatBorder" },
- { "─", "FloatBorder" },
- { "â•°", "FloatBorder" },
- { "│", "FloatBorder" },
- },
- },
- },
-
- -- all the opts to send to nvim-lspconfig
- -- these override the defaults set by rust-tools.nvim
- -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
- server = {
- cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
- on_attach = require("lsp").common_on_attach,
- }, -- rust-analyser options
- }
- require("rust-tools").setup(opts)
-else
- require("lspconfig").rust_analyzer.setup {
- cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "rust" },
- root_dir = require("lspconfig.util").root_pattern("Carrust.toml", "rust-project.json"),
- }
-end
-
--- TODO: fix these mappings
-vim.api.nvim_exec(
- [[
- autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>
- autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR>
- autocmd Filetype rust nnoremap <leader>le <Cmd>RustRunnables<CR>
- autocmd Filetype rust nnoremap <leader>lh <Cmd>RustHoverActions<CR>
- ]],
- true
-)
+-- TODO get from dap
+-- require("lang.rust").dap()
diff --git a/ftplugin/sbt.lua b/ftplugin/sbt.lua
new file mode 120000
index 00000000..d0d6ce5b
--- /dev/null
+++ b/ftplugin/sbt.lua
@@ -0,0 +1 @@
+scala.lua \ No newline at end of file
diff --git a/ftplugin/scala.lua b/ftplugin/scala.lua
new file mode 100644
index 00000000..169e36ad
--- /dev/null
+++ b/ftplugin/scala.lua
@@ -0,0 +1 @@
+require("lsp").setup "scala"
diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua
index 54002f19..4f18fbca 100644
--- a/ftplugin/sh.lua
+++ b/ftplugin/sh.lua
@@ -1,52 +1 @@
-O.formatters.filetype["sh"] = {
- function()
- return {
- exe = O.lang.sh.formatter.exe,
- args = O.lang.sh.formatter.args,
- stdin = not (O.lang.sh.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if not require("lv-utils").check_lsp_client_active "bashls" then
- -- 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" },
- }
-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.linter == "shellcheck" then
- table.insert(sh_arguments, shellcheck)
-end
-
-if not require("lv-utils").check_lsp_client_active "efm" then
- require("lspconfig").efm.setup {
- -- init_options = {initializationOptions},
- cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
- init_options = { documentFormatting = true, codeAction = false },
- root_dir = require("lspconfig").util.root_pattern ".git/",
- filetypes = { "sh" },
- settings = {
- rootMarkers = { ".git/" },
- languages = {
- sh = sh_arguments,
- },
- },
- }
-end
+require("lsp").setup "sh"
diff --git a/ftplugin/svelte.lua b/ftplugin/svelte.lua
new file mode 100644
index 00000000..175a5cbd
--- /dev/null
+++ b/ftplugin/svelte.lua
@@ -0,0 +1 @@
+require("lsp").setup "svelte"
diff --git a/ftplugin/swift.lua b/ftplugin/swift.lua
new file mode 100644
index 00000000..1ae7554a
--- /dev/null
+++ b/ftplugin/swift.lua
@@ -0,0 +1 @@
+require("lsp").setup "swift"
diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua
index c5748189..e9a98ec5 100644
--- a/ftplugin/tex.lua
+++ b/ftplugin/tex.lua
@@ -1,38 +1 @@
-if require("lv-utils").check_lsp_client_active "texlab" then
- return
-end
-
-require("lspconfig").texlab.setup {
- cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
- on_attach = require("lsp").common_on_attach,
-}
-
-vim.g.vimtex_compiler_method = "latexmk"
-vim.g.vimtex_view_method = "zathura"
-vim.g.vimtex_fold_enabled = 0
-vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
-
-O.plugin.which_key.mappings["L"] = {
- name = "+Latex",
- c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
- f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
- i = { "<cmd>VimtexInfo<cr>", "Project Information" },
- s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
- t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
- v = { "<cmd>VimtexView<cr>", "View PDF" },
-}
-
--- Compile on initialization, cleanup on quit
-vim.api.nvim_exec(
- [[
- augroup vimtex_event_1
- au!
- au User VimtexEventQuit call vimtex#compiler#clean(0)
- au User VimtexEventInitPost call vimtex#compiler#compile()
- augroup END
- ]],
- false
-)
-if O.lang.latex.auto_save then
- vim.api.nvim_exec([[au FocusLost * :wa]], false)
-end
+require("lsp").setup "tex"
diff --git a/ftplugin/tf.lua b/ftplugin/tf.lua
index a328f7c2..3486663d 100644
--- a/ftplugin/tf.lua
+++ b/ftplugin/tf.lua
@@ -1,25 +1 @@
-O.formatters.filetype["hcl"] = {
- function()
- return {
- exe = O.lang.terraform.formatter.exe,
- args = O.lang.terraform.formatter.args,
- stdin = not (O.lang.terraform.formatter.stdin ~= nil),
- }
- end,
-}
-O.formatters.filetype["tf"] = O.formatters.filetype["hcl"]
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-
-if require("lv-utils").check_lsp_client_active "terraformls" then
- return
-end
-
-require("lspconfig").terraformls.setup {
- cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
- on_attach = require("lsp").common_on_attach,
- filetypes = { "tf", "terraform", "hcl" },
-}
+require("lsp").setup "terraform"
diff --git a/ftplugin/thing.pp b/ftplugin/thing.pp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ftplugin/thing.pp
diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua
index f74b54e9..2f6219df 100644
--- a/ftplugin/typescript.lua
+++ b/ftplugin/typescript.lua
@@ -1,3 +1 @@
-require "lsp.tsserver-ls"
-
-vim.cmd "setl ts=2 sw=2"
+require("lsp").setup "typescript"
diff --git a/ftplugin/typescriptreact.lua b/ftplugin/typescriptreact.lua
index f74b54e9..2f6219df 100644
--- a/ftplugin/typescriptreact.lua
+++ b/ftplugin/typescriptreact.lua
@@ -1,3 +1 @@
-require "lsp.tsserver-ls"
-
-vim.cmd "setl ts=2 sw=2"
+require("lsp").setup "typescript"
diff --git a/ftplugin/vim.lua b/ftplugin/vim.lua
index 4a405698..88c00c1c 100644
--- a/ftplugin/vim.lua
+++ b/ftplugin/vim.lua
@@ -1,9 +1 @@
-if require("lv-utils").check_lsp_client_active "vimls" then
- return
-end
-
--- npm install -g vim-language-server
-require("lspconfig").vimls.setup {
- cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
- on_attach = require("lsp").common_on_attach,
-}
+require("lsp").setup "vim"
diff --git a/ftplugin/vue.lua b/ftplugin/vue.lua
index 96048164..a174c9bf 100644
--- a/ftplugin/vue.lua
+++ b/ftplugin/vue.lua
@@ -1,10 +1 @@
-if require("lv-utils").check_lsp_client_active "vuels" then
- return
-end
-
--- Vue language server configuration (vetur)
-require("lspconfig").vuels.setup {
- cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" },
- on_attach = require("lsp").common_on_attach,
- root_dir = require("lspconfig").util.root_pattern(".git", "vue.config.js", "package.json", "yarn.lock"),
-}
+require("lsp").setup "vue"
diff --git a/ftplugin/yaml.lua b/ftplugin/yaml.lua
index f1dfc5dc..d21f9785 100644
--- a/ftplugin/yaml.lua
+++ b/ftplugin/yaml.lua
@@ -1,24 +1 @@
-O.formatters.filetype["yaml"] = {
- function()
- return {
- exe = O.lang.yaml.formatter.exe,
- args = O.lang.yaml.formatter.args,
- stdin = not (O.lang.yaml.formatter.stdin ~= nil),
- }
- end,
-}
-
-require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
-}
-if require("lv-utils").check_lsp_client_active "yamlls" then
- return
-end
-
--- npm install -g yaml-language-server
-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"
+require("lsp").setup "yaml"
diff --git a/ftplugin/zig.lua b/ftplugin/zig.lua
index 55707d85..ef3d64d4 100644
--- a/ftplugin/zig.lua
+++ b/ftplugin/zig.lua
@@ -1,17 +1 @@
-if not require("lv-utils").check_lsp_client_active "zls" then
- -- Because lspinstall don't support zig yet,
- -- So we need zls preset in global lib
- -- Further custom install zls in
- -- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
- require("lspconfig").zls.setup {
- root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
- on_attach = require("lsp").common_on_attach,
- }
-end
-
-require("lv-utils").define_augroups {
- _zig_autoformat = {
- { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
- },
-}
-vim.cmd "setl expandtab tabstop=8 softtabstop=4 shiftwidth=4"
+require("lsp").setup "zig"
diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua
index 750e8ede..4f18fbca 100644
--- a/ftplugin/zsh.lua
+++ b/ftplugin/zsh.lua
@@ -1,36 +1 @@
-if not require("lv-utils").check_lsp_client_active "bashls" then
- -- 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" },
- }
-end
-
--- sh
-local sh_arguments = {}
-
-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.linter == "shellcheck" then
- table.insert(sh_arguments, shellcheck)
-end
-
-if not require("lv-utils").check_lsp_client_active "efm" then
- require("lspconfig").efm.setup {
- -- init_options = {initializationOptions},
- cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
- init_options = { documentFormatting = true, codeAction = false },
- root_dir = require("lspconfig").util.root_pattern ".git/",
- filetypes = { "zsh" },
- settings = {
- rootMarkers = { ".git/" },
- languages = {
- sh = sh_arguments,
- },
- },
- }
-end
+require("lsp").setup "sh"