How do I delete consecutive duplicate lines from a file using a single Ex command?
:g/\(.\+\)\n\1/d
The :g command with a backreference pattern can detect and delete consecutive duplicate lines in one pass.
2125 results for "i{ a{"
:g/\(.\+\)\n\1/d
The :g command with a backreference pattern can detect and delete consecutive duplicate lines in one pass.
/\%>5c\%<20cpattern
How it works Vim's search patterns support column position constraints using the \%c family of atoms.
:%sort /[^,]*,/ n
Vim's :sort command accepts a pattern that controls which part of each line is used as the sort key.
:set autoread
The autoread option tells Vim to automatically re-read a file when it detects the file has been changed outside of Vim.
:lua require'dap'.toggle_breakpoint()
The nvim-dap plugin implements the Debug Adapter Protocol in Neovim, providing a full debugging experience with breakpoints, step-through execution, variable in
:%s/pattern/replacement/ge
The e flag on :substitute silences the "Pattern not found" error that Vim normally reports when a substitution has no matches.
mzgUiw`z
When you run an operator like gUiw, Vim can leave your cursor in a slightly different place than where you started.
vim.uv.new_timer()
Neovim exposes vim.
:set mouse=a
How it works The :set mouse=a command enables mouse support in all Vim modes.
:'<,'>g/pattern/command
How it works The :g (global) command is one of Vim's most powerful features.
:verbose nmap <leader>
The :verbose prefix on mapping commands shows not just the mapping definition but also the file and line number where it was defined.
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
:pedit
Vim has a built-in preview window — a special window distinct from regular splits.
/pattern/+N or /pattern/-N
Vim's search command accepts an offset that places your cursor on a line relative to the match.
qaYp<C-a>q99@a
By recording a macro that duplicates a line and increments its number, you can generate a numbered list of any length with a single replay command.
macros #macros #editing #normal-mode #automation #productivity
:keepjumps {command}
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
navigation #navigation #ex-commands #jump-list #normal-mode #vimscript
:set showbreak=+++
When wrap is enabled, Vim wraps long lines at the screen edge, but there is no built-in visual marker to distinguish a wrapped continuation from a brand-new lin
:<C-r>"
When typing an Ex command or search pattern, you often need to insert text you've already yanked or deleted.
/colour\%[s]
Vim's \%[.
:iabbrev <expr> {trigger} {expression}
The flag on :iabbrev turns the right-hand side into a Vimscript expression that is evaluated at expansion time rather than stored as a literal string.