LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-19-2010, 06:34 PM   #1
nicklaszlo
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Rep: Reputation: 0
Strange vim startup behavior when accessed via cygwin ssh


Weird problem:

Text is automatically entered into my vim session within a few seconds of vim starting up. This is really annoying because when I open an existing document it can cause changes to the document that I then have to undo. If the automatically entered text messes up my automatically generated folds I have to restart vim to get them back. What's really weird is the problem only seems to occur when using vim over ssh.

I run WindowMaker 0.92 on Cygwin X Server 1.7.3 with Windows XP. I ssh in an xterm. The remote host is Debian Testing with Kernel 2.6.30-2-686. The remote VIM is 7.2.

If I press "i" really fast on vim startup I can get a sample of the text that is automatically entered. It appears to be something I typed into vim at some point in the past. It includes LaTeX commands since that's mostly what I use vim to write. Here is a sample copied from Cygwin into XP so the encoding is messed up but it will give you a good idea:
Quote:

\int g(\oemga)<80>kb<80>kb<80>kb<80>kb<80>kbmega)\d<80>kb<80>kbd\omega
\sum ((`/\hbar\oemg<80>kb<80>kb<80>kbmega
kT^<80>kb

^%2<80>kb<80>kb2\\^M&\approx -`/1
12
`/\int g(\oe<80>kbmega)((`/<80>kb\ESClihbar\<80>kb<80>kb<80>kb<80>kb<80>kb<80>kb{\hbar\oemga<80>kb<80>kb<80>kb<80>kbmega
kT

^2
ESChhlid\omegaESCllli\int g(\omega)d\omega
\\<80>kb<80>kbESC:w^M\lljjjj$a^M`/1
I assume <80>kb (~@kb in the correct encoding) is supposed to be a nonalphanumeric key.


Here is my .vimrc:

Quote:
" Configuration file for vim
set runtimepath=~/.vim,/usr/share/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vimcurrent,/usr/share/vim/vimfiles/after,/usr/share/vim/addons/after,~/.vim/after

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=indent,eol,start " more powerful backspacing

" Now we set some defaults for the editor
set autoindent " always set autoindenting on
" set linebreak " Don't wrap words by default
set textwidth=0 " Don't wrap lines by default
set viminfo='20,\"50 " read/write a .viminfo file, don't store more than
" 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc

" We know xterm-debian is a color terminal
if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
set t_Co=16
set t_Sf=[3%dm
set t_Sb=[4%dm
endif

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
" set background=dark

if has("autocmd")
" Enabled file type detection
" Use the default filetype settings. If you also want to load indent files
" to automatically do language-dependent indenting add 'indent' as well.
filetype plugin on

endif " has ("autocmd")

" Some Debian-specific things
if has("autocmd")
augroup filetype
au BufRead reportbug.* set ft=mail
au BufRead reportbug-* set ft=mail
augroup END
endif

" Uncomment the following to have Vim jump to the last position when
" reopening a file
" if has("autocmd")
" au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
" \| exe normal g'\"" | endif
" endif

" Set paper size from /etc/papersize if available (Debian-specific)
if filereadable("/etc/papersize")
try
let s:shellbak = &shell
let &shell="/bin/sh"
let sapersize = matchstr(system("cat /etc/papersize"), "\\p*")
let &shell=s:shellbak
if strlen(sapersize)
let &printoptions = "paper:" . sapersize
endif
catch /^Vim\%((\a\+)\)\=:E145/
endtry
endif

" The following are commented out as they cause vim to behave a lot
" different from regular vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif

"folding
set foldmethod=syntax
Speculation: Some weird interaction between my cygwin/X settings or xterm settings and my vim settings.

This line looks particularly suspect, but I don't see what my problem has to do with color:

if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
 
Old 02-19-2010, 09:13 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
I'm not a vim expert but I'm sure someone will shoot this down.

Could there be some commands being sent that replay a recording or reload a previous register in vim ?
I see your .vimrc has this line
set viminfo='20,\"50 " read/write a .viminfo file, don't store more than
" 50 lines of registers

Maybe it's worth seeing if such a register exists and if its contents match the bad input. At least you'll know it's not a ghost !
Or it could be that your terminal is replaying some old content after vim is opened.

Anyway, this seems like a useful site for vim commands
http://successtheory.com/tips/vimtips.html

Towards the bottom of the page are the commands for displaying the contents of registers and cleaning them out.
for example @q executes a recording or register. If your terminal is sending such characters unseen then it may cause your problem.

Just speculating myself really.

regards

Alan

Last edited by smoker; 02-19-2010 at 09:16 PM.
 
Old 02-19-2010, 11:45 PM   #3
nicklaszlo
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
It looks like the problem is coming from the "#Registers" section of my .viminfo. So why is it only getting dumped into my buffer when I use cygwin/ssh? Note some of my registers were very long, probably due to my pressing q and not noticing it.

I don't want to disable my .viminfo file, nor do I want to disable storing registers across sessions. I think the line you pointed out just limits the length of the registers.

In the mean time, I have tried deleting the existing registers. We will see if the problem comes back.
 
Old 02-24-2010, 09:31 PM   #4
nicklaszlo
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Deleting the existing registers did not help. I was careful to remove them using a program other than vim since editing .viminfo with vim will cause your work to be automatically undone. I think I can rule out a malformed register as the cause. Any new ideas?
 
Old 03-13-2010, 10:49 PM   #5
nicklaszlo
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Anyone else have any ideas?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Vim behavior in ubuntu, # goes to start of line. exodist Linux - Software 1 11-26-2008 08:59 PM
cygwin vim copy/paste problem takahaya Linux - Software 2 03-31-2006 01:16 AM
annoying vim behavior pauloco Linux - Software 0 09-27-2005 12:10 PM
chmod acts strange in Cygwin greg108 Linux - General 1 08-08-2003 09:34 AM
Cygwin and VIM alexandru Linux - Newbie 0 03-07-2002 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration