mklein994's comments

mklein994 | 1 month ago | on: Termux

For me, it was how I learned Vim. The awkward keyboard pushed me towards learning more efficient keystrokes, so now I'm very comfortable with Vim.

I would learn it on the bus, and at the time I didn't have a data plan, so I could only access things I had already downloaded. The `:help` documentation is very thorough.

mklein994 | 1 year ago | on: Things you didn't know about GNU readline (2019)

> Also, without some sort of indicator, Vim’s modal design is awkward here—it’s very easy to forget which mode you’re in.

With `bash`, you can show which mode you're in by putting this in your `~/.inputrc`:

    show-mode-in-prompt on
It makes your prompt look like this:

    [foo@bar ~]$ # before turning it on
    @[foo@bar ~]$ # after
    @[foo@bar ~]$ set -o vi
    (ins)[foo@bar ~]$ # and after I press esc:
    (cmd)[foo@bar ~]$
Customize these with `emacs-mode-string`, `vi-ins-mode-string`, and `vi-cmd-mode-string`.

mklein994 | 2 years ago | on: Let the terminal bells ring out

> [...] but I found it difficult to remember to put `;tput bel` on every command that would be slow [...]

What I do in these situations (assuming the job is still in the foreground, and can be interrupted), is suspend the task with ctrl+z and resume with `fg`, chaining it with some other command:

    fg; notify-send "done"
This uses the "job control" feature of `bash`, so it requires no extra setup. Your approach has the simple advantage however, that once it's set up, it just works, automatically.

mklein994 | 2 years ago | on: Navigational Instruments (2020)

Cool. I didn't know about "Ctrl+T, Ctrl+Z"; I've always used "Alt+D, Alt+Enter" to duplicate tabs. This other shortcut might come in handy if I want to immediately edit the URL.

mklein994 | 3 years ago | on: The Perfect Commit

It's called the Imperative Mood[0]. I like to think of it as though I'm completing this statement: "If you apply this patch, this commit will [Do The Thing™]". Here's a few examples:

If I were to apply this patch, this commit will…

- Simplify FooWidget

- Add optional table support

- Remove trailing whitespace

- Update fizzbuzz to 1.2.0

- Merge branch 'feature/ABC-123-foobar'

- Revert "Add foo to bar"

[0]: https://en.wikipedia.org/wiki/Imperative_mood

mklein994 | 5 years ago | on: Show HN: I wrote a program to convert lines of text into trees

Neat. I'll add this to my toolbox.

Somewhat unrelated: I discovered some time ago that the column command (from util-linux) can print trees of hierarchical data (up to 2 levels deep).

From the man page:

  $ echo -e '1 0 A\n2 1 AA\n3 1 AB\n4 2 AAA\n5 2 AAB' | column --tree-id 1 --tree-parent 2 --tree 3
  1  0  A
  2  1  |-AA
  4  2  | |-AAA
  5  2  | `-AAB
  3  1  `-AB
column(1): https://github.com/karelzak/util-linux/blob/master/text-util...

mklein994 | 5 years ago | on: A Vim Guide for Advanced Users

The docs for this is in `:help v_CTRL-A`.

It should actually say VISUAL BLOCK mode. This is where you use `CTRL-v` to select a block of text. You can read more in `:help blockwise-visual`.

Also see the 'nrformats' option: `:help 'nrformats'`. You can include alphabetic characters to do the same thing with A-Z, for example.

https://vimhelp.org/change.txt.html#v_CTRL-A

page 1