Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Opa Application Development

You're reading from   Opa Application Development A rapid and secure web development framework to develop web applications quickly and easily in Opa

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781782163749
Length 116 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Li Wenbo Li Wenbo
Author Profile Icon Li Wenbo
Li Wenbo
Arrow right icon
View More author details
Toc

Setting up editors


You can write Opa codes with any text editor you like, but a good editor can make coding easier. This section is about setting up editors you may commonly use. For now, Sublime Text is the most complete Integrated Development Environment (IDE) for Opa.

Sublime Text

Sublime Text (http://www.sublimetext.com/) is a sophisticated text editor for code, markup, and prose. You can download and try Sublime Text for free from http://www.sublimetext.com/2.

There is an Opa plugin that offers syntax highlighting, code completion, and some other features. To install the plugin, follow these steps:

  1. Get the plugin from https://github.com/downloads/MLstate/OpaSublimeText/Opa.sublime-package.

  2. Move it to ~/.config/sublime-text2/Installed Packages/ (in Linux), or %%APPDATA%%\Sublime Text 2\Installed Packages\ (in Windows), or ~/Library/Application Support/Sublime Text 2/Installed Packages (in Mac).

  3. Start Sublime and check if the menu entry (View | Syntax | Opa) is present. If everything goes well, the file with the .opa extension should automatically have its syntax highlighted. If not, please make sure you are using the Opa plugin (View | Syntax | Opa). We can navigate to Edit | Line | Reindent to auto-indent the Opa code.

Vim

Vim (http://www.vim.org/) is a highly configurable text editor, freely available for many different platforms. The Opa installation package provides a mode for Vim at /usr/share/opa/vim/ (for Linux) or /opt/mlstate/share/opa/vim/ (for Mac OS). To enable Vim to detect Opa syntax, copy these files to your .vim directory in your home folder (create it if it does not exist already):

  • On Linux, type the following command:

    $cp –p /usr/share/opa/vim/* ~/.vim/
    
  • On Mac OS, type the following command:

    $cp –p /opt/mlstate/share/opa/vim/* ~/.vim
    

Emacs

On Mac OS X, you can either use Aquamacs and the package installation will take care of it, or you should add the following line to your configuration file (which might be ~/.emacs; create it if it does not exist already):

(autoload 'opa-classic-mode "/Library/Application Support/Emacs/site-lisp/opa-mode/opa-mode.el" "Opa CLASSIC editing mode." t)
(autoload 'opa-js-mode "/Library/Application Support/Emacs/site-lisp/opa-mode/opa-js-mode.el" "Opa JS editing mode." t)
(add-to-list 'auto-mode-alist '("\.opa$" . opa-js-mode))
(add-to-list 'auto-mode-alist '("\.js\.opa$" . opa-js-mode))
(add-to-list 'auto-mode-alist '("\.classic\.opa$" . opa-classic-mode))

On Linux, add the following lines to your configuration file:

(autoload 'opa-js-mode "/usr/share/opa/emacs/opa-js-mode.el" "Opa JS editing mode." t)
(autoload 'opa-classic-mode "/usr/share/opa/emacs/opa-mode.el" "Opa CLASSIC editing mode." t)
(add-to-list 'auto-mode-alist '("\.opa$" . opa-js-mode))
(add-to-list 'auto-mode-alist '("\.js\.opa$" . opa-js-mode))
(add-to-list 'auto-mode-alist '("\.classic\.opa$" . opa-classic-mode))

For Eclipse, the experimental plugin is available at https://github.com/MLstate/opa-eclipse-plugin.

You have been reading a chapter from
Opa Application Development
Published in: Jun 2013
Publisher: Packt
ISBN-13: 9781782163749
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image