updated lsp, linting and formatters nvim

This commit is contained in:
liph22
2025-12-20 17:43:24 +01:00
parent 3a741ac23c
commit bb05a90ee9
14 changed files with 245 additions and 89 deletions

File diff suppressed because one or more lines are too long

View File

@@ -37,7 +37,6 @@ monitor=,preferred,auto,1.5
# Set programs that you use # Set programs that you use
$terminal = kitty $terminal = kitty
$fileManager = dolphin
$menu = wofi --show drun $menu = wofi --show drun
$browser = librewolf $browser = librewolf
$mail = betterbird $mail = betterbird
@@ -227,7 +226,6 @@ $mainMod = SUPER # Sets "Windows" key as main modifier
bind = $mainMod, return, exec, $terminal bind = $mainMod, return, exec, $terminal
bind = $SUPER_SHIFT, c, killactive, bind = $SUPER_SHIFT, c, killactive,
bind = $mainMod, !, exit, bind = $mainMod, !, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating, bind = $mainMod, V, togglefloating,
bind = $mainMod, space, exec, $menu bind = $mainMod, space, exec, $menu
bind = $mainMod, P, exec, [workspace 5 silent] bitwarden-desktop bind = $mainMod, P, exec, [workspace 5 silent] bitwarden-desktop
@@ -339,7 +337,7 @@ bindl = , XF86AudioPrev, exec, playerctl previous
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# Ignore maximize requests from apps. You'll probably like this. # Ignore maximize requests from apps. You'll probably like this.
windowrulev2 = suppressevent maximize, class:.* # windowrulev2 = suppressevent maximize, class:.*
# Fix some dragging issues with XWayland # Fix some dragging issues with XWayland
#windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 #windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0

View File

@@ -10,6 +10,7 @@
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" }, "cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "328c2f1dda56f933d3337a1316e1020ba30ba6aa" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
@@ -24,14 +25,15 @@
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" }, "luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
"neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" }, "neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"none-ls.nvim": { "branch": "main", "commit": "5abf61927023ea83031753504adb19630ba80eef" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" },
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" }, "nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
"nvim-lint": { "branch": "master", "commit": "7a64f4067065c16a355d40d0d599b8ca6b25de6d" },
"nvim-lspconfig": { "branch": "master", "commit": "c4f67bf85b01a57e3c130352c0a0e453ab8cd5b9" }, "nvim-lspconfig": { "branch": "master", "commit": "c4f67bf85b01a57e3c130352c0a0e453ab8cd5b9" },
"nvim-navic": { "branch": "master", "commit": "7d914a39a1ef8f4e22c2c4381abeef7c556f5a13" }, "nvim-navic": { "branch": "master", "commit": "7d914a39a1ef8f4e22c2c4381abeef7c556f5a13" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
@@ -43,7 +45,6 @@
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"portal.nvim": { "branch": "main", "commit": "77d9d53fec945bfa407d5fd7120f1b4f117450ed" }, "portal.nvim": { "branch": "main", "commit": "77d9d53fec945bfa407d5fd7120f1b4f117450ed" },
"projections.nvim": { "branch": "main", "commit": "f18a8505f84f45a0fe024cafca5b969447f63cd5" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "3d757e586ff0bfc85bdb7b46c9d3d932147a0cde" }, "telescope.nvim": { "branch": "master", "commit": "3d757e586ff0bfc85bdb7b46c9d3d932147a0cde" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },

View File

@@ -0,0 +1,24 @@
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
-- null_ls.builtins.diagnostics.eslint_d,
null_ls.builtins.diagnostics.rubocop,
null_ls.builtins.formatting.rubocop,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.diagnostics.pylint,
null_ls.builtins.formatting.beautysh,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}

View File

