mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge pull request #1523 from atom/ks-init-dot-coffee
Rename ~/.atom/user.coffee to ~/.atom/init.coffee
This commit is contained in:
@@ -112,14 +112,16 @@ namespaces: `core` and `editor`.
|
||||
|
||||
### Quick Personal Hacks
|
||||
|
||||
### user.coffee
|
||||
### init.coffee
|
||||
|
||||
When Atom finishes loading, it will evaluate _user.coffee_ in your _~/.atom_
|
||||
When Atom finishes loading, it will evaluate _init.coffee_ in your _~/.atom_
|
||||
directory, giving you a chance to run arbitrary personal CoffeeScript code to
|
||||
make customizations. You have full access to Atom's API from code in this file.
|
||||
If customizations become extensive, consider [creating a
|
||||
package][create-a-package].
|
||||
|
||||
This file can also be named _init.js_ and contain JavaScript code.
|
||||
|
||||
### styles.css
|
||||
|
||||
If you want to apply quick-and-dirty personal styling changes without creating
|
||||
|
||||
14
dot-atom/init.coffee
Normal file
14
dot-atom/init.coffee
Normal file
@@ -0,0 +1,14 @@
|
||||
# Your init script
|
||||
#
|
||||
# Atom will evaluate this file each time a new window is opened. It is run
|
||||
# after packages are loaded/activated and after the previous editor state
|
||||
# has been restored.
|
||||
#
|
||||
# An example hack to make opened Markdown files always be soft wrapped:
|
||||
#
|
||||
# path = require 'path'
|
||||
#
|
||||
# atom.workspaceView.eachEditorView (editorView) ->
|
||||
# editor = editorView.getEditor()
|
||||
# if path.extname(editor.getPath()) is '.md'
|
||||
# editor.setSoftWrap(true)
|
||||
@@ -1 +0,0 @@
|
||||
# For more on how to configure atom open `~/github/atom/docs/configuring-and-extending.md`
|
||||
@@ -9,6 +9,7 @@
|
||||
{ type: 'separator' }
|
||||
{ label: 'Preferences...', command: 'application:show-settings' }
|
||||
{ label: 'Open Your Config', command: 'application:open-your-config' }
|
||||
{ label: 'Open Your Init Script', command: 'application:open-your-init-script' }
|
||||
{ label: 'Open Your Keymap', command: 'application:open-your-keymap' }
|
||||
{ label: 'Open Your Snippets', command: 'application:open-your-snippets' }
|
||||
{ label: 'Open Your Stylesheet', command: 'application:open-your-stylesheet' }
|
||||
|
||||
@@ -220,6 +220,8 @@ describe "Config", ->
|
||||
expect(fs.existsSync(path.join(atom.config.configDirPath, 'packages'))).toBeTruthy()
|
||||
expect(fs.isFileSync(path.join(atom.config.configDirPath, 'snippets.cson'))).toBeTruthy()
|
||||
expect(fs.isFileSync(path.join(atom.config.configDirPath, 'config.cson'))).toBeTruthy()
|
||||
expect(fs.isFileSync(path.join(atom.config.configDirPath, 'init.coffee'))).toBeTruthy()
|
||||
expect(fs.isFileSync(path.join(atom.config.configDirPath, 'styles.css'))).toBeTruthy()
|
||||
|
||||
describe ".loadUserConfig()", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -494,8 +494,12 @@ class Atom extends Model
|
||||
shell.beep() if @config.get('core.audioBeep')
|
||||
@workspaceView.trigger 'beep'
|
||||
|
||||
getUserInitScriptPath: ->
|
||||
initScriptPath = fs.resolve(@getConfigDirPath(), 'init', ['js', 'coffee'])
|
||||
initScriptPath ? path.join(@getConfigDirPath(), 'init.coffee')
|
||||
|
||||
requireUserInitScript: ->
|
||||
if userInitScriptPath = fs.resolve(@getConfigDirPath(), 'user', ['js', 'coffee'])
|
||||
if userInitScriptPath = @getUserInitScriptPath()
|
||||
try
|
||||
require userInitScriptPath
|
||||
catch error
|
||||
|
||||
@@ -189,6 +189,7 @@ class AtomApplication
|
||||
|
||||
@openPathOnEvent('application:show-settings', 'atom://config')
|
||||
@openPathOnEvent('application:open-your-config', 'atom://.atom/config')
|
||||
@openPathOnEvent('application:open-your-init-script', 'atom://.atom/init-script')
|
||||
@openPathOnEvent('application:open-your-keymap', 'atom://.atom/keymap')
|
||||
@openPathOnEvent('application:open-your-snippets', 'atom://.atom/snippets')
|
||||
@openPathOnEvent('application:open-your-stylesheet', 'atom://.atom/stylesheet')
|
||||
|
||||
@@ -107,6 +107,7 @@ class WorkspaceView extends View
|
||||
@command 'application:zoom', -> ipc.sendChannel('command', 'application:zoom')
|
||||
@command 'application:bring-all-windows-to-front', -> ipc.sendChannel('command', 'application:bring-all-windows-to-front')
|
||||
@command 'application:open-your-config', -> ipc.sendChannel('command', 'application:open-your-config')
|
||||
@command 'application:open-your-init-script', -> ipc.sendChannel('command', 'application:open-your-init-script')
|
||||
@command 'application:open-your-keymap', -> ipc.sendChannel('command', 'application:open-your-keymap')
|
||||
@command 'application:open-your-snippets', -> ipc.sendChannel('command', 'application:open-your-snippets')
|
||||
@command 'application:open-your-stylesheet', -> ipc.sendChannel('command', 'application:open-your-stylesheet')
|
||||
|
||||
@@ -35,6 +35,8 @@ class Workspace extends Model
|
||||
@open(atom.keymap.getUserKeymapPath())
|
||||
when 'atom://.atom/config'
|
||||
@open(atom.config.getUserConfigPath())
|
||||
when 'atom://.atom/init-script'
|
||||
@open(atom.getUserInitScriptPath())
|
||||
|
||||
# Called by the Serializable mixin during deserialization
|
||||
deserializeParams: (params) ->
|
||||
|
||||
Reference in New Issue
Block a user