" define a function for cycling the tabstops from 2 -> 4 -> 8 -> 2 set ts=4 sw=4 function Toggle_Tab_Width() if &ts == 2 set ts=4 sw=4 elseif &ts == 4 set ts=8 sw=8 else set ts=2 sw=2 endif endfunction " call the funciton via the ex style command ':TG' command TG call Toggle_Tab_Width() " set up Function-Key-1 to run the function. normally " invokes help, but you can still get to that via :help. unmap map :TG^M " Allow this to work in insert mode too. unmap! map! :TG^Mli