LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-27-2003, 03:09 PM   #1
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Rep: Reputation: 30
VI problem, never been solved


vi behaves very oddly on all my systems, I dont understand it, I'm using fluxbox and xterm to access it, but when I'm in insert mode the arrow keys just seem to insert letters and also when I press 'i' to goto insert mode ... it dosnt say 'INSERT' in the bottom right hand corner, does anyone have ANY ideas, please, I've started this thread like 3 times over the last few month, but no-ones ever had the answer

atm I'm having to use pico locally, and I hate it ! please help me !
 
Old 07-27-2003, 04:06 PM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
wierd. are the keys being inserted escape keys? wierd since linux is supposed have that set up for ya already. anyway try this out.

http://www.tldp.org/HOWTO/Text-Terminal-HOWTO-16.html

Quote:
vi and Cursor-Keys


Vi uses the esc-key as a command to exit insert mode. Unfortunately for most terminals the arrow-keys send an an escape sequence (starting with the ESC character) to the host. Vi must distinguish between these two meanings of ESC. A smart vi (such as vim if configured for it) is able to detect the difference by noting the time between the ESC and the next key. If it's a short time, then it's likely that a cursor key was pressed. Use "help cursor-keys" in vim to find out more.


Here's another way to fix this. On VT terminals the left-arrow-key may be either set to send ESC [ D or ESC O D. The other arrow keys are similar but use A, B, and C instead of D. If you're having problems, choose ESC [ D since the "O" in the other alternative could be interpreted by vi as a command to "Open a line". The "[" should be interpreted by vi to mean that an arrow-key has been pressed. ESC [ D will be sent provided "Cursor Key Application Mode" has not been set. ESC [ D is normally the default so everything is seemingly OK. Except that many termcaps contain a string (not the init string) which sets what you want to avoid: "Application Mode". Editors may send this string to the terminal when the editor starts up. Now you are in trouble.


This string has the termcap code "ks" (smkx in terminfo) meaning enable the function (and related) keys (including the arrow keys). An application enables these keys by sending the "ks" string to the terminal. Whoever wrote the termcap reasoned that if an application wants to enable these keys, then they should be put into "Application Key Mode" since this is an "application", but you don't want this.


The Linux console has no "ks" string so you can't fall into this trap at the console. For other terminals you may need to edit the termcap (or terminfo) or use another termcap entry. You need to change not only the "ks" string but also the termcap definitions of what they send: kd, kl, kr, ku. Then run tic to install it.


For vim (vi iMproved) there is a way to set it up to work OK with ESC O D (so you don't need to edit termcap): See vim help for "vt100-cursor-keys". You may run "gitkeys" and then press your cursor keys to see what they send but they may be set to send something different when you're in an editor.
 
Old 07-27-2003, 04:41 PM   #3
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Original Poster
Rep: Reputation: 30
well, sorry, after closer inspection I've actually found I was using a symlink to a vim binary, but this dosnt actually bring me any closer to a solution, I just find it very odd when even pressing the i key to goto insert mode dosnt bring up the word INSERT in the bottom right hand corner, yet it still is in insert mode because I can insert text its so weird
 
Old 07-27-2003, 04:59 PM   #4
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
phoeniXflame,

can you use vim normally outside X?? An have you tried gvim in X (it's part of the xvim package)?
 
Old 07-27-2003, 05:02 PM   #5
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Original Poster
Rep: Reputation: 30
yea that seems to be ok, but I want to use it from xterm really :|
 
Old 07-27-2003, 05:32 PM   #6
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
Have you checked your .vimrc?
 
Old 07-27-2003, 05:37 PM   #7
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Original Poster
Rep: Reputation: 30
dont seem have one
 
Old 07-27-2003, 06:03 PM   #8
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
Hehe, well it seems that is your problem. It happened to me once, and vim was acting as weird as your is. Then I found out, that i had accidentally typed:
> .vimrc

instead of:
> .gvimrc

You can use this one if you like:
Code:
" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2002 May 28
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

set autoindent		" always set autoindenting on
" =================================================================
"if has("vms")
"  set nobackup		" do not keep a backup file, use versions instead
"else
"  set backup		" keep a backup file
"  endif
" =================================================================
set nobackup	" don't keep a backup file
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching
set tabstop=8		" keeping tab at default level
set softtabstop=2	" using softtab to set user level
set shiftwidth=2	" avoid 8 character auto indent
set noexpandtab	" no auto expanding - see lines 38 - 40
" set number		" uncomment this for line numbering

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " 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

endif " has("autocmd")
And please let me know if it solves the problem.

Enjoy
 
Old 07-28-2003, 04:44 AM   #9
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Original Poster
Rep: Reputation: 30
omg I could kiss you I really could ! that solved it ! everything is working perfectly now ! yay ! no more pico

thankyou VERY much
 
Old 07-28-2003, 06:19 AM   #10
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
Hehe, what a reaction!

Glad I could help.

Enjoy
 
Old 07-28-2003, 06:39 AM   #11
phoeniXflame
Member
 
Registered: Feb 2003
Location: Somewhere, UK
Distribution: Slack, OpenBSD, Debian, SuSE
Posts: 189

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by lfur
Hehe, what a reaction!

Glad I could help.

Enjoy
heh, well its because its taken SOO long to work out why its happening
 
  


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
Solved Problem Second GCC-Pass(or gettext sanity check problem) hoes Linux From Scratch 0 09-04-2005 10:20 AM
'PEAR.php' (include_path=''.:/usr/local/lib/php'') SOLVED SOLVED adengua Linux - Software 0 04-02-2004 03:34 AM
problem some what solved ritturaj Linux - Newbie 1 08-31-2003 11:57 AM
problem yet not solved ritturaj Linux - Hardware 2 08-06-2003 02:26 AM
The X-windows problem is solved...here's what I did shanlz Linux - Hardware 0 11-11-2002 12:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:02 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