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

Feature: Option to override bufnew #153

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevintraver
Copy link

@kevintraver kevintraver commented Apr 23, 2024

Currently, the behavior of bufnew is managed by configuration settings. This enhancement introduces the ability to override this configuration, enabling the creation of distinct keymaps for controlling bufnew.

-- keymap for splitting without bufnew
keymap('n', '<c-l>', function()
    require('focus').split_nicely("", false)
end, { desc = 'split nicely' })

-- keymap for splitting with bufnew
keymap('n', '<c-s-l>', function()
    require('focus').split_nicely("", true)
end, { desc = 'split nicely (bufnew)' })

@cryptomilk
Copy link
Collaborator

cryptomilk commented Apr 23, 2024

Thank you very much for your contribution.

If we add this we should use an opts parameter passed to the function.

opts = {
  args = '',
  bufnew = true,
}

It would then look like this:

require('focus').split_nicely({ bufnew = true })

You could also make it backwards compatible by checking if the parameter is a string or table this way!

Also this would need to be backed by tests.

@kevintraver kevintraver marked this pull request as draft April 23, 2024 23:42
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.

None yet

2 participants