Tuesday, October 5, 2010

Re: paste in vim creates stupid result

On Tue, 5 Oct 2010, Joan Miquel Torres Rigo wrote:

> 2010/10/5 Alexander Dietz:
>> Hi,
>>
>> On Tue, Oct 5, 2010 at 16:18, Joan Miquel Torres Rigo wrote:
>>>
>>> 2010/10/5 Alexander Dietz:
>>>> Hi,
>>>>
>>>> On Tue, Oct 5, 2010 at 16:00, Joan Miquel Torres Rigo wrote:
>>>>
>>>> you mean to type the command in vim the way you type a search command?
>>>
>>> The way you type any command.
>>>
>>> In normal mode, simply type ':set nopaste<enter>'.
>>
>> I would like to configure vim in such a way, that I do not need to
>> type a new command each time I copy something, or paste something
>> etc. When you work with e.g. emacs, xterm or a web-broswer edit
>> field, you also do not need to 'type some command' before you are
>> going to paste something. You just click the middle mouse button to
>> paste text, for example.
>>
>
>
> 1. In your first post you said that you have ":set paste" in your
> ~/.vimrc that obviously not working. Then, if you want to solve the
> problem (only if you want, of course) you need to make some tests to
> diagnose the cause.
>
> 2. You entitled this thread as 'vim creates stupid result'. But this
> result is stupid only if you REALLY told vim that you want enter in
> paste mode. Otherwise this is VERY smart becouse it helps user to
> indent text (also you can switch off this feature with :set
> noautoindent).
>
> 3. Setting 'paste' mode by default is not a smart decision because you
> will lose many good features, but you can do it simply putting 'set
> paste' in your ~/.vimrc.
>
> 4. If you were simply did the test that I suggested you probably could
> see that this workded and think that there must be something wrong in
> your ~/.vimrc.
>

1 through 4 = good points.

A better test would be to run, in vim:

:verbose set paste?

That would indicate whether the ':set paste' in .vimrc is being
overridden.


> 5. While writting (1) and reviewing your first email I see a spurius
> ':' before each command in your .vimrc which I did'nt adviced first
> time because they are correct when commands used in normal mode, but
> not in command mode in which is processed vimrc files.

Stylistically, yes, the ':' should be removed, but it doesn't make a
difference for what gets executed.

:set paste
and
set paste

have the same effect in ~/.vimrc.


> 6. There is to many more intelligent and efficient ways to paste data
> from other applications (despite if is desktop clipboard or mouse
> selection). See :help registers.

I disagree with this part. In most web browsers, for example, there's
often no quick keyboard navigation for selecting a specific range of
text. So, it's much quicker to highlight the range with the mouse and
middle-click it into Vim.


> 7. If you persist in using mouse to paste, you can also map some keys
> to :set paste / :set nopaste commands. But also, you can do what you
> where trying just removing the spurius ':' at the begining of the 'set
> paste' command in your ~/.vimrc (and, of course, of the other commands
> in this file if you want they take some effect).
>
> 8. Definitively vim is not stupid, but much more smart that you think.
> But requires a bit of patience to learn. Only this. But then you can
> improve your efficiency up to 4 or 5 times or more simply tunning it.
>
>
>
>
>> My question: Is it possible to configure the same way, such that,
>> when in the inserting mode, text can be pasted into the vim text as
>> it can be done with emacs, xterm, webbrowser etc. If that is
>> possible, what exactly do I need to put into my .vimrc.
>
> You don't need to put nothing: You need to remove the supurius ':' in
> your commands.
>

(See above.)

--
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: