Skip to content

Instantly share code, notes, and snippets.

@Epigene
Last active August 23, 2017 09:38
Show Gist options
  • Save Epigene/41206a84821eaf4619a0 to your computer and use it in GitHub Desktop.
Save Epigene/41206a84821eaf4619a0 to your computer and use it in GitHub Desktop.
# 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 log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
atom.commands.add 'atom-text-editor', 'custom:insert-working-file-path', =>
editor = atom.workspace.getActiveTextEditor()
editor.insertText editor.getPath()
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * https://atom.io/docs/latest/using-atom-basic-customization#customizing-key-bindings
# * https://atom.io/docs/latest/behind-atom-keymaps-in-depth
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
'atom-text-editor':
'shift-cmd-e': 'editor:log-cursor-scope'
'shift-ctrl-d': 'editor:duplicate-lines'
'alt-d': 'find-and-replace:select-next'
'alt-v': 'custom:insert-working-file-path'
'cmd-alt-,': 'editor:fold-all'
'cmd-alt-.': 'editor:unfold-all'
'cmd-alt-/': 'editor:unfold-all'
'atom-workspace':
'cmd-l': 'git-projects:toggle'
'cmd-shift-l': 'git-projects:toggle-add'
[
{
"name": "about",
"version": "1.7.6"
},
{
"name": "antigua-dark-syntax",
"version": "1.4.4",
"theme": "syntax"
},
{
"name": "archive-view",
"version": "0.63.2"
},
{
"name": "atom-dark-syntax",
"version": "0.28.0",
"theme": "syntax"
},
{
"name": "atom-dark-ui",
"version": "0.53.0",
"theme": "ui"
},
{
"name": "atom-light-syntax",
"version": "0.29.0",
"theme": "syntax"
},
{
"name": "atom-light-ui",
"version": "0.46.0",
"theme": "ui"
},
{
"name": "autocomplete-atom-api",
"version": "0.10.1"
},
{
"name": "autocomplete-css",
"version": "0.16.2"
},
{
"name": "autocomplete-html",
"version": "0.8.0"
},
{
"name": "autocomplete-plus",
"version": "2.35.4"
},
{
"name": "autocomplete-snippets",
"version": "1.11.0"
},
{
"name": "autoflow",
"version": "0.29.0"
},
{
"name": "autosave",
"version": "0.24.3"
},
{
"name": "background-tips",
"version": "0.26.0"
},
{
"name": "base16-tomorrow-dark-theme",
"version": "1.5.0",
"theme": "syntax"
},
{
"name": "base16-tomorrow-light-theme",
"version": "1.5.0",
"theme": "syntax"
},
{
"name": "bookmarks",
"version": "0.41.0"
},
{
"name": "bracket-matcher",
"version": "0.85.5"
},
{
"name": "color-picker",
"version": "2.2.4"
},
{
"name": "command-palette",
"version": "0.40.4"
},
{
"name": "dalek",
"version": "0.2.1"
},
{
"name": "deprecation-cop",
"version": "0.56.7"
},
{
"name": "dev-live-reload",
"version": "0.47.1"
},
{
"name": "encoding-selector",
"version": "0.23.4"
},
{
"name": "exception-reporting",
"version": "0.41.4"
},
{
"name": "file-types",
"version": "0.5.5"
},
{
"name": "find-and-replace",
"version": "0.208.3"
},
{
"name": "fonts",
"version": "2.0.0"
},
{
"name": "fuzzy-finder",
"version": "1.5.8"
},
{
"name": "git-diff",
"version": "1.3.6"
},
{
"name": "github",
"version": "0.3.3"
},
{
"name": "go-to-line",
"version": "0.32.1"
},
{
"name": "grammar-selector",
"version": "0.49.5"
},
{
"name": "image-view",
"version": "0.61.2"
},
{
"name": "incompatible-packages",
"version": "0.27.3"
},
{
"name": "keybinding-resolver",
"version": "0.38.0"
},
{
"name": "language-c",
"version": "0.52.1"
},
{
"name": "language-clojure",
"version": "0.22.2"
},
{
"name": "language-coffee-script",
"version": "0.48.7"
},
{
"name": "language-csharp",
"version": "0.12.1"
},
{
"name": "language-css",
"version": "0.42.2"
},
{
"name": "language-danger",
"version": "1.2.0"
},
{
"name": "language-gfm",
"version": "0.89.0"
},
{
"name": "language-git",
"version": "0.19.1"
},
{
"name": "language-go",
"version": "0.42.0"
},
{
"name": "language-html",
"version": "0.47.2"
},
{
"name": "language-hyperlink",
"version": "0.16.1"
},
{
"name": "language-java",
"version": "0.22.0"
},
{
"name": "language-javascript",
"version": "0.126.1"
},
{
"name": "language-json",
"version": "0.19.1"
},
{
"name": "language-less",
"version": "0.32.0"
},
{
"name": "language-make",
"version": "0.22.3"
},
{
"name": "language-mustache",
"version": "0.13.0"
},
{
"name": "language-objective-c",
"version": "0.15.1"
},
{
"name": "language-perl",
"version": "0.35.0"
},
{
"name": "language-php",
"version": "0.37.0"
},
{
"name": "language-property-list",
"version": "0.9.1"
},
{
"name": "language-python",
"version": "0.45.0"
},
{
"name": "language-ruby",
"version": "0.71.0"
},
{
"name": "language-ruby-on-rails",
"version": "0.25.2"
},
{
"name": "language-sass",
"version": "0.59.0"
},
{
"name": "language-shellscript",
"version": "0.25.0"
},
{
"name": "language-slim",
"version": "0.5.0"
},
{
"name": "language-source",
"version": "0.9.0"
},
{
"name": "language-sql",
"version": "0.25.5"
},
{
"name": "language-text",
"version": "0.7.2"
},
{
"name": "language-todo",
"version": "0.29.1"
},
{
"name": "language-toml",
"version": "0.18.0"
},
{
"name": "language-xml",
"version": "0.35.0"
},
{
"name": "language-yaml",
"version": "0.29.0"
},
{
"name": "line-ending-selector",
"version": "0.7.1"
},
{
"name": "link",
"version": "0.31.1"
},
{
"name": "markdown-preview",
"version": "0.159.12"
},
{
"name": "metrics",
"version": "1.2.5"
},
{
"name": "notifications",
"version": "0.67.2"
},
{
"name": "one-dark-syntax",
"version": "1.7.1",
"theme": "syntax"
},
{
"name": "one-dark-ui",
"version": "1.10.4",
"theme": "ui"
},
{
"name": "one-light-syntax",
"version": "1.7.1",
"theme": "syntax"
},
{
"name": "one-light-ui",
"version": "1.10.4",
"theme": "ui"
},
{
"name": "open-on-github",
"version": "1.2.1"
},
{
"name": "package-generator",
"version": "1.1.1"
},
{
"name": "settings-view",
"version": "0.249.4"
},
{
"name": "snippets",
"version": "1.1.4"
},
{
"name": "solarized-dark-syntax",
"version": "1.1.2",
"theme": "syntax"
},
{
"name": "solarized-light-syntax",
"version": "1.1.2",
"theme": "syntax"
},
{
"name": "spell-check",
"version": "0.71.4"
},
{
"name": "status-bar",
"version": "1.8.11"
},
{
"name": "styleguide",
"version": "0.49.6"
},
{
"name": "symbols-view",
"version": "0.116.0"
},
{
"name": "sync-settings",
"version": "0.8.1"
},
{
"name": "tabs",
"version": "0.106.2"
},
{
"name": "timecop",
"version": "0.36.0"
},
{
"name": "tree-view",
"version": "0.217.1"
},
{
"name": "update-package-dependencies",
"version": "0.12.0"
},
{
"name": "welcome",
"version": "0.36.4"
},
{
"name": "whitespace",
"version": "0.36.2"
},
{
"name": "wrap-guide",
"version": "0.40.2"
}
]
{
"tree-view": {
"hideVcsIgnoredFiles": false
},
"autocomplete-plus": {
"confirmCompletion": "tab"
},
"core": {
"closeDeletedFileTabs": true,
"disabledPackages": [
"link",
"language-toml",
"language-python",
"language-php",
"language-perl",
"language-objective-c",
"language-mustache",
"language-java",
"language-go",
"language-csharp",
"language-c",
"background-tips",
"bookmarks"
],
"telemetryConsent": "no",
"themes": [
"one-dark-ui",
"antigua-dark-syntax"
]
},
"editor": {
"autoIndentOnPaste": false,
"confirmCheckoutHeadRevision": false,
"fontFamily": "DejaVuSansMono",
"fontSize": 13,
"preferredLineLength": 80,
"showIndentGuide": true,
"softWrap": true,
"zoomFontWhenCtrlScrolling": true
},
"exception-reporting": {
"userId": "8526bc3a-e18d-ac5e-0271-21faf61857a8"
},
"file-types": {
"conf": "source.shell",
"config": "source.shell",
"fish": "source.shell",
"rb": "source.ruby.rails"
},
"fonts": {
"fontFamily": "DejaVu Mono"
},
"git-projects": {
"rootPath": "/Users/augusts/Documents"
},
"linter-ruby": {
"rubyExecutablePath": "/Users/Augusts/.rvm/rubies/ruby-2.0.0-p643/bin/ruby"
},
"one-dark-ui": {
"tabSizing": "Even"
},
"sync-settings": {},
"tabs": {
"usePreviewTabs": true
},
"welcome": {
"showOnStartup": false
},
"whitespace": {
"ignoreWhitespaceOnCurrentLine": false
}
}
'*':
'rb block':
'prefix': 'rb'
'body': """
```rb
$1
```
"""
'.source.ruby':
'DB transaction block':
'prefix': 't_b'
'body': """
ActiveRecord::Base.transaction do
$1
end
"""
'begin-rescue block':
'prefix': 'begin'
'body': """
begin
$1
rescue
end
"""
'after block':
'prefix': 'after'
'body': """
after do
$1
end
"""
'scope definition':
'prefix': 'sco'
'body': """
scope :named, ->(argument) { where(attribute: argument) }
"""
'scope definition2':
'prefix': 'scope'
'body': """
scope :named, ->(argument) { where(attribute: argument) }
"""
'sequence line':
'prefix': 'sequence'
'body': """
sequence(:email, 1) { |n| \"person\#{n}@example.com\" }
"""
'describe block':
'prefix': 'describe'
'body': """
describe "#$1" do
context "when " do
it " " do
expect(0).to eq 1
end
end
context "when " do
it " " do
expect(0).to eq 1
end
end
end
"""
'context block':
'prefix': 'context'
'body': """
context "when $1" do
xit " " do
expect(0).to eq 1
end
end
"""
'it block':
'prefix': 'it'
'body': """
xit "$1" do
expect(0).to eq 1
end
"""
'before block':
'prefix': 'before'
'body': """
before do
$1
end
"""
'around block':
'prefix': 'around'
'body': """
around(:each) do |spec|
run_background_jobs_immediately do
spec.run
end
end
"""
'expect line':
'prefix': 'expect'
'body': """
expect( $1 ).to eq 1
"""
'let line':
'prefix': 'let'
'body': """
let(:$1) { build_stubbed(:) }
"""
'FactoryGirl create':
'prefix': 'Fac'
'body': """
create(:$1)
"""
'FactoryGirl build':
'prefix': 'bld'
'body': """
@ = build(:$1)
"""
'RSpec change block':
'prefix': 'change'
'body': """
change{$1}.from().to()
"""
'RSpec change block, full mode':
'prefix': 'exchange'
'body': """
expect{}.
to change{$1}.from().to()
"""
'gsub':
'prefix': 'gsub'
'body': """
gsub(/$1/, '')
"""
'each':
'prefix': 'each'
'body': """
each do |$1|
# code
end
"""
'delegate':
'prefix': 'delegate'
'body': """
delegate :gifts, to: :friend, allow_nil: true, prefix: false
"""
'trait block':
'prefix': 'trait'
'body': """
trait :$1 do
end
"""
'Timecop line':
'prefix': 'Timecop'
'body': """
Timecop.freeze("2017-01-08 12:00".to_datetime)
"""
'Ext incuded block':
'prefix': 'included'
'body': """
included do
$1
end
"""
'allow block':
'prefix': 'allow'
'body': """
allow($1User).to receive(:query_external_api).and_return(nil)
"""
'allow any block':
'prefix': 'any_in'
'body': """
allow_any_instance_of($1).to receive(:).and_call_original
"""
'no error spec block':
'prefix': 'ner'
'body': """
it "works without errors" do
expect{}.to_not raise_error
end
"""
'error spec block2':
'prefix': 'exerr'
'body': """
expect{}.to raise_error(RuntimeError, /\Amessage/)
"""
'error spec block':
'prefix': 'er'
'body': """
it "raises error" do
expect{}.to raise_error(RuntimeError, "message")
end
"""
'enum block':
'prefix': 'enum'
'body': """
enum some_type: {first: 0, second: 1}
"""
'retryable block':
'prefix': 'retry'
'body': """
var = nil
Retryable.retryable(tries: 3, on: [ArgumentError, TimeoutError]) do
var = Model.where().first_or_create!
end
"""
'method types block':
'prefix': 'method_types'
'body': """
#== Class Getters ==
#== Class Changers ==
#== Instance Getters ==
#== Instance Changers ==
"""
atom-workspace {
// font-family: DejaVuSansMono;
}
.atom-dock-toggle-button-visible
{
display: none;
}
// style the background color of the tree view
.tree-view {
// background-color: whitesmoke;
}
@fnt-size: 12px;
html, body, .tree-view, .tab-bar .tab {
font-size: @fnt-size;
}
// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
}
atom-text-editor .bracket-matcher .region {
}
// To style other content in the text editor's shadow DOM, use the ::shadow expression
atom-text-editor::shadow .cursor {
border-color: #ff003d;
transition: opacity 0.6s;
}
atom-text-editor::shadow .bracket-matcher .region {
color: #ffffff;
border: 1px solid #ffffff;
border-radius: 5px;
position: absolute;
//background: #ffffff;
background: rgba(255, 255, 255, 1);
z-index: 10;
}
atom-text-editor .wrap-guide {
width: 1px;
background-color: white;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment