Tuesday, October 5, 2010

Re: paste in vim creates stupid result

Hi,

I am not sure if understood me correctly. Or I did not understood you.

On Tue, Oct 5, 2010 at 17:37, Joan Miquel Torres Rigo <joanmiquel@mallorcaweb.net> wrote:
2010/10/5 Alexander Dietz <alexanderdietz1@googlemail.com>:
> Hi,
>
> On Tue, Oct 5, 2010 at 16:18, Joan Miquel Torres Rigo
> <joanmiquel@mallorcaweb.net> wrote:
>>
>> 2010/10/5 Alexander Dietz <alexanderdietz1@googlemail.com>:
>> > Hi,
>> >
>> > On Tue, Oct 5, 2010 at 16:00, Joan Miquel Torres Rigo
>> > <joanmiquel@mallorcaweb.net> 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.
>


The above described the behavior I would like to have with vim. Is there something unclear?

 


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.

Why should I make tests? I have explicitly shown my complete .vimrc.
 

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).

Yes, maybe the title of this thread was not well chosen.
 

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.

I do not understand what you are trying to say here.
 

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.

As I says before, I have shown my complete .vimrc. I will show it again at the end of the email, so if you are a specialist of .vimrc settings you might see what is wrong in these set of settings.
 

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.


I have removed them all by now.
 
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.


That is exactly why I ask my question on this mailing list - I think I have a simple problem which might be not too hard to solve. I am no vim specialist and I absolutely have no time to spend months on understanding all of the possible .vimrc settings - that is why I am requesting help from the vim specialists in this email forum.

 
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).


When I 'map' a key to ':set paste', does it mean I just need to press that key so that the respective command is executed? This is not one of the desired behaviors I would like to have. Please read that part again.
 
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.


As I mentioned before, I have no time to spend months to understand all of the intelligent pieces you can do with vim. That is why I have written this email request - otherwise anyone with a vim configuration question just can read the vim documentation and this email forum would become useless.
 



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

I do not understand your answer. I asked two questions actually. Let me rephrase them:

1. Is it possible to configure vim in .vimrc in such a way, so I can use the mouse as I can use it in e.g. emacs, xterm or a browser edit box? So that I can paste text, which I have copied before by just marking with the mouse, can paste in with the exact same formatting?

2. If the answer to question (1) is yes: How do I set up my .vimrc configuration to get my desired behavior described under (1)

Please let me know if anything is unclear...

To your answer: I removed all the ':' in .vimrc, but when I paste something into vim each line is still intended by another two spaces, which is not what I want. So I guess your help on this issue does not work for me.


Thanks
  Alex


P.S. My current complete .vimrc again, which I have put into this email as follows: I made a 'cat .vimrc, then marked the whole text with the mouse, changed to this browser window, pressed the middle button on the mouse, and the text appears as below, just as I would to have the behavior within vim...


set number
set paste
set mouse=a


autocmd FileType * set tabstop=2|set shiftwidth=2|set noexpandtab
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
autocmd BufEnter * set ai sw=4 ts=4 sta et fo=croql
set softtabstop=4 " makes the spaces feel like real tabs


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