Neovim
This is my Neovim config README.md file.
It takes a lot of time to configure Neovim from scratch, I am currently enjoying using AstronNvim LazyVim which
comes with a lot of functionality.
LazyVim
Section titled “LazyVim”Fundamentals
Section titled “Fundamentals”Learn how to:
- Change Configuration
- Disable plugins
- Add plugins and other things listed in the documentation.
Programming in LazyVim
Section titled “Programming in LazyVim”LSP key bindings
Section titled “LSP key bindings”K: Keyword documentation under cursorgK: Signature helpgd: Go to definitiongD: Go to declaration<leader>ca: Code action
Configuration
Section titled “Configuration”Too much stuff in the left columns. Signcolumn, Statuscolumn. mini.indentscope creates distracting animations.
Getting rid of things to the left of the text
Section titled “Getting rid of things to the left of the text”- Disable gitsigns
- Disable statuscolumn:
:set stc= - Disable signscolumn:
:set signscolumn=no
Installing (Windows)
Section titled “Installing (Windows)”In Powershell, install packer with:
git clone https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim"
Clone the repo into ~\AppData\Local\nvim:
gh repo clone jmn/nvim-config nvim
Open the file nvim\lua\plug.lua and execute it with:
:luafile %
Then run PackerSync:
:PackerSync
Partially baked from:
Then restart nvim.
Installing extras
Section titled “Installing extras”Install nerdfont: Hack-NF and configure terminal to use it.
scoop bucket add nerd-fontsscoop install sudosudo scoop install -g Hack-NFIn Terminal, Right click tab, choose:
- Settings -> Profiles -> Command Prompt -> Appearance -> Text -> Font Face
Other good fonts include, jetbrainsmono-nf.
Configure Windows Terminal to open tabs in the same directory
Section titled “Configure Windows Terminal to open tabs in the same directory”set PROMPT=$e]9;9;$P$e\%PROMPT%setx PROMPT "%PROMPT%"Ripgrep
Section titled “Ripgrep”Telescope grep uses rg (ripgrep). Install it using:
scoop install ripgrep
Comment.nvim
Section titled “Comment.nvim”- important keystrokes:
gccin normal mode,gcin visual mode.
🔥 Usage
Section titled “🔥 Usage”When you call setup() method, Comment.nvim sets up some basic mapping which can used in NORMAL and VISUAL mode to get you started with the pleasure of commenting stuff out.
Basic mappings
Section titled “Basic mappings”These mappings are enabled by default. (config: mappings.basic)
- NORMAL mode
help`gcc` - Toggles the current line using linewise comment`gbc` - Toggles the current line using blockwise comment`[count]gcc` - Toggles the number of line given as a prefix-count using linewise`[count]gbc` - Toggles the number of line given as a prefix-count using blockwise`gc[count]{motion}` - (Op-pending) Toggles the region using linewise comment`gb[count]{motion}` - (Op-pending) Toggles the region using blockwise comment- VISUAL mode
help`gc` - Toggles the region using linewise comment`gb` - Toggles the region using blockwise comment #### Extra mappings
These mappings are enabled by default. (config: mappings.extra)
- NORMAL mode
help`gco` - Insert comment to the next line and enters INSERT mode`gcO` - Insert comment to the previous line and enters INSERT mode`gcA` - Insert comment to end of the current line and enters INSERT modeExamples
Section titled “Examples”help# Linewise
`gcw` - Toggle from the current cursor position to the next word`gc$` - Toggle from the current cursor position to the end of line`gc}` - Toggle until the next blank line`gc5j` - Toggle 5 lines after the current cursor position`gc8k` - Toggle 8 lines before the current cursor position`gcip` - Toggle inside of paragraph`gca}` - Toggle around curly brackets
# Blockwise
`gb2}` - Toggle until the 2 next blank line`gbaf` - Toggle comment around a function (w/ LSP/treesitter support)`gbac` - Toggle comment around a class (w/ LSP/treesitter support)Folding
Section titled “Folding”- Important Key:
z. - Examples:
z-o(open fold),z-c(close fold)
Folding Markdown
Section titled “Folding Markdown”- Folding via tree-sitter sexp can work to some extent in markdown mode.
- https://essais.co/better-folding-in-neovim/
- https://alpha2phi.medium.com/neovim-for-beginners-code-folding-7574925412
Moving in windows
Section titled “Moving in windows”C-w +,
- o - only
- j - navigate to window below
- k - navigate to window above.
- s - split
Yank (Copy) the entire buffer to system clipboard
Section titled “Yank (Copy) the entire buffer to system clipboard”use ggVGY to yank the entire buffer to the system clipboard.
Afterwards you can use C-o to get back to where you were.
Another idea could be to use :%y to yank the buffer.
Running shell commands from Neovim
Section titled “Running shell commands from Neovim”:map <F5> :!odin run . <enter>