-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvimrc-ui.vim
81 lines (70 loc) · 2.37 KB
/
vimrc-ui.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
if has("gui_running")
" GUI is running or is about to start.
" Maximize GVim window.
" set lines=37 columns=135
" remove the menu bar
set guioptions-=m
" and remove the toolbar
set guioptions-=T
" and enable the horizontal scrollbar
"set guioptions+=b
" and remove the vertical scrollbar
set guioptions-=r
" no left scrollbar
set guioptions-=L
" use console style dialogs
set guioptions+=c
" but always show the tabline (window otherwise resizes when first showing tabline)
" set showtabline=2
set showtabline=1
if has("win32") || has("win64")
set guifont=Consolas:h10:cANSI
else
" set guifont=Hack
let &guifont="0xProto 10"
endif
endif
" helper function for titlestring. Returns the name of the current
" session, if any is loaded, or an empty string when no session is loaded
function! TitleCurrentSession()
if exists('g:LAST_SESSION')
return g:LAST_SESSION.': '
else
return ''
endif
endfunction
" title string
set titlestring= " completely reset titlestring
set titlestring+=%{TitleCurrentSession()} " get the name of the current session, if available
set titlestring+=%t " the current filename
set titlestring+=%(\ %M%) " modified flag
set titlestring+=%(\ (%{expand(\"%:~:h\")})%) " relative path to current file
set titlestring+=%(\ %a%) " extra attributes
function! TabLabelName(n)
let buflist = tabpagebuflist(a:n)
let bufnam = bufname(buflist[tabpagewinnr(a:n) - 1])
return substitute(bufnam, '.*/', '', '') " get basename of the buffer
endfunction
function TabLabelProperties()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
let label = ' ('.wincount.')'
endif
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label .= ' [+]'
break
endif
endfor
" Append the buffer name
return label
endfunction
function! MyGuiTabLine()
let s = '#%N%{TabLabelProperties()}: %{TabLabelName(' . tabpagenr() . ')} '
return s
endfunction
set guitablabel=%!MyGuiTabLine()