Support Ctrl-C to cancel ex-mode

This commit is contained in:
Edvin Hultberg 2017-07-27 16:13:48 +02:00
parent 4747bcf5e8
commit 26ac7c50b1
2 changed files with 5 additions and 1 deletions

View file

@ -9,5 +9,7 @@
# https://atom.io/docs/latest/advanced/keymaps # https://atom.io/docs/latest/advanced/keymaps
'atom-text-editor.vim-mode-plus:not(.insert-mode)': 'atom-text-editor.vim-mode-plus:not(.insert-mode)':
':': 'ex-mode:open' ':': 'ex-mode:open'
'atom-text-editor.ex-mode-editor':
'ctrl-c': 'ex-mode:close'
'atom-text-editor.vim-mode:not(.insert-mode)': 'atom-text-editor.vim-mode:not(.insert-mode)':
':': 'ex-mode:open' ':': 'ex-mode:open'

View file

@ -15,7 +15,8 @@ class ExCommandModeInputElement extends HTMLDivElement
@editorContainer.style.height = "0px" @editorContainer.style.height = "0px"
@editorElement = document.createElement "atom-text-editor" @editorElement = document.createElement "atom-text-editor"
@editorElement.classList.add('editor') @editorElement.classList.add('editor') # Consider this deprecated!
@editorElement.classList.add('ex-mode-editor')
@editorElement.getModel().setMini(true) @editorElement.getModel().setMini(true)
@editorElement.setAttribute('mini', '') @editorElement.setAttribute('mini', '')
@editorContainer.appendChild(@editorElement) @editorContainer.appendChild(@editorElement)
@ -40,6 +41,7 @@ class ExCommandModeInputElement extends HTMLDivElement
atom.commands.add(@editorElement, 'core:confirm', @confirm.bind(this)) atom.commands.add(@editorElement, 'core:confirm', @confirm.bind(this))
atom.commands.add(@editorElement, 'core:cancel', @cancel.bind(this)) atom.commands.add(@editorElement, 'core:cancel', @cancel.bind(this))
atom.commands.add(@editorElement, 'ex-mode:close', @cancel.bind(this))
atom.commands.add(@editorElement, 'blur', @cancel.bind(this)) atom.commands.add(@editorElement, 'blur', @cancel.bind(this))
backspace: -> backspace: ->