Ciao in Vim

Table of Contents

  1. Introduction
  2. Environment
  3. Configuration Files
  4. Using the Interpreter
  5. Current Improvements
  6. Future Improvements

Introduction

Vim is a light and powerful editor. If you are comfortable with Emacs, I recommend using the excellent Emacs mode for Ciao. If you are unsure about Emacs, and VIper, the Vi Package for Emacs Rebels hasn't helped you, there is a fledging Vim mode for Ciao. This page describes the current state and future improvements for this Vim mode.

This extension is maintained by agadani at gmail dot com

Environment

The configurations on this page require at least Vim 7.0 You can find the current version of Vim for your platform at http://www.vim.org/download.php
For integrated interpretor support, you will need to compile your vim with the +python option and download and install the vimsh utility.

You can download Ciao from the CLIP Lab.

Configuration

Download ciao-vim.tar.
This tarball contains the files:

By default, the install script assumes that your Vim local directory is ~/.vim. If this isn't the case, change the $VIMDIR environment variable to your local directory. E.g.:
    export VIMDIR="/Applications/Vim.app/Contents/Resources/vim/runtime"
    
Some possible location for your vim local directory, based on operating system:

Unix ~/.vim
OS X Fink /usr/share/vim/vim70
OS X Vim.app     /Applications/Vim.app/Contents/Resources/vim/runtime
WindowsC:\Program Files\Vim\vimfiles

If you have modified the following files in your Vim local directory (if you aren't sure, you probably haven't), DO NOT run the installer:

You will need to install manually.

If this isn't the case, simply untar the package and run the provided shell script. Ciao should be included next time you open an instance of Vim
Note: If you are using an older verion of vim, make certain that the line filetype on is in your .vimrc


The installer also puts ciao-vimsh.vim in your home directory. You will need this file in the working directory of the Ciao project you are currently editing, so copy it accordingly.

Using the Interpreter

Because Vim does not yet support full integration of the shell, using the Ciao interpreter within vim is a bit of a hack.
If you've downloaded and installed vimsh as per the directions above, the following commands in your Vim should give you a vertically split window with an interpreter:

	
	 vertical split
	 let g:vimsh_split_open=0
	 let g:vimsh_sh_arg=""
	 let g:vimsh_prompt_pty="?- "
	 let g:vimsh_sh="/usr/bin/ciao"
	 source vimsh.vim
	

Manual Install

Run the following commands for your $VIMDIR:

    cp ciao-syntax.vim $VIMDIR/syntax/ciao.vim
    cp ciao-compiler.vim $VIMDIR/compiler/ciao.vim
    cp ftplugin_ciao.vim $VIMDIR/ftplugin/ciao.vim
    cp colorful.vim $VIMDIR/colors/colorful.vim
    

Modify the following lines in your filetype.vim:

fun! s:FTpl()
  if exists("g:filetype_pl")
    exe "setf " . g:filetype_pl
  else
    " recognize Ciao or Prolog by specific text in the first non-empty line
    " require a blank after the '%' because Perl uses "%list" and
    "%translate"
    let l = getline(nextnonblank(1))
    if l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
      let m = getline(nextnonblank(2))
      if m =~ '\'
        setf prolog
      else
        setf ciao
      endif
    else
      setf perl
    endif
  endif
endfun
    

Add the following line to synmenu.vim:

    an 50.80.400 &Syntax.C.Ciao :cal SetSyn("ciao")
    
Add the following line to makemenu.vim:

    SynMenu C.Ciao:ciao
    

Current Improvements

ToDo


Last Modified: 12/08/2006 by agadani at gmail dot com

Table of Contents Home