I feel like the images should be switched.
When you know how to exit, you just slap your face 🤦 and ask “why… why, please, why don’t they add new shortcuts 🤦!”.
Lol if you know how to exit, you may know that you actually can change almost everything about vim.
I don’t think you can add modifier keys in shortcuts.
And this behavior should come out of the box, not me changing stuff around so I can make it usable. For something that I use all the time, sure, but I only use a terminal text editor with git, and I don’t use git that often. For everything else, I use a GUI text editor (mousepad, leafpad, whatever).
If you wanna save changes: :wq
If not: :q!
Else: :SpanishInquisition
Why do so many people prefer :wq over :x?
Cause I don’t like to think about my x
:x
was a gamechanger. And it doesn’t update the file’s modify date if you made no changes.Sometimes I just sit back and think about all that saved time and effort so much that I have actually lost time by switching from
:wq
.same reason I prefer :wq to ZZ. muscle memory.
Hmm, I didn’t expect that last one.
I did not expect the Spanish inquisition!
help! i wanna leave!
:wq
why isn’t it working???You have been chosen by the Vim Dommy Mommy. You cannot leave.
you don’t need the
!
when you have thew
, because your changes already get saved.If anything it is dangerous as it will still exit even if changes cannot be saved.
Try editing a file in
/etc
as a regular user. It happens sometimes and you really want that warning that the write failed.Anyway,
:x
is superior. It only writes if there are changes. So, your mtime doesn’t change unnecessarily.wait people care about the mtime?
:ggdGwq (please don’t do this)
VIM Golf… Same outcome, fewer strokes:
%d|wq
you can replace wq with x
:%d|x
Only in Vim, not in Vi.
E492: Not an editor command: ggdGwq
I use Vim daily, and i have absolutely no clue what that command would do, what would it do? Delete the document, save and quit?
exactly.
gg -> go to top of document
d -> delete (actually, it’s cut, but it destroys the mnemonic)
G -> here is a modifier to “d” and tells it do “delete until end of document”
w -> write current state of buffer to disk
q -> exit program
Actually not, binds and commands aren’t the same.
ggdG
only works as a series of inputs, whilewq
only works as a command (with the colon).Exactly. The colon needs to be just before the
w
, not at the front of the sequence…And while you’re at it, throw an
ESC
in there at the beginning, will ya?
yeah, I screwed it up
gg
Huh… I always just used :1
I prefer the extremely intuitive:
["grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9")
]=system(or
i:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9[esc]Y:@"[cr]
It just rolls off the fingers, doesn’t it?
Edit: damn it lemmy didn’t like my meme because it assumes that characters between angle brackets are html tags :( you ruined it lemmy
EDIT 2: rewrote it, just assume that square brackets are buttons not characters
This is how you get buffer files everywhere
deleted by creator
I always get annoyed when I’m on some system and nano pops up and I need to figure out how to kill that thing.
Nano literally tells you all the shortcuts to your face.
It shows a message which wastes valuable screen estate, especially on low resolution terminals, containing a message I have to read every single time because the keys are not in muscle memory, and never will because the bindings are stupid.
On systems I have control over the reaction to nano popping up is exiting, removing it, making sure the package system blocks reinstallation attempts, and go back to what I was initially doing in a sane editor.
You have so much pent up emotion over a text editor. Life can be so much more my friend!
First day on linux?
You know the bell curve meme? I’m just beyond this.
Very intuitive - Ctrl + X… unlike vim.
Why is Ctrl-X intuitive? Shouldn’t it be Ctrl-Q (for “quit”)?
CTRL+eXit
In most apps, Ctrl-X means “cut”, not “quit”. Especially when it’s a freakin’ text editor!
I will grant you that it’s more intuitive than vi, but that is a very, very low bar.
It doesn’t have to be X, just the fact that it uses modifier keys is enough. It could be Q or anything else, just please, for the love of god, we live in the 21st century now, all keyboards have modifier keys, please, add modifier keys shortcuts as well.
Because it also sends the kill signal in every terminal I’ve witnessed yet… And you have it right on screen the second you start Nano.
Because nano just shows how to exit, as well as some other basic functions at bottom
gg/un2x?-d/like
FTFY
I’m not planning on googling that 😒.
result: Very intuitive like vim.
gg
- top of the file/un
- find “un” place cursor at u2x
- remove 2 characters?-
- search backwards for the character-
d/like
- delete everything up until the characterslike
See, intuitive!
I don’t do that much search and replace in any terminal based text editor to actually use that on a regular basis. If I need edits like that, I use a GUI text editor.
Sure, I just hate moving from mouse to keyboard every few seconds as I code.
<ESC> <CTRL>+Z killall -9 vim
And then
sudo apt install nano
No no no no, it’s
sudo xbps-install -Suv nano
👍.
Alt+SysReq+O
deleted by creator
Just SysRq. Alt+PrtScr is how you press SysRq Just like you wouldn’t write “shift+1” instead of “!”
If you can remember this, you can remember how to save and quit
It’s just a meme. I actually use vim regularly. But this is funnier.
:x
There’s a button to exit vim on your pc. Just hold it 7 seconds and vim is closed. 😅
it’s right next to the turbo button
Serious question. Why? No, for real, why? Why are these hard to understand editors still the default on most distros and flavors? Why haven’t they reinvented themselves with easier to understand shortcuts?
I get the feeling my comment will attract heat, but I’m a web dev, studied comp Sci for years, have worked for nearly a decade and have spent over half my 30 year old life using computers of all sorts. I’m by no means a genius and I by no means know enough about this or most tech subjects, but I literally only knew how to close vim with and without saving changes in a recent vim encounter, purely due to a meme I saw in this community a few days prior, and I had already forgotten the commands by the time I saw this post. Nothing about vim and alternatives feels intuitive or easy to use, and you may say it’s a matter of sitting down and learning, which you can argue that, but you can’t argue this isn’t a bit of a gatekeeper for people trying to dip their toes into anything that could eventually rely on opening vim to do something.
I won’t try to deny its place in computer history, or its use for many, or even that it is preferred by some, but when every other software with keyboard shortcuts agrees on certain easy to remember standards, I don’t quite understand how software that goes against all of that hasn’t been replaced or hasn’t reinvented itself in newer versions.
Then again, I have no idea what the difference between vi, vim, emacs, and nano are, so roast away!
Then again, I have no idea what the difference between vi, vim, emacs, and nano are, so roast away!
Lol. Git Gud, Noob.
Vi is meant for old school and modern terminals. Ctrl+S or Ctrl+C had very particular purposes in software control flow. With Vi you can communicate via SSH on almost any unix file system. It’s basically a universal editor that doesn’t require a mouse or a lot of keys on a keyboard. You can get away with just a subset of the ASCII set.
So for one, it’s kind of like having a backwards compatible piece of software that exists on almost any system you might need to remotely control via a keyboard with no GUI.
For two, once you do learn how to use Vi/Vim/Emacs, you’ll be far faster at typing. It has several useful tricks for automating typing (faster copy/paste, copy/paste n-times, jump around lines/chars, go-to lines, search via Regex, etc.) which are particularly useful in a programming context.
Generally, it’s worth a developer spending at least a day or a week typing only in Vi for programming. Yes, you’ll be slow and clunky. But the moment you have to SSH into a server and make meaningful changes to a file, you’ll be happy you spent the time.
Because vim (and emacs too!) is a powerful editor that works purely on command line and most people who are experienced in the Unix world are generally familiar with it. There are plenty of easier editors to use, like nano, that are also widely distributed and you are free to change your default. Being really powerful but you kind of need to know what you’re doing is basically unix’s whole thing.
Why would vim reinvent itself? Vim’s functionality has been standard for years, and works as expected. You can always use nano or something similar instead, which is probably a lot more usable to someone who doesn’t want to learn all the advanced functionality of vim or emacs
As a ~20 year vim user, and by no means a proficient power user (any time I end up in recording mode, I just mash ESC repeatedly until this start behaving normally again.), I think it’s just “it’s easier for someone that doesn’t know how to use it to learn, than it is for everyone that already knows how to use it to relearn”.
Like the damn scroll options on laptop trackpads. Multitouch scroll down = scroll down. Then someone decided it needed to match the way phone scrolling works after smartphones became popular, so now there’s lots of scroll down = scroll up software behavior. But the options are still there to behave neither way. If you don’t like the vim commands, you’re free to install something that behaves in a way that you expect. If you do like vim commands, install it and get the behavior that users have come to expect for the last 20+ years.
Some people like vim the way it is. That’s why they haven’t re-invented it. If you want to use a more intuitive text editor, there are plenty available (such as nano or micro).They don’t need to turn vim into a clone of something that already exists.
As for why it’s still the default… It’s the same reason why everybody uses QWERTY keyboards when Dvorak is clearly superior. People already know how to type with QWERTY and they don’t want to take the time to re-learn with a new layout, change their workflows, etc.
It isn’t universal, though. Garuda Linux defaults to micro. The web dev boot camp I was in didn’t bring vim up at all! We only used nano! I think that was a disservice to the students, but the instructors must’ve thought that it would be too confusing.
Dvorak is clearly superior? Prove it
To ensure the Unix-like standard of maximum backwards compatibility. Vi (the original, before Vim) was made in an age where computer keyboards might not have had luxury features like arrow keys, but did have alphanumeric keys and minimally competent users. It has worked for almost half a century, so unless you’re Microsoft, why would you change it?
Even today, many people prefer it because you don’t have to move your hand far away from the home row while typing or navigating, and the modality gives the user a much greater toolkit (seriously, I just about nutted when I discovered
d i "
). Not having to rely on modifiers and the arrow keys also reduces the risk of the repeated stress injury known as Emacs pinky.Nano is the default on Debian for more than a decade. Maybe two. I don’t think vim is the default on any largely use distro now.
Are you actually asking why people use them?
Is
vi
still the default? On Debian it sure isn’t,nano
is the default and has been for years, and I can only assume the debian derivatives have all followed suit. That’d already be most new installs taken care of.If you find something that opens
vi
unexpectedly, double-check$EDITOR
’s value then file a bug report and tell them to follow$EDITOR
.Just to add to that some programs also use their own variable like GIT_EDITOR, SVN_EDITOR,…
I guess some people really like the features. Imo Micro/Nano are much easier to use than Vim
i mean… skill issue 🤷
ZZ/ZQ.
I am also a shift-zz fan.
ZZ
:qa!
I love how in the comments on even the most basic vim meme I learn something new
ZZ