VIM: The Awesome Part Jack Rosenthal

September 8, 2016

Jack Rosenthal

VIM: The Awesome Part

Generalizing our Keystrokes I Most beginners at VIM see the keystrokes we type statically, i.e. they see the only keystrokes we make are the ones we remember the keystrokes for. Keys remembered dd cw dw yy .. .

What it does Delete line Change word Delete word Yank line .. .

This is tedious, and incredibly hard to remember. Chances are, if you remember VIM this way, then you will hate it.

Jack Rosenthal

VIM: The Awesome Part

Generalizing our Keystrokes II Let’s divide our NORMAL mode keystrokes as two types1 : actions and movements. Movements alone will move your cursor. Actions do things, and often take movements to act on. Repeating an action keystroke for its movement will act on the movement of the line When using one of the VISUAL modes, the m parameter to actions are dropped, and actions apply to the selection Action dm ym cm g~m .. . 1

delete m yank m change m swap case on m .. .

Movement h j k l b w ^ $ gg G .. .

left, down, up, right word left, right beginning, end of line beginning, end of file .. .

not all keystrokes fall under these two categories Jack Rosenthal

VIM: The Awesome Part

Repeating NORMAL Mode Commands

Adding a number n in front of a movement will do it n times. Examples: d5w – delete the next 5 words 5j – move 5 lines down c2j – change this line, and the next two You can also use the . key to repeat a command again. For example, change a word, then move 5 words over, press . to make the same substitution again.

Jack Rosenthal

VIM: The Awesome Part

find and till

fc will be the motion on to the next occurrence of the c character on the current line tc does the same, but goes right before c rather than on Fc and Tc do the same, but go backwards on the line Examples: fs – move to the next occurrence of s on the line ct. – change till . dTA – delete backwards until just before A

Jack Rosenthal

VIM: The Awesome Part

inside and around VIM has special movements that only act with actions called inside and around. They take a parameter of what to go inside or around. It works a bit like this: Inside

Around

i" i' – inside a string

a" a' – around a string

i) i} i] – inside parens, squirly braces, brackets

a) a} a] – around parens, squirly braces, brackets

iw is ip – inside a word, sentence, paragraph

aw as ap – around a word, sentence, paragraph

For example: ci" – change inside the string you are on vip – select the current paragraph dis – delete the current sentence Jack Rosenthal

VIM: The Awesome Part

The promised ROT13 encoding action

g?m

Jack Rosenthal

VIM: The Awesome Part

Taking Advantage of Deletion

d, x will put what was deleted into the paste register. This means you can swap things really easily: xp – swap characters ddp – swap lines and so fourth…

Jack Rosenthal

VIM: The Awesome Part

Some Ex mode stuff: :g/

:g/regex/cmd will run the Ex mode command cmd on every line that matches regex For example, to delete all blank lines, do :g/^$/d Because the order on which :g/ acts, you can use it to flip all the lines in a file using :g/^/m0

Jack Rosenthal

VIM: The Awesome Part

Getting some command output in your buffer

:! followed by some shell command will run that command using your shell from vim. :rcmd will redirect some Ex mode command to the buffer We can combine them to redirect shell commands to our buffer. For example :r!fortune | cowsay

Jack Rosenthal

VIM: The Awesome Part

VIM Plugins

VIM plugins are awesome, they let you alter VIM to nicely fit your work flow There are crap tons of VIM plugins You can turn VIM into a full fledged IDE with plugins I invite you to do a web search to find the ones you like best!

Jack Rosenthal

VIM: The Awesome Part

VIM: The Awesome Part - GitHub

Page 1 ... d, x will put what was deleted into the paste register. This means you can swap things ... I invite you to do a web search to find the ones you like best!

99KB Sizes 3 Downloads 265 Views

Recommend Documents

VIM: The Basic Part - GitHub
Why use vim? • Because it's the best plaintext editor available! .... copy/pasting, saving, etc... • This is where you begin when you open a vim window. • To return ...

Epic Vim Tutorial - GitHub
Jan 19, 2012 - Move back to the start of the first email address in the file. 7. Press Ctrl+v to enter visual block mode. 8. Using the arrow keys, select all email ...

Part 1 - GitHub
Apr 27, 2014 - Developing scalable applications with IBM MQ Light and ... Improving the sample application by separating the web-facing component from the.

Exercises part 1 - GitHub
This R Markdown document contains exercises to accompany the course “Data analysis and visualization using R”. This document contains the exercises ...

Hacking Vim
This has lead to him now owning the web-hosting company Devteam ... James Eaton-Lee works as a Consultant specializing in Infrastructure Security and.

Durgasoft SCJP Notes Part-1 - GitHub
Durgasoft SCJP Notes. Part-1 http://javabynataraj.blogspot.com 1 of 255. Page 2. http://javabynataraj.blogspot.com 2 of 255.

vi / vim graphical cheat sheet
F "back" fwd. G eof/ goto ln Hscreen top. J join lines. K help. L screen bottom ... version at http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html.

Frtvz) R vim
Nov 23, 2015 - There will be a short meeting of Secondary School Science Department Heads,. President and Vice President of Secondary Science Teachers Club and Public Elementary. School Cluster Science Key Teachers at 3:00 — 5:00 PM on November 24,

Durgasoft SCJP Notes Part-2 - GitHub
Durgasoft SCJP Notes. Part-2 http://javabynataraj.blogspot.com 1 of 401. Page 2. http://javabynataraj.blogspot.com 2 of 401. Page 3 ...

practical vim pdf download
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. practical vim pdf ...

Queens Community District 14 Basemap - Part 1 - GitHub
UNNAMED ST. QUENTIN ST. PEMBROKE ST. MARSHALL RD. AVIATION RD. MARINE PKWY BRIDGE. UNNAMED ST. UNNAMEDST. SHO. REPKWY. BAYSIDEAV. BEACH 147 ST. BEACH 193 ST. RANGE RD. SEA BREEZEAV. EMMO. NS AV. BERGEN AV. HILLSIDEAV. AV WAV W. KINGS HIGHWAY. BEACH 1

What part of List do you not understand? - GitHub
scala.Equals. • private AbstractXXX hierarchy. • redundant inheritance paths. - linearization. Comments and Corrections: @tpolecat (Twitter and #scala)

Part-of-Speech Driven Cross-Lingual Pronoun Prediction with ... - GitHub
Most modern statistical machine translation ... of using discourse analysis for pronoun translation .... The best performing classes are ce, ils ..... Giza++ software.

Amazon part # price qty desc B00UTIFCVA 17.33 2 ... - GitHub
Amazon part # price qty desc. B00UTIFCVA. 17.33. 2. Signswise 600p/r Incremental Rotary Encoder Dc5-24v Wide Voltage Power Supply 6mm Shaft.

[PDF] The Awesome Foursome: The Essential ...
Master of Science in Health from Herbert H. Lehman College in 1970. In 1968, he ... scientist's schemes - they often don't work due to sheer implausibility.

Dear Awesome Person - Ethix Ventures
Oct 25, 2011 - promote Transfair/Fair Trade USA products. We hereby pull our support .... to bite the hand that feeds it. This is well recognized in accounting,.