Giter Site home page Giter Site logo

Comments (4)

datwaft avatar datwaft commented on July 23, 2024 1

This is kind of intended.

I talked about this with zest creator here.

The problem is a limitation of macros, because they work on compilation time they cannot evaluate their parameters to know if a symbol (like b in your case) is a vim variable name or a local name (maybe it could be posible to read the local environment using a macro (I have seen it in fennel's documentation), but it would make the macro overly complicated).

Therefore, I needed to decide between using symbols as vim variables and not accepting runtime variables as names, or using strings and having the ability to do that.

Option 1:

(let! spell true)
(let [spell "wrap"]
  (let! spell true)) ; this sets spell, not wrap

Option 2:

(let! :spell true) ; now you need to use strings
(let! [spell "wrap"]
  (let! spell true)) ; sets wrap :D

At the moment, I decided to use option 1, because it looks a lot better.

Therefore, we have some options about how to solve this:

  1. Modifying the macro to give priority to local variables if it finds them.
  2. Creating a new macro with another name (e.g. set~!) that uses option 2.
  3. Not using a macro for this, and just using (tset vim.g <variable> <value>).

At the moment I am using option 3, because I created my macros for idiomatic vim configuration, and using loops and the like is more scripting, and for that I don't need it to be that idiomatic.

What do you think?

from nvim.conf.

datwaft avatar datwaft commented on July 23, 2024 1

I added the explanation to the documentation, I will now close this issue.

from nvim.conf.

bangedorrunt avatar bangedorrunt commented on July 23, 2024

Thank you for your explanation. I understand and totally I agree with your choice. But please add more information about this issue (in macro explanation docs?) for new users just like me who don't have an in depth knowledge at first about how macros works behind the curtain so mistake and/or confusion could be avoided 😀

from nvim.conf.

datwaft avatar datwaft commented on July 23, 2024

Yes, I will close this issue when I add that to the documentation.

Thanks!

from nvim.conf.

Related Issues (10)

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.