💾 Archived View for pwshnotes.flounder.online › gemlog › 2022-08-15-formatting-vim.gmi captured on 2023-06-14 at 13:55:17. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
I prefer to read long passages in Vim. So, I copy and paste from the Web into Vim.
Sometimes, the plain text copy of an online document is difficult to read in Vim.
Below are some advanced Vim commands to address specific issues.
If you get unexpected results from running multiple commands, try running the commands in the order they appear here.
In Vim, you can paste at the command line by pressing Ctrl-r and then + So, it is possible to copy and paste these commands without typing. Take care to include only one leading colon : in your commands.
:%s/\S\n\zs\(\S\)/\r\1
Here, \r will add a carriage return to the output.
The above Vim command will add a blank line before headings.
We go from this:
... and terminal.integrated.tabs.defaultColor. Extended PowerShell keybindings
to this:
... and terminal.integrated.tabs.defaultColor. Extended PowerShell keybindings
:g/^\w.\{79,}\|^ \w.\{75,}\|^ \w.\{71,}/normal gqgq
The Vim command above will add line breaks to long paragraphs. I find this helps if, later, I use a linewise visual select while reading.
Turn this paragraph with no line breaks:
There are additional PowerShell keybindings, such as Ctrl+Space, thanks to shell integration. These weren't possible before due to the lack of VT encoding. Provided that shell integration is working in pwsh, the following keybindings should now work:
into this paragraph with a line break at the end of each line:
There are additional PowerShell keybindings, such as Ctrl+Space, thanks to shell integration. These weren't possible before due to the lack of VT encoding. Provided that shell integration is working in pwsh, the following keybindings should now work:
Basic Information About Vim Modes (e.g. Normal Mode)
Introduction to the Vim Command Line
Manual Page for Regular Expressions in Vim
The meaning of % in :%s/ | Vim Range
:normal | Using Normal Mode Commands in Command-line Mode
Selecting Lines | Linewise Visual Select | Vim User Manual
Created: Monday, August 15, 2022
Updated: Saturday, October 8, 2022