The text editor is a core tool for writing software. I've always used Atom. Lately, I've noticed my Atom text editor was bogging down on my Chromebook running Ubuntu 16.04. Keystrokes and mouse movements were lagging and slowing my coding down. I'm also getting low on disk space, which may be a related issue.
You'll want to choose a text editor based on how it suits your own needs. In this case, I want a light-weight, responsive editor with no lag. Bells and whistles are less important. I'm also looking to minimize disk space required.
I decided to compare the apt installed package size of some popular editors. First, I installed Atom, Emacs, Sublime, VS Code and Vim using the Ubuntu 16.04 terminal. You could also consider using IDLE, python's built-in text editor as an alternative that requires no additional software.
Then I found the below command to list all installed apt packages by package size on Ubuntu:
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
Here's the terminal output with relevant packages in Megabytes (including Firefox for comparative size):
136 emacsen-common
366 vim-common
1071 vim-tiny
2400 vim
21648 emacs26
26870 vim-runtime
34033 sublime-text
70307 emacs26-common
193694 firefox
236965 code
607932 atom
Atom is by far the largest package I downloaded. It is nearly three times the size of VS Code, my second largest package. The next largest was my web browser, Firefox. Most of the other packages I downloaded were considerably smaller.
Side note: I also found out Ubuntu 16.04 ships with a stripped down version of Vim called vim-tiny.
Total Installed Package Sizes in Megabytes (Smallest to Largest)
Some of these editors have multiple packages they are dependent on.
Text Editor |
Total Installed Packages Size |
Packages Installed |
Vim |
29,636 MB |
vim, vim-common, vim-runtime |
Sublime |
34,033 MB |
sublime-text |
Emacs |
91,955 MB |
emacs26-common, emacs26, emacsen-common |
VS Code |
236,965 MB |
code |
Atom |
607,932 MB |
atom |
Results: Vim and Sublime win for smallest installed package size.
- Vim is the lightest-weight package of these 5 popular text editors, with Sublime not far behind. Emacs is comparable to them for usability and relatively small.
- Atom is nearly 3x the size of VS Code and 20x the size of Vim. Atom and VS Code are larger than the Firefox browser package, the third largest of any downloaded package on my system.
- I tested out all of the editors by opening the same Python file and making some edits. I found Vim, Emacs and Sublime were much more responsive than Atom and VS Code.
Conclusion: All Editors Are Not Created Equal
These are fine editors when paired with the right machine and developer needs. In my case, a Chromebook running Linux installed with Crouton, a few editors are performing faster and taking up less space. I've chosen Sublime or Emacs as my editor for this computer. One slightly annoying feature of Sublime is being prompted to buy the paid version from the trial version. Atom, Emacs, Vim and VS Code are free. Vim might be a good option if I ever decide to conquer its notoriously high learning curve.
[Bonus] Find the size of all packages matching with "vim" in their name:
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | grep vim
Terminal output from above command:
366 vim-common
1071 vim-tiny
2400 vim
26870 vim-runtime
Additional Reading
What is the best lightweight text editor?
Atom as an Editor is Too Big
Goal: recreate my resume in the dark Atom text editor theme
(background and fonts). Sub-goal: find a color eyedropper to grab
the actual color values of the Atom layout.
Approach #1: find an Atom eyedropper package to grab the colors. My
first thought was to find the easiest solution, within the packages of
my Atom text editor. After searching Atom's packages, the two best
potential solutions were "an-color-eyedropper" and "color picker" . The an-color-eyedropper
description sounds perfect: "A simple "real" color picker. By "real" I
mean it's able to pick colors anywhere on any screen."
Color picker
an color eyedropper
Unfortunately it failed to install and displayed the error, "Unable to
download 400 Bad Request Repository inaccessible". It seems to rely on
the "python" Atom package which is now deprecated. I was unable to find
a repo anywhere by googling.
Color picker has
easy-to-follow instructions and installed with no problem. It allows you
to quickly select any color visually with sliders. Then the RGB or
Hexadecimal values of your color are added as text in the editor in
proper format. However, we are looking for a color grabber to pull
colors from a screen object. This is more of a productivity enhancing
and color exploration tool for programmers. On to Python options.
Approach #2: Use the python tkcolorpicker package to grab the colors.
The first thing I found on Google was tkcolorpicker,
a package that uses the tkinter
library. I couldn't tell exactly what it was, so let's find out. First,
install via pip install:
python -m pip install tkcolorpicker
Then run the below script. Cool gadget for sure, but also not quite
what I was looking to use. It allows selection of a color with
sliders or input values, similar to Atom's color picker, but for user
input rather than color picking. Nice little tool. :D
| import tkinter as tk
import tkinter.ttk as ttk
from tkcolorpicker import askcolor
root = tk.Tk()
style = ttk.Style(root)
style.theme_use("clam")
hex_code, RGB_code = askcolor((255, 255, 0), root)
print(hex_code, RGB_code)
root.mainloop()
|
askcolor() returns a tuple with both the RGB and hex codes selected by
the user. Above, we are unpacking that tuple into the hex_code and
RGB_code variables.
Approach #3: Use the Python eyedropper package to grab the colors.
I then found eyedropper
for Windows, which has a minimalist repository and offers a simple
approach to desktop eyedropper functionality. Install eyedropper via
pip:
python -m pip install eyedropper
Hover your mouse over the object you want to grab the color from (in my
case, the Atom text editor background). Alternatively, I was able to run
eyedropper from the command line by entering:
py -m eyedropper
Mission possible. Then I hit ctrl+v in a text file and there was the
hex code for my Atom background. Some of the colors that eyedropper
grabbed were nearly identical to those in the Atom text editor dark
theme. Others were not quite the same. I made slight eyeball adjustments
to the colors for some of the fonts.
Microsoft Word uses RGB codes but eyedropper gave us hex. To convert, I
found this website practical and
quick. Alternatively, you could convert a hex code to RGB with python:
| hex_code = input("Enter hex: ").lstrip("#")
RGB_code = tuple(int(hex_code[i : i + 2], 16) for i in (0, 2, 4))
print("RGB =", RGB_code)
|
Bonus: use pd.read_clipboard()
docs
to get the hex codes.
Once eyedropper sends the color values to your system's clipboard, there
are multiple ways to access them. This alternative uses pandas.
Installing pandas and pyperclip with pip:
| python -m pip install pandas
python -m pip install pyperclip
|
On Linux, install xclip or xsel
sudo apt-get install xclip
To get the clipboard contents with pandas:
| import pandas as pd
hex_code_df = pd.read_clipboard()
print(hex_code_df.head())
|
Supplementary Notes and Links