mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
config/settings: Add option helpsplit
for permanent help
split type
For downward compatibility the default split type for the `help` command is set to be `hsplit`.
This commit is contained in:
parent
ff4c5c83f2
commit
47b84f75e1
@ -1723,7 +1723,8 @@ func (h *BufPane) ToggleHelp() bool {
|
||||
if h.Buf.Type == buffer.BTHelp {
|
||||
h.Quit()
|
||||
} else {
|
||||
h.openHelp("help", true, false)
|
||||
hsplit := config.GlobalSettings["helpsplit"] == "hsplit"
|
||||
h.openHelp("help", hsplit, false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -450,12 +450,12 @@ func (h *BufPane) openHelp(page string, hsplit bool, forceSplit bool) error {
|
||||
|
||||
// HelpCmd tries to open the given help page in a horizontal split
|
||||
func (h *BufPane) HelpCmd(args []string) {
|
||||
hsplit := config.GlobalSettings["helpsplit"] == "hsplit"
|
||||
if len(args) < 1 {
|
||||
// Open the default help if the user just typed "> help"
|
||||
h.openHelp("help", true, false)
|
||||
h.openHelp("help", hsplit, false)
|
||||
} else {
|
||||
var topics []string
|
||||
hsplit := true
|
||||
forceSplit := false
|
||||
const errSplit = "hsplit and vsplit are not allowed at the same time"
|
||||
for _, arg := range args {
|
||||
|
@ -29,6 +29,7 @@ var optionValidators = map[string]optionValidator{
|
||||
"detectlimit": validateNonNegativeValue,
|
||||
"encoding": validateEncoding,
|
||||
"fileformat": validateChoice,
|
||||
"helpsplit": validateChoice,
|
||||
"matchbracestyle": validateChoice,
|
||||
"multiopen": validateChoice,
|
||||
"reload": validateChoice,
|
||||
@ -41,6 +42,7 @@ var optionValidators = map[string]optionValidator{
|
||||
var OptionChoices = map[string][]string{
|
||||
"clipboard": {"internal", "external", "terminal"},
|
||||
"fileformat": {"unix", "dos"},
|
||||
"helpsplit": {"hsplit", "vsplit"},
|
||||
"matchbracestyle": {"underline", "highlight"},
|
||||
"multiopen": {"tab", "hsplit", "vsplit"},
|
||||
"reload": {"prompt", "auto", "disabled"},
|
||||
@ -109,6 +111,7 @@ var DefaultGlobalOnlySettings = map[string]interface{}{
|
||||
"divchars": "|-",
|
||||
"divreverse": true,
|
||||
"fakecursor": false,
|
||||
"helpsplit": "hsplit",
|
||||
"infobar": true,
|
||||
"keymenu": false,
|
||||
"mouse": true,
|
||||
|
@ -27,9 +27,11 @@ quotes here but these are not necessary when entering the command in micro.
|
||||
Help topics are stored as `.md` files in the `runtime/help` directory of
|
||||
the source tree, which is embedded in the final binary.
|
||||
The `flags` are optional.
|
||||
* `-hsplit`: Opens the help topic in a horizontal split (default for initial split)
|
||||
* `-hsplit`: Opens the help topic in a horizontal split
|
||||
* `-vsplit`: Opens the help topic in a vertical split
|
||||
|
||||
The default split type is defined by the global `helpsplit` option.
|
||||
|
||||
* `save ['filename']`: saves the current buffer. If the file is provided it
|
||||
will 'save as' the filename.
|
||||
|
||||
|
@ -172,6 +172,13 @@ Here are the available options:
|
||||
default value: `unknown`. This will be automatically overridden depending
|
||||
on the file you open.
|
||||
|
||||
* `helpsplit`: sets the split type to be used by the `help` command.
|
||||
Possible values:
|
||||
* `vsplit`: open help in a vertical split pane
|
||||
* `hsplit`: open help in a horizontal split pane
|
||||
|
||||
default value: `hsplit`
|
||||
|
||||
* `hlsearch`: highlight all instances of the searched text after a successful
|
||||
search. This highlighting can be temporarily turned off via the
|
||||
`UnhighlightSearch` action (triggered by the Esc key by default) or toggled
|
||||
|
Loading…
Reference in New Issue
Block a user