Earlier quoted context omitted.
I've always thought that doing 5dd and such was a bad demonstration of Vi(m) since I never know how many lines to delete. I'll just dd multiple times. More powerful vim commands are like daw (delete all of a paragraph), di) (delete inside of a set of parentheses), and dtX (delete until the character X).
daw deletes the word you are in (delete a word). But dap deletes a paragraph. And you can tell vi what you mean by "word" and "paragraph" (I think) in your settings file.
Bill Joy's greatest gift to man – the vi editor (2003)
151–160 of 186 posts
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#152For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#153Earlier quoted context omitted.
"This is especially important if you have to edit a file on a remote server" This may have been true a decade ago, but editors like Visual studio code now have remote editing abilities over SSH. I regularly have 50+ files open at a time for editing/compiling and I've never found editors like VI very helpful. If I need to make a quick edit to a config file, it does the job.
Now imagine that SSH going from a Citrix windows desktop running on a Windows 10 VM on your linux laptop. Every key press reacts in around a second. Welcome to banking "security"! Now let's say I want to `d5}`, to delete the next 5 paraghraph. In vi(m) I can do this by telling it "hey vim, delete those 5 damn paragraph!" In fancy VScode I have to say more like... "Hey editor, wait a sec, I'm moving my cursor over the…
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#154Earlier quoted context omitted.
Unfortunately, the barrier I faced with even trying VI is that you cannot discover any functionality intuitively. Exaggerating (but just a little) I could not even figure out how to type without someone giving me a tutorial. That was enough to make me stop.
I agree. You need to use vimtutor to get the basics: the simplest modes (insert, normal), the simplest normal-mode motions (hjkl), the simplest normal-mode actions (d, c, f/t), and the concept of "adverbs" (8j, 4dw, 2df]). Once you have mastered these simple concepts, most of the magic comes from (1) combining them (2) googling the things that you intuitively know must be possible, and discovering how they're done, w…
Well, that did it -- I went back to my desk, and pulled up vi-tutor.txt, then never looked back.
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#155Example is searching for text on my system clipboard. There's no way to do this in vim: it insists on interpreting special regex chars. If you google it, you will find line noise that you can paste into your vimrc; these solutions inevitably have caveats and are now personalized to you.
(I asked our resident vim expert how he accomplishes this, and he seemed confused why you would ever need to do that. vim is its own universe, huh.)
Anyways looking for practical suggestions for getting into vim - a "cheat sheet" that has actually worked for someone!
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#156Earlier quoted context omitted.
> I used vi and vim for about 25 years before switching to Emacs. Then maybe you can help:) I've tried, multiple times, to switch to emacs. And every time, I get stuck, because vim keybindings are so wired in to my muscle memory now, and even the broader interactions are hard to adopt (i.e., I expect to get a command prompt by escaping to command mode and then typing ":", and then all commands are available). Is ther…
You must have heard of evil by now... but if not check it out. It's a vim emulation layer for Emacs.
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#157Earlier quoted context omitted.
What I observe is that most vim fans who swear by it use it as a bare bones editor, syntax highlighting at most. No auto-completion, go to definition or any other IDE stuff. Yes, it is possible to make vim IDE-like but very few do so.
I used to be like you describe, mostly because language-specific plugins were a dumpsterfire of hidden complexity, that really slowed down your editing experience. While some plugins are brilliantly-designed, it takes a long time to learn how to configure one language plugin to your tastes, and that learning is generally non-transferable to other language plugins. (vim-go fits this to the T, ime). https://github.com/…
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#158Earlier quoted context omitted.
I used to be like you describe, mostly because language-specific plugins were a dumpsterfire of hidden complexity, that really slowed down your editing experience. While some plugins are brilliantly-designed, it takes a long time to learn how to configure one language plugin to your tastes, and that learning is generally non-transferable to other language plugins. (vim-go fits this to the T, ime). https://github.com/…
Have you tried language server implementations like coc.nvim? They seem to be superior to ale and others that don't use the Language Server Protocol.
I took a cursory look at their repo. I might be understanding this incorrectly, but it looks like you have to run node as a sidecar to use it? Isn’t that really intensive vs ALE? I figure if I wanted to run V8, one might as well use VSC, which after all is an electron app. :)
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#159For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…
vi also builds its concepts together in a great way. Navigation keys are powerful, but combined with actions, they become monumentally powerful in a way few IDEs seem to replicate well. Something simple like "copy the next 10 lines to the clipboard" is just 10yj or 10Y or even y10j. No awkward reaching for control keys. Now combine those actions into macros and things get really fun. One of the most fun navigation ke…
There's also the t key which will place the cursor on the character just before it. There are also the F and T keys that will search backward in the same line and the ; and , keys that allow you jump from character to character in that line.
But, if you want more flexibility and the ability to jump across multiple lines, a / or ? search will allow you to select text up to and including the multiple characters you search for.
Re: Bill Joy's greatest gift to man – the vi editor (2003)
#160For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…
Bind your caps lock to ctrl+left/esc too. It's so much better than reaching for esc/ctrl all the time.