From: Iain Patterson Date: Wed, 26 Feb 2014 10:54:38 +0000 (+0000) Subject: Set tab width with a function. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=f98ab7e017c3c0b9d536c429d8adf161b320bba7;p=profile.git Set tab width with a function. Use the new Tab_Width() function to set tabstop and shiftwidth rather than calling set for each. --- diff --git a/.vimrc b/.vimrc index f572ab2..6a03dd9 100644 --- a/.vimrc +++ b/.vimrc @@ -449,16 +449,21 @@ endfun "}}}2 call Mapping("-", "yyp:s/./-/g:let @/=''") call Mapping("=", "yyp:s/./=/g:let @/=''") +fun! Tab_Width(width) "{{{2 + exec "set sw=" . a:width + exec "set ts=" . a:width +endfun "}}}2 + " Set 2-column tabs with \2. -call Mapping("2", ":se ts=2:se sw=2") +call Mapping("2", ":call Tab_Width(2)") " Set 4-column tabs with \4. -call Mapping("4", ":se ts=4:se sw=4") +call Mapping("4", ":call Tab_Width(4)") " Set 8-column tabs with \8. -call Mapping("8", ":se ts=8:se sw=8") +call Mapping("8", ":call Tab_Width(8)") " Set 16-column tabs with \6. -call Mapping("6", ":se ts=16:se sw=16") +call Mapping("6", ":call Tab_Width(16)") " Set 32-column tabs with \3. -call Mapping("3", ":se ts=32:se sw=32") +call Mapping("3", ":call Tab_Width(32)") " Toggle paste mode with \p. call Mapping("p", ":se paste!") " Swap case-sensitivity with \c.