"H. S. Teoh" <hst...@quickfur.ath.cx> wrote in message news:mailman.527.1329589896.20196.digitalmar...@puremagic.com... > On Sat, Feb 18, 2012 at 12:10:48PM -0500, Nick Sabalausky wrote: > > [...] >> If I'm using a server that doesn't already have ssh set up (for >> instance, if I'm actually setting up ssh) *then* I'll either use >> nano/pico or, if I can, I'll install mcedit which is the closest I've >> seen to what I would consider a nice text-mode editor. > [...] > > I used to hate vi and its variants because of modality, which I just > couldn't understand how anyone could consider as *not* a handicap. >
For most of these things you mention, I'd argue a modal editor like vi isn't really necessary. For instance I use Programmer's Notepad 2 (Windows-only, unfortunately) which is a "normal" word-processor-style GUI editor, and with it: > But I have to say, after having actually used it for quite a number of > years now, I simply can't bear to go back to pico. Being able to move in > text by words Ctrl-Left, Ctrl-Right > or blocks or even matching parentheses/brackets/braces > with just a keystroke or two, I'm not sure if PN2 in particular does this, but I know that's fairly common in many typical non-VI/non-emacs editors. > or apply complex commands (like regexes) > to large blocks of text at a time (thus effecting a very large change > *reliably*), PN2 has regex find/replace. VS has it, too, and I'm sure many others. I agree, it *is* a fantastic thing to have. > going back to pico is like going back to a 50-year-old > screwdriver with a loose handle after having used a power drill. It > makes me feel so crippled. > > Part of what makes vi useful is that many of its commands can deal with > logical units greater than a single character. So you can, e.g., > navigate by words Like I said, Ctrl-Left, Ctrl-Right > or paragraphs Not sure what that means in the context of code...? But I have the standard PgUp/PgDn/Home/End, FWIW. > or matching braces (extremely useful for > moving around in code) with just one or two keystrokes, Again, fairly common even outside VI. > replace a word > without needing to count how long it is, Replace following word: Shift-Ctrl-Right, Type new word Replace preceding word: Shift-Ctrl-Right, Type new word Replace random specific word: Double-click, Type new word > cut-n-paste n paragraphs (or words, etc.) > around without needing to actually traverse them. In pico > you'd have to select, then hit down X number of times per paragraph, Or mouse on most editors, which really isn't as bad as people make it out to be. (But maybe it's just because I'm on a trackball.) > before you can actually cut. In vi, you just type "d5}" to delete 5 > paragraphs, Yea, but that way, you have to actually count out what you need. Personally, I'd much rather traverse. > then use '/' (search) to find the reinsertion point, and > then 'p' to paste everything in there. Ctrl-F: Quick find (not the default, but that's how I have it set up) Esc, Ctrl-V Yea, there's the Ctrl and Esc, but it's not so bad. > You can also say, "cut to end of > file" with just two keystrokes: "dG". Shift-Ctrl-End, Ctrl-X This works, too: Shift-Ctrl-(End, then X) > My favorite is "replace up to > closing parenthesis": "c/)<ESC>replacement_text<ESC>". Very useful for > editing code without needing to recount parentheses. > Assuming one of the many editors that supports "jump to paren" and such things: Shift-Ctrl-(whatever key it is), replacement_text > Furthermore, being able to tell the editor to repeat a (set of) commands > n times is very useful, instead of having to manually repeat it > yourself. Yea, admittedly that's not very common with "normal" editors, unless you count editor scripting (PN2 uses Python). But there's nothing stopping them from enhancing that with macro recording/playback. > Having logical units is useful here, e.g., you can repeatedly > replace words of different lengths with a replacement word without > needing to worry about mismatching lengths. > Again, Shift-Ctrl-Left/Right, or Shift-(whatever other navigation keys/shortcuts you happen to have available). > Similarly, pico can in principle do everything that vi does too, Even *I* very much doubt that ;) Pico's benefit is that it's at least usable by people who are used to the typical word-processor-style editors. But feature-rich it certainly ain't (unless it's all hidden somewhere?). > just that vi gets you there with less pain. > > Just my $0.02. > Yea. I'm not saying that VI isn't nice for those who have learned it and like it. But I don't think the typical eclipse/word-processor-style editors are much, if at all, behind on the tricks you describe. Certainly not impossible in theory (I can easily imagine an editor allowing "Ctrl-{number}-Right" for "Move {number} words to the right"). It sounds to me like the difference isn't so much "modal vs modeless" as it is whether you escape to the special modes by pressing a key or by holding a key. VI: Press a key. Others: Hold a key. The "Hold a key" is easier for new users since the mode always "snaps back" whenever you let go (or when you press Esc, if you're using something like Quick Find). But I understand that some people can get used to VI's...umm..."persistent" modality.