mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 06:12:35 +09:00
Split help into multiple files and add help command
This commit is contained in:
@@ -24,6 +24,7 @@ var commandActions = map[string]func([]string){
|
||||
"VSplit": VSplit,
|
||||
"HSplit": HSplit,
|
||||
"Tab": NewTab,
|
||||
"Help": Help,
|
||||
}
|
||||
|
||||
// InitCommands initializes the default commands
|
||||
@@ -65,6 +66,22 @@ func DefaultCommands() map[string]string {
|
||||
"vsplit": "VSplit",
|
||||
"hsplit": "HSplit",
|
||||
"tab": "Tab",
|
||||
"help": "Help",
|
||||
}
|
||||
}
|
||||
|
||||
// Help tries to open the given help page in a horizontal split
|
||||
func Help(args []string) {
|
||||
if len(args) < 1 {
|
||||
// Open the default help if the user just typed "> help"
|
||||
CurView().openHelp("help")
|
||||
} else {
|
||||
helpPage := args[0]
|
||||
if _, ok := helpPages[helpPage]; ok {
|
||||
CurView().openHelp(helpPage)
|
||||
} else {
|
||||
messenger.Error("Sorry, no help for ", helpPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user