From 94e1b6c3d54ed36f1afe17cb75baac397a3864c7 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Sun, 16 Mar 2025 11:08:21 +0100 Subject: [PATCH 01/20] docs: add FreeBSD requirements --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 48b28f5..c0aed23 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,9 @@ NOTE: EXTERNAL DEPENDENCIES MACOS - fd (https://github.com/sharkdp/fd, used by telescope) - A Nerd font (https://www.nerdfonts.com/, used by various plugins) +NOTE: EXTERNAL DEPENDENCIES FREEBSD +- cmake, ripgrep (pkg install ) + NOTE: EXTERNAL DEPENDENCIES WINDOWS See https://blog.nikfp.com/how-to-install-and-set-up-neovim-on-windows - ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope) From cfe153c47bb69737d6ba8f87af21428bf23ab3a1 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 17 Mar 2025 09:43:42 +0100 Subject: [PATCH 02/20] chore: update lazy plugins --- after/ftplugin/trouble.lua | 5 ---- lazy-lock.json | 50 +++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 30 deletions(-) delete mode 100644 after/ftplugin/trouble.lua diff --git a/after/ftplugin/trouble.lua b/after/ftplugin/trouble.lua deleted file mode 100644 index d8d62f0..0000000 --- a/after/ftplugin/trouble.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Disable column width indicators in quickfix/Trouble windows --- vim.opt.colorcolumn = "" -vim.opt.colorcolumn = "" -vim.opt_local.colorcolumn = "" -vim.wo.colorcolumn = "0" diff --git a/lazy-lock.json b/lazy-lock.json index bba3e9c..cecb73f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,39 +1,39 @@ { "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, - "auto-dark-mode.nvim": { "branch": "master", "commit": "02ef9553e2a1d6e861bc6955d58ce5883d28a6ad" }, + "auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "conform.nvim": { "branch": "master", "commit": "80b57f662b5e13ae8c2c7c38639966084625fa5e" }, + "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, "copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "flash.nvim": { "branch": "main", "commit": "f899265876ecdcf7352dbc9f0adf87068cedefbb" }, - "gitsigns.nvim": { "branch": "main", "commit": "9772ce68a9a6d156f3f2166bfd0a17a09ab37eba" }, - "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, + "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lsp-zero.nvim": { "branch": "v4.x", "commit": "baff1ca10ecad7efe04f02f06d2647dd2ae90074" }, - "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, - "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, - "mini.nvim": { "branch": "main", "commit": "87fc38a8a2b8d498cecb021d057a38ea2e9f5a79" }, + "lualine.nvim": { "branch": "master", "commit": "b8b60c7f1d0d95ad74ee215b2291280b30482476" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.nvim": { "branch": "main", "commit": "88f18a7d018d8bb4d32f6be4c712134a10e826d3" }, "newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" }, - "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" }, - "nvim-lspconfig": { "branch": "master", "commit": "00dae9f5f4ad215d4561f2fd2f26478c48b0ca7f" }, - "nvim-treesitter": { "branch": "master", "commit": "cced713b4993ddbfba8f82e9e60fcab7cbee8101" }, - "nvim-treesitter-context": { "branch": "master", "commit": "9a49f43a2ec9bf77aecfb0fcbc43af43338375c0" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, - "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, - "oil.nvim": { "branch": "master", "commit": "add50252b5e9147c0a09d36480d418c7e2737472" }, - "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, - "rose-pine": { "branch": "main", "commit": "20c7940da844aa4f162a64e552ae3c7e9fdc3b93" }, - "smear-cursor.nvim": { "branch": "main", "commit": "110f7d8771fff9dde6b2aa7e20c29bae8bb4d834" }, - "snipe.nvim": { "branch": "main", "commit": "0d0a482ac713370196e4fc0025d5aaac5030104d" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, + "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, + "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, + "nvim-lspconfig": { "branch": "master", "commit": "2574ad38c6ee4f0bef3a1ca305cd5df627a52bb3" }, + "nvim-treesitter": { "branch": "master", "commit": "d76a8b6e1b67fd3bcffec4a5d45fd9dee4dbbee8" }, + "nvim-treesitter-context": { "branch": "master", "commit": "572e534c9f881bb9bf9f388e4c87f360446c72d4" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, + "nvim-web-devicons": { "branch": "master", "commit": "d0cafff5c4347a604a07edf7bb9a91fda7eb577e" }, + "oil.nvim": { "branch": "master", "commit": "548587d68b55e632d8a69c92cefd981f360634fa" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rose-pine": { "branch": "main", "commit": "7d1b5c7dcd274921f0f58e90a8bf935f6a95fbf3" }, + "smear-cursor.nvim": { "branch": "main", "commit": "81638007bf7bbe79a78a3bfcbe8c640ec83344c0" }, + "snipe.nvim": { "branch": "main", "commit": "f43a1f0090de03d48ce5c55df630c1aa4d0b4291" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "b262293ef481b0d1f7a14c708ea7ca649672e200" }, - "trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" }, - "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, - "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" }, + "vim-illuminate": { "branch": "master", "commit": "19cb21f513fc2b02f0c66be70107741e837516a1" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } From 1a5d5bc4a088192a5792929a561d22982fdf252c Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 17 Mar 2025 09:44:09 +0100 Subject: [PATCH 03/20] feat: disable smear cursor --- lua/weeheavy/plugins/smear-cursor.lua | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lua/weeheavy/plugins/smear-cursor.lua b/lua/weeheavy/plugins/smear-cursor.lua index 048ef41..ca1549e 100644 --- a/lua/weeheavy/plugins/smear-cursor.lua +++ b/lua/weeheavy/plugins/smear-cursor.lua @@ -1,23 +1,24 @@ return { - "sphamba/smear-cursor.nvim", + "sphamba/smear-cursor.nvim", + enabled = false, - opts = { - -- Smear cursor when switching buffers or windows. - smear_between_buffers = true, + opts = { + -- Smear cursor when switching buffers or windows. + smear_between_buffers = true, - -- Smear cursor when moving within line or to neighbor lines. - -- Use `min_horizontal_distance_smear` and `min_vertical_distance_smear` for finer control - smear_between_neighbor_lines = true, + -- Smear cursor when moving within line or to neighbor lines. + -- Use `min_horizontal_distance_smear` and `min_vertical_distance_smear` for finer control + smear_between_neighbor_lines = true, - -- Draw the smear in buffer space instead of screen space when scrolling - scroll_buffer_space = true, + -- Draw the smear in buffer space instead of screen space when scrolling + scroll_buffer_space = true, - -- Set to `true` if your font supports legacy computing symbols (block unicode symbols). - -- Smears will blend better on all backgrounds. - legacy_computing_symbols_support = false, + -- Set to `true` if your font supports legacy computing symbols (block unicode symbols). + -- Smears will blend better on all backgrounds. + legacy_computing_symbols_support = false, - -- Smear cursor in insert mode. - -- See also `vertical_bar_cursor_insert_mode` and `distance_stop_animating_vertical_bar`. - smear_insert_mode = true, - }, + -- Smear cursor in insert mode. + -- See also `vertical_bar_cursor_insert_mode` and `distance_stop_animating_vertical_bar`. + smear_insert_mode = true, + }, } From 267bc441eefd0cb1c979d876013e2a2c56c67b2f Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 17 Mar 2025 09:45:13 +0100 Subject: [PATCH 04/20] feat(snipe): add keyboard shortcuts for h/v splits --- lua/weeheavy/plugins/snipe.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/weeheavy/plugins/snipe.lua b/lua/weeheavy/plugins/snipe.lua index bb83c61..f1a7515 100644 --- a/lua/weeheavy/plugins/snipe.lua +++ b/lua/weeheavy/plugins/snipe.lua @@ -22,13 +22,18 @@ return { }, ui = { position = "topright", + -- position = "cursor", + open_win_override = { + -- title = "i can haz file?", + border = "rounded", + }, + preselect_current = true, }, navigate = { cancel_snipe = "q", - -- Close the buffer under the cursor - -- PR not merged yet: https://github.com/leath-dub/snipe.nvim/pull/13 - -- NOTE: Make sure you don't use the character below on your dictionary close_buffer = "d", + open_vsplit = "V", + open_split = "X", }, }) end, From e92bba8321c51f678bb7763759bb49fd4494bd16 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 17 Mar 2025 09:45:46 +0100 Subject: [PATCH 05/20] feat(treesitter): add more languages to defaults --- lua/weeheavy/plugins/treesitter.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/weeheavy/plugins/treesitter.lua b/lua/weeheavy/plugins/treesitter.lua index b136623..8246fe4 100644 --- a/lua/weeheavy/plugins/treesitter.lua +++ b/lua/weeheavy/plugins/treesitter.lua @@ -48,6 +48,9 @@ return { "editorconfig", "http", "make", + "toml", + "latex", + "sql", }, incremental_selection = { enable = true, From 55006b1b2f00692034adc51f6686416acb93a514 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 17 Mar 2025 10:27:26 +0100 Subject: [PATCH 06/20] feat(trouble): additional settings --- lua/weeheavy/plugins/trouble.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/weeheavy/plugins/trouble.lua b/lua/weeheavy/plugins/trouble.lua index 5b965b9..beb946c 100644 --- a/lua/weeheavy/plugins/trouble.lua +++ b/lua/weeheavy/plugins/trouble.lua @@ -12,5 +12,9 @@ return { desc = "Diagnostics (Trouble)", }, }, - opts = {}, + opts = { + open_no_results = true, + auto_close = true, + indent_guides = false, + }, } From 2ba4c993edef7f6974f33d04c6f87a5562d5d0f2 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Thu, 27 Mar 2025 08:03:45 +0100 Subject: [PATCH 07/20] feat: try theme transparency --- lua/weeheavy/plugins/theme/rosepine.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/weeheavy/plugins/theme/rosepine.lua b/lua/weeheavy/plugins/theme/rosepine.lua index f00c774..d3a5b69 100644 --- a/lua/weeheavy/plugins/theme/rosepine.lua +++ b/lua/weeheavy/plugins/theme/rosepine.lua @@ -5,5 +5,9 @@ return { lazy = false, enabled = true, priority = 1000, - opts = {}, + opts = { + styles = { + transparency = true, + }, + }, } From ba271f705b7378b6b60eae881feb51d380216006 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 28 Mar 2025 13:30:42 +0100 Subject: [PATCH 08/20] fix: lualine LSP client depreciation warning, fixes #1 --- lua/weeheavy/plugins/lualine.lua | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lua/weeheavy/plugins/lualine.lua b/lua/weeheavy/plugins/lualine.lua index c24416b..cf0e3dc 100644 --- a/lua/weeheavy/plugins/lualine.lua +++ b/lua/weeheavy/plugins/lualine.lua @@ -1,20 +1,21 @@ -- status line like vim-airline -- Display attached LSP client -local function lsp_clients() - local clients = vim.lsp.get_active_clients() - local client_names = {} - local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end +local function lsp_client_name() + local bufnr = vim.api.nvim_get_current_buf() + + -- local clients = vim.lsp.buf_get_clients(bufnr) + local clients = vim.lsp.get_clients({ bufnr = 0 }) + if next(clients) == nil then + return "n/a" end - if next(client_names) == nil then - return "no LS" + + local c = {} + for _, client in pairs(clients) do + table.insert(c, client.name) + -- table.insert(c, string.sub(client.name, 0, 8) .. "...") end - --return "[" .. table.concat(client_names, ", ") .. "]" + return "\u{f085} " .. table.concat(c, ",") end -- hide content on narrow windows @@ -69,8 +70,8 @@ return { -- specify full list of elements when adding custom things { "encoding", cond = hide_in_width }, { "fileformat" }, - { "filetype" }, - { lsp_clients, cond = hide_in_width }, + { "filetype", cond = hide_in_width }, + { lsp_client_name, cond = hide_in_width }, --{ clock, cond = hide_in_width }, }, }, From 0628c3e2ec5bfa5f4c1b2c46056dfd967c0192a9 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 28 Mar 2025 13:40:57 +0100 Subject: [PATCH 09/20] feat: disable obsolete/newly builtin plugins --- lua/weeheavy/plugins/auto-dark-mode.lua | 1 + lua/weeheavy/plugins/zenmode.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/weeheavy/plugins/auto-dark-mode.lua b/lua/weeheavy/plugins/auto-dark-mode.lua index 2954a9e..e30ba12 100644 --- a/lua/weeheavy/plugins/auto-dark-mode.lua +++ b/lua/weeheavy/plugins/auto-dark-mode.lua @@ -1,6 +1,7 @@ -- https://github.com/f-person/auto-dark-mode.nvim return { "f-person/auto-dark-mode.nvim", + enabled = false, opts = { -- in ms. needs to be larger than whatever time your system takes to -- query dark mode. Otherwise you risk freezing neovim on shutdown diff --git a/lua/weeheavy/plugins/zenmode.lua b/lua/weeheavy/plugins/zenmode.lua index 1691a32..cbe69ec 100644 --- a/lua/weeheavy/plugins/zenmode.lua +++ b/lua/weeheavy/plugins/zenmode.lua @@ -2,6 +2,7 @@ -- https://github.com/folke/zen-mode.nvim return { "folke/zen-mode.nvim", + enabled = false, dependencies = { "folke/twilight.nvim", opts = { From 23fe78acec158f7a26a289d8ded04f371fdc6471 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 28 Mar 2025 13:43:19 +0100 Subject: [PATCH 10/20] feat(conform): add more formatters --- lua/weeheavy/plugins/lsp/conform.lua | 63 ++++++++++++++-------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/lua/weeheavy/plugins/lsp/conform.lua b/lua/weeheavy/plugins/lsp/conform.lua index b8f513b..45806ab 100644 --- a/lua/weeheavy/plugins/lsp/conform.lua +++ b/lua/weeheavy/plugins/lsp/conform.lua @@ -1,34 +1,35 @@ -- Some things are from https://www.josean.com/posts/neovim-linting-and-formatting return { - "stevearc/conform.nvim", - tag = "stable", - opts = {}, - config = function() - local conform = require("conform") - conform.setup({ - -- formatters_by_ft = { - formatters = { - javascript = { "prettier" }, - typescript = { "prettier" }, - javascriptreact = { "prettier" }, - typescriptreact = { "prettier" }, - svelte = { "prettier" }, - css = { "prettier" }, - html = { "prettier" }, - json = { "prettier" }, - yaml = { "prettier" }, - markdown = { "prettier" }, - graphql = { "prettier" }, - lua = { "stylua" }, - python = { "isort", "black" }, - sh = { "shfmt" }, - }, - stop_after_first = false, - format_on_save = { - lsp_fallback = true, - async = false, - timeout_ms = 1000, -- default: 1000 - }, - }) - end, + "stevearc/conform.nvim", + tag = "stable", + opts = {}, + config = function() + local conform = require("conform") + conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + sh = { "shfmt" }, + terraform = { "tflint" }, + hcl = { "hclfmt" }, + }, + stop_after_first = false, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 1000, -- default: 1000 + }, + }) + end, } From e2d27c98c1c3a7b82b7a24db923f71be49a83ee6 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Tue, 1 Apr 2025 10:53:48 +0200 Subject: [PATCH 11/20] feat: switch to native 0.11 LSP, remove obsolete things --- .luarc.json | 7 + CHEATSHEET.md | 2 + README.md | 38 ++--- init.lua | 4 +- lazy-lock.json | 33 ++--- lsp/ansible.lua | 28 ++++ lsp/go.lua | 6 + lsp/lua.lua | 14 ++ lsp/marksman.lua | 6 + lsp/terraform.lua | 6 + lsp/yaml.lua | 5 + lua/weeheavy/autocmd.lua | 69 +++++++-- lua/weeheavy/plugins/auto-dark-mode.lua | 23 --- lua/weeheavy/plugins/copilot.lua | 55 ------- lua/weeheavy/plugins/indent-blankline.lua | 17 --- lua/weeheavy/plugins/lsp/blink.lua | 59 ++++++++ lua/weeheavy/plugins/lsp/conform.lua | 65 +++++---- lua/weeheavy/plugins/lsp/copilot-cmp.lua | 10 -- lua/weeheavy/plugins/lsp/lsp-zero.lua | 170 ---------------------- lua/weeheavy/plugins/lsp/mason.lua | 6 + lua/weeheavy/plugins/smear-cursor.lua | 24 --- lua/weeheavy/plugins/theme/rosepine.lua | 29 ++-- lua/weeheavy/plugins/zenmode.lua | 58 -------- lua/weeheavy/prefs.lua | 52 +++++-- 24 files changed, 311 insertions(+), 475 deletions(-) create mode 100644 .luarc.json create mode 100644 lsp/ansible.lua create mode 100644 lsp/go.lua create mode 100644 lsp/lua.lua create mode 100644 lsp/marksman.lua create mode 100644 lsp/terraform.lua create mode 100644 lsp/yaml.lua delete mode 100644 lua/weeheavy/plugins/auto-dark-mode.lua delete mode 100644 lua/weeheavy/plugins/copilot.lua delete mode 100644 lua/weeheavy/plugins/indent-blankline.lua create mode 100644 lua/weeheavy/plugins/lsp/blink.lua delete mode 100644 lua/weeheavy/plugins/lsp/copilot-cmp.lua delete mode 100644 lua/weeheavy/plugins/lsp/lsp-zero.lua create mode 100644 lua/weeheavy/plugins/lsp/mason.lua delete mode 100644 lua/weeheavy/plugins/smear-cursor.lua delete mode 100644 lua/weeheavy/plugins/zenmode.lua diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..21ccfff --- /dev/null +++ b/.luarc.json @@ -0,0 +1,7 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": ["lua/?.lua", "lua/?/init.lua"], + "diagnostics.globals": ["vim"], + "workspace.checkThirdParty": false, + "workspace.library": ["$VIMRUNTIME"] +} diff --git a/CHEATSHEET.md b/CHEATSHEET.md index 0b3f8c1..6a34cf0 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -4,6 +4,7 @@ - `;` leader key - `:checkhealth []` check base or plugin status +- `:checkhealth vim.lsp` show details of LSP attached to buffer - `:verbose set expandtab?` check where `expandtab` has been set last - `:Lazy` show package manager UI - `:Mason` show Mason UI @@ -49,6 +50,7 @@ - `Ctrl`+`l` accept selected suggestion - `gd` go to definition - `gr` show references of function +- `grn` renames all refs of the symbol under cursor - `leader`+`q` toggle `trouble.nvim` quickfix list - `leader`+`da` go to next diagnostic (any severity) - `leader`+`dw` go to next diagnostic (_warning_ severity) diff --git a/README.md b/README.md index 86fdfb2..789f0bb 100644 --- a/README.md +++ b/README.md @@ -29,34 +29,26 @@ It's not too important. Still, I try to balance increasing startup time with the usefullness of a plugin. Output from lazy.nvim profiling (`:Lazy profile`) on a MacBook Pro M2 Max, -macOS 14 on Neovim 0.10.1. +macOS 15 on Neovim 0.11.0. ### Start and open init.lua -Around 10% of the plugins are lazy-loaded. +Around 15% of the plugins are lazy-loaded. ```bash - Startuptime: 96.76ms - -Based on the actual CPU time of the Neovim process till UIEnter. -This is more accurate than `nvim --startuptime`. - LazyStart 13.3ms - LazyDone 41.06ms (+27.76ms) - UIEnter 96.76ms (+55.71ms) +LazyStart 14.64ms +LazyDone 59.11ms (+44.48ms) +UIEnter 119.52ms (+60.41ms) ``` ### Starting with an empty file -Around 50% of the plugins are lazy-loaded. +Around 40% of the plugins are lazy-loaded. ```bash -Startuptime: 49.82ms - -Based on the actual CPU time of the Neovim process till UIEnter. -This is more accurate than `nvim --startuptime`. - LazyStart 13.75ms - LazyDone 40.39ms (+26.64ms) - UIEnter 49.82ms (+9.43ms) +LazyStart 14.37ms +LazyDone 60.18ms (+45.81ms) +UIEnter 74.45ms (+14.27ms) ``` ## Plugins @@ -70,26 +62,20 @@ This is more accurate than `nvim --startuptime`. | **nvim-treesitter-context** | Shows current line context | | | **nvim-treesitter-textobjects** | ? | | | **oil.nvim** | file explorer, (bulk file creation/rename) | | -| **tokyonight.nvim** | Theme with treesitter/lsp support | | +| **rose-pine** | Theme | | | **lualine.nvim** | Status line | | | **gitsigns.nvim** | Git change indicator | | | **which-key.nvim** | Shows contextual key bindings | | | **vim-illuminate** | Highlight similar words (w/ LSP, Treesitter, regex) | | -| **lsp-zero.nvim** | LSP for mere mortals | | -| **nvim-lspconfig** | Component of lsp-zero.nvim | | -| **cmp-nvim-lsp** | Dependency of lsp-zero.nvim | | | **conform.nvim** | Formatter configuration, replacement for `null-ls` | | | **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | | -| **mason-lspconfig.nvim** | Bridges mason.nvim with the lspconfig plugin | | -| **zen-mode.nvim** | Distraction-free coding for Neovim | | -| **twilight.nvim** | Dims inactive portions of the code you're editing | | | **todo-comments.nvim** | Highlights `NOTE:`, `FIXME:` etc. and makes them findable via Telescope | | | **mini.nvim** | I use the icons | | | **flash.nvim** | Navigation and Treesitter selection w/ search labels | | -| **copilot.lua** | The better github.com/github/copilot.vim | | -| **copilot-cmp** | transforms zbirenbaum/copilot.lua into a cmp source. | | | **nvim-lint** | Narrow-scope linter plugin to use via Neovim diagnostic framework | | | **snipe.nvim** | Buffer navigation | | +| **blink.cmp** | Fuzzy code completion | | +| **diffview.nvim** | Git diff viewer/stager | | ## Looks diff --git a/init.lua b/init.lua index c0aed23..1486ba0 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,8 @@ --[[ My simple(TM) Neovim configuration. Made from scratch, inspired by https://www.youtube.com/watch?v=w7i4amO_zaE +Later on, switched to native LSP setup with the help of +https://gpanders.com/blog/whats-new-in-neovim-0-11/ NOTE: EXTERNAL DEPENDENCIES MACOS - ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope) @@ -24,5 +26,5 @@ Then run "make" in your users telescope-fzf-native plugin directory: C:\Users\foobar\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim --]] --- Include customized configuration +-- Include my custom configuration require("weeheavy") diff --git a/lazy-lock.json b/lazy-lock.json index cecb73f..2e38162 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,39 +1,30 @@ { - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, - "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, - "copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, - "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lsp-zero.nvim": { "branch": "v4.x", "commit": "baff1ca10ecad7efe04f02f06d2647dd2ae90074" }, - "lualine.nvim": { "branch": "master", "commit": "b8b60c7f1d0d95ad74ee215b2291280b30482476" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "mini.nvim": { "branch": "main", "commit": "88f18a7d018d8bb4d32f6be4c712134a10e826d3" }, + "mini.nvim": { "branch": "main", "commit": "d0464ced00abfd9bbed196fa36ccf3b1691c6b2c" }, "newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" }, - "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, - "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, - "nvim-lspconfig": { "branch": "master", "commit": "2574ad38c6ee4f0bef3a1ca305cd5df627a52bb3" }, - "nvim-treesitter": { "branch": "master", "commit": "d76a8b6e1b67fd3bcffec4a5d45fd9dee4dbbee8" }, - "nvim-treesitter-context": { "branch": "master", "commit": "572e534c9f881bb9bf9f388e4c87f360446c72d4" }, + "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, + "nvim-treesitter": { "branch": "master", "commit": "9be6836ebeb88a536055bf1ce0961eef68da4bc6" }, + "nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, - "nvim-web-devicons": { "branch": "master", "commit": "d0cafff5c4347a604a07edf7bb9a91fda7eb577e" }, - "oil.nvim": { "branch": "master", "commit": "548587d68b55e632d8a69c92cefd981f360634fa" }, + "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "rose-pine": { "branch": "main", "commit": "7d1b5c7dcd274921f0f58e90a8bf935f6a95fbf3" }, - "smear-cursor.nvim": { "branch": "main", "commit": "81638007bf7bbe79a78a3bfcbe8c640ec83344c0" }, + "rose-pine": { "branch": "main", "commit": "96ff3993a67356ee85d1cdab9be652cdc1c5d1ac" }, "snipe.nvim": { "branch": "main", "commit": "f43a1f0090de03d48ce5c55df630c1aa4d0b4291" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "b262293ef481b0d1f7a14c708ea7ca649672e200" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" }, "vim-illuminate": { "branch": "master", "commit": "19cb21f513fc2b02f0c66be70107741e837516a1" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, - "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lsp/ansible.lua b/lsp/ansible.lua new file mode 100644 index 0000000..fe4e232 --- /dev/null +++ b/lsp/ansible.lua @@ -0,0 +1,28 @@ +---@type vim.lsp.Config +--- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/ansiblels.lua +--- https://github.com/neovim/nvim-lspconfig/pull/3659/files#diff-5ecad9b03732db4dfd97f3aa9874fa465b88ee4e121bf152e670f46e4f19cc6e +return { + cmd = { "ansible-language-server", "--stdio" }, + settings = { + ansible = { + python = { + interpreterPath = "python", + }, + ansible = { + path = "ansible", + }, + executionEnvironment = { + enabled = false, + }, + validation = { + enabled = true, + lint = { + enabled = true, + path = "ansible-lint", + }, + }, + }, + }, + filetypes = { "yaml.ansible" }, + root_markers = { "ansible.cfg", ".ansible-lint" }, +} diff --git a/lsp/go.lua b/lsp/go.lua new file mode 100644 index 0000000..e1eaf49 --- /dev/null +++ b/lsp/go.lua @@ -0,0 +1,6 @@ +---@type vim.lsp.Config +return { + cmd = { "gopls" }, + root_markers = { "go.work", "go.mod", ".git" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, +} diff --git a/lsp/lua.lua b/lsp/lua.lua new file mode 100644 index 0000000..a6c0039 --- /dev/null +++ b/lsp/lua.lua @@ -0,0 +1,14 @@ +---@type vim.lsp.Config +return { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".luarc.jsonc" }, + telemetry = { enabled = false }, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + }, + }, +} diff --git a/lsp/marksman.lua b/lsp/marksman.lua new file mode 100644 index 0000000..4b6181a --- /dev/null +++ b/lsp/marksman.lua @@ -0,0 +1,6 @@ +---@type vim.lsp.Config +return { + cmd = { "marksman" }, + root_markers = { ".md" }, + filetypes = { "markdown" }, +} diff --git a/lsp/terraform.lua b/lsp/terraform.lua new file mode 100644 index 0000000..8ab398b --- /dev/null +++ b/lsp/terraform.lua @@ -0,0 +1,6 @@ +---@type vim.lsp.Config +return { + cmd = { "terraform-ls", "serve" }, + root_markers = { "go.work", "go.mod", ".git" }, + filetypes = { "terraform" }, +} diff --git a/lsp/yaml.lua b/lsp/yaml.lua new file mode 100644 index 0000000..cf43b9e --- /dev/null +++ b/lsp/yaml.lua @@ -0,0 +1,5 @@ +---@type vim.lsp.Config +return { + filetypes = { "yaml" }, + cmd = { "yaml-language-server", "--stdio" }, +} diff --git a/lua/weeheavy/autocmd.lua b/lua/weeheavy/autocmd.lua index 9d678dd..a752c2c 100644 --- a/lua/weeheavy/autocmd.lua +++ b/lua/weeheavy/autocmd.lua @@ -1,23 +1,60 @@ --- Highlight yanked text on e.g. yy,yap etc. -vim.api.nvim_create_autocmd("TextYankPost", { - desc = "Highlight when yanking (copying) text", - group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, +-- Native autocompletion +-- vim.api.nvim_create_autocmd("LspAttach", { +-- callback = function(ev) +-- local client = vim.lsp.get_client_by_id(ev.data.client_id) +-- if client:supports_method("textDocument/completion") then +-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) +-- end +-- end, +-- }) + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("my.lsp", {}), + callback = function(args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + if client:supports_method("textDocument/implementation") then + -- Create a keymap for vim.lsp.buf.implementation ... + end + -- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y| + if client:supports_method("textDocument/completion") then + -- Optional: trigger autocompletion on EVERY keypress. May be slow! + -- local chars = {} + -- for i = 32, 126 do + -- table.insert(chars, string.char(i)) + -- end + -- client.server_capabilities.completionProvider.triggerCharacters = chars + -- vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true }) + end + -- Auto-format ("lint") on save. + -- Usually not needed if server supports "textDocument/willSaveWaitUntil". + if + not client:supports_method("textDocument/willSaveWaitUntil") + and client:supports_method("textDocument/formatting") + then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("my.lsp", { clear = false }), + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 }) + end, + }) + end + end, }) -vim.api.nvim_create_autocmd("FileType", { - pattern = "trouble", - callback = function() - vim.opt.colorcolumn = "" - end, +-- Highlight yanked text on e.g. yy,yap etc. +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, }) -- https://github.com/LazyVim/LazyVim/discussions/654 vim.api.nvim_create_autocmd("FileType", { - pattern = "terraform", - callback = function() - vim.bo.commentstring = "# %s" - end, + pattern = "terraform", + callback = function() + vim.bo.commentstring = "# %s" + end, }) diff --git a/lua/weeheavy/plugins/auto-dark-mode.lua b/lua/weeheavy/plugins/auto-dark-mode.lua deleted file mode 100644 index e30ba12..0000000 --- a/lua/weeheavy/plugins/auto-dark-mode.lua +++ /dev/null @@ -1,23 +0,0 @@ --- https://github.com/f-person/auto-dark-mode.nvim -return { - "f-person/auto-dark-mode.nvim", - enabled = false, - opts = { - -- in ms. needs to be larger than whatever time your system takes to - -- query dark mode. Otherwise you risk freezing neovim on shutdown - update_interval = 4000, - set_dark_mode = function() - vim.api.nvim_set_option_value("background", "dark", {}) - vim.cmd("colorscheme rose-pine-moon") - end, - set_light_mode = function() - vim.api.nvim_set_option_value("background", "light", {}) - vim.cmd("colorscheme rose-pine-dawn") - end, - fallback = "light", - }, - -- config = function() - -- local darkmode = require("auto-dark-mode") - -- darkmode.setup({}) - -- end, -} diff --git a/lua/weeheavy/plugins/copilot.lua b/lua/weeheavy/plugins/copilot.lua deleted file mode 100644 index 5a140e2..0000000 --- a/lua/weeheavy/plugins/copilot.lua +++ /dev/null @@ -1,55 +0,0 @@ --- Fully featured & enhanced replacement for copilot.vim complete with API for --- interacting with Github Copilot --- https://github.com/zbirenbaum/copilot.lua -return { - "zbirenbaum/copilot.lua", - lazy = true, - enabled = false, - event = "InsertEnter", - config = function() - local copilot = require("copilot") - copilot.setup({ - panel = { - enabled = false, - auto_refresh = false, - keymap = { - jump_prev = "[[", - jump_next = "]]", - accept = "", - refresh = "gr", - open = "", - }, - layout = { - position = "bottom", -- | top | left | right - ratio = 0.4, - }, - }, - suggestion = { - enabled = false, - auto_trigger = false, - debounce = 75, - keymap = { - accept = "", - accept_word = false, - accept_line = false, - next = "", - prev = "", - dismiss = "", - }, - }, - filetypes = { - yaml = true, - markdown = false, - help = false, - gitcommit = false, - gitrebase = false, - hgcommit = false, - svn = false, - cvs = false, - ["."] = false, - }, - copilot_node_command = "node", -- Node.js version must be > 18.x - server_opts_overrides = {}, - }) - end, -} diff --git a/lua/weeheavy/plugins/indent-blankline.lua b/lua/weeheavy/plugins/indent-blankline.lua deleted file mode 100644 index 30a82c0..0000000 --- a/lua/weeheavy/plugins/indent-blankline.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "lukas-reineke/indent-blankline.nvim", - enabled = false, - lazy = true, - event = { "BufReadPre", "BufNewFile" }, - main = "ibl", - opts = {}, - config = function() - local indent = require("ibl").setup({ - -- disable scope highlighting as it requires some tuning - scope = { enabled = false }, - indent = { - char = "│", - }, - }) - end, -} diff --git a/lua/weeheavy/plugins/lsp/blink.lua b/lua/weeheavy/plugins/lsp/blink.lua new file mode 100644 index 0000000..7b098d3 --- /dev/null +++ b/lua/weeheavy/plugins/lsp/blink.lua @@ -0,0 +1,59 @@ +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "enter", + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "accept", "fallback" }, + [""] = { "cancel", "fallback" }, + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/lua/weeheavy/plugins/lsp/conform.lua b/lua/weeheavy/plugins/lsp/conform.lua index 45806ab..f371ee3 100644 --- a/lua/weeheavy/plugins/lsp/conform.lua +++ b/lua/weeheavy/plugins/lsp/conform.lua @@ -1,35 +1,36 @@ -- Some things are from https://www.josean.com/posts/neovim-linting-and-formatting return { - "stevearc/conform.nvim", - tag = "stable", - opts = {}, - config = function() - local conform = require("conform") - conform.setup({ - formatters_by_ft = { - javascript = { "prettier" }, - typescript = { "prettier" }, - javascriptreact = { "prettier" }, - typescriptreact = { "prettier" }, - svelte = { "prettier" }, - css = { "prettier" }, - html = { "prettier" }, - json = { "prettier" }, - yaml = { "prettier" }, - markdown = { "prettier" }, - graphql = { "prettier" }, - lua = { "stylua" }, - python = { "isort", "black" }, - sh = { "shfmt" }, - terraform = { "tflint" }, - hcl = { "hclfmt" }, - }, - stop_after_first = false, - format_on_save = { - lsp_fallback = true, - async = false, - timeout_ms = 1000, -- default: 1000 - }, - }) - end, + "stevearc/conform.nvim", + enabled = true, + tag = "stable", + opts = {}, + config = function() + local conform = require("conform") + conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + sh = { "shfmt" }, + terraform = { "tflint" }, + hcl = { "hclfmt" }, + }, + stop_after_first = false, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 1000, -- default: 1000 + }, + }) + end, } diff --git a/lua/weeheavy/plugins/lsp/copilot-cmp.lua b/lua/weeheavy/plugins/lsp/copilot-cmp.lua deleted file mode 100644 index b31c0fc..0000000 --- a/lua/weeheavy/plugins/lsp/copilot-cmp.lua +++ /dev/null @@ -1,10 +0,0 @@ --- transforms https://github.com/zbirenbaum/copilot.lua into a cmp source. --- https://github.com/zbirenbaum/copilot-cmp -return { - "zbirenbaum/copilot-cmp", - lazy = false, - --event = "InsertEnter", - config = function() - require("copilot_cmp").setup() - end, -} diff --git a/lua/weeheavy/plugins/lsp/lsp-zero.lua b/lua/weeheavy/plugins/lsp/lsp-zero.lua deleted file mode 100644 index 6fb632a..0000000 --- a/lua/weeheavy/plugins/lsp/lsp-zero.lua +++ /dev/null @@ -1,170 +0,0 @@ -return { - { - "VonHeikemen/lsp-zero.nvim", - branch = "v4.x", - lazy = true, - config = false, - init = function() - -- Disable automatic setup, we are doing it manually - vim.g.lsp_zero_extend_cmp = 0 - vim.g.lsp_zero_extend_lspconfig = 0 - end, - }, - { - "williamboman/mason.nvim", - tag = "stable", - lazy = false, - config = true, - }, - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { "L3MON4D3/LuaSnip" }, - }, - config = function() - -- Here is where you configure the autocompletion settings. - local lsp_zero = require("lsp-zero") - lsp_zero.extend_cmp() - - local cmp = require("cmp") - local cmp_action = lsp_zero.cmp_action() - local cmp_select = { behavior = cmp.SelectBehavior.Select } - - cmp.setup({ - formatting = lsp_zero.cmp_format(), - sources = { - { name = "nvim_lsp" }, - { name = "path" }, - { name = "buffer" }, - { name = "copilot" }, - { name = "luasnip" }, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.confirm({ select = true }), -- accept LSP autocompletion - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp_action.luasnip_jump_forward(), - [""] = cmp_action.luasnip_jump_backward(), - }), - window = { - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - completion = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - }, - }) - end, - }, - - -- LSP - { - "neovim/nvim-lspconfig", - cmd = { "LspInfo", "LspInstall", "LspStart" }, - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "williamboman/mason-lspconfig.nvim", tag = "stable" }, - }, - config = function() - local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end - vim.diagnostic.config({ - update_in_insert = true, - signs = true, - virtual_text = { - prefix = "", -- Could be '●', '▎', 'x' - source = "if_many", - }, - float = { - source = "if_many", - }, - }) - -- This is where all the LSP shenanigans will live - local lsp_zero = require("lsp-zero") - - -- Keybindings only active when a LS is active for the curr. file - -- lsp_zero.on_attach(function(client, bufnr) - local lsp_attach = function(client, bufnr) - -- see :help lsp-zero-keybindings to learn the available actions - -- or https://lsp-zero.netlify.app/docs/language-server-configuration.html#default-keymaps - -- https://www.reddit.com/r/neovim/comments/1ankiu1/lsp_zero_go_to_definition_stopped_working/ - lsp_zero.default_keymaps({ buffer = bufnr, preserve_mappings = false }) - end - - lsp_zero.extend_lspconfig({ - sign_text = true, - lsp_attach = lsp_attach, - capabilities = require("cmp_nvim_lsp").default_capabilities(), - }) - - require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, - }) - - require("mason-lspconfig").setup({ - ensure_installed = { - "bashls", - "jsonls", - "lua_ls", - "vimls", - "yamlls", - }, - handlers = { - -- names must align with Mason names - lsp_zero.default_setup, - lua_ls = function() - local lua_opts = lsp_zero.nvim_lua_ls() - require("lspconfig").lua_ls.setup(lua_opts) - require("lspconfig").gopls.setup({}) - require("lspconfig").yamlls.setup({ - settings = { - yaml = { - -- https://www.arthurkoziel.com/json-schemas-in-neovim/ - schemaStore = { - enable = false, - url = "", - }, - schemas = { - ["https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json"] = "cf-*{yml,yaml}", - -- ["https://json.schemastore.org/kustomization.json"] = "kustomization.{yml,yaml}", - -- ["https://raw.githubusercontent.com/docker/compose/master/compose/config/compose_spec.json"] = "docker-compose*.{yml,yaml}", - -- ["https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json"] = "argocd-application.yaml", - }, - }, - }, - }) - require("lspconfig").taplo.setup({ - -- Taplo loads all schemas (not selectively) - settings = { - evenBetterToml = { - -- https://www.arthurkoziel.com/json-schemas-in-neovim/ - schema = { - -- additional schemas - -- associations = { - -- ["alacritty\\.toml$"] = "https://raw.githubusercontent.com/distinction-dev/alacritty-schema/main/alacritty/reference.json", - -- }, - }, - }, - }, - }) - end, - }, - }) - end, - }, -} diff --git a/lua/weeheavy/plugins/lsp/mason.lua b/lua/weeheavy/plugins/lsp/mason.lua new file mode 100644 index 0000000..0e4bc19 --- /dev/null +++ b/lua/weeheavy/plugins/lsp/mason.lua @@ -0,0 +1,6 @@ +return { + "williamboman/mason.nvim", + tag = "stable", + lazy = false, + config = true, + } diff --git a/lua/weeheavy/plugins/smear-cursor.lua b/lua/weeheavy/plugins/smear-cursor.lua deleted file mode 100644 index ca1549e..0000000 --- a/lua/weeheavy/plugins/smear-cursor.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - "sphamba/smear-cursor.nvim", - enabled = false, - - opts = { - -- Smear cursor when switching buffers or windows. - smear_between_buffers = true, - - -- Smear cursor when moving within line or to neighbor lines. - -- Use `min_horizontal_distance_smear` and `min_vertical_distance_smear` for finer control - smear_between_neighbor_lines = true, - - -- Draw the smear in buffer space instead of screen space when scrolling - scroll_buffer_space = true, - - -- Set to `true` if your font supports legacy computing symbols (block unicode symbols). - -- Smears will blend better on all backgrounds. - legacy_computing_symbols_support = false, - - -- Smear cursor in insert mode. - -- See also `vertical_bar_cursor_insert_mode` and `distance_stop_animating_vertical_bar`. - smear_insert_mode = true, - }, -} diff --git a/lua/weeheavy/plugins/theme/rosepine.lua b/lua/weeheavy/plugins/theme/rosepine.lua index d3a5b69..7d5a55a 100644 --- a/lua/weeheavy/plugins/theme/rosepine.lua +++ b/lua/weeheavy/plugins/theme/rosepine.lua @@ -1,13 +1,20 @@ return { - "rose-pine/neovim", - name = "rose-pine", - branch = "main", - lazy = false, - enabled = true, - priority = 1000, - opts = { - styles = { - transparency = true, - }, - }, + "rose-pine/neovim", + name = "rose-pine", + branch = "main", + lazy = false, + enabled = true, + priority = 1000, + opts = { + styles = { + -- transparency = true, + }, + config = function() + local rose = require("rose-pine") + rose.setup({ + variant = "auto", -- auto, main, moon, or dawn + dark_variant = "moon", -- main, moon, or dawn + }) + end, + }, } diff --git a/lua/weeheavy/plugins/zenmode.lua b/lua/weeheavy/plugins/zenmode.lua deleted file mode 100644 index cbe69ec..0000000 --- a/lua/weeheavy/plugins/zenmode.lua +++ /dev/null @@ -1,58 +0,0 @@ --- Distraction-free coding when you need it --- https://github.com/folke/zen-mode.nvim -return { - "folke/zen-mode.nvim", - enabled = false, - dependencies = { - "folke/twilight.nvim", - opts = { - treesitter = true, - context = 2, - }, - }, - event = { "BufReadPre", "BufNewFile" }, - opts = { - window = { - backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - width = 0.75, -- width of the Zen window - height = 1, -- height of the Zen window - -- by default, no options are changed for the Zen window - -- uncomment any of the options below, or add other vim.wo options you want to apply - options = { - signcolumn = "no", -- disable signcolumn - number = false, -- disable number column - relativenumber = false, -- disable relative numbers - cursorline = false, -- disable cursorline - cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column - list = false, -- disable whitespace characters - colorcolumn = "0", -- disable line width indicator - }, - }, - plugins = { - -- disable some global vim options (vim.o...) - -- comment the lines to not apply the options - options = { - enabled = true, - ruler = false, -- disables the ruler text in the cmd line area - showcmd = false, -- disables the command in the last line of the screen - -- you may turn on/off statusline in zen mode by setting 'laststatus' - -- statusline will be shown only if 'laststatus' == 3 - laststatus = 0, -- turn off the statusline in zen mode - }, - twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - gitsigns = { enabled = false }, -- disables git signs - -- this will change the font size on alacritty when in zen mode - -- requires Alacritty Version 0.10.0 or higher - -- uses `alacritty msg` subcommand to change font size - alacritty = { - enabled = true, - font = "20", -- font size - }, - }, - -- callback where you can add custom code when the Zen window opens - on_open = function(win) end, - -- callback where you can add custom code when the Zen window closes - on_close = function() end, - }, -} diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index 71d5f18..f794ec8 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -1,3 +1,13 @@ +-- LSP activation (references lsp/ +vim.lsp.enable({ + "lua", + "go", + "terraform", + "yaml", + "ansible", + "marksman", +}) + -- Set highlight on search vim.opt.hlsearch = true @@ -48,15 +58,14 @@ vim.opt.cursorline = true vim.opt.wrap = false vim.opt.termguicolors = true -vim.opt.background = "dark" -- light, dark +-- vim.opt.background = "dark" -- light, dark -- Themes: -- tokyonight-night -- tokyonight-storm -- tokyonight-day -- tokyonight-moon -- vim.cmd.colorscheme("tokyonight-storm") -vim.cmd.colorscheme("rose-pine-dawn") --- vim.cmd.colorscheme("newpaper") +vim.cmd.colorscheme("rose-pine") -- Decrease update time vim.opt.updatetime = 250 @@ -77,12 +86,33 @@ vim.opt.showmode = false -- Hobo way to to force ansiblels being used for Ansible files vim.filetype.add({ - pattern = { - [".*/.*playbook.*.ya?ml"] = "yaml.ansible", - [".*/.*tasks.*/.*ya?ml"] = "yaml.ansible", - [".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible", - [".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible", - [".*/local.ya?ml"] = "yaml.ansible", - [".*-ansible/.*ya?ml"] = "yaml.ansible", - }, + pattern = { + [".*/.*playbook.*.ya?ml"] = "yaml.ansible", + [".*/.*tasks.*/.*ya?ml"] = "yaml.ansible", + [".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible", + [".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible", + [".*/local.ya?ml"] = "yaml.ansible", + [".*-ansible/.*ya?ml"] = "yaml.ansible", + }, +}) + +-- rounded borders +vim.opt.winborder = "rounded" + +-- Inline hints +vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "󰅚", + [vim.diagnostic.severity.WARN] = "󰀪", + [vim.diagnostic.severity.HINT] = "󰌶", + [vim.diagnostic.severity.INFO] = "", + }, + }, + -- virtual_text = { current_line = true }, + -- virtual_lines = true, + -- virtual_text = true, + virtual_lines = { + current_line = true, + }, }) From b5be5a3659f5932c3b1f854560e3ba03cc087640 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Tue, 1 Apr 2025 11:02:14 +0200 Subject: [PATCH 12/20] feat: use virtual_text instead of virtual_lines and add keymap to toggle this --- lua/weeheavy/prefs.lua | 11 +++-- lua/weeheavy/remap.lua | 94 +++++++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index f794ec8..f1b52e7 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -109,10 +109,9 @@ vim.diagnostic.config({ [vim.diagnostic.severity.INFO] = "", }, }, - -- virtual_text = { current_line = true }, - -- virtual_lines = true, - -- virtual_text = true, - virtual_lines = { - current_line = true, - }, + virtual_text = true, + virtual_lines = false, + -- virtual_lines = { + -- current_line = true, + -- }, }) diff --git a/lua/weeheavy/remap.lua b/lua/weeheavy/remap.lua index fd07fd2..cc094d1 100644 --- a/lua/weeheavy/remap.lua +++ b/lua/weeheavy/remap.lua @@ -13,10 +13,10 @@ vim.keymap.set("n", "fo", ":Telescope oldfiles", { noremap = true, d -- Find files vim.keymap.set( - "n", - "ff", - ":Telescope find_files hidden=true no_ignore=false", - { noremap = true, desc = "File search" } + "n", + "ff", + ":Telescope find_files hidden=true no_ignore=false", + { noremap = true, desc = "File search" } ) -- Live find string (using ripgrep) @@ -24,10 +24,10 @@ vim.keymap.set("n", "fg", ":Telescope live_grep", { noremap = true, -- Find string under cursor (using ripgrep) vim.keymap.set( - "n", - "fs", - ":Telescope grep_string", - { noremap = true, desc = "Search text under cursor in cwd/grep search string" } + "n", + "fs", + ":Telescope grep_string", + { noremap = true, desc = "Search text under cursor in cwd/grep search string" } ) -- Find string under cursor --vim.keymap.set( @@ -42,27 +42,27 @@ vim.keymap.set("n", "", ":Telescope buffers", { noremap = tr vim.keymap.set("n", "ft", ":TodoTelescope", { noremap = true, desc = "Find TODOs" }) --vim.keymap.set("n", "gs", ":Telescope git_status", { noremap = true, desc = "Git status" }) vim.keymap.set( - "n", - "gla", - ":Telescope git_commits", - { noremap = true, desc = "Git log (across all files)" } + "n", + "gla", + ":Telescope git_commits", + { noremap = true, desc = "Git log (across all files)" } ) vim.keymap.set("n", "glf", ":Telescope git_bcommits", { noremap = true, desc = "Git log (this file)" }) --vim.keymap.set("n", "gdp", ":Gitsigns diffthis", { noremap = true, desc = "Git diff previous (this file)" }) --vim.keymap.set("n", "gd", ":Gitsigns diffthis", { noremap = true, desc = "Git diff previous (this file)" }) vim.keymap.set("n", "gd", function() - if next(require("diffview.lib").views) == nil then - vim.cmd("DiffviewOpen") - else - vim.cmd("DiffviewClose") - end - --end, { noremap = true, desc = "Diff this shit" }) + if next(require("diffview.lib").views) == nil then + vim.cmd("DiffviewOpen") + else + vim.cmd("DiffviewClose") + end + --end, { noremap = true, desc = "Diff this shit" }) end, { noremap = true, desc = "Toggle diff/stage UI " }) vim.keymap.set( - "n", - "gb", - ":Gitsigns toggle_current_line_blame", - { noremap = true, desc = "Toggle git blame" } + "n", + "gb", + ":Gitsigns toggle_current_line_blame", + { noremap = true, desc = "Toggle git blame" } ) -- Remapping of existing Vim key binds @@ -77,26 +77,26 @@ vim.keymap.set("n", "b", "B") -- skip punctuation when moving to end of previous vim.keymap.set("v", "J", ":m '>+1gv=gv") -- move whole lines/blocks down in visual mode vim.keymap.set("v", "K", ":m '<-2gv=gv") -- move whole lines/blocks up in visual mode -vim.keymap.set("n", "", "zz") -- eye-friendly down scrolling -vim.keymap.set("n", "", "zz") -- eye-friendly up scrolling +vim.keymap.set("n", "", "zz") -- eye-friendly down scrolling +vim.keymap.set("n", "", "zz") -- eye-friendly up scrolling -vim.keymap.set("n", "J", "mzJ`z") -- when merging lines, keep cursor at current position +vim.keymap.set("n", "J", "mzJ`z") -- when merging lines, keep cursor at current position vim.keymap.set( - "n", - "s", - [[:%s/\<\>//gI]], - { noremap = true, desc = "Replace word below cursor" } + "n", + "s", + [[:%s/\<\>//gI]], + { noremap = true, desc = "Replace word below cursor" } ) -- Apply conform.nvim formatting on keypress (same as on save) vim.keymap.set({ "n", "v" }, "o", function() - local conform = require("conform") - conform.format({ - lsp_fallback = true, - async = false, - timeout_ms = 500, - }) + local conform = require("conform") + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 500, + }) end, { desc = "Format file or range (in visual mode)" }) -- Toggle zen-mode.nvim @@ -104,27 +104,37 @@ vim.keymap.set("n", "z", ":ZenMode") -- Go to next diagnostic item (any severity) vim.keymap.set({ "n", "v" }, "da", function() - vim.diagnostic.goto_next({}) - vim.api.nvim_feedkeys("zz", "n", false) + vim.diagnostic.goto_next({}) + vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next diagnostic" }) -- Go to next diagnostic item (error severity) vim.keymap.set({ "n", "v" }, "de", function() - vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR }) - vim.api.nvim_feedkeys("zz", "n", false) + vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR }) + vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next error diagnostic" }) -- Go to next diagnostic item (warning severity) vim.keymap.set({ "n", "v" }, "dw", function() - vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN }) - vim.api.nvim_feedkeys("zz", "n", false) + vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN }) + vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next warning diagnostic" }) -- Toggle LSP diagnostics vim.keymap.set({ "n", "v" }, "dd", function() - vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end, { desc = "Turn diagnostics on/off" }) -- Toggle trouble (for document) --vim.keymap.set("n", "qq", ":TroubleToggle") --vim.keymap.set("n", "qq", "Trouble diagnostics toggle") + +-- By default, show virtual_text and hide virtual_lines. +-- This keymap allows to do the opposite. Can be useful when there are multiple +-- severities on the same line +vim.keymap.set("n", "tdd", function() + vim.diagnostic.config({ + virtual_lines = not vim.diagnostic.config().virtual_lines, + virtual_text = not vim.diagnostic.config().virtual_text, + }) +end, { desc = "Toggle diagnostic virtual lines and virtual text" }) From 6060e83a166c0c10b3b60a946246f0f65c32ae9f Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Wed, 2 Apr 2025 12:36:01 +0200 Subject: [PATCH 13/20] fix: spring cleanup --- after/ftplugin/qf.lua | 5 - lazy-lock.json | 6 +- lua/weeheavy/plugins/theme/tokyonight.lua | 124 +++++++++++----------- lua/weeheavy/remap.lua | 36 ++----- 4 files changed, 71 insertions(+), 100 deletions(-) delete mode 100644 after/ftplugin/qf.lua diff --git a/after/ftplugin/qf.lua b/after/ftplugin/qf.lua deleted file mode 100644 index d8d62f0..0000000 --- a/after/ftplugin/qf.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Disable column width indicators in quickfix/Trouble windows --- vim.opt.colorcolumn = "" -vim.opt.colorcolumn = "" -vim.opt_local.colorcolumn = "" -vim.wo.colorcolumn = "0" diff --git a/lazy-lock.json b/lazy-lock.json index 2e38162..8bb6cec 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,6 @@ { - "auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" }, "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, + "ccc.nvim": { "branch": "main", "commit": "9abb22d5d47460852a935129b4feff39fd8033e3" }, "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, @@ -9,10 +9,10 @@ "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "mini.nvim": { "branch": "main", "commit": "d0464ced00abfd9bbed196fa36ccf3b1691c6b2c" }, + "mini.nvim": { "branch": "main", "commit": "687fa868d869078194c02065628712982d971fd6" }, "newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" }, "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, - "nvim-treesitter": { "branch": "master", "commit": "9be6836ebeb88a536055bf1ce0961eef68da4bc6" }, + "nvim-treesitter": { "branch": "master", "commit": "30654ee72a69e7c76a54b66d748dae088429e863" }, "nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, diff --git a/lua/weeheavy/plugins/theme/tokyonight.lua b/lua/weeheavy/plugins/theme/tokyonight.lua index e7af43a..313ee98 100644 --- a/lua/weeheavy/plugins/theme/tokyonight.lua +++ b/lua/weeheavy/plugins/theme/tokyonight.lua @@ -1,65 +1,65 @@ return { - "folke/tokyonight.nvim", - tag = "stable", - lazy = false, - enabled = true, - priority = 1000, - opts = {}, - config = function() - local tokyonight = require("tokyonight") - local util = require("tokyonight.util") - tokyonight.setup({ - styles = { - -- See :help nvim_set_hl - comments = { italic = true }, - --functions = { underdotted = true }, - }, - on_colors = function(colors) - -- Brighten up comments a bit - colors.comment = "#888fac" - -- Better visible visual selection background color - --colors.bg_visual = "#e82a86" - --colors.bg_visual = colors.teal - end, - on_highlights = function(hl, c) - -- Brighter line numbers - hl.LineNr = { - fg = util.darken(c.dark5, 0.6), - } - --hl.ColorColumn = { - -- bg = c.purple, - --} + "folke/tokyonight.nvim", + tag = "stable", + lazy = false, + enabled = false, + priority = 1000, + opts = {}, + config = function() + local tokyonight = require("tokyonight") + local util = require("tokyonight.util") + tokyonight.setup({ + styles = { + -- See :help nvim_set_hl + comments = { italic = true }, + --functions = { underdotted = true }, + }, + on_colors = function(colors) + -- Brighten up comments a bit + colors.comment = "#888fac" + -- Better visible visual selection background color + --colors.bg_visual = "#e82a86" + --colors.bg_visual = colors.teal + end, + on_highlights = function(hl, c) + -- Brighter line numbers + hl.LineNr = { + fg = util.darken(c.dark5, 0.6), + } + --hl.ColorColumn = { + -- bg = c.purple, + --} - -- Remove borders from Telescope windows - local prompt = "#2d3149" - hl.TelescopeNormal = { - bg = c.bg_dark, - fg = c.fg_dark, - } - hl.TelescopeBorder = { - bg = c.bg_dark, - fg = c.bg_dark, - } - hl.TelescopePromptNormal = { - bg = prompt, - } - hl.TelescopePromptBorder = { - bg = prompt, - fg = prompt, - } - hl.TelescopePromptTitle = { - bg = prompt, - fg = prompt, - } - hl.TelescopePreviewTitle = { - bg = c.bg_dark, - fg = c.bg_dark, - } - hl.TelescopeResultsTitle = { - bg = c.bg_dark, - fg = c.bg_dark, - } - end, - }) - end, + -- Remove borders from Telescope windows + local prompt = "#2d3149" + hl.TelescopeNormal = { + bg = c.bg_dark, + fg = c.fg_dark, + } + hl.TelescopeBorder = { + bg = c.bg_dark, + fg = c.bg_dark, + } + hl.TelescopePromptNormal = { + bg = prompt, + } + hl.TelescopePromptBorder = { + bg = prompt, + fg = prompt, + } + hl.TelescopePromptTitle = { + bg = prompt, + fg = prompt, + } + hl.TelescopePreviewTitle = { + bg = c.bg_dark, + fg = c.bg_dark, + } + hl.TelescopeResultsTitle = { + bg = c.bg_dark, + fg = c.bg_dark, + } + end, + }) + end, } diff --git a/lua/weeheavy/remap.lua b/lua/weeheavy/remap.lua index cc094d1..bb7bbcd 100644 --- a/lua/weeheavy/remap.lua +++ b/lua/weeheavy/remap.lua @@ -1,11 +1,8 @@ -- keyboard shortcuts --- Leader key set to space, base for any key combo --- vim.g.mapleader = " " +-- Leader key. Base for any key combo vim.g.mapleader = ";" ---vim.keymap.set("n", "r", vim.cmd.Ex, { noremap = true, desc = "netrw File Browser" }) -- netrw file explorer ---vim.keymap.set("n", "e", "lua require('oil').toggle_float('.')", { noremap = true, silent = true }) vim.keymap.set("n", "e", ":Oil --float", { desc = "Oil" }) -- List recently opened files @@ -20,7 +17,7 @@ vim.keymap.set( ) -- Live find string (using ripgrep) -vim.keymap.set("n", "fg", ":Telescope live_grep", { noremap = true, desc = "Search string" }) +vim.keymap.set("n", "fg", ":Telescope live_grep", { noremap = true, desc = "String search" }) -- Find string under cursor (using ripgrep) vim.keymap.set( @@ -29,18 +26,10 @@ vim.keymap.set( ":Telescope grep_string", { noremap = true, desc = "Search text under cursor in cwd/grep search string" } ) --- Find string under cursor ---vim.keymap.set( --- "n", --- "fs", --- [[lua require('telescope.builtin').grep_string()]], --- { silent = true, noremap = true } ---) vim.keymap.set("n", "", ":Telescope buffers", { noremap = true, desc = "Show open buffers" }) -- todo-comments.nvim vim.keymap.set("n", "ft", ":TodoTelescope", { noremap = true, desc = "Find TODOs" }) ---vim.keymap.set("n", "gs", ":Telescope git_status", { noremap = true, desc = "Git status" }) vim.keymap.set( "n", "gla", @@ -48,15 +37,12 @@ vim.keymap.set( { noremap = true, desc = "Git log (across all files)" } ) vim.keymap.set("n", "glf", ":Telescope git_bcommits", { noremap = true, desc = "Git log (this file)" }) ---vim.keymap.set("n", "gdp", ":Gitsigns diffthis", { noremap = true, desc = "Git diff previous (this file)" }) ---vim.keymap.set("n", "gd", ":Gitsigns diffthis", { noremap = true, desc = "Git diff previous (this file)" }) vim.keymap.set("n", "gd", function() if next(require("diffview.lib").views) == nil then vim.cmd("DiffviewOpen") else vim.cmd("DiffviewClose") end - --end, { noremap = true, desc = "Diff this shit" }) end, { noremap = true, desc = "Toggle diff/stage UI " }) vim.keymap.set( "n", @@ -72,14 +58,11 @@ vim.keymap.set("n", "b", "B") -- skip punctuation when moving to end of previous --vim.keymap.set("n", "i", "gg=G``", { noremap = true, desc = "Re-indent whole file" }) -- '``' makes it stay at current line+column position --- Thank you @ThePrimeagen for those --- https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua +-- Thanks https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua vim.keymap.set("v", "J", ":m '>+1gv=gv") -- move whole lines/blocks down in visual mode vim.keymap.set("v", "K", ":m '<-2gv=gv") -- move whole lines/blocks up in visual mode - vim.keymap.set("n", "", "zz") -- eye-friendly down scrolling vim.keymap.set("n", "", "zz") -- eye-friendly up scrolling - vim.keymap.set("n", "J", "mzJ`z") -- when merging lines, keep cursor at current position vim.keymap.set( @@ -99,24 +82,21 @@ vim.keymap.set({ "n", "v" }, "o", function() }) end, { desc = "Format file or range (in visual mode)" }) --- Toggle zen-mode.nvim -vim.keymap.set("n", "z", ":ZenMode") - -- Go to next diagnostic item (any severity) vim.keymap.set({ "n", "v" }, "da", function() - vim.diagnostic.goto_next({}) + vim.diagnostic.get_next({}) vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next diagnostic" }) -- Go to next diagnostic item (error severity) vim.keymap.set({ "n", "v" }, "de", function() - vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR }) + vim.diagnostic.get_next({ severity = vim.diagnostic.severity.ERROR }) vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next error diagnostic" }) -- Go to next diagnostic item (warning severity) vim.keymap.set({ "n", "v" }, "dw", function() - vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN }) + vim.diagnostic.get_next({ severity = vim.diagnostic.severity.WARN }) vim.api.nvim_feedkeys("zz", "n", false) end, { desc = "Go to next warning diagnostic" }) @@ -125,10 +105,6 @@ vim.keymap.set({ "n", "v" }, "dd", function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end, { desc = "Turn diagnostics on/off" }) --- Toggle trouble (for document) ---vim.keymap.set("n", "qq", ":TroubleToggle") ---vim.keymap.set("n", "qq", "Trouble diagnostics toggle") - -- By default, show virtual_text and hide virtual_lines. -- This keymap allows to do the opposite. Can be useful when there are multiple -- severities on the same line From 2f8fbd32d3a14f69c079d58ba373670ccc6173c2 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Wed, 2 Apr 2025 12:36:25 +0200 Subject: [PATCH 14/20] fix: use signs again for LSP diagnostics --- lua/weeheavy/prefs.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index f1b52e7..f24f928 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -108,6 +108,12 @@ vim.diagnostic.config({ [vim.diagnostic.severity.HINT] = "󰌶", [vim.diagnostic.severity.INFO] = "", }, + -- linehl = { + -- [vim.diagnostic.severity.ERROR] = "Error", + -- [vim.diagnostic.severity.WARN] = "Warn", + -- [vim.diagnostic.severity.INFO] = "Info", + -- [vim.diagnostic.severity.HINT] = "Hint", + -- }, }, virtual_text = true, virtual_lines = false, From 907a52ea32f6deb289aa63987626952a233d9b26 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Wed, 2 Apr 2025 12:36:51 +0200 Subject: [PATCH 15/20] feat: use ccc.nvim to colorize color definitions --- lua/weeheavy/plugins/ccc.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lua/weeheavy/plugins/ccc.lua diff --git a/lua/weeheavy/plugins/ccc.lua b/lua/weeheavy/plugins/ccc.lua new file mode 100644 index 0000000..efcfc48 --- /dev/null +++ b/lua/weeheavy/plugins/ccc.lua @@ -0,0 +1,18 @@ +-- File system operations for nerds +-- https://github.com/uga-rosa/ccc.nvim +return { + "uga-rosa/ccc.nvim", + config = function() + local ccc = require("ccc") + local mapping = ccc.mapping + ccc.setup({ + + -- Your preferred settings + -- Example: enable highlighter + highlighter = { + auto_enable = true, + lsp = true, + }, + }) + end, +} From b6f577d9ff1ca524d0c68806af79e5ceecc5a5ab Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Wed, 2 Apr 2025 14:32:59 +0200 Subject: [PATCH 16/20] fix: slightly improve startup times --- README.md | 14 +++++++------- lua/weeheavy/plugins/ccc.lua | 2 ++ lua/weeheavy/plugins/lsp/blink.lua | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 789f0bb..cf00063 100644 --- a/README.md +++ b/README.md @@ -36,19 +36,19 @@ macOS 15 on Neovim 0.11.0. Around 15% of the plugins are lazy-loaded. ```bash -LazyStart 14.64ms -LazyDone 59.11ms (+44.48ms) -UIEnter 119.52ms (+60.41ms) +LazyStart 18.67ms +LazyDone 43.52ms (+24.85ms) +UIEnter 110.71ms (+67.19ms) ``` ### Starting with an empty file -Around 40% of the plugins are lazy-loaded. +Around 50% of the plugins are lazy-loaded. ```bash -LazyStart 14.37ms -LazyDone 60.18ms (+45.81ms) -UIEnter 74.45ms (+14.27ms) +LazyStart 18.15ms +LazyDone 46.91ms (+28.76ms) +UIEnter 59.08ms (+12.17ms) ``` ## Plugins diff --git a/lua/weeheavy/plugins/ccc.lua b/lua/weeheavy/plugins/ccc.lua index efcfc48..0d1c67b 100644 --- a/lua/weeheavy/plugins/ccc.lua +++ b/lua/weeheavy/plugins/ccc.lua @@ -2,6 +2,8 @@ -- https://github.com/uga-rosa/ccc.nvim return { "uga-rosa/ccc.nvim", + lazy = true, + event = { "BufReadPre", "BufNewFile" }, config = function() local ccc = require("ccc") local mapping = ccc.mapping diff --git a/lua/weeheavy/plugins/lsp/blink.lua b/lua/weeheavy/plugins/lsp/blink.lua index 7b098d3..0f7296a 100644 --- a/lua/weeheavy/plugins/lsp/blink.lua +++ b/lua/weeheavy/plugins/lsp/blink.lua @@ -1,5 +1,7 @@ return { "saghen/blink.cmp", + lazy = true, + event = { "BufReadPre", "BufNewFile" }, -- optional: provides snippets for the snippet source dependencies = { "rafamadriz/friendly-snippets" }, From c525a3e6e429137d8cf4f5756d3ae2332ec5c0e9 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Thu, 3 Apr 2025 14:27:32 +0200 Subject: [PATCH 17/20] feat(gitsigns): keymap for :Gitsigns preview_hunk --- lua/weeheavy/plugins/gitsigns.lua | 59 ++++++++++--------------------- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/lua/weeheavy/plugins/gitsigns.lua b/lua/weeheavy/plugins/gitsigns.lua index fd7391b..9b38ca7 100644 --- a/lua/weeheavy/plugins/gitsigns.lua +++ b/lua/weeheavy/plugins/gitsigns.lua @@ -1,43 +1,22 @@ -- Adds git related signs to the gutter, as well as utilities for managing changes return { - "lewis6991/gitsigns.nvim", - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - on_attach = function(bufnr) - --vim.keymap.set( - -- "n", - -- "ggh", - -- require("gitsigns").preview_hunk, - -- { buffer = bufnr, desc = "Preview git hunk" } - --) - - -- don't override the built-in and fugitive keymaps - local gs = package.loaded.gitsigns - vim.keymap.set({ "n", "v" }, "]c", function() - if vim.wo.diff then - return "]c" - end - vim.schedule(function() - gs.next_hunk() - end) - return "" - end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" }) - vim.keymap.set({ "n", "v" }, "[c", function() - if vim.wo.diff then - return "[c" - end - vim.schedule(function() - gs.prev_hunk() - end) - return "" - end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" }) - end, - }, + "lewis6991/gitsigns.nvim", + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + on_attach = function(bufnr) + vim.keymap.set( + "n", + "gg", + require("gitsigns").preview_hunk, + { buffer = bufnr, desc = "Preview git hunk" } + ) + end, + }, } From 2fc217a01da85e1f574b6af4a891dce691bf7b9f Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Thu, 3 Apr 2025 14:27:39 +0200 Subject: [PATCH 18/20] chore: update lazy plugins --- lazy-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 8bb6cec..98604bd 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,8 +11,8 @@ "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mini.nvim": { "branch": "main", "commit": "687fa868d869078194c02065628712982d971fd6" }, "newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" }, - "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, - "nvim-treesitter": { "branch": "master", "commit": "30654ee72a69e7c76a54b66d748dae088429e863" }, + "nvim-lint": { "branch": "master", "commit": "81e8ba7655cc4395b1092ef4e1b6e83f54cd54ad" }, + "nvim-treesitter": { "branch": "master", "commit": "997288c55253e27f782d991099490f80205d65bf" }, "nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, From 60a8a057a521cb974e3d19aa7dae8a439745ff8c Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 4 Apr 2025 11:36:20 +0200 Subject: [PATCH 19/20] feat: add Tailwind CSS LSP --- lsp/tailwind.lua | 34 ++++++++++++++++++++++++++++++++++ lua/weeheavy/prefs.lua | 1 + 2 files changed, 35 insertions(+) create mode 100644 lsp/tailwind.lua diff --git a/lsp/tailwind.lua b/lsp/tailwind.lua new file mode 100644 index 0000000..b0b93c2 --- /dev/null +++ b/lsp/tailwind.lua @@ -0,0 +1,34 @@ +---@type vim.lsp.Config +return { + cmd = { "tailwindcss-language-server", "--stdio" }, + root_markers = { "tailwind.config.js" }, + filetypes = { "javascript", "htmldjango", "css" }, + settings = { + tailwindCSS = { + validate = true, + lint = { + cssConflict = "warning", + invalidApply = "error", + invalidScreen = "error", + invalidVariant = "error", + invalidConfigPath = "error", + invalidTailwindDirective = "error", + recommendedVariantOrder = "warning", + }, + classAttributes = { + "class", + "className", + "class:list", + "classList", + "ngClass", + }, + includeLanguages = { + eelixir = "html-eex", + eruby = "erb", + templ = "html", + htmlangular = "html", + htmldjango = "html", + }, + }, + }, +} diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index f24f928..6312c93 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -6,6 +6,7 @@ vim.lsp.enable({ "yaml", "ansible", "marksman", + "tailwind", }) -- Set highlight on search From b08d663fb7568ad0061a6dc48311e69005db350b Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 4 Apr 2025 11:43:57 +0200 Subject: [PATCH 20/20] fix(terraform): optimize list of root_markers --- lsp/terraform.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsp/terraform.lua b/lsp/terraform.lua index 8ab398b..ce42c7c 100644 --- a/lsp/terraform.lua +++ b/lsp/terraform.lua @@ -1,6 +1,6 @@ ---@type vim.lsp.Config return { cmd = { "terraform-ls", "serve" }, - root_markers = { "go.work", "go.mod", ".git" }, + root_markers = { ".terraform", ".terraform.lock.hcl", ".git" }, filetypes = { "terraform" }, }