vim/autoload/do.vim

21 lines
463 B
VimL

" 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
" TODO: Make do#rstrip_lines work on a range
function! do#rstrip_lines()
let l:line = line('.')
let l:column = col('.')
execute '%s/\s\+$//e'
nohlsearch
call cursor(l:line, l:column)
endfunction