Archive for September 9th, 2010

Make Vim Remember The Cursor’s Last Position After Exiting

So you edit a file in vim, you exit vim, and after a while you want to edit the file again. Many times it’s nice to have the cursor placed in the same position you left it. Here’s how to make this happen:

1. Add this to your ~/.vimrc file  (or to /etc/vim/vimrc to enable to the feature system-wide):

if has(“autocmd”)
au BufReadPost * if line(“‘\”") > 1 && line(“‘\”") <= line(“$”) | exe “normal! g`\”" | endif
endif
2. Check if the file ~/.viminfo  exists. If it doesn’t, create it:
touch ~/.viminfo

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Thursday, September 9th, 2010 Vim 3 Comments
my email
my photo
Hi,
My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
I'm a Verification Engineer in Mellanox Technologies Ltd.
I love Linux, the Command Line and the OpenSource Community.
I used to write Poems (Arabic) when I was able to find time for this.
September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  
SEO Powered by Platinum SEO from Techblissonline

Twitter links powered by Tweet This v1.7.4, a WordPress plugin for Twitter.