[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scheme with vim

From: Marc Chantreux
Subject: scheme with vim
Date: Wed, 29 Jan 2020 16:56:47 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

hello people,

during the guix days 2019, i made a demo of how awesome vim is as a
scheme editor (because s-expr actually are text objects). then
during the JRES, i said to Julien i'll write a tutorial about it.

i started to write a filetype plugin and an interactive tutorial
(vimtutor inspired) but i realize i need more guile skills.

the very first start is here:


* simple completion based on searching the first letters after
  the '-' symbols (so `us-m<tab>` becomes `use-modules`).
* mappings like (d for (define |) *l for λ,
* explaination about what text objects are and how to use them

but i have some questions:

# completion

i don't know what is the good way to get the list of built-in
commands of guile so i ended up with

    aptitude search '~i ~n guile-2' -F%p |
        xargs -n1 dpkg -L |
        perl -lnE 'print if /[.]scm$/ && -f' |
    ctags -L - -f ~/.vim/ctags/guile

any better way ?

# please be quiet

a way to test a code in vim is to use the interpreter as a filter using
the ! action (:h !) or write in a pipe.  if you do that with guile, the
repl header is printed:

    GNU Guile 2.2.4
    Copyright (C) 1995-2017 Free Software Foundation, Inc.

    Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
    This program is free software, and you are welcome to redistribute it
    under certain conditions; type `,show c' for details.

i wrote a wrapper:

    guile_as_filter () {
        local x=$( mktemp /tmp/guile-as-filter-XXXXX )
        cat "$@" > $x
        guile -s $x
        rm $x

then i got

    ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
    ;;;       or pass the --no-auto-compile argument to disable.
    ;;; compiling /tmp/guile-as-filter-RTGLe
    ;;; compiled 

is there a way to restrict stderr and stdout to the content produced by
the actual script ?  (also interesting for a quickfix errformat)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]