From ffcdd3b1a3f856668e7ed5d3df77c468ca3dc313 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 2 Sep 2013 00:06:41 +0000 Subject: [PATCH] support change filename modifier. --- autoload/airline/extensions/tabline.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 8268a8d0..dc8259f3 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -1,6 +1,8 @@ " MIT License. Copyright (c) 2013 Bailey Ling. " vim: et ts=2 sts=2 sw=2 +let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.') + function! airline#extensions#tabline#init(ext) set tabline=%!airline#extensions#tabline#get() @@ -27,9 +29,9 @@ function! airline#extensions#tabline#get() for nr in range(1, bufnr('$')) if buflisted(nr) && bufexists(nr) if cur == nr - call b.add_section('airline_tablinesel', '%( %{fnamemodify(bufname('.nr.'), ":t")} %)') + call b.add_section('airline_tablinesel', '%( %{fnamemodify(bufname('.nr.'),"'.s:fmod.'")} %)') else - call b.add_section('airline_tabline', '%( %{fnamemodify(bufname('.nr.'), ":t")} %)') + call b.add_section('airline_tabline', '%( %{fnamemodify(bufname('.nr.'),"'.s:fmod.'")} %)') endif endif endfor @@ -57,6 +59,6 @@ endfunction function! airline#extensions#tabline#title(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) - return fnamemodify(bufname(buflist[winnr - 1]), ':p:.') + return fnamemodify(bufname(buflist[winnr - 1]), s:fmod) endfunction