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

Trying to install wilder correctly for NvChad, getting Unknown function _wilder_python_file_finder #196

Closed
Gerodote opened this issue Jan 6, 2024 · 1 comment

Comments

@Gerodote
Copy link

Gerodote commented Jan 6, 2024

So, what did I wrong?

What I have now:
image

After :runtime! plugin/rplugin.vim and :UpdateRemotePlugins :

image

Setup:

a PC with a Linux.

fd installed, also exist a bash script in PATH called fdfind that calls fd actually
ripgrep installed
Python provider works.

`nvim --version`:
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
Current config:

So, you can try it (use this branch, not master): https://github.com/Gerodote/Nvchad_config_cpp/tree/wilder

Added to Lazy plugins
{
    "gelguy/wilder.nvim",
    dependencies = {
      { "romgrk/fzy-lua-native", build = "make", lazy = false },
      { "nixprime/cpsm", dependencies = { "ctrlpvim/ctrlp.vim", lazy = false }, lazy = false },
    },
    config = function()
      require "custom.configs.wilder"
    end,
    -- init = function ()
    --  ... idk what here should be
    --   vim.cmd([[
    --   :UpdateRemoteConfig
    --   ]])
    -- end,
    lazy = false,
  },
config is what in README called advanced
local wilder = require('wilder')
wilder.setup({modes = {':', '/', '?'}})

wilder.set_option('pipeline', {
  wilder.branch(
    wilder.python_file_finder_pipeline({
      file_command = function(ctx, arg)
        if string.find(arg, '.') ~= nil then
          return {'fdfind', '-tf', '-H'}
        else
          return {'fdfind', '-tf'}
        end
      end,
      dir_command = {'fd', '-td'},
      filters = {'cpsm_filter'},
    }),
    wilder.substitute_pipeline({
      pipeline = wilder.python_search_pipeline({
        skip_cmdtype_check = 1,
        pattern = wilder.python_fuzzy_pattern({
          start_at_boundary = 0,
        }),
      }),
    }),
    wilder.cmdline_pipeline({
      fuzzy = 2,
      fuzzy_filter = wilder.lua_fzy_filter(),
    }),
    {
      wilder.check(function(ctx, x) return x == '' end),
      wilder.history(),
    },
    wilder.python_search_pipeline({
      pattern = wilder.python_fuzzy_pattern({
        start_at_boundary = 0,
      }),
    })
  ),
})

local highlighters = {
  wilder.pcre2_highlighter(),
  wilder.lua_fzy_highlighter(),
}

local popupmenu_renderer = wilder.popupmenu_renderer(
  wilder.popupmenu_border_theme({
    border = 'rounded',
    empty_message = wilder.popupmenu_empty_message_with_spinner(),
    highlighter = highlighters,
    left = {
      ' ',
      wilder.popupmenu_devicons(),
      wilder.popupmenu_buffer_flags({
        flags = ' a + ',
        icons = {['+'] = '', a = '', h = ''},
      }),
    },
    right = {
      ' ',
      wilder.popupmenu_scrollbar(),
    },
  })
)

local wildmenu_renderer = wilder.wildmenu_renderer({
  highlighter = highlighters,
  separator = ' · ',
  left = {' ', wilder.wildmenu_spinner(), ' '},
  right = {' ', wilder.wildmenu_index()},
})

wilder.set_option('renderer', wilder.renderer_mux({
  [':'] = popupmenu_renderer,
  ['/'] = wildmenu_renderer,
  substitute = wildmenu_renderer,
}))
`:checkhealth` :
==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
- WARNING {nvim-lspconfig}: overriding <config>

==============================================================================
null-ls: require("null-ls.health").check()

- OK deno_fmt: the command "deno" is executable.
- OK prettier: the command "prettier" is executable.
- OK stylua: the command "stylua" is executable.
- OK yapf: the command "yapf" is executable.
- OK clang_format: the command "clang-format" is executable.
- OK cmake_lint: the command "cmake-lint" is executable.
- OK cmake_format: the command "cmake-format" is executable.

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /usr/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- WARNING "wilder.nvim" is not registered.
- WARNING Out of date
  - ADVICE:
    - Run `:UpdateRemotePlugins`

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $COLORTERM="truecolor"

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.20.8 (0c49d6745b3fc4822ab02e0018770cd6383a779c) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v21.5.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20230801
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.5.13-7-MANJARO",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Wed Dec 20 07:15:58 UTC 2023"
} ~

Parser/Features         H L F I J
  - c                   ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: xsel

Python 3 provider (optional) ~
- `g:python3_host_prog` is not set.  Searching for python3 in the environment.
- Executable: /usr/bin/python3
- Python version: 3.11.6
- pynvim version: 0.5.0
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- WARNING `ruby` and `gem` must be in $PATH.
  - ADVICE:
    - Install Ruby and verify that `ruby` and `gem` commands work.

Node.js provider (optional) ~
- Node.js: v21.5.0
- Nvim node.js host: /usr/lib/node_modules/neovim/bin/cli.js
- OK Latest "neovim" npm/yarn/pnpm package is installed: 4.10.1

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.0.3
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `cmake_tools` ~
- No healthcheck provided

Telescope Extension: `terms` ~
- No healthcheck provided

