3 ms·
For me, I was always annoyed with how tedious it was to edit things. i.e, The gap between what I think vs what I have to do in the editor to get it done. This c
by jpradeek 12y ago
For me, I was always annoyed with how tedious it was to edit things. i.e, The gap between what I think vs what I have to do in the editor to get it done. This constant annoyance was what drove me to spend time and energy into learning it. I believe that if you don't care about it, you won't really benefit out of it. Because the whole point of switching to Vim/Emacs is to minimise the gap between what you think and how you do it.
Let me give you an example. You'll be thinking, "I need to change all the arguments to a function." In other editors, you'll press the arrow keys until you get to one end, press backspace key multiple times until you get to the other end. In Vim, I'd do "ci(" which means "change everything inside (" - which is pretty much how I think about what I need to do. A similar but more common example is changing text inside quotes. Again, that'd be 'ci"'.
Not everyone feels the annoyance about this and if you don'tt, hats totally fine. Learning something just because its cool is never worth it. Learn it if you really care about it.
Also read this post by Yehuda Katz about how he started for some ideas. http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/ http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convi...
- Someone1234 12y agoYour example falls flat. Any text editor with regular expression support can do that... Do you have another example?
- Hello71 12y agovim: step 1: type ci(. step 2: type what you want to replace with. step 3: press ESC. notepad++: step 1: press Ctrl-H. step 2: type \([^)]*\). step 3: press tab. step 4: press (. step 5: type what you want to replace with. step 6: press ). step 7: move hand to mouse. step 8: move cursor to and click on "Regular expression". step 9: press enter. Do you have another example?
- therealunreal 12y agoNot implying that the vim way isn't faster but on any regular text editor you can: ctrl+right arrow once or twice, right arrow to skip the (, shift+end, shift+left arrow, then type.
- dllthomas 12y agoAnd of course, \([^)]*\) breaks if you have foo(bar(), x / (y + 1))
- inclemnet 12y agoPepole don't use vim because it does things that are simply impossible in other editors - they use it because they find it lets them do that thing better. In this case, I guess the main point is about vim's modal editing in which the command is simple, easy to type and obeys a meaningful grammar.
- hderms 12y agoThe reason why it's interesting is it is basically a grammer for editing text. It's simple enough that you can easily create new strings of grammar which do what you want but powerful enough that the skill ceiling is practically infinite. Once you have a grammar for editing text a lot of interesting features fall into place quite naturally like having 'undo trees' instead of just linear undo, being able to write complex macros in the same language you edit text in, etc...
- adolph 12y agoI think you are missing the elegance. The example isn't change foo to bar in f1(foo); f2(foo); f3(foo). The example is the series of steps and physical mode changes to change f(foo) to f(bar). To do this one must select the letters foo somehow and then cause bar to be typed in their place. This can be done a number of ways in a "normal" text editor. For example, the person might double-click foo with the mouse to select the word and then type in bar. This does four things: 1. places the cursor in the location of foo; 2. select foo; 3. remove foo; 4. insert bar. In this example, there is one or two physical input context changes: from keyboard to mouse and back or maybe just from mouse to keyboard. In vim, the physical input context never changes. The keyboard remains your context throughout. The person would 1. Position the cursor somewhere by foo (i.e. by typing a search expression like /foo<enter>); 2. type ci(<enter> which selects everything in the parenthesis, deletes and changes the context to input; 3. type bar (and probably 4. press the <esc> key). I suspect that some people aren't bugged very much by the physical context switch and so the point of this is lost. Other people are bugged by it and struggle along until they find vi, emacs or the like.