On 2011-04-15 12:58 +0100, Nikolai Weibull wrote:
Is there any way of getting C-p and C-n do ido-prev-match and ido-next-match in Ido mode?
As it turns out, `ido-setup-hook' is not executed in the minibuffer, so `viper-add-local-keys' creates a buffer-local binding for the main buffer instead. (`ido-minibuffer-setup-hook' /is/ executed in the minibuffer, though). However, buffer-local bindings are a bad fit in any case, since they will linger when the minibuffer is used for other things. Command remapping works better: (add-hook 'ido-setup-hook (lambda () (define-key ido-completion-map [remap vimpulse-abbrev-expand-before] 'ido-prev-match) (define-key ido-completion-map [remap vimpulse-abbrev-expand-after] 'ido-next-match))) (Normally, `vimpulse-define-key' is used in these cases, but it works at the mode level and isn't really fine-grained enough for the minibuffer. Ido mode is seen as "active" both in the main buffer and the minibuffer, while the `ido-completion-map' keymap is active /only/ in the minibuffer (by shadowing `minibuffer-local-completion-map'). Food for thought: a `-define-key' function which assignes state bindings to keymaps rather than to modes will not have this limitation.) -- Vegard