From 981cb46c7c365db88b9861a6972cc96d60d88c1b Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 20 Sep 2017 12:00:00 -0500 Subject: [PATCH] Add :ISort vim command --- autoload/do.vim | 11 +++++++++++ plugin/commands.vim | 1 + 2 files changed, 12 insertions(+) create mode 100644 autoload/do.vim create mode 100644 plugin/commands.vim diff --git a/autoload/do.vim b/autoload/do.vim new file mode 100644 index 0000000..0c78d93 --- /dev/null +++ b/autoload/do.vim @@ -0,0 +1,11 @@ +" Save, call isort on, then reload a python file. +function! do#isort() + if &filetype !=# 'python' + echohl ErrorMsg + echomsg 'isort only supports python files' + echohl None + endif + write! + call system('isort '.expand('%:p')) + edit! +endfunction diff --git a/plugin/commands.vim b/plugin/commands.vim new file mode 100644 index 0000000..c1e034f --- /dev/null +++ b/plugin/commands.vim @@ -0,0 +1 @@ +command! ISort call do#isort()