Skip to content

Instantly share code, notes, and snippets.

@Sequoia
Created January 22, 2016 19:37
Show Gist options
  • Save Sequoia/2d7dfa4ecf6ad7de69c7 to your computer and use it in GitHub Desktop.
Save Sequoia/2d7dfa4ecf6ad7de69c7 to your computer and use it in GitHub Desktop.
switch between soft/hard 2/4 space tabs in vim
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