NeoVIM Shortcuts & Commands
NeoVIM Shortcuts & Commands
Command Mode
Explore – :Ex
Enter – abre archivo / entra en directorio en la misma ventana.o – abre en nueva ventana horizontal (split debajo).v – abre en vertical split.t – abre en nueva pestaña (tab).p – previsualiza archivo en un split temporal.- – subir un nivel (directorio padre).u – retrocede al directorio anterior (como un “back”).U – rehace (u+U = undo/redo de navegación).
Edit
i – Insert mode prev position<S-i> – Insert mode beginning of linea – append text after cursor.<S-a> – append text to the end of the current line.o – Insert new line below current position and set insert mode.<S-o> – Insert new line above current position and set insert mode.(:e,:w) scp://user@host//path/to/file – (open and edit, write) remote file via ssh:Ex scp://user@host//abs/path/ – explore remote directory through ssh
Available protocols: (scp://, sftp://, ftp://, rsync://, etc)
Yank – Copy.
y – Yank selection.y<_movement_> – Yank selection simulating movement.yy – Yank line.<_n_> + yy – Yank <n> lines forward.
Change – Cut and set insert mode
cc – Change linecb – Change from cursor to beginning of word.cw or ($ ^ + - …) – Change to beginning next word ó (or end/beginning line, next, prev, etc)ciw – Change Inner Word
x – Cut next char<S-x> – Cut prev chardw – Cut/Delete from cursor to end of Worddiw – Cut Inner Wordd($ ^ + - …) and C + … – Chain from current position to the corresponding movementd<_n_> or ($ ^ + - …) – Repeat deletion command n timesdd – Delete linep – Paste after cursor.<S-p> – Paste before cursor.u – Undo change in history.<C-r> – Redo<S-r> – Replace mode.s – Suplant char or selection<S-s> – Suplant line
Registers / Memory
Types:
- Unnamed:
"[y,d,p]– default registry - Numbered:
("0-"9)[y,d,p,...] - Named:
("a-"z)[y,d,p,...] - System:
"+– system clipboard (Ctrl+C / Ctrl+V)"*– primary selection (X11/Linux, mouseVselection). - Special:
"%– current file name"#– alternate file name"/– last search pattern":– last command".– last inserted text"_– black hole register (discard text)
Uses:
y– goes to"and"0d,c,x,s– goes to"and"1,"2now is previous"1, shifts up to"9p,<S-p>– takes from unnamed registry""0p,"1p,"+p– paste last yank, last delete, system clipboardr{char}– replacement does not touch registers
Macros:qa – record into registry a:@a – replay registry a as macro:@@ – replay last executed macro
[:@,:@:] - replay last : command
Execution or Ex Mode – Colon Commands:
:= – Show number of total lines:w – Save changes without quitting:w <_filename_> – Write contents of file to a new filename.:wq – Saves changes and quit:q! – Quit without saving changes.:e <_file_path_> – Open file <file_path> for editing. (Current changes must be saved):r <_file_path_> – Read <file_path> and insert content in current edition:! <_bash_command_> – Execute shell command from within vi:ter[minal] – Open terminal, use I to write commands<C-\><C-n> – Pause terminal and go to Normal mode
Search and Replace:
:s/<_str_>/<_rep_> – Replace first occurrence of <str> for <rep> in line:s/<_str_>/<_rep_>/g – Replace all occurrs of <str> for <rep> in line:%s/<_str_>/<_rep_>/g – Replace all occurrs of <str> for <rep> in file:%s/<_str_>/<_rep_>/gc – Replace all occurrs of <str> for <rep> in file, ask confirmation each time
%at beginning represents "file search" (without % is line search). Can be replaced with a line number, +, - <jump lines>gat end represents “all occurrences”cat end means "ask for confirmation"
Operación de plugins:
<C-t> – Open/Close terminal<C-\><C-n> – hold terminal, set Normal mode<space> kp – copy filename relative path from where was opened<space> gd – go to definition <space> [l,h] – go to tab next, previous
In NerdTree:I – show/hide hidden directories and files
Configuraciones: -- Conceal oculta caracteres especiales. Nivel de 0 a 3. :set conceallevel=0 – No ocultar nada
Sessions
[:mksession,:mks] ~/session_name.vim – Save current session[:source,:so] ~/session_name.vim – Restore session:qa – Quit all. Leave session