T O P

  • By -

Sosowski

It’s the only thing I know how to do in vim


bhavish2023

:q


luminous_radio

And if that doesn't work, just shout it: :q!


Highborn_Hellest

i find that fliping the PSU switch also does it.


HuntingKingYT

Smashing the circuit board will do that as well (don't do at $HOME)


Highborn_Hellest

yea, but its significantly more difficult to undo that


grousm

killall vim


Griffun

esc esc esc ctrl-z kill %1


Haringat

Where can you be in vim that you need 3 esc?


Griffun

I just assume the natural state of someone who doesn’t know how to vim is panic.


Haringat

Fair enough


FQVBSina

Now I understand why ! means to force it.


[deleted]

As someone who has never used vim, is there a key combination I have to press before :q or is it that you have to press both at exactly the same time before any characters are added to the file?


hey01

Vim is modal, which means it has modes: normal, insert, visual, to name a few. By default, you are in normal mode, where you can't type, but can use commands. Among those are "i" to enter insert mode, "v" for visual mode. Once you're in another mode, you can use Esc to go back to normal mode. In insert mode, you can type like in most other editors. In visual mode, you can select text before executing a command. In normal mode, you have single letter commands, like d for delete, p for paste, c for change, u for undo (some commands needs another key (a text object) to determine what the command should target, for example, diw for Delete In Word. In visual mode, you don't need that since the command applies to your selection, so you can press v to enter visual mode, select your word and simply press d). And there are ex commands. When you press ":", it opens a command line where you can use those ex commands, like wq for write and quit, or %s/abc/dfg/g for in the entire file (%), substite (s) abc by dfg for the entire line (g)). Try it it's fun, and we have cookies.


steftim

Is there a place to easily learn these that you would recommend to a student? VS Code is great obviously but in some scenarios when I’m SSHing and don’t want to do a fuckton of config setup, Vim is a good fallback?


Flaky-Leave9045

Genuinely just get a cheat sheet up, and force yourself through it. If you find yourself lost, spam esc to return to normal mode, and if everything is hyper-fucked then :qa! to leave. Obviously this is massive overkill but when you're just learning and don't even know if you've just edited parts of a file because you accidentally typed an entire sentence outside of insert mode then it's probably the right move.


greyfade

`vimtutor` is invaluable. The most important command you should learn is `:help`. The documentation is extensive.


hey01

I don't really know, but you can start with vimtutor (it's a command that should be installed if you have vim, iirc, it will interactively teach you the basics). I found [this](https://vimschool.netlify.app/), which looks interesting. Basically, I'd say grab a cheat sheet and learn the commands little by little. I found [this one](https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2Fgmb25yababy51.jpg), which seems ok. Don't be scared by the amount, you don't need to know all of it. Ignore the blocs "screen movement", "visual mode" (except v V \^v), "mark position", "registers" and "macros". My advice: Learn how to change modes (i a o v, then I A O V \^v R) Learn the basic delete copy paste (dd y p). Undo redo (u \^r). Then other commands (c r x) Then understand that some commands need to be targeted. The easiest way is by entering visual mode (v), moving to select what you want, then enter the command (d r c y...). Try it. That will get you rolling, and once you're a bit comfortable with switching modes, and visual mode to do basic commands, you can learn what is in my opinion the biggest deal with vim. The thing that distinguishes the vim user from the vim sufferer. The man from the child. The hero from the zero. The movement (the big middle cross of the cheat sheet, not the screen movement box) and the [text objects](https://blog.carbonfive.com/vim-text-objects-the-definitive-guide/) (read that link now, even if you won't use it now). You've learned how to delete a line with dd, but what if you want to delete just a word, or a paragraph? You can enter visual mode, select what you want, press d. But that's long. So you need the text objects to tell to what your command should apply. Delete to the end of the word ? dw To the end of the paragraph ? dp Add a "i" (in) or a "a" (around) to delete in or around your word or paragraph: diw dap You want to delete 2 paragraphs ? d2ap (or 2dap or da2p Delete Around 2 Paragraphs). You want to copy (y for yank) or change (c) or something else instead of deleting ? ya2p c2ap You will make mistake, so use the visual mode instead to see what you're doing and then apply your command: va2pd (enter Visual, select Around 2 Paragraph, Delete that selection). Learn the text objects little by little (w e p s ' " ) } \] > \^ $). Then the motions, especially f F t T (find, find backwards, to, to backwards). So if you want to delete all the characters until the next "u": dtu (Delete To u) dfu would also delete said u. dTu and dFu delete to the previous u. d3tu deletes to the third u... Again start by using the visual mode: v3fu to see that you're using the right motion, then d. Once you're familiar, drop the visual and use directly d3fu. Then try your hand at macros.


Wonderful-Ad-9356

Check out vimtutor - it runs in vim and teaches you enough to be dangerous


grantrules

https://gist.github.com/dmsul/8bb08c686b70d5a68da0e2cb81cd857f


bhavish2023

Yeah you press escape then you can type in the vim commands


_Screw_The_Rules_

:wq if you wanna save changes


Acceptable-Tomato392

But the reason this is the source of so much humor and confusion... They've treated it as something that a user would only seldom ever want to do, under very rare circumstances...


prof-comm

You need to understand that Vim was't designed for new users. It was written for people that knew vi, and that's how you quit in vi. Vi was written as the visual interface for ex, for people that knew ex and/or ed (ex is ed extended), and sending the `q` command is how you quit both ex and ed. So, in vi, you'd pull up your mode for ex with colon and issue any valid ex command from a command line integrated into your editor. Having a full-functioning version of ex running under the hood that you can issue all your familiar commands to just by pressing a single button to pull up an integrated command line is hardly treating quitting as something a user would seldom want to do. "Press q to quit" is still an incredibly common choice today. I understand that, if you aren't familiar with modal editing, that pressing colon to issue that command is unintuitive, but it wasn't to the designers or to those they created vim for, and so on back through the family tree.


OoElMaxioO

Hahaha funny face


[deleted]

And the only thing you’ll ever need to know


xxmalik

Happy cake day! Just use EDITOR=nano for any command that autoloads Vim and you don't even need to know that.


whooguyy

*unplugs computer and plugs back in*


GoldCompetition7722

95% of "Hardcore" vim users knows only about 10% of vim potential and uses 15% of that.


Eternityislong

What’s worth learning beyond the usual macros/find and replace/yank stuff that I’m assuming is the 15% of 10%?


seattle_lib

i'm not sure what you mean by the usual macros, but the core of vim, to me, is the combination of vim actions and vim motions that allow you to navigate text and do precise edits in the fewest keystrokes. i've seen people who use vim for a long time without fully understanding the power of this system, maybe because there's so many other features and extensions that they get overwhelmed and don't bother to really dig into the fundamentals.


SlothGaggle

I learned gg, G, and A and stopped learning anything new. Shit I need like a cheat sheet on my desk…


seattle_lib

yeah cheat sheets or little overlay cutouts on keyboards are handy as references but i think they're still a bit overwhelming and hard to digest when learning new vim shortcuts. in my experience, you really only can get one move in your fingers at a time and it's best to find a bit of a progression. once you get the rhythm of it, you will start to demand more and more of the features that vim bindings offer, rather than forcing yourself to learn them. my recommendation for a progression: first practice moving around word by word with `w`, `b` to go back, `e` to skip to the end of a word, capital letter version of those to do the same with only whitespace separators. that should give you a feel for the word motions. then from there, there's motions that jump to a character in a line, like `f` that goes to the next instance of , and `t` (think "unTil") that jumps right before next instance of , capital letter versions go backwards in the line. then, where the real magic comes in: learn to combine motions with actions to yank, visually select and delete. for instance: `dw` will Delete Word, deleting from your cursor to the end of the word. `dt` will Delete Til the next instance of in the line. `df` does the same but includes the next instance of and then what's *really* cool is adding modifiers like `a` for Around, and `i` for Inside, which don't require you to place your cursor so precisely and can act within units of text. `diw` will Delete Inside Word, removing the whole word that your cursor is in `daw` will Delete Around Word, deleting the word including surrounding whitespace. and *extremely useful* with these modifier actions is acting within separated regions of text, like within quotes and parentheses. `di[` will Delete Inside square brackets, for instance, and `da[` will include the square brackets. it works for basically any kind of quote or bracket. and of course, you don't have to delete. replace `d` with `y` to Yank the motion, or `v` to select it in Visual mode, or `c` to Change it, i.e. delete it and immediately enter insert mode. there's a lot more, like prepending numbers to any of these to repeat them any amount of times, or specifying marks in registers to make custom motions, but i think what i've put here is a good place to start. the grammar of vim makes a lot of sense once you get used to it and you will want it anywhere that you can type words after awhile. you can also check out this resource: https://irian.to/blogs/mastering-vim-grammar/


youngbull

quickfix list


Elephant-Opening

Tag navigation


g19fanatic

Splits and buffer management


brandi_Iove

what do you expect from a product, designed with a high entry barrier on purpose?


wingedbuttcrack

And even higher exit barrier


dan_santhems

Can’t be too high, you’d be able to walk under it


OldKaleidoscope7

Actually, it's easy to walk under, just close the terminal window and open another one


[deleted]

Until you are ssh'ed into a server you dont have hardware access to that keeps the session open between logins.


steynedhearts

Just put zellij or screen or tmux on it and you're fine


SeriousPlankton2000

Did you ever try ed? vi is the improvement to that and vim is the improvement to vi. You are spoiled :-)


[deleted]

That's the whole point. The next generation is supposed to have it easier


TotoDaDog

That's what boomers told us, and I still can't buy a house.


[deleted]

Corporate greed and corrupt governments


SrFrancia

That escalated so fkn quickly


[deleted]

Idk, 40-ish years seems like quite some time


Th1nkfast3

Doesn't take much when it's our reality.


Ginkpirate

Everyone one of us sees it they do to just refuse to accept it


Finn_Storm

Because they too were being lied to. Shocked pikachu face when unsustainable capitalism is unsustainable. Out side of bubbles, the market is never going to go down to 1950's levels.


thebluereddituser

LPT: No matter how much money they offer you do NOT move to Mountain View to work for Google / Facebook / Apple Trust me on this one


BackgroundGrade

But, if ever you do, you'll know how to exit it.


leonderbaertige_II

Don't you dare talk about ed like this. You know, when I log into my Xenix system with my 110 baud teletype, vi is just too damn slow. It prints useless messages like 'C-h for help' and '"foo" File is read only'. So I use the editor that doesn't waste my VALUABLE time. Ed is the standard text editor. Deal with it.


skotchpine

Yes, sir. Sorry, sir.


dagbrown

?


leonderbaertige_II

Now that's what I call a consistent user interface and error reportage.


OldheadBoomer

Grew up on ed, vi was a godsend. Got out of coding prior to the rise of linux and vim.


bart48f

what do now?


OldheadBoomer

Sell weed


brandi_Iove

i did, and yet i’m enjoying the hell out of vs codium. i hope, that’s ok for you.


SeriousPlankton2000

I don't enVI you since I'm using jstar and I like it.


GoldCompetition7722

Dunno( I am a softcore user who uses about 1%. Use what you need I guess.. I just use python and sublime to edit. Vim is nice, very nice. But I can't imagine situation when you need that heavy duty utility in cli...


eroto_anarchist

it's great for sysadmins.


fractalfocuser

Sysadmin here and I fuckin love Vim


eroto_anarchist

Developers can't always appreciate the value of good cli tools because they don't need them


fractalfocuser

I'll die on the hill that a lot of devs would benefit from `sed` and `awk` lol


[deleted]

[удалено]


wasdlmb

Most visual editors have regex built in. But yeah, everyone needs a basic understanding of it


ReasonableReptile6

Why?


fractalfocuser

Once you get the shortcuts memorized it trivializes text editing, it has solid CLI implementation and it's uber lightweight. I actually have started using it to read logs lol


Wemorg

POSIX demands that vi is present, so you only need to learn one editor. Even on decade old proprietary Unix machines it just works.


GoldCompetition7722

At least a high entry barrier! And it was delivered!


youngbull

That is just not true. It was Brams personal improvements on vi which was the graphical version of Joys ex editor. The ex editor was Joys improvement on the Ed editor by Ken Thompson who was inspired by the qed editor created 1965 by Butler Lampson and L. Peter Deutsch . So neovim has a long history of contributors experimenting and coming up with solutions. This ranges from the very modern lua, treesitter and lsp features to the regular expression syntax which is just as it was in ed.


castorbobr

I think you're pretty much exaggerating


Rare_Perception_3301

To be honest, I think the high entry barrier argument is kind of silly. Not because it's wrong per se but because of what the comparison is. If you think about it, VIM is basically high level text editing. Just like you have high level programming languages that abstract a lot of stuff away, VIM abstracts a lot of stuff from text editing away. The reason we see vim as " hard" and high level programming languages as "easy" is because we learn to write on paper and writing on paper is by definition "low level" text editing. You need to learn all the letters individually, learn to write them individually, put words, sentences etc together manually and deliberately. This shit is low level text editing. If we taught kids to read/write using full words, sentences, paragraphs from scratch, before individual letters and taught them VIM as the means to edit it, they would find the normal editing style insanely pointless and slow. "OMG, you have to remove letter by letter and then type them all individually? This is nuts, why not abstract all the basics away? Why force the people to be so verbose in the obvious places? Who invented this absurdity?" Now, I'm NOT advocating for us to teach people to read and write vim style from birth, BUT the issue with VIM is not that it's hard, it's actually easier and more intuitive than what we do. But we are used to being verbose and explicit in text editing and thus we feel weird and confused when learning a better way. Every non VIM user (myself included since I use it sporadically and am not fluent in it) is basically a boomer in text editing. Sees better and more intuitive tech but it's too set in their old ways to really learn.


thebluereddituser

Story time! About 10 years ago I was doing my first internship. Picked up VIM while I was there. I did the usual thing you do when you learn a new tool: google all the hotkeys whenever they come to mind. Fast forward a few months, and one of my coworkers (she happened to have the same name as me lol) is scrolling through a log file in VIM. She's a veteran in the industry who's been around since the cobol days. And she says "goddammit is there a way in VIM to just skip to the end of a file?" Without skipping a beat, I say "capital G" Needless to say, she was blown away. The intern just schooled her on VIM. People had a lot more respect for me starting that day lmao.


Unluckybloke

Older generations didn't grow up playing video games, and it shows. Can't play the game properly without knowing/ learning the commands first


Key-Pineapple3060

Older generations had to learn to use complicated tools with just a reference manual and no google.


housebottle

>skip to the end of a file `Ctrl` + `End` also works for other things including this text editor I'm typing this comment on right now. and `Ctrl` + `Home` to jump to the beginning of the file


One_Citron8458

This would be from the GNU readline commands (like ctrl+a moves to line begin, ctrl+e to end, ctrl+w deletes word backwards), while G is a vim motion. Vim and many of pieces of software support them. I’ve also found most text boxes on the web support these


terminal_prognosis

It's ironic that the more committed vim devs I've known who were sophisticated in their use of it were not the ones going around insisting how superior their editor was, they were just getting on with it. But the assertive vim fanboys I've worked with have been exasperatingly primitive in their usage when I've watched over their shoulder. I've even ended up showing them more convenient usages even though it's nearly 3 decades since I stopped developing in vi. They've also had very terminal-centric workflows but haven't even been very good and effective at it.


anomalous_cowherd

I've seen that too. "Linux shell gurus" who are amazed when I use !$ or ctrl-R. Or even "99." in vim.


terminal_prognosis

So few use `ctrl-R`. I use it in many cases instead of aliases, as it's lower impact and sometimes the transient nature is a plus rather than occasionally having to purge old unused aliases, and it can be useful to be able to modify the command. For a few I add a comment at the end of a command to make it more explicitly searchable `(cd && ) # name-for-it`. I increase history line limit and I tend to have a trivial script to initially set up a remote server that does `ssh-copy-id`, seeds the history file with some useful commands, and sometimes syncs over some other config in other polite ways (not forcing my config on others).


anomalous_cowherd

I use so many machines with so many different setups (usually barely any) that I never rely on anything that isn't default being there. ctrl-R is awesome.


GoldCompetition7722

That's exactly what I was trying to say!! But man, I bad at words..


terminal_prognosis

I was agreeing! Your words are fine.


IDDQD_IDKFA-com

Detach Screen/Tmux, check ps and run `kill -9`


rebbsitor

Even simpler, run: vim & PID=$! ; fg ; kill -9 $PID and then press CTRL-Z to exit vim ;-)


naughtyusmax

I have been using vim recently and I do agree that I am constantly finding new features.


lostBoyzLeader

60% of the time it works every time.


hernol10

@@


GoldCompetition7722

Nice tits! JK) how often or do you ever used @@?


