Skip to content

Instantly share code, notes, and snippets.

@uladkasach
Last active March 24, 2020 12:51

Revisions

  1. uladkasach revised this gist Mar 24, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vims.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ add macro to add async to nearest non-async arrow function before cursor
    combinations: change till and in
    - `ciw` => change in word
    - `ctw` => change till word
    - `ci(` => change in `(` - `)`

    change surround
    - `cs'"` => change surround from ' to " (https://github.com/tpope/vim-surround)
  2. uladkasach revised this gist Mar 24, 2020. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion vims.md
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,11 @@ add macro to add async to nearest non-async arrow function before cursor
    3. `a` (append -> insert mode),
    4. `async` (add async),
    5. `q` (stop macro),
    6. `@a` (use macro)
    6. `@a` (use macro)

    combinations: change till and in
    - `ciw` => change in word
    - `ctw` => change till word

    change surround
    - `cs'"` => change surround from ' to " (https://github.com/tpope/vim-surround)
  3. uladkasach revised this gist Mar 24, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vims.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ move in line till char

    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),
    2. `?[^async] \(\) => {` (reverse search for pattern),
    3. `a` (append -> insert mode),
    4. `async` (add async),
    5. `q` (stop macro),
  4. uladkasach revised this gist Mar 24, 2020. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions vims.md
    Original file line number Diff line number Diff line change
    @@ -8,13 +8,13 @@ search and replace
    - replace `${__from__},${__to__`} w/ `%` for all lines

    move screen w/o cursor
    `zz` => to middle
    `zt` => cursor to top
    `zb` => cursor to bottom
    - `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)
    - `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),
  5. uladkasach revised this gist Mar 24, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions vims.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    ## searching
    `/${__regex__}`, enter, n/shift-n => forward search
    `?${__regex__}`, enter, n/shift-n => backwards search
    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`
    - `:${__from__},${__to__}s/${__search_regex__}/${__replace_regex__}/gc`
    - drop c for no confirmation
    - replace `${__from__},${__to__`} w/ `%` for all lines

  6. uladkasach revised this gist Mar 24, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vims.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    searching
    ## searching
    `/${__regex__}`, enter, n/shift-n => forward search
    `?${__regex__}`, enter, n/shift-n => backwards search

  7. uladkasach created this gist Mar 24, 2020.
    25 changes: 25 additions & 0 deletions vims.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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)