Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration on neovim use lua #479

Open
EiEddie opened this issue Oct 6, 2023 · 1 comment
Open

Configuration on neovim use lua #479

EiEddie opened this issue Oct 6, 2023 · 1 comment

Comments

@EiEddie
Copy link

EiEddie commented Oct 6, 2023

I only see the configuration which use vimscript, but if I want to use this plugin in neovim, how I write a new conf which use lua? Or how I use the vimscript one in neovim?

@P1n3appl3
Copy link

neoformat works just fine in neovim. If you're wondering how to configure it using lua, the options listed in :h neoformat-config are global vimscript variables (:h g:) which you can use from lua as follows:

-- defining a custom formatter in lua
vim.g.neoformat_typst_typstfmt = { exe = "typstfmt", replace = 1 }
vim.g.neoformat_enabled_typst = { "typstfmt" }

For more information about how this works, see :h lua-vim-variables and :h lua-vimscript. You can also write vimscript inline in your lua config, so something like the following would work:

vim.cmd [[
    let g:neoformat_basic_format_retab = 1
    let g:neoformat_try_node_exe = 1
]]

Note to maintainers: maybe it's worth adding a note about this in the README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants