Elementary vim tricks

Embed Size (px)

Citation preview

  1. 1. Some cool vim tricks Ikuru K
  2. 2. References Web Rtfm read the fine manual
  3. 3. vim + Invoke this from the command line to open a file at the provided line number.
  4. 4. Vim +/ Open a file at the first occurrence of the provided pattern.
  5. 5. Multi line insert - 1 Starting with a file with multiple rows like this
  6. 6. Multi line insert - 2 Highlight selections with visual block mode (Ctrl + v)
  7. 7. Multiple line insert - 3 Once desired lines are selected, (Shift + i ) to insert desired characters. Note that 'i' alone will not do.
  8. 8. Multiple line edit - 4 Hit Esc, and typed characters will be inserted across multiple rows.
  9. 9. Nice things to have in .vimrc :set nu Shows line numbers to the left. syntax on Will highlight lexical elements intelligently, if vim can make sense of the language.
  10. 10. 'Buffer' concept Files in the workspace ':badd ' adds a new file to workspace 'b ' lets you move around the buffers.
  11. 11. Vertical Window
  12. 12. :vert sb[Next/Previous] Sb* command will open a file in the buffer by splitting the current window. vert command forces the split occur vertically. Switch the focus with Ctrl+w
  13. 13. Running external commands ! After showing results, will re-open the file that was being edited.
  14. 14. Thank you