diff --git a/cmd/micro/bindings.go b/cmd/micro/bindings.go index 89cd2702..c97c96e0 100644 --- a/cmd/micro/bindings.go +++ b/cmd/micro/bindings.go @@ -54,6 +54,7 @@ var bindingActions = map[string]func(*View) bool{ "Cut": (*View).Cut, "CutLine": (*View).CutLine, "DuplicateLine": (*View).DuplicateLine, + "DeleteLine": (*View).DeleteLine, "Paste": (*View).Paste, "SelectAll": (*View).SelectAll, "OpenFile": (*View).OpenFile, @@ -859,6 +860,18 @@ func (v *View) DuplicateLine() bool { return true } +// DeleteLine deletes the current line +func (v *View) DeleteLine() bool { + v.Cursor.SelectLine() + if !v.Cursor.HasSelection() { + return false + } + v.Cursor.DeleteSelection() + v.Cursor.ResetSelection() + messenger.Message("Deleted line") + return true +} + // Paste whatever is in the system clipboard into the buffer // Delete and paste if the user has a selection func (v *View) Paste() bool {