mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-28 22:08:12 +09:00
Replace CtrlO with open command
This comit also makes it possible for a binding to auto-type the beginning of a command into command mode. Closes #450
This commit is contained in:
@@ -49,6 +49,7 @@ func init() {
|
||||
"Reload": Reload,
|
||||
"Cd": Cd,
|
||||
"Pwd": Pwd,
|
||||
"Open": Open,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +101,7 @@ func DefaultCommands() map[string]StrCommand {
|
||||
"reload": {"Reload", []Completion{NoCompletion}},
|
||||
"cd": {"Cd", []Completion{FileCompletion}},
|
||||
"pwd": {"Pwd", []Completion{NoCompletion}},
|
||||
"open": {"Open", []Completion{FileCompletion}},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +216,18 @@ func Pwd(args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
func Open(args []string) {
|
||||
if len(args) > 0 {
|
||||
filename := args[0]
|
||||
// the filename might or might not be quoted, so unquote first then join the strings.
|
||||
filename = strings.Join(SplitCommandArgs(filename), " ")
|
||||
|
||||
CurView().Open(filename)
|
||||
} else {
|
||||
messenger.Error("No filename")
|
||||
}
|
||||
}
|
||||
|
||||
func ToggleLog(args []string) {
|
||||
buffer := messenger.getBuffer()
|
||||
if CurView().Type != vtLog {
|
||||
|
||||
Reference in New Issue
Block a user