Comments (4)
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:
- Modifying the macro to give priority to local variables if it finds them.
- Creating a new macro with another name (e.g.
set~!
) that uses option 2. - 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.
I added the explanation to the documentation, I will now close this issue.
from nvim.conf.
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.
Yes, I will close this issue when I add that to the documentation.
Thanks!
from nvim.conf.
Related Issues (10)
- fix: augroup! macro only executes the first statement HOT 1
- Move LSP mappings to on_attach HOT 1
- feat: integrate which-key HOT 35
- Question about the `pack!` macro, using pack! in multiple files? HOT 5
- `highlight!` macro doesn't set GUI options (bold/underline/italic) HOT 9
- Question about package macros HOT 3
- feat: add function support to set! macro HOT 1
- feat: add symbol list support to autocmd! macro HOT 1
- feat: add setlocal! macro HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim.conf.