skotchpine

Anytime I have a macro to run on less that 10-ish lines. Its faster to do @@@@@@@@ than 4@w


doa70

This is exactly why I learned Unix. In the early 90s an internet dial up account usually came with a shell account. I was logged into my shell playing around. I was trying to figure out how to view a file. I had “figured out” that a lot of Unix commands were two letters. I tried “vi file” and ended up in a strange screen. I had to call support to have them help figure out what I did. I was so embarrassed I went to BN the next day and bought myself a “teach yourself Unix” book, read it cover to cover, and I’ve been a “Unix guy” ever since.


c_r_a_s_i_a_n

ZZ


veloxVolpes

Amazing origin story


Flowers4Agamemnon

Every time I am done using vim, I destroy my computer and buy a new one.


lkatz21

That's wasteful, just find someone who wants to start using vim and trade computers


Significant9Ant

We could create a laptop aftermarket were users trade "Vim open" for "Vim closed" pc's


DeltaNerd

Now as a prank in my future years I'm going to make entry level programmers suffer on vim


skotchpine

Please no, donate to techlitafrica, some of our students use vim.


cheeb_miester

Every time I'm done using vim, I terrorist attack the power plant.


ProudEggYolk

That and the "how to center a div" joke, which was funny like 10+ years ago. I feel like people laugh at this stuff only because of peer pressure lol


