One of the most fun navigation keys is the under-reported "f" key. If the cursor isn't where you want it to be, you can easily put it on the right line (perhaps with 55G or something if you want line 55) and then to move the cursor over the character you are actually looking at you just type f( assuming that ( is the character you want the cursor on. It's just great... it's about having the computer work around your human experience of looking at the screen in a nice way.
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.
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, which in turn gives you more basic concepts.
At that point, your feedback loop gives you escape velocity, and you'll never willingly go back to a standard text editor again. :)
Getting escape velocity is really tough, though.
Well, that did it -- I went back to my desk, and pulled up vi-tutor.txt, then never looked back.
Vim is extremely intuitive in its compositional behavior; I have never used "67w", but I know exactly what it would do because of composition.
I think "discoverability" is closer.
Vi is a completely different way of thinking. I would compare it to learning to program. When you first start, there isn't very much that is discoverable. You just have to sit through the learning. Once you do, you have access to a lot of power.
In case you wish to type immediately after deleting, replace 'd' with 'c' in the above.
But yes, `dap` and friends are options too.
And the objects are text-centric (word, sentence, etc). Add on top of that a powerful macro system, and you get a really powerful tool for text manipulation.
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 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 there and select a couple lines which happens to be 5 paragrahs, OOOPS, I went a bit too far, now let's go back. YES, now delete them!".
Other examples:
- "increment this number by 5" - "delete this html tag recursively" - "indent the next 20 lines" - "remove all the arguments from this function call" - etc.
Vim has a language, _that_ is the powerful part.
To be fair, thankfully VSCode (and any of the other fancy IDEs) have basic vim-functionality providing plugins.
Oh god are you one of my colleagues?
Unfortunately this is some external requirement I cannot do anything about. Also, as opposed to many people, I actually got to work and know both the IDE-world (including VScode), and the vim world. I have a base for comparison.
Hopefully you "got that" too.
Anyway, unfortunately given setup won't even be viable with anything running "local", since in the mentioned citrix environment we cannot install anything, so no vscode, no local vim, no nothing...
I tried using vim-only setups but there's so much configuring and weird things. Nothing to me has worked as great as my current VSCode + Vim plugin setup. It's the best of both worlds, as I get the quite frankly absurd speed improvements of VIM while also the great user-friendliness and ease of VScode
https://github.com/VSCodium/vscodium/issues/240#issuecomment...
VS Code and vi have different use cases. Contrary to what you said, most people are not going to open VS Code to make a quick edit to a config file. If that works for you, fine, but the overhead of starting electron is significant.
But yea vscode remote is really good.
vim has had those features for many years now, so I'm not sure why people wouldn't make use of those features unless they aren't aware of them.
There were even the games of considering what plain text typed in wrong mode would cause the most of the damage.
The main reason Vim and Emacs have their current followers is that the competing editors on Linux or Unix platforms are significantly worse (on average), not that these two are by any means any kind of the possible optimum. And boy, is the competition worse.
(Personally, I use console editors only if I have to, and then prefer to use vim, but otherwise I prefer my customized low-footprint programmable GUI.)
vim has had the multi-level undo and redo for a number of years. If I really screw up, I can always run something like :earlier 5m to get back to the state I was at 5 minutes ago.
The only problem I have with some of the normal mode keystrokes is when I want to use some of the window based shortcuts and accidently press ctrl-w while my browser window is open (which closes the tab) :)
That said, it is hard to learn all these features and modern GUI IDEs are pretty amazing. You can still use vi in many of these editors.
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/dense-analysis/ale (along with the language-server movement in general) changed my perspective. I now do at least the go-to and autocomplete half of IDE things, now.
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. :)
It is a trade off I gladly accept to use vim and tmux. Aside from that, vim plugin for vscode is pretty good for doing pair programming with the team.
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 delete a word using 'dw'. You can delete 5 words with '5dw'. Another example: deleting a line is 'dd'. Delete 5 lines with '5dd'
It is a modal editor. At a basic level there is an "edit" (insert) mode, a "navigation" (normal) mode, and a "selection" (visual) mode. The power of a modal environment means that commands and hotkeys now have a context and do slightly different things in different modes. While this may be overwhelming, once all these modes are ingrained in you, it allows you to be extremely efficient since you do not have to remember new hotkeys. For example, in the navigation mode, you can apply the 5dd to delete 5 lines. In selection mode, use '5w' to select five words. 'd' now deletes everything in the selection. If you've ever struggled to manage and remember your hotkeys, modal environment is your friend. (set this up in mac using something like hammerspoon.)
It includes some really nice out of the box features: Macro system to save you time with repetitive tasks, regular expressions search and replace, time travel through your edits, it stores your edits in a tree so you can navigate to your changes even after multiple undo/redo. "." repeats the last change. You can also apply a number before it to repeat the change n number of times. I am surprised how often I use this that this is and this is first thing I miss when using another editor.
Vi is worth learning as it will improve your productivity. This is especially important if you have to edit a file on a remote server. Vi is installed on every unix distribution. Many cli tools and shells have a vi mode. This allows you to take the vi 'language' to all these cli tools for more productivity.
For those who struggle to learn, I highly recommend Vim Adventures. After that, force yourself to use vi for your every day edits and it'll be second nature in a couple of weeks.
https://vim-adventures.com