diff --git a/cmd/micro/action/bindings.go b/cmd/micro/action/bindings.go index 2b5173a3..105f8ca2 100644 --- a/cmd/micro/action/bindings.go +++ b/cmd/micro/action/bindings.go @@ -14,9 +14,9 @@ import ( "github.com/zyedidia/tcell" ) -var Bindings = DefaultBindings() - func InitBindings() { + config.Bindings = DefaultBindings() + var parsed map[string]string defaults := DefaultBindings() @@ -57,7 +57,7 @@ func BindKey(k, v string) { util.TermMessage("Raw events not supported yet") } - Bindings[k] = v + config.Bindings[k] = v } // findKeyEvent will find binding Key 'b' using string 'k' diff --git a/cmd/micro/action/command.go b/cmd/micro/action/command.go index ca4f275b..3fec2c9c 100644 --- a/cmd/micro/action/command.go +++ b/cmd/micro/action/command.go @@ -4,6 +4,7 @@ import ( "os" "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/shell" "github.com/zyedidia/micro/cmd/micro/shellwords" @@ -263,7 +264,7 @@ func (h *BufHandler) ShowKeyCmd(args []string) { return } - if action, ok := Bindings[args[0]]; ok { + if action, ok := config.Bindings[args[0]]; ok { InfoBar.Message(action) } else { InfoBar.Message(args[0], " has no binding") diff --git a/cmd/micro/config/globals.go b/cmd/micro/config/globals.go index 841ff68f..cd5bd3cd 100644 --- a/cmd/micro/config/globals.go +++ b/cmd/micro/config/globals.go @@ -4,3 +4,5 @@ const ( 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 ) + +var Bindings map[string]string diff --git a/cmd/micro/display/statusline.go b/cmd/micro/display/statusline.go index b9343fa9..e6b06033 100644 --- a/cmd/micro/display/statusline.go +++ b/cmd/micro/display/statusline.go @@ -83,13 +83,13 @@ func (s *StatusLine) Display() { option := name[4:] return []byte(fmt.Sprint(s.FindOpt(string(option)))) } else if bytes.HasPrefix(name, []byte("bind")) { - // binding := string(name[5:]) + binding := string(name[5:]) // TODO: search bindings - // for k, v := range action.Bindings { - // if v == binding { - // return []byte(k) - // } - // } + for k, v := range config.Bindings { + if v == binding { + return []byte(k) + } + } return []byte("null") } else { return []byte(s.Info[string(name)](s.win.Buf))