Add function for removing key bindings
parent
bbbf38d474
commit
49870831ab
|
@ -69,14 +69,22 @@ configIsParam(sym::Symbol) = sym in keys(CONFIG)
|
||||||
|
|
||||||
const KEY_BINDINGS = Dict{UInt32, String}()
|
const KEY_BINDINGS = Dict{UInt32, String}()
|
||||||
|
|
||||||
|
"""Remove a keybinding"""
|
||||||
|
function rmKeyBinding(c::Char)
|
||||||
|
delete!(KEY_BINDINGS, UInt32(c) & 0x1f)
|
||||||
|
end
|
||||||
|
|
||||||
|
"""Set a keybinding"""
|
||||||
function setKeyBinding(c::Char, s::String)
|
function setKeyBinding(c::Char, s::String)
|
||||||
KEY_BINDINGS[UInt32(c) & 0x1f] = s
|
KEY_BINDINGS[UInt32(c) & 0x1f] = s
|
||||||
end
|
end
|
||||||
|
|
||||||
function getKeyBinding(c::Char)
|
"""Get command from keybinding"""
|
||||||
|
function getKeyBinding(c::Char) ::String
|
||||||
get(KEY_BINDINGS, UInt32(c) & 0x1f, "")
|
get(KEY_BINDINGS, UInt32(c) & 0x1f, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""Return true if the given key is bound to a command"""
|
||||||
isKeyBound(c::Char) = (UInt32(c) & 0x1f) in keys(KEY_BINDINGS)
|
isKeyBound(c::Char) = (UInt32(c) & 0x1f) in keys(KEY_BINDINGS)
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,32 +108,12 @@ setKeyBinding('f', "find")
|
||||||
setKeyBinding('q', "quit")
|
setKeyBinding('q', "quit")
|
||||||
|
|
||||||
|
|
||||||
# # In juliarc:
|
|
||||||
# # using Acorn
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# ## KEY_BINDINGS
|
|
||||||
# #Acorn.addKeyBinding('f', "find")
|
|
||||||
# Acorn.addKeyBinding('o', "open")
|
|
||||||
# Acorn.addKeyBinding('s', "save")
|
|
||||||
#
|
|
||||||
# """
|
|
||||||
# bind f find
|
|
||||||
# bind o open
|
|
||||||
# bind s save
|
|
||||||
# set tab_stop 4
|
|
||||||
# set expandtab true
|
|
||||||
# """
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# hard/soft tabs
|
|
||||||
# show hidden characters
|
|
||||||
|
|
||||||
export
|
export
|
||||||
configGet,
|
configGet,
|
||||||
configSet,
|
configSet,
|
||||||
configIsParam,
|
configIsParam,
|
||||||
configDesc,
|
configDesc,
|
||||||
|
rmKeyBinding,
|
||||||
setKeyBinding,
|
setKeyBinding,
|
||||||
getKeyBinding,
|
getKeyBinding,
|
||||||
isKeyBound
|
isKeyBound
|
||||||
|
|
Loading…
Reference in New Issue