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

feat(command-modifiers): add command-modifiers to the toggle() and open() APIs #24

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

serranomorante
Copy link
Contributor

@serranomorante serranomorante commented Sep 11, 2024

With this PR, now one could do:

require("quicker").toggle({ open_cmd_mods = { split = "botright" } })
require("quicker").open({ open_cmd_mods = { split = "botright" } })

An alternative to this PR is using the following autocmd.

local init = function()
  vim.api.nvim_create_autocmd("FileType", {
    desc = "Open quickfix list globally",
    group = vim.api.nvim_create_augroup("quickfix_toggle", { clear = true }),
    pattern = "qf",
    command = "wincmd J",
  })
end

@github-actions github-actions bot requested a review from stevearc September 11, 2024 18:28
Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the things that's confusing about this is that if you pass in the open_cmd the loclist parameter is partially ignored. What do you think about instead passing in open_cmd_mods which is a table of the modifiers that can be passed to the command (see :help nvim_parse_cmd)? There's already a type defined for this table.

@github-actions github-actions bot requested a review from stevearc September 12, 2024 21:30
@serranomorante
Copy link
Contributor Author

Thanks for looking at it! I did the changes and updated the description 👍

…`open()` APIs

With this PR, now one could do:

```lua
require("quicker").toggle({ open_cmd_mods = { split = "botright" } })
require("quicker").open({ open_cmd_mods = { split = "botright" } })
```

An alternative to this PR is using the following autocmd.

```lua
local init = function()
  vim.api.nvim_create_autocmd("FileType", {
    desc = "Open quickfix list globally",
    group = vim.api.nvim_create_augroup("quickfix_toggle", { clear = true }),
    pattern = "qf",
    command = "wincmd J",
  })
end
```
@serranomorante serranomorante changed the title feat(open_cmd): add open_cmd option to toggle() and open() APIs feat(command-modifiers): add command-modifiers to the toggle() and open() APIs Sep 12, 2024
@stevearc
Copy link
Owner

LGTM thanks for the PR!

@stevearc stevearc merged commit 95a839f into stevearc:master Sep 13, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants