fisadev / vim-isort

Vim plugin to sort python imports using https://github.com/timothycrosley/isort
MIT License
219 stars 32 forks source link

Added isort_visual #3

Closed robhudson closed 10 years ago

robhudson commented 10 years ago

Added visual mode using Ctrl-i shortcut.

Not sure if this is useful or could be done differently but I found it useful to just sort certain imports based on visual selection.

fisadev commented 10 years ago

Great! very useful :) Do you want to make it configurable? (a default mapping, but ability to change it or disable it with a setting on the user's .vimrc). I can try to do it if you can't/don't want, no problem.

robhudson commented 10 years ago

I'm not sure how to make it configurable so I would appreciate your change (and learn from it). I also note that both methods are essentially the same and could probably be refactored to be the same with different ranges passed in (one for the whole file, one for the visually selected range). But I'm not familiar with the two different python call syntax used here.

fisadev commented 10 years ago

Ok! Merged as it is, and working on making it configurable. Thanks for the work, is very useful :)

fisadev commented 10 years ago

Done, and also a litle refactor to avoid code repetition.