One second saved per minute = 1.666% better living
- pico and nano
- Sublime Text
- Git Editor
- Editor Config
- Eclipse IDE install
- Visual Studio Code
- AWS Cloud9
- More on front-end styling
- More on OSX
This is a random collection of notes on text editors for the Mac.
There is not shortage to the number of programs available to edit code.
- Visual Studio Code from Microsoft (free, built using Electron)
- Atom from GitHub (free, built using Electron)
- Adobe Brackets is on Windows too
- http://barebones.com/products/textwrangler is the little brother to BBEdit.
- mcvim ? for Mac
- $89 Sublime Text
- (There is no equivalent of Windows Notepad++ on MacOS)
- Spyder (for Python pyflakes and pylint code analysis)
- Visual Studio Express from Microsoft
- Gogland, an IDE for Go from Jetbrains (makers of IntelliJ, PyCharm, etc.)
- Aptana Studio
- IntelliJ and WebStorm and PhpStorm from JetBrains
- Visual Studio from Microsoft
- Markdown display
- Code completion
- Pre-compile on the fly
- Static code scan on the fly
- Full project navigation
- Refactoring (renaming) support
emacs was developed in 1976 by then 23-year old MIT and Harvard grad Richard Stallman, well known as the developer of gcc (open source C compiler) and the founder of the GNU Free Software Foundation.
Emacs has, perhaps, more manual editing commands than other editors, numbering over 1,000 commands.
“Some jokingly referred to emacs as the Carpal Tunnel editor, since most of the commands in emacs are accesses by typing multiple keys on the keyboard at the same time.”
But Emacs users can define macros that combine commands.
vim is an alias of
vi. vim is vi plus the m from the word improved.
vim is the most commonly available text editor in Linux.
vi is still the standard text editor available on many Unix system.
A good reason to become proficient with vi is that on some industrial type systems, where no extra software can be installed, vi may be the only editor available.
The original vi (visual editor) was developed in 1976 as part of BSD Unix system by Bill Joy, who went on to be one of the co-founders of Sun Microsystems (which Oracle later purchased). vi became popular within the Unix community for its full screen visual editing not available before.
The newer vim and graphical gvim, do add many nice features to vi.
Quitting out from command mode
In a Terminal, type command:
This is an interactive tutorial.
Press Enter as requested.
Press : to enter line mode.
PROTIP: Most of the time when you see a colon at the lower-left corner, it’s saying just press a key for a command, such as q to quit out.
Press q to quit out.
To open to the first occurance of “x” in the file executed automatically when opening a command-line Terminal:
vim +/alias ~/.bash_profile
There are three modes:
- command mode
- insert mode
- line mode
A Cheat Sheet is at https://devhints.io/vim
While in command mode, cursor to a position in the document:
- press X to delete a character.
set numberto toggle numbering on the left edge.
set invnumberto toggle inverse numbering backwards.
- type i to enter insert mode at the cursor.
- type I to enter insert mode at the front of the line.
- type o to insert new line below current position.
type O to insert new line above current position.
- type G to go to end of file.
type 55G to go to line 55.
type dd to delete line.
- type ZZ to save and exit
While in insert mode:
- Press Esc to exit insert mode.
- line mode is seen after pressing Esc.
While in last-line mode:
- cursor up brings up previous commands
press u to undo last change.
- :q to quit (short for :quit)
- :q! to quit without saving (short for :quit!)
:qa to quit all (short for :quitall)
- :wq to write and quit (in other words, save and exit)
- :x to exit (shorter than :wq)
- :e to revert to last saved version
Open at line 55 of the file executed automatically when opening a command-line Terminal:
vim +55 ~/.bash_profile
pico and nano
The user interface of nano and pico are identical because they were both developed by the University of Washington. nano is an open source clone of pico.
According to Wikipedia, pico stands for “pine composer”.
pico became well known and popular because it was the default editor used with the pine e-mail client (an easy-to-use text based e-mail client popular when early internet users sent e-mail messages only in plain text data using slow dial-up modems).
The ^ character means hold down the control key while you press the character.
Today, nano is easy to use for beginners. However, it lacks the advanced features of vim and emacs.
MacVim is a GUI app for macOS.
The manual approach:
- Download the binary release http://macvim-dev.github.io/macvim or the .dmg file from https://github.com/macvim-dev/macvim/releases
- Expand archive
- Move MacVim.app into folder /Applications/.
To use brew:
- Run brew install vim && brew install macvim
- Run brew link macvim
Many tutorials make use of this tool from Jon Skinner.
There are two simultaneous production versions of Sublime Text: 2 and 3. This is because Sublime contains its own Python interpreter to run add-ons. Choose version 3.
Download and Install Sublime Text
https://www.sublimetext.com/3 is recommended even though it’s labeled “beta” because desirable packages are being written for it.
Expanded explanations for various platforms:
On Linux: https://github.com/TCattd/sublime-text-linux-installer
Configure for command-line invocation
To use the Sublime Text text editor from the command line, make a symlink to subl.
If you don’t have a folder /usr/local/bin/, create it.
Assuming you’ve placed Sublime Text in the Applications folder:
sudo ln -s "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
To use Sublime Text as the editor for many commands that prompt for input, set your EDITOR environment variable:
export EDITOR='subl -w'
Specifying -w causes the subl command to not exit until the file is closed.
To open for edit a file using the Sublime text editor, for example:
PROTIP: Sublime Text runs in the background to index your source files.
One nice feature of Sublime is that if you are already editing a file. You are brought to the file being edited instead of seeing another instance of that file.
Install Package Control
One advantage of Sublime Text is its plug-ins.
Switch to an internet browser to visit Package Control home page.
Click Browse at the upper right for the most popular:
- Emmet for keyboard shortcuts
- SublimeLinter to find typos
- Theme - Soda to look better
- SFTP to transfer files from within the editor UI.
Click the Popular heading for a list with more detail.
Visit Package Control home page.
- Open SublimeText 3.
- If not already installed, see https://packagecontrol.io/installation#st3
- Select your version of Sublime you have open.
- Double-click on the command text to select it.
- Press Ctrl+C to copy the command into the operating system’s invisible clipboard.
Switch back to SublimeText (press Command+Tab).
Bring up Sublime’s command-line Console by using the control+` (back-tick) shortcut or click menu View > Show Console.
NOTE: The Console recognizes Python code.
Paste the command and press Enter.
This creates the Installed Packages/ folder.
If you get
IndentationError: unexpected indent???
control+again to remove the Console.
- Restart Sublime Text.
Use Package Control
Press Cmd+Shift+P to bring command palette in front.
The position from the previous action is remembered.
- Type pac for Package Control. (Press Esc to dismiss it)
Select Install Package.
NOTE: This may take a few seconds to bring up a list from a website visited above.
Type in a package name and press Enter to install it:
(This is similar in operation to the Vim Tutor.)
Read more about SublimeText:
Use Sublime Text on Retina? for crisp, readable text, to Settings add
"font_options" : ["gray_antialias"]
Install spell check
Recommended spelling from the geniuses at Google. Install ST v3 https://github.com/noahcoad/google-spell-check/tree/st3 by https://github.com/noahcoad/google-spell-check/
Install Python linter
Install Flake8 – a favorite Python linters because it’s fast yet has a low rate of false positives.
pip3 install –upgrade flake8
The response shows it is a combination of the Pyflakes static-analysis tool and Pycodestyle (former pep8) code style checker.
SublimeLinter is the most popular linting framework for Sublime Text due to its focus, simplicity, and performance. Install the SublimeLinter and the SublimeLinter-flake8 plugins for Sublime Text.
- GotoSublimeTextandopentheCommandPalette (Cmd+Shift+p)
- ThenselectthePackageControl:InstallPackageoptionand hit Return.
- Packagecontrolwillpresentyouwithalistofavailable packages. Type SublimeLinter and select the SublimeLinter - Interactive code linting framework for Sublime Text 3 package.
- Install SublimeLinter-flake8 Now we need to integrate SublimeLinter with Flake8. This is done through another plugin called SublimeLinter-flake8. Let’s install it:
- ThenselectthePackageControl:InstallPackageoptionand hit Return.
- Packagecontrolwillpresentyouwithalistofavailable packages. Type flake8 and select the SublimeLinter-flake8 - SublimeLinter plugin for Python, using flake8 package.
Restart Sublime Text to Finalize the Plugin Install
For SublimeLinter to start working correctly we need to exit Sublime Text and start it again. Click on Sublime Text → Quit Sublime Text to shut down Sublime Text and then launch it again.
- Changealineinthefiletointroduceasyntaxorformatting error.
To disable individual linter warnings, put a “# noqa” comment at the end of a line. See documentation at: http://flake8.pycqa.org/
If Git finds conflicts, it needs a way to show the differences in a text editor.
Git uses the default vim editor. To quit the page, press :q! (colon to specify a command, q to specify quit, exclamation point for immediate).
Sublime Text is a popular text editor.
Advantage of using the intelliJ IDE:
- Simple keystrokes wraps statements in a try-catch or if-else block.
- It generates getter and setter methods for object attributes.
- Inbuilt packaging tools like gradle, SBT, grunt, bower, etc.
- Directly access databases such as SQL, ORACLE, PostgreSQL, Microsoft SQL Server
- Editions for different operating systems: Windows, Linux, etc.
Videos by LaunchCode:
- Zen Habits of using IntelliJ IDEA Nov 9, 2017 at Devoxx [50:10] by Victor Kropp (@kropp)
- 42 IntelliJ IDEA Tips and Tricks Oct 23,
from IntelliJ IDEA
IntelliJ Control Key Shortcuts
During initial configuration, specify the Project SDK using the command up-arrow to the secret portal:
- Click New button
- Select JDK
- Click on the folder list (containing bin, etc.)
- Press command + up arrow to navigate up a folder level from Home to the **MacOS** folder.
- Click Choose to select the Java associated with the system. This is called the "Secret Portal" approach.
|Defaults changeable in Preferences||Keymaps|
command + G to Generate
command + O to go to class
command + ⌫ Delete line
Use an internet browser to atom.io
The site recognizes your operating system (OS X, Windows, or Linux) and presents the appropriate download button.
- Click Download to your Downloads folder.
Expand the downloaded zip file.
On a Mac:
- Open a new Finder window and press shift+Command+A or click Go, then Applications.
- Drag and drop the Atom app file from Downloads to your root Applications folder.
- If an existing file is there, replace it.
Delete the zip file downloaded.
Follow Twitter @AtomEditor
Atom has package control, themes, auto-completion built-in.
- https://github.com/atom/spell-check doesn’t work per http://stackoverflow.com/questions/27731981/use-spell-check-in-code-comments
To enable Spell Check for your current file type: put your cursor in the file:
- Open the Command Palette (cmd-shift-p)
Run the Editor: Log Cursor Scope command.
This triggers a notification containing a list of scopes. The first scope listed is the one you should add to the list of scopes in the settings for the Spell Check package.
Examples: source.coffee, text.plain, text.html.basic.
- Press cmd-shift-: to bring up the list of corrections when your cursor is on a misspelled word.
Put a .EditorConfig file ( from editorconfig.org) in your root folder, and the editor will format your code according to the rules defined in the file for whatever type of file is being edited.
It’s supported by default in Atom and other editors.
It may take some effort to memorize the keyboard sequences, but these are the ones I remember because I save time using them:
Eclipse IDE install
brew cask install eclipse-java
Please migrate your Casks to the new location and delete /opt/homebrew-cask/Caskroom, or if you would like to keep your Caskroom at /opt/homebrew-cask/Caskroom, add the following to your HOMEBREW_CASK_OPTS: --caskroom=/opt/homebrew-cask/Caskroom For more details on each of those options, see https://github.com/caskroom/homebrew-cask/issues/21913. ==> Satisfying dependencies complete ==> Downloading https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/R/eclipse-java-neon-R-macosx-cocoa-x86_64.tar.gz&r=1 ==> Verifying checksum for Cask eclipse-java ==> Moving App 'Eclipse.app' to '/Applications/Eclipse.app' 🍺 eclipse-java staged at '/opt/homebrew-cask/Caskroom/eclipse-java/4.6.0' (0B)
Visual Studio Code
Microsoft’s Code is slower to startup than Sublime Text.
But its windowing is much more configurable, if that’s important to you. An example of this is moving the default sidebar to the right side of the editor.
Code’s auto-indenting and execution of snippets work naturally.
Search for add-ins on https://marketplace.visualstudio.com/ by opening its Extension panel (CTRL + Shift + X). Nick’s list.
Install the GUI program using Homebrew:
brew cask install visual-studio-code
My favorite approach is to open Code from the Mac Finder, by right-clicking on a folder and select Open with Visual Studio Code per these instructions
- Click “Typescript” as well.
If you’re using Protractor, search for that and install what appears:
Press shift+command+P or select Code’s menu View, Command Palette at the top of the screen.
Begin typing this until the full command is recognized in the list:
Install ‘Code’ command in PATH
Select the full command that appears in the drop-down.
Exit the Code program.
You can now, in a new Terminal shell window, use the code command to open a file:
BTW, “hello” in the example above can be any file.
Tutorials on VSCode
Make Visual Studio Code Your Editor video course at Scotch.io by Chris Sevilleja (@chrisoncode)
- Introduction 7:55
- VS Code Basics 8:01
- Command Palette and Shortcuts 6:18
- Settings 8:04
- Extensions, 8:00
Search and Multi-Cursor 7:38
- Git 10:46
- Intellisense 10:22
- HTML 7:03
- CSS and Sass 6:56
- Angular 6:09
- Node and npm 6:38
PHP and Laravel 7:40
- Project Manager 7:26
Settings Sync 6:40
- Tasks 12:44
- Debugging 8:36
- VS Code 1.10 Features 5:28
- Custom Status and Activity Bar 7:26
15 Essential Plugins for Visual Studio Code June 27, 2017
AWS Cloud9 for (Serveless) Lambda (under the Developer Tools category) works completely in the browser running in EC2 under the hood. Key bindings from various other editors. It auto-hibernates. Terminal, Git, NVM, Python, are pre-installed. AWS Resources tab provides Lambda and Gateway integration.
Reviewed using https://github.com/ACloudGuru/acg-rr-cloud9
CAUTION: Do your own backups.
https://www.codota.com/code/tutorials Full sentence completion, learned from millions of programs. dmg attaches to Eclipse, IntelliJ, STS, Android Studio 3.0. (Not Netbeans) Invokes by default shift+Alt+space.
More on front-end styling
This is one of several topics:
- Text Editors
- Markdown text for GitHub from HTML
- JAM Stack Website Project Plan
- HTTP/2 Transition Project Plan
- Static websites
- Website styles
- Website Styling
- Email from website
- Search within Hyde format Jekyll websites
- Data Visualization using Tableau
More on OSX
This is one of a series on Mac OSX:
- MacOS Hardware and accessories
- MacOS Boot-up
- MacOS Terminal Tips and Tricks
- MacOS Keyboard tricks
- Text editors and IDEs on MacOS
- MacOS Setup automation
- MacOS Homebrew installers
- Manage Disk Space on MacOS
- Data Backups on MacOS
- Ports open
- Applications on MacOS
- Windows on Apple MacOS
- Packer create Vagrant Windows image
- Python on MacOS
- Maven on MacOS
- Ruby on MacOS
- Java on MacOS
- Node on MacOS installation
- PHP on MacOS
- Scala ecosystem