Neither one nor Many

 
January 15 2011

When navigating directories, every now and then pushd . and popd just aren't sufficient. When directory structures tend to become quite deep, I get really annoyed with typing change-directory’s and wish I had some bookmarks. That's why some time while ago I created a simple tool for usage within (GNU) screen: CTRL+X pops up a menu for selecting common directories and files ("bookmarks"!). This makes switching between those long directory structures a lot more pleasant img1!

Create bookmarks file

// Configuration file ($HOME/.launcher)
[
   {"Websites, configuration" : [
      {"dir" : "/srv/www/vhosts/ray.burgemeestre.net"},
      {"dir" : "/srv/www/vhosts/www.burgemeestre.net"},
      {"dir" : "/usr/local/src/mongoose/am"},
      {"dir" : "/usr/local/src/mongoose/am/output/ray-blog-burgemeestre-net"},
      {"file" : "/etc/apache2/vhosts.d/www-burgemeestre-net.conf"},
      {"file" : "/etc/apache2/vhosts.d/ray-blog-burgemeestre-net.conf"},
      {"file" : "/etc/apache2/vhosts.d/ray-burgemeestre-net.conf"}
   ]},
   {"Common Lisp" : [
      {"dir" : "/var/chroot/lispbot/home/trigen"},
      {"file" : "/var/chroot/lispbot/home/trigen/bot.lisp"}
   ]},
   {"C++ projects" : [
      {"dir" : "/usr/local/src/launcher"},
      {"dir" : "/usr/local/src/launcher/src"},
      {"file" : "/usr/local/src/launcher/src/parser.cpp"}
   ]}
]

Use in screen with C-x

Choosing a directory in the menu opens it in a new screen tab. Choosing a file opens a new menu which allows you to dispatch it to specific editors or e-mail it (options currently all hardcoded in the source).

Installation

Most of the code is still from 2007, but these last two days I refactored the code a bit. And added some build scripts. (Needless to say I didn't get to implementing all features I had in mind.) It's all on github for download.

It installs /usr/local/bin/launcher and two helper bash scripts (/usr/local/bin/launch_scr.sh and /usr/local/bin/launch_scr2.sh). You bind it to screen in your .screenrc with this line: bindkey ^x exec /usr/local/bin/launch_scr.sh.

(Also for your .screenrc I recommend using a caption if you don't already with: caption always "%{Yb} %D %Y-%02m-%02d %0c %{k}|%{G} %l %{k}|%{W} %-w%{+b}%n %t%{-b}%+w")

C++ Comments (0)


Leave a Reply

Comment may not be visible immediately, because I process everything manually.**

**) I plan to automate this.., but it's on my ToDo since for ever..


Author:
Ray Burgemeestre
february 23th, 1984

Topics:
C++, Linux, Webdev

Other interests:
Music, Art, Zen