On 13/07/09 18:00, Raúl Núñez de Arenas Coronado wrote:
>
> Saluton Roald :)
>
> Roald<[email protected]> dixit:
>> Questions: can I add modes?
>
> Not exactly, but using mappings and some scripting you can achieve what
> you want. Just define mappings for normal mode.
>
>> If not: is there a good reason for that?
>
> Current design, I suppose. Moreover, if you think about it, there's
> plenty of things that doesn't belong to an editor (browsing files, for
> example) but that you can add to an editor and that in fact are present
> in Vim: if you add a mode for each and every of them you will end up
> with dozens of modes, and it doesn't make sense.
>
> The usage pattern you explained in your message doesn't make sense as a
> mode for me, because those actions belong to "normal" mode.
>
> Current design is, IMHO, perfect. You have normal mode for performing
> editing tasks, visual mode to visually perform editing tasks and
> command mode for ex commands.
Command-LINE mode. "Command mode" is an older synonym, still used in
parts of the help, for "Normal mode". See ":help command-mode" if you
don't believe me.
> Operator pending mode is not exactly a
> mode, but a helper to be able to fine tune normal mode mappings, and
> insert mode is not a mode at all (although it is treated like that to
> make defining maps easier), but the result of a command in normal mode
> (namely the "i" or "a" commands, for example).
About Insert mode, I believe the opposite. Vim has two great families of
modes, namely some in which the letters you type appear on the screen
and can be removed in a different sequence (mainly Insert mode, Replace
mode and Command-line mode -- with its Ex-command, Search-before and
Search-back variants) and those in which they act immediately, possibly
after you press several keys in succession, but in that case you cannot
edit the sequence, you can either abort it, or, in some cases, remove
only the last keys hit, by backspacing over them in LIFO sequence --
these are Normal mode, Visual mode (including its characterwise,
linewise and blockwise variants, as well as Select mode), and
Operator-pending which is where you are when entering the movement or
object after an action command.
>
> Usually Vim is called "modal" because it can be in "insert mode" or
> "normal mode". I don't consider things like that. I prefer to consider
> Vim as a command-driven application, one of the commands insert text,
> other allows for visual selections, other runs ex commands etc. It's all
> about commands, just that.
If "insert text" is just "one command" until you leave Insert mode...
well, I won't deny that to part of the Vim C code it is that, but
thinking that, when I enter a new file, I'll be partway inside "one long
command" for I don't know how long until, after having hit Esc (which is
part of that long command but signals it end) I'll finally hit
":wq<Enter>" (a second command) to quit Vim... well, that's just
impractical for a flesh-and-blood person who can hardly conceive that
the long job of typing all the data in one file is "the same kind of
stuff" as ":wq" and that he used exactly two commands during that long
session. (And when I hit F3 in Insert mode, which is imapped to
<C-O>:wa|wv<CR> , to me it isn't ending one command, doing two other
commands, and starting a fourth one, it's just one action to save the
file, and that is "part" of Insert mode. I might admit that after I
previously went "down" from Normal to Insert, this goes "down" one
further level to Normal mode, and from there to Command-line mode, as
part of a mapping --which, on other programs, might be called a
macro-instruction-- but I'll hold steadfastly that Insert-mode hasn't
been abandoned, it is "pending" all the while that that mapping
executes, and finally the mapping goes back to it the way a subroutine
returns to its caller.)
>
> In you case you want commands that are easier to type than Ctr-w w for
> changing windows, not a new mode with a new set of mappings.
>
> My suggestion is that you can use unmapped keys to perform the actions
> you use the most with just one keypress, or even use already mapped keys
> you don't use, or use a mapleader, etc. For example, I use "gqip" a lot,
> so I've mapped "çç" to do that ("ç" is my mapleader), I've mapped "çc"
> to comment a block of visually selected lines, etc. Mappings are your
> friends, not new modes ;)
Yes, here I agree. If you find that you don't like using Ctrl-W all the
time, you can map it to something else, and if your keyboard is a
US-QWERTY with no accented letters, you can still use
:map <F5> <C-W>
and hit F5 (with one finger) wherever the help says to hit Ctrl-W (which
requires two fingers).
>
>> If not: is there any chance of it being implemented?
>
> I can't speak for Bram, but I would bet that it won't ;)
>
Actually, you could say that Ctrl-W starts a "new mode" with a duration
of just one keypress, then goes back to Normal mode -- reminds me of
"three-shift" alphabets I knew on the mainframes of some decades ago,
but let's not delve into that. i_Ctrl-X also starts a kind of "new mode"
(autocompletion) with a somewhat longer duration; it ends (by going back
to Insert mode) as soon as you hit a key that it doesn't recognise. And
i_CTRL-O "embeds" exactly one Normal-mode command into Insert mode.
The reason that Bram -- reluctantly, I'm sure, since he doesn't like
Emacs ;-) -- had to recruit these control keys, was that all or almost
all "ordinary" keys already did something, and that he intentionally
wanted to leave the F keys (other than F1 = Help and, on some systems,
F10 = Menu) to "the user's choice". Fn and Shift-Fn keys are your "best
choices" as {lhs} for mappings. (On Windows, but not on the Linux system
I'm using now, Ctrl-Fn and Alt-Fn may also be used, I think. And if I
can't use them, it isn't gvim's fault but the fault of the window
manager, which snaps them away before Vim has a chance to see them.)
Best regards,
Tony.
--
History, n.:
Papa Hegel he say that all we learn from history is that we
learn nothing from history. I know people who can't even learn from
what happened this morning. Hegel must have been taking the long
view.
-- Chad C. Mulligan, "The Hipcrime Vocab"
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---