mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-19 07:15:34 -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 {
|
if h.Buf.Type == buffer.BTHelp {
|
||||||
h.Quit()
|
h.Quit()
|
||||||
} else {
|
} else {
|
||||||
h.openHelp("help", true, false)
|
hsplit := config.GlobalSettings["helpsplit"] == "hsplit"
|
||||||
|
h.openHelp("help", hsplit, false)
|
||||||
}
|
}
|
||||||
return true
|
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
|
// HelpCmd tries to open the given help page in a horizontal split
|
||||||
func (h *BufPane) HelpCmd(args []string) {
|
func (h *BufPane) HelpCmd(args []string) {
|
||||||
|
hsplit := config.GlobalSettings["helpsplit"] == "hsplit"
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
// Open the default help if the user just typed "> help"
|
// Open the default help if the user just typed "> help"
|
||||||
h.openHelp("help", true, false)
|
h.openHelp("help", hsplit, false)
|
||||||
} else {
|
} else {
|
||||||
var topics []string
|
var topics []string
|
||||||
hsplit := true
|
|
||||||
forceSplit := false
|
forceSplit := false
|
||||||
const errSplit = "hsplit and vsplit are not allowed at the same time"
|
const errSplit = "hsplit and vsplit are not allowed at the same time"
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
|
@ -29,6 +29,7 @@ var optionValidators = map[string]optionValidator{
|
|||||||
"detectlimit": validateNonNegativeValue,
|
"detectlimit": validateNonNegativeValue,
|
||||||
"encoding": validateEncoding,
|
"encoding": validateEncoding,
|
||||||
"fileformat": validateChoice,
|
"fileformat": validateChoice,
|
||||||
|
"helpsplit": validateChoice,
|
||||||
"matchbracestyle": validateChoice,
|
"matchbracestyle": validateChoice,
|
||||||
"multiopen": validateChoice,
|
"multiopen": validateChoice,
|
||||||
"reload": validateChoice,
|
"reload": validateChoice,
|
||||||
@ -41,6 +42,7 @@ var optionValidators = map[string]optionValidator{
|
|||||||
var OptionChoices = map[string][]string{
|
var OptionChoices = map[string][]string{
|
||||||
"clipboard": {"internal", "external", "terminal"},
|
"clipboard": {"internal", "external", "terminal"},
|
||||||
"fileformat": {"unix", "dos"},
|
"fileformat": {"unix", "dos"},
|
||||||
|
"helpsplit": {"hsplit", "vsplit"},
|
||||||
"matchbracestyle": {"underline", "highlight"},
|
"matchbracestyle": {"underline", "highlight"},
|
||||||
"multiopen": {"tab", "hsplit", "vsplit"},
|
"multiopen": {"tab", "hsplit", "vsplit"},
|
||||||
"reload": {"prompt", "auto", "disabled"},
|
"reload": {"prompt", "auto", "disabled"},
|
||||||
@ -109,6 +111,7 @@ var DefaultGlobalOnlySettings = map[string]interface{}{
|
|||||||
"divchars": "|-",
|
"divchars": "|-",
|
||||||
"divreverse": true,
|
"divreverse": true,
|
||||||
"fakecursor": false,
|
"fakecursor": false,
|
||||||
|
"helpsplit": "hsplit",
|
||||||
"infobar": true,
|
"infobar": true,
|
||||||
"keymenu": false,
|
"keymenu": false,
|
||||||
"mouse": true,
|
"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
|
Help topics are stored as `.md` files in the `runtime/help` directory of
|
||||||
the source tree, which is embedded in the final binary.
|
the source tree, which is embedded in the final binary.
|
||||||
The `flags` are optional.
|
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
|
* `-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
|
* `save ['filename']`: saves the current buffer. If the file is provided it
|
||||||
will 'save as' the filename.
|
will 'save as' the filename.
|
||||||
|
|
||||||
|
@ -172,6 +172,13 @@ Here are the available options:
|
|||||||
default value: `unknown`. This will be automatically overridden depending
|
default value: `unknown`. This will be automatically overridden depending
|
||||||
on the file you open.
|
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
|
* `hlsearch`: highlight all instances of the searched text after a successful
|
||||||
search. This highlighting can be temporarily turned off via the
|
search. This highlighting can be temporarily turned off via the
|
||||||
`UnhighlightSearch` action (triggered by the Esc key by default) or toggled
|
`UnhighlightSearch` action (triggered by the Esc key by default) or toggled
|
||||||
|
Loading…
Reference in New Issue
Block a user