diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 87ac4c91..009f4bd8 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -463,7 +463,8 @@ func (v *View) InsertNewline(usePlugin bool) bool { v.Cursor.Right() } - if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) { + // Remove the whitespaces if keepautoindent setting is off + if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) && !v.Buf.Settings["keepautoindent"].(bool) { line := v.Buf.Line(v.Cursor.Y - 1) v.Buf.Remove(Loc{0, v.Cursor.Y - 1}, Loc{Count(line), v.Cursor.Y - 1}) } diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index b11a0614..240ee771 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -176,6 +176,7 @@ func GetOption(name string) interface{} { func DefaultGlobalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, + "keepautoindent": false, "autosave": false, "colorcolumn": float64(0), "colorscheme": "default", @@ -209,6 +210,7 @@ func DefaultGlobalSettings() map[string]interface{} { func DefaultLocalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, + "keepautoindent": false, "autosave": false, "colorcolumn": float64(0), "cursorline": true,