Bash >
http://www.gnu.org/software/bash/manual/html_node/Readline-Init-File.html
Readline Init File
This is basically a steaming piece of shit that's unusable.
See also:
~/.inputrc
doesn't work in PCLinuxOS .92/etc/inputrc
man bash
andman readline
should help (but don't really.. since they're man pages and those aren't very useful)- I was unable to find a keyboard map online. How sad is that?!
-
control-v
and then the character or keystroke combination to learn what it is. To use it, replacecontrol
with\e
and replace[[
with[
Customization ∞
## Page up/down (scroll through history) # This leaves the cursor where it is, but should instead put the cursor at the end (and continue allowing up/down to cycle through that chunk of history) # One way (fails): #"\eOa": history-search-backward ## control+up-arrow #"\eOb": history-search-forward ## control+down-arrow # Alternate terminal type (fails): #"\e[2A": history-search-backward ## shift+up-arrow #"\e[2B": history-search-forward ## shift+down-arrow # success with PCLinuxOS .92 "\e[[5~": history-search-backward ## pageup "\e[[6~": history-search-forward ## pagedown ## ctrl-left and right (navigate words) # One way (fails): #"\eOd": backward-word #"\eOc": forward-word # Alternate terminal type (success with PCLinuxOS .92) "\e[1;5D": backward-word "\e[1;5C": forward-word ## Make tab cycle through alternates, instead of blocking typing and showing the list. "\t": menu-complete
F-keys ∞
This stuff puts a tilde ( ~
) on the next line!
"\e[OP":"echo ok" #F1 "\e[OQ" #F2 "\e[OR" #F3 "\e[OS" #F4 "\e[15" #F5 "\e[17" #F6 "\e[18" #F7 "\e[19" #F8 "\e[20" #F9 "\e[21" #F10 "\e[23" #F11 "\e[24":"echo ok\C-M" #F12
To do ∞
shift-tab
should go through the complete list backwards.
control-backspace and control-delete ∞
Apparently these were made really difficult to fix.
I may need to fiddle with the x keyboard driver to remap these hotkeys, and then I could have inputrc modified to use the remapping.
? ## ctrl-backspace ? ## ctrl-delete
Is the right file to use this?:
/usr/lib/kbd/keymaps/i386/qwerty/defkeymap.kmap.gz
Resources ∞
- http://www.faqs.org/docs/bashman/bashref_89.html
-
http://gentoo.linuxhowtos.org/bash/assign_commands_to_keys.htm
Notes from William Park ∞
man bash
man readline
-
history-search-forward
-history-search-backward
-.inputrc
For searching through the history, above should be enough, eg.
C-p: history-search-backward C-n: history-search-forward
which can be bound to some other keys of your choice.
For searching through previously visited directories, it's more complicated. You can easily build up a large list. So, you need
- some random access into "partial match", or
-
moving sequentially for few last directories that you can actually remember.
The key insight is "Programmable Completion" (man bash
). To make long story short, put this in ~/.profile
.
_cd () { local cur=${COMP_WORDS[$COMP_CWORD]} COMPREPLY=( $(compgen -W "`dirs`" -- $cur) ) } cd () { pushd "${1:-$HOME}" ; } alias b='pushd' # swap current and previous alias p='popd' # pop the current, and go back to previous complete -o dirnames -F _cd cd complete -d popd pushd
1.
cd
will push the new directory onto stack,p
will pop and move to previous directory.-
b
will toggle between current and previous, ie. swap the 2 items on the stack.
2. When you press <Tab>
, eg.
cd /usr<TAB>
it will try to complete on '/usr' from 'dirs' output. If no completion is possible, then only the directories will be listed.
Main problem is that if your 'dirs' has
/usr/local/src/bash ~
then typing
cd /<Tab>
will return
cd /usr/local/src/bash
This is okay if you wanted to go to /usr/local/src/bash
, but not if you wanted some other directory under /
, like /var/log
. For the latter case, you have to type more chars, eg.
cd /v<Tab>
ported, date is from the earlier content management system and is probably wrong
I don't know what these notes are really for, but these problems are solved under zsh.