Added ~ support

Thanks to @romgrk in PR #48
This commit is contained in:
Loic Nageleisen 2015-07-28 12:02:03 +02:00
parent cdf65d6e27
commit 8fd1fe14c8
2 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,6 @@
path = require 'path' path = require 'path'
CommandError = require './command-error' CommandError = require './command-error'
fs = require 'fs' fs = require 'fs-plus'
VimOption = require './vim-option' VimOption = require './vim-option'
trySave = (func) -> trySave = (func) ->
@ -108,7 +108,7 @@ class Ex
tabp: => @tabprevious() tabp: => @tabprevious()
edit: (range, filePath) -> edit: (range, filePath) ->
filePath = path.normalize(filePath.trim()) filePath = fs.normalize(filePath.trim())
if filePath.indexOf(' ') isnt -1 if filePath.indexOf(' ') isnt -1
throw new CommandError('Only one file name allowed') throw new CommandError('Only one file name allowed')
buffer = atom.workspace.getActiveTextEditor().buffer buffer = atom.workspace.getActiveTextEditor().buffer
@ -124,7 +124,7 @@ class Ex
buffer.load() buffer.load()
write: (range, filePath) -> write: (range, filePath) ->
filePath = path.normalize(filePath.trim()) filePath = fs.normalize(filePath.trim())
deferred = Promise.defer() deferred = Promise.defer()
editor = atom.workspace.getActiveTextEditor() editor = atom.workspace.getActiveTextEditor()

View file

@ -15,7 +15,8 @@
"underscore-plus": "1.x", "underscore-plus": "1.x",
"event-kit": "^0.7.2", "event-kit": "^0.7.2",
"space-pen": "^5.1.1", "space-pen": "^5.1.1",
"atom-space-pen-views": "^2.0.4" "atom-space-pen-views": "^2.0.4",
"fs-plus": "^2.2.8"
}, },
"consumedServices": { "consumedServices": {
"vim-mode": { "vim-mode": {