|Summary:||Problems with home/end keys in vim when used inside screen|
|Product:||Gentoo Linux||Reporter:||uriahheep <uriahheep>|
|Component:||Current packages||Assignee:||Vim Maintainers <vim>|
|Package list:||Runtime testing required:||---|
Description uriahheep 2005-10-29 01:46:54 UTC
When one tries to use the 'Home' or 'End' keys in app-editors/vim when running it inside app-misc/screen, the cursor will not go to the end/beginning of the line you're on. instead, vim will jam for a second, and, if in insert mode, will leave insert mode. additionally, in any mode, if the character that the cursor is on is a letter, it will be replaced with either its uppercase or its lowercase, depending on the letter's original case. note that this problem has only been experienced with american keyboards, and the keycodes to resolve the issue are possibly specific only to these keyboards. to resolve this problem, one must simply add these 4 lines to /etc/vimrc: map <ESC>[8~ <End> map <ESC>[7~ <Home> imap <ESC>[8~ <End> imap <ESC>[7~ <Home> i would suggest the addition of these lines to gentoo's default vimrc in order to rectify this annoyance upon installation of the application involved and improve general usability of gentoo's factory-installed vim. Reproducible: Sometimes Steps to Reproduce: 1. enter an instance of screen 2. run vim 3. inside vim, enter insert mode, type some jibberish for you to test on 4. press either 'home' or 'end' key (no need to exit instert mode, pressing the home or end key should do it for you :P) 5. (optionnal) press either key again, and witness further manifestations of mysterious, worrisome forces Actual Results: 1. vim will magically exit insert mode. 2. if the character that the cursor was on upon the pressing of involved keys is a letter, the letter's case (upper/lower) will be reversed 3. outside of insert mode, the reversing of cases will persist Expected Results: pressing home key --> cursor appears at beginning of line pressinf end key --> cursor appears at end of line thankyou for reading.
Comment 1 uriahheep 2005-10-29 01:55:14 UTC
hmm, perhaps i should correct a statement i made: >> note that this problem has only been experienced >> with american keyboards, and the keycodes to resolve >> the issue are possibly specific only to these keyboards. more like that is the only type of keyboard that i have had the chance of trying... ;)
Comment 2 Ciaran McCreesh 2005-10-30 17:41:56 UTC
What's the underlying terminal? This sounds like a terminfo issue, not something that should be solved by maps...
Comment 3 uriahheep 2005-10-31 06:59:04 UTC
This problem has persisted in both aterm and xterm, and I don't doubt that it would manifest itself in other terminals. Additionally, I've had this problem with all of my Gentoo installs, on all of my computers, but only inside X and a terminal. When in command line, I have no problem. This quick fix is all that I've been able to use to repair vim functionality, and it doesn't seem to affect any other functionality.. I believe that the maps will not affect any setups with other types of keyboards if they are in the default vimrc, since I see that maps to these same keycodes have been applied unconditionally for the same purpose in /etc/inputrc (while being ineffective in vim+screen in terminal windows) without hurting anyone not having this problem's install. This leads to my belief that this may be a little reported, yet widespread problem, one which could be resolved with these simple, harmless maps. Anyway, I'm going to school now... Thanks
Comment 4 Ciaran McCreesh 2005-10-31 18:38:55 UTC
Wrong scope for the fix, unless it somehow turns out that this is vim-specific. What are t_K1, t_K4, t_kh and t_@7 in vim?