VIM⚓︎
A collection of VIM notes beyond the basics.
Changing Surrounding Tags/Quotes⚓︎
To change surrounding quotes or tags (requires vim-surround plugin or similar)
| Command | Action | Before | After |
|---|---|---|---|
cs"' |
Change surrounding " to ' | "hello world" |
'hello world' |
cs'" |
Change surrounding ' to " | 'hello world' |
"hello world" |
cs({ |
Change surrounding () to {} | (hello world) |
{ hello world } |
cs(} |
Change surrounding () to {} (no space) | (hello world) |
{hello world} |
ds" |
Delete surrounding " | "hello world" |
hello world |
ds' |
Delete surrounding ' | 'hello world' |
hello world |
ysiw" |
Add " around current word | hello |
"hello" |
ysiw' |
Add ' around current word | hello |
'hello' |
Text Objects⚓︎
| Command | Action | Scope | Before | After (typed NEW) |
|---|---|---|---|---|
ci" |
Change | Inside "" | "LOGFILE_DIR" |
"NEW" |
ca" |
Change | Around "" | "LOGFILE_DIR" |
NEW |
ci' |
Change | Inside '' | 'LOGFILE_DIR' |
'NEW' |
ca' |
Change | Around '' | 'LOGFILE_DIR' |
NEW |
ci{ |
Change | Inside {} | ${LOGFILE_DIR} |
${NEW} |
ca{ |
Change | Around {} | ${LOGFILE_DIR} |
NEW |
ciw |
Change | Inside word | LOGFILE_DIR |
NEW |
di" |
Delete | Inside "" | "LOGFILE_DIR" |
"" |
da" |
Delete | Around "" | "LOGFILE_DIR" |
(empty) |
di{ |
Delete | Inside {} | ${LOGFILE_DIR} |
${} |
da{ |
Delete | Around {} | ${LOGFILE_DIR} |
(empty) |
yi" |
Yank | Inside "" | "LOGFILE_DIR" |
(yanks LOGFILE_DIR) |
ya" |
Yank | Around "" | "LOGFILE_DIR" |
(yanks "LOGFILE_DIR") |