Why and How I Switch from Sublime Text to Atom
I have been a huge fan of Sublime Text. It is my second text editor (the first is notepad++). Since a long time ago, I am aware of the existent of Atom text editor but I thought it is almost the same as Sublime Text, hence I am going to stick to Sublime Text since I am more familiar with it and I thought Sublime and Atom are almost the same in terms of code editing experience.
I am fine with Sublime Text for a long period of time as I mainly use Sublime Text to code C++ or Python program and I am having an awesome coding experience in Sublime Text. However, as I am dealing with more variety of stuff recently I started to notice the shortage and limitation of Sublime Text.
Note: From now on, all the features I am discussing are out-of-the-box features. (Seriously, I don’t like to install too many third-party plugins)
The first time I notice the limitation of Sublime Text is when I am dealing with files with Chinese character with GBK encoding. As usual, I used Sublime Text to view and edit the file, but, surprisingly, Sublime Text did not provide support for GBK encoding out-of-the-box. A quick Google shows that there are 2 ways for me to deal with GBK encoding, install GBK plugins on Sublime or use Atom. I chosen the former, tried to install the plugins and realize it is kind of inconvenient to use those plugins (I had forgotten the exact detail but I remember I did not use Sublime Text for GBK, it must involve some tedious setup or poor user experience for me to ditch Sublime Text on GBK). Out of frustration, I installed Atom and yes, Atom does well with the GBK encoding. However, due to my support toward Sublime Text, I still stick to Sublime Text on general text editing and coding.
After that, Sublime Text still serves me quite well in text editing. The breaking point when I finally decided to switch from Sublime to Atom is when I need to do Markdown editing. Same as the case above, a quick google shows that there are 2 ways for me to deal with Markdown, install plugins or use Atom. As usual, I choose the former. Installing the plugins was easy, but the user experience is not good (if compared to Atom, I can safely use the word sucks). You need to manually generate the preview every time you wish to view the preview and it usually takes a few seconds to generate it. Then, you need to switch the window to a browser to view your Markdown and then switch back to Sublime Text to continue you Markdown editing. Then, I tried to use Atom, guess what Atom does? out-of-the-box Markdown preview and syntax highlighting, side-by-side preview and live update.
At this moment, I know that I have to make the switch. The only reason I stay in Sublime was my love toward it but there is a ton of reason to make the switch. I am sorry Sublime, I have to ditch you now .
Here are the reasons that make me make the switch.
- Atom is practically the superset of Sublime Text (I can safely say that 85% of what Sublime Text can do, Atom can do better)
- The GBK encoding support (as described above)
- The Markdown editing user experience (as described above)
- Other cool features that Atom ships
- Project-wide search function
- Git integration
(This is actually super cool, files status on git are color indicated, gitignored files are light gray, staged file are green, unstaged modifies are orange) - Spell checker
- Live, side-by-side HTML/CSS preview
- It is free and open source (I know Sublime Text is free too, but if you need a license, you need to pay right?)
- Atom icon looks nicer than Sublime Text most recent icon (I like the preview Sublime Text icon but not that latest one)
Of course, there are reasons that somewhat make me refuse to the switch too.
- Sublime Text is blazing fast (< 1 sec), Atom is somewhat fast (~ 3 sec) to open a file or directory
- There is no out-of-the-box hex editor on Atom
- There are definitely some features in Sublime Text I gonna miss but currently, I am still not sure, haven’t code too much on Atom yet (more Atom plugins? )
Here, I am only discussing features that I know and might use, certainly there are awesome features in Sublime Text and Atom I had missed and unaware of but currently, I focus on those features I am aware of.
How do I make the switch?
The feels of both editors at first glance are almost same, below are the differences that I am aware of.
- Atom doesn’t have a minimap (I don’t really use the minimap, so I am okay with this)
- This issue. Sadly, as I am aware of, there is still no fix
Next, configure my setting for my text editor
- always reopen previous state after closing the editor
(Preferences -> Core -> Restore Previous Windows On Start) - trim whitespace on save
(Preferences -> Packages -> whitespace -> Ensure Single Trailing New Line, Keep Markdown Line Break, Remove Trailing Whitespace) - scroll past end
(Preferences -> Editor -> Scroll Past End) - shows current file line ending (unix/dos) and encoding
(default is shown on bottom right corner) - replace tab with whitespace. Yes, I hate tab
\t
character in my code, unless I am coding with whitespace language?
(default is good) - tab length = 4
(Preferences -> Editor -> Tab Length -> 4) - show whitespace (line ending, tab, space) on highlight. This is a feature I like and use a lot in Sublime Text
(Preferences -> Editor -> Check Show Invisibles -> Paste the following at stylesheet file,styles.less
)
atom-text-editor {
.leading-whitespace, .invisible-character {
color: #222;
}
}
- key binding
(Paste the following at keymap file,keymap.cson
)
'atom-workspace atom-text-editor:not([mini])':
'cmd-shift-up': 'editor:add-selection-above'
'cmd-shift-down': 'editor:add-selection-below'
'ctrl-shift-up': 'editor:move-line-up'
'ctrl-shift-down': 'editor:move-line-down'
'.platform-darwin atom-text-editor':
'cmd-d': 'find-and-replace:select-all'
-
Ctrl
+Shift
+Up
/Down
— Swap lines up or down -
Cmd
+Shift
+Up
/Down
— Multi-select line above or below -
Cmd
+d
— Select all
As I am still (relatively) new to Atom, I think I will miss out quite a lot of differences, I will edit this post if I found out other stuff that is different in Atom.
Updates: I actually switch back to Sublime Text 3 after trying to do extensive coding (Python, C++ and etc) on Atom. Now, I am using Sublime Text as my main text editing and use Atom for Markdown editing.
A few reasons that make me return to Sublime Text:
- Atom is slow, like super slow (compared to Sublime Text) and this is the main reason I ditch atom for general text editing.
- Atom cache of unsaved files is problematic and might cause data loss. Unlike Notepad++ or Sublime Text, when you have unsaved files, you close the application you will know your data is safe.
- I am more used to the shortcut and environment of Sublime Text, I feel much more comfortable to do coding in Sublime Text compare to Atom.