mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-08 16:10:29 +09:00
@@ -181,6 +181,13 @@ func OptionValueComplete(inputOpt, input string) (string, []string) {
|
||||
if strings.HasPrefix("dos", input) {
|
||||
suggestions = append(suggestions, "dos")
|
||||
}
|
||||
case "sucmd":
|
||||
if strings.HasPrefix("sudo", input) {
|
||||
suggestions = append(suggestions, "sudo")
|
||||
}
|
||||
if strings.HasPrefix("doas", input) {
|
||||
suggestions = append(suggestions, "doas")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -431,7 +431,7 @@ func (b *Buffer) SaveAsWithSudo(filename string) error {
|
||||
screen = nil
|
||||
|
||||
// Set up everything for the command
|
||||
cmd := exec.Command("sudo", "tee", filename)
|
||||
cmd := exec.Command(b.Settings["sucmd"].(string), "tee", filename)
|
||||
cmd.Stdin = bytes.NewBufferString(b.SaveString(b.Settings["fileformat"] == "dos"))
|
||||
|
||||
// This is a trap for Ctrl-C so that it doesn't kill micro
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -215,6 +215,7 @@ func DefaultGlobalSettings() map[string]interface{} {
|
||||
"splitRight": true,
|
||||
"splitBottom": true,
|
||||
"statusline": true,
|
||||
"sucmd": "sudo",
|
||||
"syntax": true,
|
||||
"tabmovement": false,
|
||||
"tabsize": float64(4),
|
||||
|
||||
@@ -177,6 +177,11 @@ Here are the options that you can set:
|
||||
|
||||
default value: `on`
|
||||
|
||||
* `sucmd`: specifies the super user command. On most systems this is "sudo" but on BSD it can be "doas." This
|
||||
option can be customized and is only used when saving with su.
|
||||
|
||||
default value: `sudo`
|
||||
|
||||
---
|
||||
|
||||
Default plugin options:
|
||||
|
||||
Reference in New Issue
Block a user