normal·mode
~ / ex
10

Ex Commands

The command line: ranges, :t and :m, :normal across lines, :substitute, :global and repeating the last command.

  1. 01

    Line ranges: :d, :j and friends

    Put a range in front of an Ex command to work on lines without moving to them.

    :{N}:{N},{M}d:.,$d:.,+{N}d:{N},{M}j:{N},{M}j!:'<,'>:%
  2. 02

    Copy and move lines: :t and :m

    Duplicate or move whole lines to any address with one command.

    :t.:{N}t.:t$:t0:m0:m$:m+1:m-2
  3. 03

    Normal mode on many lines: :normal

    Type the same Normal-mode keys on every line of a range.

    :%normal {keys}:'<,'>normal {keys}:{range}normal .
  4. 04

    Substitute: :s, ranges and flags

    Replace text on a line, in a range or everywhere, with & for the whole match.

    :s/{old}/{new}/:s/{old}/{new}/g:%s/{old}/{new}/g:'<,'>s/{old}/{new}/&\&nvim
  5. 05

    Matching lines: :g, :v and :sort

    Run a command on every line that matches (or doesn't), and sort lines.

    :g/{pattern}/d:v/{pattern}/d:g/^/m0:g/{pattern}/t$:sort:sort u:sort n:sort!
  6. 06

    Repeat the last Ex command: @: and @@

    Run the previous command line again, here or anywhere else.

    @:{count}@:@@
  7. 07

    Grab the word under the cursor: <C-r><C-w>

    Insert the word (or WORD) under the cursor into the command line.

    <C-r><C-w><C-r><C-a><C-r><C-l><C-r>{register}nvim
outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim