Skip to content

Instantly share code, notes, and snippets.

@uladkasach
Last active March 24, 2020 12:51
Show Gist options
  • Save uladkasach/00c99e6bb636b1fecbee81641cec24a7 to your computer and use it in GitHub Desktop.
Save uladkasach/00c99e6bb636b1fecbee81641cec24a7 to your computer and use it in GitHub Desktop.
favorite commands

searching

  • /${__regex__}, enter, n/shift-n => forward search
  • ?${__regex__}, enter, n/shift-n => backwards search

search and replace

  • :${__from__},${__to__}s/${__search_regex__}/${__replace_regex__}/gc
    • drop c for no confirmation
    • replace ${__from__},${__to__} w/ % for all lines

move screen w/o cursor

  • zz => to middle
  • zt => cursor to top
  • zb => cursor to bottom

move in line till char

  • f${char} => find char (F to reverse search)
  • t${char} => till char (T to reverse search)

add macro to add async to nearest non-async arrow function before cursor

  1. qa (start recording macro to bind to a),
  2. ?[^async] \(\) => { (reverse search for pattern),
  3. a (append -> insert mode),
  4. async (add async),
  5. q (stop macro),
  6. @a (use macro)

combinations: change till and in

  • ciw => change in word
  • ctw => change till word
  • ci( => change in ( - )

change surround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment