Neither one nor Many
Software engineering blog about my projects, geometry, visualization and music.
In shell scripting I prefer the Kornshell. A while ago I experimented with "oh my zsh", but I switched back to ksh. Their auto completion for program commands is really unsurpassed (tab completion on program parameters for grep for example). The auto-incorrect however, is quite annoying . There is also a git plugin that visualized the active git branch in the
$PS1 prompt. I liked these features and I want to add them to ksh.
I fixed a few things for ksh in my
.kshrc at bitbucket.
My problem with the default behaviour: by default history is globally shared amongst all shells. I tend to work in a screen and do different stuff in each buffer. So it's annoying if stuff from one buffer magically appears in the other buffer.
So what I do is I make sure there is one history file
~/.ksh_history which contains all history from all shells. When starting a new shell I copy this file into a history file specific for that ("sub")shell, i.e.
~/.ksh_history_files/<shellpid>. Each new shell does this.
When a shell is started all history files from
~/.ksh_history_files/* are merged back into
~/.ksh_history. And the ones that are no longer in use (shells have exited) are removed. This is done with a simple
Commands are processed through a simply ksh function that makes sure all history lines are unique, without changing the order.
Some funny caveats were:
If you are inside a git clone).
Maybe the oh-my-zsh git integration is more advanced, no idea. Luckily this visualization in
$PS1 is very fast.
trigen@Firefly21:/projects> cd smashbattle trigen@Firefly21:/projects/smashbattle[network_multiplayer]> git branch master * network_multiplayer trigen@Firefly21:/projects/smashbattle[network_multiplayer]>
Fixed with a simple alias around cd provided by
dirs usage check here.
trigen@Firefly21:/usr/local/src/wxWidgets-3.0.0> cd <<<< this didn't work on Ubuntu 13.10 anyways. trigen@Firefly21:/home/trigen>
The browser is assumed to be "chromium-browser" (sudo apt-get install chromium-browser).
gi dan flavinis opened in a new chromium tab.
i <url>- open url in browser
g <search terms>- search with google.com
gi <search terms>- search with google images
gv <search terms>- search with google videos
gnl <search terms>- search with google.nl
gs <search term>- search google scholar
w <search term>- search wikipedia
wa <search terms>- search wolfram alpha
yv <search terms>- search youtube
y <search terms>- search yahoo
yi <search terms>- search yahoo images
yv <search terms>- search yahoo videos
imdb <search terms>- search imdb
h <search term>- search hyperdictionary
v <search term>- search vandale (dutch dictionary)
Usage example: Open run menu (
ALT+F2). Then type
gi dan flavin to get the example result from screenshot.
I had to abandon my pure-ksh-functions approach to make the launcher commands available everywhere.
So you have call
install_launcher as root to install the shortcuts as scripts in
Ubuntu does not respect shell functions in run unfortunately.