How do I force a case-sensitive or case-insensitive search for just one pattern without changing my settings?
\C
Vim's \C and \c atoms let you override ignorecase and smartcase on a per-pattern basis.
396 results for "it at"
\C
Vim's \C and \c atoms let you override ignorecase and smartcase on a per-pattern basis.
:g/pattern/normal @a
The :g (global) command combined with :normal @a lets you execute a recorded macro only on lines matching a pattern.
macros #macros #ex-commands #global-command #editing #automation
qa<C-r>=expression<CR>q
How it works The expression register (=) lets you evaluate Vimscript expressions and insert the result.
qa0f:dwj0q
How it works When recording a macro that you plan to repeat across multiple lines, the key technique is to end the macro positioned on the next line, ready for
<C-v>jjc replacement<Esc>
Visual block mode's change command lets you replace a rectangular column of text across multiple lines in a single operation.
visual-mode #editing #visual-mode #block-mode #normal-mode #productivity
:g/pattern/m $
The :g (global) command combined with :m (move) lets you collect all lines matching a pattern and relocate them to a specific position in the file.
command-line #ex-commands #editing #global #search #formatting
:let @q =
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
qQ...q
When you record a macro into register q with qq.
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
vis
The is (inner sentence) text object selects the sentence the cursor is in — excluding any leading or trailing whitespace that separates sentences.
^
The ^ command moves the cursor to the first non-blank character of the current line.
gi
The gi command moves the cursor to the position where you last exited insert mode and immediately enters insert mode again.
navigation #navigation #insert-mode #marks #normal-mode #productivity
:lcd
:cd changes the global working directory, affecting every window and tab in the session.
<C-t> and <C-d>
When you're typing in insert mode and realize the current line needs more or less indentation, you don't have to leave insert mode to fix it.
:g/pattern/m0
When working with large files, you sometimes need to reorganize content by pulling all lines matching a certain pattern to the top.
command-line #global #move #ex-commands #editing #command-line
:profile start /tmp/profile.log | profile func *
When Vim feels sluggish during editing (not just at startup), the :profile command lets you measure the execution time of every function call.
". / "% / ": / "# registers
Vim has four read-only special registers that automatically contain useful contextual information.
registers #registers #special-registers #workflow #productivity
:bufdo %s/old/new/ge | update
The :bufdo command executes an Ex command in every loaded buffer.
buffers-windows #buffers #ex-commands #editing #substitution
vim-sleuth
The vim-sleuth plugin by Tim Pope automatically detects the indentation style (tabs vs spaces) and width used in a file and sets shiftwidth, expandtab, tabstop,
"ayy "byy "cyy
How it works Vim provides 26 named registers (a through z) that you can use as independent clipboards.