From a291b0597a7c9f76cfdb0dc4be9833ed6c8778e8 Mon Sep 17 00:00:00 2001 From: Brandon Conway Date: Sun, 4 Jul 2021 07:34:53 -0700 Subject: Solargraph uses stdio instead of --stdio (#642) You can see this in the [default config](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/solargraph.lua). --- ftplugin/ruby.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftplugin') diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index f46a71f8..4f2c20f8 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -1,6 +1,6 @@ -- If you are using rvm, make sure to change below configuration require'lspconfig'.solargraph.setup { - cmd = {DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "--stdio"}, + cmd = {DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio"}, on_attach = require'lsp'.common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with( -- cgit v1.2.3 From 7cd58b1228749f72a81ba84c265cafafe47fa5a6 Mon Sep 17 00:00:00 2001 From: PZ31k0nauT <86895284+PZ31k0nauT@users.noreply.github.com> Date: Sun, 4 Jul 2021 18:50:38 +0200 Subject: Basics for php lsp (#664) * Update php.lua * Update default-config.lua * Update lv-config.example.lua --- ftplugin/php.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/php.lua b/ftplugin/php.lua index abc90092..b571a213 100644 --- a/ftplugin/php.lua +++ b/ftplugin/php.lua @@ -1,4 +1,25 @@ require'lspconfig'.intelephense.setup { cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" }, - on_attach = require'lsp'.common_on_attach -} \ No newline at end of file + 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 + }, + } + }; +} -- cgit v1.2.3 From 9f511bcb594b7e2461c97cb8182603928c773c2f Mon Sep 17 00:00:00 2001 From: Rafael Date: Sun, 4 Jul 2021 22:14:01 -0300 Subject: start formatting rules --- ftplugin/c.lua | 42 +++++------ ftplugin/cmake.lua | 8 +- ftplugin/css.lua | 15 ++-- ftplugin/dart.lua | 20 ++--- ftplugin/docker.lua | 8 +- ftplugin/elixir.lua | 4 +- ftplugin/elm.lua | 16 ++-- ftplugin/euphoria3.lua | 4 +- ftplugin/go.lua | 36 ++++----- ftplugin/graphql.lua | 2 +- ftplugin/html.lua | 14 ++-- ftplugin/java.lua | 34 ++++----- ftplugin/javascript.lua | 113 ++++++++++++++-------------- ftplugin/javascriptreact.lua | 113 ++++++++++++++-------------- ftplugin/json.lua | 45 +++++------ ftplugin/kotlin.lua | 32 ++++---- ftplugin/lua.lua | 103 ++++++++++++------------- ftplugin/php.lua | 44 ++++++----- ftplugin/python.lua | 126 +++++++++++++++---------------- ftplugin/ruby.lua | 36 +++++---- ftplugin/rust.lua | 174 ++++++++++++++++++++++--------------------- ftplugin/sh.lua | 44 ++++++----- ftplugin/tex.lua | 6 +- ftplugin/tf.lua | 8 +- ftplugin/typescript.lua | 113 ++++++++++++++-------------- ftplugin/typescriptreact.lua | 113 ++++++++++++++-------------- ftplugin/vim.lua | 6 +- ftplugin/vue.lua | 8 +- ftplugin/yaml.lua | 8 +- ftplugin/zig.lua | 22 +++--- ftplugin/zsh.lua | 52 +++++++------ 31 files changed, 691 insertions(+), 678 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/c.lua b/ftplugin/c.lua index a2324986..ef371c03 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -1,31 +1,31 @@ -local clangd_flags = {"--background-index"}; +local clangd_flags = { "--background-index" } if O.lang.clang.cross_file_rename then - table.insert(clangd_flags, "--cross-file-rename") + 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("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, + }), + }, } if O.lang.clang.autoformat then - require('lv-utils').define_augroups({ - _clang_autoformat = { - {'BufWritePre *.c lua vim.lsp.buf.formatting_sync(nil,1000)'}, - {'BufWritePre *.h lua vim.lsp.buf.formatting_sync(nil,1000)'}, - {'BufWritePre *.cpp lua vim.lsp.buf.formatting_sync(nil,1000)'}, - {'BufWritePre *.hpp lua vim.lsp.buf.formatting_sync(nil,1000)'}, - }}) + require("lv-utils").define_augroups { + _clang_autoformat = { + { "BufWritePre *.c lua vim.lsp.buf.formatting_sync(nil,1000)" }, + { "BufWritePre *.h lua vim.lsp.buf.formatting_sync(nil,1000)" }, + { "BufWritePre *.cpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, + { "BufWritePre *.hpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, + }, + } end diff --git a/ftplugin/cmake.lua b/ftplugin/cmake.lua index a9647118..1b61ffb2 100644 --- a/ftplugin/cmake.lua +++ b/ftplugin/cmake.lua @@ -1,5 +1,5 @@ -require'lspconfig'.cmake.setup { - cmd = {DATA_PATH .. '/lspinstall/cmake/venv/bin/cmake-language-server'}, - on_attach = require'lsp'.common_on_attach, - filetypes = {"cmake"}, +require("lspconfig").cmake.setup { + cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" }, + on_attach = require("lsp").common_on_attach, + filetypes = { "cmake" }, } diff --git a/ftplugin/css.lua b/ftplugin/css.lua index 4affb45e..d51dee70 100644 --- a/ftplugin/css.lua +++ b/ftplugin/css.lua @@ -1,9 +1,10 @@ -- 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 +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, } -vim.cmd("setl ts=2 sw=2") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua index fe4898e8..419d0400 100644 --- a/ftplugin/dart.lua +++ b/ftplugin/dart.lua @@ -1,11 +1,11 @@ -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("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, + }, } diff --git a/ftplugin/docker.lua b/ftplugin/docker.lua index b477a239..37b4317f 100644 --- a/ftplugin/docker.lua +++ b/ftplugin/docker.lua @@ -1,6 +1,6 @@ -- 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("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, } diff --git a/ftplugin/elixir.lua b/ftplugin/elixir.lua index 362ee010..fbb5b29b 100644 --- a/ftplugin/elixir.lua +++ b/ftplugin/elixir.lua @@ -1,5 +1,5 @@ -require'lspconfig'.elixirls.setup{ - cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh"}; +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) diff --git a/ftplugin/elm.lua b/ftplugin/elm.lua index 3572a607..ffd97a2a 100644 --- a/ftplugin/elm.lua +++ b/ftplugin/elm.lua @@ -1,9 +1,9 @@ -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("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", + }, } diff --git a/ftplugin/euphoria3.lua b/ftplugin/euphoria3.lua index adc0ac7d..c434c56a 100644 --- a/ftplugin/euphoria3.lua +++ b/ftplugin/euphoria3.lua @@ -1,6 +1,6 @@ -- TODO Remove this at some point -require'lspconfig'.elixirls.setup{ - cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh"}; +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) diff --git a/ftplugin/go.lua b/ftplugin/go.lua index b2d6a82a..0bee465f 100644 --- a/ftplugin/go.lua +++ b/ftplugin/go.lua @@ -1,22 +1,22 @@ -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 +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, } if O.lang.go.autoformat then - require('lv-utils').define_augroups({ - _go_format = { - {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} - }, - _go = { - -- Go generally requires Tabs instead of spaces. - {'FileType', 'go', 'setlocal tabstop=4'}, - {'FileType', 'go', 'setlocal shiftwidth=4'}, - {'FileType', 'go', 'setlocal softtabstop=4'}, - {'FileType', 'go', 'setlocal noexpandtab'} - } - }) + require("lv-utils").define_augroups { + _go_format = { + { "BufWritePre", "*.go", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, + }, + _go = { + -- Go generally requires Tabs instead of spaces. + { "FileType", "go", "setlocal tabstop=4" }, + { "FileType", "go", "setlocal shiftwidth=4" }, + { "FileType", "go", "setlocal softtabstop=4" }, + { "FileType", "go", "setlocal noexpandtab" }, + }, + } end diff --git a/ftplugin/graphql.lua b/ftplugin/graphql.lua index 0bd97ed5..df3dce9b 100644 --- a/ftplugin/graphql.lua +++ b/ftplugin/graphql.lua @@ -1,2 +1,2 @@ -- npm install -g graphql-language-service-cli -require'lspconfig'.graphql.setup {on_attach = require'lsp'.common_on_attach} +require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach } diff --git a/ftplugin/html.lua b/ftplugin/html.lua index 26f149d5..312301b1 100644 --- a/ftplugin/html.lua +++ b/ftplugin/html.lua @@ -2,9 +2,13 @@ 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 +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, } -vim.cmd("setl ts=2 sw=2") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 0b151b66..00ca0091 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,4 +1,4 @@ -local util = require 'lspconfig/util' +local util = require "lspconfig/util" -- In Vimscript -- augroup lsp -- au! @@ -20,17 +20,17 @@ local util = require 'lspconfig/util' -- }; local on_attach = function(client, bufr) - -- require('jdtls').setup_dap() - require'lsp'.common_on_attach(client, bufr) + -- require('jdtls').setup_dap() + require("lsp").common_on_attach(client, bufr) end -require'lspconfig'.jdtls.setup { - on_attach = 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 +require("lspconfig").jdtls.setup { + on_attach = 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 } -- require('jdtls').start_or_attach({ @@ -41,10 +41,10 @@ require'lspconfig'.jdtls.setup { -- }) -- TODO setup autoformat stuff later - -- _java = { - -- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'}, - -- { - -- 'FileType', 'java', - -- 'nnoremap ca lua require(\'jdtls\').code_action()' - -- } - -- } +-- _java = { +-- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'}, +-- { +-- 'FileType', 'java', +-- 'nnoremap ca lua require(\'jdtls\').code_action()' +-- } +-- } diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index 16254da3..1c4004c2 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -7,64 +7,67 @@ -- 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 - - }) - } +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, + }), + }, } -require'lsp.ts-fmt-lint'.setup() +require("lsp.ts-fmt-lint").setup() if O.lang.tsserver.autoformat then - require('lv-utils').define_augroups({ - _javascript_autoformat = { - { + 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)' - } - } - }) + "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") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/javascriptreact.lua b/ftplugin/javascriptreact.lua index 16254da3..1c4004c2 100644 --- a/ftplugin/javascriptreact.lua +++ b/ftplugin/javascriptreact.lua @@ -7,64 +7,67 @@ -- 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 - - }) - } +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, + }), + }, } -require'lsp.ts-fmt-lint'.setup() +require("lsp.ts-fmt-lint").setup() if O.lang.tsserver.autoformat then - require('lv-utils').define_augroups({ - _javascript_autoformat = { - { + 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)' - } - } - }) + "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") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/json.lua b/ftplugin/json.lua index 3a565095..da0c9ff2 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -1,28 +1,29 @@ -- 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, +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 - } - } + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, } if O.lang.json.autoformat then - require('lv-utils').define_augroups({ - _json_format = { - { - 'BufWritePre', '*.json', - 'lua vim.lsp.buf.formatting_sync(nil, 1000)' - } - } - }) + require("lv-utils").define_augroups { + _json_format = { + { + "BufWritePre", + "*.json", + "lua vim.lsp.buf.formatting_sync(nil, 1000)", + }, + }, + } end diff --git a/ftplugin/kotlin.lua b/ftplugin/kotlin.lua index fcbb736b..dbd800b9 100644 --- a/ftplugin/kotlin.lua +++ b/ftplugin/kotlin.lua @@ -6,31 +6,29 @@ --- https://github.com/udalov/kotlin-vim (recommended) --- Note that there is no LICENSE specified yet. -local util = require 'lspconfig/util' +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" +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 + "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 + "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("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, } - diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index bd541177..f3c3ac50 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -2,71 +2,72 @@ 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 - } - } - } +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, + }, + }, + }, } if O.lang.lua.autoformat then - require('lv-utils').define_augroups({ - _lua_autoformat = { - { - 'BufWritePre', '*.lua', - 'lua vim.lsp.buf.formatting_sync(nil, 1000)' - } - } - }) + require("lv-utils").define_augroups { + _lua_autoformat = { + { + "BufWritePre", + "*.lua", + "lua vim.lsp.buf.formatting_sync(nil, 1000)", + }, + }, + } end local lua_arguments = {} local luaFormat = { - formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=80", - formatStdin = true + 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 + formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", + formatStdin = true, } -if O.lang.lua.formatter == 'lua-format' then +if O.lang.lua.formatter == "lua-format" then table.insert(lua_arguments, luaFormat) -elseif O.lang.lua.formatter == 'lua-fmt' then +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, - } - } +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/ftplugin/php.lua b/ftplugin/php.lua index b571a213..4dc8e9e0 100644 --- a/ftplugin/php.lua +++ b/ftplugin/php.lua @@ -1,25 +1,23 @@ -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 - - }) +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, + }, }, - filetypes = O.lang.php.filetypes, - settings = { - intelephense = { - format = { - braces = O.lang.php.format.braces - }, - environment = { - phpVersion = O.lang.php.environment.php_version - }, - } - }; + }, } diff --git a/ftplugin/python.lua b/ftplugin/python.lua index 23e54880..abb75e2a 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -2,86 +2,76 @@ 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"} + LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", + lintStdin = true, + lintFormats = { "%f:%l:%c: %m" }, } -local isort = {formatCommand = "isort --quiet -", formatStdin = true} +local isort = { formatCommand = "isort --quiet -", formatStdin = true } -local yapf = {formatCommand = "yapf --quiet", formatStdin = true} -local black = {formatCommand = "black --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.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.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) +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 = {"python"}, - settings = { - rootMarkers = {".git/", "requirements.txt"}, - languages = { - python = python_arguments, - } - } +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, + }, + }, } - - - - - - - - - - - - -- npm i -g pyright -require'lspconfig'.pyright.setup { - cmd = { - DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", - "--stdio" +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, + }, }, - 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 - } - } - } + }, } if O.lang.python.autoformat then - require('lv-utils').define_augroups({ - _python_autoformat = { - { - 'BufWritePre', '*.py', - 'lua vim.lsp.buf.formatting_sync(nil, 1000)' - } - } - }) + require("lv-utils").define_augroups { + _python_autoformat = { + { + "BufWritePre", + "*.py", + "lua vim.lsp.buf.formatting_sync(nil, 1000)", + }, + }, + } end diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index 4f2c20f8..0cff96ff 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -1,24 +1,22 @@ -- 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 +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, } if O.lang.ruby.autoformat then - require('lv-utils').define_augroups({ - _ruby_format = { - {'BufWritePre', '*.rb', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} - } - }) + require("lv-utils").define_augroups { + _ruby_format = { + { "BufWritePre", "*.rb", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, + }, + } end diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 2fddb982..34b211d6 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,99 +1,101 @@ 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 = "<-", - - -- prefix for all the other hints (type, chaining) - -- default: "=>" - 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"} - } - } + 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 = "<-", + + -- prefix for all the other hints (type, chaining) + -- default: "=>" + 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) - + }, + }, + + -- 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("Cargo.toml", - "rust-project.json") - } - + 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("Cargo.toml", "rust-project.json"), + } end -- TODO fix these mappings -vim.api.nvim_exec([[ +vim.api.nvim_exec( + [[ autocmd Filetype rust nnoremap lm RustExpandMacro autocmd Filetype rust nnoremap lH RustToggleInlayHints autocmd Filetype rust nnoremap le RustRunnables autocmd Filetype rust nnoremap lh RustHoverActions - ]], true) + ]], + true +) if O.lang.rust.autoformat then - require('lv-utils').define_augroups({ - _rust_format = { - {'BufWritePre', '*.rs', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} - } - }) + require("lv-utils").define_augroups { + _rust_format = { + { "BufWritePre", "*.rs", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, + }, + } end - diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index 7d9312f6..fa8f0785 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -1,33 +1,37 @@ -- 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" } +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 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'} + 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.formatter == "shfmt" then + table.insert(sh_arguments, shfmt) +end -if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) 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, - } - } +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/ftplugin/tex.lua b/ftplugin/tex.lua index 179c143c..71c484f7 100644 --- a/ftplugin/tex.lua +++ b/ftplugin/tex.lua @@ -1,4 +1,4 @@ -require'lspconfig'.texlab.setup{ - cmd = {DATA_PATH .. "/lspinstall/latex/texlab"}, - on_attach = require'lsp'.common_on_attach +require("lspconfig").texlab.setup { + cmd = { DATA_PATH .. "/lspinstall/latex/texlab" }, + on_attach = require("lsp").common_on_attach, } diff --git a/ftplugin/tf.lua b/ftplugin/tf.lua index a2e751a4..d46affd5 100644 --- a/ftplugin/tf.lua +++ b/ftplugin/tf.lua @@ -1,5 +1,5 @@ -require'lspconfig'.terraformls.setup{ - cmd = {DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve"}, - on_attach = require'lsp'.common_on_attach, - filetypes = { "tf", "terraform", "hcl" } +require("lspconfig").terraformls.setup { + cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" }, + on_attach = require("lsp").common_on_attach, + filetypes = { "tf", "terraform", "hcl" }, } diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua index 16254da3..1c4004c2 100644 --- a/ftplugin/typescript.lua +++ b/ftplugin/typescript.lua @@ -7,64 +7,67 @@ -- 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 - - }) - } +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, + }), + }, } -require'lsp.ts-fmt-lint'.setup() +require("lsp.ts-fmt-lint").setup() if O.lang.tsserver.autoformat then - require('lv-utils').define_augroups({ - _javascript_autoformat = { - { + 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)' - } - } - }) + "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") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/typescriptreact.lua b/ftplugin/typescriptreact.lua index 16254da3..1c4004c2 100644 --- a/ftplugin/typescriptreact.lua +++ b/ftplugin/typescriptreact.lua @@ -7,64 +7,67 @@ -- 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 - - }) - } +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, + }), + }, } -require'lsp.ts-fmt-lint'.setup() +require("lsp.ts-fmt-lint").setup() if O.lang.tsserver.autoformat then - require('lv-utils').define_augroups({ - _javascript_autoformat = { - { + 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)' - } - } - }) + "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") +vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/vim.lua b/ftplugin/vim.lua index 39beb119..449210b9 100644 --- a/ftplugin/vim.lua +++ b/ftplugin/vim.lua @@ -1,5 +1,5 @@ -- 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("lspconfig").vimls.setup { + cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" }, + on_attach = require("lsp").common_on_attach, } diff --git a/ftplugin/vue.lua b/ftplugin/vue.lua index 66fba01e..6787d12f 100644 --- a/ftplugin/vue.lua +++ b/ftplugin/vue.lua @@ -1,5 +1,5 @@ -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", ".") +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", "."), } diff --git a/ftplugin/yaml.lua b/ftplugin/yaml.lua index 7b6f9a25..e2847365 100644 --- a/ftplugin/yaml.lua +++ b/ftplugin/yaml.lua @@ -1,6 +1,6 @@ -- 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, +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") +vim.cmd "setl ts=2 sw=2 ts=2 ai et" diff --git a/ftplugin/zig.lua b/ftplugin/zig.lua index 06217ddd..7fc8d3fc 100644 --- a/ftplugin/zig.lua +++ b/ftplugin/zig.lua @@ -1,15 +1,15 @@ -- Because lspinstall don't support zig yet, -- So we need zls preset in global lib --- Further custom install zls in +-- 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, +require("lspconfig").zls.setup { + root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"), + on_attach = require("lsp").common_on_attach, } -require('lv-utils').define_augroups({ - _zig_autoformat = { - {'BufWritePre', '*.zig', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}, - {'BufEnter', '*.zig', ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")'} - } -}) -vim.cmd("setl expandtab tabstop=8 softtabstop=4 shiftwidth=4") +require("lv-utils").define_augroups { + _zig_autoformat = { + { "BufWritePre", "*.zig", "lua vim.lsp.buf.formatting_sync(nil, 1000)" }, + { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' }, + }, +} +vim.cmd "setl expandtab tabstop=8 softtabstop=4 shiftwidth=4" diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua index 7e99ebd3..a2847f19 100644 --- a/ftplugin/zsh.lua +++ b/ftplugin/zsh.lua @@ -1,40 +1,44 @@ -- 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" } +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" } +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 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'} + 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.formatter == "shfmt" then + table.insert(sh_arguments, shfmt) +end -if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) 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, - } - } +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, + }, + }, } -- cgit v1.2.3 From 4bbf4c290a4a61e70717f3ea52567d2cacfdedae Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 4 Jul 2021 23:25:16 -0400 Subject: rename to docker file --- ftplugin/docker.lua | 6 ------ ftplugin/dockerfile.lua | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 ftplugin/docker.lua create mode 100644 ftplugin/dockerfile.lua (limited to 'ftplugin') diff --git a/ftplugin/docker.lua b/ftplugin/docker.lua deleted file mode 100644 index 37b4317f..00000000 --- a/ftplugin/docker.lua +++ /dev/null @@ -1,6 +0,0 @@ --- 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, -} diff --git a/ftplugin/dockerfile.lua b/ftplugin/dockerfile.lua new file mode 100644 index 00000000..37b4317f --- /dev/null +++ b/ftplugin/dockerfile.lua @@ -0,0 +1,6 @@ +-- 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, +} -- cgit v1.2.3 From af5d292fbf51946ed508222cdefca3caed364971 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 5 Jul 2021 00:52:36 -0400 Subject: basic python debugging --- ftplugin/python.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ftplugin') diff --git a/ftplugin/python.lua b/ftplugin/python.lua index abb75e2a..04fe2ded 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -75,3 +75,6 @@ if O.lang.python.autoformat then }, } end + +local dap_install = require("dap-install") +dap_install.config("python_dbg", {}) -- cgit v1.2.3 From a569128faac772d05648b07ec93206010f12bc3d Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 5 Jul 2021 10:36:01 -0400 Subject: only when dap install is active --- ftplugin/python.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/python.lua b/ftplugin/python.lua index 04fe2ded..d7db1977 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -76,5 +76,7 @@ if O.lang.python.autoformat then } end -local dap_install = require("dap-install") -dap_install.config("python_dbg", {}) +if O.plugin.dap_install.active then + local dap_install = require("dap-install") + dap_install.config("python_dbg", {}) +end -- cgit v1.2.3 From 279e01f2f35948afa185115b100254cd1496277b Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 5 Jul 2021 13:58:38 -0400 Subject: debugging updates --- ftplugin/python.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftplugin') diff --git a/ftplugin/python.lua b/ftplugin/python.lua index d7db1977..62464397 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -76,7 +76,7 @@ if O.lang.python.autoformat then } end -if O.plugin.dap_install.active then +if O.plugin.debug.active and O.plugin.dap_install.active then local dap_install = require("dap-install") dap_install.config("python_dbg", {}) end -- cgit v1.2.3 From 71c5cb4f0be89d3a175e99b0c2ebc5e55178e8a9 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 5 Jul 2021 20:01:19 +0000 Subject: (feat) use neoformat as the defalt format option (#715) --- ftplugin/c.lua | 11 ----------- ftplugin/go.lua | 18 ++++-------------- ftplugin/javascript.lua | 35 ----------------------------------- ftplugin/javascriptreact.lua | 35 ----------------------------------- ftplugin/json.lua | 12 ------------ ftplugin/lua.lua | 31 ------------------------------- ftplugin/python.lua | 17 ----------------- ftplugin/ruby.lua | 8 -------- ftplugin/rust.lua | 8 -------- ftplugin/sh.lua | 4 ---- ftplugin/typescript.lua | 35 ----------------------------------- ftplugin/typescriptreact.lua | 35 ----------------------------------- ftplugin/zig.lua | 1 - ftplugin/zsh.lua | 6 ------ 14 files changed, 4 insertions(+), 252 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/c.lua b/ftplugin/c.lua index ef371c03..7443cabe 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -18,14 +18,3 @@ require("lspconfig").clangd.setup { }), }, } - -if O.lang.clang.autoformat then - require("lv-utils").define_augroups { - _clang_autoformat = { - { "BufWritePre *.c lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.h lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.cpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, - { "BufWritePre *.hpp lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/go.lua b/ftplugin/go.lua index 0bee465f..56b9cacc 100644 --- a/ftplugin/go.lua +++ b/ftplugin/go.lua @@ -6,17 +6,7 @@ require("lspconfig").gopls.setup { on_attach = require("lsp").common_on_attach, } -if O.lang.go.autoformat then - require("lv-utils").define_augroups { - _go_format = { - { "BufWritePre", "*.go", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - _go = { - -- Go generally requires Tabs instead of spaces. - { "FileType", "go", "setlocal tabstop=4" }, - { "FileType", "go", "setlocal shiftwidth=4" }, - { "FileType", "go", "setlocal softtabstop=4" }, - { "FileType", "go", "setlocal noexpandtab" }, - }, - } -end +vim.opt_local.tabstop = 4 +vim.opt_local.shiftwidth = 4 +vim.opt_local.softtabstop = 4 +vim.opt_local.expandtab = false diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -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.lua b/ftplugin/javascriptreact.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/javascriptreact.lua +++ b/ftplugin/javascriptreact.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -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/json.lua b/ftplugin/json.lua index da0c9ff2..29a3096f 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -15,15 +15,3 @@ require("lspconfig").jsonls.setup { }, }, } - -if O.lang.json.autoformat then - require("lv-utils").define_augroups { - _json_format = { - { - "BufWritePre", - "*.json", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index f3c3ac50..32c24e80 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -40,34 +40,3 @@ 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/ftplugin/python.lua b/ftplugin/python.lua index 62464397..a9b41648 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -20,12 +20,6 @@ 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" }, @@ -64,17 +58,6 @@ require("lspconfig").pyright.setup { }, }, } -if O.lang.python.autoformat then - require("lv-utils").define_augroups { - _python_autoformat = { - { - "BufWritePre", - "*.py", - "lua vim.lsp.buf.formatting_sync(nil, 1000)", - }, - }, - } -end if O.plugin.debug.active and O.plugin.dap_install.active then local dap_install = require("dap-install") diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index 0cff96ff..bc844cd3 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -12,11 +12,3 @@ require("lspconfig").solargraph.setup { }, filetypes = O.lang.ruby.filetypes, } - -if O.lang.ruby.autoformat then - require("lv-utils").define_augroups { - _ruby_format = { - { "BufWritePre", "*.rb", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 34b211d6..2a106e7e 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -91,11 +91,3 @@ vim.api.nvim_exec( ]], true ) - -if O.lang.rust.autoformat then - require("lv-utils").define_augroups { - _rust_format = { - { "BufWritePre", "*.rs", "lua vim.lsp.buf.formatting_sync(nil,1000)" }, - }, - } -end diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index fa8f0785..c146e45f 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -15,10 +15,6 @@ local shellcheck = { 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 diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua index 1c4004c2..ab370364 100644 --- a/ftplugin/typescript.lua +++ b/ftplugin/typescript.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -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 index 1c4004c2..ab370364 100644 --- a/ftplugin/typescriptreact.lua +++ b/ftplugin/typescriptreact.lua @@ -34,40 +34,5 @@ require("lspconfig").tsserver.setup { }), }, } - require("lsp.ts-fmt-lint").setup() - -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/zig.lua b/ftplugin/zig.lua index 7fc8d3fc..92b4120d 100644 --- a/ftplugin/zig.lua +++ b/ftplugin/zig.lua @@ -8,7 +8,6 @@ require("lspconfig").zls.setup { } require("lv-utils").define_augroups { _zig_autoformat = { - { "BufWritePre", "*.zig", "lua vim.lsp.buf.formatting_sync(nil, 1000)" }, { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' }, }, } diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua index a2847f19..b6fa9d5d 100644 --- a/ftplugin/zsh.lua +++ b/ftplugin/zsh.lua @@ -15,17 +15,11 @@ require("lspconfig").bashls.setup { -- 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 -- cgit v1.2.3