]> git.sthu.org Git - vimconf.git/commitdiff
plugins: Add wilder
authorStefan Huber <shuber@sthu.org>
Mon, 15 Jul 2024 20:47:31 +0000 (22:47 +0200)
committerStefan Huber <shuber@sthu.org>
Thu, 18 Jul 2024 06:11:46 +0000 (08:11 +0200)
plugins-full.vim.example
plugins-midi.vim.example

index d1286f346f8a8f59489e55ceaf9fe03e3a397d53..a9ad6c40cf029fe822c9795efb9ce6e4163facda 100644 (file)
@@ -30,8 +30,6 @@ Plug 'Konfekt/vim-DetectSpellLang', {'do': 'spell'}
 
 Plug 'dpelle/vim-LanguageTool'
 
-Plug 'ryanoasis/vim-devicons', Cond($TERM != 'linux')
-
 Plug 'joom/latex-unicoder.vim'
 Plug 'chrisbra/unicode.vim'
 
@@ -64,7 +62,7 @@ function PluginsConfigFull()
 
     if has('nvim-0.5')
         lua <<EOF
-            require'nvim-treesitter.configs'.setup {
+            require("nvim-treesitter.configs").setup({
                 -- one of "all"
                 ensure_installed = {
                     "asm",
@@ -174,7 +172,7 @@ function PluginsConfigFull()
                         },
                     },
                 },
-            }
+            })
 EOF
 
         set foldmethod=expr
index 7b120b998d4cad581bcafbd9eecc9ba416931d75..0d40bfa9c467efbc2d3e04ffe9ae19eccda43459 100644 (file)
@@ -1,3 +1,17 @@
+" Required for wilder and mason
+Plug 'ryanoasis/vim-devicons', Cond($TERM != 'linux')
+
+if has('nvim')
+  function! UpdateRemotePlugins(...)
+    " Needed to refresh runtime files
+    let &rtp=&rtp
+    UpdateRemotePlugins
+  endfunction
+
+  Plug 'romgrk/fzy-lua-native'
+  Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') }
+endif
+
 Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}
 
 Plug 'jamessan/vim-gnupg'
@@ -44,6 +58,93 @@ function PluginsConfigMidi()
     let g:vim_markdown_auto_insert_bullets = 0
 
     let g:calendar_monday = 1
+
+    if has('nvim')
+        lua <<EOF
+            local wilder = require('wilder')
+            wilder.setup({modes = {':', '/', '?'}})
+
+            wilder.set_option('pipeline', {
+              wilder.branch(
+                wilder.python_file_finder_pipeline({
+                  debounce = 100,
+                  file_command = function(ctx, arg)
+                    -- If search pattern contains "." also search of hidden
+                    -- files. Otherwise, do not.
+                    if string.find(arg, '.') ~= nil then
+                      return {'fd', '-tf', '-H'}
+                    else
+                      return {'fd', '-tf'}
+                    end
+                  end,
+                  dir_command = {'fd', '-td'},
+                }),
+                wilder.substitute_pipeline({
+                  debounce = 50,
+                  pipeline = wilder.python_search_pipeline({
+                    skip_cmdtype_check = 1,
+                    pattern = wilder.python_fuzzy_pattern({
+                      start_at_boundary = 0,
+                    }),
+                  }),
+                }),
+                wilder.cmdline_pipeline({
+                  debounce = 50,
+                  fuzzy = 2,
+                  fuzzy_filter = wilder.lua_fzy_filter(),
+                }),
+                {
+                  wilder.check(function(ctx, x) return x == '' end),
+                  wilder.history(),
+                },
+                wilder.python_search_pipeline({
+                  debounce = 50,
+                  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',
+                ellipsis = '…',
+                empty_message = wilder.popupmenu_empty_message_with_spinner(),
+                highlighter = highlighters,
+                left = {
+                  ' ',
+                  wilder.popupmenu_devicons(),
+                  wilder.popupmenu_buffer_flags({
+                    flags = '%a-+',
+                  }),
+                },
+                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,
+            }))
+EOF
+    endif
 endfunction
 
 " vim:ft=vim