January 21st, 2011 § § permalink
Make Vim more IDE-like by assigning F5 to save and run your current script. Just add this to your ~/.vimrc
map <F5> <Esc>:w<CR>:!%:p<CR>
This maps the F5 key to run two things: :w, which saves your file, and :!%:p, which will run your current script (! runs a shell command and %:p expands to the path of your current file).
A test example
echo "#!/bin/bash" > test.sh
echo "echo hello world" >> test.sh
chmod +x test.sh
vim test.sh
Now pressing F5 while in Vim will save test.sh and run the file in Vim’s internal shell. Just press enter when the script is done to return to Vim.
code based on discussion at stackoverflow
August 10th, 2008 § § permalink
There’s always a couple Firefox features I miss when I’m using Opera. Here’s how to setup Opera’s tab behavior like Firefox’s. These work in Opera 9.5.
Close Tab Behavior
Opera normally moves back to the last active tab, but you can get it to behave like Firefox when closing tabs, moving to the next tab on the right.
- Go to Tools » Preferences » Advanced » Tabs
- Set the “When closing a tab” option to “Activate next tab”.
Control Click Opens Link In Background Tab
Opera can behave like Firefox, opening links in a background tab when control-clicking links by using a custom user javascript file. First, setup your user javascript directory in Opera.
- Go to Tools » Preferences » Advanced » Content » JavaScript Options
- “User JavaScript files” to “~/.opera/userjs”. (You may have to create this folder)
- Download Shoust’s allinbackground.js javascript (also mirrored here) into this folder. Now control-click your links.
Thanks to Marv for finding Shoust’s post.