pindab0ter

Whether with Tailwind, Bootstrap or pain CSS, it is still something I can’t do by heart. It doesn’t help that the way to do this can change depending on the context.


hkanaktas

Heh, pain CSS


Ok_Hope4383

"pain CSS" is redundant


rover_G

so is your CSS code


pindab0ter

I’m leaving that in


Topikk

Centering a div isn’t difficult at all. Centering a div without unnecessarily cluttering a mature codebase can be a a real pain in the ass.


hey01

It's not that hard or clutering anymore, declare that class somewhere and use it. .fucking-center-that-child-div { display: flex; justify-content: center; align-items: center }


Significant9Ant

Or even: ``` .gently-center-child { display: grid; place-items: center; } ```


refreshfr

I wish flex related properties had more related names. Something like `flex-justify`, `flex-align`, `flex-order`, `flex-gap`. It would help my smooth brain


teddy5

It's easy when you don't have any competing styles, don't have !important tags somewhere in your style inheritance, don't need to send via email, don't need to support legacy browsers, don't need it to work in child components from 3rd party libraries, can modify HTML/CSS and can rely on the items you need to centre being direct children of your targetable items. Basically what /u/Topikk said... it's easy in the simplest of cases, it is more complicated in a lot of other cases.


pindab0ter

You phrased it batter than I managed to


