[slim-vim] Lisp->Vim FFI (I) at theclapp.org

Larry Clapp larry at theclapp.org
Fri May 26 23:07:04 CDT 2006


I've commited a patch that implements 30 Vim functions in Lisp.  See
http://theclapp.org/repos/vim+async+ecl .

Fri May 26 23:35:37 EDT 2006  Larry Clapp <larry at theclapp.org>
  * Lisp->Vim FFI (I)

  Includes a Lisp interface to the following Vim functions:

    append      bufwinnr     line
    argc        byte2line    lispindent
    argidx      char2nr      setline
    argv        cindent      virtcol
    browse      col          winbufnr
    bufexists   confirm      wincol
    buflisted   cursor       winheight
    bufloaded   getline      winline
    bufname     getwinposx   winnr
    bufnr       getwinposy   winwidth

  In all cases, the Lisp functions accept and return 0-based
  coordinates.  That is, in most cases, where a Vim function returns
  [1..n], its Lisp counterpart returns [0..n).  In some cases, Vim
  functions return [1..n] but it would be inappropriate for the Lisp
  function to return [0..n) (e.g. line("$")), so the Lisp function
  returns [0..n], and I added a num-* function for use in loops and
  dotimes:

    num-buffers
    num-lines

  Where a Vim function accepts [0..n] but 0 means "do something
  special" (e.g.  winbufnr), the Lisp function accepts [0..n) and nil.
  Where a Vim function accepts 1/0 as a boolean flag, the Lisp
  function accepts t/nil.  Where a Vim function returns 0 or -1 in the
  case of an error, the Lisp function returns nil.

  Examples:

  Vim                     Lisp
  ---                     ----
  append( 0, "foo" )    (append nil "foo")      ; insert a line before the first line
  bufname( 2 )          (bufname 1)             ; get the name of the second buffer
  winbufnr( 0 )         (winbufnr nil)          ; get the number of the buffer in the current window

  Look in runtime/if_ecl.lisp for the def-vim-function forms.

Brad -- NOW you can nit-pick.  :)

-- Larry



More information about the slim-vim mailing list