I was having the same prob and managed to fix it. Its when you've got 2 xterm/vim sessions open and you copy/paste with the mouse from one to the other.
If the src window/file had a comment at the end of the line (or as the whole line) as in Perl/shell ie '#', then the target ended up with '#' on each line and the next newline, as per his example.
Not exactly sure how I fixed it (
), but :
1. mv /etc/vimrc /etc/vimrc_bak
2. mv /etc/virc /etc/virc_bak
3. here's my new/current $HOME/.vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
" allow backspacing over everything in insert mode
" Only do this part when compiled with support for autocommands.
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
endif " has("autocmd")
if &term =~ "xterm"
" stop auto matching parentheses, but shift-% still works
let loaded_matchparen = 1
Hope it works for you. You may need to logout (completely) and in again to avoid any caching effects.