alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

commit 9f321c20c499b50e3cf9468bc521ac677268110c (patch)
parent 1aeba880373725a833187f7c955404af9610768e
Author: Alex Karle <alex@alexkarle.com>
Date:   Wed,  1 Dec 2021 00:22:08 -0500

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

Diffstat:
Agopher/notes/all/hard-wrapping-in-vi-and-vim.txt | 44++++++++++++++++++++++++++++++++++++++++++++
Dgopher/phlog/015.txt | 42------------------------------------------
Mgopher/phlog/index.gph | 1-
3 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/gopher/notes/all/hard-wrapping-in-vi-and-vim.txt 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<motion>` 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: + + ! <motion> command ... + +Will replace the lines in <motion> 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 @@ -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<motion>` 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: - - ! <motion> command ... - -Will replace the lines in <motion> 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 @@ -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]