diff options
| -rw-r--r-- | .config/nvim/lazy-lock.json | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/config/language-servers.lua | 106 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/conform.lua | 24 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/mason.lua | 14 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/nvim-lint.lua | 78 | ||||
| -rw-r--r-- | hosts/laptop-nixos/home.nix | 5 |
6 files changed, 117 insertions, 111 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 301c642..67df559 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -40,6 +40,7 @@ "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dbee": { "branch": "master", "commit": "21d2cc0844a16262bb6ea93ab3d0a0f20bd87853" }, + "nvim-lint": { "branch": "master", "commit": "8e9562de7261e5b862c631958df616e1a65552cd" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, "nvim-lspconfig": { "branch": "master", "commit": "bc6ada4b0892b7f10852c0b8ca7209fd39a6d754" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, diff --git a/.config/nvim/lua/custom/config/language-servers.lua b/.config/nvim/lua/custom/config/language-servers.lua index 0f07d95..4163628 100644 --- a/.config/nvim/lua/custom/config/language-servers.lua +++ b/.config/nvim/lua/custom/config/language-servers.lua @@ -55,61 +55,61 @@ return { -- }, -- }, -- }, -- python - -- bashls = true, -- bash - -- taplo = true, -- toml - -- lemminx = true, -- xml - -- yamlls = true, -- yaml - -- jsonls = true, -- json - -- html = true, -- html - -- cssls = true, -- css - -- ts_ls = true, -- javascript/typescript - -- astro = true, -- astro framework - -- mdx_analyzer = true, -- markdown with JS I think + bashls = true, -- bash + taplo = true, -- toml + lemminx = true, -- xml + yamlls = true, -- yaml + jsonls = true, -- json + html = true, -- html + cssls = true, -- css + ts_ls = true, -- javascript/typescript + astro = true, -- astro framework + mdx_analyzer = true, -- markdown with JS I think -- marksman = true, -- Markdown LSP -- markdown_oxide = true, -- Markdown LSP but better - -- gopls = { - -- cmd = { 'gopls' }, - -- filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, - -- root_dir = function(filename) - -- return require('lspconfig/util').root_pattern('go.work', 'go.mod', '.git')(filename) - -- end, - -- settings = { - -- gopls = { - -- gofumpt = true, - -- codelenses = { - -- gc_details = false, - -- generate = true, - -- regenerate_cgo = true, - -- run_govulncheck = true, - -- test = true, - -- tidy = true, - -- upgrade_dependency = true, - -- vendor = true, - -- }, - -- hints = { - -- assignVariableTypes = false, - -- compositeLiteralFields = false, - -- compositeLiteralTypes = true, - -- constantValues = true, - -- functionTypeParameters = false, - -- parameterNames = false, - -- rangeVariableTypes = true, - -- }, - -- analyses = { - -- fieldalignment = true, - -- nilness = true, - -- unusedparams = true, - -- unusedwrite = true, - -- useany = true, - -- }, - -- usePlaceholders = false, - -- completeUnimported = true, - -- staticcheck = true, - -- directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' }, - -- semanticTokens = true, - -- }, - -- }, - -- }, -- Go LSP + gopls = { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_dir = function(filename) + return require('lspconfig/util').root_pattern('go.work', 'go.mod', '.git')(filename) + end, + settings = { + gopls = { + gofumpt = true, + codelenses = { + gc_details = false, + generate = true, + regenerate_cgo = true, + run_govulncheck = true, + test = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = false, + compositeLiteralFields = false, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = false, + parameterNames = false, + rangeVariableTypes = true, + }, + analyses = { + fieldalignment = true, + nilness = true, + unusedparams = true, + unusedwrite = true, + useany = true, + }, + usePlaceholders = false, + completeUnimported = true, + staticcheck = true, + directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' }, + semanticTokens = true, + }, + }, + }, -- Go LSP -- jdtls = true, -- java -- sqlls = true, -- sqls = { diff --git a/.config/nvim/lua/custom/plugins/conform.lua b/.config/nvim/lua/custom/plugins/conform.lua index 973e5dc..2610884 100644 --- a/.config/nvim/lua/custom/plugins/conform.lua +++ b/.config/nvim/lua/custom/plugins/conform.lua @@ -3,27 +3,27 @@ return { event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, keys = { - { '<leader>ft', '<cmd>FormatToggle<cr>', desc = '[F]ormat [T]oggle Globally' }, + { '<leader>ft', '<cmd>FormatToggle<cr>', desc = '[F]ormat [T]oggle Globally' }, { '<leader>fT', '<cmd>FormatToggle!<cr>', desc = '[F]ormat [T]oggle Locally' }, - { '<leader>ff', '<cmd>Format<cr>', desc = '[F]ormat [F]ile' }, - { '<leader>f', '<cmd>Format<cr><esc>', desc = '[F]ormat', mode = 'v' }, + { '<leader>ff', '<cmd>Format<cr>', desc = '[F]ormat [F]ile' }, + { '<leader>f', '<cmd>Format<cr><esc>', desc = '[F]ormat', mode = 'v' }, }, ---@module "conform" ---@type conform.setupOpts opts = { formatters_by_ft = { - -- ['lua'] = { 'stylua' }, + ['lua'] = { 'stylua' }, -- ['c'] = { 'clang-format' }, -- ['python'] = { 'isort', 'black' }, -- ['rust'] = { 'rustfmt' }, - -- ['go'] = { 'gofumpt', 'goimports-reviser' }, - -- ['markdown'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['yaml'] = { 'prettierd' }, - -- ['json'] = { 'jq' }, - -- ['html'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['css'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['javascript'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['typescript'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['go'] = { 'gofumpt', 'goimports-reviser' }, + ['markdown'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['yaml'] = { 'prettierd' }, + ['json'] = { 'jq' }, + ['html'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['css'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['javascript'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['typescript'] = { 'prettierd', 'prettier', stop_after_first = true }, }, format_on_save = function(bufnr) -- Disable with a global or buffer local variable diff --git a/.config/nvim/lua/custom/plugins/mason.lua b/.config/nvim/lua/custom/plugins/mason.lua index ca4cb32..c42ebc0 100644 --- a/.config/nvim/lua/custom/plugins/mason.lua +++ b/.config/nvim/lua/custom/plugins/mason.lua @@ -24,14 +24,14 @@ return { -- 'black', -- python formatter -- 'isort', -- python formatter for imports -- 'flake8', -- python linter - -- 'gofumpt', -- go formatter + 'gofumpt', -- go formatter -- 'golangci-lint', -- go linter - -- 'prettierd', -- multi-lang formatter - -- 'prettier', -- prettierd but slower, used as a fallback - -- 'jq', -- json formatter - -- 'jsonlint', -- json linter - -- 'shellcheck', -- bash linter - -- 'beautysh', -- shell formatter + 'prettierd', -- multi-lang formatter + 'prettier', -- prettierd but slower, used as a fallback + 'jq', -- json formatter + 'jsonlint', -- json linter + 'shellcheck', -- bash linter + 'beautysh', -- shell formatter }, }, }, diff --git a/.config/nvim/lua/custom/plugins/nvim-lint.lua b/.config/nvim/lua/custom/plugins/nvim-lint.lua index b9b0316..7bb3a16 100644 --- a/.config/nvim/lua/custom/plugins/nvim-lint.lua +++ b/.config/nvim/lua/custom/plugins/nvim-lint.lua @@ -1,41 +1,41 @@ return { - -- 'mfussenegger/nvim-lint', - -- lazy = false, - -- config = function() - -- local lint = require('lint') - -- lint.linters_by_ft = { - -- c = { 'clangtidy' }, - -- cpp = { 'clangtidy' }, - -- go = { 'golangcilint' }, - -- python = { 'flake8' }, - -- json = { 'jsonlint' }, - -- bash = { 'shellcheck' }, - -- } - -- - -- vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave', 'TextChanged', 'TextChangedI' }, { - -- group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), - -- callback = function() - -- require('lint').try_lint() - -- end, - -- }) - -- - -- -- NOTE: most if not all of clangt-idy warnings are - -- -- also reported by clangd, so this function filters clang-tidy warnings - -- -- to avoid duplication of warnings - -- local clangtidy_parser = lint.linters.clangtidy.parser - -- lint.linters.clangtidy.parser = function(output, bufnr, linter_cwd) - -- local diagnostics = clangtidy_parser(output, bufnr, linter_cwd) - -- diagnostics = vim.tbl_filter(function(diagnostic) - -- if diagnostic.severity == vim.diagnostic.severity.WARN then - -- return false - -- end - -- if diagnostic.severity == vim.diagnostic.severity.ERROR then - -- return false - -- end - -- - -- return true - -- end, diagnostics) - -- return diagnostics - -- end - -- end, + 'mfussenegger/nvim-lint', + lazy = false, + config = function() + local lint = require('lint') + lint.linters_by_ft = { + -- c = { 'clangtidy' }, + -- cpp = { 'clangtidy' }, + go = { 'golangcilint' }, + -- python = { 'flake8' }, + json = { 'jsonlint' }, + bash = { 'shellcheck' }, + } + + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave', 'TextChanged', 'TextChangedI' }, { + group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), + callback = function() + require('lint').try_lint() + end, + }) + + -- NOTE: most if not all of clangt-idy warnings are + -- also reported by clangd, so this function filters clang-tidy warnings + -- to avoid duplication of warnings + -- local clangtidy_parser = lint.linters.clangtidy.parser + -- lint.linters.clangtidy.parser = function(output, bufnr, linter_cwd) + -- local diagnostics = clangtidy_parser(output, bufnr, linter_cwd) + -- diagnostics = vim.tbl_filter(function(diagnostic) + -- if diagnostic.severity == vim.diagnostic.severity.WARN then + -- return false + -- end + -- if diagnostic.severity == vim.diagnostic.severity.ERROR then + -- return false + -- end + -- + -- return true + -- end, diagnostics) + -- return diagnostics + -- end + end, } diff --git a/hosts/laptop-nixos/home.nix b/hosts/laptop-nixos/home.nix index f15da4c..f406f18 100644 --- a/hosts/laptop-nixos/home.nix +++ b/hosts/laptop-nixos/home.nix @@ -42,6 +42,10 @@ protonvpn-gui unzip nvimpager + go + pnpm + nodejs_23 + python3Full ]; # Home Manager is pretty good at managing dotfiles. The primary way to manage @@ -62,6 +66,7 @@ home.sessionPath = [ "$HOME/.local/bin" ]; + # Let Home Manager install and manage itself. programs.home-manager.enable = true; } |
