Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Vim
Efficiency in text editing
Camille TJHOA - ESIPE MLV
Summary
Vi IMproved
- Quick overview
- Vim bases
- Speak vim
- Advanced usage
Vim
Vi IMproved written by Bram Moolenaar,
- Open source
- Based on Vi
- Vim is not Vi
Advantages
X independant
- Command Line
- GUI gVim
- SSH
- Standard
1st approach
OMG I’m gonna die
- Too much shortcuts
- I don’t understand
- Go to nano, gedit, etc
Learning vim
Difficult
- Hard learning curve
- Little steps
- Huge benefits
Inefficiency
Judge yourself
- Detect your inefficiency
- Find a quicker way
- Make it a habit
Inefficiency
Judge yourself
- Use your tools: emacs (evil) or other
- Think when you’re typing
- "Everything you can do, I can do faster in Vim"
Modal editing
Bases
- Normal <ESC> default
- Command line <:>, </>, <?>,
- Insert <i> (insert) <a> (append) <s> (substitute)
- Visual <v>
- ...
Commands
Bases
- Edit :e <filename>
- Quit :q
- Save :w
- Quit without saving :q!
Move around
Bases
- Arrows or <h>, <j>, <k>, <l>
- Word by word <w>
- Begin/end of a word <b>, <e>
- Go to matching bracket <%>
Move by line
Bases
- Begin/end of a line <^>, <$> (regexp)
- Jump to line <:><number>
- Begining of the file <g><g>
- End of the file <G>
Vim sentence
Speak Vim
Verb → Modifier → Noun (Text object, ...)
Verb: c (change)
Modifier: i (inside)
Noun: w (word)
In normal mode
Verbs
Speak Vim
- Delete <d>
- Change <c>
- Yank/copy <y>
- Paste after the cursor <p>
- Visual <v>
Modifiers
Speak Vim
- Inside <i>
- Around <a>
- Find <f><letter>
- Till/until <t><letter>
Text objects
Speak Vim
- Word <w>
- Sentence <s>
- Paragraph <p>
- Block / parentheses <b>
- Tags (eg xml/html) <t>
Quizz
Speak Vim
- Delete till the end of line ??????
- Change in () ?????????
- Delete current line + the next line ??????????
Quizz
Speak Vim
- Delete till the end of line <d><$>
- Change in () <c><i><(>
- Delete current line + the next line <d><j>
Historic
Like a boss
- Undo <u>
- Redo <Ctrl> <r>
- Repeat the same action <.>
Search
Like a boss
- Search </>
- Reverse search <?>
- Search word under cursor <*>
For all : <n> next, <N> previous, <ESC> escape
Actions on lines
Like a boss
- Delete <d><d>
- Change ??????
- Yank/copy ??????
Actions on lines
Like a boss
- Delete <d><d>
- Change <c><c>
- Yank/copy <y><y>
Actions on lines
Like a boss
- Open a line after the current line <o>
- Format <=><=>
Case sensitive
Like a boss
- Open a line before the current line <O>
- Paste before cursor <P>
- Insert at the begining of a line <I>
- Insert at the end of a line <A>
Alternate visual modes
Like a boss
- Visual line <V>
- Visual block <Ctrl><v>
Split
Like a boss
- Horizontal split :split :sp
- Vertical split :vsplit :vsp
- Change current window <Ctrl><w>
Autocompletion
Like a boss
- Basic <Ctrl><n>
- Advanced <Ctrl><x><Ctrl><KEY>
Follow a file
Like a boss
Conclusion
- Difficult to learn ...
- ... but not so hard if you understand vim logic
- Daily use
Questions ??