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

Add option to prevent switching splits when executing e.g. RustLsp 'run' #560

Open
mjrogozinski opened this issue Nov 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mjrogozinski
Copy link

Feature description

Whenever e.g. vim.cmd.RustLsp 'run' is executed, the focus changes to the newly open split with results.

I mitigate with with defer_fn. It's not pretty and it does not work when one has to e.g. select a testable (because of the timeout duration).

local function switch_to_previous_split()
  vim.defer_fn(function()
    vim.cmd 'wincmd w'
  end, 100)
end

vim.keymap.set('n', '<leader>x', function()
  vim.cmd.RustLsp 'run'
  switch_to_previous_split()
end, in_current_buffer.with_desc 'Rust run')

It would be nice to have an option like vim.cmd.RustLsp { 'run', pinned = true } to prevent focus changing.

@mjrogozinski mjrogozinski added the enhancement New feature or request label Nov 3, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Nov 3, 2024

hey 👋

the default termopen executor is very basic and doesn't have a lot of features.
If you want something more configurable, I recommend using the toggleterm executor (if you have toggleterm installed).
See :h rustaceanvim.config for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants