nvim-dap-ui
nvim-dap-ui copied to clipboard
`cmdheight` gets overridden to 1 upon nvim-dap-ui starts
I have cmdheight=2
as default and however nvim-dap-ui sets it to 1. I don't have this issue if I use nvim-dap without nvim-dap-ui.
My nvim-dap/-ui config:
" nvim-dap
if has('nvim')
lua << EOF
local dap, dapui = require('dap'), require('dapui')
require('dap-go').setup()
dapui.setup()
vim.fn.sign_define('DapBreakpoint', { text='●', texthl='', linehl='debugBreakpoint', numhl='debugBreakpoint' })
vim.fn.sign_define('DapBreakpointCondition', { text='◆', texthl='', linehl='debugBreakpoint', numhl='debugBreakpoint' })
vim.fn.sign_define('DapStopped', { text='▶', texthl='', linehl='debugPC', numhl='debugPC' })
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
EOF
function! s:dap_ui_evaluate(expression) abort
let escaped_expression = escape(a:expression, '"\')
execute 'lua require("dapui").eval("' . l:escaped_expression . '")'
endfunction
command! -nargs=1 DapEvaluate :call <SID>dap_ui_evaluate(<f-args>)
nnoremap <silent> <F5> :lua require('dap').continue()<CR>
nnoremap <silent> <F17> :lua require('dap').reverse_continue()<CR>
nnoremap <silent> <leader><F5> :lua require('dap').run_to_cursor()<CR>
nnoremap <silent> <F10> :lua require('dap').step_over()<CR>
nnoremap <silent> <F22> :lua require('dap').step_back()<CR>
nnoremap <silent> <F11> :lua require('dap').step_into()<CR>
nnoremap <silent> <F23> :lua require('dap').step_out()<CR>
nnoremap <silent> <F6> :lua require('dap').pause()<CR>
nnoremap <silent> <F9> :lua require('dap').toggle_breakpoint()<CR>
nnoremap <silent> <leader><F9> :lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
nnoremap <silent> <F33> :lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
nnoremap <silent> <M-S-F9> :lua require('dap').clear_breakpoints()<CR>
nnoremap <silent> <M-S-F10> :lua require('dap').terminate()<CR>
nnoremap <silent> <leader>e :lua require('dapui').eval()<CR>
xnoremap <silent> <leader>e <Cmd>lua require('dapui').eval()<CR>
nnoremap <leader>E :DapEvaluate<space>
autocmd FileType dap-float nnoremap <silent> q :q<CR>
autocmd FileType dap-repl lua require('dap.ext.autocompl').attach()
endif
Neovim version:
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Ah I see why this is happening, I'll have to tinker around to prevent this
Tried to find a way to handle this without just resetting the value but doesn't seem possible with how NeoVim handles resizing windows. Added a fix in latest commit to just reset after opening/closing the windows
When I toggle the UI several times with the latest version, I notice that the "DAP Watches" and repl split shrink if I have cmdheight=2
. I'm assuming this bug is related.
Here's a recording of it:
![](https://i.imgur.com/rB16aAE.gif)
This is not related AFAIK to the cmdheight fix but is due to the way the window sizing logic works. There can rounding issues. Although I haven't solved the underlying problem, you can use the reset
argument to the open
and toggle
functions. Related issue https://github.com/rcarriga/nvim-dap-ui/issues/116
Also closing this issue as it's been solved.