How do I enable native LSP-powered completion in Neovim without installing nvim-cmp or other plugins?
vim.lsp.completion.enable()
Neovim 0.
Search Vim Tricks
Searching...vim.lsp.completion.enable()
Neovim 0.
vim.snippet.expand()
Neovim 0.
:g/pattern1/g/pattern2/command
Vim's :g command can be nested — the command part of one :g can itself be another :g.
\%[seq]
Vim's \%[seq] atom makes the sequence seq optional in a pattern — matching any prefix of the sequence (including nothing).
:noautocmd e {file}
When you have heavy autocmds registered for BufRead, BufEnter, or FileType events — such as LSP clients, formatters, or syntax processors — opening a large
command-line #command-line #ex-commands #buffers-windows #config
g<C-g> (visual mode)
In visual mode, pressing g reports detailed statistics for the selected text only — word count, character count, and byte count.
dgn
The gn motion is a versatile text object that selects the next occurrence of the last search pattern.
editing #editing #search #text-objects #normal-mode #motions
\U, \L, \u, \l, \e in :substitute replacement
Vim's substitute command supports in-replacement case conversion metacharacters that transform the case of matched text without extra scripting.
z. and z<CR> and z-
Vim has two parallel sets of scroll commands: the well-known zz, zt, zb which reposition the view without moving the cursor, and the lesser-known z.
:match {group} /pattern/
:match, :2match, and :3match give you three independent highlight slots that overlay patterns on the buffer using any highlight group — without touching the s
:wincmd {cmd}
:wincmd {key} is the Ex command equivalent of every {key} window shortcut.
buffers-windows #buffers-windows #windows #ex-commands #normal-mode
\%(pattern\)\@=
Vim's lookahead assertion \@= confirms that the current position is followed by a pattern — without including those characters in the match.
:saveas {newname}
:saveas saves the buffer to a new file and redirects all future :w commands to write to that new filename — making it the true "Save As" command in Vim.
g??
Vim has a built-in ROT13 operator g? that encodes text by rotating each letter 13 positions in the alphabet.
:tjump /pattern
:tjump is a smarter variant of :tag.
]s
When spell checking is enabled with :set spell, Vim underlines misspelled words in the buffer.
:s/\%Vfoo/bar/
The \%V atom in Vim's regex engine matches only within the area of the last visual selection.
search #search #visual-mode #substitute #advanced #ex-commands
:set scroll=10
The scroll option determines how many lines (scroll up) and (scroll down) move the viewport.
:set digraph
With :set digraph enabled, you can enter special characters in insert mode by typing the two-character digraph code followed by (backspace).
config #insert-mode #digraphs #unicode #special-characters #config
:%s/^\(.\+\)\n\1$/\1/
This substitute command detects pairs of identical adjacent lines and collapses them into one, using a back-reference to match the repeated content.