Announce: proton - vim focused / spacemacs inspired way of using atom (help wanted)


#1

Hi!

I want to introduce my WIP package ‘proton’ (name subject to change). Proton tries to bring a pleasent spacemacs + vim experience over to atom while at the same time improving the way you use the editor.

For those unknown to spacemacs style editing, spacemacs is a emacs configuration made for vim users. It has incredible vim support and adds very intiuitive keybindings on top. Here’s how it works;

Keybindings

Each keybinding is assigned to a certain category that is triggered with space. g for example is git. w is window and so on. Executing space g s while in command mode executes, well, __[g]__it __[s]__tatus. Or space w v splits the __[w]__indow __[v]__ertically.

Proton also makes sure that each part of the editor has vim-friendly keybindings out of the box. The overlay, autosuggest, tree-view and file browsers for example have all been re-mapped to allow navigation with ctrl+j / ctrl+k.

Our goal is that you never have to leave the home-row for anything!

Layers

On top of that, each configuration happens in so called layers. A layer is a piece of isolated functionality that can be added to extend the editor further. Layers do the following:

  • Install a handful of packages needed to operate
  • Set keybindings for these packages to integrate with the editor
  • Provide sane defaults for a pleasent experience

Git for example is a layer. It installs the git packages, adds the g category and git keybindings and finally sets up the packages for you with good defaults (that you can override).

Instead of cramming your way through packages over packages to get something you need, just enable the layer for that and rely on community tested packages: Imagine you want to work on python. Instead of trial-and-error installing 5 python packages, just enable the python layer and boom! proton installs all the good bits that you need for a pleasent python experience.

Configuration

proton also replaces your entire configuration system. Instead of maintaining x atom files, you now have 1 central one: ~/.proton. This file could look like this:

What I’m doing here is,

  • I tell proton to install the layers: core, git, clojure and python
  • Next up, I saw I want the package minimap which is not part of a layer, but I want it anyway
  • For configuration, I say “change the font to Hack, hide the tab bar and use relative numbers”
  • Lastly I specify that when I hit “escape” in the tree view, I want to hide it

Upon load, proton will wipe each little bit of configuration that is not managed through your .proton file. 1 version of your proton file will always result in an exact state of the editor configuration.

On top of that, proton will also deinstall each package that is not part of a layer or not specified by the user. Because if it is not needed, why even bother with keeping it?

Very dotfile friendly!

Usage

Proton is still in a very early state and nowhere near as stable as I wish it would be. To install, you currently have to compile it yourself. Check out the instructions here https://github.com/dvcrn/proton#install

If you have a cool layer idea, check out this document in how you can contribute :slight_smile: https://github.com/dvcrn/proton/blob/master/HOW-TO-LAYER.md


Spacemacs like community driven configurations
#2

Sounds interesting. I also wanted to have the spacemacs style SPC-x-y keybindings.

I was a happy spacemacs user for a while, but the churn there keeps breaking my flow, updating almost always guarantees that it will break and its getting more and more esoteric. I update the other day and now even the spacebar no longer does what it used to ! I can’t even tell if its broken or if this is a planned changed.

Some simple key binding handler that allows us to bind 2 letter sequences to atom commands would be lovely.

That’s really it: SPC enters the mode, the next two select.
After a few seconds wait, pop out the sidebar with the key directory. Just as you have it in the screenshot above.
That was the greatest thing about Spacemacs, that it was easily discoverable.

I would suggest that you keep the layers idea completely separate. In fact I am not sure why it is needed in Atom as the package manager already works well for me. But in any case keep it as a separate package from the key binding idea.

The smaller your package is, the more likely it is to become a good fit for lots of us to use.


#3

Thanks for the feedback! You got some good points.

I’m also thinking about chopping proton into separate modules. The dotfile configuration loader is another example that could be very useful for a good amount of people without the rest.

Need to think about how to make things generic enough.


#4

I think instead of showing a panel at the bottom it would be really nice to show an overlay on the right side of the current editor pane. Slightly translucent.

In Spacemacs you see first the root levels, then a long list of possible completions.

This list can be quite long so it wouldn’t fit in the bottom panel.

Also the bottom panel is always a bit distracting when it moves. eg. the Keybinding Resolver is too annoying to keep it activated.

It may just be an issue of styling the panel to be absolute position, no code changes needed.


#5

Although I like Clojure and Clojurescript, I would recommend making the key commands simpler by using .cson files. Most people will not want to make a layer and compile just to change a key command.

If your layers (perhaps as a separate proton layers project) define key commands then it could export all of those to a .cson file at build time, and then the user .cson would customize on top of that.

'g':
  'a': 'git-plus:add'
  'S': 'git-plus:status'
  's': 'git-plus:stage-files'
  'P': 'git-plus:push'
  'c': 'git-plus:commit'

This would be far preferable to the current atom keybinding system which is hard to think through.

Or even better, just use yaml:

g:
  a: git-plus:add
  S: git-plus:status
  s: git-plus:stage-files
  P: git-plus:push
  c: git-plus:commit

The initial key trigger should of course be settable. SPC works for those of us in VIM mode. But § (top left of keyboard) or ESC (top left) might be good for some people. Let them choose.

I wonder if you can parse the standard keybindings and automatically map those to SPC versions.

eg.

'.platform-darwin':
  'alt-cmd-1': 'pane-layout:column-1'

would map to SPC p 1

'body':
  'cmd-k left': 'pane:split-left'

would map to SPC p left (though I would then change that in my user bindings to SPC p j)

'atom-workspace':
  'alt-cmd-g': 'symbol-gen:generate'

would map to SPC s g

sort the keybinding Sources by some priority and assign them on a first come first served basis.


#6

You can use CSON without the quotes around keys if they are valid CoffeeScript identifiers. So while I think you’ll still have to quote the values … you can probably get away with just using CSON (for which there is already a parser in Atom) and get most of the benefit of using YAML for the example here.


#7

I LOVE THIS. Where did this project go? :smiley:


#8

Going strong :slight_smile: https://github.com/dvcrn/proton