Vim is very accommodating when it comes to tab Vs. space preferences. As I understand it, the tabstop
setting indicates the width of a tab character. The
This is my first attempt at writing VimScript, but here goes:
function! Stab(value)
let &shiftwidth = a:value
let &softtabstop = a:value
let &tabstop = a:value
endfunc
If I put this in my .vimrc file, I can call it by running :call Stab(X)
, where X is the desired tab width. This is an adequate solution for now, but if anyone can suggest a way of making it easier to call I would be grateful.
I've also created a function that quickly summarizes the current settings, which I have mapped to ctrl-Tab:
nmap :call TabParams()
function! TabParams()
echo "tabstop: ".&tabstop
echo "shiftwidth: ".&shiftwidth
echo "softtabstop: ".&softtabstop
endfunc
Well, I put up a 100 point bounty for this answer, and now I've half solved it myself. Not sure if I can accept my own answer...