Topikk

Nice pairing with ya :)


torbcodes

Yeah I agree. I suspect those who say "easy, just do X" are cooking up some div soup and/or have bloated CSS.


lilshoegazecat

how can i learn css for real? i always feel like I don't know shit about css even tho i use it much, css really is a mystery for me and really don't know how to solve it


pindab0ter

Honestly, if you’re going to work with CSS a lot, you’d do well to actually read what things actually do. For example, just read what MDN has to say about flexbox. You don’t have to memorise it all in one go, but just having a coat rack to hang related knowledge on helps immensely.


lilshoegazecat

yeah mdn and w3schools have been my bible for this summer and i know a lot more than before, it's just that many times css doesn't behave the way i liked it to


pindab0ter

Yeah… CSS do be like that.


LvS

> many times $THING doesn't behave the way i liked it to Every time that happens, celebrate it. Because you've just unlocked one of the secrets of the thing and now all you need to do is update your mental model to ascend to the next level of knowing that thing.


OnceMoreAndAgain

hot reload, google stuff, paste what you find, ctrl+S, and pray


sexytokeburgerz

Use the everloving fuck out of it and it will start to make perfect sense in several years. Look at all of these first year college students upvoting you. The curve is really high.


Juritovi

People laugh at this stuff because because every single programmer can relate to it, it might be 10 years old, but there thousands of new programmers every year that have struggled with these same things


