Skip to content

Commit

Permalink
vim: sort operator
Browse files Browse the repository at this point in the history
  • Loading branch information
benknoble committed Sep 19, 2019
1 parent ecabacd commit 7b2d610
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions links/vim/autoload/sort.vim
@@ -0,0 +1,11 @@
function! sort#operator(type, ...) abort

let l:visual = a:0

if l:visual
'<,'>sort
else
'[,']sort
endif

endfunction
7 changes: 7 additions & 0 deletions links/vim/plugin/sort_op.vim
@@ -0,0 +1,7 @@
if exists('g:loaded_sort_op')
finish
endif
let g:loaded_sort_op = 1

nnoremap <silent> gs :set operatorfunc=sort#operator<CR>g@
vnoremap <silent> gs :<C-u>call sort#operator(visualmode(), 1)<CR>

0 comments on commit 7b2d610

Please sign in to comment.