tsbohc / zest.nvim Goto Github PK
View Code? Open in Web Editor NEWmacros to configure neovim in fennel
License: MIT License
macros to configure neovim in fennel
License: MIT License
As you can see in
https://github.com/nanotee/nvim-lua-guide#caveats-3
that makes it impossible to use zest to configure number
or relativenumber
.
It works if you always set the global option and the local (buffer or window) option obtained from the scope.
The ZEST_OPTS_X_auto
variable names use an incremented X value.
For example:
(ki- [n]
{:H "^"
:L "$"})
generates
local ZEST_OPTS_19_auto = {noremap = true}
vim.api.nvim_set_keymap("n", "L", "$", ZEST_OPTS_18_auto)
return vim.api.nvim_set_keymap("n", "H", "^", ZEST_OPTS_18_auto)
def-keymap works but def-keymap-fn throws this:
; Sponsored by @rafaeldelboni ❤
; --------------------------------------------------------------------------------
; eval (file): ...s/nvim/.config/nvim/fnl/dotfiles/mappings.fnl
; Compile error in /home/p00f/.local/share/nvim/site/pack/packer/start/zest.nvim/fnl/zest/macros.fnl:117
; unknown global in strict mode: ZEST_VLUA_23_auto
;
; `(.. ":call " ZEST_VLUA# "()<cr>"))
; * Try looking to see if there's a typo.
; * Try using the _G table instead, eg. _G.ZEST_VLUA_23_auto if you really want a global.
; * Try moving this code to somewhere that ZEST_VLUA_23_auto is in scope.
; * Try binding ZEST_VLUA_23_auto as a local in the scope of this code.
when i do
(import-macros {:def-keymap-fn fmap
:def-keymap kmap} :zest.macros)
(kmap :<C-n> [n] ":bnext<CR>")
(fmap :de [n] (print 1))
Found some fennel tools in compiler's wiki. Ones that i use are:
Found way to check if arg to macro is a function at compile time.
(fn function? [f]
"checks if a 'f' is function."
(let [ref (?. f 1 1)]
(or (= ref :hashfn)
(= ref :fn))))
Fennel Passes variable as table:
{ "hashfn", -- it indexes this val.
byteend = 78,
bytestart = 73,
line = 4,
prefix = "hashfn",
<metatable> = <1>{ "SYMBOL",
__eq = <function 1>,
__fennelview = <function 2>, __lt = <function 3>,
__tostring = <function 2>
}
}
Won't work if function is indirectly passed.
Eg-
(fn name []
(do-something))
(macro-name name) ;; will not work
(macro-name #(name)) ;; will work
(fn M.map- [args fs ts]
(let [(modes opts) (keymap-options args)
fs (tostring fs)]
(if (function? ts)
(def-fn-map modes fs ts opts)
(def-map modes fs (tostring ts) opts))))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.