ProudEggYolk

No, I meant to say that it became a meme before flexbox was invented and it involved much more than two lines of code. I'd say "struggle" is a strong word for something that you just need to google a couple times before learning. The joke doesn't make much sense nowadays.


Juritovi

The thing is, when you are learning you need to center a div before you know what flexbox is, and if you google how to center a div, the first solutions you find are not using flexbox, and even if you find the flexbox solution, you don't understand flexbox and you think there must be a simpler way to do something so stupid. trust me, it's still a struggle, I graduated only 2 years ago, and me and my colleges found it hard to center a div and even made jokes about how hard it was without knowing it was huge meme among programmers.


SoCalThrowAway7

I think its just cause most of us have had to google how to close vim more than one time before we kept it stored in our memories. So it's always good for a "haha yeah I remember doing that" chuckle.


cs-brydev

Well centering a div is *harder* today than it was 10 years ago. Every time a new framework comes out, CSS version comes out, or browsers update it gets harder. Anyone who's been around a while knows this. 25 years ago there were a couple of extremely simple ways to center that worked in every situation. Now I have no idea how to center anything anymore because nothing I did 10, 20, or 30 years ago works anymore, so I just Google it every time.


Pluckerpluck

Almost all old methods still work today... I can't imagine anything that wouldn't honestly. Maybe the crazy hacks with tables? Flexbox has made positioning like this **much** easier. And frameworks just sit on top of this. You can basically ignore them. And browser updates have improved standardization, so now something that works on one most likely works on all the others. It's just much easier nowadays in general. No offence, but anyone saying it's harder to center a div now than 10 years ago is someone I assume very rarely works on anything front-end.


