- "set": {"Set", []Completion{OptionCompletion, NoCompletion}},
- "setlocal": {"SetLocal", []Completion{OptionCompletion, NoCompletion}},
- "show": {"Show", []Completion{OptionCompletion, NoCompletion}},
- "bind": {"Bind", []Completion{NoCompletion}},
- "run": {"Run", []Completion{NoCompletion}},
- "quit": {"Quit", []Completion{NoCompletion}},
- "save": {"Save", []Completion{NoCompletion}},
- "replace": {"Replace", []Completion{NoCompletion}},
- "vsplit": {"VSplit", []Completion{FileCompletion, NoCompletion}},
- "hsplit": {"HSplit", []Completion{FileCompletion, NoCompletion}},
- "tab": {"Tab", []Completion{FileCompletion, NoCompletion}},
- "help": {"Help", []Completion{HelpCompletion, NoCompletion}},
- "eval": {"Eval", []Completion{NoCompletion}},
- "log": {"ToggleLog", []Completion{NoCompletion}},
- "plugin": {"Plugin", []Completion{PluginCmdCompletion, PluginNameCompletion}},
- "reload": {"Reload", []Completion{NoCompletion}},
- "cd": {"Cd", []Completion{FileCompletion}},
- "pwd": {"Pwd", []Completion{NoCompletion}},
- "open": {"Open", []Completion{FileCompletion}},
- "tabswitch": {"TabSwitch", []Completion{NoCompletion}},
+ "set": {"Set", []Completion{OptionCompletion, OptionValueCompletion}},
+ "setlocal": {"SetLocal", []Completion{OptionCompletion, OptionValueCompletion}},
+ "show": {"Show", []Completion{OptionCompletion, NoCompletion}},
+ "showkey": {"ShowKey", []Completion{NoCompletion}},
+ "bind": {"Bind", []Completion{NoCompletion}},
+ "run": {"Run", []Completion{NoCompletion}},
+ "quit": {"Quit", []Completion{NoCompletion}},
+ "save": {"Save", []Completion{NoCompletion}},
+ "replace": {"Replace", []Completion{NoCompletion}},
+ "replaceall": {"ReplaceAll", []Completion{NoCompletion}},
+ "vsplit": {"VSplit", []Completion{FileCompletion, NoCompletion}},
+ "hsplit": {"HSplit", []Completion{FileCompletion, NoCompletion}},
+ "tab": {"Tab", []Completion{FileCompletion, NoCompletion}},
+ "help": {"Help", []Completion{HelpCompletion, NoCompletion}},
+ "eval": {"Eval", []Completion{NoCompletion}},
+ "log": {"ToggleLog", []Completion{NoCompletion}},
+ "plugin": {"Plugin", []Completion{PluginCmdCompletion, PluginNameCompletion}},
+ "reload": {"Reload", []Completion{NoCompletion}},
+ "cd": {"Cd", []Completion{FileCompletion}},
+ "pwd": {"Pwd", []Completion{NoCompletion}},
+ "open": {"Open", []Completion{FileCompletion}},
+ "tabswitch": {"TabSwitch", []Completion{NoCompletion}},
+ "term": {"Term", []Completion{NoCompletion}},
+ "memusage": {"MemUsage", []Completion{NoCompletion}},
+ "retab": {"Retab", []Completion{NoCompletion}},
+ "raw": {"Raw", []Completion{NoCompletion}},
+ }
+}
+
+// CommandEditAction returns a bindable function that opens a prompt with
+// the given string and executes the command when the user presses
+// enter
+func CommandEditAction(prompt string) func(*View, bool) bool {
+ return func(v *View, usePlugin bool) bool {
+ input, canceled := messenger.Prompt("> ", prompt, "Command", CommandCompletion)
+ if !canceled {
+ HandleCommand(input)
+ }
+ return false
+ }
+}
+
+// CommandAction returns a bindable function which executes the
+// given command
+func CommandAction(cmd string) func(*View, bool) bool {
+ return func(v *View, usePlugin bool) bool {
+ HandleCommand(cmd)
+ return false