[nvim] Add peekaboo plugin to display registers
This commit is contained in:
parent
bd047962f8
commit
5f0c508ea8
2 changed files with 36 additions and 2 deletions
31
nvim/.config/nvim/plugin/vim-peekaboo.vim
Normal file
31
nvim/.config/nvim/plugin/vim-peekaboo.vim
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
" PLUGIN: vim-peekaboo
|
||||
let g:peekaboo_delay=500
|
||||
|
||||
function! CreateCenteredFloatingWindow()
|
||||
let width = float2nr(&columns * 0.6)
|
||||
let height = float2nr(&lines * 0.6)
|
||||
let top = ((&lines - height) / 2) - 1
|
||||
let left = (&columns - width) / 2
|
||||
let opts = {'relative': 'editor', 'row': top, 'col': left, '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)
|
||||
call 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)
|
||||
au BufWipeout <buffer> exe 'bw '.s:buf
|
||||
endfunction
|
||||
|
||||
if has('nvim-0.4.0') || has("patch-8.2.0191")
|
||||
let g:peekaboo_window = "call CreateCenteredFloatingWindow()"
|
||||
else " Fallback to a split window
|
||||
let g:peekaboo_window={"window": "vert bo 30new"}
|
||||
endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue