Skip to content

Commit

Permalink
Merge pull request #885 from asmsuechan/exit-by-comma-q-in-vim-mode
Browse files Browse the repository at this point in the history
iss #832 Make :q work in vim mode
  • Loading branch information
kazup01 authored Sep 23, 2017
2 parents 8c48ee6 + e6c1d7a commit bd266dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions browser/components/CodeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ export default class CodeEditor extends React.Component {

let editorTheme = document.getElementById('editorTheme')
editorTheme.addEventListener('load', this.loadStyleHandler)

CodeMirror.Vim.defineEx('quit', 'q', this.quitEditor)
CodeMirror.Vim.defineEx('q!', 'q!', this.quitEditor)
CodeMirror.Vim.defineEx('wq', 'wq', this.quitEditor)
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
}

quitEditor () {
document.querySelector('textarea').blur()
}

componentWillUnmount () {
Expand Down

0 comments on commit bd266dc

Please sign in to comment.