@@ -1,3 +1,5 @@
-- This is a VS Code like winbar that uses nvim-navic in order to get LSP context from your language server.
return { return {
{ {
"utilyre/barbecue.nvim", "utilyre/barbecue.nvim",

View File

@@ -0,0 +1,79 @@
return {
{
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("conform").setup({
formatters_by_ft = {
-- Lua
lua = { "stylua" },
-- JavaScript/TypeScript/Web
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
vue = { "prettier" },
css = { "prettier" },
scss = { "prettier" },
less = { "prettier" },
html = { "prettier" },
json = { "prettier" },
jsonc = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
handlebars = { "prettier" },
-- Ruby
ruby = { "rubocop" },
-- Python (black first, then isort for imports)
python = { "black", "isort" },
-- Bash/Shell
sh = { "beautysh" },
bash = { "beautysh" },
zsh = { "beautysh" },
},
-- Format on save
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
-- Formatter settings
formatters = {
stylua = {
prepend_args = { "--indent-type", "Spaces", "--indent-width", "2" },
},
prettier = {
prepend_args = { "--tab-width", "2" },
},
beautysh = {
prepend_args = { "--indent-size", "2" }, -- 2 spaces for bash
},
},
})
-- Manual format keymap (same as your old <leader>gf)
vim.keymap.set("n", "<leader>gf", function()
require("conform").format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format buffer" })
-- Optional: format on visual selection
vim.keymap.set("v", "<leader>gf", function()
require("conform").format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format selection" })
end,
},
}

View File

@@ -44,6 +44,16 @@ return {
}, },
}, },
pyright = {}, pyright = {},
bashls = {
filetypes = { "sh", "bash", "zsh" },
settings = {
bashIde = {
globPattern = "*@(.sh|.inc|.bash|.command|.zsh)",
shellcheckPath = "shellcheck",
},
},
},
} }
-- Setup each server with the new API -- Setup each server with the new API

View File

@@ -0,0 +1,36 @@
return {
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
dependencies = { "williamboman/mason.nvim" },
opts = {
ensure_installed = {
-- Formatters (you already have these)
"stylua",
"prettier",
"rubocop",
"black",
"isort",
"beautysh",
-- Linters (add these)
"ruff", -- Python (fast!)
"shellcheck", -- Bash
"jsonlint", -- JSON
"stylelint", -- CSS/SCSS
"htmlhint", -- HTML
"hadolint", -- Dockerfile
"eslint_d", -- JavaScript/TypeScript
"markdownlint", -- Markdown
-- LSP servers (optional)
"bash-language-server",
"dockerfile-language-server",
"ts_ls",
"solargraph",
"html",
"lua_ls",
"pyright",
},
},
},
}

View File

@@ -1,23 +0,0 @@
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
-- null_ls.builtins.diagnostics.eslint_d,
null_ls.builtins.diagnostics.rubocop,
null_ls.builtins.formatting.rubocop,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.diagnostics.pylint,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}

View File

@@ -0,0 +1,65 @@
return {
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
lint.linters_by_ft = {
-- Python
python = { "ruff" }, -- Fast! Replaces pylint, flake8, isort
-- Alternative: python = { "pylint" },
-- Or combine: python = { "ruff", "mypy" }, -- ruff + type checking
-- Bash/Shell
sh = { "shellcheck" },
bash = { "shellcheck" },
zsh = { "shellcheck" },
-- JSON
json = { "jsonlint" },
jsonc = { "jsonlint" },
-- CSS/SCSS
css = { "stylelint" },
scss = { "stylelint" },
sass = { "stylelint" },
less = { "stylelint" },
-- HTML
html = { "htmlhint" },
-- Alternative: html = { "tidy" },
-- Dockerfile (bonus)
dockerfile = { "hadolint" },
-- JavaScript/TypeScript (bonus)
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
-- Ruby (you already have this formatter)
ruby = { "rubocop" },
-- Markdown (bonus)
markdown = { "markdownlint" },
}
-- Auto-lint on save and when leaving insert mode
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
-- Manual lint trigger
vim.keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting" })
end,
},
}

View File

@@ -1,38 +0,0 @@
return {
{
"gnikdroy/projections.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
},
config = function()
require("projections").setup({
workspaces = {
"~/projects",
"~/obsidian",
"~/.config",
},
patterns = { ".git", "package.json", "Cargo.toml", "go.mod" },
})
require("telescope").load_extension("projections")
-- Auto-store session on VimExit
local Session = require("projections.session")
vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
callback = function() Session.store(vim.loop.cwd()) end,
})
-- Auto-restore session
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
if vim.fn.argc() == 0 then
Session.restore(vim.loop.cwd())
end
end,
})
end,
keys = {
{ "<leader>fp", "<cmd>Telescope projections<cr>", desc = "Find Projects" },
},
},
}

View File

View File

@@ -2,7 +2,9 @@ tank /mnt/tank/ t
ssd2 /mnt/ssd2/ 7 ssd2 /mnt/ssd2/ 7
ssd1 /mnt/ssd1/ 6 ssd1 /mnt/ssd1/ 6
plugins /home/liph/.config/nvim/lua/plugins/ p plugins /home/liph/.config/nvim/lua/plugins/ p
obsidian /home/liph/Documents/obsidian/vault/ o
nvim /home/liph/.config/nvim/ n nvim /home/liph/.config/nvim/ n
liph /home/liph/ l
hypr /home/liph/.config/hypr/ h hypr /home/liph/.config/hypr/ h
healing /mnt/tank/audio/healing/ H healing /mnt/tank/audio/healing/ H
hdd5 /mnt/hdd5/ 5 hdd5 /mnt/hdd5/ 5
@@ -13,5 +15,4 @@ hdd1 /mnt/hdd1/ 1
flash1 /mnt/flash1/ 8 flash1 /mnt/flash1/ 8
Downloads /home/liph/Downloads/ D Downloads /home/liph/Downloads/ D
dotfiles /home/liph/dotfiles/ d dotfiles /home/liph/dotfiles/ d
Desktop /home/liph/Desktop/ d
.config /home/liph/.config/ c .config /home/liph/.config/ c