add normal o
@@ -76,6 +76,8 @@ func newVimNormalState(e *Editor) VimState {
"i": s.toInsert,
"a": s.toInsertRight,
"A": s.toInsertEndOfLine,
+ "o": s.toInsertNewLine,
+ "O": s.toInsertNewLineAbove,
"h": s.left,
"l": s.right,
"j": s.down,
@@ -165,6 +167,16 @@ func (s *NormalState) toInsertEndOfLine() {
win.buffer.xiView.Click(row, maxCol)
}
+func (s *NormalState) toInsertNewLine() {
+ s.toInsertEndOfLine()
+ s.editor.activeWin.buffer.xiView.InsertNewline()
+}
+
+func (s *NormalState) toInsertNewLineAbove() {
+ s.up()
+ s.toInsertNewLine()
+}
+
func (s *NormalState) esc() {
s.cancelVisual()
s.reset()
@@ -264,6 +276,8 @@ func (s *NormalState) up() {
if col > maxCol {
col = maxCol
}
+ win.row = row
+ win.col = col
if s.visualActive {
win.buffer.xiView.Drag(row, col)
} else {
@@ -449,6 +463,9 @@ func newVimInsertState(e *Editor) VimState {
"<Enter>": s.newLine,
"<C-m>": s.newLine,
"<C-j>": s.newLine,
+ "<Space>": s.insertSpace,
+ "<lt>": s.insertLt,
+ "<Bslash>": s.insertBslash,
"<BS>": s.deleteBackward,
"<C-h>": s.deleteBackward,
"<C-u>": s.deleteToBeginningOfLine,
@@ -491,6 +508,18 @@ func (s *InsertState) newLine() {
s.editor.activeWin.buffer.xiView.InsertNewline()
}
+func (s *InsertState) insertSpace() {
+ s.editor.activeWin.buffer.xiView.Insert(" ")
+}
+
+func (s *InsertState) insertLt() {
+ s.editor.activeWin.buffer.xiView.Insert("<")
+}
+
+func (s *InsertState) insertBslash() {
+ s.editor.activeWin.buffer.xiView.Insert("\\")
+}
+
func (s *InsertState) deleteForward() {
s.editor.activeWin.buffer.xiView.DeleteForward()
}
