Skip to content

Instantly share code, notes, and snippets.

@JesseBilsten
Created July 15, 2014 17:16
Show Gist options
  • Select an option

  • Save JesseBilsten/283c5fac5a14a37e7eba to your computer and use it in GitHub Desktop.

Select an option

Save JesseBilsten/283c5fac5a14a37e7eba to your computer and use it in GitHub Desktop.
" Remove trailing whitespace on save
" http://stackoverflow.com/questions/356126/how-can-you-automatically-remove-trailing-whitespace-in-vim
function! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfunction
"autocmd FileType c,cpp,java,php,ruby,python,sass,css,less,scss autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
" Take one line of all HTML and add <cr>'s and indent
" http://stackoverflow.com/questions/9987743/format-and-indent-html-in-vim
function! <SID>FormatHTML()
s/<[^>]*>/\r&\r/g
g/^$/d
gg=G
endfunction
map <Leader>html :s/<[^>]*>/\r&\r/g<cr>:g/^$/d<cr>gg=G
" Powerline status bar
set rtp+=~/.janus/vim-powerline/powerline/bindings/vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment