4 ms·
Every IDE or text editor I have ever used had very limited text manipulation and navigation capabilities. The only exceptions are VIM and Emacs (and editors th
by VonGallifrey 8y ago
Every IDE or text editor I have ever used had very limited text manipulation and navigation capabilities.
The only exceptions are VIM and Emacs (and editors that follow that spirit, like Neovim).
Vim especially has an entire language of text manipulation and navigation features. This language is made up of actions (like c for change or d for delete), Motions (like hjkl for left, up, down, right respectively) and Repetitions. These elements can be combined into very powerful commands, especially since there are a lot of Actions and Motions that can be performed. This is made possible by the Modal Editing[1] that Vim provides. You would simply type these commands in "Normal Mode" and then you would be dropped into "Insert Mode" if necessary.
At first this might seem very silly or inefficient, but after a while it becomes almost second nature and is more efficient then using the mouse or pressing Arrow Keys 100 times. Especially if combined with the Macro capabilities and the Search Commands.
Some examples of this language:
Navigate 10 lines up: 10k
Navigate 10 lines down: 10j
Go to the beginning of the next Method: ]m
Change the word under the cursor: cw
Change the paragraph under the Cursor: cip
Change the inside of "" pair under the Cursor: ci"
Change a pair of "" after the Cursor: ca"
Change the inside of {} pair under the Cursor: ci{
Visually select the text from the cursor until the 3rd occurrence of the character x going to the left without selecting the x: v3Tx
Same thing, but going right: v3tx
Same thing, but going to the right and selecting the x: v3fx
Same thing, but change instead of visual select: c3Tx
Same thing, but do a rot13 "encryption" after selecting: v3Txg?
[1]: https://unix.stackexchange.com/a/57708 https://unix.stackexchange.com/a/57708
- emodendroket 8y agoThis stuff is all supported by IDEs, though. e.g., https://github.com/JetBrains/ideavim https://github.com/JetBrains/ideavim
- VonGallifrey 8y agoThese kind of Vim emulators are not really providing the full vim experience. Some come close (like Emacs Evil Mode), but most just don't. Most are just scratching the surface of stock vim. Not even the vim experience when using plugins, just stock vim. I tried ideaVim and while I do not remember what my specific problems where, you can read their ReadMe for a glimpse that they have a lot of issues still. Even IF they would provide a decent enough vim emulation, why use something emulated when I can have all the IDE features in Vim itself. Also: Vim plugins that provide IDE features are purposefully build with the way vim works. Providing advanced IDE functionality in a Modal Editing environment. This can not be said about an IDE with vim emulation. As far as I can see they implement those features as ":action <actionName>" which is so much worse then what vim can do. IntelliJ + IdeaVim is simply a worse Text editor then Vim despite being significantly more bloated and slower and I would even say that Vim with plugins is a much better IDE as well (while STILL being less bloated and faster).
- emodendroket 8y agoI was always more of an Emacs guy so I can't speak to that specifically, but in your big list of examples there's nothing that wouldn't work, as far as I can tell.
- timrichard 8y agoBeen doing all that happily for years with IdeaVIM. And still retaining access to the things that are nice in a graphical environment.
- VonGallifrey 8y agoIdeaVIM is not good. I have tried it and for me it just pales in comparison to just vim. I can get all my IDE features in vim anyways. I don't use java though, so maybe that would be different if I where using Java.