Skip to content

Commit 734e114

Browse files
committed
nvim updates
1 parent 48357ca commit 734e114

File tree

9 files changed

+178
-90
lines changed

9 files changed

+178
-90
lines changed

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@
88
* feat(container): add podman-compose
99
* feat(container): add neofetch
1010
* feat(container): add /usr/local/bin/aws for aws cli v2
11-
* feat(zsh): add gi git ignore tool
11+
* feat(zsh): add `gi` git ignore tool
1212
* feat(templates): add daily and glossary templates
1313
* feat(bin): add webapps installer inspired by DHH/omacom
14+
* feat(nvim): lean in on nvim v0.11.x built in lsp
15+
* <https://vonheikemen.github.io/learn-nvim/feature/lsp-setup.html>
16+
* remove `lsp-zero`
17+
* another `lspconfig` rewrite
18+
* removed `💡` as it was lighting up on every line of python, ruff gives you code action everywhere.
19+
* feat(nvim): `<leader><CR>` closes all popups as well as `noh`
20+
* feat(nvim): add diagnodtic_or_spell bindings depending on filetype
1421

1522
## 0.1.3
1623

1724
* fix npm install directory
1825
* versioned distrobox.ini
1926
* converted from python3.11 image to ubuntu:24.04
20-
* updated nvim to v0.11.0
27+
* updated nvim to `v0.11.0`
2128
* update installers
2229
* add date keymap for nvim
2330

@@ -32,7 +39,7 @@
3239
* add ghostty distrobox
3340
* fix Dockerfile
3441
* add syntax highlighting for `Containerfile` in nvim
35-
* add just testnvim to run quick local tests of a fresh nvim install
42+
* add `just testnvim` to run quick local tests of a fresh nvim install
3643

3744
## 0.1.1
3845

@@ -49,7 +56,7 @@
4956
* add tailscale and fuser host commands to devtainer distrobox
5057
* update installers
5158
* installer is done in justfile, not in alias
52-
* fix missing batcat
59+
* fix missing `batcat`
5360
* configure nvim-manager in zshrc
5461
* devtainer builds now have a semver version defined in `version` file
5562

nvim/.config/nvim/lazy-lock.json

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
{
22
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
3-
"LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" },
3+
"LuaSnip": { "branch": "master", "commit": "831a130291eb6dae0dabd2748d0a99401a2eebc4" },
44
"aerial.nvim": { "branch": "master", "commit": "5c0df1679bf7c814c924dc6646cc5291daca8363" },
5-
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
6-
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
5+
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
76
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
8-
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
9-
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
7+
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
108
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
119
"codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" },
12-
"conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" },
10+
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
1311
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
1412
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
1513
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
16-
"gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" },
14+
"gitsigns.nvim": { "branch": "main", "commit": "1fcaddcc427ff5802b6602f46de37a5352d0f9e0" },
1715
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
1816
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
1917
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
20-
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
21-
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
18+
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
2219
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
23-
"mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" },
24-
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
25-
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
20+
"mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" },
2621
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
2722
"menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" },
28-
"none-ls.nvim": { "branch": "main", "commit": "db2a48b79cfcdab8baa5d3f37f21c78b6705c62e" },
23+
"mini.nvim": { "branch": "main", "commit": "432a0614f8dc38715892b0eec537716457ea4c2f" },
24+
"none-ls.nvim": { "branch": "main", "commit": "a5954f00ee88bcdf154e931198ec636a26a1077c" },
2925
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
3026
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
31-
"nvim-lspconfig": { "branch": "master", "commit": "6ed0fc9f86c93d5a816419e7d99be85a3c6fed10" },
27+
"nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" },
3228
"nvim-navbuddy": { "branch": "master", "commit": "a34786c77a528519f6b8a142db7609f6e387842d" },
3329
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
34-
"nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" },
30+
"nvim-tree.lua": { "branch": "master", "commit": "543ed3cac212dc3993ef9f042f6c0812e34ddd43" },
3531
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
3632
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
37-
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
33+
"nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" },
3834
"onedark.nvim": { "branch": "master", "commit": "11de4da47f3e69cb70c3ae9816bd8af166cbe121" },
3935
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
4036
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
4137
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
42-
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" },
43-
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
38+
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
39+
"vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" },
4440
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
4541
"volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }
4642
}

nvim/.config/nvim/lua/waylonwalker/keymap.lua

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,17 @@ set("n", "<leader>qq", "yy<cmd>lua require'waylonwalker.util.window'.open_window
310310
set("v", "<leader>qq", "d<cmd>lua require'waylonwalker.util.window'.open_window()<cr>pkddgqqggyG:q<cr>P")
311311

312312
set("n", "((", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
313+
set("n", ")(", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
313314
set("n", "))", "<cmd>lua vim.diagnostic.goto_next()<CR>")
315+
set("n", "()", "<cmd>lua vim.diagnostic.goto_next()<CR>")
314316

315317
set("n", "<c-n>", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
316318
set("n", "<c-p>", "<cmd>lua vim.diagnostic.goto_next()<CR>")
317319

320+
vim.keymap.set("n", "<leader>e", function()
321+
vim.diagnostic.open_float(nil, { focus = false })
322+
end, { desc = "Show diagnostic float" })
323+
318324
set("n", "<leader>a", "<cmd>AerialToggle!left<CR>")
319325

320326
-- Keyboard users
@@ -346,8 +352,33 @@ end, { expr = true })
346352
vim.api.nvim_create_user_command("PreCommit", "!pre-commit run --files %", {})
347353
vim.api.nvim_create_user_command("QQ", "q!", {})
348354

349-
set("n", "<f4>", "]s")
350-
set("n", "<f5>", "[s")
351-
set("n", "<f6>", "<cmd>Telescope spell_suggest<cr>")
355+
-- set("n", "<f4>", "]s")
356+
-- set("n", "<f5>", "[s")
357+
-- set("n", "<f6>", "<cmd>Telescope spell_suggest<cr>")
358+
local function diagnostic_or_spell(dir)
359+
return function()
360+
if vim.bo.filetype == "markdown" then
361+
-- Use normal keys for spell navigation
362+
vim.api.nvim_feedkeys(dir == "next" and "]s" or "[s", "n", false)
363+
else
364+
-- Use diagnostic navigation
365+
if dir == "next" then
366+
vim.diagnostic.goto_next()
367+
else
368+
vim.diagnostic.goto_prev()
369+
end
370+
end
371+
end
372+
end
373+
374+
set("n", "<F4>", diagnostic_or_spell("next"), { desc = "Previous diagnostic or spelling error" })
375+
set("n", "<F5>", diagnostic_or_spell("prev"), { desc = "Next diagnostic or spelling error" })
376+
set("n", "<F6>", function()
377+
if vim.bo.filetype == "markdown" then
378+
vim.cmd("Telescope spell_suggest")
379+
else
380+
vim.lsp.buf.code_action({ apply = true })
381+
end
382+
end, { desc = "Auto-fix or spell suggest" })
352383

353384
return M

nvim/.config/nvim/lua/waylonwalker/lazy.lua

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
local is_docker = os.getenv("DOCKER_BUILD") == "true"
22
-- Bootstrap lazy.nvim
33
require("lazy").setup({
4+
{ "echasnovski/mini.nvim", version = false },
5+
46
{
57
"nvim-treesitter/nvim-treesitter",
68
build = ":TSUpdate",
@@ -12,8 +14,8 @@ require("lazy").setup({
1214
require("waylonwalker.plugins.treesitter")
1315
end,
1416
},
15-
{ "nvzone/volt", lazy = true },
16-
{ "nvzone/menu", lazy = true },
17+
{ "nvzone/volt", lazy = true },
18+
{ "nvzone/menu", lazy = true },
1719
{
1820
"nvim-tree/nvim-tree.lua",
1921
dependencies = {
@@ -62,40 +64,35 @@ require("lazy").setup({
6264
enabled = not is_docker,
6365
},
6466
{
65-
"VonHeikemen/lsp-zero.nvim",
67+
"neovim/nvim-lspconfig",
6668
dependencies = {
67-
-- LSP Support
68-
{ "neovim/nvim-lspconfig" },
69-
{ "williamboman/mason.nvim" },
70-
{ "williamboman/mason-lspconfig.nvim" },
71-
{ "onsails/lspkind.nvim" },
72-
73-
-- Autocompletion
74-
{ "hrsh7th/nvim-cmp" },
75-
{ "hrsh7th/cmp-buffer" },
76-
{ "hrsh7th/cmp-path" },
77-
{ "saadparwaiz1/cmp_luasnip" },
78-
{ "hrsh7th/cmp-nvim-lsp" },
79-
{ "hrsh7th/cmp-nvim-lua" },
80-
81-
-- Snippets
82-
{ "L3MON4D3/LuaSnip" },
83-
{ "rafamadriz/friendly-snippets" },
69+
"williamboman/mason.nvim",
70+
"williamboman/mason-lspconfig.nvim",
71+
"hrsh7th/cmp-nvim-lsp",
72+
"nvim-telescope/telescope.nvim",
73+
},
74+
config = function()
75+
require("waylonwalker.plugins.lsp")
76+
end,
77+
},
8478

85-
{ "williamboman/mason.nvim" },
86-
{
87-
"jay-babu/mason-null-ls.nvim",
88-
event = { "BufReadPre", "BufNewFile" },
89-
dependencies = {
90-
"williamboman/mason.nvim",
91-
"nvimtools/none-ls.nvim",
79+
{
80+
"nvimdev/lspsaga.nvim",
81+
config = function()
82+
require("lspsaga").setup({
83+
ui = {
84+
code_action = "",
9285
},
93-
config = function()
94-
require("waylonwalker.plugins.null-ls")
95-
end,
96-
},
86+
})
87+
end,
88+
dependencies = {
89+
"nvim-treesitter/nvim-treesitter", -- optional
90+
"nvim-tree/nvim-web-devicons", -- optional
9791
},
9892
},
93+
94+
{ "j-hui/fidget.nvim" },
95+
9996
{
10097
"nvimtools/none-ls.nvim",
10198
dependencies = { "nvim-lua/plenary.nvim" },
@@ -121,21 +118,6 @@ require("lazy").setup({
121118

122119
-- Detect tabstop and shiftwidth automatically
123120
"tpope/vim-sleuth",
124-
125-
{ -- LSP Configuration & Plugins
126-
"neovim/nvim-lspconfig",
127-
dependencies = {
128-
-- Automatically install LSPs and related tools to stdpath for neovim
129-
"williamboman/mason.nvim",
130-
"williamboman/mason-lspconfig.nvim",
131-
"WhoIsSethDaniel/mason-tool-installer.nvim",
132-
133-
-- Useful status updates for LSP.
134-
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
135-
{ "j-hui/fidget.nvim", opts = {} },
136-
},
137-
config = require("waylonwalker.plugins.lsp-config").setup,
138-
},
139121
{
140122
-- Autocompletion
141123
"hrsh7th/nvim-cmp",
@@ -177,27 +159,21 @@ require("lazy").setup({
177159
end
178160

179161
-- Navigation
180-
map({ "n", "v" }, "]c", function()
162+
map("n", "<f1>", function()
181163
if vim.wo.diff then
182-
return "]c"
164+
vim.cmd.normal({ "<f1>", bang = true })
165+
else
166+
gs.nav_hunk("next")
183167
end
184-
vim.schedule(function()
185-
gs.next_hunk()
186-
end)
187-
return "<Ignore>"
188-
end, { expr = true, desc = "Jump to next hunk" })
168+
end)
189169

190-
map({ "n", "v" }, "[c", function()
170+
map("n", "<f2>", function()
191171
if vim.wo.diff then
192-
return "[c"
172+
vim.cmd.normal({ "<f2>", bang = true })
173+
else
174+
gs.nav_hunk("prev")
193175
end
194-
vim.schedule(function()
195-
gs.prev_hunk()
196-
end)
197-
return "<Ignore>"
198-
end, { expr = true, desc = "Jump to previous hunk" })
199-
200-
-- Actions
176+
end) -- Actions
201177
-- visual mode
202178
map("v", "<leader>hs", function()
203179
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
local M = {}
22
M.cmp = require("waylonwalker.plugins.cmp")
33
M.fugitive = require("waylonwalker.plugins.fugitive")
4-
-- M.lsp_config = require("waylonwalker.plugins.lsp-config")
5-
M.null_ls = require("waylonwalker.plugins.null-ls")
64
M.autoformat = require("waylonwalker.plugins.autoformat")
75
M.lualine = require("waylonwalker.plugins.lualine")
86
M.treesitter = require("waylonwalker.plugins.treesitter")
97
M.alpha_nvim = require("waylonwalker.plugins.alpha-nvim")
10-
-- M.coverage = require("waylonwalker.plugins.coverage")
118
M.navbuddy = require("waylonwalker.plugins.navbuddy")
129
return M
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- lua/plugins/lsp/init.lua (or similar)
2+
local servers = {
3+
"ruff",
4+
-- "ty",
5+
"ts_ls",
6+
"lua_ls",
7+
"jsonls",
8+
"yamlls",
9+
}
10+
11+
require("mason").setup()
12+
require("mason-lspconfig").setup({
13+
ensure_installed = servers,
14+
})
15+
16+
local lspconfig = require("lspconfig")
17+
18+
local capabilities = vim.lsp.protocol.make_client_capabilities()
19+
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
20+
21+
for _, server in ipairs(servers) do
22+
lspconfig[server].setup({
23+
on_attach = function(client, bufnr)
24+
-- map keys, format on save, etc.
25+
end,
26+
capabilities = capabilities,
27+
})
28+
end
29+
30+
vim.lsp.config("ty", {
31+
init_options = {
32+
settings = {
33+
-- ty language server settings go here
34+
},
35+
},
36+
})
37+
38+
-- Required: Enable the language server
39+
vim.lsp.enable("ty")
40+
41+
-- vim.fn.sign_define("LspCodeActionSign", { text = "", texthl = "" })

nvim/.config/nvim/lua/waylonwalker/util/color.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ M.nobg = function()
2929
vim.cmd("highlight CursorLineNr ctermbg=NONE guibg=NONE")
3030
vim.cmd("highlight SignColumn ctermbg=NONE guibg=NONE")
3131
vim.cmd("nohl")
32+
33+
-- Close all floating windows
34+
for _, win in ipairs(vim.api.nvim_list_wins()) do
35+
if vim.api.nvim_win_get_config(win).relative ~= "" then
36+
vim.api.nvim_win_close(win, true)
37+
end
38+
end
3239
end
3340

3441
api.nvim_set_keymap(

0 commit comments

Comments
 (0)