Last active
April 18, 2024 14:39
-
-
Save cipharius/6f5132bfbd447c1e89c33ab9583657ee to your computer and use it in GitHub Desktop.
Revisions
-
cipharius revised this gist
Jul 19, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ define-command sort-selections -params 0.. -override -docstring ' sort-selections: Sort current selections using GNU sort utility All parameters will be passed to the GNU sort utility ' %{ # Copy current selections to a temporary sort buffer execute-keys %{"sy} edit -scratch *sort-selections* execute-keys %{"s<a-p>} # Seperate selections with null characters execute-keys %{<a-!>printf '\000'<ret>ggd} # Sort the buffer # Use `head -c-1` to get rid of leading newline -
cipharius revised this gist
Jul 19, 2019 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ define-command sort-selections -params 0.. -override -docstring ' sort-selections: Sort current selections All parameters will be passed to the unix sort command ' %{ # Copy current selections to a temporary sort buffer execute-keys %{"sy} @@ -10,10 +11,11 @@ sort-selections: Sort current selections execute-keys %{<a-!>echo -ne '\x00'<ret>ggd} # Sort the buffer # Use `head -c-1` to get rid of leading newline execute-keys "%%|head -c-1|sort -z %arg{@}<ret>" # Yank the sorted candidates execute-keys %{%HS\x00<ret>"sy} # Update the original buffer delete-buffer -
cipharius created this gist
Jul 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ define-command sort-selections -docstring ' sort-selections: Sort current selections ' %{ # Copy current selections to a temporary sort buffer execute-keys %{"sy} edit -scratch *sort-selections* execute-keys %{"s<a-p>} # Seperate selections with null characters execute-keys %{<a-!>echo -ne '\x00'<ret>ggd} # Sort the buffer execute-keys %{%|sort -z<ret>ggd} # Yank the sorted candidates execute-keys %{%H<a-;>LS\x00<ret>"sy} # Update the original buffer delete-buffer execute-keys %{"sR} }