split README and CHEATSHEET

This commit is contained in:
Oliver Ladner 2024-01-18 15:13:29 +01:00
commit 0d10a064b6
2 changed files with 99 additions and 93 deletions

99
CHEATSHEET.md Normal file
View file

@ -0,0 +1,99 @@
# Neovim command and keybind cheat sheet
Some of these are plain Vim commands, others are specific to Neovim.
## Basics
- `Space` leader key
### Plugins
- `:so` Source file
- `:checkhealth` check base and all plugins
- `:checkhealth <pluginname>` check for problems of a plugin
- `:Lazy` show package manager UI
- `:Mason` show Mason UI
- `:verbose set expandtab?` check where `expandtab` has been set last
## Navigation
## Tabs
Use buffers in situations where
- `Ctrl`+`t` open a file in e.g. a Telescope finder in a new tab
- `gt` or `gT` switch between open tabs (forward/reverse direction)
## Window/split
- `Ctrl`+`wq` close window
- `Ctrl`+`ws` split window **horizontally**
- `Ctrl`+`wv` split window **vertically**
- `Ctrl`+`<h/j/k/l>` move between split windows
- `Ctrl`+`w=` equalize split window width and height
- `Ctrl`+`wr` swap position of two windows
## Buffer
- `Space`+`Space` shows open buffers (via `Telescope buffers`)
- `:bd` close current buffer
## Code
- `w` move to **start of next word** (ignores punctuation due to remap)
- `e` move to **end of next word** (ignores punctuation due to remap)
- `b` move to **start of previous word** (ignores punctuation due to remap)
- `Ctrl`+`d` scroll **down** 1/2 page while keeping the cursor centered
- `Ctrl`+`u` scroll **up** 1/2 page while keeping the cursor centered
## Editing
### Code editing
- `leader`+`i` re-indent whole file
- `leader`+`o` re-format whole file or visual with `conform.nvim`
- `i` insert mode at cursor position
- `I` insert mode at the **beginning of the line**
- `a` insert mode **one character after the current** one
- `A` insert mode at the **end of the line**
- `o` insert mode a line **below** the cursor
- `O` insert mode a line **above** the cursor
- `s` delete character and replace (substitute) it
- `cw` replace the current word
- `yy` copy (yank) the current line
- `p` paste yanked line below
- `P` paste yanked line above
- `"3p` redo (put) e.g. your third last delete [source](https://www.reddit.com/r/neovim/comments/18ri1bm/its_been_like_10_years_and_i_just_learned_that/)
### Visual mode
- `v` at cursor position
- `V` line mode
- `Ctrl`+`v` block mode
## Search files or text
- `leader`+`fg` search text in files (also searches for text under cursor)
- `leader`+`ff` search files (respects `.gitignore`)
- `leader`+`e` file browser (disregards `.gitignore`)
- `leader`+`fo` recently opened files
### Navigation in Telescope live_grep, find_files, git_status and file_browser
- `↓` or `Ctrl`+`n` scroll down (**n**ext) file list
- `↑` or `Ctrl`+`p` scroll up (**p**revious) file list
- `Ctrl`+`d` scroll **d**own in preview pane
- `Ctrl`+`u` scroll **u**p in preview pane
- `Ctrl`+`/` help
- `Ctrl`+`v` open file in **vertical** split
- `Ctrl`+`x` open file in **horizontal** split
- `Ctrl`+`t` open file in new tab
### Treesitter
- `:TSUpdate` update all parsers
- `:TSModuleInfo` show installed parsers
### LSP
- `LspInfo` show attached LSP client info

View file

@ -78,99 +78,6 @@ This is how it looks like:
![My Neovim setup](./sample.png)
## Command cheat sheet
### Neovim
Some of these are plain Vim commands, other specific to Neovim.
#### Basics
- `Space` is set as the leader key
#### Plugin things and debugging
- `:so` Source file
- `:checkhealth <pluginname>` check for problems of a plugin. Use `:checkhealth`
to check base and all plugins
- `:Lazy` to bring up package manager UI
- `:Mason` to show Mason UI
- `:verbose set expandtab?` check where `expandtab` has been set last
#### Navigation
##### Code navigation
- `w` move to **start of next word** (ignores punctuation due to remap)
- `e` move to **end of next word** (ignores punctuation due to remap)
- `b` move to **start of previous word** (ignores punctuation due to remap)
- `Ctrl`+`d` scroll **down** 1/2 page while keeping the cursor centered
- `Ctrl`+`u` scroll **up** 1/2 page while keeping the cursor centered
##### Code editing
- `leader`+`i` re-indent whole file
- `leader`+`o` re-format whole file or visual with `conform.nvim`
- `i` insert mode at cursor position
- `I` insert mode at the **beginning of the line**
- `a` insert mode **one character after the current** one
- `A` insert mode at the **end of the line**
- `o` insert mode a line **below** the cursor
- `O` insert mode a line **above** the cursor
- `s` delete character and replace (substitute) it
- `cw` replace the current word
- `yy` copy (yank) the current line
- `p` paste yanked line below
- `P` paste yanked line above
- `"3p` redo (put) e.g. your third last delete [source](https://www.reddit.com/r/neovim/comments/18ri1bm/its_been_like_10_years_and_i_just_learned_that/)
##### Visual mode
- `v` visual mode at cursor position
- `V` visual mode line mode
- `Ctrl`+`v` visual block mode
##### Tab navigation
(Don't use tabs by default, but use buffers instead).
- `Ctrl`+`t` to open a file in e.g. a Telescope finder in a new tab
- `gt` or `gT` to switch between open tabs
##### Window navigation
- `Ctrl`+`wq` close window
- `Ctrl`+`ws` split window **horizontally**
- `Ctrl`+`wv` split window **vertically**
- `Ctrl`+`<h/j/k/l>` move between split windows
- `Ctrl`+`w=` equalize split window width and height
##### Buffer navigation
- `Space`+`Space` shows open buffers (via `Telescope buffers`)
- `:bd` close current buffer
### Telescope
#### Navigation in live_grep, find_files, git_status and file_browser
- `↓` or `Ctrl`+`n` scroll down (**n**ext) file list
- `↑` or `Ctrl`+`p` scroll up (**p**revious) file list
- `Ctrl`+`d` scroll **d**own in preview
- `Ctrl`+`u` scroll **u**p in preview
- `Ctrl`+`/` help
- `Ctrl`+`v` open file in **vertical** split
- `Ctrl`+`x` open file in **horizontal** split
### Treesitter
- `:TSUpdate` update all parsers
- `:TSModuleInfo` show installed parsers
### LSP
- `LspInfo` show attached LSP client info
## Open issues/TODOs
- ollama integration <https://github.com/nomnivore/ollama.nvim>