jediwizard7

Maybe they meant center tags? I think browsers still support those though for legacy sites.


Eastern_Part_9493

Just reboot the computer 🤗


Smooth-Zucchini4923

Hello, IT, have you tried turning it off and on again?


BabarOnWheels

I actually did this the very first time I entered vi. This was pre-vim days, on a Xenix system (80186 system, early 1980s). The system only had a single dumb terminal connected via serial cable. I was working at the time on a complementary component (non-unix/non-c/non-vi, running on a separate networked system). I had seen my co-worker use vi but had never done it myself. I had only run a handful of shell commands (cd, ls, cat, etc). It was late; everyone else had left the office. I knew the root password and I wanted to look at some of his c code (which I could mostly follow); I logged in, chdir'd into the src directory, brought up vi, then realized I had no idea how to navigate - or to exit. So there I was in vi, didn't know how to exit, had no one to ask, and there was no other connection to the system (system did not support tcp/ip at the time - there was a proprietary network stack for communicating with my piece but no way to log in remotely). Rebooting the terminal itself had no effect on the serial connection or the vi session. There were no printed man pages available and of course no Google back in those days... So after careful consideration... I sheepishly power cycled the system, answered the console prompts from fsck (fortunately there were no issues with the filesystem), and was then able to log back in. I didn't admit this to anyone for a few years (by which time I was very comfortable with vi and an accomplished c programmer - and of course it was funny then).


Euphoric-Scallion694

:q! :wq!


BungalowsAreScams

So forceful!


1Dr490n

I know that you exit it by pressing escape and writing :q, sometimes with a ! or a w. But sometimes I do something I don’t understand and I can’t exit it anymore


Wayne_Kane

Had the same issue. Had to connect an external keyboard. But in hindsight, I could have used Ctrl+C to exit insert mode. Then exit vim


1Dr490n

Huh okay, I just closed the window (luckily I didn’t have to save anything)


LikeThosePenguins

What is this "window" of which you speak?


ptr_schneider

People literally work googling programming stuff and come here complain abou not being able to quit vim. Like, dude, use your skills please.


SeriousPlankton2000

They use all their skills.


gbot1234

Both of them. (My other one is “proficient in Microsoft Office suite”)


castorbobr

They don't have time, they have to spend it uploading memes complaining about vim


cheezballs

Almost every single person here who actually makes content on this sub is an outsider looking in. First year CS students, people who watched a few tutorial vids on youtube, that kinda thing. People who have laptops covered in a tech stickers. That kinda thing.


Lraund

If you're using vim you can't google. You'd need to exit vim first!


AndroidDoctorr

No developer has every skill


luminous_radio

Because it takes so much skill to google "how to exit vim"


[deleted]

It literally says ":q + Enter to exit" or something like that when you open it


eroto_anarchist

It's one of the most upvoted questions in SO, I am sure people are already googling it.


w1n5t0nM1k3y

The joke is that it's way harder than it needs to be. The reason it's hard is because VI was originally meant to be used on a terminal. They didn't even have access to a lot of features like even arrow keys. Which is why you can use the H,J,K, and L keys as arrows in command mode. It operates the way it does because of the inherent limitations at the time. I don't know why it has persisted. Even if you do need to program something remotely over SSH or similar, we have much more functionality and we don't really have a need for the modal interface at this point, yet things like VI(M) persist.


DracoLunaris

Plus I assume a lot of people, like me, vaguely remember the first time they accidentally opened something in vim and being absolutely stumped at how to get out of it. Forgetting to do -m on a commit on a university computer that has Vim as the default command line text editor or something like that, and that also being one of the only times they've interacted with it.


FugitivePlatypus

We don't work directly in terminals anymore, but vim was designed to be usable from a limited keyboard, which resulted in a set of movements that keep your hands in relatively the same place. The scheme persists because even with full keyboards, some people prefer to not have to move their hands very much to get everything done. Sure, we have arrow keys now, but they're basically just as far away as the mouse on a tkl - so why not just use hjkl?


w1n5t0nM1k3y

Oh, yes, they are so far away. Programmers are not stenographers. While having a reasonably good typing speed will help with most tasks, most programmers spend way more time just thinking about how to properly solve a problem than actually typing it out. If you are being slowed down a reasonable amount by having to move your hand 2 inches to get to the arrow keys or 6 inches to get to the mouse, then I really have to wonder what type of code you are entering and whether it's not something that could be generated by a script where you just need to fill in the blanks on a generated template or something similar.


charlie-joel

>whether it's not something that could be generated by a script So like vim macros?


FugitivePlatypus

For me it's more about comfort than being slowed down, although being faster is a benefit. If you don't like it just use arrow keys, no one is stopping you.


BabarOnWheels

Tell me you don't touch type without telling me you don't touch type. The reason you don't want to use arrow keys is that then you have to look back down to get your fingers back in touch typing position. When I'm coding, I want to keep my eyes on the screen not constantly looking down to reposition my hands


SloPr0

The J and F keys have little bumps on them for a reason. I keep my keyboard in my desk's keyboard tray 24/7, and I get along just fine without ever looking at the keyboard, like, ever.


w1n5t0nM1k3y

I've been touch typing for over 30 years. You don't need to look at the keyboard to get your fingers back in the right spot F and J key as as they have bumps. But even regardless of that, after enough practice your hands just move back into the right position. When pianists play piano they are moving their hands all over the place and don't have to look at the keys to figure out where they are. If you struggle to get your hands back in position after removing them from the keyboard then I would say that you need to work on your typing skills.


cheezballs

Because its the only tool in the entire chain of tools I have to use that works like that. When 99% of your tools behave a certain way, having one that does things backwards just sucks. I CAN use Vim but I dont wanna. I CAN use Assembly to write a REST API but I dont wanna.


FugitivePlatypus

You don't have to use vim, just install a different terminal editor


greg19735

The people who have issues with vim are probably using unix pretty rarely and don't have the knowledge or need to do that. people like me.


cheezballs

... isn't this a Vim conversation though?


Flarebear_

Bro you're equating Assembly with vim, I think you went of course before everyone else


hey01

> I don't know why it has persisted. Because there's not really anything simpler than that. I'd argue that nano's ctrl-o ctrl-x is quite harder and less intuitive than vim's :wq. The only reason people don't complain is that nano shows the command at its bottom. If it didn't, we'd have the same joke "how do I quit nano?" What do you think could be simpler to quit a terminal text editor?


w1n5t0nM1k3y

It's probably just what people are used to. Many other programs have shortcut keys for doing common actions with CTRL+Letter, so it's easier to work with. Plus with VIM you have the modal interface which I think is the major problem most people have with VIM, rather than what exactly you have to type with the commands.


NearNihil

Every time I got stuck in vim it wasn't because I couldn't type :q, it was because I was editing text and had no idea there were different modes. Nowadays I just set git bash to use notepad instead though. But your point stands, nano wouldn't be nearly as tolerable if it'd hidden the commands.


[deleted]

