Vim
Write to read-only file
Delete any number of lines
Shift+V from point of cursor and press D key to delete.
Search and replace
-
Open Telescope with fuzzy finding:
-
Type in search term
-
Add all results to quickfix list at once using
<Ctrl-q>
or alternatively, press Tab on every desired entry and press<Alt-q>
-
Type the following command:
-
Write all changes:
Disable search highlight
Prepend multiple lines with a character
- Shift+V from point of cursor to enter Visual Block mode
- Move up/down to select multiple lines
:
to enter command modes/^/#/g
to replace first character on the lines with a#
The prompt will look something like this when all done:
Format to certain column width
-
Set text width to desired width:
-
Move to start of file:
-
Format text from start to the end:
Measure start-up speed
Re-indent according to file type
- A single line:
==
- A range of lines:
<range>==
- Entire file:
gg=G
- Probably won’t be as intelligent as a language-specific formatter
Reverse lines
More information here.
Use visual mode to selectively reverse ((:g|:global)
command is still required).
Useful for re-ordering commits with git rebase -i
if you know you made the most relevant commit first and subsequent minor changes afterwards.