Unix Technical Forum

vi and vim

This is a discussion on vi and vim within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Folks, I am a novice vi user. I first started using it about six months ago. I am a ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 06:05 PM
Michael B. Levy
 
Posts: n/a
Default vi and vim

Folks,

I am a novice vi user. I first started using it about six months ago. I am
a recent Slackware convert, and I'm confused by the differences that vim
behaves on Slackware 10 than it did on Mandrake 10. In insert mode, if I
try to move around with the arrow keys, characters are written, ie A, B, C,
D. This means that I have to leave insert mode back to command mode just
to move the cursor around. In elvis, this doesn't happen, but elvis
doesn't have syntax highlighting, and I want to use vi to edit some html.

Any clue what I'm missing?

Mike

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 06:05 PM
William Park
 
Posts: n/a
Default Re: vi and vim

Michael B. Levy <mblevy2000@do.not.spam.optonline.net> wrote:
> Folks,
>
> I am a novice vi user. I first started using it about six months ago. I am
> a recent Slackware convert, and I'm confused by the differences that vim
> behaves on Slackware 10 than it did on Mandrake 10. In insert mode, if I
> try to move around with the arrow keys, characters are written, ie A, B, C,
> D. This means that I have to leave insert mode back to command mode just
> to move the cursor around. In elvis, this doesn't happen, but elvis
> doesn't have syntax highlighting, and I want to use vi to edit some html.
>
> Any clue what I'm missing?


Copy over .muttrc you used in Mandrake.

--
William Park <opengeometry@yahoo.ca>
Open Geometry Consulting, Toronto, Canada
Linux solution for data processing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 06:05 PM
reclusive monkey
 
Posts: n/a
Default Re: vi and vim

Use H,J,K,L for your movement keys. If you want a quick tutorial on
Vim, type vimtutor (I think! Sorry, on a 'bloze' box at work). Hope
this helps.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-19-2008, 06:05 PM
Handover Phist
 
Posts: n/a
Default Re: vi and vim

Michael B. Levy blithely blithered
> Folks,
>
> I am a novice vi user. I first started using it about six months ago. I am
> a recent Slackware convert, and I'm confused by the differences that vim
> behaves on Slackware 10 than it did on Mandrake 10. In insert mode, if I
> try to move around with the arrow keys, characters are written, ie A, B, C,
> D. This means that I have to leave insert mode back to command mode just
> to move the cursor around. In elvis, this doesn't happen, but elvis
> doesn't have syntax highlighting, and I want to use vi to edit some html.
>
> Any clue what I'm missing?
>
> Mike


Slack doesn't automagically configure vim like Mandrake does.

cp /usr/share/vim/vim63/vimrc_example.vim ~/.vimrc

--
Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs.
-- Dennis Ritchie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-19-2008, 06:05 PM
Michael B. Levy
 
Posts: n/a
Default Re: vi and vim

Handover Phist wrote:

>
> Slack doesn't automagically configure vim like Mandrake does.
>
> cp /usr/share/vim/vim63/vimrc_example.vim ~/.vimrc
>


Thanks!

Mike

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-19-2008, 06:06 PM
Realto Margarino
 
Posts: n/a
Default Re: vi and vim

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael B. Levy <mblevy2000@do.not.spam.optonline.net> trolled:
> Folks,
>
> I am a novice vi user. I first started using it about six months ago. I am
> a recent Slackware convert, and I'm confused by the differences that vim
> behaves on Slackware 10 than it did on Mandrake 10. In insert mode, if I
> try to move around with the arrow keys, characters are written, ie A, B, C,
> D. This means that I have to leave insert mode back to command mode just
> to move the cursor around. In elvis, this doesn't happen, but elvis
> doesn't have syntax highlighting, and I want to use vi to edit some html.


It sounds to me like you have the TERM variable messed up. Set the
TERM variable to "linux." If you are running vim from xterm you
should have TERM set to "xterm."

cordially, as always,

rm

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBQbUKOeEckfDWS6x8EQIRqwCgt2hte0J+7s7JBOgCvr/mrbEjqLkAnijR
yVSghBhZvDymyvRbU2KA0/6q
=bObY
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-19-2008, 06:07 PM
jayjwa
 
Posts: n/a
Default Re: vi and vim

On 2004-12-06, Michael B. Levy <mblevy2000@do.not.spam.optonline.net> wrote:

>> Slack doesn't automagically configure vim like Mandrake does.
>>
>> cp /usr/share/vim/vim63/vimrc_example.vim ~/.vimrc
>>

>
> Thanks!
>
> Mike



....and Elvis does syntax highlighting, too (as well as have background themes
and run in it's own window in X11). The syntax is about setting the right
file (look at the examples), but I think getting the themes &
backgrounds requires a recompile.

Here's my Elvis configuration. The font is my favourite sabvga one I found
someplace I've since forgotten:


if gui == "x11"
then {
set! font="sabvga"
}

set autoindent
set smartargs
set taglibrary
set wrapscan
set incsearch
map gw lbygS:word<Space><C-P><CR>
color x11.normal light gray on black
color x11.bottom navy blue on gray
color x11.selection white on dark gray
color x11.hlsearch boxed
color x11.cursor bold red on red
color x11.tool dark blue on white
color x11.toolbar white on gray40
color x11.scroll like tool
color x11.scrollbar like toolbar
color x11.status like tool
color x11.statusbar like toolbar
color x11.guide white
color x11.comment italic light cyan
color x11.string navy blue
color x11.keyword bold
color x11.function Red4 or pink
color x11.number Blue4 or light blue
color x11.prep bold Blue4 or light blue
color x11.prepquote like string
color x11.other like keyword
color x11.variable Gray15 or palegoldenrod
color x11.fixed gray35 or gray80
color x11.libt like keyword italic
color x11.argument like keyword green or dark green
color x11.hexheading gray70
color x11.linenumber gray
color x11.link like formatted underlined blue or light blue
color x11.spell on maroon

color termcap.normal light blue on black
color termcap.hlsearch bold
color termcap.ruler blue or light cyan
color termcap.showmode boxed green
color termcap.comment italic light cyan
color termcap.string white or brown
color termcap.char like string
color termcap.regexp like string
color termcap.keyword bold white or black
color termcap.function light cyan or cyan
color termcap.number light cyan or blue
color termcap.prep bold magenta or blue
color termcap.prepquote like string
color termcap.other like keyword
color termcap.variable like normal
color termcap.fixed white or gray
color termcap.libt like keyword
color termcap.hexheading gray
color termcap.linenumber gray
color termcap.link underlined blue or light cyan
color termcap.spell red or light magenta
color windows.spell on maroon
try {
alias wc {
"Count words in the buffer, or a range of lines
local w=0
!(%)%s/\w\+/let w=w+1/gx
calc w "words"
}
}
try check +other
try check -link
try aug END
then {
au!
au BgChanged light color x11.spell on pink
au BgChanged dark color x11.spell on maroon
au BgChanged light color windows.spell on pink
au BgChanged dark color windows.spell on maroon
}
try aug END

switch gui
case windows
case x11 {
color normal black on gray90
color argument like keyword green or dark green
color bottom like normal
color comment italic dark green or light green
color cursor blue on navyblue
color fixed gray35 or gray80
color function Red4 or pink
color guide white
color hexheading gray70
color hlsearch boxed
color keyword bold
color libt like keyword italic
color linenumber gray
color link like formatted underlined blue or light blue
color number Blue4 or light blue
color other like keyword
color prep bold Blue4 or light blue
color prepquote like string
color scroll like tool
color scrollbar like toolbar
color selection on tan
color spell on pink
color status like tool
color statusbar like toolbar
color string tan4 or tan1
color tool black on gray75
color toolbar white on gray40
color variable Gray15 or palegoldenrod
}
case vio
case termcap {
color normal white on black
color char like string
color comment italic light green or green
color fixed white or gray
color function light cyan or cyan
color hexheading gray
color hlsearch bold
color keyword bold white or black
color libt like keyword
color linenumber gray
color link underlined blue or light cyan
color number light cyan or blue
color other like keyword
color prep bold magenta or blue
color prepquote like string
color regexp like string
color ruler blue or light cyan
color showmode green boxed
color spell red or light magenta
color string white or brown
color variable like normal
}


There's probably a better way to do this (the two bottom bracketed parts
seem redundant, for example), but it did what I wanted so I left
it alone. Someday I'll go back and clean it up some, when I've more time.


Syntax is defined in the "elvis.syn" file and supports languages like
Perl, shell, html, php, Pascal, C/C++, email (OK, not it's not a lang.
but...) The themes from the site include these:

ceiling.ex
fungus.ex
greenbar.ex
greenspeckle.ex
marble.ex
nebula.ex
parchment.ex
sand.ex
stucco.ex
tiedye.ex
water.ex
wood.ex


--
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-19-2008, 06:08 PM
alexrait1
 
Posts: n/a
Default Re: vi and vim

I suggest to use this vimrc
http://t2.technion.ac.il/~shlomil/my.vimrc.txt
It has tab completion, really cool feature.

Message posted via:
=====================
www.linuxpackages.net/forum
www.linuxpackages.net
Expanding the world of Slackware
=====================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-19-2008, 06:13 PM
nabis
 
Posts: n/a
Default Re: vi and vim

Michael B. Levy wrote:
> Folks,
>
> I am a novice vi user.
>
> Any clue what I'm missing?
>
> Mike
>


locate vimrc
cat /usr/share/vim/vim61/vimrc_example.vim > ~/.vimrc


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:29 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com