Telescope Extension: `themes` ~
- No healthcheck provided

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/fuxu/.local/state/nvim/lsp.log
- WARNING Log size: 101500 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/c.so
- OK Parser: cpp        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/cpp.so
- OK Parser: css        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/css.so
- OK Parser: html       ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/html.so
- OK Parser: javascript ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/javascript.so
- OK Parser: lua        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so
- OK Parser: markdown   ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/markdown_inline.so
- OK Parser: tsx        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/tsx.so
- OK Parser: typescript ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/typescript.so
- OK Parser: vim        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/vim.so
`checkhealth` after `:runtime! plugin/rplugin.vim` and `:UpdateRemotePlugins` :
==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
- WARNING {nvim-lspconfig}: overriding <config>

==============================================================================
null-ls: require("null-ls.health").check()

- OK deno_fmt: the command "deno" is executable.
- OK prettier: the command "prettier" is executable.
- OK stylua: the command "stylua" is executable.
- OK yapf: the command "yapf" is executable.
- OK clang_format: the command "clang-format" is executable.
- OK cmake_lint: the command "cmake-lint" is executable.
- OK cmake_format: the command "cmake-format" is executable.

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /usr/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $COLORTERM="truecolor"

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.20.8 (0c49d6745b3fc4822ab02e0018770cd6383a779c) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v21.5.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20230801
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.5.13-7-MANJARO",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Wed Dec 20 07:15:58 UTC 2023"
} ~

Parser/Features         H L F I J
  - c                   ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: xsel

Python 3 provider (optional) ~
- `g:python3_host_prog` is not set.  Searching for python3 in the environment.
- Executable: /usr/bin/python3
- Python version: 3.11.6
- pynvim version: 0.5.0
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- WARNING `ruby` and `gem` must be in $PATH.
  - ADVICE:
    - Install Ruby and verify that `ruby` and `gem` commands work.

Node.js provider (optional) ~
- Node.js: v21.5.0
- Nvim node.js host: /usr/lib/node_modules/neovim/bin/cli.js
- OK Latest "neovim" npm/yarn/pnpm package is installed: 4.10.1

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.0.3
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `cmake_tools` ~
- No healthcheck provided

Telescope Extension: `terms` ~
- No healthcheck provided

Telescope Extension: `themes` ~
- No healthcheck provided

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/fuxu/.local/state/nvim/lsp.log
- WARNING Log size: 101500 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/c.so
- OK Parser: cpp        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/cpp.so
- OK Parser: css        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/css.so
- OK Parser: html       ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/html.so
- OK Parser: javascript ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/javascript.so
- OK Parser: lua        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so
- OK Parser: markdown   ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/markdown_inline.so
- OK Parser: tsx        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/tsx.so
- OK Parser: typescript ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/typescript.so
- OK Parser: vim        ABI: 14, path: /home/fuxu/.local/share/nvim/lazy/nvim-treesitter/parser/vim.so

After looking at rplugin/python3/wilder/__init__.py it seems that executor is still None, I assume maybe _wilder_init isn't called, and I can be totally wrong.

How to solve it?

@Gerodote
Copy link
Author

Gerodote commented Jan 14, 2024

I've solved it.

How?

  1. Nvchad by default disables rplugin .

To fix this, in custom/chadrc.lua add M.lazy_nvim = require "file_name" , where "file_name" is file name which contains plugins.configs.lazy_nvim.lua , but with commented "rplugin" .

  1. Before this plugin start working, in ~/.local/share/nvim/rplugin.vim should exist some lines like:
call remote#host#RegisterPlugin('python3', '/home/fuxu/.local/share/nvim/lazy/wilder.nvim/rplugin/python3/wilder', [
      \ {'sync': v:true, 'name': '_wilder_python_basic_highlight', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_clap_filt', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_cpsm_filt', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': '_wilder_python_cpsm_highlight', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_difflib_sort', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_file_finder', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_fruzzy_filt', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_fuzzy_filt', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_fuzzywuzzy_sort', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': '_wilder_python_get_file_completion', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_get_help_tags', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_get_users', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': '_wilder_init', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': '_wilder_python_pcre2_highlight', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_search', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_sleep', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_lexical_sort', 'type': 'function', 'opts': {}},
      \ {'sync': 'urgent', 'name': '_wilder_python_uniq_filt', 'type': 'function', 'opts': {}},
     \ ])

But how to generate them?

:runtime! plugin/rplugin.vim

:UpdateRemotePlugins

Yep, that's stupid.

But then you should restart neovim. IDK why. It seems neovim just checks this file with rplugin stuff at startup.

  1. I incorrectly installed cpsm. There had to be bash ./install.sh command at build phase of cpsm plugin.

So, how I added it to Lazy?

  {
    "gelguy/wilder.nvim",
    dependencies = {
      { "Gerodote/fzy-lua-native_updated_gitignore_repaired_makefile", build = "make", lazy = false },
      { "nixprime/cpsm", dependencies = { "ctrlpvim/ctrlp.vim", lazy = false }, lazy = false, build = "bash ./install.sh" },
    },
    config = function()
      require "custom.configs.wilder"
    end,
    keys = { "/", "?", ":" },
    build = function()
      vim.cmd([[
        let &rtp=&rtp
      ]]
      )
      vim.api.nvim_command "runtime! plugin/rplugin.vim"
      vim.api.nvim_command ":UpdateRemotePlugins"
    end,
  },

And it seems to work after installing and reopening nvim.

@Gerodote Gerodote changed the title Trying to install wilder correctly, getting Unknown function _wilder_python_file_finder Trying to install wilder correctly for NvChad, getting Unknown function _wilder_python_file_finder Jan 30, 2024
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

1 participant