Justin's Vim Tips

I’m jotting down useful Vim tips so I can remember them:

How to format commit message to break at 80 chars?

  1. Select the text to format
  2. gq

And set the line width if needed.

:set textwidth=80

How to turn off line numbers to copy-paste to another editor, like Grammarly

:set nonumber

And :set number to turn back on.


How to get line wrapping in IdeaVim

Per Bug VIM-186

There’s a useful workaround to this issue using the Wrap to Column plugin and then adding these lines to ~/.ideavimrc to use the plugin for gq:

nmap gqq :action com.andrewbrookins.idea.wrap.WrapAction<CR>
vmap gq :action com.andrewbrookins.idea.wrap.WrapAction<CR>