Top 3-ish Tips for Newbs in Atom

For me, while typing in Word or even Excel, the Enter key means “next line please”.

However, by default, Atom’s autocomplete-plus package occasionally takes it to mean “please insert a comically random word”.

Of course, a lot of the time it’s useful, the package does scan your working folder for previously defined variable names, and when those are suggested hitting Enter is a time saving joy.

But I just couldn’t get rid of my reflex to hit Enter at the end of line -particularly when typing “end”:I found this a little frustrating at times!But I’ve found that the great, if somewhat terrifying, thing about Atom is that it’s very customisable.

In Atom, head to the menu-bar, go to Atom then Preferences, a new Atom Settings tab will open, then select Packages and search for “autocomplete-plus”.

If you have this package installed, you should see its panel: click the Settings button; otherwise install it here.

You’ll see that a wide selection of customisation is possible, from setting a minimum number of letters for the recommended words, to stipulating file extensions that will cause said files in your repository to be ignored by the Package as it scans for autocomplete suggestions.

But, fellow efficiency seekers, my little “reflex issue” was solved by customizing the “Keymap for Confirming a Suggestion”.

There are five options to choose from, but I went with: always using Tab to confirm a suggestion, and only using Enter if I have explicitly scrolled through the suggestions to pick one.

This option fits my muscle memory, perhaps you’ll be different.

But isn’t it great that we have the choice?2.

Colour Coding your BracketsA friend of mine (a recent coding bootcamp graduate) was waxing lyrical about an alternative text editor to Atom, Visual Studio Code, and one of the (alleged) advantages she cited was a package that colour codes your brackets.

This allows you to see each bracket’s life partner at a glance (despite any sloppy indentation).

But, changing to yet another piece of software while still being so new at this coding game, didn’t appeal to me much*.

So, I thought, there had be an Atom Package for this!.And (praise be) there is:The bracket-colorizer package: Oooh…pretty“Orange and yellow, GROSS!” you might cry.

Fear not, colours are also customizable, although a little less straightforwardly.

The install process has you paste some code into Atom’s global style sheet (full instructions here): this code sets a colour for every pair of brackets depending on how nested they are (i.

e.

brackets inside brackets inside brackets etc).

You can simply cut and paste the included colour names into the nest level you desire.

Enjoy!3.

Hotkeys are Fun!.(and Fast)Now I knew this would be the case from the get-go: but knowing hotkeys for the software you use as a coder is invaluable.

I’ve heard many seasoned coders claim that they almost never use the mouse.

I’m definitely not there yet, but here’s a few of my favourites:a.

Save All: alt + cmd(⌘) + SWhen working on several files at once, I’ve found myself (and seen others, yes you) manually clicking on each Atom tab and hitting command+S before, finally, running the code.

This is the remedy.

b.

Jump between the two brackets in a pair : Ctrl + MThis one complements the colour coded brackets above nicely.

If you select a bracket and press Ctrl+M you’ll quickly skip between a bracket and its partner, making the connection super clear.

c.

And all the rest (Atom’s key-bindings list)If you dare venture into Atom’s “Key-bindings” list (under Preferences again) you’ll see a lot of these hotkeys (aka Key-bindings).

But don’t fret: they are searchable!.My current plan is that every time I find myself doing a repetitive or inefficient process in Atom, I’m going to search this list first.

I’ll gradually compile my favourite key-bindings onto a cheat-sheet that I’ll keep on my desk until they’re memorised.

Here’s what I’ve got so far:“Fold”/ “Unfold” all your code: alt+cmd+shift+{ or }: Ok so with four keys to press at once this one is a bit of a finger twister!.But it’s worth it.

All of your methods, classes etc will “fold” into a compressed form at once: showing only their first and last lines.

This allows you see the bigger picture of even quite large files (180+ lines) on one screen.

You can then manually open the “folds” with alt+cmd+{ or } while your cursor is on the defining (first) line of the method (or class etc).

Jump to the page’s top or bottom: cmd key (⌘) + ↑ or ↓: This one actually works in almost every piece of software (on Mac).

And is super useful to avoid the inevitable scrolling cramp that will come from swiping several times to get back to the top of a large file.

Find & change multiple Keywords/names/whatever all at once: cmd+D: It would be a crime not to include this last one, and I must credit my teacher Nico for showing it to us.

Please, if nothing else, use this one.

Have you ever written lots of code just to realise that you’ve given something a stupid name?.Or worse, given two objects the same (non-local) name in two places!.Gasp.

Yes, the “find and replace” function that Atom has is common with your average word processor is an ok solution here, but it has several steps and can often be overkill.

Trust me, instead, simply highlight the first instance of your unwanted word, then each subsequent press of cmd+D will select its next instance.

Once you’ve got the offending ones highlighted, simply type the re-thought name, and viola, as if helped by a hundred ghostly fingers they all type out at once before your eyes.

Magic!:Oh, how cool you’ll look in front of your friends.

*It’s my intention to gradually dip into Visual Studio over the next 14 weeks and write a comparison at the end.

.

. More details

Leave a Reply