diff --git a/README.md b/README.md index 20410b4..0e5f726 100644 --- a/README.md +++ b/README.md @@ -5,22 +5,35 @@ After doing my first steps with , I decided to roll my own, custom, "lightweight" Neovim configuration in order to better understand Neovim and its configuration/customization, package managers, -plugins etc. and have "my own" config that only includes things I really need. +plugins etc. and have my own config that only includes parts I need. More on the "why's" are explained [in my blog post](https://lugh.ch/neovim-lessons-learned.html). ## Installation -1. Install Neovim 0.10. or newer +1. Install Neovim 0.12 or newer 1. Install the dependencies documented in `init.lua` 1. Clone this Git repository to 1. `~/.config/nvim` on macOS or Linux - 1. `c:\Users\foobar\AppData\Local\nvim` when on Windows + 1. `c:\Users\foobar\AppData\Local\nvim` on Windows ### Finishing touches - Create a `$HOME/.ignore` file and add big, useless directories to it, so - Telescope/ripgrep/fd can ignore those. My current list of files/directories is - available in `lua/weeheavy/plugins/telescope-fzf-native.lua` + ripgrep, fd can ignore those. Ideas: + ``` + Pictures/ + Music/ + Applications/ + dotnet/ + opt/miniconda3/ + Library/ + .cache/ + .vscode/ + .git/ + .local/ + .m2/ + .npm/ + ``` - Install Mason LSP/linter/formatters from the table down below ## Speed @@ -29,52 +42,55 @@ 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 15 on Neovim 0.11.0. +macOS 15 on Neovim 0.12.0. ### Start and open init.lua Around 15% of the plugins are lazy-loaded. ```bash -LazyStart 18.67ms -LazyDone 43.52ms (+24.85ms) -UIEnter 110.71ms (+67.19ms) +LazyStart 12.28ms +LazyDone 61.96ms (+49.68ms) +UIEnter 122.07ms (+60.11ms) ``` -### Starting with an empty file +### Starting without a file -Around 50% of the plugins are lazy-loaded. +Around 45% of the plugins are lazy-loaded. ```bash -LazyStart 18.15ms -LazyDone 46.91ms (+28.76ms) -UIEnter 59.08ms (+12.17ms) +LazyStart 13.51ms +LazyDone 64.8ms (+51.29ms) +UIEnter 84.97ms (+20.17ms) ``` ## Plugins -| Name | Purpose | URL | -| ------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------- | -| **lazy.nvim** | Package manager | | -| **telescope.nvim** | Find, Filter, Preview, Pick | | -| **telescope-fzf-native.nvim** | Fuzzy finder for Telescope | | -| **nvim-treesitter** | Parser/syntax highlighting | | -| **nvim-treesitter-context** | Shows current line context | | -| **nvim-treesitter-textobjects** | ? | | -| **oil.nvim** | file explorer, (bulk file creation/rename) | | -| **rose-pine** | Theme | | -| **lualine.nvim** | Status line | | -| **gitsigns.nvim** | Git change indicator | | -| **which-key.nvim** | Shows contextual key bindings | | -| **conform.nvim** | Formatter configuration, replacement for `null-ls` | | -| **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | | -| **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 | | -| **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 | | +| Name | Purpose | URL | +| ------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------- | +| **SchemaStore.nvim** | JSON schemas | | +| **aerial.nvim** | Code outline | | +| **blink.cmp** | Fuzzy code completion | | +| **ccc.nvim** | Color picker/color highlight | | +| **conform.nvim** | Formatter configuration, replacement for `null-ls` | | +| **diffview.nvim** | Git diff viewer/stager | | +| **flash.nvim** | Navigation and Treesitter selection w/ search labels | | +| **gitsigns.nvim** | Git change indicator | | +| **kanso** | Theme | | +| **lazy.nvim** | Package manager | | +| **lualine.nvim** | Status line | | +| **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | | +| **mini.nvim** | Picker, icons, show trailing whitespace, textobject nav | | +| **nvim-lint** | Narrow-scope linter plugin to use via Neovim diagnostic framework | | +| **nvim-treesitter** | Parser/syntax highlighting | | +| **nvim-treesitter-context** | Shows current line context | | +| **nvim-treesitter-textobjects** | ? | | +| **oil.nvim** | file explorer, (bulk file creation/rename) | | +| **rose-pine** | Theme | | +| **snipe.nvim** | Buffer navigation | | +| **todo-comments.nvim** | Highlight `NOTE:`, `FIXME:` inline and via `trouble.nvim` | | +| **trouble.nvim** | pretty diagnostics, references, quickfix and location list | | +| **which-key.nvim** | Shows contextual key bindings | | ## Looks @@ -85,32 +101,42 @@ This is how it looks like: ## Mason essentials This lists the LSPs/linter/formatters I consider ok for my use cases. Tools may -support many more languages than I document in the "Language" column. The -formatters installed here are used via `conform.nvim`. +support more languages than I document in the "Language" column. The formatters +installed through Mason are then configured in `conform.nvim`. -| Type | Language | Name | Benefits | Issues | -| --------- | ------------------ | --------------------------- | ------------------------------------------------ | ----------------------------------------------------- | -| LSP | Markdown | **marksman** | Autocompletes links | | -| LSP | Go | **gopls** | | n/a | -| LSP | Terraform/OpenTofu | **terraform-ls** | | n/a | -| LSP | Terraform/OpenTofu | **tflint** | | n/a | -| LSP | Ansible | **ansible-language-server** | Ansible knowhow | Search _yaml.ansible_ in `prefs.lua` | -| LSP | Bash | **bash-language-server** | Incorporates ShellCheck | n/a | -| LSP | YAML | **yaml-language-server** | | n/a | -| Linter | Ansible | **ansible-lint** | | yamllint vs. ansible-lint | -| Linter | YAML | **yamllint** | | yamllint vs. ansible-lint | -| Linter | Terraform/OpenTofu | **tflint** | | | -| Linter | any | **woke** | Makes you aware of woke language | | -| Linter | Git commits | **commitlint** | Ensure to adhere to _Conventional Commit_ format | | -| Linter | JSON | **jsonlint** | | | -| Linter | Text | **proselint** | See [source][prose] | | -| Linter | Text | **write-good** | See [source][writegood] | | -| Formatter | Markdown, YAML | **prettier** | Markdown table formatting | n/a | -| Formatter | Lua | **stylua** | Formats Lua | n/a | -| Formatter | Bash | **shfmt** | Formats Bash scripts | n/a | -| Formatter | HCL | **hclfmt** | For HashiCorp configuration language | | -| Formatter | many | **prettier** | See [docs][prettier] | | -| Formatter | YAML | **yamlfmt** | | | +| Type | Language | Name | Benefits | Issues | +| --------- | ------------------ | ----------------------------------- | ----------------------- | --------------------------------- | +| Formatter | YAML | **yamlfmt** | | | +| Formatter | many | **prettier** | See [docs][prettier] | | +| Formatter | Python | **isort** | Sorts imports | | +| Formatter | Python | **ruff** | | | +| Formatter | TOML | **taplo** | | | +| Formatter | Lua | **stylua** | | | +| LSP | Ansible | **ansible-language-server** | Ansible knowhow | See _yaml.ansible_ in `prefs.lua` | +| LSP | Bash | **bash-language-server** | Incorporates ShellCheck | | +| LSP | Go | **gopls** | | | +| LSP | Markdown | **marksman** | Autocompletes links | [issues/327][marksmanbug] | +| LSP | Docker Compose | **docker-compose-language-service** | | | +| LSP | Docker | **dockerfile-language-server** | | | +| LSP | HTML | **html-lsp** | | | +| LSP | JSON | **json-lsp** | | | +| LSP | Python | **ruff** | | | +| LSP | Lua | **stylua** | | | +| LSP | CSS | **tailwindcss-language-server** | | | +| LSP | TOML | **taplo** | | | +| LSP | Terraform/OpenTofu | **tflint** | | | +| LSP | Terraform/OpenTofu | **terraform-ls** | HashiCorp | | +| LSP | YAML | **yaml-language-server** | | | +| Linter | Ansible | **ansible-lint** | | yamllint vs. ansible-lint | +| Linter | Git commits | **commitlint** | _Conventional Commits_ | | +| Linter | JSON | **jsonlint** | | | +| Linter | Terraform/OpenTofu | **tflint** | | | +| Linter | Text | **proselint** | See [source][prose] | | +| Linter | Text | **write-good** | See [source][writegood] | | +| Linter | YAML | **yamllint** | | yamllint vs. ansible-lint | +| Linter | many | **gitleaks** | | | +| Linter | Python | **ruff** | | | +| Linter | Bash | **shellcheck** | | | ## Key bindings @@ -127,3 +153,4 @@ See [CHEATSHEET](CHEATSHEET.md) [prettier]: https://prettier.io/docs/ [prose]: https://github.com/amperser/proselint [writegood]: https://github.com/btford/write-good?tab=readme-ov-file#checks +[marksmanbug]: https://github.com/artempyanykh/marksman/issues/327 diff --git a/after/ftplugin/help.lua b/after/ftplugin/help.lua index 44cea3c..1813e8c 100644 --- a/after/ftplugin/help.lua +++ b/after/ftplugin/help.lua @@ -1,3 +1,2 @@ --- Disable column width indicators in quickfix/Trouble windows -vim.opt.colorcolumn = "" +-- Disable colorcolumn in help windows vim.wo.colorcolumn = "" diff --git a/after/ftplugin/oil.lua b/after/ftplugin/oil.lua index ba7eb51..4961a79 100644 --- a/after/ftplugin/oil.lua +++ b/after/ftplugin/oil.lua @@ -1,4 +1,4 @@ --- Disable numbers in Oil windows -vim.opt.relativenumber = false -vim.opt.number = false -vim.opt.colorcolumn = "" +-- Disable numbers and colorcolumn in Oil windows +vim.wo.relativenumber = false +vim.wo.number = false +vim.wo.colorcolumn = "" diff --git a/init.lua b/init.lua index 6fd7216..6d54614 100644 --- a/init.lua +++ b/init.lua @@ -5,31 +5,21 @@ 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) -- fd (https://github.com/sharkdp/fd, used by telescope) - A Nerd font (https://www.nerdfonts.com/, used by various plugins) +- tree-sitter-cli (brew install ) NOTE: EXTERNAL DEPENDENCIES FREEBSD -- cmake, ripgrep (pkg install ) +- cmake, tree-sitter-cli, ripgrep (pkg install ) NOTE: EXTERNAL DEPENDENCIES LINUX (Arch) - cmake, tree-sitter-cli, nodejs (pacman -S ) -Make fzf work: -1. Go to ~/.local/share/nvim/lazy/telescope-fzf-native.nvim -2. Run `make` - 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) -- fd (https://github.com/sharkdp/fd, used by telescope) - A Nerd font (https://www.nerdfonts.com/, used by various plugins) - nodejs-lts (used for npm to install prettier) - then run "npm i -g npm" - zig, wget, unzip, git, fzf -- make, mingw (MartinStorsjo.LLVM-MinGW.MSVCRT), cmake (https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) -Then run "mingw32-make.exe" in your users telescope-fzf-native plugin directory: -C:\Users\foobar\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim --]] -- Include my custom configuration diff --git a/lazy-lock.json b/lazy-lock.json index cd48ceb..3428b0d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,36 +1,31 @@ { - "SchemaStore.nvim": { "branch": "main", "commit": "25a82a141dc0caf3b9b82002a35caf3c9feab741" }, + "SchemaStore.nvim": { "branch": "main", "commit": "250aed7415ddd6cb3ea321490c7b35094ed9148d" }, "aerial.nvim": { "branch": "master", "commit": "645d108a5242ec7b378cbe643eb6d04d4223f034" }, "blink-cmp-git": { "branch": "master", "commit": "10783593af764424018a95e75df6ad5a8b66fe07" }, - "blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" }, + "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "catppuccin": { "branch": "main", "commit": "cb5665990a797b102715188e73c44c3931b3b42e" }, "ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" }, "conform.nvim": { "branch": "master", "commit": "3543d000dafbc41cc7761d860cfdb24e82154f75" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "fzf-lua": { "branch": "main", "commit": "bde73a6886b607246095aa59f396de5e0d036890" }, - "gitsigns.nvim": { "branch": "main", "commit": "a462f416e2ce4744531c6256252dee99a7d34a83" }, + "fzf-lua": { "branch": "main", "commit": "8223eb24a7adf72c4b24e04b751486b492775414" }, + "gitsigns.nvim": { "branch": "main", "commit": "6d808f99bd63303646794406e270bd553ad7792e" }, "kanso.nvim": { "branch": "main", "commit": "1afbbb449aa0254823dbe1932e3cbb51886ff9fe" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, - "lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" }, + "lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" }, "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, - "mini.nvim": { "branch": "main", "commit": "439cdcd6992bc9012efd7d8ed7a7b7a0f1fac32a" }, - "nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" }, - "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, - "nvim-treesitter-context": { "branch": "master", "commit": "adf4b6b0420b7be6c717ef0ac7993183d6c201b1" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, - "nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, + "mini.nvim": { "branch": "main", "commit": "5849ef04c32a6a8e55957b946c0a275801d87530" }, + "nvim-lint": { "branch": "master", "commit": "eab58b48eb11d7745c11c505e0f3057165902461" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, + "nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" }, + "nvim-web-devicons": { "branch": "master", "commit": "c72328a5494b4502947a022fe69c0c47e53b6aa6" }, "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "pomo.nvim": { "branch": "main", "commit": "7e06e5221d8d1e596a0ab29dd4d7fcee5f3cd05a" }, - "rose-pine": { "branch": "main", "commit": "cf2a288696b03d0934da713d66c6d71557b5c997" }, + "rose-pine": { "branch": "main", "commit": "9504524e5ed0e326534698f637f9d038ba4cd0ee" }, "snipe.nvim": { "branch": "main", "commit": "d2d196c335919767803f905d573ce66340e33ee6" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, - "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }, - "zenbones.nvim": { "branch": "main", "commit": "22b7fb75593412e0dc81b4bdefae718e9e84aa82" } + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lsp/proselint.lua b/lsp/proselint.lua index cdd20bf..1d260c1 100644 --- a/lsp/proselint.lua +++ b/lsp/proselint.lua @@ -1,5 +1,5 @@ ---@type vim.lsp.Config return { - cmd = { "proselint" }, + cmd = { "proselint", "check", "--output-format=json" }, filetypes = { "markdown", "text", "gitcommit", "plaintext" }, } diff --git a/lsp/woke.lua b/lsp/woke.lua deleted file mode 100644 index 79c7927..0000000 --- a/lsp/woke.lua +++ /dev/null @@ -1,5 +0,0 @@ ----@type vim.lsp.Config -return { - cmd = { "woke", "--stdin" }, - filetypes = { "markdown", "text", "gitcommit", "plaintext" }, -} diff --git a/lua/weeheavy/init.lua b/lua/weeheavy/init.lua index 4ef9f75..9e9336c 100644 --- a/lua/weeheavy/init.lua +++ b/lua/weeheavy/init.lua @@ -14,8 +14,8 @@ require("weeheavy.prefs") require("weeheavy.autocmd") -- Run floating Oil window when Neovim was started without a file name -if vim.fn.argc() == 0 then - vim.defer_fn(function() - vim.cmd("Oil --float") - end, 0) -end +-- if vim.fn.argc() == 0 then +-- vim.defer_fn(function() +-- vim.cmd("Oil --float") +-- end, 0) +-- end diff --git a/lua/weeheavy/plugins/diffview.lua b/lua/weeheavy/plugins/diffview.lua index c5520d8..495f239 100644 --- a/lua/weeheavy/plugins/diffview.lua +++ b/lua/weeheavy/plugins/diffview.lua @@ -1,9 +1,10 @@ return { - "sindrets/diffview.nvim", - branch = "main", - --event = "VeryLazy", - opts = {}, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, + "sindrets/diffview.nvim", + branch = "main", + lazy = true, + --event = "VeryLazy", + opts = {}, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, } diff --git a/lua/weeheavy/plugins/lsp/mason.lua b/lua/weeheavy/plugins/lsp/mason.lua index 0e4bc19..a8d294b 100644 --- a/lua/weeheavy/plugins/lsp/mason.lua +++ b/lua/weeheavy/plugins/lsp/mason.lua @@ -1,6 +1,6 @@ return { - "williamboman/mason.nvim", - tag = "stable", - lazy = false, - config = true, - } + "williamboman/mason.nvim", + tag = "stable", + -- cmd = "Mason", + config = true, +} diff --git a/lua/weeheavy/plugins/lsp/nvim-lint.lua b/lua/weeheavy/plugins/lsp/nvim-lint.lua index 23286a2..e2cbd1b 100644 --- a/lua/weeheavy/plugins/lsp/nvim-lint.lua +++ b/lua/weeheavy/plugins/lsp/nvim-lint.lua @@ -37,11 +37,11 @@ return { typescriptreact = { "eslint_d" }, svelte = { "eslint_d" }, python = { "ruff" }, - lua = { "woke" }, - ansible = { "woke" }, - markdown = { "woke", "proselint", "write_good" }, + -- lua = { "woke" }, + -- ansible = { "woke" }, + markdown = { "proselint", "write_good" }, text = { "gitleaks", "proselint", "write_good" }, - sh = { "gitleaks", "woke" }, + sh = { "gitleaks" }, bash = { "gitleaks" }, go = { "golangcilint" }, } diff --git a/lua/weeheavy/plugins/mini.lua b/lua/weeheavy/plugins/mini.lua index 3465fbf..bdce9fc 100644 --- a/lua/weeheavy/plugins/mini.lua +++ b/lua/weeheavy/plugins/mini.lua @@ -7,7 +7,16 @@ return { -- require("mini.ai").setup({ n_lines = 500 }) require("mini.trailspace").setup() -- highlight trailing space require("mini.cursorword").setup() -- highlight word below cursor - require("mini.ai").setup() -- replace within/outside quotes + require("mini.ai").setup({ -- replace within/outside quotes + mappings = { + -- Disable next/last variants to avoid conflict with + -- Neovim 0.12 built-in `an`/`in` node selection (see :help v_an) + around_next = "", + inside_next = "", + around_last = "", + inside_last = "", + }, + }) require("mini.pick").setup({ mappings = { move_down = "", diff --git a/lua/weeheavy/plugins/telescope-fzf-native.lua b/lua/weeheavy/plugins/telescope-fzf-native.lua deleted file mode 100644 index ecad5b2..0000000 --- a/lua/weeheavy/plugins/telescope-fzf-native.lua +++ /dev/null @@ -1,19 +0,0 @@ ---[[ -Fuzzy finder -Docs: https://github.com/nvim-telescope/telescope-fzf-native.nvim - -Performance depends on installation of ripgrep and fd (both available in Homebrew) -If you have huge amounts of files, consider adding some to `$HOME/.ignore`: - Pictures/ - Music/ - Applications/ - dotnet/ - opt/miniconda3/ - Library/ - .cache/ - .git/ -]]-- -return { - "nvim-telescope/telescope-fzf-native.nvim", - build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' -} diff --git a/lua/weeheavy/plugins/telescope.lua b/lua/weeheavy/plugins/telescope.lua deleted file mode 100644 index c7a93d5..0000000 --- a/lua/weeheavy/plugins/telescope.lua +++ /dev/null @@ -1,56 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - lazy = true, - --event = "VeryLazy", - cmd = "Telescope", - tag = "0.1.8", - dependencies = { - "nvim-lua/plenary.nvim", - }, - --config = function(lazy, opts) - config = function() - local telescope = require("telescope") - telescope.load_extension("fzf") - --telescope.load_extension("file_browser") - telescope.setup({ - defaults = { - border = false, - sorting_strategy = "ascending", - wrap_result = true, - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.45, - width = 0.90, - height = 0.75, - preview_cutoff = 90, - }, - }, - }, - pickers = { - colorscheme = { - enable_preview = true, - }, - find_files = { - hidden = true, - wrap_results = false, -- this is not about the preview - }, - live_grep = { - additional_args = function() - return { "--hidden", "--glob", "!**/.git/*" } - end, - }, - grep_string = { - additional_args = function() - return { "--hidden", "--glob", "!**/.git/*" } - end, - }, - ["lsp_references"] = { wrap_results = true }, - ["lsp_definitions"] = { wrap_results = true }, - ["diagnostics"] = { wrap_results = true }, - ["buffers"] = { sort_mru = true, sort_lastused = true, ignore_current_buffer = false }, - }, - }) - end, -} diff --git a/lua/weeheavy/plugins/treesitter.lua b/lua/weeheavy/plugins/treesitter.lua index 84e951f..062a8d6 100644 --- a/lua/weeheavy/plugins/treesitter.lua +++ b/lua/weeheavy/plugins/treesitter.lua @@ -1,74 +1,77 @@ -- Treesitter +-- NOTE: After updating, wipe old plugin cache then reinstall: +-- rm -rf ~/.local/share/nvim/lazy/nvim-treesitter +-- rm -rf ~/.local/share/nvim/lazy/nvim-treesitter-textobjects +-- Then open Neovim and run :Lazy restore return { - "nvim-treesitter/nvim-treesitter", - branch = "master", -- FIXME: switch to main sometime - lazy = false, - build = ":TSUpdate", - event = { "BufReadPre", "BufNewFile" }, - enabled = true, - dependencies = { - "nvim-treesitter/nvim-treesitter-textobjects", - }, - config = function() - local treesitter = require("nvim-treesitter.configs") + { + "nvim-treesitter/nvim-treesitter", + branch = "main", + lazy = false, + build = ":TSUpdate", + enabled = true, + config = function() + require("nvim-treesitter") + .install({ + "lua", + "comment", -- used for TODO:, FIXME:, XXX: and NOTE: + "vim", + "vimdoc", + "bash", + "diff", + "make", + "gitignore", + "gitcommit", + "markdown", + "markdown_inline", + "rst", + "latex", + "elixir", + "eex", + "heex", + "yaml", + "html", + "css", + "javascript", + "dockerfile", + "query", + "hcl", + "terraform", + "bicep", + "csv", + "properties", + "ini", + "python", + "regex", + "json", + "go", + "gomod", + "gosum", + "editorconfig", + "http", + "toml", + "sql", + "promql", + "nginx", + "powershell", + }) + :wait(300000) -- wait max. 5 min - treesitter.setup({ - highlight = { enable = true }, - indent = { enable = true }, - auto_install = false, - -- language list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages - ensure_installed = { - "lua", - "comment", -- used for TODO:, FIXME:, XXX: and NOTE: - "vim", - "vimdoc", - "bash", - "diff", - "make", - "gitignore", - "gitcommit", - "markdown", - "markdown_inline", - "rst", - "latex", - "elixir", - "eex", - "heex", - "yaml", - "html", - "css", - "javascript", - "dockerfile", - "query", - "hcl", - "terraform", - "bicep", - "csv", - "properties", - "ini", - "python", - "regex", - "json", - "go", - "gomod", - "gosum", - "editorconfig", - "http", - "toml", - "sql", - "promql", - "nginx", - "powershell", - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - }) - end, + -- Highlight & indent are built into Neovim 0.11+ + vim.api.nvim_create_autocmd("FileType", { + callback = function() + if pcall(vim.treesitter.start) then + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end + end, + }) + + -- Incremental node selection (Neovim 0.12+, see :help v_an v_in) + -- Built-in: an = expand to parent, in = shrink to child + -- mini.ai's `an`/`in` next/last mappings must be disabled (see mini.lua) + vim.keymap.set("n", "", "van", { desc = "Treesitter: init selection", remap = true }) + vim.keymap.set("v", "", "an", { desc = "Treesitter: expand selection", remap = true }) + vim.keymap.set("v", "", "in", { desc = "Treesitter: shrink selection", remap = true }) + end, + }, } diff --git a/lua/weeheavy/plugins/trouble.lua b/lua/weeheavy/plugins/trouble.lua index 9f34071..d8c97bc 100644 --- a/lua/weeheavy/plugins/trouble.lua +++ b/lua/weeheavy/plugins/trouble.lua @@ -8,6 +8,11 @@ return { open_no_results = true, auto_close = true, indent_guides = false, + win = { + wo = { + colorcolumn = "", + }, + }, }, keys = { -- TODO: add more keymaps diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index d870b29..43dae40 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -7,7 +7,6 @@ vim.lsp.enable({ "ansible", "marksman", "write-good", - -- "woke", -- permission issues with macOS .Trash "tailwind", "docker-compose", "bicep", diff --git a/lua/weeheavy/remap.lua b/lua/weeheavy/remap.lua index 15f1f58..c675c6c 100644 --- a/lua/weeheavy/remap.lua +++ b/lua/weeheavy/remap.lua @@ -32,8 +32,7 @@ vim.keymap.set( ) -- todo-comments.nvim --- NOTE: this one is a bit hard to migrate away from Telescope to mini.nvim -vim.keymap.set("n", "ft", ":TodoTelescope", { noremap = true, desc = "Find TODOs" }) +vim.keymap.set("n", "ft", ":Trouble todo", { noremap = true, desc = "Find TODOs" }) -- Git things vim.keymap.set("n", "gla", ":Pick git_commits", { noremap = true, desc = "Git log (all files)" })