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

Allow actions.open_qflist to utilize split modifiers like :botright, :rightbelow, etc #2142

Closed
cptchuckles opened this issue Aug 22, 2022 · 3 comments · Fixed by #2554
Closed
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@cptchuckles
Copy link

Is your feature request related to a problem? Please describe.
I use simrat39/symbols-outline and noticed that when I have a three-column window layout going on, invoking telescope.acitons.open_qflist will open the quickfix list in a split window under the last opened vertical window, which (in my use-case) means that it's inconveniently squished in the lower-right corner, under my symbol outliner (fig. 1)

Compare this to how the quickfix list opens when invoking :lua vim.diagnostic.setqflist({open=true}) (fig.2)

I found out that vim.diagnostic.setqflist invokes :botright copen, whereas telescope.actions.open_qflist invokes just :copen. Using :botright causes the next command to open a window that spans the whole neovim window, which in my opinion is vastly preferable in this case, since quickfix items tend to be long, and I can't read them when they end up in the corner. Unfortunately there is no way to cause Telescope to use :botright copen, or any other kind of split modifier like :rightbelow, :topleft, etc.

Describe the solution you'd like
I would like actions.open_qflist to accept an opts table with a property that tells it whether to use a split-modifying command or not, and which one.

Describe alternatives you've considered
I could just keep moving the window that opens but that gets annoying.

Additional context
fig.1: quickfix list opened in the lower-right corner after invoking actions.open_qflist:
fig.1: quickfix list opened in the lower-right corner
(note: in the above example, the center window was the last to have been focused before opening telescope)

fig.2: quickfix list opened across the bottom of Neovim, since it was opened via :botright copen:
quickfix list opened across the bottom of neovim via :botright copen

@cptchuckles cptchuckles added the enhancement Enhancement to performance, inner workings or existent features label Aug 22, 2022
@DasOhmoff
Copy link

I think so too. Also it should be an easy fix maybe

@juhaku
Copy link

juhaku commented Nov 29, 2022

This behavior can be achieved with really easy workaround in your own telescope configs.

local telescope_actions = require("telescope.actions")

local function send_to_quickfix(promtbufnr)
   telescope_actions.smart_send_to_qflist(promtbufnr)
   vim.cmd([[botright copen]])
end

telescope.setup({
  defaults = {
    mappings = {
      ["n"] = {
        ["<C-q>"] = send_to_quickfix,
      },
       ["i"] = {
         ["<C-q>"] = send_to_quickfix,
       },
     },
  },
})

@Myzel394
Copy link

@juhaku this doesn't seem to be working anymore :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants