LinHES Forums
http://forums.linhes.org/

Get vi arrow keys working in insert mode and more
http://forums.linhes.org/viewtopic.php?f=3&t=18986
Page 1 of 1

Author:  cliffsjunk [ Mon Sep 22, 2008 10:12 pm ]
Post subject:  Get vi arrow keys working in insert mode and more

Get vi arrow keys working in insert mode and more

Copy the following to ~/.vimrc for each user that you want to fix.
That probably means to /root/.vimrc and to /home/mythtv/.vimrc
at least. Fixes cursor keys in insert mode and replace mode as well
as some other things.

Code:
" Mandrakelinux configuration.
" Rafael Garcia-Suarez <rgarciasuarez@mandrakesoft.com>

" Don't set vi-compatibility
set nocp

" Syntax highlighting only for vim-enhanced
if has("syntax")
    syntax on
endif

" I know it's horrible for a vi master but useful for newbies.
imap <C-a> <Esc>I
imap <C-e> <ESC>A
map <C-Tab> <C-W>w
imap <C-Tab> <C-O><C-W>w
cmap <C-Tab> <C-C><C-Tab>

" Some macros to manage the buffer of vim
map <F5> :bp<C-M>
map <F6> :bn<C-M>
map <F7> :bd<C-M>

" Default backspace like normal
set bs=2

" Terminal for 80 char ? so vim can play till 79 char.
"set textwidth=79

" Some options deactivated by default (remove the "no" to enable them)
set nobackup
set nohlsearch
set noincsearch

" Always display a status-bar
" set laststatus=2

" Show the position of the cursor
set ruler

" Uncomment this to disable wrap
"set nowrap

" Show matching parentheses
set showmatch

" Make % work with <>
set mps+=<:>

I copied this from my old Mandriva router box where I have noticed
that vi works so much better for years...

Cliff

Author:  manicmike [ Tue Sep 23, 2008 4:50 pm ]
Post subject:  Re: Get vi arrow keys working in insert mode and more

cliffsjunk wrote:
Copy the following to ~/.vimrc for each user that you want to fix.


Try copying it to /etc/vimrc to make it global for the system.

Mike

P.S. Generally this will only work for vim. For some systems vi opens in legacy mode and would not read this file. Works fine on KM though

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/