mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Move bindings location in code
This commit is contained in:
@@ -14,9 +14,9 @@ import (
|
|||||||
"github.com/zyedidia/tcell"
|
"github.com/zyedidia/tcell"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Bindings = DefaultBindings()
|
|
||||||
|
|
||||||
func InitBindings() {
|
func InitBindings() {
|
||||||
|
config.Bindings = DefaultBindings()
|
||||||
|
|
||||||
var parsed map[string]string
|
var parsed map[string]string
|
||||||
defaults := DefaultBindings()
|
defaults := DefaultBindings()
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ func BindKey(k, v string) {
|
|||||||
util.TermMessage("Raw events not supported yet")
|
util.TermMessage("Raw events not supported yet")
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings[k] = v
|
config.Bindings[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
// findKeyEvent will find binding Key 'b' using string 'k'
|
// findKeyEvent will find binding Key 'b' using string 'k'
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/zyedidia/micro/cmd/micro/buffer"
|
"github.com/zyedidia/micro/cmd/micro/buffer"
|
||||||
|
"github.com/zyedidia/micro/cmd/micro/config"
|
||||||
"github.com/zyedidia/micro/cmd/micro/screen"
|
"github.com/zyedidia/micro/cmd/micro/screen"
|
||||||
"github.com/zyedidia/micro/cmd/micro/shell"
|
"github.com/zyedidia/micro/cmd/micro/shell"
|
||||||
"github.com/zyedidia/micro/cmd/micro/shellwords"
|
"github.com/zyedidia/micro/cmd/micro/shellwords"
|
||||||
@@ -263,7 +264,7 @@ func (h *BufHandler) ShowKeyCmd(args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if action, ok := Bindings[args[0]]; ok {
|
if action, ok := config.Bindings[args[0]]; ok {
|
||||||
InfoBar.Message(action)
|
InfoBar.Message(action)
|
||||||
} else {
|
} else {
|
||||||
InfoBar.Message(args[0], " has no binding")
|
InfoBar.Message(args[0], " has no binding")
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ const (
|
|||||||
DoubleClickThreshold = 400 // How many milliseconds to wait before a second click is not a double click
|
DoubleClickThreshold = 400 // How many milliseconds to wait before a second click is not a double click
|
||||||
AutosaveTime = 8 // Number of seconds to wait before autosaving
|
AutosaveTime = 8 // Number of seconds to wait before autosaving
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Bindings map[string]string
|
||||||
|
|||||||
@@ -83,13 +83,13 @@ func (s *StatusLine) Display() {
|
|||||||
option := name[4:]
|
option := name[4:]
|
||||||
return []byte(fmt.Sprint(s.FindOpt(string(option))))
|
return []byte(fmt.Sprint(s.FindOpt(string(option))))
|
||||||
} else if bytes.HasPrefix(name, []byte("bind")) {
|
} else if bytes.HasPrefix(name, []byte("bind")) {
|
||||||
// binding := string(name[5:])
|
binding := string(name[5:])
|
||||||
// TODO: search bindings
|
// TODO: search bindings
|
||||||
// for k, v := range action.Bindings {
|
for k, v := range config.Bindings {
|
||||||
// if v == binding {
|
if v == binding {
|
||||||
// return []byte(k)
|
return []byte(k)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return []byte("null")
|
return []byte("null")
|
||||||
} else {
|
} else {
|
||||||
return []byte(s.Info[string(name)](s.win.Buf))
|
return []byte(s.Info[string(name)](s.win.Buf))
|
||||||
|
|||||||
Reference in New Issue
Block a user