Skip to content

Vim

Autoformat xml

:'<,'>!xmllint --format -

Get back selection after indentation

gv
Get this feature forever
vnoremap < <gv
vnoremap > >gv

Run command in shell

:!<command>
:!    # Run the last external command
:!!   # Repeats last command
:silent !<command> # Eliminates the need to hit enter after the command is done
:r !<command>      # Puts the output of <command> into the current buffer

Replace words with yanked text

First way

yiw
# Move to new word
viwp
viw"0p  # Redo

Second way

yiw
# Move to new word
ciw[CTRL-R]0[Esc]
.   # Redo

Delete all lines containing word

:g/<word>/d