Merge pull request #178 from mkiken/fix-substitute-vim-mode-plus

Support vim-mode-plus substitute command
This commit is contained in:
Jasper v. B 2017-05-25 01:06:58 +02:00 committed by GitHub
commit ed3417c842
3 changed files with 21 additions and 2 deletions

View file

@ -36,6 +36,9 @@ module.exports = ExMode =
@vim = vim @vim = vim
@globalExState.setVim(vim) @globalExState.setVim(vim)
consumeVimModePlus: (vim) ->
this.consumeVim(vim)
config: config:
splitbelow: splitbelow:
title: 'Split below' title: 'Split below'

View file

@ -335,12 +335,23 @@ class Ex
[pattern, substition, flags] = parsed [pattern, substition, flags] = parsed
if pattern is '' if pattern is ''
pattern = vimState.getSearchHistoryItem() if vimState.getSearchHistoryItem?
# vim-mode
pattern = vimState.getSearchHistoryItem()
else if vimState.searchHistory?
# vim-mode-plus
pattern = vimState.searchHistory.get('prev')
if not pattern? if not pattern?
atom.beep() atom.beep()
throw new CommandError('No previous regular expression') throw new CommandError('No previous regular expression')
else else
vimState.pushSearchHistory(pattern) if vimState.pushSearchHistory?
# vim-mode
vimState.pushSearchHistory(pattern)
else if vimState.searchHistory?
# vim-mode-plus
vimState.searchHistory.save(pattern)
try try
flagsObj = {} flagsObj = {}

View file

@ -23,6 +23,11 @@
"versions": { "versions": {
"^0.1.0": "consumeVim" "^0.1.0": "consumeVim"
} }
},
"vim-mode-plus": {
"versions": {
"^0.1.0": "consumeVimModePlus"
}
} }
}, },
"providedServices": { "providedServices": {