Fennel wiki: vis

The vis editor can be configured with fennel.

Add the following to your ~/.config/vis/visrc.lua

require('vis')
local fennel = require("fennel")
local config = fennel.dofile("/home/user/.config/vis/config.fnl")

Create an example config called ~/.config/vis/config.fnl

(vis.events.subscribe vis.events.WIN_OPEN
                      (fn [win]
                        (vis:command "set number on")
                        (vis:command "set autoindent on")
                        (vis:command "set tabwidth 4")
                        (vis:command "set expandtab on")
                        (vis:command "set ignorecase on")))

(fn nmap [k b]
  (vis:map vis.modes.NORMAL k b))

(nmap ";;" :<vis-window-next>)

Make sure that the path to the bootstrap compiler is ~/.config/vis/fennel.lua

An alternative approach to configuring vis with fennel is to compile a fennel file to lua:

$ fennel --compile visrc.fnl > ~/.config/vis/visrc.lua

Now run vis with your newly compiled visrc.lua config file.

visrc.fnl

(require :vis)

(vis.events.subscribe vis.events.WIN_OPEN
                      (fn [win]
                        (vis:command "set number on")
                        (vis:command "set autoindent on")
                        (vis:command "set tabwidth 4")
                        (vis:command "set expandtab on")
                        (vis:command "set ignorecase on")))

(fn nmap [k b]
  (vis:map vis.modes.NORMAL k b))

(nmap ";;" :<vis-window-next>)

You can use antifennel if you need help converting lua code to fennel.