Skip to content

Instantly share code, notes, and snippets.

@yevhenpavliuk
Last active April 3, 2016 10:02
Show Gist options
  • Save yevhenpavliuk/a25d66d30fede4c72e90ed57d9547b4a to your computer and use it in GitHub Desktop.
Save yevhenpavliuk/a25d66d30fede4c72e90ed57d9547b4a to your computer and use it in GitHub Desktop.
ex-command-script
.KS
.IP "TTY_ARGV" 2n
The command, specified as an argument vector, that the TTY subwindow executes.
.KE
.KS
.IP "ICON_IMAGE" 2n
Sets or gets the remote image for icon's image.
.KE
.KS
.IP "XV_LABEL" 2n
Specifies a frame's header or an icon's label.
.KE
.KS
.IP "SERVER_SYNC" 2n
Synchronizes with the server once.
Does not set synchronous mode.
.KE
ex -S sort-ks-ke-blocks.vim ks-ke-blocks.txt
# ex - ks-ke-blocks.txt <sort-ks-ke-blocks.vim
# Doesn't work for me (I've tried only in Terminal on Mac OS X).
# I think it's because terminal removes control characters.
" Add escapes at the end of each line (except the last) in KS-KE blocks.
global /^\.KS/,/^\.KE/-1 s/$/
" global /^\.KS/,/^\.KE/-1 s/$/^[
" Join lines in KS-KE blocks.
global /^\.KS/,/^\.KE/ join
% !sort
" Split lines joined by escape in KS-KE blocks.
% s/ /
/g
" % s/^[ /^M/g
write
quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment