clone of my dotfiles.ssp.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix nvim lsp

sspaeti 88dc963d 43c4d433

+74 -55
+1 -1
nvim/.config/nvim/lua/sspaeti/plugins/_init_lazy.lua
··· 154 154 "hiphish/rainbow-delimiters.nvim", 155 155 event = "VeryLazy", 156 156 }, 157 - { "alexlafroscia/tree-sitter-glimmer", event = "VeryLazy" }, 157 + 158 158 { "LunarVim/bigfile.nvim", event = "VeryLazy" }, 159 159 { "towolf/vim-helm", event = "VeryLazy", ft = "helm" } 160 160 }
+13 -14
nvim/.config/nvim/lua/sspaeti/plugins/lsp/lspconfig.lua
··· 41 41 { "<Leader>la", vim.lsp.buf.code_action, desc = "LSP Code Action" }, 42 42 { "<Leader>lf", vim.lsp.buf.format, desc = "LSP Format" }, 43 43 { "<Leader>lr", vim.lsp.buf.rename, desc = "LSP Rename" }, 44 - { "<Leader>lc", vim.diagnostic.enable(false), desc = "Diagnostic Disable" }, 45 - { "<Leader>le", vim.diagnostic.enable, desc = "Diagnostic Enable" }, 44 + { "<Leader>lc", function() vim.diagnostic.enable(false) end, desc = "Diagnostic Disable" }, 45 + { "<Leader>le", function() vim.diagnostic.enable() end, desc = "Diagnostic Enable" }, 46 46 { "<leader>lo", vim.diagnostic.open_float, desc = "Diagnostic Open (Float)" }, 47 47 { "<Leader>ln", vim.diagnostic.goto_next, desc = "Diagnostic Go To Next" }, 48 48 { "]d", vim.diagnostic.goto_next, desc = "Diagnostic Go To Next" }, ··· 113 113 --vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) 114 114 --vim.keymap.set("n", "<leader>lh", function() vim.lsp.buf.signature_help() end, opts) 115 115 116 - -- turn on grammarly language server only for filetype=markdown 117 - if client.name == "grammarly" then 118 - vim.api.nvim_buf_set_option(bufnr, "filetype", "markdown") 119 - end 120 116 end 121 117 122 118 -- used to enable autocompletion (assign to every lsp server config) 123 119 local capabilities = cmp_nvim_lsp.default_capabilities() 124 120 125 121 -- Change the Diagnostic symbols in the sign column (gutter) 126 - -- (not in youtube nvim video) 127 - local signs = { Error = "", Warn = "", Hint = "", Info = "", } 128 - for type, icon in pairs(signs) do 129 - local hl = "DiagnosticSign" .. type 130 - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) 131 - end 122 + vim.diagnostic.config({ 123 + signs = { 124 + text = { 125 + [vim.diagnostic.severity.ERROR] = "", 126 + [vim.diagnostic.severity.WARN] = "", 127 + [vim.diagnostic.severity.HINT] = "ï µ", 128 + [vim.diagnostic.severity.INFO] = "", 129 + }, 130 + }, 131 + }) 132 132 133 133 -- Define LSP servers with their configurations 134 134 local servers = { ··· 230 230 for _, server in ipairs(servers) do 231 231 local name, config = server[1], server[2] 232 232 vim.lsp.config(name, config) 233 - -- Note: vim.lsp.enable() is NOT called here 234 - -- Servers will auto-start when opening matching filetypes 233 + vim.lsp.enable(name) 235 234 end 236 235 237 236 end,
+9
nvim/.config/nvim/lua/sspaeti/plugins/lsp/mason.lua
··· 32 32 "cssls", 33 33 "lua_ls", 34 34 "pyright", 35 + "ts_ls", 36 + "tailwindcss", 37 + "helm_ls", 38 + "graphql", 39 + "emmet_ls", 40 + "ruff", 41 + "lemminx", 42 + "bashls", 43 + "jdtls", 35 44 }, 36 45 -- auto-install configured servers (with lspconfig) 37 46 automatic_installation = true, -- not the same as ensure_installed
+28 -36
nvim/.config/nvim/lua/sspaeti/plugins/lsp/none-ls.lua
··· 1 1 return { 2 2 "nvimtools/none-ls.nvim", --before: jose-elias-alvarez/null-ls.nvim" 3 - lazy = true, 4 - -- event = { "BufReadPre", "BufNewFile" }, -- to enable uncomment this 3 + event = { "BufReadPre", "BufNewFile" }, 5 4 dependencies = { 6 5 "jay-babu/mason-null-ls.nvim", 7 6 }, ··· 15 14 mason_null_ls.setup({ 16 15 ensure_installed = { 17 16 "prettier", -- prettier formatter 18 - "stylua", -- lua formatter 19 - "black", -- python formatter 20 - "pylint", -- python linter 21 - "eslint_d", -- js linter 22 - "jq", --json format 17 + "jq", -- json format 18 + "mypy", -- python type checker 19 + -- "eslint_d", -- removed from none-ls builtins; use eslint LSP instead 23 20 }, 24 21 }) 25 22 ··· 42 39 root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), 43 40 -- setup formatters & linters 44 41 sources = { 45 - -- to disable file types use 46 - -- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs) 47 42 formatting.prettier.with({ extra_filetypes = { "svelte" } }), -- js/ts formatter 48 - formatting.stylua.with({ extra_args = { "indent_type=space" } }), -- lua formatter 49 - formatting.isort, 50 - formatting.black, 51 - -- formatting.black.with({ extra_args = { "--fast" } }), 52 - diagnostics.pylint, 53 - diagnostics.eslint_d.with({ -- js/ts linter 54 - condition = function(utils) 55 - return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs 56 - end, 57 - }), 58 - --see also ~/.pylintrc or .my_example.toml 59 - -- R - refactoring related checks => snake_case 60 - -- C - convention related checks 61 - -- W0511 disable TODO warning 62 - -- W1201, W1202 disable log format warning. False positives (I think) 63 - -- W0231 disable super-init-not-called - pylint doesn't understand six.with_metaclass(ABCMeta) 64 - -- W0707 disable raise-missing-from which we cant use because py2 back compat 65 - -- C0301 Line too long => disabled as black-formatter handles long lines automatically 66 - diagnostics.flake8.with({ 67 - extra_args = { 68 - "--max-line-length=88", 69 - "--disable=R,duplicate-code,W0231,W0511,W1201,W1202,W0707,C0301,no-init", 70 - }, 71 - }), 43 + -- diagnostics.eslint_d removed from none-ls builtins; use eslint LSP instead 44 + -- diagnostics.eslint_d.with({ 45 + -- condition = function(utils) 46 + -- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) 47 + -- end, 48 + -- }), 72 49 diagnostics.mypy.with({ extra_args = { "--ignore-missing-imports" } }), 73 - diagnostics.write_good, 50 + -- Replaced by ruff LSP (configure rules in ruff.toml / pyproject.toml): 51 + -- formatting.stylua.with({ extra_args = { "indent_type=space" } }), -- lua_ls handles lua formatting 52 + -- formatting.isort, -- ruff handles import sorting 53 + -- formatting.black, -- ruff handles python formatting 54 + -- diagnostics.pylint, -- ruff covers pylint rules (PLW, PLC, PLR prefixes) 55 + -- diagnostics.flake8.with({ 56 + -- extra_args = { 57 + -- "--max-line-length=88", 58 + -- "--disable=R,duplicate-code,W0231,W0511,W1201,W1202,W0707,C0301,no-init", 59 + -- }, 60 + -- }), 61 + -- diagnostics.write_good, 62 + -- 63 + -- Ruff equivalents for your pylint/flake8 disables (put in ruff.toml or pyproject.toml): 64 + -- [tool.ruff.lint] 65 + -- ignore = ["PLR", "PLW0511", "PLW1201", "PLW1202", "PLW0231", "PLW0707", "E501"] 74 66 }, 75 67 -- configure format on save TODO: this seem not to work yet, at least for python 76 68 on_attach = function(current_client, bufnr) 77 - local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') 69 + local filetype = vim.bo[bufnr].filetype 78 70 if current_client.supports_method("textDocument/formatting") 79 71 -- and filetype == 'python' --only python formatin on save 80 72 then ··· 83 75 group = augroup, 84 76 buffer = bufnr, 85 77 callback = function() 78 + if not vim.g.format_on_save then return end 86 79 vim.lsp.buf.format({ 87 80 filter = function(client) 88 81 -- only use null-ls for formatting instead of lsp server 89 - print("on_attach called for buffer", bufnr) 90 82 return client.name == "null-ls" 91 83 end, 92 84 bufnr = bufnr,
+1 -3
nvim/.config/nvim/lua/sspaeti/plugins/nvim-cmp.lua
··· 73 73 -- sources for autocompletion 74 74 sources = cmp.config.sources({ 75 75 { name = "nvim_lsp", priority = 1 }, 76 - { name = "vsnip" }, 76 + { name = "luasnip" }, 77 77 { name = "path" }, 78 78 { name = "luasnip" }, 79 79 { name = "obsidian" }, 80 80 { name = "obsidian_new" }, 81 - { name = "nvim_lsp:lua_ls" }, 82 - { name = "nvim_lsp:null-ls" }, 83 81 { name = "dictionary", keyword_length = 3, priority = 5, keyword_pattern = [[\w\+]] }, -- from uga-rosa/cmp-dictionary plug 84 82 }), 85 83 -- configure lspkind for vs-code like pictograms in completion menu
+1 -1
nvim/.config/nvim/lua/sspaeti/plugins/treesitter.lua
··· 14 14 return 15 15 end 16 16 treesitter.setup { 17 - ensure_installed = { "vimdoc", "python", "markdown", "markdown_inline", "css", "html", "javascript", "yaml", "bash", "json", "lua", "regex", "sql", "toml", "vim", "rust", "glimmer" }, -- one of "all" or a list of languages 17 + ensure_installed = { "vimdoc", "python", "markdown", "markdown_inline", "css", "html", "javascript", "yaml", "bash", "json", "lua", "regex", "sql", "toml", "vim", "rust" }, -- one of "all" or a list of languages 18 18 sync_install = false, 19 19 auto_install = true, 20 20 highlight = {
+11
nvim/.config/nvim/lua/sspaeti/remap.lua
··· 131 131 vim.keymap.set("n", "<Leader>li", ":Mason<CR>") 132 132 vim.keymap.set("n", "<Leader>ll", ":Lazy<CR>") 133 133 134 + -- Toggle format on save (controls the LspFormatting augroup from none-ls) 135 + vim.g.format_on_save = false -- disabled by default 136 + vim.keymap.set("n", "<Leader>lF", function() 137 + vim.g.format_on_save = not vim.g.format_on_save 138 + if vim.g.format_on_save then 139 + vim.notify("Format on save: ON") 140 + else 141 + vim.notify("Format on save: OFF") 142 + end 143 + end, { desc = "Toggle format on save" }) 144 + 134 145 -- closing buffers "https://stackoverflow.com/a/8585343/5246670 135 146 vim.keymap.set("n", "<C-w>q", ":bp<bar>sp<bar>bn<bar>bd<CR>") 136 147 --vim.keymap.set("n", "<leader>q", ":bp<bar>sp<bar>bn<bar>bd<CR>")
+10
ruff/.config/ruff/pyproject.toml
··· 2 2 # select = ["E", "F", "B", "W", "Q"] 3 3 # fix = true 4 4 line-length = 88 5 + 6 + [tool.ruff.lint] 7 + # Migrated from pylint/flake8 config: 8 + # PLR = refactoring checks (snake_case etc.) 9 + # PLW0511 = TODO warnings 10 + # PLW1201, PLW1202 = log format warnings (false positives) 11 + # PLW0231 = super-init-not-called 12 + # PLW0707 = raise-missing-from 13 + # E501 = line too long (ruff formatter handles this) 14 + ignore = ["PLR", "PLW0511", "PLW1201", "PLW1202", "PLW0231", "PLW0707", "E501"]