This page intentionally left blank.
VI
everywhereWhat's your super power
VI
via readlinemore like it!
VI
an editor
VI
is called VI? ex
short for EX
tended
ex
is a line editor
VI
= VI
sualshortest unambigous abbreviation
VIM
= V
i IM
proved:q # quit vi :wq # write file and quit :q! # quit vi not save :x # write and quit
VI
vi # open vi editor i # insert mode # enter text ESC # normal mode # special commands h j k l # ⬅ ⬇ ⬆ ➡ : # ex mode - command mode / # search n # next match :s/// # substitute :q! # quit without saving
Vi
where there is readlineVi
in the editorVi
on the command linevi
on command lineset -o vi ESC # normal mode / # search cw # change word u . # undo and redo ^ $ # beginning and end w W # word and whitespace word b B # back a word y # yank (copy) to end p # paste ct<char> # cut to character
set -o emacs # get me out of here
Emacs
set -o | egrep 'vi |emacs' emacs on vi off
emacs shortcuts
CTRL A # beginning of line CTRL E # end of line CTRL R # reverse search
super power
?"2. That having no choice but to use
vi
early in my career would mean that I can never leave those keybindings behind."
@anaulin https://anaulin.org/blog/things-nobody-told-me-about-being-a-software-engineer/
if you repeat an action enough
it will become automatic
therefore effortless
come up with a drill
set -o vi python -c 'print("hello")' <ESC> k $ b i Python <RETURN> set -o emacs
PRACTICE, PRACTICE, PRACTICE
EVERYWHERE!
not just readline and command line!
# psql cat >> ~/.inputrc set editing-mode vi # mysql cat >> ~/.editrc bind -v
Vi
anywhere there is ReadLinevi shortcuts?
touch typing?
problem solving with TDD?
new language or framework?
PRACTICE, PRACTICE, PRACTICE
set -o vi # get into vi mode set -o emacs # get me out of here ESC # go into "normal mode" / # search for a term **Navigation** h j k l # ⬅ ⬆ ⬇ ➡ gg # top G # bottom ^ # begninning of line (~ regex) $ # end of line (~ regex) **Insert mode** a A # append after cursor/end of line i I # insert before cursor/beginning of line
**Editing** . # redo u # undo cw # change a word x X # delete character/previous character w b # move word forward / backward w4 b4 # move 4 words forward / backward W B # move whitespace word forward / backward ct <CHAR> # change to '.' character yw # yank (copy) word y4w # yank 4 words v # open vi editor
VI
bindings?node
iex
mongodb
brew install rlwrap rlwrap --always-readline node rlwrap --always-readline iex rlwrap --always-readline mongodb