Skip to content

Instantly share code, notes, and snippets.

@ivomachado
Last active June 13, 2018 15:17
Show Gist options
  • Save ivomachado/65e300c0469c2914447ce15d7eced5b6 to your computer and use it in GitHub Desktop.
Save ivomachado/65e300c0469c2914447ce15d7eced5b6 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[data-grammar~=c]:not(.mini)', 'custom:make-function-pointer', ->
editor = atom.workspace.getActiveTextEditor()
pos = editor.getCursorBufferPosition()
pattern = /(?:static\s*){0,1}((?:\w+\s*\*{0,1}\s*&{0,1}\s*)*(?:\*|\s|&))(\w+)\s*\((.*)\)/g
text = editor.lineTextForBufferRow(pos.row)
result = pattern.exec(text)
if result != null
argsString = result[3];
argsTypes = ''
argsPattern = /((?:\w+\s*\*{0,1}\s*&{0,1}\s*)*(?:\*|\s|&|\())(?:\(\*{0,1}\s*)*(\w+)(?:\s*\)\s*)*((?:\[\d*\])*(?:\(.+\))*)(?=\s*(?:,|$|=))/g
arg = argsPattern.exec argsString
while arg != null
argsTypes += (arg[1].trimRight() + ' ' + arg[3]).trimRight() + ', '
arg = argsPattern.exec argsString
# editor.moveToBeginningOfLine()
# editor.insertNewline()
# editor.moveUp()
function_pointer = 'typedef ' + result[1] + '(*T' + result[2] + ')' + '(' + argsTypes.slice(0,-2) + ');'
# editor.insertText function_pointer
atom.clipboard.write function_pointer
# 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
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on OS X and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * https://atom.io/docs/latest/hacking-atom-debugging#check-the-keybindings
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# https://atom.io/docs/latest/using-atom-basic-customization#cson
'.editor':
'ctrl-left' : 'editor:move-to-previous-subword-boundary'
'ctrl-right' : 'editor:move-to-next-subword-boundary'
'ctrl-shift-left' : 'editor:select-to-previous-subword-boundary'
'ctrl-shift-right' : 'editor:select-to-next-subword-boundary'
'atom-text-editor:not([mini])':
'alt-shift-u' : 'emmet:update-tag'
'alt-shift-r' : 'emmet:remove-tag'
'alt-shift-e' : 'emmet:expand-abbreviation'
'alt-shift-w' : 'emmet:wrap-with-abbreviation'
'alt-left' : 'emmet:decrement-number-by-1'
'alt-right' : 'emmet:increment-number-by-1'
'alt-down' : 'emmet:decrement-number-by-01'
'alt-up' : 'emmet:increment-number-by-01'
'ctrl-shift-down' : 'emmet:decrement-number-by-10'
'ctrl-shift-up' : 'emmet:increment-number-by-10'
'alt-shift-down' : 'multi-cursor:expandDown'
'alt-shift-up' : 'multi-cursor:expandUp'
'ctrl-alt-shift-down' : 'multi-cursor:move-last-cursor-down'
'ctrl-alt-shift-up' : 'multi-cursor:move-last-cursor-up'
'ctrl-alt-shift-right' : 'multi-cursor:move-last-cursor-right'
'ctrl-alt-shift-left' : 'multi-cursor:move-last-cursor-left'
'alt-/' : 'trailing-semicolon:semicolon'
'alt-,' : 'trailing-semicolon:comma'
'alt-shift-left' : 'editor:move-selection-left'
'alt-shift-right' : 'editor:move-selection-right'
'atom-text-editor[data-grammar~=python]:not(.mini)':
'shift-f6' : 'autocomplete-python:rename'
'.platform-win32 .find-and-replace, .platform-linux .find-and-replace':
'ctrl-alt-e' : 'find-and-replace:toggle-regex-option'
'.platform-win32 .project-find, .platform-linux .project-find':
'ctrl-alt-e' : 'project-find:toggle-regex-option'
'body':
'ctrl-tab ^ctrl' : 'unset!'
'ctrl-tab' : 'pane:show-next-item'
'ctrl-shift-tab ^ctrl' : 'unset!'
'ctrl-shift-tab' : 'pane:show-previous-item'
packages: [
"aligner"
"atom-beautify"
"atom-live-server"
"atom-material-syntax-dark"
"atom-material-syntax-light"
"atom-material-ui"
"atom-move-line"
"atom-touch-events"
"atom-typescript"
"auto-detect-indentation"
"auto-replace-in-selection"
"autocomplete-angular-material"
"autocomplete-clang"
"autocomplete-ionic-framework"
"autocomplete-paths"
"autocomplete-python"
"autoupdate-packages"
"browser-plus"
"emmet"
"file-icons"
"flex-tool-bar"
"git-control"
"git-time-machine"
"gruvbox-plus-syntax"
"highlight-line"
"html-entities"
"hyperclick"
"hyperlink-hyperclick"
"ionic-preview"
"language-nginx"
"less-than-slash"
"linter"
"linter-clang"
"linter-coffeescript"
"linter-less"
"markdown-pdf"
"merge-conflicts"
"minimap"
"minimap-hide"
"minimap-selection"
"multi-cursor"
"open-recent"
"open-terminal-here"
"outline-selection"
"package-sync"
"pigments"
"pinned-tabs"
"platformio-ide-terminal"
"resize-indent"
"smart-tags"
"sort-lines"
"sync-settings"
"text-manipulation"
"tool-bar"
"trailing-semicolon"
]
{
"activate-power-mode": {
"particles": {
"spawnCount": {
"max": 20,
"min": 10
},
"totalCount": {
"max": 1000
}
},
"screenShake": {
"maxIntensity": 10,
"minIntensity": 5
}
},
"advanced-open-file": {
"createDirectories": true,
"createFileInstantly": true
},
"aligner": {
",-leftSpace": true,
":-alignment": "left",
":-leftSpace": true
},
"atom-beautify": {
"c": {
"default_beautifier": "clang-format"
},
"general": {
"_analyticsUserId": "e1412cf3-c75b-4042-8a7a-71829248321d",
"beautifyEntireFileOnSave": false
},
"html": {
"brace_style": "expand",
"indent_size": 2,
"wrap_attributes": "force",
"wrap_attributes_indent_size": 2
},
"js": {
"indent_size": 2
},
"python": {
"default_beautifier": "yapf"
}
},
"atom-minify": {
"cssMinifier": "CSSO",
"jsMinifier": "UglifyJS2"
},
"autocomplete-python": {
"outputProviderErrors": true,
"pythonPaths": "$PROJECT/venv/Scripts/python.exe;$PROJECT/venv/bin/python;python;",
"useSnippets": "required"
},
"autohide-tree-view": {
"showOn": "hover + click + touch",
"showPinButton": false
},
"autoupdate-packages": {
"frequency": 1,
"lastUpdateTimestamp": 1467288691580
},
"core": {
"closeEmptyWindows": false,
"disabledPackages": [
"language-mustache",
"language-perl",
"language-ruby",
"language-ruby-on-rails",
"language-toml",
"language-yaml",
"language-go",
"language-clojure",
"language-make",
"language-objective-c",
"update-package-dependencies",
"dev-live-reload",
"spell-check",
"welcome",
"package-generator",
"open-on-github",
"language-source",
"deprecation-cop",
"language-property-list",
"linter-pylint",
"auto-replace-in-selection",
"Sublime-Style-Column-Selection"
],
"ignoredNames": [
"*.pyc",
"bower_components",
".vs",
"node_modules",
".live-archive",
".idea",
"venv*",
"*.exe"
],
"packagesWithKeymapsDisabled": [
"multi-cursor",
"trailing-semicolon",
"sort-lines"
],
"projectHome": "C:\\Users\\ivoma\\Worskpace",
"restorePreviousWindowsOnStart": false,
"themes": [
"one-dark-ui",
"atom-material-syntax-dark"
]
},
"editor": {
"scrollPastEnd": true,
"scrollSensitivity": 90,
"showIndentGuide": true,
"showInvisibles": true,
"softWrapHangingIndent": 80,
"tabLength": 4
},
"exception-reporting": {
"userId": "117dceae-6793-ec06-2b12-aeabdb531fb7"
},
"file-icons": {
"coloured": false
},
"gpp-compiler": {
"addCompilingErr": false
},
"gruvbox-plus-syntax": {
"contrast": "Hard",
"variant": "No Dimmed Colors"
},
"jsformat": {
"format_on_save": false
},
"keyboard-localization": {
"useKeyboardLayout": "pt_BR"
},
"linter": {
"errorPanelHeight": 200,
"showProviderName": false,
"statusIconScope": "File"
},
"linter-gcc": {
"execPath": "g++"
},
"linter-js-standard": {
"lintMarkdownFiles": true,
"style": "happiness"
},
"linter-pylint": {
"pythonPath": "%p/venv/Scripts/python.exe"
},
"linter-python": {
"lintTrigger": "Lint only after change",
"underlineType": "Only place with error"
},
"markdown-preview": {
"useGitHubStyle": true
},
"minimap": {
"absoluteMode": true,
"plugins": {
"git-diff": true,
"git-diffDecorationsZIndex": 0,
"minimap-hide": true,
"minimap-hideDecorationsZIndex": 0,
"selection": true,
"selectionDecorationsZIndex": 0
}
},
"omnisharp-atom": {
"autoAdjustTreeView": true,
"codeLens": false,
"enhancedHighlighting": true,
"enhancedHighlighting19": true,
"featureEditorButtons": false
},
"one-dark-ui": {
"fontSize": 14,
"layoutMode": "Compact"
},
"one-light-ui": {
"layoutMode": "Compact"
},
"open-terminal-here": {
"command": "start /D \"%cd%\" conemu64"
},
"package-sync": {
"createOnChange": true,
"forceOverwrite": true
},
"pigments": {
"markerType": "dot"
},
"pinned-tabs": {
"closeUnpinned": false
},
"platformio-ide-terminal": {
"core": {
"shell": "C:\\WINDOWS\\System32\\cmd.exe"
},
"style": {
"theme": "pro"
},
"toggles": {
"autoClose": true
}
},
"split-diff": {
"diffWords": true,
"ignoreWhitespace": true,
"leftEditorColor": "red",
"rightEditorColor": "green",
"syncHorizontalScroll": true
},
"sync-settings": {
"extraFiles": [
"toolbar.cson",
"packages.cson"
],
"syncPackages": false
},
"tabs": {
"addNewTabsAtEnd": true,
"enableVcsColoring": true
},
"terminal-panel": {
"shell": "powershell.exe"
},
"terminal-plus": {
"core": {
"shell": "C:\\WINDOWS\\System32\\cmd.exe"
}
},
"tool-bar": {
"position": "Right"
},
"tree-view": {
"hideIgnoredNames": true,
"hideVcsIgnoredFiles": true,
"showOnRightSide": true
},
"webbox-color": {
"fillColorAsBackground": false
},
"welcome": {
"showOnStartup": false
}
}
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# https://atom.io/docs/latest/using-atom-basic-customization#cson
'.source.js':
'Class Attribute':
'prefix': 'clsattr'
'body': 'this.${1:attribute} = ${1:attribute} || $2;'
'.source.c':
'Typedef Function pointer':
'prefix': 'tdfun'
'body': 'typedef ${1:TypeOfReturn} (*${2:TypeName})(${3:TypeOfArg});'
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
/*
* Examples
* (To see them, uncomment and save)
*/
// style the background color of the tree view
.tree-view {
// background-color: #121212;
}
// @background-color: #1e1e1e;
// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
// color: white;
// background-color: @background-color;
}
// To style other content in the text editor's shadow DOM, use the ::shadow expression
atom-text-editor::shadow .cursor {
// border-color: red;
}
atom-text-editor::shadow .highlight.find-result .region {
}
// .status-bar {
// background-color: #0e639c;
// a {
// color: white;
// }
//
// .cursor-position .inline-block {
// color: white;
// }
// }
.tool-bar {
// @color: #1e1e1e;
// background-color: @color;
.btn {
// background-color: @color !important;
// border: 0;
// color: white;
}
}
atom-text-editor::shadow {
.selection .region {
// background-color: #362f88;
// border-radius: 3px;
}
.line-number {
color: #aaa;
}
}
# This file is used by Flex Tool Bar to create buttons on your Tool Bar.
# For more information how to use this package and create your own buttons,
# read the documentation on https://atom.io/packages/flex-tool-bar
[
{
type : "button"
icon : "file"
callback : "application:new-file"
tooltip : "New File"
iconset : "fa"
}
{
type : "button"
icon : "floppy-o"
callback : "core:save"
tooltip : "Save"
iconset : "fa"
}
{
type : "button"
icon : "file-archive-o"
callback : "application:open-file"
tooltip : "Open File"
iconset : "fa"
}
{
type : "button"
icon : "terminal"
callback : "open-terminal-here:open-root"
tooltip : "Open terminal in project root"
iconset : "fa"
}
{
type : "button"
icon : "folder-open-o"
callback : "application:open-folder"
tooltip : "Open Folder"
iconset : "fa"
}
{
type : "button"
icon : "archive"
callback : "application:add-project-folder"
tooltip : "Add Project Folder"
iconset : "fa"
}
{
type : "spacer"
}
{
type : "button"
iconset : "fa"
icon : "list-ul"
callback : "tree-view:toggle"
tooltip : "Toggle Project Tree"
}
{
type : "button"
iconset : "fa"
icon : "columns"
tooltip : "Split Screen"
callback : ["pane:split-right-and-copy-active-item"]
}
{
type : 'spacer'
}
{
type : "button"
iconset : "devicon"
icon : "git-plain"
callback : "git-control:toggle"
tooltip : "Git"
}
{
type : 'spacer'
}
{
type : 'button'
tooltip : 'Open Settings View'
callback : 'settings-view:open'
icon : 'gear'
iconset : 'fa'
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment