Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created May 4, 2023 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/d3fbc3dcdb59851489864cfc10695069 to your computer and use it in GitHub Desktop.
Save tshirtman/d3fbc3dcdb59851489864cfc10695069 to your computer and use it in GitHub Desktop.
function! ShowWindowNumbers()
for i in range(1, winnr('$'))
" Get the buffer and window associated with this number
let bufnr = winbufnr(i)
let winid = win_getid(i)
let figlet_output = system('figlet -f small ' . i )
let popup_content = split(figlet_output, "\n")
let popup_height = 5
let popup_width = 8
let row = win_screenpos(i)[0] + (winheight(i) - popup_height) / 2
let col = win_screenpos(i)[1] + (winwidth(i) - popup_width) / 2
let popup_options = {
\ 'win': winid,
\ 'wrap': 0,
\ 'maxheight': popup_height,
\ 'maxwidth': popup_width,
\ 'minheight': popup_height,
\ 'minwidth': popup_width,
\ 'line': row,
\ 'col': col,
\ 'time': 3000,
\ 'style': 'minimal',
\ 'title': 'Window ' . i,
\ 'border': [],
\ }
call popup_create(popup_content, popup_options)
endfor
endfunction
nnoremap <silent> <C-w>n :call ShowWindowNumbers()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment