13 ms·
What Is Vim?
- cutler 2y ago"Vell Vim's just zis guy, you know"
- deleted 2y ago[deleted]
- lproven 2y agoThank you, Dr Halfrunt.
- j7ake 2y ago> There's a Vim mode in every single mainstream code editor out there Not Jupyter notebooks though (by default)
- dallbee 2y agoCho 55
- tom_ 2y agoI guess. Wake me up when you can enable Emacs mode in vim.
- lambda_lord 2y agoHelix uses a selection-first action model: you select the word/paragraph/whatever you want to perform an action on, then you change/delete/whatever on that selection. I think this is more intuitive than the "verb object" model Vim uses: if you get your selection wrong in Vim, you then need to undo the action and try again. In Helix, I can see what I am about to manipulate before I make the action. I think at this point Vim wins out for being so ubiquitous, but I wish the Helix model took off first.
- drekipus 2y agoThat's what I really enjoy about helix (and kak) - a different approach to the modal editing paradigm. I'm still stuck on neovim for now, but progressively I'll make my way to helix I think.
- sprobertson 2y agoI use both in vim - if the selection is tricky use v or V to define the selection first, but most of the time "verb object" makes sense to me since that's how english works (tho could see it being unintuitive for non-SVO languages). "delete the next word" or "change inside the parentheses" roll off the brain and into the keyboard
- tom_ 2y agoI remember thinking roughly the same thing when I was a regular vim user. This was a long time ago now, so I forget the details, but from memory I used to use visual mode quite a lot, meaning I'd get to use the motion commands to select the region of interest first and then choose the operation to perform on it. The typical vim model is a bit weird, but once I got practised with it it was actually quite surprising how much complicated stuff I could do purely by sight. But while the muscle memory aspect got me further than I'd have expected, it did only get me so far. Selecting the region first always seemed like it'd be the better way in general, being no worse when your fingers can do it automatically, while being better in the case where you're having to think about what you're doing.
- srik 2y agoTo achieve something similar in vim one could use visual selection first and then run the verb on it. Helps with spotting mistakes or just tweaking selections in general. It is a tad bit tedious but a small bonus is `gv` which invokes the previous visual selection at a later point. That said selecting first isn't perfect because large selections often move the viewport around especially on small screens and that's really annoying but ahh that's life, always with the compromises.
- ericjmorey 2y agoThe lead of NeoVim indicated that it would be possible to make this "grammar" an option for users. He didn't seem like it was something that's high priority, but he definitely was open to PRs to implement it.
- mmahemoff 2y agoLearning Vim early on had a high return on investment for this reason. Years later, I'm still able to benefit from the same muscle memory in modern tools, e.g. Obsidian. It should be said, though, that most implementations are simplified rewrites of Vim's core functionality. When you use a tool to achieve a sense of "flow", it can be grating for the editor to behave in subtly different ways from expectation, or discover an important feature does not work at all. Also, there tends to be limited, if any, support for Vim plugins. In the modern era of Vim and NeoVim, it's possible for such tools to use the real version via network protocol, but integration is easier said than done. So far it's mostly been Vim GUI wrappers that leverage the capability rather than independent editors. I still use Vim mode where I can even if it's a shadow of the real Vim experience. It makes life easier to use the same muscle memory on every shell, editor, and command-line, and not have to worry about learning every new app's idiosyncracies.
- dylan604 2y agoLong ago, I learned video editing on a CMX tape based system. The key bindings on that system remain in place in pretty much every video application today. (Spacebar => play/pause, j/k/l => reverse/stop/forward, i/o => in/out) Sometimes, keybindings just make sense and for them to not do it definitely as you say feels disturbing. For new apps that don't, it's like did you live under a rock in a cave and never see any other preceding program that you are making, or do you honestly think yours is better. I can assure, they aren't.
- nyrikki 2y agoNever touched a CMX, with the EditDroid being the oldest I ever saw and it had a trackball/scrub knob. But the vi keybindings are directly from the LSI ADM 3A terminal, which is what Bill Joy wrote vi on. It had overloaded hjkl for the arrow keys compared to it's predecessors like the 7700A and successor 3A+ that had dedicated arrow keys. The fact that Home/~ were the same key thus ~ being your home directory and that esc was where the tab key is on modern keyboards explains a lot about the vi keybindings.
- chrismorgan 2y ago> There's a Vim mode in every single mainstream code editor out there. And they’re always frustratingly incomplete and/or buggy. Some motions will be unimplemented, or will behave incorrectly, especially with regards to boundaries around whitespace inclusion or exclusion in a motion. Things you added to Vim and got used to are unavailable, and so your ysa") to put parentheses around the string your cursor is on just doesn’t work. (Lack of vim-surround definitely gets me frequently.) In VS Code, it maintains its own undo stack, and the interactions between the two undo stacks are terrible and terribly frustrating—yet doing without might be even worse, because they behave very differently. And too often in a browser context, ^W will close your tab, losing data, rather then being inhibited and erasing the last word, as it should. That one is practically unforgivable in a Vim mode, yet common. That, more than anything else, will make me avoid a Vim mode.
- 8f2ab37a-ed6c 2y agoThat's been my experience as well. I tried a few times to make my regular vim bindings + plugins to work in Rider and there's always that last 5% that seems to not work quite the way you'd expect, even for supported plugins. Bummer.
- __MatrixMan__ 2y agoYep, it's apparently easier to move your IDE into vim than it is to move vim into your IDE. The only vim mode I've met that wasn't infuriatingly incomplete was emacs evil mode.
- teeray 2y ago> And they’re always frustratingly incomplete and/or buggy I refer to this as the Vim Uncanny Valley
- JadeNB 2y agoFeature request: `:vuv` causes vim to replace native operation by a broken, buggy half-implementation. Optional enhancement: LLM learns your favorite commands, and makes sure that they specifically are broken.
- stevebmark 2y agoAgree that Vim is a language to talk to your computer, but it's not necessarily efficient. Vim is famously an imperative editor: You have to tell Vim the sequence of steps to perform. Clicking your mouse on a position on the screen is declarative: You declare you want the cursor here. With Vim you have to imperatively walk the cursor to where you want to go, or god forbid use something like easymotion.
- dylan604 2y agoThat's like telling some small child they are lesser because they can't walk because they're still learning to crawl. The systems that vim worked on didn't even know what a mouse was.
- eloisius 2y agoYou can, in fact, click to set the cursor position and even click and drag to select.
- rwiggins 2y agoSetting aside that you can enable mouse mode in vim and use the mouse to your heart's desire -- and setting aside the "declarative" vs "imperative" nomenclature debate -- vim is pretty dang efficient. Typing `gg` to go to the beginning of a file, or `G` to go the end. Or all the other variety of motions. There are a lot. Also, there is not necessarily any need to move the cursor anywhere. For example, if I'm in the middle of writing some string and I've decided to change the whole thing, `<ESC>ci"` does that, with no cursor movement required.
- tolciho 2y agoIt is imperative in certain editors that you fumble for the mouse whilst in vi one can simply declare 3ff to get to the third f on the line. Granted, I mostly do not use certain editors, and accidentally compiled mouse click support out of the terminal—brushing the trackpad risked spamming programs with mouse noise, and some programs would sometimes do silly things with it. The mouse is fine for focusing terminals, I guess. (No, not vim, vi.)
- Lio 2y ago
- hashkb 2y agoI love this take. I was a die-hard Vim/Neovim zealot... but these days I absolutely love the ecosystem of tools that support normal mode. For so long hand-cramping emacs keybindings were sort-of-standard-in-a-few-places. If you're not convinced vimming is the best way to interact with your editor, you probably haven't seen a really proficient vimmer.
- cassepipe 2y agoAnd meanwhile in every thread or article about vim, it is very rare to mention remapping Caps Lock to Escape (or the other lesser IMHO lesser options ) even though one third of user do it. The other two third are deluded tool fetishists that are ready to suffer that their most important key is the furthest away from the home of row because "you get used to it" even if that's just an unfortunate historical accident. I would have not stuck to vim at all if not for this one trick and I suspect that's the main reason behind many dropouts
- Lio 2y agoLOL this made me chuckle. :) I always remap caps to ctrl because ctrl-[ is an acceptable escape key for me as I like to use other insert mode shortcuts. Eg ctrl-h, ctrl-m, ctrl-k etc. I know some people map to escape/ctrl when held but that usually means installing something like Karabiner.
- cassepipe 2y agoWell then you should mention it when talking about vim to non-vimmers as not to leave them in the dark with the defaults. The question is not what solution you found to avoid the Escape key but that you did. And even though you are probably used to your solution having the most important key in your program be a weird combo is not great imho. And you are missing out on bash/zsh/gdb and other command line vim modes.
- Lio 2y ago> And you are missing out on bash/zsh/gdb and other command line vim modes. I'm not at all, ctrl-[ is a terminal thing. It's available everywhere as are the the other ctrl shortcuts I mentioned.
- FpUser 2y ago>"Wha Is Vim" Something I've never learned. Not proud of it but I do not think I am missing anything either. I write native software for Linux for living at the moment.
- cbsks 2y agoNo time like the present. Give it a try. Even if you just use it for editing /etc files it’s much more efficient than nano. Don’t be intimidated by the huge feature set. I’ve been using it practically daily for 25 years and I still only use a small fraction of the available commands.
- FpUser 2y ago>"Give it a try" I have. Not my cup of tea. Small file I edit in nano / whatever else. Anything serious is remote editing using some IDE. The terminal I use also has SSH file browser where you can click on file and edit it locally using any editor. It will be saved back to where it came from.
- theonething 2y ago> I do not think I am missing anything either How could you possibility know that unless you're familiar with Vim?
- FpUser 2y agoI played with it and do not think I need it.
- Lio 2y agoI don’t think there’s any reason why you have to learn Vi/Vim. I think someone could go their whole career without that. That seems like a perfectly legitimate choice to me. …but, I learned vi somewhere between less running on MSDOS and an embedded programming course at uni in the 90s. I’ve used the those shortcuts in database clients, shells and web browsers, etc. ever since. That’s a long time and a lot of value. It’s payed off so much that I don’t really remember if it was difficult to learn; I just use the keyboard and get the edits I want without much thought. Being able to know something like that and bring it with you across operating systems has been useful. I’m pretty sure it will still be useful in twenty years time.
- ggm 2y agoEven though I wince at mis remembered muscle memory using it, I still wish nvi had progressed a little further. I mostly turn off vim features. Default cut-paste with code indent is a giant mismatch. It's cruder, and itself a mishmash of non-joy code, but I found nvi suited me well for decades on netbsd and freebsd, and I use it still. I do run the port on osx but somehow each upgrade I find myself slipped back into vim. And on debian and the like. I live in Emacs for org, and vi for code edit. Happy mix these last 40+ years. Sometimes it's hard to recall that ex exists, inside vi. But if you do any :command that's where you are. Inside a simpler editor landscape embedded in the visual world. Ed is a sometimes tool. Always gratifying to use it!
- syndicatedjelly 2y agoI recently gave up on VSCode because the Vim mode is still substandard, missing keybindings, and constantly glitches out in new and fun (read: not-fun) ways. I’m just gonna use NeoVim and program the IDE myself, in a true moment of going super-saiyan as a programmer
- danielvaughn 2y agoI’ve yet to get sucked into Vim, though I’ve given it a shot on a few occasions. I just feel too much muscle memory with whatever you call normal editing. One of these days I want to really stick with it because I do love the verb/action/modifier idea. I’m even building a similar keyboard-driven editor for building UIs. It has commands like “s a i” (select all images), “a t n” (add text element as next sibling), etc.
- teeray 2y ago> I just feel too much muscle memory with whatever you call normal editing. You end up the same with Vim eventually. After almost 13 years of using it, I sometimes have to actually type the things I do to articulate what command it is. I also had a moment where someone said, “it’s just like the ‘p’ command in normal mode” and I had to really think about what they meant—in my head I’m just like “put line” and it just happens.
- adamnemecek 2y ago[flagged]
- __MatrixMan__ 2y agoWould you say that software, in general, is improving in the year of our lord 2024? We may have taken a wrong turn somewhere. Going back may be the answer.
- adamnemecek 2y agoOk, if Vim is supposed to be an improvement, may god have mercy on us all.
- temporarara 2y agoVim stands for "Vi IMproved" so it literally is meant to be an improvement, and IMO it really is although plain old Vi is still better than most editors.
- __MatrixMan__ 2y agoEvery time I try to use vscode I start losing time because within a few months I become involved in some kind of diplomacy between the maintainers of vscode and some adjacent component over a bug that neither wants to own. Stuff just works in vim. So uh yeah, definitely an improvement. And re: may god have mercy on us all... Yeah it's not looking good. I'd really like it if we could get our shit together, but ever since we put the marketing people in charge the engineering has been looking increasingly flimsy.
- adamnemecek 2y agoThat's because vim does very little.
- __MatrixMan__ 2y agoAgreed, it doesn't suck because it has only one job to do. One master. Me.
- AdieuToLogic 2y agoVim is efficient, in that there is no need for one's hands to leave the keyboard. Vim is succinct, in that what is needed often takes less commands than those less frequent. Vim is pliable, in that can be made to do whatever you wish. Vim is everything, vim is nothing. Mastering vim is to find Zen made possible by an exponential command space.
- wycy 2y agoLearning vim was one of the best things I did for myself at work. Completely changed everything about the way I work and made me so much faster.
- steve1977 2y agoArticle mainly seems to talk about vi, not vim. But I guess the author doesn't know where vim is coming from.
- revskill 2y agoExpecting with bad assumption means you want a war.
- smusamashah 2y agoHow do you explain "w" and "wq" to save and quit the editor with "verb adjective object" model? These two and "i" is all I remember about vi. Or is vi a different thing from vim and this model doesn't apply?
- MathMonkeyMan 2y ago"w" and "wq" happen in command mode. "verb adjective object" happens in normal mode. Command mode is more like ed. vim is vi "IMproved." Just a more featureful version.
- cassepipe 2y agoI don't understand why people keep talking about :wq when :x has been a thing for so long now
- philipwhiuk 2y agoBecause :wq is sufficient and I need :w and :q! anyway
- cassepipe 2y agoset confirm
- metaltyphoon 2y agoThis is probably because :X encrypts a file so too easy to make that mistake?
- marliechiller 2y agoI dont understand why people even do that when ZZ is easier xD
- cassepipe 2y agoI disagree that's two combos (Shift + z) on awkward key whereas you should be used to : by now
- alienchow 2y agoVim is this editor that a senior backend engineer told me to go try for a week, when I was still relatively junior. Like really try to remember all the shortcuts, not some half-assed attempt then laugh about not being able to remember <esc>:wq. If I were able to demonstrate fluent Vim skills at the end of the week, he'd gift me his TKL mechanical keyboard with a Vim keycap on the escape button. It's been 9 years since that challenge, and I'm still typing on the Filco keyboard. Good memories. Although I've since moved on to NeoVim for the LSPs. It's nice that I can freely edit files on any machine for something I picked up in a week.
- cassepipe 2y agoYet another article about vim that does not mention remapping Escape even though it's a dumb historical accident that the most important key is the furthest away from the home row.
- sexyman48 2y agoimagine you would remove the functionality that Vim mode in VSCode gives you from Neovim. imagine you what?
- philipwhiuk 2y agoI think the author is not a native-English speaker. They mean > imagine if you remove the functionality that Vim mode in VSCode gives you from Neovim.
- rikafurude21 2y agoIt still doesnt make sense. If you remove vim mode from neovim you have... Nothing?
- eonmist 2y agoTo me there was a distinct "aha" moment when the "vim language" suddenly made sense. Makes me think of when kids suddenly discover how to read.
- kazinator 2y agoVim is not only an editing language, but a fast-starting editor with a small-ish native executable, and small run-time memory use. This facet is typically not ported into other editors that have a Vim mode. Vim runs natively inside virtual machines and containers, on resource-constrained embedded systems, and on remotely accessed machines. Another aspect is that Vim can be operated entirely using a terminal emulator, and so can be running on a remote host to which the use only has a SSH or serial connection.
- trollbridge 2y agoWell said. I use nvim with all kinds of plugins and a custom init.lua, and then I use vim (or nvi) when something goes wrong with my init.lua, and nvim won't start, or when I want to quickly open a file really quickly and not wait the second or so it takes for my nvim setup to load. Likewise, vim lets me do local editing on any system I connect to as there's rarely ever a Unix left that doesn't have vim installed. (Back when vim was the new kid on the block, I said the same thing about stock ex/vi - I made sure I was comfortable editing in vi, and then I never felt uncomfortable when I had to do work on a remote system.) Another benefit with vim or nvim is how easy it is to copy someone else's full-featured setup: one of the programmers I work with is really into nvim, and he figured out an ideal setup for both working on Go and Python code. Then he just shared his setup with me. Copying someone's VSCode setup with plugins and all and getting it all to work would be a multi-hour ordeal.
- xcrunner529 2y agoWould you mind sharing the python setup? So many options and it’s overwhelming for someone looking to switch from vscode.
- Zizizizz 2y agonvim/.config/nvim/lua/plugins - `blink.lua` (auto complete drop-down) - `dap.lua` (debugger) - `lsp.lua` (language server ruff and pyright setup)
- gorfian_robot 2y agovi is fine. never seen the need to get all fancy with vim.
- dartos 2y agoGive it time.
- gorfian_robot 2y agoit has been 40 years ...
- h43z 2y agoMy ode to why speed even matters https://h.43z.one/vimsteps/0 https://h.43z.one/vimsteps/0
- linsomniac 2y agoI was in a PyCon presentation about the Python bytecode when I came up with the idea that vim editing commands are a bytecode for executing text manipulation.
- p0w3n3d 2y agovim is an operating system that allows also editing files
- alabhyajindal 2y agoIsn't this an emacs joke? Hearing this for the first time for vim.
- slightwinder 2y ago> There's a Vim mode in every single mainstream code editor out there. Is it really a vim-mode, or a vi-mode? I mean, most of those are already very limited, but does any of them actually support vim-specific evolutions/changes? And isn't the real question here: where does generic modal editing end, and when does vi(m) starts to display its specific personality?
- beacon294 2y agoI've been using vscode in java because of the cumbersome file navigation in bash. Is there easy full tree navigation in vim? It may also be because the terminal view is much smaller than vscode's smaller navigation font so I can see much less of the file tree in a terminal program such as ranger. I also never really mastered windows although I did master vim buffers. I do use tmux.
- penguin_booze 2y agoIn my workflow I've integrated both ranger file manager and fzf as file pickers: fzf when I'm inside a git repo ('git ls-files | fzf' - but doesn't have to be this way), and ranger for elsewhere. Both ranger and fzf are amenable to being used for this purpose, so all it takes is a couple of lines of hand-rolled vimscript - no need to wait for a third party integration plugin to drop.
- beacon294 2y agoWhat's a rough sketch of your idea for the vimscript?
- delta_p_delta_x 2y agoI am too stupid for Vim. The bottleneck is my brain, not my typing speed.
- liontwist 2y agoHere is some material to challenge that idea: https://danluu.com/productivity-velocity/ https://danluu.com/productivity-velocity/ Is also funny to phrase it in terms of bottlenecks because bottleneck optimization is an 80/20 approach to performance. People who are serious about perf don’t practice it. 80/20 is good for once a month tasks. When it comes to the primary work I do everyday I don’t want to leave 20% on the table.
- delta_p_delta_x 2y agoI spend maybe 90-95% of my time thinking, looking up existing code, reading documentation, solutions, and code exemplars online, and trying to engineer a solution either in my head or on paper. I spend at most 10% actually typing. It's just not something that I've really ever felt has slowed me down.
- nouveaux 2y agoAs a modern day tech person, you only spend 4 hours a week on your keyboard across browsers, email, messaging, command line, etc? What about your personal life? Even then, learning Vim could improve your computer interactions easily by 10%. That's 40 min a week or ~34 hours in a year. https://xkcd.com/1205/ https://xkcd.com/1205/
- delta_p_delta_x 2y agoI mean during my work hours I spend the majority of my time reading and thinking rather than programming. In my personal life I try not to program. I do other things.
- liontwist 2y agoDid you look at the article?
- favflam 2y agoIs anyone here using Lazyvim? I switched to this from VS code and it feels much more productive and lightweight on my computer. I never got into VIM before until I saw some Youtube personality using Lazyvim.
- lproven 2y agoI think this is a classic example of Unix-induced tunnel vision. Because Vi[m] is just one example of a keyboard-driven UI that has been adopted in other places, whereas in fact there's a more common one that's used by more people on more computers every day... but it's not widely known that it's a thing and it has a name. It's IBM CUA. https://en.wikipedia.org/wiki/IBM_Common_User_Access https://en.wikipedia.org/wiki/IBM_Common_User_Access It is what defines the keyboard interface of MS Windows, and tens of millions of skilled Windows users use parts of CUA every day, from Alt+F4 to close a window to Ctrl+S to save to Ctrl+F to find to F2 to edit. For blind and visually impaired users it is the sole or primary UI for Windows. It is also largely supported in multiple Linux and FOSS desktops, such as Xfce, Unity, LXDE, LXQt, MATE, and others. Sadly, KDE does not implement much of it, and modern GNOME almost none of it. But it's there and most Gtk desktop apps support some of it -- although Gtk4 is driving that out now. CUA provides a whole set of consistent keyboard controls for DOS, Windows 3.x, 9x, NT, 2000-11, OS/2, and almost all the Linux desktops until GNOME 3 came along. It has editing keys but also far more. A skilled person can drive all of a Windows computer, and all apps, as quickly as a skilled Vi[m] user can -- well, can edit text and nothing else.