Skip to content

Keystrokes for example gifs

Antoine edited this page Jul 24, 2018 · 6 revisions

Example 1

Example 1 GIF

  • jump to p with fp
  • select the word under cursor with <C-n>
  • do that two more times for the other two occurrences in the function
  • press c to change
  • type the replacement
  • press <Esc> to quit back to regular Vim

Example 2

Example 2 GIF

  • select the line with V
  • go to the end of the file with G
  • press <C-n> to add a cursor at the beginning of every line and move to normal mode
  • press I to insert at the beginning of the line
  • type ", move to end of line with <End>, type another " followed by ,
  • move every cursor down one line with <Down>
  • move to beginning of line with <Home>, then hit <BS>, now all the words are on the same line
  • the rest is just normal Vim

Example 3

Example 3 GIF

  • press dt" to delete everything until the first quote
  • press L to go to end of line (my custom mapping, default $)
  • press r, to replace the ] with ,
  • go back to the beginning of the line with H (custom, default ^), press f, to find the first comma
  • press v to select , in visual mode, and mash on <C-n> until the last occurrence
  • press c followed by <CR> to break the line into multiple lines
  • move every cursor up one line with <C-k> (again my custom mapping)
  • delete the left quote with C-g<BS> (custom mapping to move cursor in insert mode)
  • go to end of line and delete right quote with C-e<BS>

Example 4

Example 4 GIF

  • press jV to visually select the second line
  • press Gk to select all but the last line
  • type : followed by the MultipleCursorsFind command
  • press o to toggle the cursor for each visual selection
  • press p to paste the content of the + register (I have clipboard=unnamedplus in my vimrc) to each virtual cursor
Clone this wiki locally