[OT] Help with "vim" on Linux

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

[OT] Help with "vim" on Linux

Post by chulett »

Working on my first Linux system where vi is actually vim or "Vi IMproved" under the covers and some of the so-called improvements are making me crazy. Two in particular and curious what my options are, if any:

1) It remembers where I was in every dang file from session to session and puts me back there when I vi it again. I would prefer to just start at the top, is there a setting for this?

2) Search highlighting. Fine, nice and all but how in the heck do you clear them? All I've been able to figure out to do is to then search for something I know it won't find. And it remembers them as well between sessions, exiting and coming back doesn't get rid the dang things.

Thanks.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Does it still use .exrc?
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It apparently uses both a ".vimrc" and a ".viminfo", the former is similar and the latter seems to keep all of the history.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Re: [OT] Help with "vim" on Linux

Post by sbass1 »

chulett wrote:1) It remembers where I was in every dang file from session to session and puts me back there when I vi it again. I would prefer to just start at the top, is there a setting for this?
http://durgaprasad.wordpress.com/2007/0 ... m-solaris/

http://ubuntuforums.org/showthread.php?t=209136

So search for BufReadPost in your vimrc?
chulett wrote:2) Search highlighting. Fine, nice and all but how in the heck do you clear them? All I've been able to figure out to do is to then search for something I know it won't find. And it remembers them as well between sessions, exiting and coming back doesn't get rid the dang things.
http://vim.wikia.com/wiki/Highlight_all ... rn_matches

Perhaps rename your .vimrc, and build yours up from scratch?

http://stripey.com/vim/vimrc.html

http://www.vi-improved.org/vimrc.php

(There are others of course...Google for sample .vimrc files and steal and modify until you get one that works for you).

HTH...

Scott
Some people are the Michael Jordan's of Datastage. I'm more like Muggsy Bogues :-)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks Scott, I'll check out those links. For the record, i don't actually have a .vimrc file in my home but there may be a global one out there. I do, however, have my very own .viminfo file! Neeto. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Post by sbass1 »

Look for /etc/vimrc, /etc/vim/vimrc, or /usr/local/share/vim/vimrc.

Or do

Code: Select all

find / -name vimrc
, then go get a cup of coffee :wink:

Or create ~/.vimrc, which should override any global settings.

Code: Select all

:scriptnames
should tell you which initialization files are used.

HTH
Some people are the Michael Jordan's of Datastage. I'm more like Muggsy Bogues :-)
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Code: Select all

:nohlsearch
turns the highlighting off, however, you will get the highlighting again when you next do a search.

Code: Select all

:let @/ = "" 
seems to do the same.

Supposedly unsetting the "hlsearch" option stops it from happening but I haven't figured out how to set it (have removed the hlsearch entry from .vimrc but still highlights for me... and .viminfo is telling me it is still set).

As for the line it opens on... haven't figured it out...
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

If it is Redhat Linux, and you are getting vim when you type vi you can just "unalias vi" to get the original vi command. I'm colorblind, so vim drove me nuts. I just put the unalias vi command in my .bash_profile so it is turned off for me when I login.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

To always open a file on the first line, in the .vimrc file, change the "set viminfo=" line to have 0 after the single quote...

Or you could move back to using just vi as per previous comment... but where is the fun in that???

Edit: And to solve the highlighting, add a 'h' on to the viminfo line (remembering it is a comma separated list)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

asorrell wrote:If it is Redhat Linux, and you are getting vim when you type vi you can just "unalias vi" to get the original vi command. I'm colorblind, so vim drove me nuts. I just put the unalias vi command in my .bash_profile so it is turned off for me when I login.
Yes, it is RH w/ bash and it's not like I'm typing "vim", I type vi and get vim instead so that unalias sounds like a godsend. I just figured my poor old brain-dead vi was gone for good. [sniff]

And between putty and vim on RH, all of the colors have been a bit much - kind of like going from Kansas to Oz, if you know what I mean. I had to find a custom color scheme that 'worked' for me as the default one drove me nuts and the blue it used made anything blue illegible to me. Ended up with lighter 'desert' colors that are (mostly) palatable.

I'll let you know tomorrow! And sorry Kryt0n but I'm quite at home in vi and have no need for none of them there fancy improvements. One sec, be right back... Damn munchkins, get off my lawn!

:wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
aartlett
Charter Member
Charter Member
Posts: 152
Joined: Fri Apr 23, 2004 6:44 pm
Location: Australia

Post by aartlett »

If you are connecting to the R/Ht system from a Windows box, I like to use UltraEdit by IDM, It was cheap, can access files on the Unix/Linux remote box and becomes a 1 stop editing shop for me. Combined with my favorite File tool (FileCommander) I'm in pig heavin (one without a fllu though).

Just my effective 0 cents (2 cents rounded down because we don't use copper anymore)
Andrew

Think outside the Datastage you work in.

There is no True Way, but there are true ways.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I have UltraEdit, wasn't aware of the remote access stuff. I'll have to check that out.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

asorrell wrote:you can just "unalias vi" to get the original vi command
That worked! Very nice, thanks Andy. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply