Question about rendering floating window #368
Answered
by
MeanderingProgrammer
solomonwzs
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
MeanderingProgrammer
Mar 18, 2025
Replies: 1 comment 2 replies
-
Set the filetype after opening the buffer in a window: function! lib#debug#popup()
let lines = ['# abc', '## 123', '---', 'hello world']
let buf = nvim_create_buf(v:true, v:true)
call nvim_buf_set_lines(buf, 0, -1, v:false, lines)
let win = nvim_open_win(buf, v:false, {
\ 'width': 20,
\ 'height': 10,
\ 'col': 0,
\ 'row': 1,
\ 'relative': 'cursor',
\ })
call setbufvar(buf, '&buftype', 'nofile')
call setbufvar(buf, '&filetype', 'markdown')
endfunction You can keep the |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MeanderingProgrammer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the filetype after opening the buffer in a window:
You can keep the
buftype
where it is, I just moved both of them for consistency.