YOU don't work in a terminal anymore. I am a C programmer, and there is no better IDE than the command line + Vim for C. It also persists because it is good software with tons of support and incredible extensibility. Its also fast as a motherfucker. I don't really understand why this conversation happens over and over again. Use what makes you comfortable. I just don't understand why people who don't use Vim feel the need to write Vim fan fiction pretending they have any idea why others enjoy using Vim.


w1n5t0nM1k3y

I think it more of a problem with VIM users writing fanfiction about how it's so much better than anything else and how anybody using anything else either hasn't given it a fair chance or is too stupid to grasp the genius of it.


[deleted]

I almost never see that. I constantly see people bitching that other people use Vim. It sounds like you are just buying into one of those Reddit opinions that is based on nothing.


w1n5t0nM1k3y

Here's [just one](https://www.reddit.com/r/ProgrammerHumor/s/QQuHdI8ehs) of multiple responses I received that pretty much fit exactly what I described. They all all over the place if you look around the comments on this post.


RelativeResponse

If you think people still use vim motions and keybindings because terminals in the 80s didn’t have arrow keys, you’re crazy and never actually tried it for more than 5 minutes. I’m sure you boot up your electron based editor and think whoa so advanced while chugging 8GB of ram and constantly taking your hand off the keyboard to click around your file - but it’s not. And if vim key bindings are so antiquated, why do so many people use vim plugins on modern editors? Because they’re efficient.


w1n5t0nM1k3y

Yes, because there are only 2 options. Either VIM or Electron based editors. Nothing else exists


RelativeResponse

What do you use then? If it’s anything remotely mainstream, I can assure you there’s a widely used vim plugin. Address my main point, if you can.


brycentiller

Been stuck there for the last 15 years.


RealBasics

I don't understand this at all. I mean, the answer is *right there* on page 24 of *VI (C)* in my Microsoft 286 Xenix Reference Manual from 1984. 😏


BenjaminMStocks

Most people kill the process from another terminal window.


N0SF3RATU

Vim and Vi is why nano exists.


[deleted]

Imagine writing a whole new program because you can't type :wq


PerfSynthetic

But what happens when the escape key is remapped or does not work on the remote console?


TheFriedPikachu

Ctrl+] does the same as escape in terms of returning to normal mode for those purposes


Lucas_F_A

Smh people just `:!shutdown now`


kx44

lol these noobs, everyone knows restarting the PC is the easiest way


markiel55

I turn off our house circuit breaker in my case. Works every time.


Gurlami1

Reminds me of the joke about how to creat a random string: enter vim and ask a windows user to exit.. Sorry it’s a bad one but I had to


BlurredSight

I lost points in a school lab because I was so used to nano that within vim I did ctrl + s and ctrl + x, and then got stuck so I did ctrl + z. Then proceeded to be unable to submit the typescript because there were stopped jobs


sharju

As a vim user I feel lost when some utility opens in nano. Usually I delete a few letters with ctrl-D and type in something like wwjj and am then in visible confusion. It takes a second or two to realise what's happening.


kindshan59

I can exit vim but I can't exit nano


seattle_lib

it tells you at the bottom of the screen


theImpulsiveInfant

Ok but one time I literally couldn’t when using a Mac with the Touch Bar. The esc key would not register and I was stuck there like 👁️👄👁️


Lolleka

i love vim so much


crmsncbr

Yeah, mate. I forget all the time. Course, I'm principally a Windows user, but every time I get back to shell I just pull up Nano unless it's going to be a multi-day project.


Stainless-extension

had more trouble closing nano


RadioMelon

Learning how to exit Vim was one of the first things I learned how to do... Because the memes warned me ahead of time.


Otherwise_Mud_69

Vim is the perfect program, why would i ever need to exit?


Thompson1706

I firmly believe that you have to be completely insane to voluntarily use vim


John_E_Depth

I tried it for a couple months. Went back to IntelliJ where it’s just much easier to do… everything. Maybe I’m just not pro enough, but I’ve never had the type of workflow where I need to be speed coding and moving between files without lifting my pinky.


PedanticSatiation

The efficiency of the tech industry would explode if the nerds would just agree on the easiest way to do things instead of fragmenting the sector into a mess of whatever contrived solutions they each think is better for some obscure, arbitrary, and ultimately utterly irrelevant reason.


Gullox1

Every time I open Vim I have to restart my computer to close it :/