Awesome shit.

This commit is contained in:
Corey Johnson 2011-11-10 16:31:53 -08:00
parent c47de309e3
commit fff3e19a50
7 changed files with 8 additions and 52 deletions

View File

@ -21,8 +21,6 @@
}
- (id)initWithPath:(NSString *)_path {
if (!_path) _path = @"/tmp"; // I hate this
self = [super initWithWindowNibName:@"AtomWindow"];
path = [[_path stringByStandardizingPath] retain];

View File

@ -1,36 +0,0 @@
# Keybinding ideas
# ----------------
# Are ctrl-v and ctrl-V different?
# Nested commands? Use timeout?
# Optional Regex, is that fucking crazy?
# Command/Control/Option or cmd/ctrl/alt
# How should we deal with scope?
keymap:
# Take some method found in the keymap scope?
'cmd-c': 'copyText'
# Take a block
'cmd-v': -> paste.someText()
# Can take a regex
# * how would this work with timeouts
# * how can this not look so hackish
# * do we even need this?
'cmd-/(\d+)/': (number) ->
window.switchTo(parseInt(number))
# Nested commands
'cmd-ctrl-r':
'r': -> run.something()
't': -> test.something()
# Switch modes? I don't like this syntax
'mode(normal):esc':
'j': 'moveDown'
'k': 'moveUp'
'a': ->
goto.endOfLine()
keybindingMode('normal')
'mode(insert):i':
'delete': 'delete'

View File

@ -9,7 +9,8 @@ ace = require 'ace/ace'
module.exports =
class Editor extends Document
@register (path) -> fs.isFile path
@register (path) ->
not path or fs.isFile path
dirty: false
path: null

View File

@ -1,10 +1,10 @@
app:
'cmd-q': (app) -> app.quit()
'cmd-o': (app) -> app.open()
window:
'cmd-shift-I': (window) -> window.showConsole()
'cmd-r': (window) -> window.reload()
'cmd-o': (window) -> window.open()
document:
'cmd-shift-d': -> console.log 'derp'

View File

@ -10,7 +10,6 @@ windowAdditions =
startup: ->
@path = atom.path
@setTitle (_.last @path.split '/') or 'Untitled Document'
$atomController.window.makeKeyWindow
@ -27,8 +26,8 @@ windowAdditions =
OSX.NSApp.createController @path
open: (path) ->
path = atom.native.openPanel() unless path
if atom.document.open path
$atomController.window.makeKeyAndOrderFront $atomController
atom.trigger 'window:open', path
else
atom.app.open path

View File

@ -36,7 +36,7 @@ atom.path = $atomController.path?.valueOf()
if handler = Document.handler atom.path
atom.document = new handler atom.path
else
atom.document = new Editor
throw "I DON'T KNOW ABOUT #{atom.path}"
require 'window'
window.startup()

View File

@ -9,21 +9,15 @@ class KeyBinder
keymaps: {}
constructor: ->
atom.on 'window:load', ->
atom.keybinder.load require.resolve "key-bindings.coffee"
if fs.isFile "~/.atomicity/key-bindings.coffee"
atom.keybinder.load "~/.atomicity/key-bindings.coffee"
@load require.resolve "key-bindings.coffee"
if fs.isFile "~/.atomicity/key-bindings.coffee"
@load "~/.atomicity/key-bindings.coffee"
register: (name, scope) ->
load: (path) ->
try
# Watcher.watch path, =>
# # Should we keep track of which file bindings are associated with?
# # That way we could clear bindings when the file is changed
# # or deleted. I think the answer is yes, but I don't want to
# # do this right now.
# console.log "#{@name}: Reloading #{path}"
# @load path
json = CoffeeScript.eval "return " + (fs.read path)