Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lua/bugabinga/fuzzy_find.lua

Raw
local puk = require 'std.puk'
local icon = require 'std.icon'
local map = require 'std.map'

puk.defer 'mini.pick' (function(pick)
  local extra = puk 'mini.extra'
  pick.setup {
    options = {
      -- Whether to show content from bottom to top
      content_from_bottom = true,

      -- Whether to cache matches (more speed and memory on repeated prompts)
      use_cache = true,
    },
    window = {
      -- String to use as caret in prompt
      prompt_caret = icon.prompt_caret .. ' ',

      -- String to use as prefix in prompt
      prompt_prefix = icon.prompt_prefix .. ' ',
    },
  }

  map.normal {
    description = 'find files',
    command = pick.builtin.files,
    keys = '<leader>ff',
    category = 'fuzzy'
  }

	--TODO: improve these picker by being able to pipe their results to quicklist or loclist
	--TODO: add picker for other stuff: highlights, help, registers,...
	
  map.normal {
    description = 'live grep',
    command = pick.builtin.grep_live,
    keys = '<leader>fg',
    category = 'fuzzy'
  }

  map.normal {
    description = 'find symbols',
    command = function() extra.pickers.lsp { scope = 'document_symbol' } end,
    keys = '<leader>fs',
    category = 'fuzzy'
  }

  map.normal {
    description = 'find highlight groups',
    command = extra.pickers.hl_groups,
    keys = '<leader>fl',
    category = 'fuzzy'
  }

  map.normal {
    description = 'find spellsuggests',
    command = extra.pickers.spellsuggest,
    keys = '<leader>fz',
    category = 'fuzzy'
  }

  map.normal {
    description = 'find keymaps',
    command = extra.pickers.keymaps,
    keys = '<leader>fk',
    category = 'fuzzy'
  }

  map.normal {
    description = 'find marks',
    command = extra.pickers.marks,
    keys = '<leader>fm',
    category = 'fuzzy'
  }
end)