diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-07-22 00:08:36 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-07-22 00:08:36 +0200 |
commit | b51f1ae28924a752258e7607fbc3210f9b18eaac (patch) | |
tree | 8c8c095528990b3f6eb499dbcca15e9720e636d1 /.config/nvim/ftplugin | |
parent | da936b0ed9ac4c171d3c7908e41af1875a82b08b (diff) |
Updates based on Chris's lunarvim
Diffstat (limited to '.config/nvim/ftplugin')
23 files changed, 82 insertions, 586 deletions
diff --git a/.config/nvim/ftplugin/c.lua b/.config/nvim/ftplugin/c.lua index 43db5ec..c4fbdd1 100644 --- a/.config/nvim/ftplugin/c.lua +++ b/.config/nvim/ftplugin/c.lua @@ -1,24 +1,4 @@ -if require("cfg.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, - }), - }, -} +require("lang.clang").format() +require("lang.clang").lint() +require("lang.clang").lsp() +require("lang.clang").dap() diff --git a/.config/nvim/ftplugin/dart.lua b/.config/nvim/ftplugin/dart.lua index 3076d7d..1db4fe0 100644 --- a/.config/nvim/ftplugin/dart.lua +++ b/.config/nvim/ftplugin/dart.lua @@ -1,15 +1,4 @@ -if require("cfg.utils").check_lsp_client_active "dartls" then - return -end - -require("lspconfig").dartls.setup { - cmd = { "dart", O.lang.dart.sdk_path, "--lsp" }, - on_attach = require("cfg.lsp").common_on_attach, - init_options = { - closingLabels = false, - flutterOutline = false, - onlyAnalyzeProjectsWithOpenFiles = false, - outline = false, - suggestFromUnimportedLibraries = true, - }, -} +require("lang.dart").format() +require("lang.dart").lint() +require("lang.dart").lsp() +require("lang.dart").dap() diff --git a/.config/nvim/ftplugin/dockerfile.lua b/.config/nvim/ftplugin/dockerfile.lua index cbf3572..8a43c76 100644 --- a/.config/nvim/ftplugin/dockerfile.lua +++ b/.config/nvim/ftplugin/dockerfile.lua @@ -1,10 +1,4 @@ -if require("cfg.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("cfg.lsp").common_on_attach, - root_dir = vim.loop.cwd, -} +require("lang.dockerfile").format() +require("lang.dockerfile").lint() +require("lang.dockerfile").lsp() +require("lang.dockerfile").dap() diff --git a/.config/nvim/ftplugin/elixir.lua b/.config/nvim/ftplugin/elixir.lua index 5788347..a93d6da 100644 --- a/.config/nvim/ftplugin/elixir.lua +++ b/.config/nvim/ftplugin/elixir.lua @@ -1,14 +1,5 @@ -if require("cfg.utils").check_lsp_client_active "elixirls" then - return -end -require("lspconfig").elixirls.setup { - cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" }, -} - --- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir) --- 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 --- ]]) +require("lang.elixir").format() +require("lang.elixir").lint() +require("lang.elixir").lsp() +require("lang.elixir").dap() diff --git a/.config/nvim/ftplugin/go.lua b/.config/nvim/ftplugin/go.lua index 5cc600b..e5b8475 100644 --- a/.config/nvim/ftplugin/go.lua +++ b/.config/nvim/ftplugin/go.lua @@ -1,14 +1,4 @@ -if not require("cfg.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("cfg.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("lang.go").format() +require("lang.go").lint() +require("lang.go").lsp() +require("lang.go").dap() diff --git a/.config/nvim/ftplugin/graphql.lua b/.config/nvim/ftplugin/graphql.lua index 863bfa0..30bddcc 100644 --- a/.config/nvim/ftplugin/graphql.lua +++ b/.config/nvim/ftplugin/graphql.lua @@ -1,5 +1,4 @@ -if require("cfg.utils").check_lsp_client_active "graphql" then - return -end --- npm install -g graphql-language-service-cli -require("lspconfig").graphql.setup { on_attach = require("cfg.lsp").common_on_attach } +require("lang.graphql").format() +require("lang.graphql").lint() +require("lang.graphql").lsp() +require("lang.graphql").dap() diff --git a/.config/nvim/ftplugin/html.lua b/.config/nvim/ftplugin/html.lua index d673a26..70c3295 100644 --- a/.config/nvim/ftplugin/html.lua +++ b/.config/nvim/ftplugin/html.lua @@ -1,17 +1,4 @@ -if not require("cfg.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("cfg.lsp").common_on_attach, - capabilities = capabilities, - } -end - -vim.cmd "setl ts=2 sw=2" +require("lang.html").format() +require("lang.html").lint() +require("lang.html").lsp() +require("lang.html").dap() diff --git a/.config/nvim/ftplugin/javascript.lua b/.config/nvim/ftplugin/javascript.lua index ff7cef2..fc59ab6 100644 --- a/.config/nvim/ftplugin/javascript.lua +++ b/.config/nvim/ftplugin/javascript.lua @@ -1,41 +1 @@ -if not require("cfg.utils").check_lsp_client_active "tsserver" then - -- 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("cfg.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, - }), - }, - } - require("lsp.ts-fmt-lint").setup() -end - -vim.cmd "setl ts=2 sw=2" +require "lsp.tsserver-ls" diff --git a/.config/nvim/ftplugin/javascriptreact.lua b/.config/nvim/ftplugin/javascriptreact.lua index ff7cef2..fac6a20 100644 --- a/.config/nvim/ftplugin/javascriptreact.lua +++ b/.config/nvim/ftplugin/javascriptreact.lua @@ -1,41 +1,2 @@ -if not require("cfg.utils").check_lsp_client_active "tsserver" then - -- 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("cfg.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, - }), - }, - } - require("lsp.ts-fmt-lint").setup() -end - +require "lsp.tsserver-ls" vim.cmd "setl ts=2 sw=2" diff --git a/.config/nvim/ftplugin/json.lua b/.config/nvim/ftplugin/json.lua index e96ab45..0408f9b 100644 --- a/.config/nvim/ftplugin/json.lua +++ b/.config/nvim/ftplugin/json.lua @@ -1,21 +1,4 @@ -if require("cfg.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("cfg.lsp").common_on_attach, - - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) - end, - }, - }, -} +require("lang.json").format() +require("lang.json").lint() +require("lang.json").lsp() +require("lang.json").dap() diff --git a/.config/nvim/ftplugin/kotlin.lua b/.config/nvim/ftplugin/kotlin.lua index eb5f5f5..2677c28 100644 --- a/.config/nvim/ftplugin/kotlin.lua +++ b/.config/nvim/ftplugin/kotlin.lua @@ -1,38 +1,4 @@ -if require("cfg.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("cfg.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("lang.kotlin").format() +require("lang.kotlin").lint() +require("lang.kotlin").lsp() +require("lang.kotlin").dap() diff --git a/.config/nvim/ftplugin/lua.lua b/.config/nvim/ftplugin/lua.lua index 4462815..37ebab4 100644 --- a/.config/nvim/ftplugin/lua.lua +++ b/.config/nvim/ftplugin/lua.lua @@ -1,48 +1,4 @@ -if not require("cfg.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("cfg.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 - -if O.lang.lua.autoformat then - require("cfg.utils").define_augroups { - _lua_autoformat = { - { - "BufWritePre", - "*.lua", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end - -vim.cmd "setl ts=2 sw=2" - +require("lang.lua").format() +require("lang.lua").lint() +require("lang.lua").lsp() +require("lang.lua").dap() diff --git a/.config/nvim/ftplugin/python.lua b/.config/nvim/ftplugin/python.lua index fe8d857..85f08be 100644 --- a/.config/nvim/ftplugin/python.lua +++ b/.config/nvim/ftplugin/python.lua @@ -1,69 +1,4 @@ -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("cfg.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 }, - filetypes = { "python" }, - settings = { - rootMarkers = { ".git/", "requirements.txt" }, - languages = { - python = python_arguments, - }, - }, - } -end - -if not require("cfg.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("cfg.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.debug.active and O.plugin.dap_install.active then - local dap_install = require "dap-install" - dap_install.config("python_dbg", {}) -end +require("lang.python").format() +require("lang.python").lint() +require("lang.python").lsp() +require("lang.python").dap() diff --git a/.config/nvim/ftplugin/rust.lua b/.config/nvim/ftplugin/rust.lua index 9a6e8a3..7472840 100644 --- a/.config/nvim/ftplugin/rust.lua +++ b/.config/nvim/ftplugin/rust.lua @@ -1,97 +1,4 @@ -if require("cfg.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("cfg.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("cfg.lsp").common_on_attach, - filetypes = { "rust" }, - root_dir = require("lspconfig.util").root_pattern("Cargo.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 -) +require("lang.rust").format() +require("lang.rust").lint() +require("lang.rust").lsp() +require("lang.rust").dap() diff --git a/.config/nvim/ftplugin/sh.lua b/.config/nvim/ftplugin/sh.lua index 5110f6c..ee3a27d 100644 --- a/.config/nvim/ftplugin/sh.lua +++ b/.config/nvim/ftplugin/sh.lua @@ -1,37 +1,4 @@ -if not require("cfg.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("cfg.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("cfg.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 }, - filetypes = { "sh" }, - settings = { - rootMarkers = { ".git/" }, - languages = { - sh = sh_arguments, - }, - }, - } -end +require("lang.sh").format() +require("lang.sh").lint() +require("lang.sh").lsp() +require("lang.sh").dap() diff --git a/.config/nvim/ftplugin/swift.lua b/.config/nvim/ftplugin/swift.lua new file mode 100644 index 0000000..64d87e1 --- /dev/null +++ b/.config/nvim/ftplugin/swift.lua @@ -0,0 +1,4 @@ +require("lang.swift").format() +require("lang.swift").lint() +require("lang.swift").lsp() +require("lang.swift").dap() diff --git a/.config/nvim/ftplugin/tex.lua b/.config/nvim/ftplugin/tex.lua index f8e1cb5..3de774f 100644 --- a/.config/nvim/ftplugin/tex.lua +++ b/.config/nvim/ftplugin/tex.lua @@ -1,8 +1,4 @@ -if require("cfg.utils").check_lsp_client_active "texlab" then - return -end - -require("lspconfig").texlab.setup { - cmd = { DATA_PATH .. "/lspinstall/latex/texlab" }, - on_attach = require("cfg.lsp").common_on_attach, -} +require("lang.tex").format() +require("lang.tex").lint() +require("lang.tex").lsp() +require("lang.tex").dap() diff --git a/.config/nvim/ftplugin/typescript.lua b/.config/nvim/ftplugin/typescript.lua new file mode 100644 index 0000000..fac6a20 --- /dev/null +++ b/.config/nvim/ftplugin/typescript.lua @@ -0,0 +1,2 @@ +require "lsp.tsserver-ls" +vim.cmd "setl ts=2 sw=2" diff --git a/.config/nvim/ftplugin/typescriptreact.lua b/.config/nvim/ftplugin/typescriptreact.lua new file mode 100644 index 0000000..fac6a20 --- /dev/null +++ b/.config/nvim/ftplugin/typescriptreact.lua @@ -0,0 +1,2 @@ +require "lsp.tsserver-ls" +vim.cmd "setl ts=2 sw=2" diff --git a/.config/nvim/ftplugin/vim.lua b/.config/nvim/ftplugin/vim.lua index 0468381..0b5f5ea 100644 --- a/.config/nvim/ftplugin/vim.lua +++ b/.config/nvim/ftplugin/vim.lua @@ -1,9 +1,4 @@ -if require("cfg.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("cfg.lsp").common_on_attach, -} +require("lang.vim").format() +require("lang.vim").lint() +require("lang.vim").lsp() +require("lang.vim").dap() diff --git a/.config/nvim/ftplugin/yaml.lua b/.config/nvim/ftplugin/yaml.lua index fa5ec54..f38f258 100644 --- a/.config/nvim/ftplugin/yaml.lua +++ b/.config/nvim/ftplugin/yaml.lua @@ -1,10 +1,4 @@ -if require("cfg.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("cfg.lsp").common_on_attach, -} -vim.cmd "setl ts=2 sw=2 ts=2 ai et" +require("lang.yaml").format() +require("lang.yaml").lint() +require("lang.yaml").lsp() +require("lang.yaml").dap() diff --git a/.config/nvim/ftplugin/zig.lua b/.config/nvim/ftplugin/zig.lua index 6ece5ae..9b39176 100644 --- a/.config/nvim/ftplugin/zig.lua +++ b/.config/nvim/ftplugin/zig.lua @@ -1,35 +1,4 @@ -if not require("cfg.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("cfg.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("cfg.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 }, - filetypes = { "zsh" }, - settings = { - rootMarkers = { ".git/" }, - languages = { - sh = sh_arguments, - }, - }, - } -end +require("lang.zig").format() +require("lang.zig").lint() +require("lang.zig").lsp() +require("lang.zig").dap() diff --git a/.config/nvim/ftplugin/zsh.lua b/.config/nvim/ftplugin/zsh.lua index 6ece5ae..4dfbb7b 100644 --- a/.config/nvim/ftplugin/zsh.lua +++ b/.config/nvim/ftplugin/zsh.lua @@ -1,35 +1,4 @@ -if not require("cfg.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("cfg.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("cfg.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 }, - filetypes = { "zsh" }, - settings = { - rootMarkers = { ".git/" }, - languages = { - sh = sh_arguments, - }, - }, - } -end +require("lang.zsh").format() +require("lang.zsh").lint() +require("lang.zsh").lsp() +require("lang.zsh").dap() |