jsVim - Vi control for your browser!

Javascript, Programming, Projects, jsVim 1 Comment »

If you like keyboard shortcuts, or you know how to use Vi to control navigation of a page, then you’re going to love this! (this is not to be confused by jsvi which allows vi control for a textarea in your browser)

I used to use a Firefox extension called Vimperator that basically allowed me to control and navigate through websites using the keyboard with Vim like commands. It was a good tool, actually a great tool, but I got frustrated when I didn’t have this same functionality on Safari, or any Fluid apps (making web apps into a distinct desktop application).

I had planned initially on making jsVim work with websites I developed, but then I realized not too many people would be happy with Vim control on those pages, unless I had a unique activation key event that enabled the rest of the key commands. But anyway, I digress. So it occured to me that making it cross browser specific would be ideal, and the use of Grease[monkey,kit] would allow me to do that.

So long story short, I developed jsVim in javascript form and then created an accompanying Grease[monkey,kit] script to utilize jsVim. There’s still much work to be done (incorporating keyboard events for links/hrefs/onlicks, search/find, colon[:] console commands, etc), but I think what is available is a pretty good start to get this out into the wild.

You can use svn to check out the code, or you can just install the greasemonkey script and get to work using it right away (if you have grease[monkey,kit] already installed).

Greasemonkey script

SVN
svn co http://svn.jadecell.org/jsvim/

Here are some useful commands that should get you started working around in your browser:

  • ‘j’ - scroll down on the page (like using the down arrow)
  • ‘k’ - scroll up on the page (like using the up arrow)
  • ‘Shift+j’ - scroll down a full page (like using the Page Down button)
  • ‘Shift+k’ - scroll up a full page (like using the Page Up button)
  • ‘h’ - scroll left on the page (like using the left arrow)
  • ‘l’ - scoll right on the page (like using the right arrow)
  • ‘Shift+h’ - Go Back in history (like the browser back button)
  • ‘Shift+l’ - Go Forward in history (like the browser forward button)
  • ‘Shift+g’ - goto the bottom of the page
  • ‘gg’ or ‘U’ - goto the top of the page
  • ‘Alt+Shift+?’ - disable jsVim keyboard shortcuts
  • ‘Esc’ - re-enable keyboard shortcuts, remove cursor in a form field from view, remove bottom console window

The next big TODO, is to get link navigation working and a full out help menu when you press the ‘?’ in the window.

Any other ideas and comments are always welcome.

===================

UPDATE:
This script will not work with Firefox’s quick search. Be sure to uncheck “Search for text when I start typing” in the Preferences >> Advanced >> General settings. I’m sure there is a workaround for this, but in the meantime, to get quicksearch up is to type ‘/’, i’ll have my quicksearch disabled until I can get this to work well.

myPyTunes v0.2

Python, myPyTunes No Comments »

I’ve updated and posted the myPyTunes script on Assembla using its Wiki/Trac/SVN project capabilities. I could put it on Google Code, but I figure I try Assembla out since somebody else recommended this to me before. Assembla maybe a bit of fluff, but I’ll give it a whirl for now.

myPyTunes has been recoded and I’m planning to classify (OOP) it for the next update. Another step will be to make it a fully integrated web application with server so it’s completely portable. In due time I guess, but until then, here is the link to the Main Website and SVN

http://www.assembla.com/wiki/show/mypytunes 

myPyTunes: iTunes from the Terminal in Python

Programming, Python, Shell, myPyTunes No Comments »

Inspired by the Controlling iTunes from the Terminal article explaining a bash shell command line script to (as the title says) control iTunes from the terminal. I liked this, but I felt I needed a bit more flexibility (meaning I want it coded in something i know better), and I really like Python (especially when i decide to classify this script), so I decided to port it over to Python.

I found this useful to have installed on the Mac Mini sitting on a desk while i was across the room on my Powerbook. Very handy since I didn’t want to have to get up every time I wanted to change the song, or pause it when the phone rang, etc.

So far its a pretty clean traslation over with a few modified functions, and a few functions I’ve thrown in from other posts I had seen, or functions I feel would be cool to be added.

I’ve only tested this on OSX 10.4.11 - iTunes 7.6, so even though I believe it should work on other versions of iTunes/OSX, don’t take my word for it, but please let me know if you do run into any problems with it.

Right now i’ll upload the file along with this blog, but i’ll be sure to use a versioning tool as i make updates.

Download myPyTunes here - Right click the link and choose “Save As..”

Here is the basic help menu when you type in “itunes -h”:

———————————————————-
iTunes Command Line Interface
———————————————————-
Usage: /usr/bin/itunes <option>
Options:
status = Shows iTunes’ status, current artist, and track.
play = Start playing iTunes.
stop = Stop iTunes
pause = Pause iTunes.
playpause = Play/Pause iTunes.
next = Go to the next track.
prev = Go to the previous track.
mute = Mute iTunes’ volume.
unmute = Unmute iTunes’ volume.
vol up = Increase iTunes’ volume by 10%
vol down = Increase iTunes’ volume by 10%
vol # = Set iTunes’ volume to # [0-100]
quit = Quit iTunes
launch = Launch iTunes
playlist @ = Play iTunes’ playlist named @”
list = list playlists.
shuf = turn on shuffle playlist
noshuf = turn off shuffle playlist
ostream = open stream
help = what’s showing now
———————————————————-