makes it easier to execute esformatter inside vim.
it's better than executing a simple
normal mode because it avoids replacing the buffer content if the script
detected any errors, it restores the cursor position and sets the working
directory to match the file (which changes the way esformatter looks for config
it was inspired by nisaacson esformatter plugin.
You will need the esformatter binary available in your path to run the command
npm install -g esformatter
To format the whole file simple call
:Esformatter while on normal mode.
To format just one block of code select it on visual mode and execute
To make it easier you can create a mapping on your
.vimrc file like:
" will run esformatter after pressing <leader> followed by the 'e' and 's' keys nnoremap <silent> <leader>es :Esformatter<CR> vnoremap <silent> <leader>es :EsformatterVisual<CR>
released under the wtfpl license