surround.vim vimpulse extension

Vegard Øye vegard_oye at
Fri Jul 30 17:57:33 CEST 2010

On 2010-07-25 00:29, ??t??p??n N??mec wrote:

> Vegard ??ye <vegard_oye at> writes:
>>     (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)
> (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.

Yes, it should work with globalized minor modes as well -- the code
just checks the mode variable and, if t,[1] enables the appropriate
state bindings associated with it. It checks the `major-mode' variable
too, so one could also modify/define major modes this way.

In essence, state bindings become just another "property" that an
Emacs mode can have.

[1] Strictly speaking: unless nil.

> Thanks for the insight!

You're welcome :)


More information about the implementations-list mailing list