Command | Description |
---|---|
:%s/old/new/g |
Replace all occurrences of 'old' with 'new' in the entire file |
:s/old/new/g |
Replace all occurrences of 'old' with 'new' in the current line |
:s/\Cold/new/g |
Case-sensitive replace of 'old' with 'new' in the current line |
:s/\v(\d+)-(\d+)/\2-\1/g |
Swap two groups of digits separated by a hyphen in the current line |
:g/^$/d |
Delete all empty lines in the file |
:g/pattern/norm gU$ |
Convert matching lines to uppercase |
`:argdo %s/old/new/gc | update` |
q<register> |
Start recording a macro into a register |
@<register> |
Execute the macro stored in the specified register |
:args *.txt |
Set arguments to all .txt files |
:cfdo <command> |
Run a command in each file in the quickfix list |
Last active
July 24, 2024 09:52
-
-
Save Piotr1215/19b1a1a3735e5757a1c947edc7777630 to your computer and use it in GitHub Desktop.
neovim search&replace cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment