Skip to Content

Vim - The power of `g`

Posted on

Some interesting command with g

  • ggg?G will root13 whole file :v
  • ga display hex, ascii of character under the cursor
  • g8 display hex value of utf-8 character.
  • G=gg auto (re)indent entire document.


  • Use ! means do not match pattern
  • Cmd list:
    • d: Delete
    • m: Move
    • t: Copy
    • s: Replace


# Delete all line matching with pattern
# Delete all blank lines
# Move all line matching pattern to end of file
# Add text to end of line matching pattern
# Run a marco on matching lines
:g/pattern/normal @q

You can find more here

comments powered by Disqus