Last Updated: February 25, 2016
· gahtune

add a "All" operator to vim

if you want to apply a command to everything you usualy type gg<command>G like for example ggyG to copy all.

I introduce, in one line for your vimrc, an operator to say "apply on all"

onoremap A :<C-u>normal! ggVG<CR>


  • onoremap declare an operator
  • assign it to A
  • select everything


You can use it like for example yA to yank all, =A indent all, dA delete all...

In Visual mode

I don't understand why this operator does not work with visual mode (does not work as expected with vA or VA). Then add this second line:

vnoremap A `<gg`>G

and vA select almost everything and VA select all ;)