Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created September 20, 2005 · complexity basic · author Craig Emery · version 5.7
to show line numbers, your column alignment can be broken. However when you're in a window that supports it, the width of the window can be changed and as long as you've got enough screen real-estate to accommodate the extra columns your column alignment can be retained.
Add this to your vimrc file:
function! Toggle_num() if !exists("g:grow") let g:grow = 8 endif set number! if &number exec "set columns+=" . g:grow else exec "set columns-=" . g:grow endif endfunction map <M-n> :call Toggle_num()<CR>
So each time you use META-n, line numbers will be toggled and the appropriate number of columns will be added or removed from your vim window.
As of Vim 7.0, it's possible to change the line number column width using the numberwidth option. Of course, it doesn't really make sense now to always grow/shrink by 8 if numberwidth is set to, say, 4. So, an easy fix would be to change the line:
let g:grow = 8
let g:grow = &numberwidth