neovim/README.md

119 lines
7.6 KiB
Markdown
Raw Normal View History

2023-11-21 10:31:34 +01:00
# My Neovim configuration
## Motivation
After doing my first steps with <https://github.com/nvim-lua/kickstart.nvim>,
2023-11-21 13:29:49 +01:00
I decided to roll my own, custom, "lightweight" Neovim configuration in order to
better understand Neovim and its configuration/customization, package managers,
2023-11-23 09:12:39 +01:00
plugins etc. and have "my own" config that only includes things I really need.
2024-03-06 09:39:37 +01:00
More on the "why's" are explained [in my blog post](https://lugh.ch/neovim-lessons-learned.html).
2023-11-21 10:31:34 +01:00
2023-11-21 13:29:49 +01:00
## Installation
2023-11-21 10:31:34 +01:00
2023-11-21 13:29:49 +01:00
1. Install Neovim 0.9.x
2024-01-22 22:51:19 +01:00
1. Install macOS/Windows dependencies documented in `init.lua`
1. Clone this Git repository to
1. `~/.config/nvim` when on macOS/Linux
1. `c:\Users\foobar\AppData\Local\nvim` when on Windows
2023-11-21 10:31:34 +01:00
2023-11-21 13:29:49 +01:00
### Finishing touches
2023-11-23 09:12:39 +01:00
- 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`
2024-01-22 22:51:19 +01:00
- Install Mason LSP/linter/formatters in the table down
2023-11-21 10:31:34 +01:00
## Speed
Output from lazy.nvim profiling (`:Lazy profile`) on a MacBook Pro M2 Max,
2024-03-06 09:51:51 +01:00
macOS 14.
2023-11-21 10:31:34 +01:00
### Start and open init.lua
2024-03-06 09:51:51 +01:00
Around 20% of the plugins are lazy-loaded.
```bash
2024-03-06 09:51:51 +01:00
Startuptime: 81.44ms
Based on the actual CPU time of the Neovim process till UIEnter.
This is more accurate than `nvim --startuptime`.
2024-03-06 09:51:51 +01:00
LazyStart 11.34ms
LazyDone 23.66ms (+12.32ms)
UIEnter 81.44ms (+57.78ms)
```
### Starting with an empty file
2024-03-06 09:51:51 +01:00
Around 65% of the plugins are lazy-loaded.
2023-11-28 13:10:51 +01:00
2023-11-21 10:31:34 +01:00
```bash
2024-03-06 09:51:51 +01:00
Startuptime: 35.89ms
2023-11-21 10:31:34 +01:00
Based on the actual CPU time of the Neovim process till UIEnter.
This is more accurate than `nvim --startuptime`.
2024-03-06 09:51:51 +01:00
LazyStart 11.55ms
LazyDone 24.74ms (+13.18ms)
UIEnter 35.89ms (+11.15ms)
2023-11-21 10:31:34 +01:00
```
## Plugins
2024-03-06 09:51:51 +01:00
| Name | Purpose | URL |
| ------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------- |
| **lazy.nvim** | Package manager | <https://github.com/folke/lazy.nvim> |
| **telescope.nvim** | Find, Filter, Preview, Pick | <https://github.com/nvim-telescope/telescope.nvim> |
| **telescope-fzf-native.nvim** | Fuzzy finder for Telescope | <https://github.com/nvim-telescope/telescope-fzf-native.nvim> |
| **nvim-treesitter** | Parser/syntax highlighting | <https://github.com/nvim-treesitter/nvim-treesitter> |
| **nvim-treesitter-context** | Shows current line context | <https://github.com/nvim-treesitter/nvim-treesitter-context> |
| **nvim-treesitter-textobjects** | ? | <https://github.com/nvim-treesitter/nvim-treesitter-textobjects> |
| **oil.nvim** | file explorer, (bulk file creation/rename) | <https://github.com/stevearc/oil.nvim> |
| **nightfox.nvim** | Theme with treesitter/lsp support | <https://github.com/EdenEast/nightfox.nvim> |
| **tokyonight.nvim** | Theme with treesitter/lsp support | <https://github.com/folke/tokyonight.nvim> |
| **lualine.nvim** | Status line | <https://github.com/nvim-lualine/lualine.nvim> |
| **nvim-web-devicons** | filetype glyphs (icons) for plugins | <https://github.com/nvim-tree/nvim-web-devicons> |
| **gitsigns.nvim** | Git change indicator | <https://github.com/lewis6991/gitsigns.nvim> |
| **which-key.nvim** | Shows contextual key bindings | <https://github.com/folke/which-key.nvim> |
| **vim-illuminate** | Highlight similar words (w/ LSP, Treesitter, regex) | <https://github.com/RRethy/vim-illuminate> |
| **lsp-zero.nvim** | LSP for mere mortals | <https://github.com/VonHeikemen/lsp-zero.nvim> |
| **nvim-lspconfig** | Component of lsp-zero.nvim | <https://github.com/neovim/nvim-lspconfig> |
| **cmp-nvim-lsp** | Dependency of lsp-zero.nvim | <https://github.com/hrsh7th/cmp-nvim-lsp> |
| **conform.nvim** | Formatter configuration, replacement for `null-ls` | <https://github.com/stevearc/conform.nvim> |
| **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | <https://github.com/williamboman/mason.nvim> |
| **mason-lspconfig.nvim** | Bridges mason.nvim with the lspconfig plugin | <https://github.com/williamboman/mason-lspconfig.nvim> |
| **zen-mode.nvim** | Distraction-free coding for Neovim | <https://github.com/folke/zen-mode.nvim> |
| **twilight.nvim** | Dims inactive portions of the code you're editing | <https://github.com/folke/twilight.nvim> |
| **todo-comments.nvim** | Highlights `NOTE:`, `FIXME:` etc. and makes them findable via Telescope | <https://github.com/folke/todo-comments.nvim> |
2023-11-21 10:31:34 +01:00
2023-11-24 17:52:57 +01:00
## 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`.
2024-03-06 09:51:51 +01:00
| Type | Language | Name | Benefits | Issues |
| --------- | -------------- | ---------------- | -------------------------- | ------------------------- |
| LSP | Markdown | **marksman** | Autocompletes links | n/a |
| LSP | Go | **gopls** | | n/a |
| LSP | Terraform | **terraform-ls** | | n/a |
| Linter | Ansible | **ansible-lint** | | yamllint vs. ansible-lint |
| Linter | YAML | **yamllint** | | yamllint vs. ansible-lint |
| Formatter | Markdown, YAML | **prettier** | Markdown table formatting! | n/a |
| Formatter | Lua | **stylua** | Formats Lua | n/a |
2024-04-25 16:24:00 +02:00
| Formatter | Bash | **shfmt** | Formats Bash scripts | n/a |
2024-02-03 22:14:23 +01:00
## Key bindings
2024-02-04 10:46:06 +01:00
See [CHEATSHEET](CHEATSHEET.md)
2024-02-03 22:14:23 +01:00
2023-11-21 13:29:49 +01:00
## Open issues/TODOs
2024-01-25 17:38:26 +01:00
- <https://github.com/axkirillov/hbac.nvim>
2024-02-03 22:14:23 +01:00
- solution to search-replace visual blocks
2024-07-11 23:11:53 +02:00
[![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)