Comments (8)
I've merged #115 which includes an experimental Lua shim for wilder
. There is no documentation (since it is highly experimental), but the configuration should be straightforward:
For every wilder#<foo>
method, an analogous wilder.<foo>
method is exposed in Lua. Take this example config:
call wilder#setup({'modes': [':', '/', '?']})
call wilder#set_option('use_python_remote_plugin', 0)
call wilder#set_option('pipeline', [
\ wilder#branch(
\ wilder#python_file_finder_pipeline({
\ 'file_command': ['find', '.', '-type', 'f', '-printf', '%P\n'],
\ 'dir_command': ['find', '.', '-type', 'd', '-printf', '%P\n'],
\ 'filters': ['fuzzy_filter', 'difflib_sorter'],
\ }),
\ wilder#cmdline_pipeline(),
\ wilder#python_search_pipeline(),
\ ),
\ ])
The config in Lua would then look like:
local wilder = require('wilder')
wilder.set_option('use_python_remote_plugin', 0)
wilder.setup({modes = {'/', '?', ':'}})
wilder.set_option('pipeline', {
wilder.branch(
wilder.python_file_finder_pipeline({
file_comand = {'find', '.', '-type', 'f', '-printf', '%P\n'},
dir_comand = {'find', '.', '-type', 'd', '-printf', '%P\n'},
filters = {'fuzzy_filter', 'difflib_sorter'},
}),
wilder.cmdline_pipeline(),
wilder.python_search_pipeline()
),
})
Essentially, wilder#set_option()
is translated to wilder.set_option()
and similar for other methods. All arguments remain the same. Lambdas have to be translated accordingly e.g. {ctx, x -> x * 2}
becomes function(ctx, x) return x*2 end
.
Note: only the top level wilder#...
methods are provided, methods in deeper namespaces e.g. wilder#cmdline#parse()
are not provided.
Note: The Lua shim introduces a bit of overhead since Neovim has to do some translation of the arguments passed from VimScript to Lua and vice versa. Ultimately, most of the logic will be passed to the VimScript core so in general a Lua config will always be slower than a VimScript config. (This could be alleviated by providing pure Lua implementations of the VimScript core, but that would be a topic for another day.)
from wilder.nvim.
I'm working on a workaround for neovim/neovim#13436, which will allow easier configuration in Lua. Will update here when the PR is merged.
from wilder.nvim.
BTW there are some problems in the example configs when run inside a vim.cmd [[ ]]
block.
- Using
s:
variables gives me a 'illegal variable names' error - The below block of code gives me an error that it can't find the list ending ']'
vim.cmd [[
call wilder#set_option('pipeline', [
wilder#branch(
wilder#cmdline_pipeline({
'fuzzy': 1,
}),
wilder#python_search_pipeline({
'pattern': 'fuzzy',
}),
),
])
]]
from wilder.nvim.
For the first case I can't reproduce it (although I'm not using packer
, just an init.lua
).
For the second case there last )
is missing the leading \
.
from wilder.nvim.
There's some issues with writing the configuration fully in Lua due to neovim/neovim#13436. I'll explore if writing wrappers in Lua will help avoid this issue.
Regarding the vim.cmd
block,
- The
s:
variables have to be renamed tog:
variables. - VimScript needs
\
to delimit a line continuation, so the correct config will be
vim.cmd [[
call wilder#set_option('pipeline', [
\ wilder#branch(
\ wilder#cmdline_pipeline({
\ 'fuzzy': 1,
\ }),
\ wilder#python_search_pipeline({
\ 'pattern': 'fuzzy',
\ }),
\ ),
\ ])
]]
from wilder.nvim.
vim.cmd [[
call wilder#set_option('pipeline', [
\ wilder#branch(
\ wilder#cmdline_pipeline({
\ 'fuzzy': 1,
\ }),
\ wilder#python_search_pipeline({
\ 'pattern': 'fuzzy',
\ }),
\ ),
\ ])
]]
Results in:
packer.nvim: Error running config for wilder.nvim: /home/amedhi/.config/nvim/lua/lv-wilder/init.lua:21: Vim(call):E697: Missing end of List ']':
vim.cmd [[
let g:wilder_highlighters = [ wilder#pcre2_highlighter(), wilder#basic_highlighter(), ]
call wilder#set_option('renderer', wilder#renderer_mux({
\ ':': wilder#popupmenu_renderer({
\ 'highlighter': wilder#basic_highlighter(),
\ }),
\ '/': wilder#wildmenu_renderer({
\ 'highlighter': wilder#basic_highlighter(),
\ }),
\})
)
]]
Results in:
packer.nvim: Error running config for wilder.nvim: /home/amedhi/.config/nvim/lua/lv-wilder/init.lua:34: Vim(call):E116: Invalid arguments for function wilder#renderer_mux
Should I open a new issue about the example configs?
from wilder.nvim.
I just tried merging all the lines (so no line continuations are necessary) and I no longer get any error messages
from wilder.nvim.
A proper way to use lua config would be great! Something like the setup {}
functions that many other plugins use to allow specifying a table of options
from wilder.nvim.
Related Issues (20)
- File finder: customizable behavior on should_use_file_finder HOT 1
- Changing the background color HOT 1
- Strange off-by-one error when hitting <Tab> in the command line HOT 3
- `_wilder_python_search` error when searching with `/` HOT 2
- Highlight the candidates
- Wilder removes topline in buffer in .10 nightly
- Wilder pop up breaks lualine "diff" component
- The popup menu's color is weird HOT 1
- I entered / in cmdline and received this error HOT 6
- Issue with wilder when trying to select commands(TAB) HOT 1
- Trying to install wilder correctly for NvChad, getting Unknown function _wilder_python_file_finder HOT 1
- Semshi/Wilder conflict HOT 6
- Configure to operate similarly to wildmode=list:longest?
- "error caught in async handler" when searching HOT 1
- Popupmenu_render only works on 1st table.
- Bug when trying to save harpoon buffer
- How to select the first listed item by default? HOT 5
- Unknown function: _wilder_python_search HOT 4
- When use_python_remote_plugin is set to 0, an error occurs when writing during a git commit.
- Nvim 0.9.5 still can not register wilder.nvim with UpdateRemotePlugins on Windows HOT 3
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 wilder.nvim.