Tuesday, October 5, 2010

Re: paste in vim creates stupid result

On Tue, 5 Oct 2010, Alexander Dietz wrote:

> Hi,
>
> I have the following problem with vim. I am trying to copy the following text from an xterm:
>
> # -----------------------------------------------------
> def external_call(command):
>     """
>     Makes an internal call to the shell (with the
>     current set environment), wait for completion
>     and returns the output and error of the command.
>     @param command: command to be executed internally
>     @return: a tuple (status, output, error)
>     """
>
> into a vim session (by using shift - middle mouse button), but the result is as follows:
>
> # -----------------------------------------------------
> def external_call(command):
>     """
>         Makes an internal call to the shell (with the
>             current set environment), wait for completion
>                 and returns the output and error of the command.
>                     @param command: command to be executed internally
>                         @return: a tuple (status, output, error)
>                             """
>
> which is not what I want! My .vimrc contains the following content:
>
> :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
>
>
> Any idea how to change the settings so that the text is correctly
> inserted into vim?

As mentioned in the thread below, try:

:verbose set paste?

The 'paste' option doesn't "enable" pasting. It means to treat
characters literally, and to not apply formatting options (like 'ai' and
'fo').

Shift+middle-click in xterm "pastes" (as in: sends the characters to
Vim) regardless of Vim's settings. With :set mouse=a, you shouldn't
need to use 'shift-'.

With xterm, you might need to set the '*allowWindowOps' resource (That
was required for me on Gentoo using an at-the-time very new version of
XTerm.). See one of my responses in a previous thread about this
problem:
http://groups.google.com/group/vim_use/browse_thread/thread/bc916d611971d204

--
Best,
Ben

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