4 ms·
"that those who still use Vi/Emacs to code are close minded and unwilling to change." Vi is not just an text editor in the terminal. It's a different way to in
by nouveaux 5y ago
"that those who still use Vi/Emacs to code are close minded and unwilling to change."
Vi is not just an text editor in the terminal. It's a different way to interact with text. To say that Vi users are close minded is like saying people who use the terminal are closed minded.
GUIs and the mouse have significantly improved the way we interact with computers. However, many things are still better in the terminal with a keyboard.
In that same vein, IDEs have improved the way we write code but it has not improved on the way we interact with text enough. For those of us who love Vi as an expressive language to interact with text, we choose to forgo the benefits that IDEs give us when writing code.
Personally, when I write code, I love the experience of tmux with neovim. It's something I try to replicate in the gui every couple of years in MacOS but it always so bad.
On the point of manual renaming, Vim is perfectly capable of project based search and replace.
- xg15 5y agoBut, well, what is so different in the way to interact with text exactly?
- jflesner 5y agoYou start in a file where you aren't even editing yet. From there, to start almost every type of navigation, highlight, or edit action will often be a few character combinations. Go to the end of a file and adding text to the end of the line would be "GA", for example. Most actions don't require adjustment of your hand placement (and its even better if you remap capslock to escape) or use of a mouse. Whatever action you take can be repeated with a simple period (big time saver if you need to repeat an action mutliple times). More powerful commands like find and replace are available with the command mode. It works perfectly well over a remote session, also Once you learn the keys that correspond to your desired actions, everything else feels wasteful (Especially as I'm writing this on my phone). I turn on vim keys for anything that has it. It takes a long time to build up your vim vocab (I recommend you learn the simple stuff and incrementally look up better ways to approach things as you go). A great way to get started is vimtutor, which is built in when you install vim; just run vimtutor from shell and start reading. There's a lot more depth to what is possible, buffers, plugins, etc. but that's what stands out to me.
- nouveaux 5y agoVim has a concept of an object and actions/motions that can be applied to the object. You can think of it as nouns and verbs. Vim objects can be letter, words, sentences or paragraphs. Say you have the following sentence: "How much wood would a woodchuck chuck?" If you cursor is on the letter "H", you can type the "dw" to delete the word "How". You can use "dt" to delete up to a letter. If your cursor is at the letter "H", "dtw" deletes up the letter "w" which will delete "How much ". This barely scratches the surface. There is a steep learning curve involved but it's totally worth it if you need to edit text on a regular basis.
- stnmtn 5y agoVIM people are very bad at explaining this. Basically, VIM allows you to compose commands together, so that learning one command means that you can compose it with another to do things very quickly. The best example is this, imo. you have a function call that is: `combineFirstAndLastName("John", "Smith")` If your cursor is in the `"John"` part, and you want to change that, you can just input `ci"`, (c)hange (i)nside ("), to instantly start typing with John being removed. Lets say you want to change all the text inside the parenthesis, you just type ci), (c)hange (i)nside `)`. There's commands like this all over, and you can compose all of them. For example, `ct"`, (c)hange un(t)ill ("), which will erase any text until the next available `"` on the line. Or, (d)elete un(t)ill `char`. It's a whole language when you're editing with VIM, and while it might sound like that's very hard to learn, it's not. Because you can slowly add these verbs and sentences into your habits until it's completely natural
- tomjen3 5y ago>It's a different way to interact with text >On the point of manual renaming, Vim is perfectly capable of project based search and replace. I think that is my point, stated better than I could, code is not just text. I have no issue whatever accepting that Emacs/Vim is much much better at dealing with text - I use Emacs for text in preference to just about everything else. My preference is IntelliJ, but essentially all the IDEs treat the code as a representation of the abstract syntax tree it is. Put your cursor over an identifier and IntelliJ will highlight all the other instances of that identifier. It will not highlight the same word when used in a comment, because it is not the same. When you treat code like text, you are limited to search and replace. When you treat it as an AST, your editor can rename your private backing field without renaming your property, because it knows they are two different things. In Java it can push methods up and create a new parent class, all while updating all the code that uses it and give you the confidence that it does so without screwing up your code base.