This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Description This tip could be included in the documentation for those interested in using neovim float term instead of a split:
" Floating window with borders for NNN and FFF
" https://github.com/neovim/neovim/issues/9718#issuecomment-559573308
function ! s: layout ()
let s: cwin = winnr ()
let height = &lines - (float2nr (&lines / 3 ))
let width = float2nr (&columns - (&columns / 3 ))
let row = (&lines / 2) - (height / 2 )
let column = (&columns / 2) - (width / 2 )
let opts = {
\ ' relative' : ' editor' ,
\ ' row' : row,
\ ' col' : column,
\ ' width' : width,
\ ' height' : height,
\ ' style' : ' minimal'
\ }
let top = ' ╭' . repeat (' ─' , width - 2 ) . ' ╮'
let mid = ' │' . repeat (' ' , width - 2 ) . ' │'
let bot = ' ╰' . repeat (' ─' , width - 2 ) . ' ╯'
let lines = [top ] + repeat ([mid], height - 2 ) + [bot]
let s: buf = nvim_create_buf (v: false , v: true )
call nvim_buf_set_lines (s: buf , 0 , -1 , v: true , lines )
let s: win = nvim_open_win (s: buf , v: true , opts)
set winhl= Normal :Floating
let opts.row += 1
let opts.height -= 2
let opts.col += 2
let opts.width -= 4
call nvim_open_win (nvim_create_buf (v: false , v: true ), v: true , opts)
augroup NNNGroup
autocmd !
au BufWipeout <buffer> exe ' bw ' .s: buf
au BufWipeout <buffer> exe s: cwin . ' wincmd w'
augroup END
endfunction
let g: fff #split = ' call ' . string (function (' <SID>layout' )) . ' ()' Reactions are currently unavailable
This tip could be included in the documentation for those interested in using neovim float term instead of a split: