Last active
August 12, 2024 21:18
-
-
Save nafisk/095a63e4c0a6339ca6c4782c7afb497e to your computer and use it in GitHub Desktop.
Revisions
-
nafisk renamed this gist
Aug 10, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nafisk created this gist
Aug 10, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,82 @@ # Vim Commands List ## 1. Vim Motions - Vim motions consist of modes and commands that help developers navigate and edit code more efficiently. - Vim comes with three modes: - **Normal Mode**: Where you type all the Vim commands. - **Insert Mode**: Where you actually write code. - **Visual Mode**: Helps us visually select and manipulate text. - **Normal Visual Mode**: Works like selecting text with a mouse. - **Block Visual Mode**: Helps you select text as a block. ### Navigation Commands - `h`, `j`, `k`, `l`: Move left, down, up, right - `w`, `b`, `e`: Navigate forward word by word, backward word by word, jump to the end of a word - `0`, `^`, `$`: Jump to the beginning of the line, first non-empty character, end of the line - `f<character>`, `F<character>`: Jump to the next/previous occurrence of `<character>` on the line - `(`, `)`: Move one sentence up/down - `{`, `}`: Move one paragraph up/down - `Ctrl + d`, `Ctrl + u`: Move down/up half a page - `Ctrl + f`, `Ctrl + b`: Move down/up a full page - `gg`, `G`: Move to the top/bottom of the file ## 2. Vim Editor - `:w`: Save the current file - `:set number`, `:set nonumber`: Show/hide line numbers ### Insert Mode Commands - `i`, `a`: Insert text before/after the cursor - `I`, `A`: Insert text at the beginning/end of the line - `o`, `O`: Insert a new line below/above the current line - `c`, `s`: Change the current word or selected text / Replace the current character and enter insert mode ### Copy and Paste Commands - `y`, `p`: Yank (copy) selected text / Paste yanked text - `yy`: Yank the entire line - `yi{char}`, `ya{char}`: Yank text inside/including specified braces or quotes ### Undo and Redo Commands - `u`: Undo the last change - `Ctrl + r`: Redo the undone change ### Deletion Commands - `d`: Delete the current word, sentence, or paragraph - `dd`: Delete the current line - `dt<character>`: Delete up to a specific character - `dw`, `ds`, `dp`: Delete word / Delete sentence / Delete paragraph ### Search Commands - `/`: Search forward for a word - `?`: Search backward for a word - `n`, `N`: Jump to the next/previous search result - `*`, `#`: Search forward/backward for the word under the cursor ### Marks and Bookmarks - `m{a-z}`: Set a mark with a specific letter - `'{mark}`, `''`: Jump to the mark / Toggle between the last two positions - `'.`: Jump to the position of the last edit ### Special Commands - `.`: Repeat the last command - `:q`, `:wq`, `:qa`: Quit Vim / Save and quit Vim / Quit all files ## 3. Command Mode Commands - `:Explore`: Opens the file explorer within Vim to navigate and open files. - `:w`: Saves the current file. - `:q`: Quits Vim. Use `:q!` to quit without saving. - `:wq`: Saves the file and quits Vim. - `:e <filename>`: Opens the specified file in Vim. - `:vsp <filename>`: Opens the specified file in a vertical split. - `:sp <filename>`: Opens the specified file in a horizontal split. - `:tabnew <filename>`: Opens the specified file in a new tab. - `:bd`: Closes the current buffer (file). - `:set number`: Displays line numbers. - `:set relativenumber`: Displays relative line numbers. - `:set syntax=<syntax>`: Enables syntax highlighting for a specific language. - `:noh`: Clears search highlighting. - `:%s/<old>/<new>/g`: Replaces all occurrences of `<old>` with `<new>` in the file. - `:!<command>`: Runs an external shell command from within Vim. - `:help <command>`: Opens help documentation for the specified command.