Created
May 10, 2014 01:09
-
-
Save kurrik/934f06673dcf34ee9ae7 to your computer and use it in GitHub Desktop.
Set up :Fmt command to autoformat JavaScript files in Vim
This file contains 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
" JavaScript formatting. | |
" Install https://github.com/rdio/jsfmt - npm install -g jsfmt | |
function! Jsformat() | |
let regel=line(".") | |
%!jsfmt --format=true | |
call cursor(regel, 1) | |
endfunction | |
autocmd BufRead,BufNewFile *.js setfiletype javascript | |
autocmd Filetype javascript command! Fmt call Jsformat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment