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

Ability to use the default vim.ui.input based on filetype? #29

Closed
axieax opened this issue Mar 23, 2022 · 4 comments
Closed

Ability to use the default vim.ui.input based on filetype? #29

axieax opened this issue Mar 23, 2022 · 4 comments

Comments

@axieax
Copy link
Contributor

axieax commented Mar 23, 2022

Following nvim-tree/nvim-tree.lua#1097, vim.ui.input with the popup doesn't look very good on top of a NvimTree buffer. Is it possible to be able to specify default filetypes / conditions for disabling this UI tweak (e.g. just for NvimTree)?

@stevearc
Copy link
Owner

Tweaking the appearance for a specific filetype would be much easier than disabling it, so before I add that functionality I'd like to see if there's a way we can make it look better. What is currently the issue? Is it the placement? That's fairly easy to adjust. For example, to place it in the lower left of the editor:

require("dressing").setup({
  input = {
    override = function(opt)
      if vim.api.nvim_buf_get_option(0, "filetype") == "NvimTree" then
        opt.anchor = "SW"
        opt.col = 1
        opt.row = vim.o.lines - vim.o.cmdheight - 1
        opt.relative = "editor"
      end
    end,
  },
})

@axieax
Copy link
Contributor Author

axieax commented Mar 23, 2022

I mean the default vim.ui.input is in the command mode bar (so no popup is what I'm trying to achieve).

@stevearc
Copy link
Owner

I've added the ability to change enabled on the fly using get_config

require("dressing").setup({
  input = {
    get_config = function()
      if vim.api.nvim_buf_get_option(0, "filetype") == "NvimTree" then
        return { enabled = false }
      end
    end,
  },
})

@axieax
Copy link
Contributor Author

axieax commented Mar 24, 2022

Works like a charm! Thanks for spending the extra time to implement this :))

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

2 participants