Skip to content

Instantly share code, notes, and snippets.

@markusfisch
Created May 8, 2014 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markusfisch/5ff8aa4670002ef0fc62 to your computer and use it in GitHub Desktop.
Save markusfisch/5ff8aa4670002ef0fc62 to your computer and use it in GitHub Desktop.
Put this in your .vimrc to easily switch between tabs (F5) and spaces (F6) and highlight improper indent
" Use Tabs
function! UseTabs()
" Highlight tabs within lines, trailing whitespace and
" spaces at the beginning of lines
match errorMsg /[^\t]\zs\t\+\|\s\+$\|^[\t]*[ ]\+[\t]*[^\*]/
set noexpandtab
endfunc
nnoremap <F5> :call UseTabs()<CR>
" Use Spaces
function! UseSpaces()
" Highlight tabs
match errorMsg /[\t]/
set expandtab
endfunc
nnoremap <F6> :call UseSpaces()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment