Created
January 22, 2016 19:37
-
-
Save Sequoia/2d7dfa4ecf6ad7de69c7 to your computer and use it in GitHub Desktop.
switch between soft/hard 2/4 space tabs in vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! SetSoftTab(n) | |
"for changing tabstops | |
let &l:shiftwidth=a:n | |
let &l:softtabstop=a:n | |
let &l:expandtab=1 | |
endfunction | |
function! SetHardTab() | |
let &l:expandtab=0 | |
let &l:shiftwidth=4 | |
endfunction | |
" maps to set tabstops quickly | |
nmap <leader>2 :call SetSoftTab(2)<CR> | |
nmap <leader>4 :call SetSoftTab(4)<CR> | |
nmap <leader>0 :call SetHardTab()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment