When I start up Vim, my .vimrc instructs the :nowrap mode. I hate the wrap while coding, as it ruins indentation and supports the coding style, where single lines get too long, too complex and less readable/concise.
However, while editing files like HTML, wrap mode is helpful, specially where there is lots of text content. It allows for faster line navigation (gj, gk...), and having long lines doesn't really matter.
So I'd like Vim set the :wrap setting based on current filetype. I tried:
autocmd FileType html,eruby,erb set wrap
However, once .html file is opened, this affects all open buffers. I would like this to affect just .html containing buffers.
Any ideas?
If you look at the help page for 'wrap', you'll see that it applies to windows instead of buffers:
*'wrap'* *'nowrap'*
'wrap' boolean (default on)
local to window
{not in Vi}
This means that you have 3 options:
BufEnter that reapplies wrap whenever you switch buffersnnoremap <F2> :set invwrapIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With