Hmmm, you should not have ':set paste' in vimrc (you don't want
it active all the time). You are supposed to use 'pastetoggle'
and press the key you chose before doing a paste, as at:
http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste
I don't see how you would get that problem if 'paste' is set,
but perhaps something has switched it off (use ':set paste?') to
check current value.
John
Alexander Dietz wrote:Hmmm, you should not have ':set paste' in vimrc (you don't want
> 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
it active all the time).
You are supposed to use 'pastetoggle'
and press the key you chose before doing a paste, as at:
http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste
I don't see how you would get that problem if 'paste' is set,
but perhaps something has switched it off (use ':set paste?') to
check current value.
John
--
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
+1
Experiencing similar problems , i'll had to re-indent everything again
, also wondering if there used to be a solution
> Thanks Alex -- 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
- --
Best Regards,
Aaron Lewis - PGP: 0xDFE6C29E
Key Server: http://keyserver.veridis.com
Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMquOwAAoJECSSp9Df5sKezSMP/A2WZMGJER2JDHHvPvAjWYbY
EJUogT9PJjOg7PbOvwiEGXESerY/SOa3KY/fKQ8DazJ9wOVmDYAC7UzceB0Ez3DP
eeYXMOXOtEB6dlpuGrCf6PRsDosemFYjLZ0J06fDSdonKaonw+dBA1yQTHKGL6fS
mte0W21HyC1znc4CTN0rBWs4NsAba9mAVlVpi+6ej6X59LgNoKlNlMGBZgtbm0gA
c7LnvI6y4kanvnK96MZj8Azrz3AVe2wPo0FMfJhKhsAkXuOH+Qgh6dzwt4YtJyyK
WCIzZvsEKcOju/iCRvXdwbn4pDfRbeVq/NxUvUTtZjSQgR/fJwNFufrjUPM7O/WS
u60+NJddyqtBQ6t1UyDekuRLaZL9fo0oTN3PkPzPjtuLkIcBn3czMN0XS/lI1NjS
rOsEHrddG1qwjBaC3SGIOrlnEWot+L8LD3gZChozLoLAubgReupNwDvx3aI0zw3M
2nSUwivD+RBm880RITlEEJ4s4Hm0irudVpfH/a2DLAYFv7UjpTVki/NU7TNAYWJ6
Pc9fZvc/TCvapVvUP0LJfwTIOVsKz2OkVW70FOjygpAqfkm/oDXOqjpcTIUyc1wQ
w7Oa+onmgIBJqPT7S16DQgv1cog1kWX9AxHUyksymBfh3eZ2KW3P2jUKNp3HRx3L
cy6VhlJZRgMbatPPdyGf
=VJEs
-----END PGP SIGNATURE-----
>
> Removing ':set paste' does not solve this problem.
Did you try to explicitly execute ':set paste' JUST BEFORE pasting the text?
> Now I cannot paste text
> at all !!!
What?
The result that you pasted before is what must happen when nopaste is
set, but you must be able to paste either in paste and nopaste modes.
:set paste only temporary disables things like autoindent which could
alter the pasted text.
--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301
2010/10/5 Alexander Dietz <alexand...@googlemail.com>:
Did you try to explicitly execute ':set paste' JUST BEFORE pasting the text?
>
> Removing ':set paste' does not solve this problem.
The way you type any command.
In normal mode, simply type ':set nopaste<enter>'.
2010/10/5 Alexander Dietz <alexand...@googlemail.com>:
> Hi,
>
> On Tue, Oct 5, 2010 at 16:00, Joan Miquel Torres Rigo
> <joanm...@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>'.
--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301
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.
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.
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.
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.
> 2010/10/5 Alexander Dietz:
>> Hi,
>>
>> On Tue, Oct 5, 2010 at 16:18, Joan Miquel Torres Rigo wrote:
>>>
>>> 2010/10/5 Alexander Dietz:
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.)
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
2010/10/5 Alexander Dietz <alexand...@googlemail.com>:
> Hi,
>
> On Tue, Oct 5, 2010 at 16:18, Joan Miquel Torres Rigo
> <joanm...@mallorcaweb.net> wrote:
>>
>> 2010/10/5 Alexander Dietz <alexand...@googlemail.com>:
>> > Hi,
>> >
>> > On Tue, Oct 5, 2010 at 16:00, Joan Miquel Torres Rigo
>> > <joanm...@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.
>
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.
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.
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.
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.
You don't need to put nothing: You need to remove the supurius ':' in
> 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.
your commands.
: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
autocmd BufEnter * set ai sw=4 ts=4 sta et fo=croql
On Tue, Oct 5, 2010 at 1:17 AM, Alexander Dietz <alexand...@googlemail.com> wrote:
autocmd BufEnter * set ai sw=4 ts=4 sta et fo=croql
On Tue, 5 Oct 2010, Alexander Dietz wrote:
> 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 wrote:
>
>> 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.
.vimrc is only one source of configuration. If you have any plugins
installed or your distributions global vimrc (in my case
/etc/vim/vimrc), they might make their own changes.
>> 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.
'paste' mode isn't what you seem to think it is. It prevents some of
the features you're setting from working ('autoindent' doesn't
autoindent in 'paste' mode, 'formatoptions' is ignored in 'paste' mode).
See: :help 'paste' for full details. The gist is that paste mode is
designed to work around problems with pasting: in a terminal without
proper mouse support, Vim has no way to tell whether you're pasting with
the mouse or just typing really fast, and even so, Vim has no way to
know that you don't want some of the automatic formatting applied, just
because you're pasting.
>> 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.
>
> [...]
>
> 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
>
Using that exact .vimrc, with shift+middle-click I get stair-stepping.
With Middle-click alone, it works how you want.
If you leave out the 'ai' (autoindent) in the BufEnter autocmd, there's
no stair-stepping, with or without shift. Same with 'si' (smartindent),
which is arguably better.
On Tue, 5 Oct 2010, Alexander Dietz wrote:
>
> On Tue, 5 Oct 2010, Benjamin R. Haskell wrote:
>
> > :verbose set paste?
>
> This command results in the word 'paste' shown at the bottom of the
> vim window.
The '?' is part of the command. ':set paste?' shows the current status
of 'paste'. Adding the 'verbose' should show you where 'paste' was last
set.
> > 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-'.
>
> But I do need to use the shift key. It's a fact for me even with 'set
> mouse=a'.
Checking some other features that might affect this. How about:
:verbose set ttymouse? term?
> > 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
>
> So you mean my problem need some other changes, related to xterm etc?
> Why do I need that? I just can copy from/to between: emacs, xterms
> (different computers, different operating systems, does not matter at
> all), browser edit windows etc... Maybe you could elaborate that
> point a bit?
Due to the long history of how terminal emulators, computers, and mouses
interact, programs can access mouse information in different ways. Full
discussions is beyond the scope of the Vim list. The XTerm change
log[1] lists several changes to allowWindowOps. The other programs you
list might not use the same method that Vim uses to access mouse
information. So, the allowWindowOps option might not matter to them.
For the way vim under xterm uses the mouse, you might need it. The
reason allowWindowOps affects Vim is that (I think) it relies on XTerm's
"bracketed paste mode"[2], which is only available when window ops are
allowed, and can be runtime enabled/disabled via 'paste64' (another X11
Resource for XTerm).
[1] http://invisible-island.net/xterm/xterm.log.html
[2] http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt (search for
bracketed paste mode)
> It seems that vim is not that smart at all in the end....
It's not helpful to keep reïterating that.
--
Best,
Ben
>>
>> On Tue, Oct 5, 2010 at 1:17 AM, Alexander Dietz wrote:
>>
>>>
>>> autocmd BufEnter * set ai sw=4 ts=4 sta et fo=croql
>>>
>>
>
> This was confusing for me to read, you may find parsing your .vimrc
> easier if you convert
>
> autocmd BufEnter * set ai
>
> into
>
> set ai
>
> or even (my favorite)
>
> set autoindent
>
>
> This way it's easier to actually understand what your .vimrc is doing.
> I think these three directives are equivalent but someone more
> qualified than me can correct me if there are differences between
> them.
With the autocommand version, the options get set whenever changing to
a different buffer. If a modeline turns off 'autoindent', it will be
turned back on. If a modeline sets its own 'formatoptions', the autocmd
resets it.
So, there's a difference. Personally, I thought these lines were
weirder:
autocmd FileType * set tabstop=2|set shiftwidth=2|set noexpandtab
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
(Why not combine the 'bar'-delimited ':set' commands?) But either way,
it works the same. Just for reference, fully "compressed":
au FileType * se ts=2 sw=2 noet
au FileType python se ts=4 sw=4 et
--
Best,
Ben
>>
>> 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.
Maybe because you are who are experiencing the problem? ;-)
[...]
> 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
Then imagine how much time we have to spend trying to solve problems
to people who doesn't want to provide required information about ITS
OWN PROBLEM and prefer to write long emails claiming glass-ball
solutions instead of simply type ':set paste' and tell us what
happens.
Cheers.
Oops!
I didn't know that.
Thank you for rectification.
[...]
>> 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.
I'm not sure because I never tryed this, but I think it is possible to
directly paste mouse selection within vim (or I thought to understood
that reading :help gui-selections). But I think this needs some setup.
Anyway I'm not an authority in this question. I rarely paste data from
mouse selection in vim.
>> You don't need to put nothing: You need to remove the supurius ':' in your
>> commands.
>>
>
> (See above.)
(Ack ;-))
On Tue, 5 Oct 2010, Alexander Dietz wrote:
The '?' is part of the command. ':set paste?' shows the current status of 'paste'. Adding the 'verbose' should show you where 'paste' was last set.
On Tue, 5 Oct 2010, Benjamin R. Haskell wrote:
> :verbose set paste?
This command results in the word 'paste' shown at the bottom of the vim window.
Checking some other features that might affect this. How about:
> 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-'.
But I do need to use the shift key. It's a fact for me even with 'set mouse=a'.
:verbose set ttymouse? term?Due to the long history of how terminal emulators, computers, and mouses interact, programs can access mouse information in different ways. Full discussions is beyond the scope of the Vim list. The XTerm change log[1] lists several changes to allowWindowOps. The other programs you list might not use the same method that Vim uses to access mouse information. So, the allowWindowOps option might not matter to them. For the way vim under xterm uses the mouse, you might need it. The reason allowWindowOps affects Vim is that (I think) it relies on XTerm's "bracketed paste mode"[2], which is only available when window ops are allowed, and can be runtime enabled/disabled via 'paste64' (another X11 Resource for XTerm).
> 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
So you mean my problem need some other changes, related to xterm etc? Why do I need that? I just can copy from/to between: emacs, xterms (different computers, different operating systems, does not matter at all), browser edit windows etc... Maybe you could elaborate that point a bit?
[1] http://invisible-island.net/xterm/xterm.log.html
[2] http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt (search for bracketed paste mode)
It's not helpful to keep reïterating that.
It seems that vim is not that smart at all in the end....
--
Best,
Ben
> I'm not sure because I never tryed this, but I think it is possible to
> directly paste mouse selection within vim (or I thought to understood
> that reading :help gui-selections). But I think this needs some setup.
This is what I use. It's far from perfect but it's a start.
:command! -nargs=1 R :normal :set paste<cr>i<cr><esc>k:r <args><cr>:j!<cr>`[k:j!<cr>:set nopaste<cr>`^
nnoremap <f9> :R !xclip -o<cr>
imap <f9> <c-\><c-o><f9>
--
Andr� Majorel http://www.teaser.fr/~amajorel/
Subliminal message : Vim needs arbitrary tab stops.