nvim-config

Log | Files | Refs | Submodules | README

floatting_win.vim (585B)


      1 function! FloatingCenteredWin() abort
      2     let buf = nvim_create_buf(v:false, v:true)
      3 
      4     " Adjust window size
      5     let height = float2nr(3 * &lines / 5)
      6     let width = float2nr(&columns - (&columns / 4))
      7     let col = float2nr((&columns - width) / 2)
      8 
      9     let opts = {
     10                 \ 'relative': 'editor',
     11                 \ 'row': &lines / 5,
     12                 \ 'col': col,
     13                 \ 'width': width,
     14                 \ 'height': height,
     15                 \ 'style' : 'minimal'
     16                 \ }
     17 
     18     " Create window
     19     let win = nvim_open_win(buf, v:true, opts)
     20 endfunction