mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Update of plugins VCSCommand, gundo and tagbar. Update vy* colorschemes.
This commit is contained in:
@@ -5,7 +5,7 @@ ScriptID SourceID Filename
|
|||||||
#2754 13139 :AutoInstall: delimitMate.vim
|
#2754 13139 :AutoInstall: delimitMate.vim
|
||||||
1984 13961 fuzzyfinder.vim
|
1984 13961 fuzzyfinder.vim
|
||||||
311 7645 grep.vim
|
311 7645 grep.vim
|
||||||
3304 15211 gundo.vim
|
3304 15744 gundo.vim
|
||||||
2727 11120 jsbeautify.vim
|
2727 11120 jsbeautify.vim
|
||||||
2666 15663 Mark
|
2666 15663 Mark
|
||||||
2262 8944 occur.vim
|
2262 8944 occur.vim
|
||||||
@@ -16,8 +16,8 @@ ScriptID SourceID Filename
|
|||||||
1697 12566 :AutoInstall: surround.vim
|
1697 12566 :AutoInstall: surround.vim
|
||||||
#273 7701 taglist.vim # exchanged with taglisttoo
|
#273 7701 taglist.vim # exchanged with taglisttoo
|
||||||
#and taglisttoo was exchanged by tagbar
|
#and taglisttoo was exchanged by tagbar
|
||||||
3465 15532 Tagbar
|
3465 15751 Tagbar
|
||||||
90 13751 vcscommand.vim
|
90 15797 vcscommand.vim
|
||||||
2226 13756 vimwiki.vim
|
2226 13756 vimwiki.vim
|
||||||
2289 0 loremipsum.vim
|
2289 0 loremipsum.vim
|
||||||
1334 6377 vst.vim
|
1334 6377 vst.vim
|
||||||
@@ -29,8 +29,8 @@ ScriptID SourceID Filename
|
|||||||
2555 15432 jellybeans.vim
|
2555 15432 jellybeans.vim
|
||||||
2536 15197 lucius.vim
|
2536 15197 lucius.vim
|
||||||
3299 14475 sorcerer.vim
|
3299 14475 sorcerer.vim
|
||||||
3309 14699 vydark
|
3309 15759 vydark
|
||||||
2589 14175 vylight
|
2589 15760 vylight
|
||||||
1165 3741 tolerable.vim
|
1165 3741 tolerable.vim
|
||||||
415 15531 zenburn
|
415 15531 zenburn
|
||||||
# compiler
|
# compiler
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Vim colour file
|
" Vim colour file
|
||||||
"
|
"
|
||||||
" Maintainer: Vy-Shane Sin Fat <shane@node.mu>
|
" Maintainer: Vy-Shane Sin Fat <shane@node.mu>
|
||||||
" Version: 1.1
|
" Version: 1.2
|
||||||
"
|
"
|
||||||
" This colour file is meant for GUI use.
|
" This colour file is meant for GUI use.
|
||||||
"
|
"
|
||||||
@@ -27,6 +27,7 @@ hi VertSplit guifg=#353535 guibg=#353535 gui=none
|
|||||||
hi ModeMsg guifg=#99dd99 guibg=#394439 gui=none
|
hi ModeMsg guifg=#99dd99 guibg=#394439 gui=none
|
||||||
hi ErrorMsg guifg=#222222 guibg=#ff8888 gui=none
|
hi ErrorMsg guifg=#222222 guibg=#ff8888 gui=none
|
||||||
hi Error guifg=#ffaaaa guibg=#333333 gui=none
|
hi Error guifg=#ffaaaa guibg=#333333 gui=none
|
||||||
|
hi Folded guifg=#666677 guibg=#242424
|
||||||
|
|
||||||
|
|
||||||
" Vim 7.x specific
|
" Vim 7.x specific
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Vim colour file
|
" Vim colour file
|
||||||
"
|
"
|
||||||
" Maintainer: Vy-Shane Sin Fat <shane@node.mu>
|
" Maintainer: Vy-Shane Sin Fat <shane@node.mu>
|
||||||
" Version: 1.3
|
" Version: 1.4
|
||||||
"
|
"
|
||||||
" This colour file is meant for GUI use.
|
" This colour file is meant for GUI use.
|
||||||
"
|
"
|
||||||
@@ -27,6 +27,7 @@ hi VertSplit guifg=#eeeeee guibg=#eeeeee gui=none
|
|||||||
hi ModeMsg guifg=black guibg=#bbddff gui=none
|
hi ModeMsg guifg=black guibg=#bbddff gui=none
|
||||||
hi ErrorMsg guifg=black guibg=#ffbbbb gui=none
|
hi ErrorMsg guifg=black guibg=#ffbbbb gui=none
|
||||||
hi Error guifg=#bb3355 guibg=white gui=none
|
hi Error guifg=#bb3355 guibg=white gui=none
|
||||||
|
hi Folded guifg=#999999 guibg=#fafafa
|
||||||
|
|
||||||
|
|
||||||
" Vim 7.x specific
|
" Vim 7.x specific
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CONTENTS *Gundo-contents*
|
|||||||
3.6 gundo_disable ............. |gundo_disable|
|
3.6 gundo_disable ............. |gundo_disable|
|
||||||
3.7 gundo_map_move_older ...... |gundo_map_move_older|
|
3.7 gundo_map_move_older ...... |gundo_map_move_older|
|
||||||
gundo_map_move_newer ...... |gundo_map_move_newer|
|
gundo_map_move_newer ...... |gundo_map_move_newer|
|
||||||
|
3.8 gundo_close_on_revert ..... |gundo_close_on_revert|
|
||||||
4. License ........................ |GundoLicense|
|
4. License ........................ |GundoLicense|
|
||||||
5. Bugs ........................... |GundoBugs|
|
5. Bugs ........................... |GundoBugs|
|
||||||
6. Contributing ................... |GundoContributing|
|
6. Contributing ................... |GundoContributing|
|
||||||
@@ -188,6 +189,13 @@ useful if you use a Dvorak keyboard and have changed your movement keys.
|
|||||||
Default: gundo_map_move_older = "j"
|
Default: gundo_map_move_older = "j"
|
||||||
gundo_map_move_newer = "k"
|
gundo_map_move_newer = "k"
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
3.8 g:gundo_close_on_revert *gundo_close_on_revert*
|
||||||
|
|
||||||
|
Set this to 1 to automatically close the Gundo windows when reverting.
|
||||||
|
|
||||||
|
Default: 0 (windows do not automatically close)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
4. License *GundoLicense*
|
4. License *GundoLicense*
|
||||||
|
|
||||||
@@ -211,6 +219,9 @@ GitHub: http://github.com/sjl/gundo.vim/
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
7. Changelog *GundoChangelog*
|
7. Changelog *GundoChangelog*
|
||||||
|
|
||||||
|
v2.2.0
|
||||||
|
* Add the g:gundo_close_on_revert setting.
|
||||||
|
* Fix a bug with the splitbelow setting.
|
||||||
v2.1.1
|
v2.1.1
|
||||||
* Fix a bug with the movement key mappings.
|
* Fix a bug with the movement key mappings.
|
||||||
v2.1.0
|
v2.1.0
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Author: Jan Larres <jan@majutsushi.net>
|
Author: Jan Larres <jan@majutsushi.net>
|
||||||
Licence: Vim licence, see |license|
|
Licence: Vim licence, see |license|
|
||||||
Homepage: http://majutsushi.github.com/tagbar/
|
Homepage: http://majutsushi.github.com/tagbar/
|
||||||
Version: 2.0.1
|
Version: 2.1
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Contents *tagbar* *tagbar-contents*
|
Contents *tagbar* *tagbar-contents*
|
||||||
@@ -113,6 +113,12 @@ with doctorjs/jsctags and will use that if present, other programs require
|
|||||||
some configuration (see |tagbar-extend|). If a program does not work even with
|
some configuration (see |tagbar-extend|). If a program does not work even with
|
||||||
correct configuration please contact me.
|
correct configuration please contact me.
|
||||||
|
|
||||||
|
Note: jsctags has to be newer than 2011-01-06 since it needs the "-f" option
|
||||||
|
to work. Also, the output of jsctags seems to be a bit unreliable at the
|
||||||
|
moment (especially regarding line numbers), so if you notice some strange
|
||||||
|
behaviour with it please run it manually in a terminal to check whether the
|
||||||
|
bug is in jsctags or Tagbar.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Requirements *tagbar-requirements*
|
2. Requirements *tagbar-requirements*
|
||||||
|
|
||||||
@@ -417,6 +423,21 @@ Example:
|
|||||||
let g:tagbar_autoshowtag = 1
|
let g:tagbar_autoshowtag = 1
|
||||||
<
|
<
|
||||||
|
|
||||||
|
*g:tagbar_systemenc*
|
||||||
|
g:tagbar_systemenc~
|
||||||
|
Default: value of 'encoding'
|
||||||
|
|
||||||
|
This variable is for cases where the character encoding of your operating
|
||||||
|
system is different from the one set in Vim, i.e. the 'encoding' option. For
|
||||||
|
example, if you use a Simplified Chinese Windows version that has a system
|
||||||
|
encoding of "cp936", and you have set 'encoding' to "utf-8", then you would
|
||||||
|
have to set this variable to "cp936".
|
||||||
|
|
||||||
|
Example:
|
||||||
|
>
|
||||||
|
let g:tagbar_systemenc = 'cp936'
|
||||||
|
<
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
HIGHLIGHT COLOURS *tagbar-highlight*
|
HIGHLIGHT COLOURS *tagbar-highlight*
|
||||||
|
|
||||||
@@ -486,7 +507,9 @@ complicated cases.
|
|||||||
|
|
||||||
Tagbar has a flexible mechanism for extending the existing file type (i.e.
|
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
|
language) definitions. This can be used both to change the settings of the
|
||||||
existing types and to add completely new types.
|
existing types and to add completely new types. A complete configuration
|
||||||
|
consists of a type definition for Tagbar in your |vimrc| and optionally a
|
||||||
|
language definition for ctags in case you want to add a new language.
|
||||||
|
|
||||||
Every type definition in Tagbar is a dictionary with the following keys:
|
Every type definition in Tagbar is a dictionary with the following keys:
|
||||||
|
|
||||||
@@ -577,12 +600,13 @@ ctagsargs: The arguments to be passed to the filetype-specific ctags program
|
|||||||
program.
|
program.
|
||||||
|
|
||||||
|
|
||||||
You then have to assign this dictionary to a variable with the name
|
You then have to assign this dictionary to a variable in your vimrc with the
|
||||||
|
name
|
||||||
>
|
>
|
||||||
g:tagbar_type_{vim filetype}
|
g:tagbar_type_{vim filetype}
|
||||||
<
|
<
|
||||||
For example, for C++ the name would be "g:tagbar_type_cpp". If you don't know
|
For example, for C++ the name would be "g:tagbar_type_cpp". If you don't know
|
||||||
the vim file type run the following command:
|
the vim file type then run the following command:
|
||||||
>
|
>
|
||||||
:set filetype?
|
:set filetype?
|
||||||
<
|
<
|
||||||
@@ -780,6 +804,22 @@ files.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
8. History *tagbar-history*
|
8. History *tagbar-history*
|
||||||
|
|
||||||
|
2.1 (2011-05-29)
|
||||||
|
- Make Tagbar work in (hopefully) all cases under Windows
|
||||||
|
- Handle cases where 'encoding' is different from system encoding, for
|
||||||
|
example on a Chinese Windows with 'encoding' set to "utf-8" (see manual
|
||||||
|
for details in case it doesn't work out-of-the-box)
|
||||||
|
- Fixed a bug with the handling of subtypes like "python.django"
|
||||||
|
- If a session got saved with Tagbar open it now gets restored properly
|
||||||
|
- Locally reset foldmethod/foldexpr in case foldexpr got set to something
|
||||||
|
expensive globally
|
||||||
|
- Tagbar now tries hard to go to the correct window when jumping to a tag
|
||||||
|
- Explain some possible issues with the current jsctags version in the
|
||||||
|
manual
|
||||||
|
- Explicitly check for some possible configuration problems to be able to
|
||||||
|
give better feedback
|
||||||
|
- A few other small fixes
|
||||||
|
|
||||||
2.0.1 (2011-04-26)
|
2.0.1 (2011-04-26)
|
||||||
- Fix sorting bug when 'ignorecase' is set
|
- Fix sorting bug when 'ignorecase' is set
|
||||||
|
|
||||||
|
|||||||
2
doc/tags
2
doc/tags
@@ -382,6 +382,7 @@ g:tagbar_expand tagbar.txt /*g:tagbar_expand*
|
|||||||
g:tagbar_foldlevel tagbar.txt /*g:tagbar_foldlevel*
|
g:tagbar_foldlevel tagbar.txt /*g:tagbar_foldlevel*
|
||||||
g:tagbar_left tagbar.txt /*g:tagbar_left*
|
g:tagbar_left tagbar.txt /*g:tagbar_left*
|
||||||
g:tagbar_sort tagbar.txt /*g:tagbar_sort*
|
g:tagbar_sort tagbar.txt /*g:tagbar_sort*
|
||||||
|
g:tagbar_systemenc tagbar.txt /*g:tagbar_systemenc*
|
||||||
g:tagbar_usearrows tagbar.txt /*g:tagbar_usearrows*
|
g:tagbar_usearrows tagbar.txt /*g:tagbar_usearrows*
|
||||||
g:tagbar_width tagbar.txt /*g:tagbar_width*
|
g:tagbar_width tagbar.txt /*g:tagbar_width*
|
||||||
g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length*
|
g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length*
|
||||||
@@ -413,6 +414,7 @@ g:vimwiki_use_mouse vimwiki.txt /*g:vimwiki_use_mouse*
|
|||||||
g:vimwiki_valid_html_tags vimwiki.txt /*g:vimwiki_valid_html_tags*
|
g:vimwiki_valid_html_tags vimwiki.txt /*g:vimwiki_valid_html_tags*
|
||||||
g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
|
g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
|
||||||
gundo.txt gundo.txt /*gundo.txt*
|
gundo.txt gundo.txt /*gundo.txt*
|
||||||
|
gundo_close_on_revert gundo.txt /*gundo_close_on_revert*
|
||||||
gundo_disable gundo.txt /*gundo_disable*
|
gundo_disable gundo.txt /*gundo_disable*
|
||||||
gundo_help gundo.txt /*gundo_help*
|
gundo_help gundo.txt /*gundo_help*
|
||||||
gundo_map_move_newer gundo.txt /*gundo_map_move_newer*
|
gundo_map_move_newer gundo.txt /*gundo_map_move_newer*
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ endif"}}}
|
|||||||
if !exists("g:gundo_map_move_newer")"{{{
|
if !exists("g:gundo_map_move_newer")"{{{
|
||||||
let g:gundo_map_move_newer = 'k'
|
let g:gundo_map_move_newer = 'k'
|
||||||
endif"}}}
|
endif"}}}
|
||||||
|
if !exists("g:gundo_close_on_revert")"{{{
|
||||||
|
let g:gundo_close_on_revert = 0
|
||||||
|
endif"}}}
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
@@ -595,11 +598,19 @@ function! s:GundoClose()"{{{
|
|||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
function! s:GundoOpen()"{{{
|
function! s:GundoOpen()"{{{
|
||||||
|
" Save `splitbelow` value and set it to default to avoid problems with
|
||||||
|
" positioning new windows.
|
||||||
|
let saved_splitbelow = &splitbelow
|
||||||
|
let &splitbelow = 0
|
||||||
|
|
||||||
call s:GundoOpenPreview()
|
call s:GundoOpenPreview()
|
||||||
exe bufwinnr(g:gundo_target_n) . "wincmd w"
|
exe bufwinnr(g:gundo_target_n) . "wincmd w"
|
||||||
|
|
||||||
call s:GundoRenderGraph()
|
call s:GundoRenderGraph()
|
||||||
call s:GundoRenderPreview()
|
call s:GundoRenderPreview()
|
||||||
|
|
||||||
|
" Restore `splitbelow` value.
|
||||||
|
let &splitbelow = saved_splitbelow
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
function! s:GundoToggle()"{{{
|
function! s:GundoToggle()"{{{
|
||||||
@@ -884,6 +895,9 @@ def GundoRevert():
|
|||||||
vim.command('GundoRenderGraph')
|
vim.command('GundoRenderGraph')
|
||||||
_goto_window_for_buffer(back)
|
_goto_window_for_buffer(back)
|
||||||
|
|
||||||
|
if int(vim.eval('g:gundo_close_on_revert')):
|
||||||
|
vim.command('GundoToggle')
|
||||||
|
|
||||||
GundoRevert()
|
GundoRevert()
|
||||||
ENDPYTHON
|
ENDPYTHON
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
" Author: Jan Larres <jan@majutsushi.net>
|
" Author: Jan Larres <jan@majutsushi.net>
|
||||||
" Licence: Vim licence
|
" Licence: Vim licence
|
||||||
" Website: http://majutsushi.github.com/tagbar/
|
" Website: http://majutsushi.github.com/tagbar/
|
||||||
" Version: 2.0.1
|
" Version: 2.1
|
||||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||||
"
|
"
|
||||||
@@ -25,9 +25,17 @@ endif
|
|||||||
" Initialization {{{1
|
" Initialization {{{1
|
||||||
|
|
||||||
" Basic init {{{2
|
" Basic init {{{2
|
||||||
|
|
||||||
|
if v:version < 700
|
||||||
|
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists('g:tagbar_ctags_bin')
|
if !exists('g:tagbar_ctags_bin')
|
||||||
if executable('ctags-exuberant')
|
if executable('ctags-exuberant')
|
||||||
let g:tagbar_ctags_bin = 'ctags-exuberant'
|
let g:tagbar_ctags_bin = 'ctags-exuberant'
|
||||||
|
elseif executable('exuberant-ctags')
|
||||||
|
let g:tagbar_ctags_bin = 'exuberant-ctags'
|
||||||
elseif executable('exctags')
|
elseif executable('exctags')
|
||||||
let g:tagbar_ctags_bin = 'exctags'
|
let g:tagbar_ctags_bin = 'exctags'
|
||||||
elseif executable('ctags')
|
elseif executable('ctags')
|
||||||
@@ -49,6 +57,16 @@ else
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
redir => s:ftype_out
|
||||||
|
silent filetype
|
||||||
|
redir END
|
||||||
|
if s:ftype_out !~# 'detection:ON'
|
||||||
|
echomsg 'Tagbar: Filetype detection is turned off, skipping plugin'
|
||||||
|
unlet s:ftype_out
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
unlet s:ftype_out
|
||||||
|
|
||||||
let g:loaded_tagbar = 1
|
let g:loaded_tagbar = 1
|
||||||
|
|
||||||
if !exists('g:tagbar_left')
|
if !exists('g:tagbar_left')
|
||||||
@@ -91,6 +109,10 @@ if !exists('g:tagbar_autoshowtag')
|
|||||||
let g:tagbar_autoshowtag = 0
|
let g:tagbar_autoshowtag = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:tagbar_systemenc')
|
||||||
|
let g:tagbar_systemenc = &encoding
|
||||||
|
endif
|
||||||
|
|
||||||
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
||||||
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
||||||
let s:icon_closed = '▶'
|
let s:icon_closed = '▶'
|
||||||
@@ -105,6 +127,7 @@ endif
|
|||||||
|
|
||||||
let s:type_init_done = 0
|
let s:type_init_done = 0
|
||||||
let s:autocommands_done = 0
|
let s:autocommands_done = 0
|
||||||
|
let s:checked_ctags = 0
|
||||||
let s:window_expanded = 0
|
let s:window_expanded = 0
|
||||||
|
|
||||||
let s:access_symbols = {
|
let s:access_symbols = {
|
||||||
@@ -113,6 +136,8 @@ let s:access_symbols = {
|
|||||||
\ 'private' : '-'
|
\ 'private' : '-'
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
autocmd SessionLoadPost * nested call s:RestoreSession()
|
||||||
|
|
||||||
" s:InitTypes() {{{2
|
" s:InitTypes() {{{2
|
||||||
function! s:InitTypes()
|
function! s:InitTypes()
|
||||||
let s:known_types = {}
|
let s:known_types = {}
|
||||||
@@ -808,6 +833,42 @@ function! s:GetUserTypeDefs()
|
|||||||
return defdict
|
return defdict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" s:RestoreSession() {{{2
|
||||||
|
" Properly restore Tagbar after a session got loaded
|
||||||
|
function! s:RestoreSession()
|
||||||
|
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||||
|
if tagbarwinnr == -1
|
||||||
|
" Tagbar wasn't open in the saved session, nothing to do
|
||||||
|
return
|
||||||
|
else
|
||||||
|
let in_tagbar = 1
|
||||||
|
if winnr() != tagbarwinnr
|
||||||
|
execute tagbarwinnr . 'wincmd w'
|
||||||
|
let in_tagbar = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:type_init_done
|
||||||
|
call s:InitTypes()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:checked_ctags
|
||||||
|
if !s:CheckForExCtags()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:InitWindow(g:tagbar_autoclose)
|
||||||
|
|
||||||
|
" Leave the Tagbar window and come back so the update event gets triggered
|
||||||
|
execute 'wincmd p'
|
||||||
|
execute tagbarwinnr . 'wincmd w'
|
||||||
|
|
||||||
|
if !in_tagbar
|
||||||
|
execute 'wincmd p'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" s:MapKeys() {{{2
|
" s:MapKeys() {{{2
|
||||||
function! s:MapKeys()
|
function! s:MapKeys()
|
||||||
nnoremap <script> <silent> <buffer> <CR> :call <SID>JumpToTag(0)<CR>
|
nnoremap <script> <silent> <buffer> <CR> :call <SID>JumpToTag(0)<CR>
|
||||||
@@ -841,7 +902,7 @@ function! s:MapKeys()
|
|||||||
|
|
||||||
nnoremap <script> <silent> <buffer> s :call <SID>ToggleSort()<CR>
|
nnoremap <script> <silent> <buffer> s :call <SID>ToggleSort()<CR>
|
||||||
nnoremap <script> <silent> <buffer> x :call <SID>ZoomWindow()<CR>
|
nnoremap <script> <silent> <buffer> x :call <SID>ZoomWindow()<CR>
|
||||||
nnoremap <script> <silent> <buffer> q :close<CR>
|
nnoremap <script> <silent> <buffer> q :call <SID>CloseWindow()<CR>
|
||||||
nnoremap <script> <silent> <buffer> <F1> :call <SID>ToggleHelp()<CR>
|
nnoremap <script> <silent> <buffer> <F1> :call <SID>ToggleHelp()<CR>
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -862,6 +923,58 @@ function! s:CreateAutocommands()
|
|||||||
let s:autocommands_done = 1
|
let s:autocommands_done = 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" s:CheckForExCtags() {{{2
|
||||||
|
" Test whether the ctags binary is actually Exuberant Ctags and not GNU ctags
|
||||||
|
" (or something else)
|
||||||
|
function! s:CheckForExCtags()
|
||||||
|
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--version')
|
||||||
|
if ctags_cmd == ''
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_output = s:ExecuteCtags(ctags_cmd)
|
||||||
|
|
||||||
|
if v:shell_error || ctags_output !~# 'Exuberant Ctags'
|
||||||
|
echoerr 'Tagbar: Ctags doesn''t seem to be Exuberant Ctags!'
|
||||||
|
echomsg 'GNU ctags will NOT WORK.'
|
||||||
|
\ 'Please download Exuberant Ctags from ctags.sourceforge.net'
|
||||||
|
\ 'and install it in a directory in your $PATH'
|
||||||
|
\ 'or set g:tagbar_ctags_bin.'
|
||||||
|
echomsg 'Executed command: "' . ctags_cmd . '"'
|
||||||
|
if !empty(ctags_output)
|
||||||
|
echomsg 'Command output:'
|
||||||
|
for line in split(ctags_output, '\n')
|
||||||
|
echomsg line
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
elseif !s:CheckExCtagsVersion(ctags_output)
|
||||||
|
echoerr 'Tagbar: Exuberant Ctags is too old!'
|
||||||
|
echomsg 'You need at least version 5.5 for Tagbar to work.'
|
||||||
|
\ 'Please download a newer version from ctags.sourceforge.net.'
|
||||||
|
echomsg 'Executed command: "' . ctags_cmd . '"'
|
||||||
|
if !empty(ctags_output)
|
||||||
|
echomsg 'Command output:'
|
||||||
|
for line in split(ctags_output, '\n')
|
||||||
|
echomsg line
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
let s:checked_ctags = 1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" s:CheckExCtagsVersion() {{{2
|
||||||
|
function! s:CheckExCtagsVersion(output)
|
||||||
|
let matchlist = matchlist(a:output, '\vExuberant Ctags (\d+)\.(\d+)')
|
||||||
|
let major = matchlist[1]
|
||||||
|
let minor = matchlist[2]
|
||||||
|
|
||||||
|
return major >= 6 || (major == 5 && minor >= 5)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Prototypes {{{1
|
" Prototypes {{{1
|
||||||
" Base tag {{{2
|
" Base tag {{{2
|
||||||
let s:BaseTag = {}
|
let s:BaseTag = {}
|
||||||
@@ -1284,10 +1397,6 @@ endfunction
|
|||||||
|
|
||||||
" s:OpenWindow() {{{2
|
" s:OpenWindow() {{{2
|
||||||
function! s:OpenWindow(autoclose)
|
function! s:OpenWindow(autoclose)
|
||||||
if !s:type_init_done
|
|
||||||
call s:InitTypes()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the tagbar window is already open jump to it
|
" If the tagbar window is already open jump to it
|
||||||
let tagbarwinnr = bufwinnr('__Tagbar__')
|
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||||
if tagbarwinnr != -1
|
if tagbarwinnr != -1
|
||||||
@@ -1297,6 +1406,16 @@ function! s:OpenWindow(autoclose)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !s:type_init_done
|
||||||
|
call s:InitTypes()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:checked_ctags
|
||||||
|
if !s:CheckForExCtags()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" Expand the Vim window to accomodate for the Tagbar window if requested
|
" Expand the Vim window to accomodate for the Tagbar window if requested
|
||||||
if g:tagbar_expand && !s:window_expanded && has('gui_running')
|
if g:tagbar_expand && !s:window_expanded && has('gui_running')
|
||||||
let &columns += g:tagbar_width + 1
|
let &columns += g:tagbar_width + 1
|
||||||
@@ -1306,6 +1425,20 @@ function! s:OpenWindow(autoclose)
|
|||||||
let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical '
|
let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical '
|
||||||
exe 'silent keepalt ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__'
|
exe 'silent keepalt ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__'
|
||||||
|
|
||||||
|
call s:InitWindow(a:autoclose)
|
||||||
|
|
||||||
|
execute 'wincmd p'
|
||||||
|
|
||||||
|
" Jump back to the tagbar window if autoclose or autofocus is set. Can't
|
||||||
|
" just stay in it since it wouldn't trigger the update event
|
||||||
|
if g:tagbar_autoclose || a:autoclose || g:tagbar_autofocus
|
||||||
|
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||||
|
execute tagbarwinnr . 'wincmd w'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" s:InitWindow() {{{2
|
||||||
|
function! s:InitWindow(autoclose)
|
||||||
setlocal noreadonly " in case the "view" mode is used
|
setlocal noreadonly " in case the "view" mode is used
|
||||||
setlocal buftype=nofile
|
setlocal buftype=nofile
|
||||||
setlocal bufhidden=hide
|
setlocal bufhidden=hide
|
||||||
@@ -1324,13 +1457,14 @@ function! s:OpenWindow(autoclose)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal nofoldenable
|
setlocal nofoldenable
|
||||||
|
" Reset fold settings in case a plugin set them globally to something
|
||||||
|
" expensive. Apparently 'foldexpr' gets executed even if 'foldenable' is
|
||||||
|
" off, and then for every appended line (like with :put).
|
||||||
|
setlocal foldmethod&
|
||||||
|
setlocal foldexpr&
|
||||||
|
|
||||||
setlocal statusline=%!TagbarGenerateStatusline()
|
setlocal statusline=%!TagbarGenerateStatusline()
|
||||||
|
|
||||||
" Variable for saving the current file for functions that are called from
|
|
||||||
" the tagbar window
|
|
||||||
let s:current_file = ''
|
|
||||||
|
|
||||||
" Script-local variable needed since compare functions can't
|
" Script-local variable needed since compare functions can't
|
||||||
" take extra arguments
|
" take extra arguments
|
||||||
let s:compare_typeinfo = {}
|
let s:compare_typeinfo = {}
|
||||||
@@ -1357,15 +1491,6 @@ function! s:OpenWindow(autoclose)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let &cpoptions = cpoptions_save
|
let &cpoptions = cpoptions_save
|
||||||
|
|
||||||
execute 'wincmd p'
|
|
||||||
|
|
||||||
" Jump back to the tagbar window if autoclose or autofocus is set. Can't
|
|
||||||
" just stay in it since it wouldn't trigger the update event
|
|
||||||
if g:tagbar_autoclose || a:autoclose || g:tagbar_autofocus
|
|
||||||
let tagbarwinnr = bufwinnr('__Tagbar__')
|
|
||||||
execute tagbarwinnr . 'wincmd w'
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" s:CloseWindow() {{{2
|
" s:CloseWindow() {{{2
|
||||||
@@ -1430,61 +1555,15 @@ function! s:ProcessFile(fname, ftype)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let typeinfo = s:known_types[a:ftype]
|
let ctags_output = s:ExecuteCtagsOnFile(a:fname, a:ftype)
|
||||||
|
|
||||||
if has_key(typeinfo, 'ctagsargs')
|
if ctags_output == -1
|
||||||
let ctags_args = ' ' . typeinfo.ctagsargs . ' '
|
|
||||||
else
|
|
||||||
let ctags_args = ' -f - '
|
|
||||||
let ctags_args .= ' --format=2 '
|
|
||||||
let ctags_args .= ' --excmd=pattern '
|
|
||||||
let ctags_args .= ' --fields=nksSa '
|
|
||||||
let ctags_args .= ' --extra= '
|
|
||||||
let ctags_args .= ' --sort=yes '
|
|
||||||
|
|
||||||
" Include extra type definitions
|
|
||||||
if has_key(typeinfo, 'deffile')
|
|
||||||
let ctags_args .= ' --options=' . typeinfo.deffile . ' '
|
|
||||||
endif
|
|
||||||
|
|
||||||
let ctags_type = typeinfo.ctagstype
|
|
||||||
|
|
||||||
let ctags_kinds = ''
|
|
||||||
for kind in typeinfo.kinds
|
|
||||||
let ctags_kinds .= kind.short
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let ctags_args .= ' --language-force=' . ctags_type .
|
|
||||||
\ ' --' . ctags_type . '-kinds=' . ctags_kinds . ' '
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has_key(typeinfo, 'ctagsbin')
|
|
||||||
let ctags_bin = expand(typeinfo.ctagsbin)
|
|
||||||
else
|
|
||||||
let ctags_bin = g:tagbar_ctags_bin
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let ctags_bin = fnamemodify(ctags_bin, ':8')
|
|
||||||
else
|
|
||||||
let ctags_bin = shellescape(ctags_bin)
|
|
||||||
endif
|
|
||||||
let ctags_cmd = ctags_bin . ctags_args . shellescape(a:fname)
|
|
||||||
let ctags_output = system(ctags_cmd)
|
|
||||||
|
|
||||||
if v:shell_error
|
|
||||||
echoerr 'Tagbar: Could not execute ctags for ' . a:fname . '!'
|
|
||||||
echomsg 'Executed command: "' . ctags_cmd . '"'
|
|
||||||
if !empty(ctags_output)
|
|
||||||
echomsg 'Command output:'
|
|
||||||
for line in split(ctags_output, '\n')
|
|
||||||
echomsg line
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
" put an empty entry into known_files so the error message is only
|
" put an empty entry into known_files so the error message is only
|
||||||
" shown once
|
" shown once
|
||||||
call s:known_files.put({}, a:fname)
|
call s:known_files.put({}, a:fname)
|
||||||
return
|
return
|
||||||
|
elseif ctags_output == ''
|
||||||
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If the file has only been updated preserve the fold states, otherwise
|
" If the file has only been updated preserve the fold states, otherwise
|
||||||
@@ -1496,6 +1575,8 @@ function! s:ProcessFile(fname, ftype)
|
|||||||
let fileinfo = s:FileInfo.New(a:fname, a:ftype)
|
let fileinfo = s:FileInfo.New(a:fname, a:ftype)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let typeinfo = s:known_types[a:ftype]
|
||||||
|
|
||||||
" Parse the ctags output lines
|
" Parse the ctags output lines
|
||||||
let rawtaglist = split(ctags_output, '\n\+')
|
let rawtaglist = split(ctags_output, '\n\+')
|
||||||
for line in rawtaglist
|
for line in rawtaglist
|
||||||
@@ -1559,6 +1640,64 @@ function! s:ProcessFile(fname, ftype)
|
|||||||
call s:known_files.put(fileinfo)
|
call s:known_files.put(fileinfo)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" s:ExecuteCtagsOnFile() {{{2
|
||||||
|
function! s:ExecuteCtagsOnFile(fname, ftype)
|
||||||
|
let typeinfo = s:known_types[a:ftype]
|
||||||
|
|
||||||
|
if has_key(typeinfo, 'ctagsargs')
|
||||||
|
let ctags_args = ' ' . typeinfo.ctagsargs . ' '
|
||||||
|
else
|
||||||
|
let ctags_args = ' -f - '
|
||||||
|
let ctags_args .= ' --format=2 '
|
||||||
|
let ctags_args .= ' --excmd=pattern '
|
||||||
|
let ctags_args .= ' --fields=nksSa '
|
||||||
|
let ctags_args .= ' --extra= '
|
||||||
|
let ctags_args .= ' --sort=yes '
|
||||||
|
|
||||||
|
" Include extra type definitions
|
||||||
|
if has_key(typeinfo, 'deffile')
|
||||||
|
let ctags_args .= ' --options=' . typeinfo.deffile . ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_type = typeinfo.ctagstype
|
||||||
|
|
||||||
|
let ctags_kinds = ''
|
||||||
|
for kind in typeinfo.kinds
|
||||||
|
let ctags_kinds .= kind.short
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let ctags_args .= ' --language-force=' . ctags_type .
|
||||||
|
\ ' --' . ctags_type . '-kinds=' . ctags_kinds . ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has_key(typeinfo, 'ctagsbin')
|
||||||
|
let ctags_bin = expand(typeinfo.ctagsbin)
|
||||||
|
else
|
||||||
|
let ctags_bin = g:tagbar_ctags_bin
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_cmd = s:EscapeCtagsCmd(ctags_bin, ctags_args, a:fname)
|
||||||
|
if ctags_cmd == ''
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_output = s:ExecuteCtags(ctags_cmd)
|
||||||
|
|
||||||
|
if v:shell_error || ctags_output =~ 'Warning: cannot open source file'
|
||||||
|
echoerr 'Tagbar: Could not execute ctags for ' . a:fname . '!'
|
||||||
|
echomsg 'Executed command: "' . ctags_cmd . '"'
|
||||||
|
if !empty(ctags_output)
|
||||||
|
echomsg 'Command output:'
|
||||||
|
for line in split(ctags_output, '\n')
|
||||||
|
echomsg line
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ctags_output
|
||||||
|
endfunction
|
||||||
|
|
||||||
" s:ParseTagline() {{{2
|
" s:ParseTagline() {{{2
|
||||||
" Structure of a tag line:
|
" Structure of a tag line:
|
||||||
" tagname<TAB>filename<TAB>expattern;"fields
|
" tagname<TAB>filename<TAB>expattern;"fields
|
||||||
@@ -1911,6 +2050,8 @@ function! s:RenderContent(...)
|
|||||||
|
|
||||||
let lazyredraw_save = &lazyredraw
|
let lazyredraw_save = &lazyredraw
|
||||||
set lazyredraw
|
set lazyredraw
|
||||||
|
let eventignore_save = &eventignore
|
||||||
|
set eventignore=all
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
|
|
||||||
@@ -1952,6 +2093,7 @@ function! s:RenderContent(...)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let &lazyredraw = lazyredraw_save
|
let &lazyredraw = lazyredraw_save
|
||||||
|
let &eventignore = eventignore_save
|
||||||
|
|
||||||
if !in_tagbar
|
if !in_tagbar
|
||||||
execute prevwinnr . 'wincmd w'
|
execute prevwinnr . 'wincmd w'
|
||||||
@@ -2177,7 +2319,30 @@ function! s:JumpToTag(stay_in_tagbar)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let tagbarwinnr = winnr()
|
let tagbarwinnr = winnr()
|
||||||
|
|
||||||
|
" This elaborate construct will try to switch to the correct
|
||||||
|
" buffer/window; if the buffer isn't currently shown in a window it will
|
||||||
|
" open it in the first window with a non-special buffer in it
|
||||||
execute 'wincmd p'
|
execute 'wincmd p'
|
||||||
|
let filebufnr = bufnr(taginfo.fileinfo.fpath)
|
||||||
|
if bufnr('%') != filebufnr
|
||||||
|
let filewinnr = bufwinnr(filebufnr)
|
||||||
|
if filewinnr != -1
|
||||||
|
execute filewinnr . 'wincmd w'
|
||||||
|
else
|
||||||
|
for i in range(1, winnr('$'))
|
||||||
|
execute i . 'wincmd w'
|
||||||
|
if &buftype == ''
|
||||||
|
execute 'buffer ' . filebufnr
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
" To make ctrl-w_p work we switch between the Tagbar window and the
|
||||||
|
" correct window once
|
||||||
|
execute tagbarwinnr . 'wincmd w'
|
||||||
|
execute 'wincmd p'
|
||||||
|
endif
|
||||||
|
|
||||||
" Mark current position so it can be jumped back to
|
" Mark current position so it can be jumped back to
|
||||||
mark '
|
mark '
|
||||||
@@ -2400,7 +2565,6 @@ endfunction
|
|||||||
function! s:CleanUp()
|
function! s:CleanUp()
|
||||||
silent autocmd! TagbarAutoCmds
|
silent autocmd! TagbarAutoCmds
|
||||||
|
|
||||||
unlet s:current_file
|
|
||||||
unlet s:is_maximized
|
unlet s:is_maximized
|
||||||
unlet s:compare_typeinfo
|
unlet s:compare_typeinfo
|
||||||
unlet s:short_help
|
unlet s:short_help
|
||||||
@@ -2434,14 +2598,14 @@ function! s:AutoUpdate(fname)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Only consider the main filetype in cases like 'python.django'
|
||||||
|
let ftype = get(split(&filetype, '\.'), 0, '')
|
||||||
|
|
||||||
" Don't do anything if the file isn't supported
|
" Don't do anything if the file isn't supported
|
||||||
if !s:IsValidFile(a:fname, &filetype)
|
if !s:IsValidFile(a:fname, ftype)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Only consider the main filetype in cases like 'python.django'
|
|
||||||
let ftype = split(&filetype, '\.')[0]
|
|
||||||
|
|
||||||
" Process the file if it's unknown or the information is outdated
|
" 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
|
" Also test for entries that exist but are empty, which will be the case
|
||||||
" if there was an error during the ctags execution
|
" if there was an error during the ctags execution
|
||||||
@@ -2490,6 +2654,76 @@ function! s:IsValidFile(fname, ftype)
|
|||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" s:EscapeCtagsCmd() {{{2
|
||||||
|
" Assemble the ctags command line in a way that all problematic characters are
|
||||||
|
" properly escaped and converted to the system's encoding
|
||||||
|
" Optional third parameter is a file name to run ctags on
|
||||||
|
function! s:EscapeCtagsCmd(ctags_bin, args, ...)
|
||||||
|
if exists('+shellslash')
|
||||||
|
let shellslash_save = &shellslash
|
||||||
|
set noshellslash
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:0 == 1
|
||||||
|
let fname = shellescape(a:1)
|
||||||
|
else
|
||||||
|
let fname = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_cmd = shellescape(a:ctags_bin) . ' ' . a:args . ' ' . fname
|
||||||
|
|
||||||
|
if exists('+shellslash')
|
||||||
|
let &shellslash = shellslash_save
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Needed for cases where 'encoding' is different from the system's
|
||||||
|
" encoding
|
||||||
|
if g:tagbar_systemenc != &encoding
|
||||||
|
let ctags_cmd = iconv(ctags_cmd, &encoding, g:tagbar_systemenc)
|
||||||
|
elseif $LANG != ''
|
||||||
|
let ctags_cmd = iconv(ctags_cmd, &encoding, $LANG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ctags_cmd == ''
|
||||||
|
echoerr 'Tagbar: Encoding conversion failed!'
|
||||||
|
\ 'Please make sure your system is set up correctly'
|
||||||
|
\ 'and that Vim is compiled with the "iconv" feature.'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ctags_cmd
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" s:ExecuteCtags() {{{2
|
||||||
|
" Execute ctags with necessary shell settings
|
||||||
|
" Partially based on the discussion at
|
||||||
|
" http://vim.1045645.n5.nabble.com/bad-default-shellxquote-in-Widows-td1208284.html
|
||||||
|
function! s:ExecuteCtags(ctags_cmd)
|
||||||
|
if exists('+shellslash')
|
||||||
|
let shellslash_save = &shellslash
|
||||||
|
set noshellslash
|
||||||
|
endif
|
||||||
|
|
||||||
|
if &shell =~ 'cmd\.exe'
|
||||||
|
let shellxquote_save = &shellxquote
|
||||||
|
set shellxquote=\"
|
||||||
|
let shellcmdflag_save = &shellcmdflag
|
||||||
|
set shellcmdflag=/s\ /c
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ctags_output = system(a:ctags_cmd)
|
||||||
|
|
||||||
|
if &shell =~ 'cmd\.exe'
|
||||||
|
let &shellxquote = shellxquote_save
|
||||||
|
let &shellcmdflag = shellcmdflag_save
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('+shellslash')
|
||||||
|
let &shellslash = shellslash_save
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ctags_output
|
||||||
|
endfunction
|
||||||
|
|
||||||
" s:GetTagInfo() {{{2
|
" s:GetTagInfo() {{{2
|
||||||
" Return the info dictionary of the tag on the specified line. If the line
|
" 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
|
" does not contain a valid tag (for example because it is empty or only
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ let s:bzrFunctions = {}
|
|||||||
" Returns the executable used to invoke bzr suitable for use in a shell
|
" Returns the executable used to invoke bzr suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
|
return VCSCommandGetOption('VCSCommandBZRExec', 'bzr')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
|
||||||
@@ -123,7 +123,7 @@ function! s:bzrFunctions.Annotate(argList)
|
|||||||
|
|
||||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||||
if resultBuffer > 0
|
if resultBuffer > 0
|
||||||
normal 1G2dd
|
normal! 1G2dd
|
||||||
endif
|
endif
|
||||||
return resultBuffer
|
return resultBuffer
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -376,6 +376,9 @@ function! s:VCSCommandUtility.system(...)
|
|||||||
set sxq=\"
|
set sxq=\"
|
||||||
endif
|
endif
|
||||||
try
|
try
|
||||||
|
if exists('*iconv')
|
||||||
|
return iconv(call('system', a:000), &tenc, &enc)
|
||||||
|
endif
|
||||||
return call('system', a:000)
|
return call('system', a:000)
|
||||||
finally
|
finally
|
||||||
if exists("save_sxq")
|
if exists("save_sxq")
|
||||||
@@ -434,7 +437,7 @@ function! s:ExecuteExtensionMapping(mapping)
|
|||||||
if !has_key(s:plugins[vcsType][2], a:mapping)
|
if !has_key(s:plugins[vcsType][2], a:mapping)
|
||||||
throw 'This extended mapping is not defined for ' . vcsType
|
throw 'This extended mapping is not defined for ' . vcsType
|
||||||
endif
|
endif
|
||||||
silent execute 'normal' ':' . s:plugins[vcsType][2][a:mapping] . "\<CR>"
|
silent execute 'normal!' ':' . s:plugins[vcsType][2][a:mapping] . "\<CR>"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ExecuteVCSCommand(command, argList) {{{2
|
" Function: s:ExecuteVCSCommand(command, argList) {{{2
|
||||||
@@ -740,12 +743,12 @@ function! s:VCSAnnotate(bang, ...)
|
|||||||
endif
|
endif
|
||||||
let originalFileType = getbufvar(originalBuffer, '&ft')
|
let originalFileType = getbufvar(originalBuffer, '&ft')
|
||||||
let annotateFileType = getbufvar(annotateBuffer, '&ft')
|
let annotateFileType = getbufvar(annotateBuffer, '&ft')
|
||||||
execute "normal 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
|
execute "normal! 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
|
||||||
call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype'))
|
call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype'))
|
||||||
set scrollbind
|
set scrollbind
|
||||||
leftabove vert new
|
leftabove vert new
|
||||||
normal 0P
|
normal! 0P
|
||||||
execute "normal" . col('$') . "\<c-w>|"
|
execute "normal!" . (col('$') + (&number ? &numberwidth : 0)). "\<c-w>|"
|
||||||
call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header')
|
call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header')
|
||||||
wincmd l
|
wincmd l
|
||||||
endif
|
endif
|
||||||
@@ -757,12 +760,12 @@ function! s:VCSAnnotate(bang, ...)
|
|||||||
" No argument list means that we're annotating
|
" No argument list means that we're annotating
|
||||||
" the current version, so jumping to the same
|
" the current version, so jumping to the same
|
||||||
" line is the expected action.
|
" line is the expected action.
|
||||||
execute "normal" line . 'G'
|
execute "normal!" line . 'G'
|
||||||
if has('folding')
|
if has('folding')
|
||||||
" The execution of the buffer created autocommand
|
" The execution of the buffer created autocommand
|
||||||
" re-folds the buffer. Display the current line
|
" re-folds the buffer. Display the current line
|
||||||
" unfolded.
|
" unfolded.
|
||||||
normal zv
|
normal! zv
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -982,8 +985,9 @@ function! s:VCSVimDiff(...)
|
|||||||
\ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')'
|
\ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')'
|
||||||
\ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
|
\ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
|
||||||
\ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
|
\ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
|
||||||
|
\ . '|call setbufvar('.originalBuffer.', ''&cursorbind'', '.getbufvar(originalBuffer, '&cursorbind').')'
|
||||||
\ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
|
\ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
|
||||||
\ . '|if &foldmethod==''manual''|execute ''normal zE''|endif'
|
\ . '|if &foldmethod==''manual''|execute ''normal! zE''|endif'
|
||||||
diffthis
|
diffthis
|
||||||
wincmd w
|
wincmd w
|
||||||
else
|
else
|
||||||
@@ -1073,7 +1077,7 @@ function! VCSCommandChdir(directory)
|
|||||||
if exists("*haslocaldir") && haslocaldir()
|
if exists("*haslocaldir") && haslocaldir()
|
||||||
let command = 'lcd'
|
let command = 'lcd'
|
||||||
endif
|
endif
|
||||||
execute command escape(a:directory, ' ')
|
execute command fnameescape(a:directory)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: VCSCommandChangeToCurrentFileDir() {{{2
|
" Function: VCSCommandChangeToCurrentFileDir() {{{2
|
||||||
@@ -1113,6 +1117,7 @@ endfunction
|
|||||||
function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
|
function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
|
||||||
let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap]
|
let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap]
|
||||||
if !empty(a:mappingMap)
|
if !empty(a:mappingMap)
|
||||||
|
\ && !exists("g:no_plugin_maps")
|
||||||
\ && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
|
\ && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
|
||||||
\ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0)
|
\ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0)
|
||||||
for shortcut in keys(a:mappingMap)
|
for shortcut in keys(a:mappingMap)
|
||||||
@@ -1160,7 +1165,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
|
|||||||
if match(a:cmd, '<VCSCOMMANDFILE>') > 0
|
if match(a:cmd, '<VCSCOMMANDFILE>') > 0
|
||||||
let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
|
let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
|
||||||
else
|
else
|
||||||
let fullCmd = a:cmd . ' -- "' . fileName . '"'
|
let fullCmd = a:cmd . ' -- ' . shellescape(fileName)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Change to the directory of the current buffer. This is done for CVS, but
|
" Change to the directory of the current buffer. This is done for CVS, but
|
||||||
@@ -1207,7 +1212,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
|
|||||||
" within a fold, but I prefer to simply unfold the result buffer altogether.
|
" within a fold, but I prefer to simply unfold the result buffer altogether.
|
||||||
|
|
||||||
if has('folding')
|
if has('folding')
|
||||||
normal zR
|
normal! zR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$d
|
$d
|
||||||
@@ -1284,6 +1289,14 @@ function! VCSCommandGetStatusLine()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! VCSCommandSetVCSType(type)
|
||||||
|
if exists('b:VCSCommandBufferSetup')
|
||||||
|
unlet b:VCSCommandBufferSetup
|
||||||
|
endif
|
||||||
|
let b:VCSCommandVCSType = a:type
|
||||||
|
call s:SetupBuffer()
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Section: Command definitions {{{1
|
" Section: Command definitions {{{1
|
||||||
" Section: Primary commands {{{2
|
" Section: Primary commands {{{2
|
||||||
com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', [<f-args>]))
|
com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', [<f-args>]))
|
||||||
@@ -1312,23 +1325,25 @@ com! VCSCommandEnableBufferSetup call VCSCommandEnableBufferSetup()
|
|||||||
com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|call s:ClearMenu()|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins
|
com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|call s:ClearMenu()|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins
|
||||||
|
|
||||||
" Section: Plugin command mappings {{{1
|
" Section: Plugin command mappings {{{1
|
||||||
nnoremap <silent> <Plug>VCSAdd :VCSAdd<CR>
|
if !exists("no_plugin_maps")
|
||||||
nnoremap <silent> <Plug>VCSAnnotate :VCSAnnotate<CR>
|
nnoremap <silent> <Plug>VCSAdd :VCSAdd<CR>
|
||||||
nnoremap <silent> <Plug>VCSCommit :VCSCommit<CR>
|
nnoremap <silent> <Plug>VCSAnnotate :VCSAnnotate<CR>
|
||||||
nnoremap <silent> <Plug>VCSDelete :VCSDelete<CR>
|
nnoremap <silent> <Plug>VCSCommit :VCSCommit<CR>
|
||||||
nnoremap <silent> <Plug>VCSDiff :VCSDiff<CR>
|
nnoremap <silent> <Plug>VCSDelete :VCSDelete<CR>
|
||||||
nnoremap <silent> <Plug>VCSGotoOriginal :VCSGotoOriginal<CR>
|
nnoremap <silent> <Plug>VCSDiff :VCSDiff<CR>
|
||||||
nnoremap <silent> <Plug>VCSClearAndGotoOriginal :VCSGotoOriginal!<CR>
|
nnoremap <silent> <Plug>VCSGotoOriginal :VCSGotoOriginal<CR>
|
||||||
nnoremap <silent> <Plug>VCSInfo :VCSInfo<CR>
|
nnoremap <silent> <Plug>VCSClearAndGotoOriginal :VCSGotoOriginal!<CR>
|
||||||
nnoremap <silent> <Plug>VCSLock :VCSLock<CR>
|
nnoremap <silent> <Plug>VCSInfo :VCSInfo<CR>
|
||||||
nnoremap <silent> <Plug>VCSLog :VCSLog<CR>
|
nnoremap <silent> <Plug>VCSLock :VCSLock<CR>
|
||||||
nnoremap <silent> <Plug>VCSRevert :VCSRevert<CR>
|
nnoremap <silent> <Plug>VCSLog :VCSLog<CR>
|
||||||
nnoremap <silent> <Plug>VCSReview :VCSReview<CR>
|
nnoremap <silent> <Plug>VCSRevert :VCSRevert<CR>
|
||||||
nnoremap <silent> <Plug>VCSSplitAnnotate :VCSAnnotate!<CR>
|
nnoremap <silent> <Plug>VCSReview :VCSReview<CR>
|
||||||
nnoremap <silent> <Plug>VCSStatus :VCSStatus<CR>
|
nnoremap <silent> <Plug>VCSSplitAnnotate :VCSAnnotate!<CR>
|
||||||
nnoremap <silent> <Plug>VCSUnlock :VCSUnlock<CR>
|
nnoremap <silent> <Plug>VCSStatus :VCSStatus<CR>
|
||||||
nnoremap <silent> <Plug>VCSUpdate :VCSUpdate<CR>
|
nnoremap <silent> <Plug>VCSUnlock :VCSUnlock<CR>
|
||||||
nnoremap <silent> <Plug>VCSVimDiff :VCSVimDiff<CR>
|
nnoremap <silent> <Plug>VCSUpdate :VCSUpdate<CR>
|
||||||
|
nnoremap <silent> <Plug>VCSVimDiff :VCSVimDiff<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
" Section: Default mappings {{{1
|
" Section: Default mappings {{{1
|
||||||
|
|
||||||
@@ -1352,7 +1367,7 @@ let s:defaultMappings = [
|
|||||||
\['v', 'VCSVimDiff'],
|
\['v', 'VCSVimDiff'],
|
||||||
\]
|
\]
|
||||||
|
|
||||||
if !VCSCommandGetOption('VCSCommandDisableMappings', 0)
|
if !exists("g:no_plugin_maps") && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
|
||||||
for [s:shortcut, s:vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings)
|
for [s:shortcut, s:vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings)
|
||||||
call s:CreateMapping(s:shortcut, '<Plug>' . s:vcsFunction, '''' . s:vcsFunction . '''')
|
call s:CreateMapping(s:shortcut, '<Plug>' . s:vcsFunction, '''' . s:vcsFunction . '''')
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ let s:cvsFunctions = {}
|
|||||||
" Returns the executable used to invoke cvs suitable for use in a shell
|
" Returns the executable used to invoke cvs suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
return VCSCommandGetOption('VCSCommandCVSExec', 'cvs')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
@@ -410,7 +410,8 @@ com! CVSWatchers call s:CVSWatchers()
|
|||||||
" Section: Plugin command mappings {{{1
|
" Section: Plugin command mappings {{{1
|
||||||
|
|
||||||
let s:cvsExtensionMappings = {}
|
let s:cvsExtensionMappings = {}
|
||||||
let mappingInfo = [
|
if !exists("no_plugin_maps")
|
||||||
|
let mappingInfo = [
|
||||||
\['CVSEdit', 'CVSEdit', 'e'],
|
\['CVSEdit', 'CVSEdit', 'e'],
|
||||||
\['CVSEditors', 'CVSEditors', 'E'],
|
\['CVSEditors', 'CVSEditors', 'E'],
|
||||||
\['CVSUnedit', 'CVSUnedit', 't'],
|
\['CVSUnedit', 'CVSUnedit', 't'],
|
||||||
@@ -421,12 +422,13 @@ let mappingInfo = [
|
|||||||
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
|
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
|
||||||
\]
|
\]
|
||||||
|
|
||||||
for [pluginName, commandText, shortCut] in mappingInfo
|
for [pluginName, commandText, shortCut] in mappingInfo
|
||||||
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
||||||
if !hasmapto('<Plug>' . pluginName)
|
if !hasmapto('<Plug>' . pluginName)
|
||||||
let s:cvsExtensionMappings[shortCut] = commandText
|
let s:cvsExtensionMappings[shortCut] = commandText
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
" Section: Plugin Registration {{{1
|
" Section: Plugin Registration {{{1
|
||||||
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ let s:gitFunctions = {}
|
|||||||
" Returns the executable used to invoke git suitable for use in a shell
|
" Returns the executable used to invoke git suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
return VCSCommandGetOption('VCSCommandGitExec', 'git')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ let s:hgFunctions = {}
|
|||||||
" Returns the executable used to invoke hg suitable for use in a shell
|
" Returns the executable used to invoke hg suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
|
return VCSCommandGetOption('VCSCommandHGExec', 'hg')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ let s:svkFunctions = {}
|
|||||||
" Returns the executable used to invoke SVK suitable for use in a shell
|
" Returns the executable used to invoke SVK suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
return VCSCommandGetOption('VCSCommandSVKExec', 'svk')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
@@ -122,7 +122,7 @@ function! s:svkFunctions.Annotate(argList)
|
|||||||
|
|
||||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||||
if resultBuffer > 0
|
if resultBuffer > 0
|
||||||
normal 1G2dd
|
normal! 1G2dd
|
||||||
endif
|
endif
|
||||||
return resultBuffer
|
return resultBuffer
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ let s:svnFunctions = {}
|
|||||||
" Returns the executable used to invoke git suitable for use in a shell
|
" Returns the executable used to invoke git suitable for use in a shell
|
||||||
" command.
|
" command.
|
||||||
function! s:Executable()
|
function! s:Executable()
|
||||||
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
return VCSCommandGetOption('VCSCommandSVNExec', 'svn')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
" Author: Jan Larres <jan@majutsushi.net>
|
" Author: Jan Larres <jan@majutsushi.net>
|
||||||
" Licence: Vim licence
|
" Licence: Vim licence
|
||||||
" Website: http://majutsushi.github.com/tagbar/
|
" Website: http://majutsushi.github.com/tagbar/
|
||||||
" Version: 2.0.1
|
" Version: 2.1
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
|
|||||||
Reference in New Issue
Block a user