About: Overload a key with multiple handlers   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

This function calls a list of handlers until one returns true, indicating the event was handled. If no handler returns true, a default action is executed. Take for example, the following CloseScratch function. function! CloseScratch() if &buftype == "nofile" && &bufhidden == "hide" && !&swapfile bdelete return 1 endif return 0 endfunction Using RunHandlers I can now dynamically overload > to call this function (in normal mode), like so: Adding more handlers should be easy enough. In this case, CloseScratch is tried first, and if that fails DefaultEsc is called.

AttributesValues
rdfs:label
  • Overload a key with multiple handlers
rdfs:comment
  • This function calls a list of handlers until one returns true, indicating the event was handled. If no handler returns true, a default action is executed. Take for example, the following CloseScratch function. function! CloseScratch() if &buftype == "nofile" && &bufhidden == "hide" && !&swapfile bdelete return 1 endif return 0 endfunction Using RunHandlers I can now dynamically overload <esc></esc> to call this function (in normal mode), like so: Adding more handlers should be easy enough. In this case, CloseScratch is tried first, and if that fails DefaultEsc is called.
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 1557(xsd:integer)
Category
  • Map
Author
  • Niels AdB
Subpage
  • /200804
Complexity
  • basic
Created
  • 2008(xsd:integer)
ID
  • 1558(xsd:integer)
NEXT
  • 1559(xsd:integer)
abstract
  • This function calls a list of handlers until one returns true, indicating the event was handled. If no handler returns true, a default action is executed. Take for example, the following CloseScratch function. function! CloseScratch() if &buftype == "nofile" && &bufhidden == "hide" && !&swapfile bdelete return 1 endif return 0 endfunction Using RunHandlers I can now dynamically overload <esc></esc> to call this function (in normal mode), like so: " Default Escape and clear message line. function! DefaultEsc() normal! "" echo "" endfunction let g:esc_handler = [] call add(g:esc_handler, "CloseScratch") nnoremap :call RunHandlers(g:esc_handler, "call DefaultEsc()") Adding more handlers should be easy enough. In this case, CloseScratch is tried first, and if that fails DefaultEsc is called.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software