-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvimrc-statusline
More file actions
196 lines (177 loc) · 6.95 KB
/
vimrc-statusline
File metadata and controls
196 lines (177 loc) · 6.95 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
set laststatus=2
if has('statusline')
" Status line detail: (from Rafael Garcia-Suarez)
" %f file path
" %y file type between braces (if defined)
" %([%R%M]%) read-only, modified and modifiable flags between braces
" %{'!'[&ff=='default_file_format']}
" shows a '!' if the file format is not the platform
" default
" %{'$'[!&list]} shows a '*' if in list mode
" %{'~'[&pm=='']} shows a '~' if in patchmode
" (%{synIDattr(synID(line('.'),col('.'),0),'name')})
" only for debug : display the current syntax item name
" %= right-align following items
" #%n buffer number
" %l/%L,%c%V line number, total number of lines, and column number
"function! SetStatusLineStyle()
" if &stl == '' || &stl =~ 'synID'
" let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}" .
" \"%{'~'[&pm=='']}" .
" \"%=#%n %l/%L,%c%V " .
" \"git:%{call GitBranch()}"
" else
" let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}" .
" \" (%{synIDattr(synID(line('.'),col('.'),0),'name')})" .
" \"%=#%n %l/%L,%c%V "
" endif
"endfunc
"call SetStatusLineStyle()
if has("ruby")
let g:git_branch_status_head_current=1
let g:git_branch_status_ignore_remotes=1
let g:git_branch_status_text=""
function! SetStatusLineStyle()
let &stl="%f %y " .
\"%([%R%M]%)" .
\"%#StatusLineNC#%{&ff=='unix'?'':&ff.'\ format'}%*" .
\"%{'$'[!&list]}" .
\"%{'~'[&pm=='']}" .
\"%=" .
\"#%n %l/%L,%c%V " .
\"git:%{GitBranchInfoString()} "
"\"%{rvm#statusline()} " .
" \"%#StatusLineNC#%{GitBranchInfoString()}%* " .
endfunc
else
function! SetStatusLineStyle()
let &stl="%f %y " .
\"%([%R%M]%)" .
\"%#StatusLineNC#%{&ff=='unix'?'':&ff.'\ format'}%*" .
\"%{'$'[!&list]}" .
\"%{'~'[&pm=='']}" .
\"%=" .
\"#%n %l/%L,%c%V "
endfunc
end
call SetStatusLineStyle()
if has('title')
set titlestring=%t%(\ [%R%M]%)
endif
"highlight StatusLine ctermfg=White ctermbg=DarkBlue cterm=bold
"highlight StatusLineNC ctermfg=White ctermbg=DarkBlue cterm=NONE
endif
"set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" Themes: powerline, wombat, jellybeans, solarized,
let g:lightline = {
\ 'colorscheme': 'powerline',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode',
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! MyModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! MyReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
function! MyFugitive()
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : ''
endif
return ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! MyFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! MyMode()
return winwidth(0) > 60 ? lightline#mode() : ''
endfunction
" let g:lightline = {
" \ 'colorscheme': 'landscape',
" \ 'mode_map': { 'c': 'NORMAL' },
" \ 'active': {
" \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
" \ },
" \ 'component_function': {
" \ 'modified': 'MyModified',
" \ 'readonly': 'MyReadonly',
" \ 'fugitive': 'MyFugitive',
" \ 'filename': 'MyFilename',
" \ 'fileformat': 'MyFileformat',
" \ 'filetype': 'MyFiletype',
" \ 'fileencoding': 'MyFileencoding',
" \ 'mode': 'MyMode',
" \ },
" \ 'separator': { 'left': '⮀', 'right': '⮂' },
" \ 'subseparator': { 'left': '⮁', 'right': '⮃' }
" \ }
"
" function! MyModified()
" return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
" endfunction
"
" function! MyReadonly()
" return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
" endfunction
"
" function! MyFilename()
" return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
" \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
" \ &ft == 'unite' ? unite#get_status_string() :
" \ &ft == 'vimshell' ? vimshell#get_status_string() :
" \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
" \ ('' != MyModified() ? ' ' . MyModified() : '')
" endfunction
"
" function! MyFugitive()
" if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
" let _ = fugitive#head()
" return strlen(_) ? '⭠ '._ : ''
" endif
" return ''
" endfunction
"
" function! MyFileformat()
" return winwidth(0) > 70 ? &fileformat : ''
" endfunction
"
" function! MyFiletype()
" return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
" endfunction
"
" function! MyFileencoding()
" return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
" endfunction
"
" function! MyMode()
" return winwidth(0) > 60 ? lightline#mode() : ''
" endfunction