# 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 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.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` on Windows ### Finishing touches - Create a `$HOME/.ignore` file and add big, useless directories to it, so 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 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.12.0. ### Start and open init.lua Around 15% of the plugins are lazy-loaded. ```bash LazyStart 12.28ms LazyDone 61.96ms (+49.68ms) UIEnter 122.07ms (+60.11ms) ``` ### Starting without a file Around 45% of the plugins are lazy-loaded. ```bash LazyStart 13.51ms LazyDone 64.8ms (+51.29ms) UIEnter 84.97ms (+20.17ms) ``` ## Plugins | 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 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 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 | | --------- | ------------------ | ----------------------------------- | ----------------------- | --------------------------------- | | Formatter | Bash | **shfmt** | | | | Formatter | HCL | **hclfmt** | | | | Formatter | Lua | **stylua** | | | | Formatter | Python | **isort** | Sorts imports | | | Formatter | Python | **ruff** | | | | Formatter | TOML | **taplo** | | | | Formatter | YAML | **yamlfmt** | | | | Formatter | many | **prettier** | See [docs][prettier] | | | LSP | Ansible | **ansible-language-server** | Ansible knowhow | See _yaml.ansible_ in `prefs.lua` | | LSP | Bash | **bash-language-server** | Incorporates ShellCheck | | | LSP | CSS | **tailwindcss-language-server** | | | | LSP | Docker | **dockerfile-language-server** | | | | LSP | Docker Compose | **docker-compose-language-service** | | | | LSP | Go | **gopls** | | | | LSP | HTML | **html-lsp** | | | | LSP | JS | **eslint-lsp** | | | | LSP | JSON | **json-lsp** | | | | LSP | Lua | **stylua** | | | | LSP | Markdown | **marksman** | Autocompletes links | [issues/327][marksmanbug] | | LSP | Python | **ruff** | | | | LSP | TOML | **taplo** | | | | LSP | Terraform/OpenTofu | **terraform-ls** | HashiCorp | | | LSP | Terraform/OpenTofu | **tflint** | | | | LSP | YAML | **yaml-language-server** | | | | Linter | Ansible | **ansible-lint** | | yamllint vs. ansible-lint | | Linter | Bash | **shellcheck** | | | | Linter | Git commits | **commitlint** | _Conventional Commits_ | | | Linter | JS | **eslint_d** | | | | Linter | JSON | **jsonlint** | | | | Linter | Makefile | **checkmake** | | | | Linter | Python | **ruff** | | | | 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** | | | ## 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 [marksmanbug]: https://github.com/artempyanykh/marksman/issues/327