documents/dev/Vim-cheat-sheet.md
Table of Contents
Vim Cheatsheet
Neovim
Copying and pasting - Hold down the Shift key and select text with the mouse cursor. Text will be copied to the clipboard. This also works for pasting from the clipboard in to vim. This works for vim running in a terminal such as xterm.
Remotes
Server mode without going through ssh
Start the server on one machine
nvim --headless --listen 0.0.0.0:9321
Connect to that session from another machine
nvim --remote-ui --server <addr>:9321
https://github.com/mhinz/neovim-remote
Navigate
g - prefix for navigating line
g0 - char first line
gj or g+DownArrow - down one row (same line)
gk or g+UpArrow - up one row (same line)
gm - jump to middle character of screen line
( and ) - prev/next sentence
Info
g ctrl+g - get word count and other info
Plugins
ctrl+j/k- next/ previous ALE errorsctrl+g, j/k- next / previous git changesleader, c, space- toggle comment
FUGITIVE:
<leader>sgit status<leader>dgit diff<leader>dp | dgdiff get, diff put<leader>hsstage hunk<leader>hrreset hunk
After doing <leader>s to show git status...
- For inline split
=to show inline splitsto stage hunk-to stage/unstage
- For vertical diffsplit
dvto enter diffsplit under cursor- of when on file:
ctrl-g d - then
ctrl-g pto "diffput" over to staging file, must write to stage - or
ctrl-g yto yank / "diffget" HEAD changes