Thursday, November 8, 2012

Re: Commands from insert mode

On 11/8/2012 6:48 PM, Ed Kostas wrote:> On Thursday, November 8, 2012
7:41:49 PM UTC-2, Alejandro Exojo wrote:
>> El Jueves, 8 de noviembre de 2012, Ed Kostas escribió:
>>
>>> :imap <C-h> <Left>
>>> :imap <C-j> <Down>
>>> :imap <C-k> <Up>
>>> :imap <C-l> <Right>
>>
>> I'm not going to answer what you asked, but since in other mail
>> you said that you are beginning, I'm going to try to explain you
>> something way more important:
>>
>> You are trying to avoid normal by adding in insert mode several
>> mappings.
>>
>> DON'T DO THAT!
>>
>> Is called normal mode for a reason. You normally want to be in
>> that mode. As Drew Neil explains in his Practical Vim book (that
>> I totally recommend), a painter doesn't necessarily spend most of
>> the time with the brush leaning on the canvas.
>>
>> You are losing the main reason that makes Vim useful if you don't
>> use modes. Even worse: many important Vim features like the dot
>> command are completely based on the change of modes.
>>
>> Also, if you really, really want to map something, make sure that
>> you make a good decision on what you use. The reason is that you
>> may be hiding, and this making more difficult to use the
>> functionality that Vim provides. For example:
>>
>> If you map <C-x> in insert mode, you will need to find another
>> key to use the completion that is provided when you press <C-x>
>> followed by another key.
>>
>> If you map <C-h> you may have problems with the backspace key (in
>> some cases Vim will see the backspace and <C-h> as the same key).
>>
>> And so on...
>>
>
> Hi, Alejandro.
>
> Thank you for your letter. In fact, I have heard a lot of
> arguments from people that claim that I should get used to the
> dichotomy between normal mode, and insertion mode. I agree with
> these argument, and in my private installation of Vim, I don't
> mess with vim key mapping. However, I would appreciate if you
> could answer me the following argument of a writer whose name is
> Caroline Shore.
>
> There are people who use the editor to browse text. The go around
> the text looking for a given phrase, error, sequence of chars,
> etc. For instance, an engineer who is trying to configure a
> monitor editing the /etc/profile is in this situation. In this
> case, using the normal mode to move the cursor, or erasing a few
> chars makes a lot of sense. When the need arise for typing, the
> engineer can escape to insertion mode.
>
> In the world at large, besides the engineer, there are creative
> writers who seldom move the cursor, or even erase characters, or
> make corrections. These people just type forward. In the old days
> of typewriters, they would type their manuscripts, and almost
> never would make corrections, or erase text. In fact, with a
> typewriter, the result of correction is not very good. This kind
> of writers live in the insertion mode, with short incursions to
> normal mode. My question: In this case, do you think that it would
> make sense to provide a short escape into normal mode?
>
> I prepared the map for lawyers, that prepare formal documents. The
> type very fast, and now and them a wrong char slip in the line;
> then they want to move the cursor one or two chars backward, erase
> the wrong insertion with x, and return to their typing forward.
> These lawyers claim that they prefer Emacs over Vim because Emacs
> is more productive for this kind of writing.
>
> By the way, nowadays lawyers plead electronically. I mean, instead
> of typing the document, printing the document, and submitting a
> hard copy to the judge, they prepare the document in LaTeX with a
> text editor (say, Emacs), produce a pdf output (say, with
> pdflatex), and submit the result to the court. A text editor, like
> Vim, with a very fast start up is appreciated.
>
> If you have good arguments for not using commands from insertion
> mode, even for people who type most of the time, and seldom need
> to move the cursor or erase a char, I would be happy to hear your
> arguments. In fact, I am eager to hear the other side of this
> story.
>
> Below I put a list of reasons for my lawyer friends appreciating
> Vim, as compared with other editors, like Eclipse, gedit, and even
> Emacs.
>
> 1 -- Vim has a very fast start up. It is almost instantaneous.
> This is very important when you need to type a short document,
> LaTeX compile it, and submit the pdf file as soon as a submission
> window opens.
>
> 2 -- Vim is relatively small. The compiled application has less
> than 7 megabytes. You can copy it in a pen drive, take it to
> another town, copy it into the BAR association computer, do your
> working, and erase Vim. With Eclipse, you would need to ask
> permission to install Java, download 200 megabytes, install
> Eclipse, prepare your documents, uninstall Eclipse, uninstall
> Java, etc.
>
> 3 -- It has scripts. Therefore you can configure your keyboard to
> speed your work.
>

I use vim a lot -- most of my life is spent in a vim buffer -- and I
agree with the lawyers. I am an engineer and when I start a project
(e.g., a new .h or .cc file), most of my time is spent in insert mode
with brief excursions to normal mode.

Here's my "Mappings to facilitate the creation of text" from 2001:
http://vim.wikia.com/wiki/Mappings_to_facilitate_the_creation_of_text

Something else that you might find interesting "Enhanced Command Window"
from 2004: http://vim.wikia.com/wiki/Enhanced_command_window

--Suresh


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: