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: add skip_toggle option to ignore some opened terminals when toggling #530

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tanloong
Copy link

@tanloong tanloong commented Jan 3, 2024

This adds a skip_toggle option to allow users skip specific terminals when toggling. A use case is when using the file explorer lf.nvim which is based on toggleterm.nvim. A common scenario on my side is that there are two hidden terminals, an Lf terminal and a Shell terminal, where I hope the Shell terminal always shows up on ToggleTerm, even though it is not the last toggled one.

With the skip_toggle this behavior can be achieved:

toggleterm.setup({
    open_mapping = [[<m-=>]],
    skip_toggle = function(t)
        return t and t.cmd and vim.startswith(t.cmd, "lf ")
    end,
}
simplescreenrecorder-2024-01-03_22.21.51.mp4

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.

1 participant