Skip to content

Instantly share code, notes, and snippets.

@ctkjose
Last active April 19, 2022 16:08
Show Gist options
  • Save ctkjose/a8f12f08f6b08eb2269cfbfffe5b5950 to your computer and use it in GitHub Desktop.
Save ctkjose/a8f12f08f6b08eb2269cfbfffe5b5950 to your computer and use it in GitHub Desktop.
My ATOM for PHP development

Atom Editor Setup

This is my atom (Version 1.48) setup for PHP develpment in a mac (updated for BigSur).

config.cson

 "default-language":
    defaultLanguage: "php"
 editor:
    fontFamily: "JetBrains Mono, Menlo, Consolas, DejaVu Sans Mono, monospace"
    maxScreenLineLength: 999
    nonWordCharacters: "/\\()\"':,.;<>~!@#%^&*|+=[]{}`?-…"
    softTabs: false
    tabLength: 4
    tabType: "hard"

I like JetBrain's Mono as my editor font.

Packages

atom-ide-ui Required for ide-php.

linter-js-standard

atom-nst My very own package that creates a pane to browse code symbols.

multi-cursor Move cursos to a new location and press alt-up to add cursor and alt-down to remove it.

atom-tag-wrapper Select some text, press alt-shift-w to start creating a tag.

ide-php Adds PHP syntax check for atom.

advanced-open-file Provides an easier approach to open files using a combination of paths and browsing.

project-manager Provides the means to save and reopen projects.

open-files Displays open files above the tree view.

busy-signal

Install a package manually

You need nodejs installed. You can install it using Homebrew brew install nodejs.

Download the package to your ~/.atom folder.

cd ~/.atom/packages

git clone https://github.com/package-name your_package
cd your_package
npm install

Useful Key Shortcuts

Use cmd-R to jump to a symbol (function, class, etc).

Use ctrl-m to jump to the bracket matching the one adjacent to the cursor. It jumps to the nearest enclosing bracket when there's no adjacent bracket.

Use ctrl-cmd-m to select all the text inside the current brackets.

Use alt-up to a a second cursor above and alt-down to create it under.

Use cmd-shift-L to create a multi cursos for the entire selection.

My Configuration

Using actual tabs. In Editor I set "Tab Type" to hard and "Tab Length" to 4.

Single/Double Click behaviour in Tree-View

By default Atoms enables the "Pending Pane Items" which allow to preview files instead of going directly into editing. This means that clicking an item in the tree-view will open in a preview pane instead of just selecting it, like most editors do. It is also annoying that it reuses the same pane.

I disable this setting in the "Core Settings" by unchecking the "Allow Pending Pane Items".

Disable autocomplete on 'ENTER' key.

Whenever something you type matches a suggestion and the autocomplete is shown if you press "Enter or Tab" the first suggestion is used.

For me this is super annoying. You can change the key binding in your settings, for me I disable the keymap. You will find this setting in Settings/Packages look for "Autocomplete Plus" then go to "Keymap For Confirming a Suggestion".

My keybindings in keymap.cson

'body':
	'ctrl-alt-up': 'command-palette:toggle'
	'ctrl-alt-down': 'command-palette:toggle'
#	'shift-cmd-O': 'application:add-project-folder'
	'shift-cmd-O': 'advanced-open-file:toggle'

'.editor':
	'ctrl-alt-left': 'editor:move-to-beginning-of-next-paragraph'
	'ctrl-alt-right': 'editor:move-to-beginning-of-previous-paragraph'
	'ctrl-alt-shift-left': 'editor:select-to-beginning-of-next-paragraph'
	'ctrl-alt-shift-right': 'editor:select-to-beginning-of-previous-paragraph'

'.platform-darwin atom-text-editor':
	'cmd-9': 'bookmarks:toggle-bookmark'
	'ctrl-9': 'bookmarks:jump-to-next-bookmark'

'.platform-darwin body':
	'shift-cmd-O': 'advanced-open-file:toggle'

'.platform-darwin atom-workspace':
 	'shift-cmd-O': 'advanced-open-file:toggle'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment