From 7a2820cbc08b8dde05b830c4cd01eedb4337f138 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 28 Apr 2018 17:04:33 -0400 Subject: [PATCH] Add hidehelp option Fixes #1080 --- cmd/micro/settings.go | 2 ++ cmd/micro/statusline.go | 30 ++++++++++++++++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index 6c6785e9..b1b1c277 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -209,6 +209,7 @@ func DefaultGlobalSettings() map[string]interface{} { "eofnewline": false, "fastdirty": true, "fileformat": "unix", + "hidehelp": false, "ignorecase": false, "indentchar": " ", "infobar": true, @@ -254,6 +255,7 @@ func DefaultLocalSettings() map[string]interface{} { "fastdirty": true, "fileformat": "unix", "filetype": "Unknown", + "hidehelp": false, "ignorecase": false, "indentchar": " ", "keepautoindent": false, diff --git a/cmd/micro/statusline.go b/cmd/micro/statusline.go index 1114fd21..d346a033 100644 --- a/cmd/micro/statusline.go +++ b/cmd/micro/statusline.go @@ -47,24 +47,26 @@ func (sline *Statusline) Display() { file += " " + sline.view.Buf.Settings["fileformat"].(string) rightText := "" - if len(kmenuBinding) > 0 { - if globalSettings["keymenu"].(bool) { - rightText += kmenuBinding + ": hide bindings" - } else { - rightText += kmenuBinding + ": show bindings" - } - } - if len(helpBinding) > 0 { + if !sline.view.Buf.Settings["hidehelp"].(bool) { if len(kmenuBinding) > 0 { - rightText += ", " + if globalSettings["keymenu"].(bool) { + rightText += kmenuBinding + ": hide bindings" + } else { + rightText += kmenuBinding + ": show bindings" + } } - if sline.view.Type == vtHelp { - rightText += helpBinding + ": close help" - } else { - rightText += helpBinding + ": open help" + if len(helpBinding) > 0 { + if len(kmenuBinding) > 0 { + rightText += ", " + } + if sline.view.Type == vtHelp { + rightText += helpBinding + ": close help" + } else { + rightText += helpBinding + ": open help" + } } + rightText += " " } - rightText += " " statusLineStyle := defStyle.Reverse(true) if style, ok := colorscheme["statusline"]; ok {