# case insensitive completion set completion-ignore-case on # - to _ insensitive completion set completion-map-case on # todo: explain this :) set menu-complete-display-prefix on # for readline-complete.el set bell-style none set completion-display-width 0 # preserve cusror location in history items. # unfortunately, this does not work when using vi-mode and j or k # I would like to make a patch to fix this. set history-preserve-point on # show all completions all the time set show-all-if-ambiguous on # this does a partial complete if it can before showing completions set show-all-if-unmodified on # nice in bash, but messes up completion in emacs shell #set visible-stats on set visible-stats off # turn off pager for completion set page-completions off # to answer this question in bash-completion README: # Q. When completing on a symlink to a directory, bash does not append # the trailing / and I have to hit again. I don't like this. set mark-symlinked-directories on # i had this set in the past to make c-u work, but it doesn't seem to be needed now. # not sure if it affected any other keybinds. #set bind-tty-special-chars off # key bindings: # note c-i/m/h/w are unusable, duplicating tab, enter, ctrl-del or something, backspace # C-x would be hard to rebind because emacs. "\C-q": exchange-point-and-mark # default not bound "\C-e": kill-region # default M-S-3 "\C-a": insert-comment # default is C-M-y "\e,": yank-nth-arg "\C-f": menu-complete # might be nice to bind this to tomsething, but not sure what: menu-complete-backward "\C-b": copy-region-as-kill # arrow keys. for other terminals, see http://unix.stackexchange.com/questions/10806/how-to-change-previous-next-word-shortcut-in-bash # this can be conditioned based on the term, see the term keyword in # bash's readline manual section #"\eOc": forward-word #"\eOd": backward-word "\e[1;5C": forward-word "\e[1;5D": backward-word Control-Space: set-mark # default is C-M-e which kinda sucks "\C-t": shell-expand-line # ctrl-delete "\e[3;5~": kill-word # default is C-x C-e "\C-g": edit-and-execute-command # default is C-y "\C-v": yank # default is C-M-y "\C-\M-v": yank-pop # by default, not bound "\C-p": dabbrev-expand # similar menu-complete, except for commands in history # default is C-q. this matches emacs. "\C-\M-q": quoted-insert # default is C-x C-u "\C-d": undo ####### commented out stuff ########### # vi mode settings and observatoins # double pound indicates it is only commented because I am not using vi mode ##set editing-mode vi # completion from history. how cool ##Control-SPACE: dynamic-complete-history # this is just kinda cool to show off: ##"\M-{": complete-into-braces # by default / and ? do a non-incremental search. This changes that. # the downside is that you have to type ctrl-v then / to get the actual char. ##set keymap vi-command ##"/": reverse-search-history ##"?": forward-search-history # make g go to the end of history. emacs has some meta key for this, # but we are not using g, so why not. ##"g": end-of-history # yank-pop from emacs mode, hacked into vim-mode. ##"o": vi-yank-pop # vim uses m to set a mark and ` to return to a mark specified # by letter. On a single line, this doesn't make much sense. So I'm using the # emacs way of a single mark. In vi-mode, you can do dm to delete a # mark. Emacs has its own delete and copy region commands. I'd like to hack the # source code to make d` delete to the mark and y` yank to the mark. I'm # leaving it for now, we will see how this works out in actual emacs when I get # my vi keybinds setup there. ##"`": exchange-point-and-mark ##"v": set-mark ##"m": kill-region ##"-": yank-last-arg ##"_": yank-nth-arg # w and b are normally always tripping over punctuation as word separators, I # think having W and B act like that is a bit more efficient default. And this # "shell" functions see words as the shell does, which is cool. # These are also only included as bash commands. # this is enables in .bashrc, after testing if bash version is > 4 # "b": shell-backward-word # "w": shell-forward-word # here we are with the unwrapped word, back and end functions, (that should get fixed). #"w": vi-fWord #"W": vi-fword #b: vi-bWord #B: vi-bword #"e": vi-eWord #"E": vi-eword # #unfortunately thre is another bug: binding for example W to vi-fword makes it #show that its bound to that and also vi-fWord, and the upper case one is what # word.now #happens # # I added a hack to the readline sources to reverse the upper/lowercase check on these # I would like to make a patch to make the command 'shell-end-word' # for some reason, binding the '=' key doesn't work. # for some reason, the documentation of the same commands seems to be more # extensive in bash. There are extra commands listed in the bash documentation # too, but so far they seem to be shell specific. # "p": yank #set keymap vi-insert # #notes: # #normal mode has this, which doesn't make sense. 'i' still works fine. whatever. # vi-insertion-mode (not bound) # # normal mode default keybinds also have this: # vi-fword (not bound) # vi-fWord (not bound) # # vi-bword (not bound) # vi-bWord (not bound) # # Looking in the readline sources, those are the real forward and back # commands, but they are wrapped in this: and its corresponding back version. # "W": vi-next-word # "w": vi-next-word # What this wrapper does is check for upper/lower case, do terminal ding if its # at the eol, and handle negative counts prefixed to it. # # This command: # "_": vi-yank-arg # works like this emacs command: # yank-last-arg # except it puts you in insert mode afterwards, so you can't make successive # calls to go to earlier last arguments. # # Emacs has a kill ring. yank means paste. yank-pop means go down the kill # ring, this only has an effect after a yank, or a yank-pop that was after a # yank. Vim also has a kill ring plugin, that has a yank-pop, and a yank-push, # to browse forward in the kill ring. In emacs there is no forward function, # you simply undo the yank. In bash vi-mode, undoing the yank undoes it # entirely, not each item in the kill ring. This isn't a big deal. In both # emacs and vi-mode, the kill ring stays in the new position regardless of the # undo. Vi-mode does not allow you to yank-pop after the vi pastes 'p' and 'P', # 1 problem is the cursor is in a little different position than an emacs yank. # I think I can modify the readline sources fairly easily to make this # possible. # There is an interesting incompatibility between vi and emacs mode. Emacs mode # always has the block be 1 square after the cursor. Same in vi-insert, but in # vi-normal, its on top of the character and can't go beyond the last # character, so if you do a yank at the last character in vi-normal, it does # not put the cursor after the last character like a normal yank because it # cant, and then you can't yank-pop because the cursor is in the wrong spot. # # # make ctrl-backspace work, see # https://unix.stackexchange.com/questions/264791/ctrl-backspace-and-ctrl-delete-in-bash "\C-h": unix-word-rubout