dotfiles/nvim/README.md

80 lines
4.2 KiB
Markdown

# kreeger's nvim configs
This repo contains my NeoVim configs, which I clone right to `~/.config/nvim`.
Here's how things are structured.
## Explained
### Top-level (no plugins involved yet)
- `init.lua` is the thin start point: it sets the `leader` to my spacebar,
disables `netrw`, and then `require()`'s 4 other configs, which have to live in
the `lua` directory for the `require` statement to work like it does.
- `lua/config/lazy_init.lua` loads [Lazy][lazy], my plugin manager of choice
- `lua/config/settings.lua` includes my basic global Vim settings that would
normally be in my `vimrc` files; stuff like line numbers, clipboard use, etc.
- `lua/config/keymaps.lua` includes any keymappings related to global Vim
behaviors, like quitting, diagnostics, focus moving, etc.
- `lua/config/autocmds.lua` includes any auto-commands, which is pretty sparse
at the moment, but does crucially have a fix to automatically ensure ".tf" files
are read as `terraform` files (so that `terraform-ls` can start working right
away)
I also have a `ftplugin` folder for any local-buffer settings that need to be
run anytime a specific filetype is open (really basic things like tab-size
settings).
### `lua/config/lazy/*.lua`: plugin town
This directory gets picked up by `lua/config/lazy_init.lua`, and loads a series
of plugins in file order based on an ordering scheme I found in a YouTube video
that now eludes me. But in a nutshell:
- `10-git.lua`: uses `gitsigns.nvim` for gutter markings and `lazygit.nvim` for
an in-NeoVim experience leveraging [lazygit][lgit], my favorite git TUI
- `20-which-key.lua`: anytime I strike a key in normal mode that's the beginning
of a key sequence (my leader, or `g`, or `ctrl-w`), this opens a pane at the
bottom of my editor to show me which keys are available next in the sequence and
what they do. It's [`which-key.nvim`][whic] and it's amazing.
- `30-fuzzyfinder.lua`: installs and configures `telescope.nvim`, which is a
fuzzy-finder UI that lets me open files in a buffer quickly, or grep through my
project, or do any number of things that use fuzzily-matched text as input.
This powers a few additional plugins that come right after it:
- `31-tree.lua`: installs `nvim-tree.lua` to give me a nice file explorer
sidebar.
- `32-terminal.lua`: installs `toggleterm.nvim` to give me in-nvim terminal
windows, for when I don't want to use tmux or iTerm2 to manage a separate
tab for me.
- `40-lsp.lua`: the first of NeoVim's language-awareness powers. Installs
`lazydev.nvim` (I'll be real honest, this only works with `lua` files and I
don't know how necessary it is) and then the big one: `nvim-lspconfig`, which
handles providing configuration files to a number of LSPs, all of which get
installed using `mason.nvim` (a package manager for LSPs, if you will) and
`mason-lspconfig`. There's a lot of stuff in this file that was pulled from...
somebody else's repo? and a YouTube video? Honestly it's the file I've combed
through the absolute least.
- `41-autoformat.lua`: installs `confirm.nvim` for running formatters that get
installed either as part of an LSP, or just the installed formatter itself
(again, all installed and handled through `mason.nvim`). Format on save, and
format on a key chord (leader-f, I think).
- `42-autocomplete.lua`: installs and configures `blink.cmp` for showing
completions (those completions all come from LSPs).
- `50-colorscheme.lua`: [Catppuccin][catp], baby.
- `60-comments.lua`: supercharge my comments by... giving me TODO highlights. I
plan to expand on this more in the future, probably.
- `80-mini.lua`: installs [`mini.nvim`][mini], a grab bag of tons of smaller Lua modules
improving the NeoVim experience. I've barely scratched the surface on this
one.
- `99-treesitter.lua`: installs and configures `nvim-treesitter` which gives
nvim the rest of its syntax-highlighting superpowers. Intentionally installed
last for a specific reason I no longer recall.
And that's it, mostly. This is ever evolving and changing, so stay tuned for
future updates.
[lazy]: https://github.com/folke/lazy.nvim
[lgit]: https://github.com/jesseduffield/lazygit
[whic]: https://github.com/folke/which-key.nvim
[catp]: https://catppuccin.com
[mini]: https://github.com/echasnovski/mini.nvim