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

Make Google Even Smarter With Google Subscribed Links

Just noticed this feature today in my Google Preferences page (I don’t visit this page regularly so I can’t tell how new this feature is).

This feature allows you to subscribe to different kinds of sources to lookup your query in, in addition to the “regular” search.

You can enable it in your Google Preferences. And you can manage your subscription in the Subscribed Links page.

› Continue reading

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

Tags: ,

Wednesday, September 8th, 2010 Google No Comments

Enhance The Experience of Logitech Keyboards and Mice on Linux

Just brought the Logitech Corded Wave keyboard, which is very comfortable and great (As long as one can ignore the ugly windows/internet explorer/msn messenger symbols printed on some of its keys).

The keyboard has many extra keys, like the function keys, a dedicated zoom in/out keys and more. The problem is that they don’t work on Linux (Ubuntu 10.04 in my case) out of the box, which is a little sad.

Fortunately, I found a simple solution in the internet, and now I can use all the features of the keyboard. The following solution can be used for almost all models of Logitech keyboards and mice.

› Continue reading

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

Tags: ,

Monday, August 30th, 2010 Hardware No Comments

Move Gnome Panel To The Second Monitor – Ubuntu

Say you have two monitors set up as “extended desktop”, and you want to move the gnome-panel from one monitor to the other monitor.

Here is how to do it in Ubuntu (Tested on Ubuntu 10.04):

1. Right click the panel, choose “properties”.

2. In “General” tab, uncheck “expand”.

3. Drag the panel from its left or right edge to the other monitor.

4. Right click the panel, choose “properties”, in “General” tab recheck “expand”.

You’re done. Have fun ;-)

Found the tip here.

Update:

An easier way, is just to hold “Alt” key, and drag the panel from one monitor to the other. No need to play with the “expand” setting. ;-)

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

Tags: , , ,

Tuesday, August 24th, 2010 Linux 3 Comments

[Moved] Regular Expression To Check For Prime Numbers

Moved to http://www.malloc.co/regular-expressions/check-if-a-number-is-prime-using-a-regular-expression/

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

Tags: ,

Saturday, July 24th, 2010 Regular Expressions 2 Comments

Firefox Extensions To Make Web Pages More Eye Friendly

To understand what I’m talking about, take a look at Dr Chip’s Vim Website which is a great resource about vim-related stuff, but is an extremely ugly website, I mean, it really hurt my eyes whenever I visit it.

If you use Firefox, then you can easily solve this problem with these two Firefox extensions. Both serve the same purpose: Making websites easier to read, by removing distractions and allowing you to focus on the content instead. Each one displays the website in a different style, and they have different options. I installed both and use them alternately (and regularly).

› Continue reading

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

Tags: , ,

Sunday, July 18th, 2010 Firefox No Comments

Colorize Make, GCC and Diff’s Output

Generally, output is more readable when it has colors to allow you distinguish between warnings, errors and progress logs.

Using colormake, colorgcc and colordiff, you can have the output of make, gcc, diff (respectively) coloured.

To install in Ubuntu:

sudo apt-get install colorgcc colormake colordiff

You might want to use aliases to override the normal make/gcc/diff commands.

Original tip from here.

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

Tags:

Saturday, July 17th, 2010 Linux No Comments

Fix Bad Indentation When Pasting Text To Vim

The problem is this:

You’re editing a buffer in vim, you copy a text (say, code snippet) from another place (say, Firefox), and you paste it inside vim (with middle mouse button / shift+insert). Most chances you won’t like what vim has just did to your text.

The problem is that vim doesn’t “know” that you’re actually pasting a text, and it thinks that you’re typing. So, if you have indentation enabled, it will re-indent your text.

The solution is simple: Whenever you want to paste text from outside vim into vim. Type this in command mode:

:set paste

So now vim knows that you’re going to paste text, and it will not touch it.

To disable the paste mode:

:set nopaste

As easy as that ;-)

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

Tags:

Friday, July 16th, 2010 Vim No Comments

NumPad Problems When Using Vim over Tmux

I use vim as my main text editor, and I usually split the screen to edit a few buffers in parallel. To make resizing the windows faster, I mapped the numpad keys “/*-+” to resize the windows (see original vim tip here).

Recently, I started to use tmux, and opened vim, split the windows as usual, and tried to resize them. It didn’t work :)

I use Ubuntu 10.04 (Don’t remember the exotic name..), and I found that the latest tmux package in their repo is 1.1-1.

Anyway, version 1.1-1 has a bug with the NumPad. The solution is to download the source of tmux 1.2 and build it. It depends on libevent so you’ll need to get it first:

this is how to make it work:

1. sudo apt-get install libevent-dev

2. Get the source tarball of tmux from here.

3. tar xzf tmux-1.2.tar.gz

4. cd tmux-1.2

5. ./configure

6. make

7. sudo make install

Done. Now your life is better. Have fun ;-)

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

Tags: , , , ,

Saturday, July 3rd, 2010 Vim 2 Comments

Online JavaScript Lint

In general, a lint is a great tool which saves hours of debug. It will find the syntax errors for you, and even give you warnings to avoid potential bugs.

I happened to write JavaScript this week, and found a great Online JavaScript Lint.  Use with care ;-)

Ah, and they also have a downloadable version.

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

Tags: , , ,

Sunday, June 27th, 2010 Web Development No 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.
June 2012
S M T W T F S
« Sep    
 12
3456789
10111213141516
17181920212223
24252627282930
SEO Powered by Platinum SEO from Techblissonline

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