Coder Social home page Coder Social logo

Comments (7)

AdeAttwood avatar AdeAttwood commented on August 23, 2024 1

I am not completely opposed to this. I am not a fan of the hole setup function, I would be OK with exposing the register_backend function so it can be used. Then find a way to disable the default backends that get registered.

The main goal for this will be to maintain simple API with minimal configure options. I have some time this weekend, so I will get the test suite moved over to busted and get some better tests added for the register backend.

from ivy.nvim.

arnevm123 avatar arnevm123 commented on August 23, 2024

Hi @AdeAttwood, is this something you want implemented?
If so I can have a crack at it 😄 -

from ivy.nvim.

arnevm123 avatar arnevm123 commented on August 23, 2024

Thanks!
For now I fixed this locally with this snippet:

vim.api.nvim_del_keymap("n", "<leader>p")
vim.api.nvim_del_keymap("n", "<leader>b")
vim.api.nvim_set_keymap("n", "<leader>p", '"+p', { noremap = true, silent = true })

And then I can also set new keymaps for Ivy itself with by making a ftplugin/ivy.lua in my config with a keymap like this:

vim.api.nvim_set_keymap(
	"n",
	"<esc>",
	"<cmd>lua vim.ivy.destroy()<CR>",
	{ noremap = true, silent = true, nowait = true }
)

from ivy.nvim.

arnevm123 avatar arnevm123 commented on August 23, 2024

Also a quick question:
With telescope I was using the fzf mode, this would allow me to search for the file foo/bar/test.lua with a search string like fo ba te. With Ivy I have to search for fobate, as spaces will not give me the result.

I suppose I will just have to kick the habit of typing spaces while searching?

And thanks a lot for this plugin, it works like a charm and looks really good!

from ivy.nvim.

AdeAttwood avatar AdeAttwood commented on August 23, 2024

@arnevm123 I have done a sample of what I think this API could look like. I would appreciate you taking it for a spin and letting me know if it will do what you want it to. I don't know if you will need to disable the lazy loading of the plugin.

With telescope I was using the fzf mode, this would allow me to search for the file foo/bar/test.lua with a search string like fo ba te. With Ivy I have to search for fobate, as spaces will not give me the result.

Yea when I move over to rust I went for a fuzzy lib rather than the old cpp algo that was adapted to work more like fzf. Currently, the word boundary needs to be the same to be a match. So instead of using spaces, you can use / to get a higher match. If you have the string foo/bar/test.lua the pattern fo/ba/te will score higher than fobate because you have the /b and /t matching the word boundary.

from ivy.nvim.

arnevm123 avatar arnevm123 commented on August 23, 2024

@AdeAttwood
I had a quick look and it seems like this does not work, as this now calls the setup twice, once at plugin/ivy.lua:20 and then a second time in my config.

---@param config IvySetupOptions
function ivy.setup(config)
  -- __AUTO_GENERATED_PRINT_VAR_START__
  print([==[ivy.setup config:]==], vim.inspect(config)) -- __AUTO_GENERATED_PRINT_VAR_END__
  print("ivy.setup")
  if has_setup then
    return
  end

  for _, backend in ipairs(config.backends) do
    register_backend(backend)
  end

  has_setup = true
end

Results in this:

ivy.setup config: {
  backends = { "ivy.backends.buffers", "ivy.backends.files", "ivy.backends.lines", "ivy.backends.lsp-workspace-symbols", "ivy.backends.rg" }
}
ivy.setup
ivy.setup config: {
  backends = { { "ivy.backends.files", {
        keymap = "<leader>fd"
      } } }
}
ivy.setup

I don't really see an easy way around this without exposing the setup function, but I can personally live with disabling and enabling keymaps 😄

Lazy loading did not really have an effect on this, as Lazy always loads the plugin which will always result in a call to the setup function. Once the code is loaded it calls the setup function.

from ivy.nvim.

AdeAttwood avatar AdeAttwood commented on August 23, 2024

@arnevm123, this one has been sorted in #81. I have also created a new ticket for the key map configuration.

from ivy.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.