Vim

Make Shell Scripts Executable By Default

If you use vim to write shell scripts, you might want to save the “chmod +x” command after saving the script.

By adding the following line to your vimrc file (typically, it’s located at ~/.vimrc), scripts will automatically become executable.

au BufWritePost * if getline(1) =~ “^#!” | if getline(1) =~ “/bin/” | silent !chmod a+x <afile> | endif | endif

(meaning, if the file includes #! with “/bin/” in the path, apply “chmod a+x” on this file).

via shell-fu.

Have fun ;)

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, September 26th, 2009 Vim No Comments

Edit The Command Line With Vim

This is a quick (and great) tip I found at Daily Vim:

Open a linux terminal, and type some (long) command.
Now type [ctrl]+[x] and then [ctrl]+[e]
The command should be moved now to a vim window.
Edit the command (fix typos, change parameters, etc..) and save.
The command will now be executed.
Enjoy ;)

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

Tags: , ,

Monday, June 1st, 2009 Vim No Comments
my email
Already a member?
Login
Login using Facebook:
Last visitors
my photo
Hi,
My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and am currently studying for a BSc. in electrical engineering at The Electrical Engineering school , Technion , Israel.
I work at the verification dept. 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.
March 2010
S M T W T F S
« Jan    
 123456
78910111213
14151617181920
21222324252627
28293031  
Opensource Logo
SEO Powered by Platinum SEO from Techblissonline

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