# bindings in bash

*Entered: in emacs on Gemini PDA*
*Date: 20231016*

## so there I was, living under a rock

I setup fzf as a bash history fuzzy finder recently (a month
or two ago). The code that I found and used from the web
included, of course, a binding to C-r to trigger this. Which
set off an excited "what?" in my mind. I knew, that bash had
bindings such as C-r, C-l, etc. but I never even thought of
setting custom bindings.

## my new favorite thing

I added a binding to C-e to start emacsclient in the current
directory (dired). Here is the code to add to ~/.bashrc:

```
# start emacs daemon if it is not running
if [[ ! $(ps -e | grep emacs) ]] ; then
 (emacs --daemon=ec) &> /dev/null &
 disown -a
fi

bind -x '"\C-e": emacsclient -s /var/run/user/1000/emacs/ec -c -a "" ./'

# or something like this for termux...
# bind -x '"\C-e": emacsclient -s /data/data/com.termux/files/usr/var/run/emacs10090/ec -c -a "" ./'
```

Then source your .bashrc and Bob's your uncle, ctrl e starts
dired in emacsclient in the current directory. So damned
nice. Apparently it doesn't take much to make me happy?