Skip to content

Commit

Permalink
Add Sort Lines Command
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Dec 9, 2022
1 parent fadb3ff commit 8833e10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ nnoremap U <C-r>
vnoremap v <Esc>gg0vG$
vnoremap V <Esc>ggVG
" Sort word(s) with <CTRL+LEFT> or <CTRL+RIGHT>
vnoremap <C-Left> d:execute 'normal i' . join(reverse(sort(split(getreg('"')))), ' ')<CR>
vnoremap <C-Right> d:execute 'normal i' . join(sort(split(getreg('"'))), ' ')<CR>
" Sort line(s) with <CTRL+DOWN> or <CTRL+UP>
vnoremap <C-Down> :sort<CR><Esc>
vnoremap <C-Up> :sort!<CR><Esc>
" Sort word(s) with <CTRL+LEFT> or <CTRL+RIGHT>
vnoremap <C-Left> d:execute 'normal i' . join(reverse(sort(split(getreg('"'), ' '))), ' ')<CR>
vnoremap <C-Right> d:execute 'normal i' . join(sort(split(getreg('"'), ' ')), ' ')<CR>
" === Begin <C> Key Maps ===

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ Keys | Function
<kbd>⌥</kbd> <kbd>↑</kbd> | Move line up.
<kbd>⌥</kbd> <kbd>↓</kbd> | Move line down.
<kbd>⎈</kbd> <kbd>←</kbd> | Sort-reverse words.
<kbd>⎈</kbd> <kbd>↑</kbd> | Sort-reverse lines.
<kbd>⎈</kbd> <kbd>→</kbd> | Sort words.
<kbd>⎈</kbd> <kbd>↓</kbd> | Sort lines.

### Visual-Line

Expand Down

0 comments on commit 8833e10

Please sign in to comment.