Search Flashcards
Go start of file
gg
Go to end of file
G
Show file info and current line number
Ctrl + g
Go to line
line number followed by G
Search command
/
Search for a phrase in reverse direction
?
Next search result
n
Previous search result
N
Return to start location
Ctrl + O
Find matching parentheses
%
Subsitute command syntax
s/old/new/g (This will subsitute new for old). The g flag will make the changes globally within the line.
Subsitute within a range of line
:#,#s/old/new/g
Subsitute within whole file
:%s/old/new/g
Subsitute within whole file and prompt to make change
:%s/old/new/gc
Find next character match in line
fx (subsitute x for whatever character you want go to the next instance of)
Change case when in Visual Mode
U (to capitalise) or u (to lowercase)
Copy whole line in visual mode
Y
Set highlight search results
:set hls
To remove highlights, :set nohlsearch
Set ignore case for search
:set ic
To remove ignore case, : set noic
Open help files
:help
Open specific help file
find the entry
Move the cursor to the tag |bugs|
Ctrl + ]