2299
Very clever... (lemmy.ml)

I'm trying out Obsidian for taking notes, and this made me laugh.

you are viewing a single comment's thread
view the rest of the comments
[-] hperrin@lemmy.world 10 points 1 year ago

Oh man, that's awesome. Aren't there a couple ways to do that though?

[-] itslilith@lemmy.blahaj.zone 5 points 1 year ago* (last edited 1 year ago)

they accept :q! but I haven't checked anything else yet

[-] hperrin@lemmy.world 5 points 1 year ago

According to Stack Overflow, there is also:

  • :cq (quit without writing and return non-zero exit code)
  • ZQ (quit without writing from normal mode)
[-] itslilith@lemmy.blahaj.zone 3 points 1 year ago* (last edited 1 year ago)

I actually knew about ZQ :)

but in what case would you ever need :cq ? I'm curious what's the idea behind that

Edit: I checked, neither work for obsidian verification, including :cq!

disappointing :c

[-] GiantRobotTRex@lemmy.sdf.org 2 points 1 year ago* (last edited 1 year ago)

It's useful when vim is being run from a different program or script.

For example, if I run p4 change to create a new Perforce changelist it will open up my editor (which I have set to vim) so that I can enter the CL description and other fields. If I realize I don't actually actually want to create the CL yet I can use :cq to quit with an error so that p4 knows to abort.

I also have a script I use for diffing a list of file pairs. It runs vimdiff on the first pair of files then if I exit with :qa it will move on to the next pair of files. But if I exit with :cq it will just abort and skip all of the remaining file pairs.

this post was submitted on 25 Oct 2023
2299 points (99.1% liked)

Programmer Humor

32558 readers
472 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS