# My Neovim configuration ## Motivation 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. 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 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 ### 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` - Install Mason LSP/linter/formatters from the table down below ## Speed 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. ### 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) ``` ### Starting with an empty file Around 50% of the plugins are lazy-loaded. ```bash LazyStart 18.15ms LazyDone 46.91ms (+28.76ms) UIEnter 59.08ms (+12.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 | | ## Looks This is how it looks like: ![My Neovim setup](./sample.png) ## 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`. | 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** | | | ## Key bindings See [CHEATSHEET](CHEATSHEET.md) ## Open issues/TODOs - - solution to search-replace visual blocks - https://github.com/aliqyan-21/wit.nvim [![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page) [prettier]: https://prettier.io/docs/ [prose]: https://github.com/amperser/proselint [writegood]: https://github.com/btford/write-good?tab=readme-ov-file#checks