February 19, 2012
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message news:mailman.527.1329589896.20196.digitalmars-d@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.


February 19, 2012
On Sun, Feb 19, 2012 at 1:31 AM, Nick Sabalausky <a@a.a> wrote:
> "H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message news:mailman.527.1329589896.20196.digitalmars-d@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.
>
>

What you just described is called Kung Fu Typing or Emacs Kung Fu. Vim has a little of it too. The common example is Ctrl-r which redoes or undoes the undo. In general Vim tries to avoid it and you can map redo to a different key(-stroke) if you like. Let the editor flame war continue...

-Jose
February 19, 2012
I think the difference between chording and non-chording styles of input depends on the person. I have dyspraxia, which affects my fine motor control, so remembering and performing complex key sequences (such as emacs' keyboard shortcuts) is difficult for me, hell I have difficulty correctly typing ":qa:" properly to quit vim, I often type ":Qa" because I can't take my hand off the keyboard fast enough. I mistype so often, especially when I have little mnemonic data to go on.

Shift-Ctrl-End, Ctrl-X is two chords and 5 keystrokes, with <End> being off my normal typing position, even if I used that combination for years, I'll likely still get it wrong 1-2 times out of ten. I've been vim-ing for about 2 years now, I still get the movement keys wrong. I still type commands that I could bind to shortcut keys, or already have bindings (":redo") for example. I create ways to remember most keys, "i" for insert, "r" for replace, "s" for substitute, "d" for delete, "p" for paste, "g" for go (sometimes), "a" for append, "c" for cut. But I can't remember modifier keys normally, especially Ctrl and Alt, I've set most of the keyboard shortcuts on my window manager, I don't remember a lot of them, because they use <Mod4> (Windows key/Meta key).

My point is, there's more to modal vs modeless than just how friendly it is, once I got over the initial hurdle, and forcibly trained myself to use h, j, k and l for motion (by disabling the arrow keys) I became far more productive in Vim than I did in any other editor, simply because I could use single key strokes for actions, I still press <Esc> just before doing any non-insert on text, even if I'm already in normal mode, and I still get things wrong, but I find it far easier to type "dwdwdwdw" to delete 4 words that to type <Ctrl>-<Shift>-<Right>,<Right>,<Right>,<Right>,<Del>, because its hard for me to hit keys if I have to move far. Pressing "dd" to delete a line is easier for me than doing <Home>,<Shift>-<End>,<Del>,<Del> because its a single key, if I got it once, then I can get it again.

I don't care what editor you use, but I didn't pick mine simply because I wanted more hacker cred, I picked mine because it allows me to work around my disabilities.

For the record, while I didn't track it, I estimate that I made about an average of 1 mistake per word typing this message, I mis-typed "track" 4 times in this sentence.

--
James Miller
February 19, 2012
On 17/02/2012 06:09, bcs wrote:
<snip>
> Any language that is designed to be easy for amateurs to use will be used by amateurs, and
> only by amateurs.
<snip>

Do you consider either VB or Python to fall under that category?

Stewart.
February 19, 2012
Vb yes, python kinda.  Vb is designed for people who don't want to
program.  The idea is to create a quick application that gets two job
done.  Python is slightly different.  It has a ton of syntax and all the
libraries that it needs to be used in moderately sized project.  Python
comes across as being easy to learn because it is simple in the most
beautiful way.  I doubt many large programs are written in python but of
course it is finding a home on the web.  I think that python stretches
close to the line but I doubt it was designed for beginners.
On Feb 19, 2012 10:20 AM, "Stewart Gordon" <smjg_1998@yahoo.com> wrote:

> On 17/02/2012 06:09, bcs wrote:
> <snip>
>
>> Any language that is designed to be easy for amateurs to use will be used
>> by amateurs, and
>> only by amateurs.
>>
> <snip>
>
> Do you consider either VB or Python to fall under that category?
>
> Stewart.
>


February 19, 2012
Kevin Cox:

> I think that python stretches
> close to the line but I doubt it was designed for beginners.

Python partially comes from ABC, a language that was designed to teach programming. So originally Python was meant (unlike ABC) to be practically useful, but also to avoid being unnecessarily hard to learn and use, retaining ABC ideas and simplicity where possible.

In the last years they have added more features to Python (Unicode on default, lazyiness on default in many places, decorators, and so on and on), to make it more efficient and more fit to write larger programs. So now Python is large enough, and despite being simpler than several other languages, it's not so simple to be a first language.

The problem with languages to teach programming to people that don't know how to program, is that if you design them to be simple and good for teaching, no one uses it for practical purposes, so it ends being useless outside schools, and very few people write patches or libraries for it. So it often dies. If you use a language used for real use, you have many libraries and a good compiler/interpreter, but the language is large, often full of legacy, warts, or backwards compatible things, and the language itself is often not easy to learn and understand.

Apparently there is no way out of this dilemma. I have seen that today Python is good enough to teach programming, but you can't teach static typing well with it. D is too much complex for young newbies. Racket Scheme has a very good editor, it has good documentation, and so on, but in my opinion Python is better as first language, despite Racket contains a typed scheme too.

Bye,
bearophile
February 19, 2012
On 02/19/2012 07:25 AM, Kevin Cox wrote:
> Vb yes, python kinda.  Vb is designed for people who don't want to
> program.  The idea is to create a quick application that gets two job
> done.  Python is slightly different.  It has a ton of syntax and all the
> libraries that it needs to be used in moderately sized project.  Python
> comes across as being easy to learn because it is simple in the most
> beautiful way.  I doubt many large programs are written in python but of
> course it is finding a home on the web.  I think that python stretches
> close to the line but I doubt it was designed for beginners.

What he said.

>
> On Feb 19, 2012 10:20 AM, "Stewart Gordon" <smjg_1998@yahoo.com
> <mailto:smjg_1998@yahoo.com>> wrote:
>
>     On 17/02/2012 06:09, bcs wrote:
>     <snip>
>
>         Any language that is designed to be easy for amateurs to use
>         will be used by amateurs, and
>         only by amateurs.
>
>     <snip>
>
>     Do you consider either VB or Python to fall under that category?
>
>     Stewart.
>

February 19, 2012
On 02/18/2012 06:13 PM, Nick Sabalausky wrote:
> "bcs"<bcs@example.com>  wrote in message
> news:jhonpv$neg$1@digitalmars.com...
>> On 02/18/2012 09:10 AM, Nick Sabalausky wrote:
>>>
>>> I've heard a lot of people say that about vi(m), but in my (admittedly
>>> somewhat limited) experience, I've never come across a (Li|U)n[ui]x
>>> system
>>> that didn't have nano or pico (neither of which are great, but they're
>>> good
>>> enough for editing Unix configuration files, and I'm actually capable of
>>> using them, unlike emacs or vim).
>>
>> Vi's not that hard to use if you don't expect to be a power user.
>>
>
> I figure I could probably get by with it (if I had to) as long as I grabbed
> a command reference and kept it nearby. But so far, I haven't felt any need
> or desire to do so.
>

