The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @samgerrits: Caroline en asielzoekers, een tweeluik. Links: dwepen met een speldje gekregen van een Iraanse asielzoeker, rechts: nou ja… 3 hours ago
    • RT @delphijunkie: Yeah, nah. I'm good thanks Twitter. https://t.co/eTMPUoeSEa 3 hours ago
    • RT @d_feldman: Microsoft: We have world class AI research Google: We have world class AI research Meta: We’re one or two steps behind in AI… 3 hours ago
    • RT @SchipholWatch: Op dit moment is kerosine zo’n tien keer goedkoper dan alternatieve synthetische brandstof. De overheid moet dit prijsve… 3 hours ago
    • RT @jasongorman: One aspect of LLMs many folks overlook is the energy cost of training one. GPT-3 used an ~936 MWh and training it took 102… 3 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,178 other subscribers

On learning vi/vim

Posted by jpluimers on 2022/01/13

I saved below thread (if you cannot read German: try Google Translate on it [Archive.is]).

The part that – translated – strikes me most is this:

A mini-challenge where I want to spent 15 minutes per day on: when I need some functionality, instead of hacking around, research how it really is supposed to be done and internalise that way.

This totally aligns with me “learn new things every day” mantra.

Also some interesting vi/vim resources and approaches are mentioned:

If you are better at reading tables or lists for commands, I can recommend [Wayback] Basic vi Commands (Computer Science Department, Colorado State University).

One of the hardest things for me to remember somehow is the search/replace syntax, though it is very similar to that of sed. Useful examples of most permutations are at [Wayback] Vi For Smarties – Lesson Eight under “Advanced Search and Replace”:

  1. Use :s/foo/bar/ to replace the first occurrence of the word foo on the current line with the word bar.
  2. Use :s/foo/bar/g to replace all occurrences of the word foo on the current line with the word bar.
  3. Use :%s/foo/bar/g to replace all occurrences of the word foo in the current file with the word bar. Leaving off the g at the end only replaces the first occurrence of foo on each line of the current file.
  4. Use :%s/foo//g to delete all occurrences of the word foo in the current file. Leaving off the percent sign (%), of course, only does this for the current line.
  5. Use :%s/foo/bar/gc to have Vi query you before each attempt to replace the word foo with the word bar.

It is part of a series of tutorials starting at [Wayback] Vi For Smarties – Lesson One, and after the last lesson directs to the in-depth – as prose written – tutorial series [Archive.is] Wayback: The Vi/Ex Editor (which, despite marked by “[ Editor’s Note: . This tutorial series is a “work in progress” and will evolve over time. We’ll announce each new addition and expand this table of contents.]” got ditched shortly after January 2006)

https://web.archive.org/web/20160108053134/http://www.networkcomputin…

.

Note that like sed, you can use a different search/replace character than /: [Wayback] vim – / in vi Search and replace? – Stack Overflow

  • Escape the / with \ like this: \/.
  • Use different search character than /, for instance ., or #.

Back to the twitter thread

[Archive.is] Das königliche Wir on Twitter: “Ich lerne jetzt vi(m). Klingt beknackt, oder? Aber ich hab überlegt: ich möchte effizienter werden, meinen Kram stressfreier bewältigen. Und ich finde, es bietet sich an da an Baustellen anzusetzen, die täglich relevant sind. Und vi(m) nutze ich in der Tat täglich. 1/”

Ich lerne jetzt vi(m).

Klingt beknackt, oder? Aber ich hab überlegt: ich möchte effizienter werden, meinen Kram stressfreier bewältigen. Und ich finde, es bietet sich an da an Baustellen anzusetzen, die täglich relevant sind. Und vi(m) nutze ich in der Tat täglich.

Aber auch wenn ich ihn nutze und über den »Hilfe, wie komm ich aus dem Editor wieder raus?!«-Witz nur sehr müde die Augen rolle gehe ich davon aus, dass ich nicht mal einen Bruchteil der Möglichkeiten ausschöpfe, die er bietet (1. Release 1976, älter als ich!). Das ist spannend.

Das ist jetzt meine Mini-Challenge, auf die ich jeden Tag eine Viertelstunde verwenden will: wenn ich eine Funktion brauche mich nicht mehr drum herum zu hacken, sondern recherchieren wie es richtig geht und das dann gefälligst auch verinnerlichen. Mal sehen, ob das so klappt

In dem Zuge will ich auch wieder verstärkt (neo)mutt in Verbindung mit vim nutzen – das wäre ein wunderbares tägliches Training 😎 Mails schreiben muss man irgendwie immer.

neomutt bietet leider auch einen Eimer voll Funktionen, die ich noch nicht ordentlich nutze. Gnah.

An euren Replies erkenne ich, dass das mit dem »sich die Kürzel merken« echt heikel zu sein scheint 🤔 Wie handhabt ihr das im Alltag? Einfach ein paar Basics wie :u und CTRL+r und gut ist? Ich bin neugierig. Oder nutzt ihr alle nano? (Ich glaub, dann muss ich entfolgen) 😂

Nur als kleinen Zwischenstand: nach dem Lesen eurer Antworten schließe ich, dass ich mich mit meinem Kenntnisstand nicht verstecken muss 😂 Da hat mir der virtuelle Schulterblick schon weiter geholfen.

vi(m), weil ich Admin bin und dieses Tool auf jedem System und ohne X-Geraffels üblicherweise vorfinde (wenn auch bei neueren Installationen dieser absurde „visual mode“ der Default ist 😳). Auch unter (Open)Solaris, IRIX, was weiß ich.

Antworten:

Patrick Ben Koetter (@patrickbkoetter)

Ich habe diverse Plugins ausprobiert und lande immer wieder bei “normal“, weil ich einfach nicht die Disziplin aufbringe das Zeug richtig zu üben.

Marcel Weinberg (@winem_)

Denke so geht es vielen, die eben teilweise auch schon viele Jahre in der IT sind. Ist dir vimtutor bekannt? Den regelmäßig durchzutanzen hilft auch etwas, auch wenn man einiges immer mal vergisst oder einfach nicht nutzt.

Kristian Köhntopp (@isotopp)

vi movement Kommandos haben System. Erkenne und lerne das System. hjkl + prefix+hjkl, Marken, prefix+jump to mark und so weiter.

Und bleibe von den verblödeten Plugins weg. Die braucht kein Mensch und machen vim nur langsam im Start und kompliziert.

Boris (@k3rvyn)

Was mich so richtig weiter gebracht hat, war dieser Talk:
https://www.youtube.com/watch?v=5r6yzFEXajQ

winfreak (@winfreak)

Ich bilde mir kleine Merkphrasen für movements…
Aus „ciw“ wird „change inner word“, z.B.
Das kann ich mir deutlich besser merken.

–jeroen


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: