Skip to content
Browse files

Trying out vim-tomdoc

  • Loading branch information...
1 parent e36b00d commit 9d8c29a818da3c3cedc0c9888a852ca4951b7bb6 @theIV committed Mar 1, 2012
Showing with 906 additions and 386 deletions.
  1. +0 −9 vim/bundle/L9/doc/tags-ja
  2. +1 −1 vim/bundle/delimitMate/README
  3. +21 −19 vim/bundle/delimitMate/autoload/delimitMate.vim
  4. +1 −1 vim/bundle/delimitMate/doc/delimitMate.txt
  5. +3 −3 vim/bundle/delimitMate/plugin/delimitMate.vim
  6. +12 −0 vim/bundle/delimitMate/test/expand_cr.txt
  7. +42 −0 vim/bundle/delimitMate/test/expand_cr.vim
  8. +9 −2 vim/bundle/gist-vim/autoload/gist.vim
  9. +196 −161 vim/bundle/tagbar/autoload/tagbar.vim
  10. +60 −32 vim/bundle/tagbar/doc/tagbar.txt
  11. +28 −2 vim/bundle/vim-powerline/README.rst
  12. +69 −7 vim/bundle/vim-powerline/autoload/Pl.vim
  13. +1 −17 vim/bundle/vim-powerline/autoload/Pl/Colorscheme.vim
  14. +74 −38 vim/bundle/vim-powerline/autoload/Pl/Hi.vim
  15. +11 −7 vim/bundle/vim-powerline/autoload/Pl/Match.vim
  16. +3 −1 vim/bundle/vim-powerline/autoload/Pl/Parser.vim
  17. +3 −3 vim/bundle/vim-powerline/autoload/Pl/Segment.vim
  18. +15 −2 vim/bundle/vim-powerline/autoload/Pl/Theme.vim
  19. +161 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/default.vim
  20. +0 −41 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/distinguished.vim
  21. +15 −5 vim/bundle/vim-powerline/autoload/Powerline/Functions.vim
  22. +2 −1 vim/bundle/vim-powerline/autoload/Powerline/Matches.vim
  23. +5 −4 vim/bundle/vim-powerline/autoload/Powerline/Segments.vim
  24. +2 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/cfi.vim
  25. +10 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
  26. +2 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/ft_man.vim
  27. +2 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/fugitive.vim
  28. +3 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/rvm.vim
  29. +2 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/syntastic.vim
  30. +2 −2 vim/bundle/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
  31. +26 −1 vim/bundle/vim-powerline/autoload/Powerline/Themes/{distinguished.vim → default.vim}
  32. +8 −4 vim/bundle/vim-powerline/doc/Powerline.txt
  33. +9 −2 vim/bundle/vim-powerline/plugin/Powerline.vim
  34. +2 −2 vim/bundle/vim-rails/autoload/rails.vim
  35. +9 −9 vim/bundle/vim-ruby/syntax/ruby.vim
  36. +11 −0 vim/bundle/vim-tomdoc/README.md
  37. +47 −0 vim/bundle/vim-tomdoc/plugin/tomdoc.vim
  38. +1 −0 vim/bundle/vim-tomdoc/templates/attr_accessor.txt
  39. +1 −0 vim/bundle/vim-tomdoc/templates/attr_reader.txt
  40. +1 −0 vim/bundle/vim-tomdoc/templates/attr_writer.txt
  41. +9 −0 vim/bundle/vim-tomdoc/templates/class-or-module.txt
  42. +1 −0 vim/bundle/vim-tomdoc/templates/constant.txt
  43. +25 −0 vim/bundle/vim-tomdoc/templates/method.txt
  44. +1 −0 vim/update_bundles
View
9 vim/bundle/L9/doc/tags-ja
@@ -1,9 +0,0 @@
-!_TAG_FILE_ENCODING utf-8 //
-l9 l9.jax /*l9*
-l9-about l9.jax /*l9-about*
-l9-author l9.jax /*l9-author*
-l9-contact l9.jax /*l9-contact*
-l9-installation l9.jax /*l9-installation*
-l9-introduction l9.jax /*l9-introduction*
-l9-usage l9.jax /*l9-usage*
-l9.txt l9.jax /*l9.txt*
View
2 vim/bundle/delimitMate/README
@@ -1,3 +1,3 @@
This plug-in provides automatic closing of quotes, parenthesis, brackets, etc., besides some other related features that should make your time in insert mode a little bit easier, like syntax awareness (will not insert the closing delimiter in comments and other configurable regions), visual wrapping, <CR> and <Space> expansions (off by default), and some more.
-Most of the features can be modified or disabled permanently, using global variables, or on a FileType basis, using :autocmd. With a couple of exceptions and limitations, this features don't brake undo, redo or history.
+Most of the features can be modified or disabled permanently, using global variables, or on a FileType basis, using :autocmd. With a couple of exceptions and limitations, these features don't brake undo, redo or history.
View
40 vim/bundle/delimitMate/autoload/delimitMate.vim
@@ -405,11 +405,10 @@ function! delimitMate#ExpandReturn() "{{{
if delimitMate#WithinEmptyPair()
" Expand:
call delimitMate#FlushBuffer()
- let char = delimitMate#GetCharFromCursor(0)
- "return "\<Esc>a\<CR>x\<CR>\<Esc>k$\"_xa"
- "return "\<Esc>a\<CR>\<UP>\<Esc>o"
- call feedkeys("\<Esc>a\<Del>\<Esc>ox\<BS>\<CR>".char."\<Esc>kA", 't')
- return ''
+
+ " Not sure why I used the previous combos, but I'm sure somebody will tell
+ " me about it.
+ return "\<Esc>a\<CR>\<Esc>O"
else
return "\<CR>"
endif
@@ -488,6 +487,15 @@ endfunction " }}}
" Tools: {{{
function! delimitMate#TestMappings() "{{{
+ if &modified
+ echohl WarningMsg
+ let answer = input("Modified buffer, type \"yes\" to write and proceed with test: ") !~ '\c^yes$'
+ echohl NONE
+ if answer != '\c^yes$'
+ return
+ endif
+ write
+ endif
let options = sort(keys(delimitMate#OptionsList()))
let optoutput = ['delimitMate Report', '==================', '', '* Options: ( ) default, (g) global, (b) buffer','']
for option in options
@@ -512,24 +520,18 @@ function! delimitMate#TestMappings() "{{{
\ b:_l_delimitMate_left_delims +
\ b:_l_delimitMate_quotes_list
- let ibroken = []
+ let imappings = []
for map in imaps
- if maparg(map, "i") !~? 'delimitMate'
- let output = ''
- if map == '|'
- let map = '<Bar>'
- endif
- redir => output | execute "verbose imap ".map | redir END
- let ibroken = ibroken + [map.": is not set:"] + split(output, '\n')
+ let output = ''
+ if map == '|'
+ let map = '<Bar>'
endif
+ redir => output | execute "verbose imap ".map | redir END
+ let imappings = imappings + split(output, '\n')
endfor
unlet! output
- if ibroken == []
- let output = ['* Mappings:', '', 'All mappings were set-up.', '--------------------', '', '']
- else
- let output = ['* Mappings:', ''] + ibroken + ['--------------------', '']
- endif
+ let output = ['* Mappings:', ''] + imappings + ['--------------------', '']
call append('$', output+['* Showcase:', ''])
" }}}
if b:_l_delimitMate_autoclose
@@ -594,7 +596,7 @@ function! delimitMate#TestMappings() "{{{
call append(line('$'), '')
endfor
endif "}}}
- redir => setoptions | set | filetype | redir END
+ redir => setoptions | set | filetype | version | redir END
call append(line('$'), split(setoptions,"\n")
\ + ['--------------------'])
setlocal nowrap
View
2 vim/bundle/delimitMate/doc/delimitMate.txt
@@ -257,7 +257,7 @@ Default: Comment ~
This options turns delimitMate off for the listed regions, read |group-name|
for more info about what is a region.
e.g.: >
- let delimitMate_excluded_regions = "Comments,String"
+ let delimitMate_excluded_regions = "Comment,String"
<
------------------------------------------------------------------------------
*'delimitMate_excluded_ft'*
View
6 vim/bundle/delimitMate/plugin/delimitMate.vim
@@ -193,7 +193,7 @@ endfunction " }}} s:Unmap()
function! s:TestMappingsDo() "{{{
%d
if !exists("g:delimitMate_testing")
- silent call delimitMate#TestMappings()
+ call delimitMate#TestMappings()
else
let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
for i in [0,1]
@@ -397,7 +397,7 @@ function! s:ExtraMappings() "{{{
" The following simply creates an ambiguous mapping so vim fully processes
" the escape sequence for terminal keys, see 'ttimeout' for a rough
" explanation, this just forces it to work
- if !has('gui_running')
+ if !has('gui_running') && (!exists('g:delimitMate_no_esc_mapping') || !g:delimitMate_no_esc_mapping)
imap <silent> <C-[>OC <RIGHT>
endif
endfunction "}}}
@@ -412,7 +412,7 @@ call s:DelimitMateDo()
command! -bar DelimitMateReload call s:DelimitMateDo(1)
" Quick test:
-command! -bar DelimitMateTest silent call s:TestMappingsDo()
+command! -bar DelimitMateTest call s:TestMappingsDo()
" Switch On/Off:
command! -bar DelimitMateSwitch call s:DelimitMateSwitch()
View
12 vim/bundle/delimitMate/test/expand_cr.txt
@@ -0,0 +1,12 @@
+#
+%d
+filetype indent on
+set bs=2 et sts=4 sw=4 ft=javascript
+call setline(1, '$(document).ready(function() {})')
+DelimitMateReload
+exec "normal 31|i\<CR>x\<Esc>"
+================================================================================
+$(document).ready(function() {
+ x
+})
+--------------------------------------------------------------------------------
View
42 vim/bundle/delimitMate/test/expand_cr.vim
@@ -0,0 +1,42 @@
+let g:delimitMate_expand_cr = 1
+"DelimitMateReload
+let lines = readfile(expand('<sfile>:t:r').'.txt')
+call vimtest#StartTap()
+let testsnumber = len(filter(copy(lines), 'v:val =~ ''^=\{80}$'''))
+call vimtap#Plan(testsnumber)
+let tcount = 1
+let expect = 0
+let evaluate = 0
+for item in lines
+ if item =~ '^=\{80}$'
+ let expect = 1
+ let expected = []
+ continue
+ endif
+
+ if item =~ '^#\|^\s*$' && expect == 0
+ " A comment or empty line.
+ continue
+ endif
+ if ! expect
+ " A command.
+ exec item
+ call vimtap#Diag(item)
+ continue
+ endif
+ if item =~ '^-\{80}$'
+ let expect = 0
+ endif
+ if expect
+ call add(expected, item)
+ continue
+ endif
+ let lines = getline(1, line('$'))
+ let passed = lines == expected
+ echom string(lines)
+ echom string(expected)
+ call vimtap#Ok(passed, string(expected) .
+ \ (passed ? ' =' : ' !') . '= ' . string(lines))
+ let tcount += 1
+endfor
+call vimtest#Quit()
View
11 vim/bundle/gist-vim/autoload/gist.vim
@@ -1,7 +1,7 @@
"=============================================================================
" File: gist.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 31-Jan-2012.
+" Last Change: 25-Feb-2012.
" Version: 5.9
" WebPage: http://github.com/mattn/gist-vim
" License: BSD
@@ -127,6 +127,10 @@ if !exists('g:gist_curl_options')
let g:gist_curl_options = ""
endif
+if !exists('g:gist_keep_selection')
+ let g:gist_keep_selection = 0
+endif
+
if !exists('g:gist_browser_command')
if has('win32') || has('win64')
let g:gist_browser_command = "!start rundll32 url.dll,FileProtocolHandler %URL%"
@@ -907,7 +911,7 @@ function! gist#Gist(count, line1, line2, ...)
else
let save_regcont = @"
let save_regtype = getregtype('"')
- silent! normal! gvygv
+ silent! normal! gvy
let content = @"
call setreg('"', save_regcont, save_regtype)
endif
@@ -918,6 +922,9 @@ function! gist#Gist(count, line1, line2, ...)
else
let url = s:GistPost(user, token, content, private, gistdesc)
endif
+ if a:count >= 1 && g:gist_keep_selection
+ silent! normal! gv
+ endif
endif
if len(url) > 0
if g:gist_open_browser_after_post
View
357 vim/bundle/tagbar/autoload/tagbar.vim
@@ -111,6 +111,10 @@ function! s:Init()
call s:InitTypes()
endif
+ if !s:autocommands_done
+ call s:CreateAutocommands()
+ endif
+
return 1
endfunction
@@ -956,7 +960,6 @@ function! s:CreateAutocommands()
augroup TagbarAutoCmds
autocmd!
autocmd BufEnter __Tagbar__ nested call s:QuitIfOnlyWindow()
- autocmd BufUnload __Tagbar__ call s:CleanUp()
autocmd CursorHold __Tagbar__ call s:ShowPrototype()
autocmd BufWritePost *
@@ -966,7 +969,7 @@ function! s:CreateAutocommands()
autocmd BufEnter,CursorHold,FileType * call
\ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'))
autocmd BufDelete,BufUnload,BufWipeout * call
- \ s:CleanupFileinfo(fnamemodify(expand('<afile>'), ':p'))
+ \ s:known_files.rm(fnamemodify(expand('<afile>'), ':p'))
autocmd VimEnter * call s:CorrectFocusOnStartup()
augroup END
@@ -1082,6 +1085,15 @@ endfunction
" Base tag {{{2
let s:BaseTag = {}
+" s:BaseTag.New() {{{3
+function! s:BaseTag.New(name) dict
+ let newobj = copy(self)
+
+ call newobj._init(a:name)
+
+ return newobj
+endfunction
+
" s:BaseTag._init() {{{3
function! s:BaseTag._init(name) dict
let self.name = a:name
@@ -1229,15 +1241,6 @@ endfunction
" Normal tag {{{2
let s:NormalTag = copy(s:BaseTag)
-" s:NormalTag.New() {{{3
-function! s:NormalTag.New(name) dict
- let newobj = copy(self)
-
- call newobj._init(a:name)
-
- return newobj
-endfunction
-
" s:NormalTag.isNormalTag() {{{3
function! s:NormalTag.isNormalTag() dict
return 1
@@ -1259,6 +1262,26 @@ function! s:NormalTag.str() dict
return self._getPrefix() . self.name . suffix . "\n"
endfunction
+" s:NormalTag.strshort() {{{3
+function! s:NormalTag.strshort(longsig) dict
+ let str = ''
+ if has_key(self.fields, 'access')
+ let str .= get(s:access_symbols, self.fields.access, '')
+ endif
+
+ let str .= self.name
+
+ if has_key(self.fields, 'signature')
+ if a:longsig
+ let str .= self.fields.signature
+ else
+ let str .= '()'
+ endif
+ endif
+
+ return str
+endfunction
+
" s:NormalTag.getPrototype() {{{3
function! s:NormalTag.getPrototype() dict
return self.prototype
@@ -1267,15 +1290,6 @@ endfunction
" Pseudo tag {{{2
let s:PseudoTag = copy(s:BaseTag)
-" s:PseudoTag.New() {{{3
-function! s:PseudoTag.New(name) dict
- let newobj = copy(self)
-
- call newobj._init(a:name)
-
- return newobj
-endfunction
-
" s:PseudoTag.isPseudoTag() {{{3
function! s:PseudoTag.isPseudoTag() dict
return 1
@@ -1297,15 +1311,6 @@ endfunction
" Kind header {{{2
let s:KindheaderTag = copy(s:BaseTag)
-" s:KindheaderTag.New() {{{3
-function! s:KindheaderTag.New(name) dict
- let newobj = copy(self)
-
- call newobj._init(a:name)
-
- return newobj
-endfunction
-
" s:KindheaderTag.isKindheader() {{{3
function! s:KindheaderTag.isKindheader() dict
return 1
@@ -1603,6 +1608,7 @@ function! s:InitWindow(autoclose)
let s:is_maximized = 0
let s:short_help = 1
+ let s:new_window = 1
let w:autoclose = a:autoclose
@@ -1618,10 +1624,6 @@ function! s:InitWindow(autoclose)
call s:MapKeys()
endif
- if !s:autocommands_done
- call s:CreateAutocommands()
- endif
-
let &cpoptions = cpoptions_save
call s:LogDebugMessage('InitWindow finished')
@@ -2230,6 +2232,7 @@ endfunction
" s:RenderContent() {{{2
function! s:RenderContent(...)
call s:LogDebugMessage('RenderContent called')
+ let s:new_window = 0
if a:0 == 1
let fileinfo = a:1
@@ -2354,10 +2357,17 @@ function! s:PrintKinds(typeinfo, fileinfo)
let childtags = filter(copy(tag.children),
\ 'v:val.fields.kind ==# ckind.short')
if len(childtags) > 0
- " Print 'kind' header of following children
+ " Print 'kind' header of following children, but
+ " only if they are not scope-defining tags (since
+ " those already have an identifier)
if !has_key(a:typeinfo.kind2scope, ckind.short)
silent put =' [' . ckind.long . ']'
- let a:fileinfo.tline[line('.')] = tag
+ " Add basic tag to allow folding when on the
+ " header line
+ let headertag = s:BaseTag.New(ckind.long)
+ let headertag.parent = tag
+ let headertag.fileinfo = tag.fileinfo
+ let a:fileinfo.tline[line('.')] = headertag
endif
for childtag in childtags
call s:PrintTag(childtag, 1,
@@ -2433,11 +2443,17 @@ function! s:PrintTag(tag, depth, fileinfo, typeinfo)
let childtags = filter(copy(a:tag.children),
\ 'v:val.fields.kind ==# ckind.short')
if len(childtags) > 0
- " Print 'kind' header of following children
+ " Print 'kind' header of following children, but only if they
+ " are not scope-defining tags (since those already have an
+ " identifier)
if !has_key(a:typeinfo.kind2scope, ckind.short)
silent put =' ' . repeat(' ', a:depth * 2) .
\ '[' . ckind.long . ']'
- let a:fileinfo.tline[line('.')] = a:tag
+ " Add basic tag to allow folding when on the header line
+ let headertag = s:BaseTag.New(ckind.long)
+ let headertag.parent = a:tag
+ let headertag.fileinfo = a:tag.fileinfo
+ let a:fileinfo.tline[line('.')] = headertag
endif
for childtag in childtags
call s:PrintTag(childtag, a:depth + 1,
@@ -2457,21 +2473,25 @@ function! s:PrintHelp()
silent 0put ='\" Tagbar keybindings'
silent put ='\"'
silent put ='\" --------- General ---------'
- silent put ='\" <Enter> : Jump to tag definition'
- silent put ='\" <Space> : Display tag prototype'
+ silent put ='\" <Enter> : Jump to tag definition'
+ silent put ='\" p : As above, but stay in'
+ silent put ='\" Tagbar window'
+ silent put ='\" <C-N> : Go to next top-level tag'
+ silent put ='\" <C-P> : Go to previous top-level tag'
+ silent put ='\" <Space> : Display tag prototype'
silent put ='\"'
silent put ='\" ---------- Folds ----------'
- silent put ='\" +, zo : Open fold'
- silent put ='\" -, zc : Close fold'
- silent put ='\" o, za : Toggle fold'
- silent put ='\" *, zR : Open all folds'
- silent put ='\" =, zM : Close all folds'
+ silent put ='\" +, zo : Open fold'
+ silent put ='\" -, zc : Close fold'
+ silent put ='\" o, za : Toggle fold'
+ silent put ='\" *, zR : Open all folds'
+ silent put ='\" =, zM : Close all folds'
silent put ='\"'
silent put ='\" ---------- Misc -----------'
- silent put ='\" s : Toggle sort'
- silent put ='\" x : Zoom window in/out'
- silent put ='\" q : Close window'
- silent put ='\" <F1> : Remove help'
+ silent put ='\" s : Toggle sort'
+ silent put ='\" x : Zoom window in/out'
+ silent put ='\" q : Close window'
+ silent put ='\" <F1> : Remove help'
silent put _
endif
endfunction
@@ -2522,6 +2542,9 @@ function! s:HighlightTag()
endif
let tagbarwinnr = bufwinnr('__Tagbar__')
+ if tagbarwinnr == -1
+ return
+ endif
let prevwinnr = winnr()
call s:winexec(tagbarwinnr . 'wincmd w')
@@ -2563,7 +2586,7 @@ function! s:JumpToTag(stay_in_tagbar)
let autoclose = w:autoclose
- if empty(taginfo) || taginfo.isKindheader()
+ if empty(taginfo) || !taginfo.isNormalTag()
return
endif
@@ -2835,36 +2858,6 @@ function! s:OpenParents(...)
endfunction
" Helper functions {{{1
-" s:CleanUp() {{{2
-function! s:CleanUp()
- silent autocmd! TagbarAutoCmds
-
- unlet s:is_maximized
- unlet s:compare_typeinfo
- unlet s:short_help
-endfunction
-
-" s:CleanupFileinfo() {{{2
-function! s:CleanupFileinfo(fname)
- call s:known_files.rm(a:fname)
-endfunction
-
-" s:QuitIfOnlyWindow() {{{2
-function! s:QuitIfOnlyWindow()
- " Check if there is more than window
- if winbufnr(2) == -1
- " Check if there is more than one tab page
- if tabpagenr('$') == 1
- " Before quitting Vim, delete the tagbar buffer so that
- " the '0 mark is correctly set to the previous buffer.
- bdelete
- quitall
- else
- close
- endif
- endif
-endfunction
-
" s:AutoUpdate() {{{2
function! s:AutoUpdate(fname)
call s:LogDebugMessage('AutoUpdate called on ' . a:fname)
@@ -2873,9 +2866,8 @@ function! s:AutoUpdate(fname)
let bufnr = bufnr(a:fname)
let ftype = getbufvar(bufnr, '&filetype')
- " Don't do anything if tagbar is not open or if we're in the tagbar window
- let tagbarwinnr = bufwinnr('__Tagbar__')
- if tagbarwinnr == -1 || ftype == 'tagbar'
+ " Don't do anything if we're in the tagbar window
+ if ftype == 'tagbar'
call s:LogDebugMessage('Tagbar window not open or in Tagbar window')
return
endif
@@ -2891,17 +2883,21 @@ function! s:AutoUpdate(fname)
return
endif
+ let updated = 0
+
" Process the file if it's unknown or the information is outdated
" Also test for entries that exist but are empty, which will be the case
" if there was an error during the ctags execution
if s:known_files.has(a:fname) && !empty(s:known_files.get(a:fname))
if s:known_files.get(a:fname).mtime != getftime(a:fname)
call s:LogDebugMessage('File data outdated, updating ' . a:fname)
call s:ProcessFile(a:fname, sftype)
+ let updated = 1
endif
elseif !s:known_files.has(a:fname)
call s:LogDebugMessage('New file, processing ' . a:fname)
call s:ProcessFile(a:fname, sftype)
+ let updated = 1
endif
let fileinfo = s:known_files.get(a:fname)
@@ -2913,8 +2909,12 @@ function! s:AutoUpdate(fname)
return
endif
- " Display the tagbar content
- call s:RenderContent(fileinfo)
+ " Display the tagbar content if the tags have been updated or a different
+ " file is being displayed
+ if bufwinnr('__Tagbar__') != -1 &&
+ \ (s:new_window || updated || a:fname != s:known_files.getCurrent().fpath)
+ call s:RenderContent(fileinfo)
+ endif
" Call setCurrent after rendering so RenderContent can check whether the
" same file is redisplayed
@@ -2927,32 +2927,49 @@ function! s:AutoUpdate(fname)
call s:LogDebugMessage('AutoUpdate finished successfully')
endfunction
-" s:IsValidFile() {{{2
-function! s:IsValidFile(fname, ftype)
- call s:LogDebugMessage('Checking if file is valid: ' . a:fname)
+" s:CheckMouseClick() {{{2
+function! s:CheckMouseClick()
+ let line = getline('.')
+ let curcol = col('.')
- if a:fname == '' || a:ftype == ''
- call s:LogDebugMessage('Empty filename or type')
- return 0
+ if (match(line, s:icon_open . '[-+ ]') + 1) == curcol
+ call s:CloseFold()
+ elseif (match(line, s:icon_closed . '[-+ ]') + 1) == curcol
+ call s:OpenFold()
+ elseif g:tagbar_singleclick
+ call s:JumpToTag(0)
endif
+endfunction
- if !filereadable(a:fname)
- call s:LogDebugMessage('File not readable')
- return 0
+" s:DetectFiletype() {{{2
+function! s:DetectFiletype(bufnr)
+ " Filetype has already been detected for loaded buffers, but not
+ " necessarily for unloaded ones
+ let ftype = getbufvar(a:bufnr, '&filetype')
+
+ if bufloaded(a:bufnr)
+ return ftype
endif
- if !has_key(s:known_types, a:ftype)
- if exists('g:tagbar_type_' . a:ftype)
- " Filetype definition must have been specified in an 'ftplugin'
- " file, so load it now
- call s:LoadUserTypeDefs(a:ftype)
- else
- call s:LogDebugMessage('Unsupported filetype: ' . a:ftype)
- return 0
- endif
+ if ftype != ''
+ return ftype
endif
- return 1
+ " Unloaded buffer with non-detected filetype, need to detect filetype
+ " manually
+ let bufname = bufname(a:bufnr)
+
+ let eventignore_save = &eventignore
+ set eventignore=FileType
+ let filetype_save = &filetype
+
+ exe 'doautocmd filetypedetect BufRead ' . bufname
+ let ftype = &filetype
+
+ let &filetype = filetype_save
+ let &eventignore = eventignore_save
+
+ return ftype
endfunction
" s:EscapeCtagsCmd() {{{2
@@ -3031,6 +3048,32 @@ function! s:ExecuteCtags(ctags_cmd)
return ctags_output
endfunction
+" s:GetNearbyTag() {{{2
+" Get the tag info for a file near the cursor in the current file
+function! s:GetNearbyTag()
+ let fileinfo = s:known_files.getCurrent()
+ if empty(fileinfo)
+ return
+ endif
+
+ let curline = line('.')
+ let tag = {}
+
+ " If a tag appears in a file more than once (for example namespaces in
+ " C++) only one of them has a 'tline' entry and can thus be highlighted.
+ " The only way to solve this would be to go over the whole tag list again,
+ " making everything slower. Since this should be a rare occurence and
+ " highlighting isn't /that/ important ignore it for now.
+ for line in range(curline, 1, -1)
+ if has_key(fileinfo.fline, line)
+ let tag = fileinfo.fline[line]
+ break
+ endif
+ endfor
+
+ return tag
+endfunction
+
" s:GetTagInfo() {{{2
" Return the info dictionary of the tag on the specified line. If the line
" does not contain a valid tag (for example because it is empty or only
@@ -3063,72 +3106,48 @@ function! s:GetTagInfo(linenr, ignorepseudo)
return taginfo
endfunction
-" s:GetNearbyTag() {{{2
-" Get the tag info for a file near the cursor in the current file
-function! s:GetNearbyTag()
- let fileinfo = s:known_files.getCurrent()
-
- let curline = line('.')
- let tag = {}
-
- " If a tag appears in a file more than once (for example namespaces in
- " C++) only one of them has a 'tline' entry and can thus be highlighted.
- " The only way to solve this would be to go over the whole tag list again,
- " making everything slower. Since this should be a rare occurence and
- " highlighting isn't /that/ important ignore it for now.
- for line in range(curline, 1, -1)
- if has_key(fileinfo.fline, line)
- let tag = fileinfo.fline[line]
- break
- endif
- endfor
-
- return tag
-endfunction
-
-" s:CheckMouseClick() {{{2
-function! s:CheckMouseClick()
- let line = getline('.')
- let curcol = col('.')
+" s:IsValidFile() {{{2
+function! s:IsValidFile(fname, ftype)
+ call s:LogDebugMessage('Checking if file is valid: ' . a:fname)
- if (match(line, s:icon_open . '[-+ ]') + 1) == curcol
- call s:CloseFold()
- elseif (match(line, s:icon_closed . '[-+ ]') + 1) == curcol
- call s:OpenFold()
- elseif g:tagbar_singleclick
- call s:JumpToTag(0)
+ if a:fname == '' || a:ftype == ''
+ call s:LogDebugMessage('Empty filename or type')
+ return 0
endif
-endfunction
-" s:DetectFiletype() {{{2
-function! s:DetectFiletype(bufnr)
- " Filetype has already been detected for loaded buffers, but not
- " necessarily for unloaded ones
- let ftype = getbufvar(a:bufnr, '&filetype')
-
- if bufloaded(a:bufnr)
- return ftype
+ if !filereadable(a:fname)
+ call s:LogDebugMessage('File not readable')
+ return 0
endif
- if ftype != ''
- return ftype
+ if !has_key(s:known_types, a:ftype)
+ if exists('g:tagbar_type_' . a:ftype)
+ " Filetype definition must have been specified in an 'ftplugin'
+ " file, so load it now
+ call s:LoadUserTypeDefs(a:ftype)
+ else
+ call s:LogDebugMessage('Unsupported filetype: ' . a:ftype)
+ return 0
+ endif
endif
- " Unloaded buffer with non-detected filetype, need to detect filetype
- " manually
- let bufname = bufname(a:bufnr)
-
- let eventignore_save = &eventignore
- set eventignore=FileType
- let filetype_save = &filetype
-
- exe 'doautocmd filetypedetect BufRead ' . bufname
- let ftype = &filetype
-
- let &filetype = filetype_save
- let &eventignore = eventignore_save
+ return 1
+endfunction
- return ftype
+" s:QuitIfOnlyWindow() {{{2
+function! s:QuitIfOnlyWindow()
+ " Check if there is more than window
+ if winbufnr(2) == -1
+ " Check if there is more than one tab page
+ if tabpagenr('$') == 1
+ " Before quitting Vim, delete the tagbar buffer so that
+ " the '0 mark is correctly set to the previous buffer.
+ bdelete
+ quitall
+ else
+ close
+ endif
+ endif
endfunction
" s:winexec() {{{2
@@ -3267,5 +3286,21 @@ function! tagbar#autoopen(...)
\ 'without finding valid file')
endfunction
+function! tagbar#currenttag(fmt, default, ...)
+ let longsig = a:0 > 0 ? a:1 : 0
+
+ if !s:Init()
+ return ''
+ endif
+
+ let tag = s:GetNearbyTag()
+
+ if !empty(tag)
+ return printf(a:fmt, tag.strshort(longsig))
+ else
+ return a:default
+ endif
+endfunction
+
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
View
92 vim/bundle/tagbar/doc/tagbar.txt
@@ -6,7 +6,7 @@ Homepage: http://majutsushi.github.com/tagbar/
Version: 2.3
==============================================================================
-Contents *tagbar* *tagbar-contents*
+Contents *tagbar* *tagbar-contents*
1. Intro ........................... |tagbar-intro|
Pseudo-tags ................... |tagbar-pseudotags|
@@ -20,14 +20,15 @@ Contents *tagbar* *tagbar-contents*
5. Configuration ................... |tagbar-configuration|
Highlight colours ............. |tagbar-highlight|
Automatically opening Tagbar .. |tagbar-autoopen|
+ Show current tag in statusline |tagbar-statusline|
6. Extending Tagbar ................ |tagbar-extend|
7. Troubleshooting & Known issues .. |tagbar-issues|
8. History ......................... |tagbar-history|
9. Todo ............................ |tagbar-todo|
10. Credits ......................... |tagbar-credits|
==============================================================================
-1. Intro *tagbar-intro*
+1. Intro *tagbar-intro*
Tagbar is a plugin for browsing the tags of source code files. It provides a
sidebar that displays the ctags-generated tags of the current file, ordered by
@@ -64,7 +65,7 @@ listed after its name and a colon. Third, tags for which the access/visibility
information is known are prefixed with a symbol indicating that.
------------------------------------------------------------------------------
-PSEUDO-TAGS *tagbar-pseudotags*
+PSEUDO-TAGS *tagbar-pseudotags*
The example also introduces the concept of "pseudo-tags". Pseudo-tags are tags
that are not explicitly defined in the file but have children in it. In this
@@ -83,7 +84,7 @@ window.
Pseudo-tags are denoted with an asterisk ('*') at the end of their name.
------------------------------------------------------------------------------
-SUPPORTED FEATURES *tagbar-features*
+SUPPORTED FEATURES *tagbar-features*
The following features are supported by Tagbar:
@@ -104,7 +105,7 @@ The following features are supported by Tagbar:
- Can be extended to support arbitrary new types.
------------------------------------------------------------------------------
-OTHER CTAGS-COMPATIBLE PROGRAMS *tagbar-other*
+OTHER CTAGS-COMPATIBLE PROGRAMS *tagbar-other*
Tagbar theoretically also supports filetype-specific programs that can output
tag information that is compatible with ctags. However due to potential
@@ -116,7 +117,7 @@ correct configuration please contact me.
Note: Please check |tagbar-issues| for some possible issues with jsctags.
==============================================================================
-2. Requirements *tagbar-requirements*
+2. Requirements *tagbar-requirements*
The following requirements have to be met in order to be able to use tagbar:
@@ -143,7 +144,7 @@ The following requirements have to be met in order to be able to use tagbar:
- Tagbar will not work in |restricted-mode| or with 'compatible' set.
==============================================================================
-3. Installation *tagbar-installation*
+3. Installation *tagbar-installation*
Use the normal Vimball install method for installing tagbar.vba:
>
@@ -160,7 +161,7 @@ $PATH environment variable you have to set the g:tagbar_ctags_bin variable,
see |g:tagbar_ctags_bin|.
==============================================================================
-4. Usage *tagbar-usage*
+4. Usage *tagbar-usage*
There are essentially two ways to use Tagbar:
@@ -223,7 +224,7 @@ case it will be displayed in a pop-up window. The prototype will also be
displayed when the cursor stays on a tag for 'updatetime' milliseconds.
------------------------------------------------------------------------------
-COMMANDS *tagbar-commands*
+COMMANDS *tagbar-commands*
:TagbarOpen [{flags}]
Open the Tagbar window if it is closed.
@@ -269,7 +270,7 @@ COMMANDS *tagbar-commands*
End debug mode, debug messages will no longer be written to the logfile.
------------------------------------------------------------------------------
-KEY MAPPINGS *tagbar-keys*
+KEY MAPPINGS *tagbar-keys*
The following mappings are valid in the Tagbar window:
@@ -297,9 +298,9 @@ x Toggle zooming the window.
q Close the Tagbar window.
==============================================================================
-5. Configuration *tagbar-configuration*
+5. Configuration *tagbar-configuration*
- *g:tagbar_ctags_bin*
+ *g:tagbar_ctags_bin*
g:tagbar_ctags_bin~
Default: empty
@@ -311,7 +312,7 @@ Example:
let g:tagbar_ctags_bin = 'C:\Ctags5.8\ctags.exe'
<
- *g:tagbar_left*
+ *g:tagbar_left*
g:tagbar_left~
Default: 0
@@ -323,7 +324,7 @@ Example:
let g:tagbar_left = 1
<
- *g:tagbar_width*
+ *g:tagbar_width*
g:tagbar_width~
Default: 40
@@ -334,7 +335,7 @@ Example:
let g:tagbar_width = 30
<
- *g:tagbar_autoclose*
+ *g:tagbar_autoclose*
g:tagbar_autoclose~
Default: 0
@@ -346,7 +347,7 @@ Example:
let g:tagbar_autoclose = 1
<
- *g:tagbar_autofocus*
+ *g:tagbar_autofocus*
g:tagbar_autofocus~
Default: 0
@@ -358,7 +359,7 @@ Example:
let g:tagbar_autofocus = 1
<
- *g:tagbar_sort*
+ *g:tagbar_sort*
g:tagbar_sort~
Default: 1
@@ -372,7 +373,7 @@ Example:
let g:tagbar_sort = 0
<
- *g:tagbar_compact*
+ *g:tagbar_compact*
g:tagbar_compact~
Default: 0
@@ -385,7 +386,7 @@ Example:
let g:tagbar_compact = 1
<
- *g:tagbar_expand*
+ *g:tagbar_expand*
g:tagbar_expand~
Default: 0
@@ -397,7 +398,7 @@ Example:
let g:tagbar_expand = 1
<
- *g:tagbar_singleclick*
+ *g:tagbar_singleclick*
g:tagbar_singleclick~
Default: 0
@@ -409,7 +410,7 @@ Example:
let g:tagbar_singleclick = 1
<
- *g:tagbar_foldlevel*
+ *g:tagbar_foldlevel*
g:tagbar_foldlevel~
Default: 99
@@ -421,7 +422,7 @@ Example:
let g:tagbar_foldlevel = 2
<
- *g:tagbar_iconchars*
+ *g:tagbar_iconchars*
g:tagbar_iconchars~
Since the display of the icons used to indicate open or closed folds depends
@@ -439,7 +440,7 @@ choose other characters in that case):
let g:tagbar_iconchars = ['+', '-'] (default on Windows)
<
- *g:tagbar_autoshowtag*
+ *g:tagbar_autoshowtag*
g:tagbar_autoshowtag~
Default: 0
@@ -454,7 +455,7 @@ Example:
let g:tagbar_autoshowtag = 1
<
- *g:tagbar_updateonsave_maxlines*
+ *g:tagbar_updateonsave_maxlines*
g:tagbar_updateonsave_maxlines~
Default: 5000
@@ -470,7 +471,7 @@ Example:
let g:tagbar_updateonsave_maxlines = 10000
<
- *g:tagbar_systemenc*
+ *g:tagbar_systemenc*
g:tagbar_systemenc~
Default: value of 'encoding'
@@ -486,7 +487,7 @@ Example:
<
------------------------------------------------------------------------------
-HIGHLIGHT COLOURS *tagbar-highlight*
+HIGHLIGHT COLOURS *tagbar-highlight*
All of the colours used by Tagbar can be customized. Here is a list of the
highlight groups that are defined by Tagbar:
@@ -535,7 +536,7 @@ your vimrc:
See |:highlight| for more information.
------------------------------------------------------------------------------
-AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen*
+AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen*
Since there are several different situations in which you might want to open
Tagbar automatically there is no single option to enable automatic opening.
@@ -556,6 +557,9 @@ use this instead:
>
autocmd VimEnter * nested :call tagbar#autoopen(1)
<
+The above is exactly what the Taglist plugin does if you set the
+Tlist_Auto_Open option, in case you want to emulate this behaviour.
+
For opening Tagbar also if you open a supported file in an already running
Vim:
>
@@ -574,8 +578,32 @@ supported ones:
Check out |autocmd.txt| if you want it to open automatically in more
complicated cases.
+------------------------------------------------------------------------------
+SHOWING THE CURRENT TAG IN THE STATUSLINE *tagbar-statusline*
+
+You can show the current tag in the 'statusline', or in any other place that
+you want to, by calling the tagbar#currenttag() function. The current tag is
+exactly the same as would be highlighted in the Tagbar window if it is open.
+It is defined as the nearest tag upwards in the file starting from the cursor
+position. This means that for example in a function it should usually be the
+name of the function.
+
+The function has the following signature:
+
+tagbar#currenttag({format}, {default} [, {longsig}])
+ {format} is a |printf()|-compatible format string where "%s" will be
+ replaced by the name of the tag. {default} will be displayed instead of
+ the format string if no tag can be found. If the optional argument
+ {longsig} is given and is non-zero then functions will have their complete
+ signature shown, otherwise only "()" will be appended so they can be more
+ easily distinguished from other tags.
+
+ For example, if you put the following into your statusline: >
+ %{tagbar#currenttag('[%s] ', '')}
+< then the function "myfunc" will be show as "[myfunc()] ".
+
==============================================================================
-6. Extending Tagbar *tagbar-extend*
+6. Extending Tagbar *tagbar-extend*
Tagbar has a flexible mechanism for extending the existing file type (i.e.
language) definitions. This can be used both to change the settings of the
@@ -850,7 +878,7 @@ Tagbar should now be able to show the sections and other tags from LaTeX
files.
==============================================================================
-7. Troubleshooting & Known issues *tagbar-issues*
+7. Troubleshooting & Known issues *tagbar-issues*
As a general rule, if the tag information displayed by Tagbar is wrong (for
example, a method doesn't show up or is in the wrong place) you should first
@@ -920,7 +948,7 @@ file.
are no problem, though.
==============================================================================
-8. History *tagbar-history*
+8. History *tagbar-history*
2.3 (2011-12-24)
- Add a convenience function that allows more flexible ways to
@@ -1003,7 +1031,7 @@ file.
- Initial release
==============================================================================
-9. Todo *tagbar-todo*
+9. Todo *tagbar-todo*
- Allow filtering the Tagbar content by some criteria like tag name,
visibility, kind ...
@@ -1012,7 +1040,7 @@ file.
- Allow jumping to a tag in the preview window, a split window or a new tab.
==============================================================================
-10. Credits *tagbar-credits*
+10. Credits *tagbar-credits*
Tagbar was written by Jan Larres and is released under the Vim licence, see
|license|. It was heavily inspired by the Taglist plugin by Yegappan
View
30 vim/bundle/vim-powerline/README.rst
@@ -21,7 +21,7 @@ See the `Troubleshooting`_ section below if you're having any issues with
the plugin or the font patcher.
**Note:** You need a patched font to be able to use the symbols in the
-statusbar. An experimental Python/fontforge-based font patcher is included
+statusline. An experimental Python/fontforge-based font patcher is included
in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage
instructions.
@@ -72,6 +72,8 @@ I can't see the fancy symbols, what's wrong?
Make sure that you've configured gvim or your terminal emulator to use
a patched font.
+ Make sure that vim is compiled with the ``--with-features=big`` flag.
+
I'm unable to patch my font, what should I do?
Font patching is only known to work on most Linux and OS X machines. If
you have followed the instructions in the fontpatcher README and still
@@ -91,9 +93,33 @@ The colors are weird in the default OS X Terminal app!
Powerline colors. Please use another terminal emulator. iTerm2 should
work fine.
-The statusbar is hidden/only appears in split windows!
+ The arrows may have the wrong colors if you have changed the "minimum
+ contrast" slider in the color tab of your OS X settings.
+
+The statusline has strange characters like ``^B`` in it!
+ Please add ``set encoding=utf-8`` to your ``vimrc``.
+
+ You may also need to set your ``LANG`` and ``LC_*`` environment
+ variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your
+ Linux distro's documentation for information about setting these
+ variables correctly.
+
+The statusline has a lot of ``^`` or underline characters in it!
+ You need to configure the ``fillchars`` setting to disable statusline
+ fillchars (see ``:h fillchars`` for details). Add this to your
+ ``vimrc`` to solve this issue::
+
+ set fillchars+=stl:\ ,stlnc:\
+
+The statusline is hidden/only appears in split windows!
Make sure that you have ``set laststatus=2`` in your ``vimrc``.
+I'm using tmux and Powerline looks like crap, what's wrong?
+ You need to tell tmux that it has 256-color capabilities. Add this to
+ your ``.tmux.conf`` to solve this issue::
+
+ set -g default-terminal "screen-256color"
+
If you have any other issues and you can't find the answer in the docs,
please submit an issue on GitHub.
View
76 vim/bundle/vim-powerline/autoload/Pl.vim
@@ -3,16 +3,14 @@
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
" Source repository: https://github.com/Lokaltog/vim-powerline
-" Commands {{{
- command! PowerlineClearCache call Pl#ClearCache()
-" }}}
" Script variables {{{
let g:Pl#OLD_STL = ''
let g:Pl#THEME = []
+ let g:Pl#THEME_CALLBACKS = []
let g:Pl#HL = []
" Cache revision, this must be incremented whenever the cache format is changed
- let s:CACHE_REVISION = 2
+ let s:CACHE_REVISION = 5
" }}}
" Script initialization {{{
function! Pl#LoadCache() " {{{
@@ -31,6 +29,14 @@
exec hi_cmd
endfor
+ " Run theme callbacks
+ for callback in g:Pl#THEME_CALLBACKS
+ " Substitute {{NEWLINE}} with newlines (strings must be
+ " stored without newlines characters to avoid vim errors)
+ exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g')
+ exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g')
+ endfor
+
return 1
endif
@@ -44,6 +50,23 @@
echo 'Powerline cache cleared. Please restart vim for the changes to take effect.'
endfunction " }}}
+ function! Pl#ReloadColorscheme() " {{{
+ call Pl#ClearCache()
+
+ " The colorscheme and theme files must be manually sourced because
+ " vim won't reload previously autoloaded files
+ "
+ " This is a bit hackish, but it works
+ unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme
+ exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0]
+
+ unlet! g:Powerline#Themes#{g:Powerline_theme}#theme
+ exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0]
+
+ let g:Pl#THEME = []
+
+ call Pl#Load()
+ endfunction " }}}
function! Pl#Load() " {{{
if empty(g:Pl#OLD_STL)
" Store old statusline
@@ -55,16 +78,46 @@
" Autoload the theme dict first
let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme
catch
- echoe 'Invalid Powerline theme! Please check your theme and colorscheme settings.'
+ echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.'
return
endtry
" Create list with parsed statuslines
for buffer_statusline in raw_theme
+ unlet! mode_statuslines
+ let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments)
+
+ if ! empty(buffer_statusline.callback)
+ " The callback function passes its arguments on to
+ " Pl#StatuslineCallback along with the normal/current mode
+ " statusline.
+ let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n"
+ let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n"
+ let s:cb_func .= "endfunction"
+
+ " The callback expression should be used to initialize any
+ " variables that will use the callback function. The
+ " expression requires a %s which will be replaced by the
+ " callback function name.
+ let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1])
+
+ exec s:cb_func
+ exec s:cb_expr
+
+ " Newlines must be substituted with another character
+ " because vim doesn't like newlines in strings
+ call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')])
+
+ unlet! s:cb_func s:cb_expr
+
+ continue
+ endif
+
+ " Store the statuslines for matching specific buffers
call add(g:Pl#THEME, {
\ 'matches': buffer_statusline.matches,
- \ 'mode_statuslines': Pl#Parser#GetStatusline(buffer_statusline.segments)
+ \ 'mode_statuslines': mode_statuslines
\ })
endfor
@@ -78,6 +131,7 @@
\ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION),
\ 'let g:Pl#HL = '. string(g:Pl#HL),
\ 'let g:Pl#THEME = '. string(g:Pl#THEME),
+ \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS),
\ ]
call writefile(cache, g:Powerline_cache_file)
@@ -105,14 +159,22 @@
return g:Pl#THEME[a:statusline].mode_statuslines[mode]
endfunction " }}}
+ function! Pl#StatuslineCallback(statusline, args) " {{{
+ " Replace %1, %2, etc. in the statusline with the callback args
+ return substitute(
+ \ a:statusline,
+ \ '\v\%(\d+)',
+ \ '\=a:args[submatch(1)]',
+ \ 'g')
+ endfunction " }}}
function! Pl#UpdateStatusline(current) " {{{
if empty(g:Pl#THEME)
" Load statuslines if they aren't loaded yet
call Pl#Load()
endif
for i in range(0, len(g:Pl#THEME) - 1)
- if Pl#Match#Validate(g:Pl#THEME[i].matches)
+ if Pl#Match#Validate(g:Pl#THEME[i])
" Update window-local statusline
let &l:statusline = '%!Pl#Statusline('. i .','. a:current .')'
endif
View
18 vim/bundle/vim-powerline/autoload/Pl/Colorscheme.vim
@@ -22,7 +22,7 @@ function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{
try
let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme
catch
- echoe 'Color scheme "'. a:colorscheme .'" doesn''t exist!'
+ echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!'
return
endtry
@@ -143,19 +143,3 @@ function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{
" array consiting of a statusline for each mode, with generated highlighting groups and dividers.
return buffer_segments
endfunction " }}}
-function! Pl#Colorscheme#HiSegment(segments, normal, ...) " {{{
- let mode_hi_dict = {
- \ 'n': a:normal
- \ }
-
- if a:0 && type(a:1) == type({})
- for [modes, hl] in items(a:1)
- for mode in split(modes, '\zs')
- let mode_hi_dict[mode] = hl
- endfor
- endfor
- endif
-
- " a:segments may be either a string or a list of strings to use this highlighting
- return [a:segments, mode_hi_dict]
-endfunction " }}}
View
112 vim/bundle/vim-powerline/autoload/Pl/Hi.vim
@@ -42,6 +42,11 @@ let s:cterm2gui_dict = {
\ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee
\ }
" }}}
+" Allocated color dict {{{
+let s:allocated_colors = {
+ \ 'NONE': 'NONE',
+ \ }
+" }}}
function! s:Cterm2GUI(cterm) " {{{
if toupper(a:cterm) == 'NONE'
return 'NONE'
@@ -53,52 +58,83 @@ function! s:Cterm2GUI(cterm) " {{{
return s:cterm2gui_dict[a:cterm]
endfunction " }}}
-function! Pl#Hi#Create(...) " {{{
- let hi = {
- \ 'cterm': ['', ''],
- \ 'gui' : ['', ''],
- \ 'attr' : []
+function! Pl#Hi#Segments(segments, mode_colors) " {{{
+ let mode_translate = {
+ \ 'normal': 'n',
+ \ 'noncurrent': 'N',
+ \ 'insert': 'i',
+ \ 'visual': 'v',
+ \ 'replace': 'r',
+ \ 'select': 's',
\ }
- " Fetch highlighting details from parameters
- for param in a:000
- " String parameters are always attributes
- if type(param) == type('')
- if tolower(param) == 'none'
- let param = 'NONE'
- endif
+ let attributes = ['bold', 'italic', 'underline']
- call add(hi['attr'], param)
+ let segments = a:segments
+ let mode_hi_dict = {}
- continue
+ " Mode dict
+ for [mode, colors] in items(a:mode_colors)
+ if has_key(mode_translate, mode)
+ let mode = mode_translate[mode]
endif
- " Other parameters are either Pl#Hi#Cterm or Pl#Hi#GUI return values (lists)
- let hi[param[0]] = [toupper(param[1]), toupper(param[2])]
+ unlet! fg
+ let fg = s:allocated_colors[colors[0]]
- unlet! param
- endfor
+ let hi = {
+ \ 'cterm': [fg['cterm'], ''],
+ \ 'gui' : [fg['gui'], ''],
+ \ 'attr' : []
+ \ }
- " Fallback to term colors in gvim
- if empty(hi['gui'][0]) && ! empty(hi['cterm'][0])
- let hi['gui'][0] = s:Cterm2GUI(hi['cterm'][0])
- endif
- if empty(hi['gui'][1]) && ! empty(hi['cterm'][1])
- let hi['gui'][1] = s:Cterm2GUI(hi['cterm'][1])
- endif
+ if exists('colors[1]')
+ if type(colors[1]) == type([])
+ " We don't have a BG color, but we have attributes
+ let hi.attr = colors[1]
+ else
+ " The second parameter is the background color
+ unlet! bg
+ let bg = s:allocated_colors[colors[1]]
- " Return dict with properly formatted color values
- return {
- \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])),
- \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])),
- \ 'guifg': (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])),
- \ 'guibg': (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])),
- \ 'attr': (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ','))
- \ }
-endfunction " }}}
-function! Pl#Hi#Cterm(fg, ...) " {{{
- return ['cterm', a:fg, (a:0 ? a:1 : '')]
+ let hi.cterm[1] = bg['cterm']
+ let hi.gui[1] = bg['gui']
+ endif
+ endif
+
+ if exists('colors[2]') && type(colors[2]) == type([])
+ " The third parameter is always an attribute list
+ let hi.attr = colors[2]
+ endif
+
+ let mode_hi_dict[mode] = {
+ \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])),
+ \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])),
+ \ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])),
+ \ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])),
+ \ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ','))
+ \ }
+ endfor
+
+ return [segments, mode_hi_dict]
endfunction " }}}
-function! Pl#Hi#GUI(fg, ...) " {{{
- return ['gui', a:fg, (a:0 ? a:1 : '')]
+function! Pl#Hi#Allocate(colors) " {{{
+ for [key, color] in items(a:colors)
+ if type(color) == type(0)
+ " Only terminal color
+ let cterm = color
+ let gui = s:Cterm2GUI(color)
+ elseif type(color) == type([]) && len(color) == 2
+ " Terminal and GUI colors
+ let cterm = color[0]
+ let gui = color[1]
+ endif
+
+ let s:allocated_colors[key] = {
+ \ 'cterm': cterm,
+ \ 'gui': gui,
+ \ }
+
+ unlet! color
+ endfor
endfunction " }}}
View
18 vim/bundle/vim-powerline/autoload/Pl/Match.vim
@@ -19,15 +19,19 @@ function! Pl#Match#Any(...) " {{{
return ['match', 'any', matches]
endfunction " }}}
-function! Pl#Match#Validate(match) " {{{
- let [m, match, matches] = a:match
+function! Pl#Match#Validate(theme) " {{{
+ let match = a:theme.matches[1]
- if ! len(matches)
- " Empty match array matches everything
- return 1
- endif
+ if match == 'none'
+ return 0
+ elseif match == 'any'
+ let matches = a:theme.matches[2]
+
+ if ! len(matches)
+ " Empty match array matches everything
+ return 1
+ endif
- if match == 'any'
for [eval, re] in matches
if match(eval(eval), '\v'. re) != -1
return 1
View
4 vim/bundle/vim-powerline/autoload/Pl/Parser.vim
@@ -171,7 +171,7 @@ function! s:ParseSegments(mode, side, segments, ...) " {{{
let mode_colors = get(colors, mode, get(colors, 'n', {}))
if empty(mode_colors)
- echoe 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"'
+ echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"'
continue
endif
@@ -313,6 +313,8 @@ function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{
let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg')
let div_colors['guibg'] = get(cmp_colors, 'guibg')
+
+ let div_colors['attr'] = 'NONE'
endif
endif
View
6 vim/bundle/vim-powerline/autoload/Pl/Segment.vim
@@ -64,16 +64,16 @@ function! Pl#Segment#Create(name, ...) " {{{
endif
endfunction " }}}
-function! Pl#Segment#Init(...) " {{{
+function! Pl#Segment#Init(params) " {{{
" Check condition parameters
- if ! s:CheckConditions(a:000)
+ if ! s:CheckConditions(a:params)
return {}
endif
let segments = {}
let ns = ''
- for param in a:000
+ for param in a:params
if type(param) == type('')
" String parameters is the namespace
let ns = param
View
17 vim/bundle/vim-powerline/autoload/Pl/Theme.vim
@@ -14,12 +14,16 @@ function! Pl#Theme#Create(...) " {{{
return buffer_segments
endfunction " }}}
+function! Pl#Theme#Callback(name, expr) " {{{
+ return ['callback', a:name, a:expr]
+endfunction " }}}
function! Pl#Theme#Buffer(ns, ...) " {{{
let segments = []
let ns = ! empty(a:ns) ? a:ns .':' : ''
" Match namespace parameter by default
let matches = Pl#Match#Any(a:ns)
+ let callback = []
let args = a:000
let args = Pl#Mod#ApplySegmentMods(args)
@@ -31,6 +35,14 @@ function! Pl#Theme#Buffer(ns, ...) " {{{
" Match item, overrides default namespace match
let matches = item
+ unlet! item
+ continue
+ elseif item[0] == 'callback'
+ " Store the item as a callback expression
+ let matches = ['match', 'none']
+ let callback = [a:ns, item[1], item[2]]
+
+ unlet! item
continue
endif
@@ -51,8 +63,9 @@ function! Pl#Theme#Buffer(ns, ...) " {{{
endfor
return {
- \ 'matches': matches,
- \ 'segments': segments
+ \ 'matches': matches
+ \ , 'callback': callback
+ \ , 'segments': segments
\ }
endfunction " }}}
function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{
View
161 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/default.vim
@@ -0,0 +1,161 @@
+call Pl#Hi#Allocate({
+ \ 'black' : 16,
+ \ 'white' : 231,
+ \
+ \ 'darkestgreen' : 22,
+ \ 'darkgreen' : 28,
+ \ 'mediumgreen' : 70,
+ \ 'brightgreen' : 148,
+ \
+ \ 'darkestcyan' : 23,
+ \ 'mediumcyan' : 117,
+ \
+ \ 'darkestblue' : 24,
+ \ 'darkblue' : 31,
+ \
+ \ 'darkestred' : 52,
+ \ 'darkred' : 88,
+ \ 'mediumred' : 124,
+ \ 'brightred' : 160,
+ \ 'brightestred' : 196,
+ \
+ \ 'darkestpurple' : 55,
+ \ 'mediumpurple' : 98,
+ \ 'brightpurple' : 189,
+ \
+ \ 'brightorange' : 208,
+ \ 'brightestorange': 214,
+ \
+ \ 'gray0' : 233,
+ \ 'gray1' : 235,
+ \ 'gray2' : 236,
+ \ 'gray3' : 239,
+ \ 'gray4' : 240,
+ \ 'gray5' : 241,
+ \ 'gray6' : 244,
+ \ 'gray7' : 245,
+ \ 'gray8' : 247,
+ \ 'gray9' : 250,
+ \ 'gray10' : 252,
+ \ })
+
+let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([
+ \ Pl#Hi#Segments(['SPLIT'], {
+ \ 'n': ['white', 'gray2'],
+ \ 'N': ['white', 'gray0'],
+ \ 'i': ['white', 'darkestblue'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['mode_indicator'], {
+ \ 'n': ['darkestgreen', 'brightgreen', ['bold']],
+ \ 'i': ['darkestcyan', 'white', ['bold']],
+ \ 'v': ['darkred', 'brightorange', ['bold']],
+ \ 'r': ['white', 'brightred', ['bold']],
+ \ 's': ['white', 'gray5', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], {
+ \ 'n': ['gray9', 'gray4'],
+ \ 'N': ['gray3', 'gray1'],
+ \ 'i': ['mediumcyan', 'darkblue'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['fileinfo', 'filename'], {
+ \ 'n': ['white', 'gray4', ['bold']],
+ \ 'N': ['gray7', 'gray1', ['bold']],
+ \ 'i': ['white', 'darkblue', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['static_str'], {
+ \ 'n': ['white', 'gray4'],
+ \ 'N': ['gray7', 'gray1'],
+ \ 'i': ['white', 'darkblue'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['fileinfo.flags'], {
+ \ 'n': ['brightestred', ['bold']],
+ \ 'N': ['darkred'],
+ \ 'i': ['brightestred', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['current_function', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], {
+ \ 'n': ['gray8', 'gray2'],
+ \ 'i': ['mediumcyan', 'darkestblue'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['lineinfo'], {
+ \ 'n': ['gray2', 'gray10', ['bold']],
+ \ 'N': ['gray7', 'gray1', ['bold']],
+ \ 'i': ['darkestcyan', 'mediumcyan', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['errors'], {
+ \ 'n': ['brightestorange', 'gray2', ['bold']],
+ \ 'i': ['brightestorange', 'darkestblue', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['lineinfo.line.tot'], {
+ \ 'n': ['gray6'],
+ \ 'N': ['gray5'],
+ \ 'i': ['darkestcyan'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ws_marker'], {
+ \ 'n': ['white', 'brightestred'],
+ \ 'i': ['darkestcyan', 'white'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], {
+ \ 'n': ['white', 'mediumred', ['bold']],
+ \ 'N': ['brightred', 'darkestred', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], {
+ \ 'n': ['white', 'darkred'],
+ \ 'N': ['brightred', 'darkestred'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], {
+ \ 'n': ['white', 'darkred'],
+ \ 'N': ['white', 'darkestred'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], {
+ \ 'n': ['white', 'mediumgreen', ['bold']],
+ \ 'N': ['mediumgreen', 'darkestgreen', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], {
+ \ 'n': ['brightgreen', 'darkgreen'],
+ \ 'N': ['mediumgreen', 'darkestgreen'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], {
+ \ 'n': ['white', 'darkgreen'],
+ \ 'N': ['white', 'darkestgreen'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], {
+ \ 'n': ['brightpurple', 'darkestpurple'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], {
+ \ 'n': ['white', 'mediumpurple'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:item'], {
+ \ 'n': ['darkestpurple', 'white', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:marked'], {
+ \ 'n': ['brightestred', 'darkestpurple', ['bold']],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:count'], {
+ \ 'n': ['darkestpurple', 'white'],
+ \ }),
+ \
+ \ Pl#Hi#Segments(['ctrlp:SPLIT'], {
+ \ 'n': ['white', 'darkestpurple'],
+ \ }),
+ \ ])
View
41 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/distinguished.vim
@@ -1,41 +0,0 @@
-let g:Powerline#Colorschemes#distinguished#colorscheme = Pl#Colorscheme#Init([
- \ Pl#Colorscheme#HiSegment(['SPLIT'], Pl#Hi#Create(Pl#Hi#Cterm( 0, 236) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 0, 233) ), 'i': Pl#Hi#Create(Pl#Hi#Cterm( 0, 24) ), } ),
- \ Pl#Colorscheme#HiSegment(['mode_indicator'], Pl#Hi#Create(Pl#Hi#Cterm( 22, 148), 'bold'), { 'i': Pl#Hi#Create(Pl#Hi#Cterm( 23, 231), 'bold'), 'v': Pl#Hi#Create(Pl#Hi#Cterm( 88, 208), 'bold'), 'r': Pl#Hi#Create(Pl#Hi#Cterm(231, 160), 'bold'), 's': Pl#Hi#Create(Pl#Hi#Cterm(231, 141), 'bold') } ),
- \ Pl#Colorscheme#HiSegment(['branch',
- \ 'scrollpercent',
- \ 'raw',
- \ 'filesize'] , Pl#Hi#Create(Pl#Hi#Cterm(250, 240) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(239, 235) ), 'i': Pl#Hi#Create(Pl#Hi#Cterm(117, 31) ), } ),
- \ Pl#Colorscheme#HiSegment(['fileinfo',
- \ 'filename'], Pl#Hi#Create(Pl#Hi#Cterm(231, 240), 'bold'), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(245, 235), 'bold'), 'i': Pl#Hi#Create(Pl#Hi#Cterm(231, 31), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['static_str'], Pl#Hi#Create(Pl#Hi#Cterm(231, 240) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(245, 235) ), 'i': Pl#Hi#Create(Pl#Hi#Cterm(231, 31) ), } ),
- \ Pl#Colorscheme#HiSegment(['fileinfo.flags'], Pl#Hi#Create(Pl#Hi#Cterm(196 ), 'bold'), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 88 ) ), 'i': Pl#Hi#Create(Pl#Hi#Cterm(196 ), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['current_function',
- \ 'fileformat',
- \ 'fileencoding',
- \ 'pwd',
- \ 'filetype',
- \ 'rvm:string',
- \ 'rvm:statusline',
- \ 'virtualenv:statusline',
- \ 'charcode',
- \ 'currhigroup'], Pl#Hi#Create(Pl#Hi#Cterm(247, 236) ), { 'i': Pl#Hi#Create(Pl#Hi#Cterm(117, 24) ), } ),
- \ Pl#Colorscheme#HiSegment(['lineinfo'], Pl#Hi#Create(Pl#Hi#Cterm(236, 252), 'bold'), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(245, 235), 'bold'), 'i': Pl#Hi#Create(Pl#Hi#Cterm( 23, 117), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['errors'], Pl#Hi#Create(Pl#Hi#Cterm(214, 236), 'bold'), { 'i': Pl#Hi#Create(Pl#Hi#Cterm(214, 24), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['lineinfo.line.tot'], Pl#Hi#Create(Pl#Hi#Cterm(244 ) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(241 ) ), 'i': Pl#Hi#Create(Pl#Hi#Cterm( 23 ) ), } ),
- \
- \ Pl#Colorscheme#HiSegment(['gundo:static_str.name',
- \ 'command_t:static_str.name',
- \ 'lustyexplorer:static_str.name',
- \ 'minibufexplorer.static_str.name'], Pl#Hi#Create(Pl#Hi#Cterm(231, 124), 'bold'), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(160, 52), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['gundo:static_str.buffer',
- \ 'command_t:raw.line',
- \ 'lustyexplorer:static_str.buffer'], Pl#Hi#Create(Pl#Hi#Cterm(231, 88) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm(160, 52) ), } ),
- \ Pl#Colorscheme#HiSegment(['gundo:SPLIT',
- \ 'command_t:SPLIT',
- \ 'lustyexplorer:SPLIT',
- \ 'minibufexplorer:SPLIT'], Pl#Hi#Create(Pl#Hi#Cterm( 0, 88) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 0, 52) ), } ),
- \
- \ Pl#Colorscheme#HiSegment(['tagbar:static_str.name'], Pl#Hi#Create(Pl#Hi#Cterm(231, 70), 'bold'), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 70, 22), 'bold'), } ),
- \ Pl#Colorscheme#HiSegment(['tagbar:static_str.buffer'], Pl#Hi#Create(Pl#Hi#Cterm(148, 28) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 70, 22) ), } ),
- \ Pl#Colorscheme#HiSegment(['tagbar:SPLIT'], Pl#Hi#Create(Pl#Hi#Cterm( 0, 28) ), { 'N': Pl#Hi#Create(Pl#Hi#Cterm( 0, 22) ), } ),
-\ ])
View
20 vim/bundle/vim-powerline/autoload/Powerline/Functions.vim
@@ -1,3 +1,6 @@
+" Recalculate the trailing whitespace warning when idle, and after saving
+autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning
+
function! Powerline#Functions#GetMode() " {{{
let mode = mode()
@@ -43,11 +46,6 @@ function! Powerline#Functions#GetFilesize() " {{{
return (bytes / 1024) . 'kB'
endif
endfunction "}}}
-function! Powerline#Functions#GetPwd() "{{{
- let pwd = substitute(getcwd(), expand("$HOME"), "~", "g")
-
- return pwd
-endfunction " }}}
function! Powerline#Functions#GetCharCode() " {{{
" Get the output of :ascii
redir => ascii
@@ -78,3 +76,15 @@ function! Powerline#Functions#GetCharCode() " {{{
return "'". char ."' ". nr
endfunction "}}}
+function! Powerline#Functions#GetWSMarker() " {{{
+ " Return '...' if trailing white space is detected
+ " Return '' otherwise
+ if ! exists("b:statusline_trailing_space_warning")
+ if search('\s$', 'nw') != 0
+ let b:statusline_trailing_space_warning = ' … '
+ else
+ let b:statusline_trailing_space_warning = ''
+ endif
+ endif
+ return b:statusline_trailing_space_warning
+endfunction " }}}
View
3 vim/bundle/vim-powerline/autoload/Powerline/Matches.vim
@@ -8,5 +8,6 @@ let g:Powerline#Matches#matches = {
\ 'gundo_tree' : Pl#Match#Add('bufname("%")', '__Gundo__'),
\ 'lustyexplorer' : Pl#Match#Add('bufname("%")', '\[LustyExplorer-Buffers\]'),
\ 'minibufexplorer' : Pl#Match#Add('bufname("%")', '\-MiniBufExplorer\-'),
- \ 'tagbar' : Pl#Match#Add('bufname("%")', '__Tagbar__')
+ \ 'tagbar' : Pl#Match#Add('&ft' , 'tagbar'),
+ \ 'nerdtree' : Pl#Match#Add('&ft' , 'nerdtree'),
\ }
View
9 vim/bundle/vim-powerline/autoload/Powerline/Segments.vim
@@ -1,4 +1,4 @@
-let g:Powerline#Segments#segments = Pl#Segment#Init(
+let g:Powerline#Segments#segments = Pl#Segment#Init([
\ Pl#Segment#Create('SPLIT' , '__split__'),
\ Pl#Segment#Create('TRUNCATE', '__truncate__'),
\
@@ -11,7 +11,7 @@ let g:Powerline#Segments#segments = Pl#Segment#Init(
\ ),
\ Pl#Segment#Create('filename' , '%t'),
\ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')),
- \ Pl#Segment#Create('pwd' , '%{Powerline#Functions#GetPwd()}'),
+ \ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'),
\ Pl#Segment#Create('static_str' , '%%{"%s"}'),
\ Pl#Segment#Create('raw' , '%s'),
\ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')),
@@ -23,5 +23,6 @@ let g:Powerline#Segments#segments = Pl#Segment#Init(
\ Pl#Segment#Create('line.tot' , '$COL %-2c'),
\ ),
\ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')),
- \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N'))
-\ )
+ \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')),
+ \ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')),
+\ ])
View
4 vim/bundle/vim-powerline/autoload/Powerline/Segments/cfi.vim
@@ -1,5 +1,5 @@
-let g:Powerline#Segments#cfi#segments = Pl#Segment#Init('cfi',
+let g:Powerline#Segments#cfi#segments = Pl#Segment#Init(['cfi',
\ (exists('g:cfi_disable') && g:cfi_disable == 0),
\
\ Pl#Segment#Create('current_function', '%{Powerline#Functions#cfi#GetCurrentFunction()}', Pl#Segment#Modes('!N'))
-\ )
+\ ])
View
10 vim/bundle/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
@@ -0,0 +1,10 @@
+let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp'
+ \ , Pl#Segment#Create('focus', '%{"%0"}')
+ \ , Pl#Segment#Create('byfname', '%{"%1"}')
+ \ , Pl#Segment#Create('prev', '%-3{"%3"}')
+ \ , Pl#Segment#Create('item', '%-9{"%4"}')
+ \ , Pl#Segment#Create('next', '%-3{"%5"}')
+ \ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}')
+ \
+ \ , Pl#Segment#Create('count', '%-6{"%0"}')
+\ ])
View
4 vim/bundle/vim-powerline/autoload/Powerline/Segments/ft_man.vim
@@ -1,3 +1,3 @@
-let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init('ft_man',
+let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init(['ft_man',
\ Pl#Segment#Create('filename', '%{Powerline#Functions#ft_man#GetName()}')
-\ )
+\ ])
View
4 vim/bundle/vim-powerline/autoload/Powerline/Segments/fugitive.vim
@@ -1,5 +1,5 @@
-let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init('fugitive',
+let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init(['fugitive',
\ (exists('g:loaded_fugitive') && g:loaded_fugitive == 1),
\
\ Pl#Segment#Create('branch', '%{Powerline#Functions#fugitive#GetBranch("$BRANCH")}')
-\ )
+\ ])
View
5 vim/bundle/vim-powerline/autoload/Powerline/Segments/rvm.vim
@@ -1,5 +1,6 @@
-let g:Powerline#Segments#rvm#segments = Pl#Segment#Init('rvm',
+let g:Powerline#Segments#rvm#segments = Pl#Segment#Init(['rvm',
\ (exists('g:loaded_rvm') && g:loaded_rvm == 1),
+ \
\ Pl#Segment#Create('string', '%{rvm#string()}'),
\ Pl#Segment#Create('statusline', '%{rvm#statusline()}')
-\ )
+\ ])
View
4 vim/bundle/vim-powerline/autoload/Powerline/Segments/syntastic.vim
@@ -1,5 +1,5 @@
-let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init('syntastic',
+let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic',
\ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1),
\
\ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N'))
-\ )
+\ ])
View
4 vim/bundle/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
@@ -1,5 +1,5 @@
-let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init('virtualenv',
+let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init(['virtualenv',
\ has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1),
\
\ Pl#Segment#Create('statusline', '%{VirtualEnvStatusline()}')
-\ )
+\ ])
View
27 ...toload/Powerline/Themes/distinguished.vim → ...ine/autoload/Powerline/Themes/default.vim
@@ -1,4 +1,4 @@
-let g:Powerline#Themes#distinguished#theme = Pl#Theme#Create(
+let g:Powerline#Themes#default#theme = Pl#Theme#Create(