You are not logged in.
I want to remap some of the vi command mode keybindings in ~/.inputrc. I originally did this by hacking the readline code, but that's just dumb...
I've got the keybindings mapped ok using key: command, for example:
d: backward-char to map backward char to d instead of to h.
However, the problem is, this is remapping the keys in insert mode instead of command mode! I tried wrapping the remappings in $if statements, thus:
$if mode=vi
#keymaps
$endif
But that does the same thing. I also tried $if mode=vi-command, but that disabled the new keymappings all together. Is there another mode I need to try, or do I have to map the keybindings some other way?
Dusty
Offline
Why are you changing vim's keybinding's in .inputrc, you should change them in .vimrc. with map <key> <set of functions>.
I am not sure what you mean by h and d. Do you mean how to move backwards in edit mode? if that's the case, maybe try something like: map d h (i am not sure if it works, you can check vim.org for a better description than mine) you can fool around from within vim by doing ":map d h" and seeing what happens, if that's what you wanted just add the line to your .vimrc
Offline
I'm not changing vim's bindings, I want to change readline's (ie: bash) bindings when it is set to vi-compatible mode. In vim, I have the d h t n j k and l keys remapped; I want to remap the same keys in vi compatible readline as well.
I originally did this by patching the readline source; I'd like to try it with keybindings now... didn't know you could bind keys in readline. The problem I am having is that it is binding in insert mode instead of in command mode.
Edit: I found this post for doing it in bash:
http://www.mail-archive.com/vox-tech@li … 04877.html
If it worked, that might be good enough, since bash is my most oft used readline app. However, I'm having some problems. I was able to make these keybindings work:
bind -m vi-command '"d": backward-char'
bind -m vi-command '"n": forward-char'
But these ones do not:
bind -m vi-command '"h": next-history'
bind -m vi-command '"t": prev-history'
bind -m vi-command '"k": vi-delete-to'
bind -m vi-command '"l": vi-search-again'
bind -m vi-command '"j": vi-char-search'
I don't think it's possible to do what I want to do without hacking the readline source. Some of the command mode functions in the vi mode source do tests on the actual charcter entered (ie: the d character for vi-delete-to). This means I can't remap any keys without editing these functions (ie: to bind k to vi-delete-to). I've already written a patch that applies my keybindings to the file instead of the default, but it would be much nicer if this could be done dynamically. I don't feel like writing that patch though! Maybe Xentac will do it...
Dusty
Offline