From 9f321c20c499b50e3cf9468bc521ac677268110c Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Wed, 1 Dec 2021 00:22:08 -0500 Subject: [PATCH] gopher: Move latest phlog post on vi/vim to notes/ Tech tips like this feel better suited to a timeless "notes" section than a _phlog_. It's admittedly a bit polished for a "note", but on the other hand it doesn't carry the same weight as some of the other musings of the phlog --- gopher/notes/all/hard-wrapping-in-vi-and-vim.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ gopher/phlog/015.txt | 42 ------------------------------------------ gopher/phlog/index.gph | 1 - 3 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 gopher/notes/all/hard-wrapping-in-vi-and-vim.txt delete mode 100644 gopher/phlog/015.txt diff --git a/gopher/notes/all/hard-wrapping-in-vi-and-vim.txt b/gopher/notes/all/hard-wrapping-in-vi-and-vim.txt new file mode 100644 index 0000000..ebc882a --- /dev/null +++ b/gopher/notes/all/hard-wrapping-in-vi-and-vim.txt @@ -0,0 +1,44 @@ +Hard-Wrapping Lines in vi(1) and vim(1) +--------------------------------------- +Wed Dec 1 00:00:50 EST 2021 + +tags: editors + +There's several types of text that I really like to hard-wrap. +Phlog posts, personal notes, git messages, and emails to name +a few. + +This can be done in vim(1) by setting `textwidth` to 60 and +then using the `gq` command to format (example: `gqip` +formats *i*nside *p*aragraph). + +However, I really like using OpenBSD's vi(1) as my $EDITOR due +to its blazingly fast startup time (and the whole point of the +$EDITOR is that it is executed by other programs!). + +To achieve the same automated formatting, I make use of a +lesser known feature: + + ! command ... + +Will replace the lines in with the output of the shell +command (which receives the lines as standard input). + +Better yet, this repeats with the dot command. So, as a final +action before publishing, I go to the top of the first paragraph +and hit `!}fmt 60`, then go down the post with `}.}.}.` until +all paragraphs are wrapped. + +How cool is that? It even works in vim(1) (one of the perks of +learning plain-vi(1) is discovering deeper vim(1) features!) + +--- + +Note that you can also use: + + range ! command + +Such as `%!fmt 60` to filter the whole document, but I find +there's usually bits and pieces fmt(1) doesn't handle well +(such as title underlines or ascii art), so I prefer to +quickly format each paragraph by hand. diff --git a/gopher/phlog/015.txt b/gopher/phlog/015.txt deleted file mode 100644 index 8f9be5a..0000000 --- a/gopher/phlog/015.txt +++ /dev/null @@ -1,42 +0,0 @@ -Using fmt(1) to Wrap Lines in vi(1) ------------------------------------ -Wed Dec 1 00:00:50 EST 2021 - -There's several types of text that I really like to hard-wrap. -Phlog posts, personal notes, git messages, and emails to name -a few. - -This can be done in vim(1) by setting `textwidth` to 60 and -then using the `gq` command to format (example: `gqip` -formats *i*nside *p*aragraph). - -However, I really like using OpenBSD's vi(1) as my $EDITOR due -to its blazingly fast startup time (and the whole point of the -$EDITOR is that it is executed by other programs!). - -To achieve the same automated formatting, I make use of a -lesser known feature: - - ! command ... - -Will replace the lines in with the output of the shell -command (which receives the lines as standard input). - -Better yet, this repeats with the dot command. So, as a final -action before publishing, I go to the top of the first paragraph -and hit `!}fmt 60`, then go down the post with `}.}.}.` until -all paragraphs are wrapped. - -How cool is that? It even works in vim(1) (one of the perks of -learning plain-vi(1) is discovering deeper vim(1) features!) - ---- - -Note that you can also use: - - range ! command - -Such as `%!fmt 60` to filter the whole document, but I find -there's usually bits and pieces fmt(1) doesn't handle well -(such as title underlines or ascii art), so I prefer to -quickly format each paragraph by hand. diff --git a/gopher/phlog/index.gph b/gopher/phlog/index.gph index 64074a0..721b149 100644 --- a/gopher/phlog/index.gph +++ b/gopher/phlog/index.gph @@ -14,7 +14,6 @@ [0|Atom Feed|/phlog/atom.xml|server|port] -[0|[2021-12-01] Using fmt(1) to Wrap Lines in vi(1)|/phlog/015.txt|server|port] [0|[2021-11-30] Screen Time|/phlog/014.txt|server|port] [0|[2021-11-25] Gopher-First Feeds|/phlog/013.txt|server|port] [0|[2021-11-21] Optimizing for Archival|/phlog/012.txt|server|port] -- libgit2 1.1.1