When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
On Thu, 16 Aug 2012 13:23:28 -0500 Les Mikesell wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
I discovered exactly the same behaviour in the Sylpheed email editor a few weeks back. Not only with cut-and-paste, but just typing into the editor window. If a line starts with # then every following line after that also gains one as you type.
Frank Cox wrote:
On Thu, 16 Aug 2012 13:23:28 -0500 Les Mikesell wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
I discovered exactly the same behaviour in the Sylpheed email editor a few weeks back. Not only with cut-and-paste, but just typing into the editor window. If a line starts with # then every following line after that also gains one as you type.
Huh. I just tried it, KDE, rxvt, CentOS 6.3, and don't see that. # ipmitool -o supermicro sel list 1 | 08/15/2012 | 20:06:32 | Physical Security #0xaa | General Chassis intrusion | Asserted gets just that.
mark
On Thu, Aug 16, 2012 at 1:44 PM, m.roth@5-cent.us wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
I discovered exactly the same behaviour in the Sylpheed email editor a few weeks back. Not only with cut-and-paste, but just typing into the editor window. If a line starts with # then every following line after that also gains one as you type.
Huh. I just tried it, KDE, rxvt, CentOS 6.3, and don't see that. # ipmitool -o supermicro sel list 1 | 08/15/2012 | 20:06:32 | Physical Security #0xaa | General Chassis intrusion | Asserted gets just that.
It is probably trying to be smarter than we are and doing something context-sensitive. Try naming the file you are editing something.pl.
-- Les Mikesell lesmikesell@gmail.com
Les Mikesell wrote:
On Thu, Aug 16, 2012 at 1:44 PM, m.roth@5-cent.us wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
I discovered exactly the same behaviour in the Sylpheed email editor a few weeks back. Not only with cut-and-paste, but just typing into the editor window. If a line starts with # then every following line after that also gains one as you type.
Huh. I just tried it, KDE, rxvt, CentOS 6.3, and don't see that. # ipmitool -o supermicro sel list 1 | 08/15/2012 | 20:06:32 | Physical Security #0xaa | General Chassis intrusion | Asserted gets just that.
It is probably trying to be smarter than we are and doing something context-sensitive. Try naming the file you are editing something.pl.
Odd. vi trythis.pl, then I highlight from another window # semanage fcontext -a -t httpd_sys_content_t '/mipav-svn(/.*)?' /etc/selinux/targeted/contexts/files/file_contexts.local: line 5 has invalid regex mipav-svn/(*): Invalid preceding regular expression
, and that's what I get, with two lines.
mark
On Thu, 16 Aug 2012, Les Mikesell wrote:
It is probably trying to be smarter than we are and doing something context-sensitive. Try naming the file you are editing something.pl.
That is exactly what it isdoing. A .pl file will probably syntaxted as a perl script.
From man vim: /usr/share/vim/vimrc System wide Vim initializations.
________________________________
From: Les Mikesell lesmikesell@gmail.com To: CentOS mailing list centos@centos.org Sent: Thursday, August 16, 2012 11:23 AM Subject: [CentOS] vi defaults in 6.x
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
--
> Les Mikesell
=== To make vi less annoying, I always create a .vimrc in the homedir of the account in question. It contains:
syntax off set nohlsearch set noincsearch :let loaded_matchparen = 1 set noai set paste set mouse= set noautoindent
Hope this helps!
______________________________________________________________________ If life gives you lemons, keep them-- because hey.. free lemons. "♥ Sticker" fixer: http://microflush.org/stuff/stickers/heartFix.html
+1 for .vimrc config files vi is generally a symlink to vim these days.
@Les, I've seen the auto-comment behavior you speak of. You may want to set formatoptions [0] in your .vimrc
[0] http://vimdoc.sourceforge.net/htmldoc/change.html#fo-table
@Joseph: You have autoindent specified twice - once in its abbreviated form and then the long version.
set noai set noautoindent
---~~.~~--- Mike // SilverTip257 //
On Thu, Aug 16, 2012 at 3:08 PM, Joseph Spenner joseph85750@yahoo.com wrote:
From: Les Mikesell lesmikesell@gmail.com To: CentOS mailing list centos@centos.org Sent: Thursday, August 16, 2012 11:23 AM Subject: [CentOS] vi defaults in 6.x
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
-- Les Mikesell
=== To make vi less annoying, I always create a .vimrc in the homedir of the account in question. It contains:
syntax off set nohlsearch set noincsearch :let loaded_matchparen = 1 set noai set paste set mouse= set noautoindent
Hope this helps!
If life gives you lemons, keep them-- because hey.. free lemons. "♥ Sticker" fixer: http://microflush.org/stuff/stickers/heartFix.html _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
SilverTip257 wrote:
+1 for .vimrc config files vi is generally a symlink to vim these days.
@Les, I've seen the auto-comment behavior you speak of. You may want to set formatoptions [0] in your .vimrc
[0] http://vimdoc.sourceforge.net/htmldoc/change.html#fo-table
@Joseph: You have autoindent specified twice - once in its abbreviated form and then the long version.
set noai set noautoindent
Also, unless you want it to act like vi, use `set nocompatible` so that it is then full vim & then your vimrc will have full effect.
Cheers,
Phil...
On 08/16/2012 04:55 PM, SilverTip257 wrote:
vi is generally a symlink to vim these days.
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
On Sun, Aug 19, 2012 at 2:31 AM, Gordon Messmer yinyang@eburg.com wrote:
On 08/16/2012 04:55 PM, SilverTip257 wrote:
vi is generally a symlink to vim these days.
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
The systems where I'd be pasting script contents mostly have the software development package group installed. The aliasing explains why it happens seemingly randomly since I'd sometimes have root's environment, sometimes not. In any case, the ':set paste" mode behavior is what I want. I don't mind syntax highlighting but it seems extremely bizarre for something pretending to be vi with a default setting to ever, under any conditions, insert something you didn't type.
Gordon Messmer yinyang@eburg.com wrote:
On 08/16/2012 04:55 PM, SilverTip257 wrote:
vi is generally a symlink to vim these days.
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
It is neither a symlink nor a shell alias - execpt maybe for platforms that for some reason don't include vi.
vi is OSS and the OSS vi is fully POSIX compliant.
and BTW: vi does not read .vimrc but .exrc
Jörg
On 08/20/2012 04:07 AM, Joerg Schilling wrote:
Gordon Messmeryinyang@eburg.com wrote:
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
It is neither a symlink nor a shell alias - execpt maybe for platforms that for some reason don't include vi.
On a CentOS system, "vi" will be a shell alias when the "vim" package is installed. Otherwise it will be a variant of "vim" which is more compatible with the POSIX description of "vi" (though not 100%). As we are discussing CentOS, I believe my statements did not require correction. Thanks.
On 20.8.2012 19:16, Gordon Messmer wrote:
On 08/20/2012 04:07 AM, Joerg Schilling wrote:
Gordon Messmeryinyang@eburg.com wrote:
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
It is neither a symlink nor a shell alias - execpt maybe for platforms that for some reason don't include vi.
On a CentOS system, "vi" will be a shell alias when the "vim" package is installed. Otherwise it will be a variant of "vim" which is more compatible with the POSIX description of "vi" (though not 100%). As we are discussing CentOS, I believe my statements did not require correction. Thanks.
I got curious ;-)
vim-minimal installs /bin/vi vim-enhanced installs /usr/bin/vim and sets the alias (the "vim" package)
[falb@xxx ~]$ which vi alias vi='vim' /usr/bin/vim [falb@xxx ~]$ which vim /usr/bin/vim [falb@xxx ~]$ whereis vi vi: /bin/vi /usr/share/man/man1/vi.1.gz /usr/share/man/man1p/vi.1p.gz
But the alias is not set for root!
[root@xxx ~]# which vi /bin/vi [root@xxx ~]# which vim /usr/bin/vim
On Sun, 26 Aug 2012 08:26:48 Markus Falb markus.falb@fasel.at wrote:
On 20.8.2012 19:16, Gordon Messmer wrote:
On 08/20/2012 04:07 AM, Joerg Schilling wrote:
Gordon Messmeryinyang@eburg.com wrote:
Actually, it's a shell alias. And then, only if "vim" is installed, which it isn't in some configurations. IIRC, desktop systems have him by default, but server installations do not.
It is neither a symlink nor a shell alias - execpt maybe for platforms that for some reason don't include vi.
On a CentOS system, "vi" will be a shell alias when the "vim" package is installed. Otherwise it will be a variant of "vim" which is more compatible with the POSIX description of "vi" (though not 100%). As we are discussing CentOS, I believe my statements did not require correction. Thanks.
I got curious ;-)
vim-minimal installs /bin/vi vim-enhanced installs /usr/bin/vim and sets the alias (the "vim" package)
[falb@xxx ~]$ which vi alias vi='vim'
> /usr/bin/vim
[falb@xxx ~]$ which vim /usr/bin/vim [falb@xxx ~]$ whereis vi vi: /bin/vi /usr/share/man/man1/vi.1.gz /usr/share/man/man1p/vi.1p.gz
But the alias is not set for root!
FWIW, If you comment out the line "[ -n "$ID" -a "$ID" -le 200 ] && return" in /etc/profile.d/vim.sh then the alias will be set at login.
Regards,
From: Les Mikesell lesmikesell@gmail.com
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
If you do not want to change the defaults, you could temporarily call vim without the initializations: vim -u NONE ...
JD
On Fri, Aug 17, 2012 at 5:22 AM, John Doe jdmls@yahoo.com wrote:
From: Les Mikesell lesmikesell@gmail.com
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
If you do not want to change the defaults, you could temporarily call vim without the initializations: vim -u NONE ...
That's the effect I want, since I log into a lot of different machines and paste stuff into scripts. But, it doesn't seem to work. With 'vim -u NONE /tmp/test.pl' it still does the auto-comment stuff.
From: Les Mikesell lesmikesell@gmail.com
On Fri, Aug 17, 2012 at 5:22 AM, John Doe jdmls@yahoo.com wrote:
From: Les Mikesell lesmikesell@gmail.com
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a
# to
all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
If you do not want to change the defaults, you could temporarily call vim without the initializations: vim -u NONE ...
That's the effect I want, since I log into a lot of different machines and paste stuff into scripts. But, it doesn't seem to work. With 'vim -u NONE /tmp/test.pl' it still does the auto-comment stuff.
Works for me at least to avoid "crazy" double auto-indent... And it turns off syntax highlighting too. But I have no auto-comment in either modes...
JD
On Fri, Aug 17, 2012 at 10:35 AM, John Doe jdmls@yahoo.com wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a
# to
all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
If you do not want to change the defaults, you could temporarily call vim without the initializations: vim -u NONE ...
That's the effect I want, since I log into a lot of different machines and paste stuff into scripts. But, it doesn't seem to work. With 'vim -u NONE /tmp/test.pl' it still does the auto-comment stuff.
Works for me at least to avoid "crazy" double auto-indent... And it turns off syntax highlighting too. But I have no auto-comment in either modes...
That's interesting - I don't think I've ever changed any defaults. I'm using the text mode version in a gnome-terminal window in case that makes a difference.
On Fri, 2012-08-17 at 11:02 -0500, Les Mikesell wrote:
On Fri, Aug 17, 2012 at 10:35 AM, John Doe jdmls@yahoo.com wrote:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a
# to
all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
If you do not want to change the defaults, you could temporarily call vim without the initializations: vim -u NONE ...
That's the effect I want, since I log into a lot of different machines and paste stuff into scripts. But, it doesn't seem to work. With 'vim -u NONE /tmp/test.pl' it still does the auto-comment stuff.
Works for me at least to avoid "crazy" double auto-indent... And it turns off syntax highlighting too. But I have no auto-comment in either modes...
That's interesting - I don't think I've ever changed any defaults. I'm using the text mode version in a gnome-terminal window in case that makes a difference.
Of course, if you don't care for vim, you can always use the old, simple version by using the command "/bin/vi" instead of "vim" and that should do away with most of the enhancements.
* Les Mikesell lesmikesell@gmail.com [08/16/2012 14:23]:
When I use copy/paste text into a window running vi, if there is a single line starting with '#', in the pasted content, it adds a # to all subsequent lines and indents each an additional level. Is there some way to eliminate this bizarre behavior, preferably globally and permanently so I don't have to repeat some change for every machine/user where I might log in?
to avoid this behavior during paste, just do: :set paste just before pasting.
Daniel.