Set nowrap in repl and float windows

Seems to work better for variables where the `tostring` implementation
is long and repeats information also available in the structure display.
This commit is contained in:
Mathias Fussenegger 2024-05-22 20:10:07 +02:00 committed by Mathias Fußenegger
parent 884964dc7f
commit 083b9f33a7
2 changed files with 23 additions and 4 deletions

View file

@ -63,6 +63,11 @@ local function new_win(buf, winopts, wincmd)
api.nvim_command(wincmd or 'belowright split')
local win = api.nvim_get_current_win()
api.nvim_win_set_buf(win, buf)
if vim.fn.has("nvim-0.11") == 1 then
vim.wo[win][0].wrap = false
else
vim.wo[win].wrap = false
end
ui.apply_winopts(win, winopts)
return win
end

View file

@ -27,17 +27,22 @@ end
function M.new_cursor_anchored_float_win(buf)
vim.bo[buf].bufhidden = "wipe"
vim.bo[buf].filetype = "dap-float"
local opts = vim.lsp.util.make_floating_popup_options(50, 30, {border = 'single'})
local win = api.nvim_open_win(buf, true, opts)
vim.wo[win].scrolloff = 0
if vim.fn.has("nvim-0.11") == 1 then
vim.wo[win][0].scrolloff = 0
vim.wo[win][0].wrap = false
else
vim.wo[win].scrolloff = 0
vim.wo[win].wrap = false
end
vim.bo[buf].filetype = "dap-float"
return win
end
function M.new_centered_float_win(buf)
vim.bo[buf].bufhidden = "wipe"
vim.bo[buf].filetype = "dap-float"
local columns = vim.o.columns
local lines = vim.o.lines
local width = math.floor(columns * 0.9)
@ -51,7 +56,16 @@ function M.new_centered_float_win(buf)
height = height,
border = 'single',
}
return api.nvim_open_win(buf, true, opts)
local win = api.nvim_open_win(buf, true, opts)
if vim.fn.has("nvim-0.11") == 1 then
vim.wo[win][0].scrolloff = 0
vim.wo[win][0].wrap = false
else
vim.wo[win].scrolloff = 0
vim.wo[win].wrap = false
end
vim.bo[buf].filetype = "dap-float"
return win
end