I'm in a similar position, vi is my tty console editor of choice but not my goto editor for anything of much significance.

>>>
>>> But I prefer to do it like this: SSH into a server, but then also connect
>>> via SSHFS (SSHFS is fucking *awesome*!). That way, no matter the server,
>>> I
>>> can use *any* editor I want: kate, gedit, whatever.
>>
>> How long does it take to get in via sshfs? If it take more than about 10
>> seconds to get started, that is a non-starter for some cases
>
> Same speed as any normal SSH login. Only difference is instead of doing:
>
> $ssh user@domain
>
> You do:
>
> $sshfs user@domain: /desired/local/mount/point
>
> Or if you don't want it rooted on the remote user's home dir:
>
> $sshfs user@domain:/ /desired/local/mount/point  # the whole damn remote
> system
> or
> $sshfs user@domain:/remote/dir /desired/local/mount/point
>
> Then to logout, it's just:
>
> $fusermount -u /desired/local/mount/point
>
> It literally is SSH, so the actual login process is exactly the same as SSH,
> whether you use a key-pair or a full login/pass.  So however fast that is,
> that's how fast SSHFS is. I've never noticed any difference.
>

That's kind of borderline for some uses.


February 22, 2012
On Friday, 17 February 2012 at 16:43:54 UTC, F i L wrote:

>
> I just don't see an argument for why we *shouldn't* make mathematical operations in code match those we where taught as children as close as possible.
>

There is a profound difference in that math is mostly about making a series of static statements, universal or temporary facts of relationships between things, while programming is all about describing operations to be performed, even if hidden by functional or object costume.

Math may use operators and functions, and programming sometimes assertions of relations, which makes reality not so clean cut simple, but this is the essential difference.

It does not serve any purpose to insist on closely similar notations.

February 22, 2012
On Friday, 17 February 2012 at 06:25:49 UTC, H. S. Teoh wrote:
> But who am I to speak out against more than four decades of historical
> accidents, right? I think I'll shut up now.

Can you forgive me a little investigation? I heard similar proposals and wonder where they come from. What do you think? It can't be python or golang, because they were already designed with there thoughts in mind.
1 2 3 4 5 6 7
Top | Discussion index | About this forum | D home