A text editor is a type of program used for editing plain text files. Such programs are sometimes known as "notepad" software, following the Microsoft Notepad.
- 1 Recommended editor
- 2 Atom editor
- 2.1 Installing and setting up Atom
- 2.2 Using Atom
- 2.3 Videos
- 2.4 Atom Links
- 3 Emacs
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.
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
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
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:
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
- Installing Atom (on Windows 10) (eng)
- Starting the Atom editor on Windows 10 (eng)
- Getting started with Atom (eng)
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