Skip to content

Instantly share code, notes, and snippets.

@tyleransom
Last active February 29, 2024 17:10
Show Gist options
  • Save tyleransom/c09b075042a3459c014550e9aa031226 to your computer and use it in GitHub Desktop.
Save tyleransom/c09b075042a3459c014550e9aa031226 to your computer and use it in GitHub Desktop.
Crosswalk between Notepad++ and Vim utilities

Crosswalk between Notepad++ and Vim utilities

Action Notepad++ shortcut Vim shortcut
Duplicate line Ctrl+D yyp
Cut line Ctrl+L dd
Move line up/down Ctrl+Shift+<up/down> dd<k/j>p
Compare files File compare plugin wizard :vsplit <filename> or vimdiff file1 file2 (from command line)
Select all (from here to top/bottom of file) Ctrl+Shift+<home/end> v<gg/G>
Select all (from here up/down one page) Ctrl+Shift+<PgUp/PgDn> v Ctrl+<U/D>
Code align on Ctrl+Shift+= (opens plugin wizard)
Repeat code align on Ctrl+= then shortcut key
Column edit mode Alt+Shift+<up/down> Ctrl+V then Shift+I
Find/Replace (+extended) Ctrl+H (opens GUI wizard) Regular expressions: e.g. :s/oldtext/newtext/gC
Find/Replace in selection [select text, Ctrl+H] here
Sort lines Access wizard from GUI Shift+V then :sort
Trim trailing/leading spaces Access wizard from GUI :%s/\s\+$//e (trailing) :%s/^\s\+//e (leading) [source]
TextFX Characters Access wizard from GUI gU[motion] (for UPPER), gu[motion] (for lower)
Merge lines Ctrl+J J
Save Ctrl+S :wq
Find Ctrl+F /

Other useful Vim commands: (in normal mode)

Action Vim shortcut
undo u
home ^
end $
superhome 0
page up/down Ctrl+<U/D>
delete x
backspace X
back one word/WORD b/B
forward one word/WORD w/W
insert i
append a
copy y [plus motion]
paste p
open (i.e. insert new line) o
change c
delete/cut d
replace R

Examples of motions (to be used with copy, paste, cut, etc.)

Action Vim shortcut
change next word cw
copy next word yw
copy from here to end of line y$
switch two letters xp
delete til dt<char>

Search mode commands

Action Vim shortcut
search forward /
search backward ?
find next f
next occurrence * or ; or n
previous occurrence # or , or N
find/replace in whole document %s/oldtext/newtext/g

Command mode commands

Action Vim shortcut
Reload file (discarding changes) :e!
Quit vim (discarding changes) :q!
Save file :w
Save & quit :wq
previous occurrence # or ,
find/replace in whole document %s/oldtext/newtext/g
execute shell command :!<command>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment