vim restart at last line

adams k7qo at commspeed.net
Thu Aug 16 14:56:58 UTC 2007


After several months of wondering how to do this, I finally
found the info.  Although the web page had some of this, they
had a few extra characters that caused it to fail.  Don't
understand why people don't correct errors, but my guess is
time and effort......

These three lines in the ~/.vimrc file will allow users of vim
(vi substitute for us old folks that have been using UNIX SYS V
and BSD since the beginning of time) to restart editing any
previously edited file and return to the last line edited.
I find this especially handy in creating books and programs
where 99% of the time you return to where you were anyway.

Add the following or create a .vimrc in your home directory
with the following:


set viminfo='10,\"100,:20,%,n~/.viminfo
    au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm
$"|endif|endif


This works great for me.

Don't mess with or modify in any way the .viminfo file in your home
directory.

If you have never tried vi or vim, from a command window run

vimtutor

and follow the instructions.  I find that being a typist (I used
to do over 100WPM) this editor is my favorite.  The h,j,k,l use
of moving the cursor is very easy instead of moving across the
desk to the arrow keys as the hands never leave the "home" position.
Remember the "j" has a descender, thus moves down, and the "k" has
an ascender, thus moves the cursor up.  

FYI

Chuck Adams






More information about the kubuntu-users mailing list