mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Added option to automatically save files with sucmd
This commit is contained in:
@@ -994,7 +994,12 @@ func (v *View) saveToFile(filename string) {
|
||||
err := v.Buf.SaveAs(filename)
|
||||
if err != nil {
|
||||
if strings.HasSuffix(err.Error(), "permission denied") {
|
||||
choice, _ := messenger.YesNoPrompt("Permission denied. Do you want to save this file using sudo? (y,n)")
|
||||
var choice bool
|
||||
if globalSettings["autosu"].(bool) {
|
||||
choice = true
|
||||
} else {
|
||||
choice, _ = messenger.YesNoPrompt("Permission denied. Do you want to save this file using sudo? (y,n)")
|
||||
}
|
||||
if choice {
|
||||
err = v.Buf.SaveAsWithSudo(filename)
|
||||
if err != nil {
|
||||
|
||||
@@ -236,6 +236,7 @@ func DefaultGlobalSettings() map[string]interface{} {
|
||||
"splitright": true,
|
||||
"statusline": true,
|
||||
"sucmd": "sudo",
|
||||
"autosu": false,
|
||||
"syntax": true,
|
||||
"tabmovement": false,
|
||||
"tabsize": float64(4),
|
||||
|
||||
Reference in New Issue
Block a user