Plugin to sort imports in a JavaScript project for Vim/NeoVim
bharyang-vim depends on bharyang-cli.
Installation with vim-plug
vim-plug can install bharyang-cli as a post-install hook, and lazy load this plugin for JavaScript projects.
Plug 'squgeim/bharyang-vim', { 'do': 'npm install -g bharyang-cli', 'for': ['javascript'] }
For manual installations, install bharyang-cli
from npm
:
npm install -g bharyang-cli
Select the import lines in visual mode. Use any of the following commands:
Bharyang
BharyangAsc
BharyangDesc
BharyangGroup
The Bharyang
command uses a configuration value to determine default sort type. The value can be one of asc
, desc
or group
. For example, to set it to desc
:
let g:bharyang_default_sort_type="desc"
The code is quite straight forward, bharyang-cli does all of the heavy lifting. Pull requests are always welcome.