Vegard Øye <[email protected]> writes:
On 2010-07-23 20:46, Tim Harper wrote:
I'm not extremely happy with my approach on how I'm looking into the delete/change commands. Basically, I'm hijacking them in doing an advise (as in defadvice) approach.
Fourth approach: stay with the delete-or-surround DWIM functions, but bind them in a separate, toggleable keymap rather than overwriting the basic bindings. Like this:
(define-minor-mode surround-mode)
(vimpulse-define-key 'surround-mode 'vi-state "d" vimpulse-delete-surround-or-delete) (vimpulse-define-key 'surround-mode 'vi-state "c" vimpulse-change-surround-or-change)
Then you can enable surround-mode in certain buffers as appropriate, or turn it into a global minor mode.
(With the usual disclaimer about my very limited knowledge of Vimpulse and Viper,) this strikes me as the cleanest one -- it just looks so Right. :-D Defining this kind of minor modes (possibly global -- I assume that would work, too?) is perhaps The Way for writing Vimpulse plug-ins. (And to put some more ashes on my head, this seems to be precisely the kind of thing for which you implemented these binding commands recently and which I failed to appreciate at the time.) Thanks for the insight! Štěpán