Readit News logoReadit News
mklein994 commented on Using Microsoft's New CLI Text Editor on Ubuntu   omgubuntu.co.uk/2025/06/m... · Posted by u/jandeboevrie
Brian_K_White · 3 months ago
I've always used :x or :x! and no longer remember why. Probably it's a bad idea like without actually looking right now I think it might mean to ignore permissions (if you're root enough) and just write even if perms would have blocked it. Hm, maybe x means wq and just the ! means force.
mklein994 · 3 months ago
It's actually a bit more nuanced: `:x` is like `:wq`, but only writes if changes have been made. `:x!` has the same semantics as `:wq!`.
mklein994 commented on Things you didn't know about GNU readline (2019)   twobithistory.org/2019/08... · Posted by u/meribold
mklein994 · a year ago
> 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 commented on Let the terminal bells ring out   muxup.com/2023q4/let-the-... · Posted by u/hasheddan
wolfgang42 · 2 years ago
The article mentions not wanting to put a bell in their terminal prompt because it would cause too many notifications, but I found it difficult to remember to put `;tput bel` on every command that would be slow, so I compromised by configuring my shell to notify only on commands that took longer than 10 seconds. I also use a popup instead of a straight bell so I'll see a reminder of what it was that was happening (this is for MacOS, on Linux it would use `notify-send` instead):

    function preexec() {
      lrn_timer=${timer:-$SECONDS}
      lrn_command="$1"
    }
    lrn_timer=0
    function precmd() {
      [[ -v lrn_timer ]] || return # preexec() doesn't set timer if no command run (e.g. from ^C before running)
      timer_show=$(($SECONDS - $lrn_timer))
      unset lrn_timer
      # 10 is the notification threshold in seconds
      if (( ${timer_show} > 10 )); then
        terminal-notifier -sound default -message "Exit $? in ${timer_show}s: $lrn_command"
      fi
    }
(Based on https://gist.github.com/petethepig/2d29e8b7e2ebc808bfe760b63...)

mklein994 · 2 years ago
> [...] 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 commented on Navigational Instruments (2020)   exple.tive.org/blarg/2020... · Posted by u/signa11
mklein994 · 2 years ago
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 commented on Lazygit: Simple terminal UI for Git commands   github.com/jesseduffield/... · Posted by u/thunderbong
kenmacd · 2 years ago
Interesting project... in the hopes of maybe nerd-sniping you (or having someone tell me where it already exists), I'll tell you the story I'd really like a solution to but can never seem to find time to build:

I have 5 un-pushed commits. I missed a 1-line change to that first one. I add that one line change to staging (gitui/lazygit/whatever), then I want to `git commit --fixup=COMMIT`. Finding that COMMIT is always a manual process for me for two reasons.

First I have to find the commit to which it applies. This commit is almost always the commit that changed the same line, or added lines around it, or something similar. I guess you could say it's the commit with the closest proximity to the change I'm adding.

Second I have to find the hash of that commit. If I've since done something like an autosquash rebase then it'll have changed. I generally end up using the mouse to do a copy/paste at this point.

Why not skip the fixup commits and just rebase right then, you might ask. Well the commits are signed, and signing requires tapping my yubikey for each commit after that.

I would really like to be able to do something like `git commit --I'm-an-idiot-and-missed-this-so-please-apply-a-fixup-to-the-proper-commit`, and have it do the figuring out for me.

mklein994 · 2 years ago
Not as quick as you're asking for, but what I do, after running "git log" to jog my memory of what the commit message was, is this:

  git commit --fixup=':/message regexp'
This will find the youngest commit where the message matches the "message regexp" pattern. See also: https://git-scm.com/docs/gitrevisions

mklein994 commented on TablEdit – Music Tablature Editor   tabledit.com/index.shtml... · Posted by u/sogen
melenaos · 3 years ago
What is called the one that has lyrics and chords above it? Chord tabs?
mklein994 · 3 years ago
Lead sheets?
mklein994 commented on Solving Advent of Code with jq   github.com/odnoletkov/adv... · Posted by u/nequo
mklein994 · 3 years ago
This is incredible. I'm learning so much by just reading the source code and trying it out.
mklein994 commented on The Perfect Commit   simonwillison.net/2022/Oc... · Posted by u/todsacerdoti
simonw · 3 years ago
I can never remember which tense is recommended for git commits - I keep meaning to figure that out and try to make a habit of if.
mklein994 · 3 years ago
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 commented on Brickit scans your pile of bricks and gives you ideas, with instructions   brickit.app/... · Posted by u/Orochikaku
usgroup · 3 years ago
Scan the inside of your fridge — list all the dishes you could make.
mklein994 · 3 years ago
Not quite there with the scanning part, but https://supercook.com comes close.

u/mklein994

KarmaCake day93December 28, 2016View Original