From f3c7f931c47235083433898c8df53a70419d2680 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Thu, 6 Nov 2025 03:36:18 +0100 Subject: [PATCH] vim linewrap --- writing/vim/linewrap.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 writing/vim/linewrap.md diff --git a/writing/vim/linewrap.md b/writing/vim/linewrap.md new file mode 100644 index 0000000..89147bb --- /dev/null +++ b/writing/vim/linewrap.md @@ -0,0 +1,32 @@ +--- +title: "vim windows" +tags: [ "vim", "format", "linewrap" ] +requires: [ "vim basics" ] +--- + +Wrap lines in a file to 80 characters with `gqG`. + +Take this markdown file: + + +```markdown +This is a looooooooooooooooooooooooong line, and reeeeeeeeeeeeeeding it can be a paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiin in the aaaaaaaaaaaaaaaaaaaaaaaarse. +``` + +Reformat the line to the proper text width by pressing `gqw`. +The output looks like this: + +```markdown +This is a looooooooooooooooooooooooong line, and reeeeeeeeeeeeeeding it can be +a paaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiin in the +aaaaaaaaaaaaaaaaaaaaaaaarse. +``` + +This works with chunks of text in visual mode. + +Change what width the text should be: + +```vim +:set textwidth=100 +``` +