Giter Site home page Giter Site logo

zest.nvim's People

Contributors

tsbohc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

olical raw1z

zest.nvim's Issues

def-keymap invalid variable names

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-fn throws error

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))

Some enhancements that i found.

tools

Found some fennel tools in compiler's wiki. Ones that i use are:

code

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))))

how it works:

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>
   }
}

Caveats

Won't work if function is indirectly passed.
Eg-

(fn name [] 
  (do-something))

(macro-name name) ;; will not work

(macro-name #(name)) ;; will work

example of macro taken from my dotfiles.

(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))))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.