Last active
April 13, 2020 16:55
-
-
Save paradigm/14aa693d0e17c33b29f736df6a309f28 to your computer and use it in GitHub Desktop.
This file contains 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 characters
# use vim ex commands in a UNIX pipe | |
# e.g.: | |
# $ printf "foo\nbar\nbaz\n" | vp 'g/^b/d' | |
# foo | |
# | |
vp() { | |
vim - -u NONE -es '+1' "+$*" '+%print' '+:qa!' | tail -n +2 | |
} | |
# use vim normal mode commands in a UNIX pipe | |
# e.g.: | |
# $ printf "foo\nbar\nbaz\n" | vn 'dd' | |
# bar | |
# baz | |
# | |
vn() { | |
vim - -u NONE -es '+1' "+normal $*" '+%print' '+:qa!' | tail -n +2 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment