sorts your dozens of imports in a .d-file
sortimport-d
can sort your dozens of import
’s in a .d
file (no matter where)
Get the repository with git
and compile everything with dub
$ git clone https://github.com/friedelschoen/importsort-d
$ cd importsort-d
$ dub build
If everything went fine, there should be a binary at bin/importsort-d
.
Copy this into a directory included in $PATH
(/usr/bin
for example) to make this command work globally.
$ sudo cp bin/importsort-d /usr/bin/
or add this into your .bashrc
, .zshrc
, etc.
export PATH=$PATH:"<path/to/importsort-d>/bin/" # on bash or zsh
fish_add_path "<path/to/importsort-d>/bin/" # on fish-shell
$ dub fetch importsort-d
$ dub run importsort-d -- --help
This won’t install the command globally, you always have to run dub run importsort-d <args>
see
$ importsort-d --help
$ dub run importsort-d -- --help
Look at the documentation at dpldocs.info
, if you want to use this project in code.
importsort-d
to Visual Studio Code?There’s a plugin called Run on Save. You can install it and set
importsort-d
as an onSave-hook:... "emeraldwalk.runonsave": { "commands": [ { "cmd": "importsort-d --inplace ${file}", "match": "\\.d$" } ] }, ...
importsort-d
to VIM/NeoVIM?Just add this to your
.vimrc
orinit.vim
:autocmd BufWritePost * silent !importsort-d --inplace <afile>
Yes
v0.2.0
)v0.3.0
);
)you got some ideas? Issue them!
v0.1.0
v0.2.0
--recursive
--keep
becomes disabling formatting--inline
don’t copy the original but creates a *.new
and renames it afterwards--original
becomes --binding
and sorts by original by defaultv0.3.0
--merge
v0.3.1
v0.3.2
--ignore-case
(pull-request #2)--force
(issue #5)import
in one line will be split up in multiple lines--inline
is renamed to --inplace
This whole project is licensed under the beautiful terms of the zlib-license
.
Further information here.
made with love and a lot of cat memes