mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge branch 'master' of github.com:github/atom
This commit is contained in:
37
README.md
37
README.md
@@ -1,28 +1,21 @@
|
||||
# Atom — Futuristic Text Editing
|
||||
|
||||
## Be forwarned: Atom is pre-alpha software!
|
||||
|
||||
## Instalation
|
||||
|
||||
1. Get [xcode 4.2](http://itunes.apple.com/us/app/xcode/id448457090?mt=12).
|
||||
|
||||
2. Clone atom from github/atom.
|
||||
|
||||
3. Open Atom.xcodeproject.
|
||||
|
||||
4. Press cmd-r to build and run.
|
||||
|
||||
## Informative Links
|
||||
|
||||
### Ace
|
||||
* [Ace](https://github.com/ajaxorg/ace)
|
||||
|
||||
* https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
|
||||
* https://github.com/ajaxorg/ace/blob/master/lib/ace/selection.js
|
||||
* https://github.com/ajaxorg/ace/blob/master/lib/ace/commands/default_commands.js
|
||||
* https://github.com/ajaxorg/ace/blob/master/lib/ace/document.js
|
||||
|
||||
### commonjs
|
||||
|
||||
* http://ringojs.org/api/master/
|
||||
* http://wiki.commonjs.org/wiki/Filesystem/A
|
||||
* https://github.com/280north/narwhal
|
||||
|
||||
### JSCocoa
|
||||
|
||||
* http://parmanoir.com/Taming_JavascriptCore_within_and_without_WebView
|
||||
* https://github.com/parmanoir/jscocoa/
|
||||
* http://code.google.com/p/jscocoa/
|
||||
|
||||
### Cloud9
|
||||
|
||||
* Extensions: http://cloud9ide.posterous.com/writing-an-extension-for-cloud9-javascript-id
|
||||
* https://github.com/ajaxorg/cloud9/blob/master/client/ext/extension_template/extension_template.js
|
||||
* [commonjs](http://wiki.commonjs.org)
|
||||
|
||||
* [JSCocoa](https://github.com/parmanoir/jscocoa/)
|
||||
|
||||
0
Resources/.keep
Normal file
0
Resources/.keep
Normal file
@@ -57,6 +57,35 @@ describe "VimMode", ->
|
||||
expect(editor.buffer.getText()).toBe "12345\nABCDE"
|
||||
expect(editor.getPosition()).toEqual(column: 0, row: 1)
|
||||
|
||||
describe "when the second d is prefixed by a count", ->
|
||||
it "deletes n lines, starting from the current", ->
|
||||
editor.buffer.setText("12345\nabcde\nABCDE\nQWERT")
|
||||
editor.setPosition(column: 1, row: 1)
|
||||
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('2')
|
||||
editor.trigger keydownEvent('d')
|
||||
|
||||
expect(editor.buffer.getText()).toBe "12345\nQWERT"
|
||||
expect(editor.getPosition()).toEqual(column: 0, row: 1)
|
||||
|
||||
describe "when followed by an h", ->
|
||||
it "deletes the previous letter on the current line", ->
|
||||
editor.buffer.setText("abcd\n01234")
|
||||
editor.setPosition(column: 1, row: 1)
|
||||
|
||||
editor.trigger keydownEvent 'd'
|
||||
editor.trigger keydownEvent 'h'
|
||||
|
||||
expect(editor.buffer.getText()).toBe "abcd\n1234"
|
||||
expect(editor.getPosition()).toEqual {column: 0, row: 1}
|
||||
|
||||
editor.trigger keydownEvent 'd'
|
||||
editor.trigger keydownEvent 'h'
|
||||
|
||||
expect(editor.buffer.getText()).toBe "abcd\n1234"
|
||||
expect(editor.getPosition()).toEqual {column: 0, row: 1}
|
||||
|
||||
describe "when followed by a w", ->
|
||||
it "deletes to the beginning of the next word", ->
|
||||
editor.buffer.setText("abcd efg")
|
||||
@@ -91,12 +120,27 @@ describe "VimMode", ->
|
||||
expect(editor.getPosition()).toEqual(column: 0, row: 1)
|
||||
|
||||
describe "the j keybinding", ->
|
||||
it "moves the cursor down, but not to the end of the last line", ->
|
||||
editor.trigger keydownEvent 'j'
|
||||
expect(editor.getPosition()).toEqual(column: 1, row: 2)
|
||||
editor.trigger keydownEvent 'j'
|
||||
expect(editor.getPosition()).toEqual(column: 1, row: 2)
|
||||
|
||||
describe "the k keybinding", ->
|
||||
it "moves the cursor up, but not to the beginning of the first line", ->
|
||||
editor.trigger keydownEvent('j')
|
||||
editor.trigger keydownEvent('k')
|
||||
expect(editor.getPosition()).toEqual(column: 1, row: 0)
|
||||
editor.trigger keydownEvent('j')
|
||||
editor.trigger keydownEvent('k')
|
||||
expect(editor.getPosition()).toEqual(column: 1, row: 0)
|
||||
|
||||
describe "the l keybinding", ->
|
||||
it "moves the cursor right, but not to the next line", ->
|
||||
editor.setPosition(column: 4, row: 1)
|
||||
editor.trigger keydownEvent('l')
|
||||
expect(editor.getPosition()).toEqual(column: 5, row: 1)
|
||||
editor.trigger keydownEvent('l')
|
||||
expect(editor.getPosition()).toEqual(column: 5, row: 1)
|
||||
|
||||
describe "the w keybinding", ->
|
||||
it "moves the cursor to the beginning of the next word", ->
|
||||
editor.buffer.setText("ab cde1+- \n xyz\n\nzip")
|
||||
|
||||
@@ -89,5 +89,11 @@ class Editor extends Template
|
||||
moveLeft: ->
|
||||
@aceEditor.navigateLeft()
|
||||
|
||||
moveRight: ->
|
||||
@aceEditor.navigateRight()
|
||||
|
||||
moveUp: ->
|
||||
@aceEditor.navigateUp()
|
||||
|
||||
moveDown: ->
|
||||
@aceEditor.navigateDown()
|
||||
|
||||
@@ -30,7 +30,9 @@ class VimMode
|
||||
'd': 'delete'
|
||||
'x': 'delete-char'
|
||||
'h': 'move-left'
|
||||
'j': 'move-up'
|
||||
'j': 'move-down'
|
||||
'k': 'move-up'
|
||||
'l': 'move-right'
|
||||
'w': 'move-to-next-word'
|
||||
|
||||
@handleCommands
|
||||
@@ -39,6 +41,8 @@ class VimMode
|
||||
'delete-char': => new commands.DeleteChar(@editor)
|
||||
'move-left': => new motions.MoveLeft(@editor)
|
||||
'move-up': => new motions.MoveUp(@editor)
|
||||
'move-down': => new motions.MoveDown @editor
|
||||
'move-right': => new motions.MoveRight @editor
|
||||
'move-to-next-word': => new motions.MoveToNextWord(@editor)
|
||||
'numeric-prefix': (e) => @numericPrefix(e)
|
||||
|
||||
@@ -72,11 +76,16 @@ class VimMode
|
||||
@pushOperator(new operators.NumericPrefix(num))
|
||||
|
||||
delete: () ->
|
||||
if @topOperator() instanceof operators.Delete
|
||||
@pushOperator(new motions.SelectLine(@editor))
|
||||
if @isDeletePending()
|
||||
@pushOperator(new motions.SelectLines(@editor))
|
||||
else
|
||||
@pushOperator(new operators.Delete(@editor))
|
||||
|
||||
isDeletePending: () ->
|
||||
for op in @opStack
|
||||
return true if op instanceof operators.Delete
|
||||
false
|
||||
|
||||
pushOperator: (op) ->
|
||||
@opStack.push(op)
|
||||
@processOpStack()
|
||||
|
||||
@@ -9,11 +9,27 @@ class MoveLeft extends Motion
|
||||
{column, row} = @editor.getPosition()
|
||||
@editor.moveLeft() if column > 0
|
||||
|
||||
select: ->
|
||||
position = @editor.getPosition()
|
||||
position.column-- if position.column > 0
|
||||
@editor.selectToPosition position
|
||||
|
||||
class MoveRight extends Motion
|
||||
execute: ->
|
||||
{column, row} = @editor.getPosition()
|
||||
currentLineLength = @editor.getLineText(row).length
|
||||
@editor.moveRight() if column < currentLineLength
|
||||
|
||||
class MoveUp extends Motion
|
||||
execute: ->
|
||||
{column, row} = @editor.getPosition()
|
||||
@editor.moveUp() if row > 0
|
||||
|
||||
class MoveDown extends Motion
|
||||
execute: ->
|
||||
{column, row} = @editor.getPosition()
|
||||
@editor.moveDown() if row < (@editor.getAceSession().getLength() - 1)
|
||||
|
||||
class MoveToNextWord extends Motion
|
||||
execute: ->
|
||||
@editor.setPosition(@nextWordPosition())
|
||||
@@ -37,9 +53,17 @@ class MoveToNextWord extends Motion
|
||||
column = nextLineMatch?.index or 0
|
||||
{ row, column }
|
||||
|
||||
class SelectLine extends Motion
|
||||
class SelectLines extends Motion
|
||||
count: null
|
||||
|
||||
constructor: (@editor) ->
|
||||
@count = 1
|
||||
|
||||
setCount: (@count) ->
|
||||
|
||||
select: ->
|
||||
@editor.selectLine()
|
||||
@editor.setPosition(column: 0, row: @editor.getRow())
|
||||
@editor.selectToPosition(column: 0, row: @editor.getRow() + @count)
|
||||
|
||||
module.exports = { MoveLeft, MoveUp, MoveToNextWord, SelectLine }
|
||||
module.exports = { MoveLeft, MoveRight, MoveUp, MoveDown, MoveToNextWord, SelectLines }
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ class NumericPrefix
|
||||
|
||||
compose: (@operatorToRepeat) ->
|
||||
@complete = true
|
||||
if @operatorToRepeat.setCount?
|
||||
@operatorToRepeat.setCount @count
|
||||
@count = 1
|
||||
|
||||
addDigit: (digit) ->
|
||||
@count = @count * 10 + digit
|
||||
|
||||
4638
vendor/coffee-script.js
vendored
4638
vendor/coffee-script.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user