" Don't assume a number with a leading zero is octal; it's far more likely a " zero-padded decimal, so increment and decrement with ^A and ^X on that basis set nrformats-=octal " Try to set the 'j' flag for 'formatoptions', to automatically delete comment " leaders when joining lines silent! set formatoptions+=j " Show the current formatoptions at a glance nnoremap \ f \ :setlocal formatoptions? " Use toggle_option_flag.vim plugin to bind quick toggle actions for some " 'formatoptions' flags if has('user_commands') " a: Reformat paragraphs to 'textwidth' on all insert or delete operations nnoremap \ a \ :ToggleOptionFlagLocal formatoptions a " c: Reformat comments to 'textwidth' nnoremap \ c \ :ToggleOptionFlagLocal formatoptions c " j: Delete comment leaders when joining lines nnoremap \ j \ :ToggleOptionFlagLocal formatoptions j " t: Reformat non-comment text to 'textwidth' nnoremap \ t \ :ToggleOptionFlagLocal formatoptions t endif