Merge 5fe2f87c24 into e33dc15392
This commit is contained in:
commit
d6fc17d229
2 changed files with 27 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
|
fs = require 'fs-plus'
|
||||||
CommandError = require './command-error'
|
CommandError = require './command-error'
|
||||||
|
|
||||||
trySave = (func) ->
|
trySave = (func) ->
|
||||||
|
|
@ -31,6 +32,7 @@ trySave = (func) ->
|
||||||
deferred.promise
|
deferred.promise
|
||||||
|
|
||||||
getFullPath = (filePath) ->
|
getFullPath = (filePath) ->
|
||||||
|
filePath = fs.normalize(filePath)
|
||||||
return filePath if path.isAbsolute(filePath)
|
return filePath if path.isAbsolute(filePath)
|
||||||
return path.join(atom.project.getPath(), filePath)
|
return path.join(atom.project.getPath(), filePath)
|
||||||
|
|
||||||
|
|
@ -163,6 +165,28 @@ class Ex
|
||||||
else
|
else
|
||||||
pane.splitUp(copyActiveItem: true)
|
pane.splitUp(copyActiveItem: true)
|
||||||
|
|
||||||
|
set: (args...) ->
|
||||||
|
editor = ->
|
||||||
|
atom.workspace.getActiveTextEditor()
|
||||||
|
|
||||||
|
arg = args[1]
|
||||||
|
regex = /\s*(\w+)(?:\s*=\s*([\d\w]+)\s*|(!))/
|
||||||
|
matches = arg.match regex
|
||||||
|
return unless matches?
|
||||||
|
|
||||||
|
[whole, option, value, bang] = matches
|
||||||
|
|
||||||
|
switch option
|
||||||
|
when 'tw'
|
||||||
|
editor().setTabLength(parseInt(value))
|
||||||
|
when 'ft'
|
||||||
|
regex = new RegExp "(source|text)\.#{value}$"
|
||||||
|
lowerCaseName = value.toLowerCase()
|
||||||
|
for name, grammar of atom.grammars.grammarsByScopeName
|
||||||
|
grammarName = grammar.name.toLowerCase()
|
||||||
|
if name.match(regex) or lowerCaseName is grammarName
|
||||||
|
editor().setGrammar(grammar)
|
||||||
|
|
||||||
sp: (args...) => @split(args...)
|
sp: (args...) => @split(args...)
|
||||||
|
|
||||||
substitute: (range, args) ->
|
substitute: (range, args) ->
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@
|
||||||
"atom": ">=0.200.0 <2.0.0"
|
"atom": ">=0.200.0 <2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"underscore-plus": "1.x",
|
"atom-space-pen-views": "^2.0.4",
|
||||||
"event-kit": "^0.7.2",
|
"event-kit": "^0.7.2",
|
||||||
|
"fs-plus": "^2.8.1",
|
||||||
"space-pen": "^5.1.1",
|
"space-pen": "^5.1.1",
|
||||||
"atom-space-pen-views": "^2.0.4"
|
"underscore-plus": "1.x"
|
||||||
},
|
},
|
||||||
"consumedServices": {
|
"consumedServices": {
|
||||||
"vim-mode": {
|
"vim-mode": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue