nvim-dap-ui icon indicating copy to clipboard operation
nvim-dap-ui copied to clipboard

How to change focus for all float_element()'s by default?

Open Fabian-programmer opened this issue 1 year ago • 5 comments

Hey,

I'm not sure if its intended or not, but when I start

require("dapui").float_element()

I can select following elements:

grafik

When I select repl or console it sets the focus inside the floating window. For anything else the focus stays outside. Now my problem is, when I move my cursor the floating window disappears. Currently I have to actively click into the floating window to keep it and do my work in there.

In the documentation, there is an enter attribute:

require('dapui').float_element('all elements', { enter = true })

but it is only possible to use it for a specific element? I would like to have it for all elements. I tried {} and '' as element argument but both didn't work.

Is there an option, I am missing?

Thank you!

Fabian-programmer avatar May 04 '23 13:05 Fabian-programmer

but it is only possible to use it for a specific element? I would like to have it for all elements. I tried {} and '' as element argument but both didn't work.

I don't understand what you mean by have it for all elements instead of a specific one. Do you mean you want to open a window for each element?

rcarriga avatar May 07 '23 09:05 rcarriga

I would like to use the picker for the elements.

require("dapui").float_element()

But for each element, I pick, the same behavior. Whereas the behavior is, that the cursor is set into the floating window of the element, when picked.

This behavior is currently only possible for the repl and console element.

Fabian-programmer avatar May 07 '23 10:05 Fabian-programmer

I've found for myself a minimalistic solution :

dapui/init.lua#L138 + args.enter = true

if you @rcarriga want this line of code in your repo I can create a PR with a config parameter instead of true.

another option would be to add for each element float_defaults with enter = true;

breakpoints.lua

function dapui.elements.breakpoints.float_defaults()
  return { enter = true }
end

or change the default behaviour in the window manager, if the keyval settings.enter is not available enter by default: windows/init.lua

but these 2 other options are tooo intrusive for this small change :)

Fabian-programmer avatar May 21 '23 14:05 Fabian-programmer

@Fabian-programmer did you come up with a more sustainable fix for this? I use floats wit Eval a lot, would love this feature.

hristod avatar Oct 24 '23 12:10 hristod

Nope, just the suggestions above, but was waiting for an answer. And forgot that this issue ticket even existed :)

Fabian-programmer avatar Oct 25 '23 16:10 Fabian-programmer

but it is only possible to use it for a specific element? I would like to have it for all elements. I tried {} and '' as element argument but both didn't work.

@Fabian-programmer try nil

require('dapui').float_element(nil, {enter = true})

ciganandrea avatar Feb 05 '24 08:02 ciganandrea

This works perfectly thank you @ciganandrea !!

Fabian-programmer avatar Feb 08 '24 21:02 Fabian-programmer