Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add ability to set tab name
  • Loading branch information
dylan-partly committed Nov 28, 2024
commit 0a769044ff8742e7f78068c9ebde45e33154a36d
7 changes: 7 additions & 0 deletions autoload/wintabs/renderers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ function! wintabs#renderers#buf_label(bufnr, config)
endfunction

function! wintabs#renderers#tab_label(tabnr)
if exists('*Wintabs_ui_tablabel')
let name = g:Wintabs_ui_tablabel(a:tabnr)
if !empty(name)
return name
endif
endif

let label = ''
if get(g:, 'loaded_taboo', 0)
let label = TabooTabTitle(a:tabnr)
Expand Down
20 changes: 20 additions & 0 deletions doc/wintabs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,26 @@ values: function
return file
endfunction

*g:Wintabs_ui_tablabel*
values: function
Function that generates the tab name
|g:wintabs_ui_vimtab_name_format|.
By default this uses the file name without any directories
('%:t').
You can use this, for example, to set a user configurable
tab name instead of using the buffer name / tab index.

function! g:Set_wintabs_tab_name()
let new_name = input('Tab name: ', get(t:, 'wintabs_custom_tab_name', ''))
let t:wintabs_custom_tab_name = new_name
endfunction
command! WintabsSetTabName call g:Set_wintabs_tab_name()

function! g:Wintabs_ui_tablabel(tabnr)
return gettabvar(a:tabnr, 'wintabs_custom_tab_name')
endfunction


*g:wintabs_ui_vimtab_name_format*
values: string
default: ' %n '
Expand Down