Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Created February 16, 2012 09:37
Show Gist options
  • Save hokaccha/1843651 to your computer and use it in GitHub Desktop.
Save hokaccha/1843651 to your computer and use it in GitHub Desktop.
indent_toggle.vim
" タブの設定を切り替えのトグル
function! TabToggle()
fun! l:Set1()
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
endfun
fun! l:Set2()
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal noexpandtab
endfun
fun! l:Set3()
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal expandtab
endfun
if !exists('b:idx') || b:idx > 2
let b:idx = 0
endif
let b:idx = b:idx + 1
exe 'call l:Set'.b:idx.'()'
endfunction
nnoremap <silent> <C-k> :<C-u>call TabToggle()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment