]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/bindings.go
make undothresthold a setting (part 2)
[micro.git] / cmd / micro / bindings.go
index 3f4d8e631f37e9c7ffbb445b378d87f151c7af1f..0869141845b955b132df04d267f1092b2801c9d7 100644 (file)
@@ -19,6 +19,7 @@ var bindings map[Key]func(*View) bool
 type Key struct {
        keyCode   tcell.Key
        modifiers tcell.ModMask
+       r         rune
 }
 
 // InitBindings initializes the keybindings for micro
@@ -58,6 +59,7 @@ func InitBindings() {
                "Copy":                (*View).Copy,
                "Cut":                 (*View).Cut,
                "CutLine":             (*View).CutLine,
+               "DuplicateLine":       (*View).DuplicateLine,
                "Paste":               (*View).Paste,
                "SelectAll":           (*View).SelectAll,
                "OpenFile":            (*View).OpenFile,
@@ -75,150 +77,150 @@ func InitBindings() {
        }
 
        keys := map[string]Key{
-               "Up":             Key{tcell.KeyUp, tcell.ModNone},
-               "Down":           Key{tcell.KeyDown, tcell.ModNone},
-               "Right":          Key{tcell.KeyRight, tcell.ModNone},
-               "Left":           Key{tcell.KeyLeft, tcell.ModNone},
-               "AltUp":          Key{tcell.KeyUp, tcell.ModAlt},
-               "AltDown":        Key{tcell.KeyDown, tcell.ModAlt},
-               "AltLeft":        Key{tcell.KeyLeft, tcell.ModAlt},
-               "AltRight":       Key{tcell.KeyRight, tcell.ModAlt},
-               "CtrlUp":         Key{tcell.KeyUp, tcell.ModCtrl},
-               "CtrlDown":       Key{tcell.KeyDown, tcell.ModCtrl},
-               "CtrlLeft":       Key{tcell.KeyLeft, tcell.ModCtrl},
-               "CtrlRight":      Key{tcell.KeyRight, tcell.ModCtrl},
-               "ShiftUp":        Key{tcell.KeyUp, tcell.ModShift},
-               "ShiftDown":      Key{tcell.KeyDown, tcell.ModShift},
-               "ShiftLeft":      Key{tcell.KeyLeft, tcell.ModShift},
-               "ShiftRight":     Key{tcell.KeyRight, tcell.ModShift},
-               "AltShiftUp":     Key{tcell.KeyUp, tcell.ModShift | tcell.ModAlt},
-               "AltShiftDown":   Key{tcell.KeyDown, tcell.ModShift | tcell.ModAlt},
-               "AltShiftLeft":   Key{tcell.KeyLeft, tcell.ModShift | tcell.ModAlt},
-               "AltShiftRight":  Key{tcell.KeyRight, tcell.ModShift | tcell.ModAlt},
-               "CtrlShiftUp":    Key{tcell.KeyUp, tcell.ModShift | tcell.ModCtrl},
-               "CtrlShiftDown":  Key{tcell.KeyDown, tcell.ModShift | tcell.ModCtrl},
-               "CtrlShiftLeft":  Key{tcell.KeyLeft, tcell.ModShift | tcell.ModCtrl},
-               "CtrlShiftRight": Key{tcell.KeyRight, tcell.ModShift | tcell.ModCtrl},
-               "UpLeft":         Key{tcell.KeyUpLeft, tcell.ModNone},
-               "UpRight":        Key{tcell.KeyUpRight, tcell.ModNone},
-               "DownLeft":       Key{tcell.KeyDownLeft, tcell.ModNone},
-               "DownRight":      Key{tcell.KeyDownRight, tcell.ModNone},
-               "Center":         Key{tcell.KeyCenter, tcell.ModNone},
-               "PgUp":           Key{tcell.KeyPgUp, tcell.ModNone},
-               "PgDn":           Key{tcell.KeyPgDn, tcell.ModNone},
-               "Home":           Key{tcell.KeyHome, tcell.ModNone},
-               "End":            Key{tcell.KeyEnd, tcell.ModNone},
-               "Insert":         Key{tcell.KeyInsert, tcell.ModNone},
-               "Delete":         Key{tcell.KeyDelete, tcell.ModNone},
-               "Help":           Key{tcell.KeyHelp, tcell.ModNone},
-               "Exit":           Key{tcell.KeyExit, tcell.ModNone},
-               "Clear":          Key{tcell.KeyClear, tcell.ModNone},
-               "Cancel":         Key{tcell.KeyCancel, tcell.ModNone},
-               "Print":          Key{tcell.KeyPrint, tcell.ModNone},
-               "Pause":          Key{tcell.KeyPause, tcell.ModNone},
-               "Backtab":        Key{tcell.KeyBacktab, tcell.ModNone},
-               "F1":             Key{tcell.KeyF1, tcell.ModNone},
-               "F2":             Key{tcell.KeyF2, tcell.ModNone},
-               "F3":             Key{tcell.KeyF3, tcell.ModNone},
-               "F4":             Key{tcell.KeyF4, tcell.ModNone},
-               "F5":             Key{tcell.KeyF5, tcell.ModNone},
-               "F6":             Key{tcell.KeyF6, tcell.ModNone},
-               "F7":             Key{tcell.KeyF7, tcell.ModNone},
-               "F8":             Key{tcell.KeyF8, tcell.ModNone},
-               "F9":             Key{tcell.KeyF9, tcell.ModNone},
-               "F10":            Key{tcell.KeyF10, tcell.ModNone},
-               "F11":            Key{tcell.KeyF11, tcell.ModNone},
-               "F12":            Key{tcell.KeyF12, tcell.ModNone},
-               "F13":            Key{tcell.KeyF13, tcell.ModNone},
-               "F14":            Key{tcell.KeyF14, tcell.ModNone},
-               "F15":            Key{tcell.KeyF15, tcell.ModNone},
-               "F16":            Key{tcell.KeyF16, tcell.ModNone},
-               "F17":            Key{tcell.KeyF17, tcell.ModNone},
-               "F18":            Key{tcell.KeyF18, tcell.ModNone},
-               "F19":            Key{tcell.KeyF19, tcell.ModNone},
-               "F20":            Key{tcell.KeyF20, tcell.ModNone},
-               "F21":            Key{tcell.KeyF21, tcell.ModNone},
-               "F22":            Key{tcell.KeyF22, tcell.ModNone},
-               "F23":            Key{tcell.KeyF23, tcell.ModNone},
-               "F24":            Key{tcell.KeyF24, tcell.ModNone},
-               "F25":            Key{tcell.KeyF25, tcell.ModNone},
-               "F26":            Key{tcell.KeyF26, tcell.ModNone},
-               "F27":            Key{tcell.KeyF27, tcell.ModNone},
-               "F28":            Key{tcell.KeyF28, tcell.ModNone},
-               "F29":            Key{tcell.KeyF29, tcell.ModNone},
-               "F30":            Key{tcell.KeyF30, tcell.ModNone},
-               "F31":            Key{tcell.KeyF31, tcell.ModNone},
-               "F32":            Key{tcell.KeyF32, tcell.ModNone},
-               "F33":            Key{tcell.KeyF33, tcell.ModNone},
-               "F34":            Key{tcell.KeyF34, tcell.ModNone},
-               "F35":            Key{tcell.KeyF35, tcell.ModNone},
-               "F36":            Key{tcell.KeyF36, tcell.ModNone},
-               "F37":            Key{tcell.KeyF37, tcell.ModNone},
-               "F38":            Key{tcell.KeyF38, tcell.ModNone},
-               "F39":            Key{tcell.KeyF39, tcell.ModNone},
-               "F40":            Key{tcell.KeyF40, tcell.ModNone},
-               "F41":            Key{tcell.KeyF41, tcell.ModNone},
-               "F42":            Key{tcell.KeyF42, tcell.ModNone},
-               "F43":            Key{tcell.KeyF43, tcell.ModNone},
-               "F44":            Key{tcell.KeyF44, tcell.ModNone},
-               "F45":            Key{tcell.KeyF45, tcell.ModNone},
-               "F46":            Key{tcell.KeyF46, tcell.ModNone},
-               "F47":            Key{tcell.KeyF47, tcell.ModNone},
-               "F48":            Key{tcell.KeyF48, tcell.ModNone},
-               "F49":            Key{tcell.KeyF49, tcell.ModNone},
-               "F50":            Key{tcell.KeyF50, tcell.ModNone},
-               "F51":            Key{tcell.KeyF51, tcell.ModNone},
-               "F52":            Key{tcell.KeyF52, tcell.ModNone},
-               "F53":            Key{tcell.KeyF53, tcell.ModNone},
-               "F54":            Key{tcell.KeyF54, tcell.ModNone},
-               "F55":            Key{tcell.KeyF55, tcell.ModNone},
-               "F56":            Key{tcell.KeyF56, tcell.ModNone},
-               "F57":            Key{tcell.KeyF57, tcell.ModNone},
-               "F58":            Key{tcell.KeyF58, tcell.ModNone},
-               "F59":            Key{tcell.KeyF59, tcell.ModNone},
-               "F60":            Key{tcell.KeyF60, tcell.ModNone},
-               "F61":            Key{tcell.KeyF61, tcell.ModNone},
-               "F62":            Key{tcell.KeyF62, tcell.ModNone},
-               "F63":            Key{tcell.KeyF63, tcell.ModNone},
-               "F64":            Key{tcell.KeyF64, tcell.ModNone},
-               "CtrlSpace":      Key{tcell.KeyCtrlSpace, tcell.ModCtrl},
-               "CtrlA":          Key{tcell.KeyCtrlA, tcell.ModCtrl},
-               "CtrlB":          Key{tcell.KeyCtrlB, tcell.ModCtrl},
-               "CtrlC":          Key{tcell.KeyCtrlC, tcell.ModCtrl},
-               "CtrlD":          Key{tcell.KeyCtrlD, tcell.ModCtrl},
-               "CtrlE":          Key{tcell.KeyCtrlE, tcell.ModCtrl},
-               "CtrlF":          Key{tcell.KeyCtrlF, tcell.ModCtrl},
-               "CtrlG":          Key{tcell.KeyCtrlG, tcell.ModCtrl},
-               "CtrlH":          Key{tcell.KeyCtrlH, tcell.ModCtrl},
-               "CtrlI":          Key{tcell.KeyCtrlI, tcell.ModCtrl},
-               "CtrlJ":          Key{tcell.KeyCtrlJ, tcell.ModCtrl},
-               "CtrlK":          Key{tcell.KeyCtrlK, tcell.ModCtrl},
-               "CtrlL":          Key{tcell.KeyCtrlL, tcell.ModCtrl},
-               "CtrlM":          Key{tcell.KeyCtrlM, tcell.ModCtrl},
-               "CtrlN":          Key{tcell.KeyCtrlN, tcell.ModCtrl},
-               "CtrlO":          Key{tcell.KeyCtrlO, tcell.ModCtrl},
-               "CtrlP":          Key{tcell.KeyCtrlP, tcell.ModCtrl},
-               "CtrlQ":          Key{tcell.KeyCtrlQ, tcell.ModCtrl},
-               "CtrlR":          Key{tcell.KeyCtrlR, tcell.ModCtrl},
-               "CtrlS":          Key{tcell.KeyCtrlS, tcell.ModCtrl},
-               "CtrlT":          Key{tcell.KeyCtrlT, tcell.ModCtrl},
-               "CtrlU":          Key{tcell.KeyCtrlU, tcell.ModCtrl},
-               "CtrlV":          Key{tcell.KeyCtrlV, tcell.ModCtrl},
-               "CtrlW":          Key{tcell.KeyCtrlW, tcell.ModCtrl},
-               "CtrlX":          Key{tcell.KeyCtrlX, tcell.ModCtrl},
-               "CtrlY":          Key{tcell.KeyCtrlY, tcell.ModCtrl},
-               "CtrlZ":          Key{tcell.KeyCtrlZ, tcell.ModCtrl},
-               "CtrlLeftSq":     Key{tcell.KeyCtrlLeftSq, tcell.ModCtrl},
-               "CtrlBackslash":  Key{tcell.KeyCtrlBackslash, tcell.ModCtrl},
-               "CtrlRightSq":    Key{tcell.KeyCtrlRightSq, tcell.ModCtrl},
-               "CtrlCarat":      Key{tcell.KeyCtrlCarat, tcell.ModCtrl},
-               "CtrlUnderscore": Key{tcell.KeyCtrlUnderscore, tcell.ModCtrl},
-               "Backspace":      Key{tcell.KeyBackspace, tcell.ModNone},
-               "Tab":            Key{tcell.KeyTab, tcell.ModNone},
-               "Esc":            Key{tcell.KeyEsc, tcell.ModNone},
-               "Escape":         Key{tcell.KeyEscape, tcell.ModNone},
-               "Enter":          Key{tcell.KeyEnter, tcell.ModNone},
-               "Backspace2":     Key{tcell.KeyBackspace2, tcell.ModNone},
+               "Up":             Key{tcell.KeyUp, tcell.ModNone, 0},
+               "Down":           Key{tcell.KeyDown, tcell.ModNone, 0},
+               "Right":          Key{tcell.KeyRight, tcell.ModNone, 0},
+               "Left":           Key{tcell.KeyLeft, tcell.ModNone, 0},
+               "AltUp":          Key{tcell.KeyUp, tcell.ModAlt, 0},
+               "AltDown":        Key{tcell.KeyDown, tcell.ModAlt, 0},
+               "AltLeft":        Key{tcell.KeyLeft, tcell.ModAlt, 0},
+               "AltRight":       Key{tcell.KeyRight, tcell.ModAlt, 0},
+               "CtrlUp":         Key{tcell.KeyUp, tcell.ModCtrl, 0},
+               "CtrlDown":       Key{tcell.KeyDown, tcell.ModCtrl, 0},
+               "CtrlLeft":       Key{tcell.KeyLeft, tcell.ModCtrl, 0},
+               "CtrlRight":      Key{tcell.KeyRight, tcell.ModCtrl, 0},
+               "ShiftUp":        Key{tcell.KeyUp, tcell.ModShift, 0},
+               "ShiftDown":      Key{tcell.KeyDown, tcell.ModShift, 0},
+               "ShiftLeft":      Key{tcell.KeyLeft, tcell.ModShift, 0},
+               "ShiftRight":     Key{tcell.KeyRight, tcell.ModShift, 0},
+               "AltShiftUp":     Key{tcell.KeyUp, tcell.ModShift | tcell.ModAlt, 0},
+               "AltShiftDown":   Key{tcell.KeyDown, tcell.ModShift | tcell.ModAlt, 0},
+               "AltShiftLeft":   Key{tcell.KeyLeft, tcell.ModShift | tcell.ModAlt, 0},
+               "AltShiftRight":  Key{tcell.KeyRight, tcell.ModShift | tcell.ModAlt, 0},
+               "CtrlShiftUp":    Key{tcell.KeyUp, tcell.ModShift | tcell.ModCtrl, 0},
+               "CtrlShiftDown":  Key{tcell.KeyDown, tcell.ModShift | tcell.ModCtrl, 0},
+               "CtrlShiftLeft":  Key{tcell.KeyLeft, tcell.ModShift | tcell.ModCtrl, 0},
+               "CtrlShiftRight": Key{tcell.KeyRight, tcell.ModShift | tcell.ModCtrl, 0},
+               "UpLeft":         Key{tcell.KeyUpLeft, tcell.ModNone, 0},
+               "UpRight":        Key{tcell.KeyUpRight, tcell.ModNone, 0},
+               "DownLeft":       Key{tcell.KeyDownLeft, tcell.ModNone, 0},
+               "DownRight":      Key{tcell.KeyDownRight, tcell.ModNone, 0},
+               "Center":         Key{tcell.KeyCenter, tcell.ModNone, 0},
+               "PgUp":           Key{tcell.KeyPgUp, tcell.ModNone, 0},
+               "PgDn":           Key{tcell.KeyPgDn, tcell.ModNone, 0},
+               "Home":           Key{tcell.KeyHome, tcell.ModNone, 0},
+               "End":            Key{tcell.KeyEnd, tcell.ModNone, 0},
+               "Insert":         Key{tcell.KeyInsert, tcell.ModNone, 0},
+               "Delete":         Key{tcell.KeyDelete, tcell.ModNone, 0},
+               "Help":           Key{tcell.KeyHelp, tcell.ModNone, 0},
+               "Exit":           Key{tcell.KeyExit, tcell.ModNone, 0},
+               "Clear":          Key{tcell.KeyClear, tcell.ModNone, 0},
+               "Cancel":         Key{tcell.KeyCancel, tcell.ModNone, 0},
+               "Print":          Key{tcell.KeyPrint, tcell.ModNone, 0},
+               "Pause":          Key{tcell.KeyPause, tcell.ModNone, 0},
+               "Backtab":        Key{tcell.KeyBacktab, tcell.ModNone, 0},
+               "F1":             Key{tcell.KeyF1, tcell.ModNone, 0},
+               "F2":             Key{tcell.KeyF2, tcell.ModNone, 0},
+               "F3":             Key{tcell.KeyF3, tcell.ModNone, 0},
+               "F4":             Key{tcell.KeyF4, tcell.ModNone, 0},
+               "F5":             Key{tcell.KeyF5, tcell.ModNone, 0},
+               "F6":             Key{tcell.KeyF6, tcell.ModNone, 0},
+               "F7":             Key{tcell.KeyF7, tcell.ModNone, 0},
+               "F8":             Key{tcell.KeyF8, tcell.ModNone, 0},
+               "F9":             Key{tcell.KeyF9, tcell.ModNone, 0},
+               "F10":            Key{tcell.KeyF10, tcell.ModNone, 0},
+               "F11":            Key{tcell.KeyF11, tcell.ModNone, 0},
+               "F12":            Key{tcell.KeyF12, tcell.ModNone, 0},
+               "F13":            Key{tcell.KeyF13, tcell.ModNone, 0},
+               "F14":            Key{tcell.KeyF14, tcell.ModNone, 0},
+               "F15":            Key{tcell.KeyF15, tcell.ModNone, 0},
+               "F16":            Key{tcell.KeyF16, tcell.ModNone, 0},
+               "F17":            Key{tcell.KeyF17, tcell.ModNone, 0},
+               "F18":            Key{tcell.KeyF18, tcell.ModNone, 0},
+               "F19":            Key{tcell.KeyF19, tcell.ModNone, 0},
+               "F20":            Key{tcell.KeyF20, tcell.ModNone, 0},
+               "F21":            Key{tcell.KeyF21, tcell.ModNone, 0},
+               "F22":            Key{tcell.KeyF22, tcell.ModNone, 0},
+               "F23":            Key{tcell.KeyF23, tcell.ModNone, 0},
+               "F24":            Key{tcell.KeyF24, tcell.ModNone, 0},
+               "F25":            Key{tcell.KeyF25, tcell.ModNone, 0},
+               "F26":            Key{tcell.KeyF26, tcell.ModNone, 0},
+               "F27":            Key{tcell.KeyF27, tcell.ModNone, 0},
+               "F28":            Key{tcell.KeyF28, tcell.ModNone, 0},
+               "F29":            Key{tcell.KeyF29, tcell.ModNone, 0},
+               "F30":            Key{tcell.KeyF30, tcell.ModNone, 0},
+               "F31":            Key{tcell.KeyF31, tcell.ModNone, 0},
+               "F32":            Key{tcell.KeyF32, tcell.ModNone, 0},
+               "F33":            Key{tcell.KeyF33, tcell.ModNone, 0},
+               "F34":            Key{tcell.KeyF34, tcell.ModNone, 0},
+               "F35":            Key{tcell.KeyF35, tcell.ModNone, 0},
+               "F36":            Key{tcell.KeyF36, tcell.ModNone, 0},
+               "F37":            Key{tcell.KeyF37, tcell.ModNone, 0},
+               "F38":            Key{tcell.KeyF38, tcell.ModNone, 0},
+               "F39":            Key{tcell.KeyF39, tcell.ModNone, 0},
+               "F40":            Key{tcell.KeyF40, tcell.ModNone, 0},
+               "F41":            Key{tcell.KeyF41, tcell.ModNone, 0},
+               "F42":            Key{tcell.KeyF42, tcell.ModNone, 0},
+               "F43":            Key{tcell.KeyF43, tcell.ModNone, 0},
+               "F44":            Key{tcell.KeyF44, tcell.ModNone, 0},
+               "F45":            Key{tcell.KeyF45, tcell.ModNone, 0},
+               "F46":            Key{tcell.KeyF46, tcell.ModNone, 0},
+               "F47":            Key{tcell.KeyF47, tcell.ModNone, 0},
+               "F48":            Key{tcell.KeyF48, tcell.ModNone, 0},
+               "F49":            Key{tcell.KeyF49, tcell.ModNone, 0},
+               "F50":            Key{tcell.KeyF50, tcell.ModNone, 0},
+               "F51":            Key{tcell.KeyF51, tcell.ModNone, 0},
+               "F52":            Key{tcell.KeyF52, tcell.ModNone, 0},
+               "F53":            Key{tcell.KeyF53, tcell.ModNone, 0},
+               "F54":            Key{tcell.KeyF54, tcell.ModNone, 0},
+               "F55":            Key{tcell.KeyF55, tcell.ModNone, 0},
+               "F56":            Key{tcell.KeyF56, tcell.ModNone, 0},
+               "F57":            Key{tcell.KeyF57, tcell.ModNone, 0},
+               "F58":            Key{tcell.KeyF58, tcell.ModNone, 0},
+               "F59":            Key{tcell.KeyF59, tcell.ModNone, 0},
+               "F60":            Key{tcell.KeyF60, tcell.ModNone, 0},
+               "F61":            Key{tcell.KeyF61, tcell.ModNone, 0},
+               "F62":            Key{tcell.KeyF62, tcell.ModNone, 0},
+               "F63":            Key{tcell.KeyF63, tcell.ModNone, 0},
+               "F64":            Key{tcell.KeyF64, tcell.ModNone, 0},
+               "CtrlSpace":      Key{tcell.KeyCtrlSpace, tcell.ModCtrl, 0},
+               "CtrlA":          Key{tcell.KeyCtrlA, tcell.ModCtrl, 0},
+               "CtrlB":          Key{tcell.KeyCtrlB, tcell.ModCtrl, 0},
+               "CtrlC":          Key{tcell.KeyCtrlC, tcell.ModCtrl, 0},
+               "CtrlD":          Key{tcell.KeyCtrlD, tcell.ModCtrl, 0},
+               "CtrlE":          Key{tcell.KeyCtrlE, tcell.ModCtrl, 0},
+               "CtrlF":          Key{tcell.KeyCtrlF, tcell.ModCtrl, 0},
+               "CtrlG":          Key{tcell.KeyCtrlG, tcell.ModCtrl, 0},
+               "CtrlH":          Key{tcell.KeyCtrlH, tcell.ModCtrl, 0},
+               "CtrlI":          Key{tcell.KeyCtrlI, tcell.ModCtrl, 0},
+               "CtrlJ":          Key{tcell.KeyCtrlJ, tcell.ModCtrl, 0},
+               "CtrlK":          Key{tcell.KeyCtrlK, tcell.ModCtrl, 0},
+               "CtrlL":          Key{tcell.KeyCtrlL, tcell.ModCtrl, 0},
+               "CtrlM":          Key{tcell.KeyCtrlM, tcell.ModCtrl, 0},
+               "CtrlN":          Key{tcell.KeyCtrlN, tcell.ModCtrl, 0},
+               "CtrlO":          Key{tcell.KeyCtrlO, tcell.ModCtrl, 0},
+               "CtrlP":          Key{tcell.KeyCtrlP, tcell.ModCtrl, 0},
+               "CtrlQ":          Key{tcell.KeyCtrlQ, tcell.ModCtrl, 0},
+               "CtrlR":          Key{tcell.KeyCtrlR, tcell.ModCtrl, 0},
+               "CtrlS":          Key{tcell.KeyCtrlS, tcell.ModCtrl, 0},
+               "CtrlT":          Key{tcell.KeyCtrlT, tcell.ModCtrl, 0},
+               "CtrlU":          Key{tcell.KeyCtrlU, tcell.ModCtrl, 0},
+               "CtrlV":          Key{tcell.KeyCtrlV, tcell.ModCtrl, 0},
+               "CtrlW":          Key{tcell.KeyCtrlW, tcell.ModCtrl, 0},
+               "CtrlX":          Key{tcell.KeyCtrlX, tcell.ModCtrl, 0},
+               "CtrlY":          Key{tcell.KeyCtrlY, tcell.ModCtrl, 0},
+               "CtrlZ":          Key{tcell.KeyCtrlZ, tcell.ModCtrl, 0},
+               "CtrlLeftSq":     Key{tcell.KeyCtrlLeftSq, tcell.ModCtrl, 0},
+               "CtrlBackslash":  Key{tcell.KeyCtrlBackslash, tcell.ModCtrl, 0},
+               "CtrlRightSq":    Key{tcell.KeyCtrlRightSq, tcell.ModCtrl, 0},
+               "CtrlCarat":      Key{tcell.KeyCtrlCarat, tcell.ModCtrl, 0},
+               "CtrlUnderscore": Key{tcell.KeyCtrlUnderscore, tcell.ModCtrl, 0},
+               "Backspace":      Key{tcell.KeyBackspace, tcell.ModNone, 0},
+               "Tab":            Key{tcell.KeyTab, tcell.ModNone, 0},
+               "Esc":            Key{tcell.KeyEsc, tcell.ModNone, 0},
+               "Escape":         Key{tcell.KeyEscape, tcell.ModNone, 0},
+               "Enter":          Key{tcell.KeyEnter, tcell.ModNone, 0},
+               "Backspace2":     Key{tcell.KeyBackspace2, tcell.ModNone, 0},
        }
 
        var parsed map[string]string
@@ -239,10 +241,20 @@ func InitBindings() {
        }
 
        for k, v := range defaults {
-               bindings[keys[k]] = actions[v]
+               if strings.Contains(k, "Alt-") {
+                       key := Key{tcell.KeyRune, tcell.ModAlt, rune(k[len(k)-1])}
+                       bindings[key] = actions[v]
+               } else {
+                       bindings[keys[k]] = actions[v]
+               }
        }
        for k, v := range parsed {
-               bindings[keys[k]] = actions[v]
+               if strings.Contains(k, "Alt-") {
+                       key := Key{tcell.KeyRune, tcell.ModAlt, rune(k[len(k)])}
+                       bindings[key] = actions[v]
+               } else {
+                       bindings[keys[k]] = actions[v]
+               }
        }
 }
 
@@ -284,18 +296,28 @@ func DefaultBindings() map[string]string {
                "CtrlC":          "Copy",
                "CtrlX":          "Cut",
                "CtrlK":          "CutLine",
+               "CtrlD":          "DuplicateLine",
                "CtrlV":          "Paste",
                "CtrlA":          "SelectAll",
                "Home":           "Start",
                "End":            "End",
                "PgUp":           "PageUp",
                "PgDn":           "PageDown",
-               "CtrlU":          "HalfPageUp",
-               "CtrlD":          "HalfPageDown",
-               "CtrlR":          "ToggleRuler",
-               "CtrlL":          "JumpLine",
-               "Delete":         "Delete",
-               "Esc":            "ClearStatus",
+               // Find alternative key
+               // "CtrlU":          "HalfPageUp",
+               // "CtrlD":          "HalfPageDown",
+               "CtrlR":  "ToggleRuler",
+               "CtrlL":  "JumpLine",
+               "Delete": "Delete",
+               "Esc":    "ClearStatus",
+
+               // Emacs-style keybindings
+               "Alt-f": "WordRight",
+               "Alt-b": "WordLeft",
+               "Alt-a": "StartOfLine",
+               "Alt-e": "EndOfLine",
+               "Alt-p": "CursorUp",
+               "Alt-n": "CursorDown",
        }
 }
 
@@ -498,12 +520,11 @@ func (v *View) SelectToEnd() bool {
 
 // InsertSpace inserts a space
 func (v *View) InsertSpace() bool {
-       // Insert a space
        if v.Cursor.HasSelection() {
                v.Cursor.DeleteSelection()
                v.Cursor.ResetSelection()
        }
-       v.eh.Insert(v.Cursor.Loc(), " ")
+       v.Buf.Insert(v.Cursor.Loc(), " ")
        v.Cursor.Right()
        return true
 }
@@ -516,12 +537,12 @@ func (v *View) InsertEnter() bool {
                v.Cursor.ResetSelection()
        }
 
-       v.eh.Insert(v.Cursor.Loc(), "\n")
+       v.Buf.Insert(v.Cursor.Loc(), "\n")
        ws := GetLeadingWhitespace(v.Buf.Lines[v.Cursor.y])
        v.Cursor.Right()
 
        if settings["autoindent"].(bool) {
-               v.eh.Insert(v.Cursor.Loc(), ws)
+               v.Buf.Insert(v.Cursor.Loc(), ws)
                for i := 0; i < len(ws); i++ {
                        v.Cursor.Right()
                }
@@ -548,19 +569,19 @@ func (v *View) Backspace() bool {
                // tab (tabSize number of spaces)
                lineStart := v.Buf.Lines[v.Cursor.y][:v.Cursor.x]
                tabSize := int(settings["tabsize"].(float64))
-               if settings["tabsToSpaces"].(bool) && IsSpaces(lineStart) && len(lineStart) != 0 && len(lineStart)%tabSize == 0 {
+               if settings["tabstospaces"].(bool) && IsSpaces(lineStart) && len(lineStart) != 0 && len(lineStart)%tabSize == 0 {
                        loc := v.Cursor.Loc()
                        v.Cursor.SetLoc(loc - tabSize)
                        cx, cy := v.Cursor.x, v.Cursor.y
                        v.Cursor.SetLoc(loc)
-                       v.eh.Remove(loc-tabSize, loc)
+                       v.Buf.Remove(loc-tabSize, loc)
                        v.Cursor.x, v.Cursor.y = cx, cy
                } else {
                        v.Cursor.Left()
                        cx, cy := v.Cursor.x, v.Cursor.y
                        v.Cursor.Right()
                        loc := v.Cursor.Loc()
-                       v.eh.Remove(loc-1, loc)
+                       v.Buf.Remove(loc-1, loc)
                        v.Cursor.x, v.Cursor.y = cx, cy
                }
        }
@@ -576,7 +597,7 @@ func (v *View) Delete() bool {
        } else {
                loc := v.Cursor.Loc()
                if loc < v.Buf.Len() {
-                       v.eh.Remove(loc, loc+1)
+                       v.Buf.Remove(loc, loc+1)
                }
        }
        return true
@@ -589,14 +610,14 @@ func (v *View) InsertTab() bool {
                v.Cursor.DeleteSelection()
                v.Cursor.ResetSelection()
        }
-       if settings["tabsToSpaces"].(bool) {
+       if settings["tabstospaces"].(bool) {
                tabSize := int(settings["tabsize"].(float64))
-               v.eh.Insert(v.Cursor.Loc(), Spaces(tabSize))
+               v.Buf.Insert(v.Cursor.Loc(), Spaces(tabSize))
                for i := 0; i < tabSize; i++ {
                        v.Cursor.Right()
                }
        } else {
-               v.eh.Insert(v.Cursor.Loc(), "\t")
+               v.Buf.Insert(v.Cursor.Loc(), "\t")
                v.Cursor.Right()
        }
        return true
@@ -660,13 +681,15 @@ func (v *View) FindPrevious() bool {
 
 // Undo undoes the last action
 func (v *View) Undo() bool {
-       v.eh.Undo()
+       v.Buf.Undo()
+       messenger.Message("Undid action")
        return true
 }
 
 // Redo redoes the last action
 func (v *View) Redo() bool {
-       v.eh.Redo()
+       v.Buf.Redo()
+       messenger.Message("Redid action")
        return true
 }
 
@@ -675,7 +698,7 @@ func (v *View) Copy() bool {
        if v.Cursor.HasSelection() {
                clipboard.WriteAll(v.Cursor.GetSelection())
                v.freshClip = true
-               messenger.Message("Copied selection to clipboard")
+               messenger.Message("Copied selection")
        }
        return true
 }
@@ -684,7 +707,6 @@ func (v *View) Copy() bool {
 func (v *View) CutLine() bool {
        v.Cursor.SelectLine()
        if v.freshClip == true {
-
                if v.Cursor.HasSelection() {
                        if clip, err := clipboard.ReadAll(); err != nil {
                                messenger.Error(err)
@@ -699,6 +721,7 @@ func (v *View) CutLine() bool {
        v.lastCutTime = time.Now()
        v.Cursor.DeleteSelection()
        v.Cursor.ResetSelection()
+       messenger.Message("Cut line")
        return true
 }
 
@@ -709,10 +732,20 @@ func (v *View) Cut() bool {
                v.Cursor.DeleteSelection()
                v.Cursor.ResetSelection()
                v.freshClip = true
+               messenger.Message("Cut selection")
        }
        return true
 }
 
+// DuplicateLine duplicates the current line
+func (v *View) DuplicateLine() bool {
+       v.Cursor.End()
+       v.Buf.Insert(v.Cursor.Loc(), "\n"+v.Buf.Lines[v.Cursor.y])
+       v.Cursor.Right()
+       messenger.Message("Duplicated 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 {
@@ -721,9 +754,10 @@ func (v *View) Paste() bool {
                v.Cursor.ResetSelection()
        }
        clip, _ := clipboard.ReadAll()
-       v.eh.Insert(v.Cursor.Loc(), clip)
+       v.Buf.Insert(v.Cursor.Loc(), clip)
        v.Cursor.SetLoc(v.Cursor.Loc() + Count(clip))
        v.freshClip = false
+       messenger.Message("Pasted clipboard")
        return true
 }
 
@@ -820,8 +854,10 @@ func (v *View) HalfPageDown() bool {
 func (v *View) ToggleRuler() bool {
        if settings["ruler"] == false {
                settings["ruler"] = true
+               messenger.Message("Enabled ruler")
        } else {
                settings["ruler"] = false
+               messenger.Message("Disabled ruler")
        }
        return false
 }