nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.67k stars 91 forks source link

Keep <C-t> for action select_tab #250

Open sbeyer opened 1 year ago

sbeyer commented 1 year ago

Is your feature request related to a problem? Please describe. When I use telescope, I usually use <C-x>, <C-v> and <C-t> to open the selected file in a new split, vsplit, and tab respectively. These are telescope's default mappings that work with every other telescope extension (that I use). telescope-file-browser.nvim is the exception, because the mapping <C-t> is overridden to action change_cwd.

Describe the solution you'd like I would like, that <C-t> is kept as default select_tab action.

Describe alternatives you've considered Fortunately, telescope mappings are configurable. I fixed it via the configuration

      local actions = require "telescope.actions"
      local fb_actions = require("telescope").extensions.file_browser.actions
      require("telescope").setup {
        extensions = {
          file_browser = {
            mappings = {
              i = {
                ["<C-t>"] = actions.select_tab,
                ["<C-z>"] = fb_actions.change_cwd,
              },
              n = {
                t = actions.select_tab,
                z = fb_actions.change_cwd,
              },
            },
          },
        },
      }

However, I think this configuration should not be necessary, since default telescope mappings are overridden without necessity.

Additional context I accidentally issued this request in the wrong repository as nvim-telescope/telescope.nvim#2419 where @jamestrew replied that we will never agree on one correct mapping. I closed the issue (mainly since I was ashamed of having opened it in the wrong repo). But after thinking about the reply, I decided to re-open the issue -- now in the correct repo -- and add a rationale: I want to point out that there are default mappings of telescope. I think, the default mappings of any telescope extension should not override any of the telescope default mappings. Otherwise the telescope-file-browser.nvim user must write a mapping configuration just to be able to access all standard functionality. It sounds more user-friendly to me if the defaults allow you to access all standard functionality, so that configuration is only necessary when you actually want to change some standard behavior, not enable standard behavior.

jamestrew commented 1 year ago

I want to point out that there are default mappings of telescope. I think, the default mappings of any telescope extension should not override any of the telescope default mappings.

Yeah that's a valid point. If we could go back to the inception of the change_cwd mapping being created I'd probably do something different to avoid overriding the default mappings. Definitely worth considering going forward but at this point, unfortunately it would be a breaking change. And unless I see more widespread support for changing this mapping, I don't want to disrupt the current user base by making this change.

Thanks for bringing this up though. If more people continue to chime in on this, we can circle back and consider addressing this.

gegoune commented 1 year ago

I agree with @sbeyer and wouldn't mind small breaking changes to restore default mapping bringing more unified experience.

sbeyer commented 1 year ago

I never felt that breaking changes are a big issue in the rapidly evolving neovim ecosystem, where either users live with breaking changes all the time (which are btw also highlighted when doing plugin updates in Packer and lazy.nvim) or just pin their plugin versions. ;-) Also note that the <C-t>/t binding is only about one year old (see commit d9ce5d0d2a846b69f16886c6fe6c135c95e558de from 2022-01-05)

Moreover, the breaking change is only in a key mapping. If misused, there are no crazy consequences.

Yes, I'm only here to belittle the breaking change. 😇

IevgeniiB commented 1 year ago

Chiming in on this, keeping the mappings consistent across telescope plugins makes a lot of sense. Thank you for the configuration that can be used as a workaround!

rbmarliere commented 7 months ago

+1 on this. I'm coming from a pure netrw workflow since I started using telescope a lot more and having a different map to an action I'm so used to is simply not a good experience.

chanithecat commented 4 weeks ago

in normal mode, t calls change_cwd as expected but in insert mode, telescope's <C-t> is being called instead of change_cwd is that normal?