open urxvt here and open in vim applescript
Update: noticed a little bug in the script, the right way to do it should be this:
set disp_no to do shell script "disp_no=($( ps -awx | grep -F 'bin/X' | awk '{print $(NF-2)}' | grep -e \":[0-9]\" )); if [[ -n $disp_no ]];then DISPLAY=${disp_no}.0; else DISPLAY=:0.0; fi;echo $DISPLAY"
if you have tcp forward off, maybe without $NF if it’s enabled but anyway grep -F X11.app won’t work with newer X versions
If you don’t already know I use x11 and a selfcompiled terminal version of vim for all my work. If you’re in OS-X you might still want to run text files in your favorite editor, and have the ability to open the terminal in the current finder version for whatever reason.
I started using Fastscripts Light a long time ago and it’s a pretty nifty little app. The applescript is based a bit on the OpenInTerminal applescript.
However, for some reason when I run the scripts from Fastscripts via hotkey the DISPLAY variable is wrong as follows:
/tmp/launch-9el5tK/:0
I use the following in my shell config files(sorry, it’s not really mine, but I have no idea who I got it from)
# Set the DISPLAY variable -- works for Apple X11 with Fast User Switching if [[ -z $DISPLAY && -z $SSH_CONNECTION ]]; then disp_no=($( ps -awx | grep -F X11.app | awk '{print $NF}' | grep -e ":[0-9]" )) if [[ -n $disp_no ]];then export DISPLAY=${disp_no}.0 else export DISPLAY=:0.0 fi echo "DISPLAY has been set to $DISPLAY" fi
Anyway, the to fix the openinrxvt all you need to do is change it the following way:
disp_no=($( ps -awx | grep -F X11.app | awk '{print $NF}' | grep -e ":[0-9]" ))
if [[ -n $disp_no ]];then
DISPLAY=${disp_no}.0
else
DISPLAY=:0.0
fi
echo $DISPLAY
compressed, the Applescript looks as follows:
set disp_no to do shell script "disp_no=($( ps -awx | grep -F X11.app | awk '{print $NF}' | grep -e \":[0-9]\" )); if [[ -n $disp_no ]];then DISPLAY=${disp_no}.0; else DISPLAY=:0.0; fi;echo $DISPLAY"
do shell script "env DISPLAY=" & disp_no & " /opt/local/bin/urxvt -cd '" & the_path & "' &> /dev/null &"
tell application "X11" to activate
Running vim is pretty much the same except that you will need to compile a console version with the server option, and then run the original instance with—servername VIM (or whatever servername you might want to use).
The relevant launch part of the Applescript looks like this:
do shell script "env DISPLAY=" & disp_no & " /opt/local/vim/bin/vim --remote \"" & the_path & "\" &> /dev/null &"
You can get the complete openinrxvt script here and the run in vim script here
After you place them into your ~/Library/Scripts/Applications/Finder folder you can use Fastscripts:fastscripts to create Finder specific hotkeys.
You might also be interested in a modified version of the script that uses the client/daemon set up of urxvt, which I talked about earlier.
do shell script "env RXVT_SOCKET=$HOME/.rxvt_socket DISPLAY=" & disp_no & " /opt/local/bin/urxvtc -cd '" & the_path & "' &> /dev/null &"
cutehg in OSX
UPDATE: murky native osx mercurial client is out
sed -i '' -e 's/port:tk//' /opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/python26/Portfile sudo port install python26 sudo port install py26-sip
Pyqt4 seemed to have problems with qt4.5 so I installed it with the QT available from the Trolltech website.
wget http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.4.4.tar.gz tar xzvf PyQt-mac-gpl-4.4.4.tar.gz cd PyQt-mac-gpl-4.4.4 python2.6 ./configure.py -q /Developer/Tools/Qt/qmake make install hg clone http://bitbucket.org/bfrog/cutehg-stable/ cd cutehg-stable python2.6 setup.py install
After you install everything you might get an annoying bug looking as follows while using the annotate or history command:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) pyqt4
checking the python shell gives this:
python2.6 >>> import sys >>> sys.getdefaultencoding() 'ascii'
This is easily fixed by doing:
echo "import sys sys.setdefaultencoding('utf-8')" > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/sitecustomize.py
What i don’t really get is why python won’t just use my LC_LOCALE/ALL but whatever.
HTH
ViInutMate on github
I noticed some people try to reach that viinputmate page, which was supposed to be a better vi plugin for textmate but there’s nothing on it…
Well, I never bothered “finishing” it. I did just push what I had on github though. However, since I didn’t version anything it’s just a big blob difference from the sourceforge thing. Maybe you’ll have some use for it, but I pretty much abandoned it a long time ago.
Anyway, long story short here it is: http://github.com/fishman/viinputmate/tree/viinputmate
Vim & Rails
I did a little write up on my general vim workflow and presented it at the hamburg rails user group meeting . I didn’t quite manage to get it as smooth as I originally planned, but anyway you can find the slides here
It was intended to be more like Andrei Zmievski VIM for (PHP) programmers but well, maybe next time.
I’ll probably focus more on getting a fast WOW! effect on the listeners and then let them ask the questions themselves, instead of trying to explain everything and failing because I keep finding new, interesting things to show…