How do I diff two files that are already open in Vim splits?
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
161 results for "paste"
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
:let @q = "dwelp"
Recording macros with q works well for simple sequences, but complex macros with special keys can be hard to get right in one take.
:let @a = "value"
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
<C-r>/
Vim stores your last search pattern in the / register.
<C-w>N
When using Vim's built-in :terminal, the buffer is in Terminal-Job mode by default, meaning all keystrokes go to the running shell.
:m +1
The :move command (abbreviated :m) relocates lines to a new position in the buffer without touching any registers.
"=
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.
qQ...q
When you record a macro into register q with qq.
:call setreg('a', @a . 'text', 'l')
How it works Vim provides two functions for advanced register manipulation: setreg() and getreg().
:t.
The :t (short for :copy) command copies lines from one location to another.
<C-o> (in insert mode)
Pressing while in insert mode drops you into a special "insert-normal" mode where you can execute exactly one normal mode command, then immediately return to in
:put ={expression}
The :put command inserts the contents of a register as a new line below the cursor.
<C-r>=
The expression register (=) lets you evaluate Vimscript expressions on the fly and insert the result directly into your text.
registers #editing #insert-mode #registers #productivity #math
<C-r><C-a>
When you are in command-line mode, inserts the word under the cursor (alphanumeric and _ only).
'[ and ']
Vim automatically sets two marks whenever you yank, change, delete, or paste text: ` [ ` (backtick-bracket) marks the start of the affected region, and ] ` mark
:let @q='commands'
Macros in Vim are stored in registers as plain text.
:let @q = '{keystrokes}'
You can assign a string directly to any register using :let @{reg} = '.
yiw
How it works The command yiw yanks (copies) the inner word under the cursor.
<C-r>{register}
Pressing followed by a register name in insert mode inserts the contents of that register at the cursor position without leaving insert mode.