asymptote: Editing modes
2.7 Editing modes
=================
Users of 'emacs' can edit 'Asymptote' code with the mode 'asy-mode',
after enabling it by putting the following lines in their '.emacs'
initialization file, replacing 'ASYDIR' with the location of the
'Asymptote' system directory (by default, '/usr/local/share/asymptote'
or 'C:\Program Files\Asymptote' under 'MSDOS'):
(add-to-list 'load-path "ASYDIR")
(autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
(autoload 'lasy-mode "asy-mode.el" "hybrid Asymptote/Latex major mode." t)
(autoload 'asy-insinuate-latex "asy-mode.el" "Asymptote insinuate LaTeX." t)
(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))
Particularly useful key bindings in this mode are 'C-c C-c', which
compiles and displays the current buffer, and the key binding 'C-c ?',
which shows the available function prototypes for the command at the
cursor. For full functionality you should also install the Apache
Software Foundation package 'two-mode-mode':
<http://www.dedasys.com/freesoftware/files/two-mode-mode.el>
Once installed, you can use the hybrid mode 'lasy-mode' to edit a LaTeX
file containing embedded 'Asymptote' code (LaTeX usage). This
mode can be enabled within 'latex-mode' with the key sequence 'M-x
lasy-mode <RET>'. On 'UNIX' systems, additional keywords will be
generated from all 'asy' files in the space-separated list of
directories specified by the environment variable 'ASYMPTOTE_SITEDIR'.
Further documentation of 'asy-mode' is available within 'emacs' by
pressing the sequence keys 'C-h f asy-mode <RET>'.
Fans of 'vim' can customize 'vim' for 'Asymptote' with
'cp /usr/local/share/asymptote/asy.vim ~/.vim/syntax/asy.vim'
and add the following to their '~/.vimrc' file:
augroup filetypedetect
au BufNewFile,BufRead *.asy setf asy
augroup END
filetype plugin on
If any of these directories or files don't exist, just create them.
To set 'vim' up to run the current asymptote script using ':make' just
add to '~/.vim/ftplugin/asy.vim':
setlocal makeprg=asy\ %
setlocal errorformat=%f:\ %l.%c:\ %m
Syntax highlighting support for the KDE editor 'Kate' can be enabled
by running 'asy-kate.sh' in the '/usr/local/share/asymptote' directory
and putting the generated 'asymptote.xml' file in
'~/.kde/share/apps/katepart/syntax/'.