- Richard Feynman -
An editor, or "text editor", is a program you use when you want to edit plain text files. There are a huge number of editors available, and you should chose (and learn) one that you find convenient. Some of the more capable editors include Emacs and Vi, but those have a rather steep learning curve. For programming, you can use any editor, but we strongly discourage you to use Microsoft Notepad (partly because how it is incapable of handling line-endings). You can read about editors on Wikipedia, before continuing reading on this page. Here's the link on Wikipedia: Read more on text editors (on Wikipedia) .
- 1 Recommended editors
- 2 Atom editor
- 3 Verify your installation
- 4 Getting started with the Atom editor
- 5 Emacs
- 6 Other editors
- 7 Links
In this material we mainly use the Atom editor and we therefor recommend you using that. In some of our videos we use Emacs, which is the authors' choice of editor. However we do not recommend starting with Emacs. Emacs itself is worthy of a course and nothing we have time to do right here and now.
We have chosen Atom (and Emacs) for the following reasons. They are:
- licensed as Free and Open Source software
- available for most platforms (GNU/Linux, MacOS, Windows, *BSD)
- easy to learn how to use
Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file. - Home page for Atom
Installing and setting up Atom
Go to the Atom homepage and follow the installation instructions there.
For Windows users we have a video helping you to install Atom:
- Installing Atom (on Windows 10) (eng)
Making things smoother on Windows
We need to add the path to Atom to the PATH environment variable in Windows. Assuming:
- Atom is installed
- You user name has no space in it
we provide a short guide on how to fix that:
- right-click on the Atom shortcut on your Desktop.
- choose "Properties"
- In "Target" field you can see the place where atom is installed. Typically something like
- Close the Properties window.
- Open the file explorer and
- click your way to the place where Atom is installed.
- Enter the "bin" folder.
- Mark the path (typically
C:\Users\username\AppData\Local\atom\bin) by clicking the fieldjust beneath the menubar.
- Copy the path (press ctrl-c)
- Press the window "button" at the left lower corner on your Desktop
- Enter "environment" (or "miljö" if Swedish) and choose "Edit the system environment variables"
- Click "Environment variables"
- Among the "System variables" you'll find PATH (or path or Path)
- mark this
- press "Edit"
- click "New"
- Paste the copied text (
C:\Users\username\AppData\Local\atom\bin), by clicking Ctrl-v
- Press "Ok"
- Press "Ok"
- Close and restart cygwin
... and it should work.
Making things smoother on MacOs
If you want to (who doesn't?) launch Atom in an easy way on MacOS do the following (assuming Atom was downloaded to the
Downloads folder. Make sure you're located in your home folder, typically by simply typing
cd followed by enter):
cd sudo mkdir /usr/local/bin sudo cp -r Downloads/Atom.app /Applications/ sudo ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom
Note:If the second command
sudo cp -r Downloads/Atom.app /Applications/ fails and the third succeeds you can discard the failure of the second command.
After this you should be able to launch atom like this:
and if you want to launch atom and open a file (
hi-there.txt) at the same time:
If Atom doesn't work for you, you should consider a different editor for your Mac, such as TextWrangler. Refer to TextWrangler's installation instructions if you have problems installing it. We don't care what editor you run in the end, our goal is for you to have an editor and not a full-blown IDE.
Fixing Atom so that you can type backslash "\" (Windows only)
When using Atom on Windows you can't write backslah "\". On other OS:es it seems to work fine - so if your using GNU/Linux, MacOS or any of the BSD variants out there: discard this section.
You need to install an extension in Atom in order for backslash to work on a Swedish keyboard (for some stupid reason).
Open Atom and choose "Settings" under the File menu. Then click on "Install" in the settings window. Search for the "Package" called "keyboard-localization" and click "install". When it is installed, click on "Settings" next to the package. Scroll down and choose the keyboard layout called "sv_SE" from the drop-down list.
Now, you can confirm that you can type backslash. If you still can't do it, contact a supervisor or teacher (and write an angry email to Atom developers).
We recommend starting Atom from the shell the following way:
- go to the directory where the files you want to work with are stored
- And do any of the following:
- Start Atom and don't load any files.
- Start Atom and load a file (e.g
- Start Atom and don't load any files.
Before, you hade to strart atom on windows with the command
atom.cmd. That seems not to be true on every system. On some systems, just
atom seems to be fine!
In Windows you may need to start atom with the command atom.cmd (which might be in a different directory from that of atom.exe - adopt your PATH accordingly).
Ctrl-s saves the file in the current buffer/window
Ctrl-f find in the file in the current buffer/window
Ctrl-n create a new file
Ctrl-w close current tab/window
Some Windows 10 Atom oddities
On Windows 10 (with a user name of "rikard"), the Atom installation seems to use the following setup:
These executables are installed:
C:\Users\rikard\AppData\Local\atom\bin\atom.cmd(a bat file - windows script)
C:\Users\rikard\AppData\Local\atom\bin\atom(no file suffix, a bash script)
C:\Users\rikard\AppData\Local\atom\app-1.19.3\resources\cli\atom.sh(a bash script)
If you use
C:\Users\rikard\AppData\Local\atom\bin\ for the Windows PATH variable, then you will execute
C:\Users\rikard\AppData\Local\atom\bin\atom when typing
atom in bash in Cygwin.
That script will call
C:\Users\rikard\AppData\Local\atom\app-1.19.3\resources\cli\atom.sh which is another bash script. This script, in turn, will use
cmd.exe to call
C:\Users\rikard\AppData\Local\atom\bin\atom.cmd which in turn will call
C:\Users\rikard\AppData\Local\atom\app-1.19.3\atom.exe. As if this weird call-chain wasn't strange enough, there are problems with the scripts:
C:\Users\rikard\AppData\Local\atom\bin\atomhas the wrong type of line-ending for a bash script - needs to be changed to LF (rather than the CRLF it is installed with)
C:\Users\rikard\AppData\Local\atom\app-1.19.3\resources\cli\atom.shhas a bug which doesn't handle absolute paths used as arguments to atom. Needs to be bugfixed to use
cygpath -wfor the arguments
Verify your installation
Close any running cygwin terminals and start a new one after you have finished installing atom.
In your home directory, type the following command:
$ atom textfiles/testfile.txt $
Make sure atom opens and you get a new prompt (the dollar sign) in the terminal, so that you can keep issuing commands in the terminal and work with atom in a separate process (a window not attached to the bash prompt in your terminal). If not, contact your supervisor or teacher for advice.
In the Atom editor, type some text, e.g.
This is just a test. and save the file (Ctrl-S).
Close Atom and back in your terminal, issue the following command:
$ cat textfiles/testfile.txt This is just a test. $
The highlighted text should be the contents of your
testfile.txt which you created using atom in the
textfiles directory. If the directory is still empty, consult your supervisor or teacher. As a last resort, install a different editor than Atom, such as Notepad++ .
This test of course requires that you followed our instructions in the Bash section above and have created the
textfiles directory first.
Mac OS Atom
Verify that you can create a new textfile with atom directly from the command line by typing the following:
$ atom textfiles/testfile.txt
Type something in the newly created textfile and save it. Confirm that the file was created in
~/textfiles/testfile.txt for instance by using
cat textfiles/testfile.txt or
ls textfiles/testfile.txt. This of course requires that you followed our instructions in the Bash section above and have created the
textfiles directory first.
Getting started with the Atom editor
atom.cmd doesn't work for you, try typing simply
atom. Before, you had to use
atom.cmd on Windows, but it seems it is not necessary anymore. Try out what works for you.
Installing emacs in Cygwin
Start the Cygwin setup program again (setup-x86_64.exe) and in the Select Packages window, change the View drop-down list to "Packages" and search for "emacs" (don't press Enter after typing in the search phrase!). In the results list, expand the "editors" category and select "emacs: The extensible..." (first item shown in screenshot) and the "emacs-w32: emacs binaries using the native Windows GUI".
When you select those items, the "Skip" text changes to the version number to be installed, e.g. "25.2-1".
Now click next etc to finish the installation.
Restart the Cygwin terminal and type:
$ emacs TestFile.txt &
& is necessary to start the emacs window in the background, so that you can keep using the terminal. Otherwise bash will wait for the emacs process to finish before you can use the terminal again.
If you are familiar with emacs, you can use it in the terminal itself without opening a GUI application. Just start it like this:
$ emacs -nw TestFile.txt
Note that now you shouldn't run it in the background! To get back to the terminal, press Ctrl-Z to pause emacs. To get back to emacs again (after e.g. compiling a program or so), just type
fg in the terminal and emacs will come back alive.
We recommend that you (if you have the time) follow the emacs tutorial linked on the startup screen of the GUI version of emacs, so that you can learn how to use keyboard shortcuts for all editing and file handling. When you get used to using only the keyboard, you'll be able to run
emacs -nw to run emacs in the terminal. If you don't have time, it's also fine to stick to the graphical (GUI) version of the editor and run it in its own window in the background (so that you can use menus and the mouse to do your work).
Installing emacs in GNU/Linux
Search your package manager to find the correct package and install it.
sudo apt-get install emacs
Installing emacs in Mac OS X
Cheat-sheet - Emacs reference card
Our wiki page on Emacs
We have a page on Emacs with the basic features to get you started.
Visual Studio Code
This editor is increasingly popular among developers and is available for Windows, GNU/Linux and MacOS. It has a very large extensions repository which allows you to configure it to your liking (you can almost make it reminiscent of Emacs) and include code support for many programming languages. We haven't tested it under Cygwin yet and will update this text when we have.