Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrl + [ support for exiting insert mode #536

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions bundles/vi/insert_map.moon
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ get_edit = (editor) ->
if text and #text > 0
(editor) -> editor\insert text

exit_insert_mode = (editor) ->
state.insert_edit = get_edit editor
insert_pos = nil
state.change_mode editor, 'command'
editor.cursor.column = math.max 1, editor.cursor.column - 1

insert_map = {
__meta: {

Expand All @@ -27,16 +33,11 @@ insert_map = {
blink_interval: -> config.cursor_blink_interval
}

escape: (editor) ->
state.insert_edit = get_edit editor
insert_pos = nil
state.change_mode editor, 'command'
editor.cursor.column = math.max 1, editor.cursor.column - 1

escape: exit_insert_mode
'ctrl_[': exit_insert_mode
ctrl_i: (editor) -> editor\shift_right!
ctrl_d: (editor) -> editor\shift_left!
}

setmetatable insert_map, {
__call: (_, editor) ->
state.enter_edit_mode editor
Expand Down