diff --git a/.vimrc b/.vimrc index 7c0c869..9b972ff 100644 --- a/.vimrc +++ b/.vimrc @@ -148,6 +148,9 @@ let g:pydiction_location = '/home/gryf/.vim/after/ftplugin/pytdiction/complete-d "TagListToo {{{2 let g:VerticalToolWindowSide = 'right' "}}} +"Tagbar {{{2 +let g:tagbar_autoclose = 1 +"}}} "{{{ Pydoc let g:pydoc_cmd = "/usr/bin/pydoc" "}}} @@ -193,7 +196,8 @@ map wp VimwikiPrevWord map ]b :call OpenInFirefox() "make displaying tags easy -nmap t :TlistToo +"nmap t :TlistToo +nmap t :TagbarToggle "eclim Buffer shortcut map b :Buffers diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat index 5e350fd..fb3af36 100644 --- a/GetLatest/GetLatestVimScripts.dat +++ b/GetLatest/GetLatestVimScripts.dat @@ -5,7 +5,7 @@ ScriptID SourceID Filename #2754 13139 :AutoInstall: delimitMate.vim 1984 13961 fuzzyfinder.vim 311 7645 grep.vim -3304 14226 gundo.vim +3304 15184 gundo.vim 2727 11120 jsbeautify.vim 2666 14741 Mark 2262 8944 occur.vim @@ -15,6 +15,8 @@ ScriptID SourceID Filename 2540 11006 snipMate.vim 1697 12566 :AutoInstall: surround.vim #273 7701 taglist.vim # exchanged with taglisttoo +#and taglisttoo was exchanged by tagbar +3465 15165 Tagbar 90 13751 vcscommand.vim 2226 13756 vimwiki.vim 2289 0 loremipsum.vim @@ -23,7 +25,7 @@ ScriptID SourceID Filename 3252 13948 :AutoInstall: L9 ### colors 1975 7471 lettuce.vim -2536 15158 lucius.vim +2536 15197 lucius.vim 1165 3741 tolerable.vim # compiler 891 10365 pylint.vim diff --git a/GetLatest/GetLatestVimScripts.dist b/GetLatest/GetLatestVimScripts.dist deleted file mode 100644 index 4745fc8..0000000 --- a/GetLatest/GetLatestVimScripts.dist +++ /dev/null @@ -1,18 +0,0 @@ -ScriptID SourceID Filename --------------------------- -294 1 Align.vim -302 2 AnsiEsc.vim -122 3 astronaut.vim -104 4 blockhl.vim -120 5 decho.vim - 40 6 DrawIt.tar.gz -451 7 EasyAccents.vim -195 8 engspchk.vim -642 9 GetLatestVimScripts.vim -489 10 Manpageview.vim -551 11 Mines.vim -514 12 mrswin.vim -670 13 visincr.vim -628 14 SeeTab.vim -508 15 ZoomWin.vim -877 16 gvcolor.vim diff --git a/colors/lucius.vim b/colors/lucius.vim index 6a4499d..ed77b06 100644 --- a/colors/lucius.vim +++ b/colors/lucius.vim @@ -1,6 +1,6 @@ " Lucius vim color file " Maintainer: Jonathan Filip -" Version: 5.1 +" Version: 5.2 hi clear if exists("syntax_on") @@ -8,7 +8,38 @@ if exists("syntax_on") endif let colors_name="lucius" -" TODO Need to add entry for conceal +" Summary: +" Dark, light, and blue color schemes in one file (GUI and 256 color terminal). + +" Description: +" This file contains three color schemes that focus on using blues and greens. +" +" The original dark color scheme started out by combining pieces of several +" other color schemes and has evolved into what it is today. Those color +" schemes are: +" +" * oceandeep (vimscript #368) +" * peaksea (vimscript #760) +" * wombat (vimscript #1778) +" * moria (vimscript #1464) +" * zenburn (vimscript #415) +" +" The default color scheme is the original, dark scheme. You can change this by +" setting the g:lucius_style variable to "light", "dark", or "blue". Once the +" color scheme is loaded, you can use the commands "LuciusLight", "LuciusDark", +" and "LuciusBlue" to change schemes quickly. +" +" Screenshots of the different color schemes in a Windows 7 GUI: +" +" * Dark: http://i.imgur.com/z0bDr.png +" * Light: http://i.imgur.com/BXDiv.png +" * Blue: http://i.imgur.com/Ea1Gq.png +" +" colorsupport.vim (vimscript #2682) is used to help with mapping the GUI +" settings to the 256 terminal colors. + +" Installation: +" Copy the file to your vim colors directory and then do :colorscheme lucius. set background=dark if exists("g:lucius_style") @@ -62,7 +93,7 @@ if g:lucius_style == "dark" hi Underlined ctermfg=fg cterm=underline " any erroneous construct hi Error guifg=#e37170 guibg=#432323 gui=none - hi Error ctermfg=167 ctermbg=236 cterm=none + hi Error ctermfg=167 ctermbg=236 cterm=none " todo, fixme, note, xxx hi Todo guifg=#e0e090 guibg=NONE gui=underline hi Todo ctermfg=186 ctermbg=NONE cterm=underline @@ -135,7 +166,7 @@ if g:lucius_style == "dark" hi TabLineSel ctermfg=254 ctermbg=236 cterm=bold " column separating vertically split windows hi VertSplit guifg=#777777 guibg=#363946 gui=none - hi VertSplit ctermfg=242 ctermbg=237 cterm=none + hi VertSplit ctermfg=243 ctermbg=237 cterm=none " line used for closed folds hi Folded guifg=#d0e0f0 guibg=#202020 gui=none hi Folded ctermfg=117 ctermbg=235 cterm=none @@ -224,9 +255,9 @@ elseif g:lucius_style == "light" hi IdentifierBold ctermfg=30 cterm=bold hi Statement guifg=#0050b0 gui=none - hi Statement ctermfg=4 cterm=none + hi Statement ctermfg=25 cterm=none hi StatementBold guifg=#0050b0 gui=bold - hi StatementBold ctermfg=4 cterm=bold + hi StatementBold ctermfg=25 cterm=bold hi PreProc guifg=#b07000 gui=none hi PreProc ctermfg=130 cterm=none @@ -249,10 +280,10 @@ elseif g:lucius_style == "light" hi Underlined ctermfg=fg cterm=underline " any erroneous construct hi Error guifg=#c02020 guibg=#e0b0b0 gui=none - hi Error ctermfg=9 ctermbg=181 cterm=none + hi Error ctermfg=1 ctermbg=181 cterm=none " todo, fixme, note, xxx hi Todo guifg=#504000 guibg=#fff880 gui=underline - hi Todo ctermfg=94 ctermbg=229 cterm=underline + hi Todo ctermfg=58 ctermbg=228 cterm=underline " match parenthesis, brackets hi MatchParen guifg=NONE guibg=#a0f0b0 gui=none hi MatchParen ctermfg=NONE ctermbg=157 cterm=bold @@ -269,7 +300,7 @@ elseif g:lucius_style == "light" " == Text Selection == " character under the cursor hi Cursor guifg=bg guibg=#406090 - hi Cursor ctermfg=bg ctermbg=25 + hi Cursor ctermfg=bg ctermbg=4 " like cursor, but used when in IME mode hi CursorIM guifg=bg guibg=#96cdcd hi CursorIM ctermfg=bg ctermbg=116 @@ -298,7 +329,7 @@ elseif g:lucius_style == "light" hi Pmenu ctermfg=NONE ctermbg=254 cterm=none " selected item in popup hi PmenuSel guifg=#003050 guibg=#a0c0e0 gui=none - hi PmenuSel ctermfg=24 ctermbg=251 cterm=none + hi PmenuSel ctermfg=23 ctermbg=251 cterm=none " scrollbar in popup hi PMenuSbar guibg=#d0d8e0 gui=none hi PMenuSbar ctermbg=188 cterm=none @@ -325,10 +356,10 @@ elseif g:lucius_style == "light" hi VertSplit ctermfg=66 ctermbg=110 cterm=none " line used for closed folds hi Folded guifg=#004080 guibg=#d0e0e0 gui=none - hi Folded ctermfg=24 ctermbg=252 cterm=none + hi Folded ctermfg=24 ctermbg=253 cterm=none " column on side used to indicated open and closed folds hi FoldColumn guifg=#004080 guibg=#d0e0e0 gui=none - hi FoldColumn ctermfg=24 ctermbg=252 cterm=none + hi FoldColumn ctermfg=24 ctermbg=253 cterm=none " == Spelling == " word not recognized @@ -384,10 +415,10 @@ elseif g:lucius_style == "light" hi WarningMsg guifg=#e06020 gui=none hi WarningMsg ctermfg=166 cterm=none " current match in the wildmenu completion - hi WildMenu guifg=#007090 guibg=#90b0d0 gui=bold,underline - hi WildMenu ctermfg=26 ctermbg=110 cterm=bold + hi WildMenu guifg=#000000 guibg=#a0f0b0 gui=bold + hi WildMenu ctermfg=24 ctermbg=110 cterm=bold " color column highlighting - hi ColorColumn guifg=NONE guibg=#f0e0d0 gui=none + hi ColorColumn guifg=NONE guibg=#f0f0e0 gui=none hi ColorColumn ctermfg=NONE ctermbg=224 cterm=none " left blank, hidden hi Ignore guifg=bg @@ -398,22 +429,22 @@ elseif g:lucius_style == "blue" hi Normal ctermfg=253 ctermbg=234 hi Comment guifg=#506070 gui=none - hi Comment ctermfg=240 cterm=none + hi Comment ctermfg=59 cterm=none hi Constant guifg=#90d0a0 gui=none - hi Constant ctermfg=74 cterm=none + hi Constant ctermfg=115 cterm=none hi ConstantBold guifg=#90d0a0 gui=bold - hi ConstantBold ctermfg=74 cterm=bold + hi ConstantBold ctermfg=115 cterm=bold hi Identifier guifg=#a0d0c0 gui=none - hi Identifier ctermfg=116 cterm=none + hi Identifier ctermfg=151 cterm=none hi IdentifierBold guifg=#a0d0c0 gui=bold - hi IdentifierBold ctermfg=116 cterm=bold + hi IdentifierBold ctermfg=151 cterm=bold hi Statement guifg=#90d0e0 gui=none - hi Statement ctermfg=150 cterm=none + hi Statement ctermfg=117 cterm=none hi StatementBold guifg=#b3d38c gui=bold - hi StatementBold ctermfg=150 cterm=bold + hi StatementBold ctermfg=117 cterm=bold hi PreProc guifg=#e0e0b0 gui=none hi PreProc ctermfg=187 cterm=none @@ -421,14 +452,14 @@ elseif g:lucius_style == "blue" hi PreProcBold ctermfg=187 cterm=bold hi Type guifg=#90d0d0 gui=none - hi Type ctermfg=115 cterm=none + hi Type ctermfg=116 cterm=none hi TypeBold guifg=#80c0c0 gui=bold - hi TypeBold ctermfg=115 cterm=bold + hi TypeBold ctermfg=116 cterm=bold hi Special guifg=#b0b0d0 gui=none - hi Special ctermfg=182 cterm=none + hi Special ctermfg=146 cterm=none hi SpecialBold guifg=#a0a0c0 gui=bold - hi SpecialBold ctermfg=182 cterm=bold + hi SpecialBold ctermfg=146 cterm=bold " == Text Markup == " text that stands out, html links @@ -436,10 +467,10 @@ elseif g:lucius_style == "blue" hi Underlined ctermfg=fg cterm=underline " any erroneous construct hi Error guifg=#e07078 guibg=#402028 gui=none - hi Error ctermfg=167 ctermbg=236 cterm=none + hi Error ctermfg=167 ctermbg=52 cterm=none " todo, fixme, note, xxx hi Todo guifg=#e0e090 guibg=#505000 gui=underline - hi Todo ctermfg=186 ctermbg=NONE cterm=underline + hi Todo ctermfg=186 ctermbg=58 cterm=underline " match parenthesis, brackets hi MatchParen guifg=#00ff00 guibg=NONE gui=bold hi MatchParen ctermfg=46 ctermbg=NONE cterm=bold @@ -451,7 +482,7 @@ elseif g:lucius_style == "blue" hi SpecialKey ctermfg=239 " titles for output from :set all, :autocmd, etc hi Title guifg=#00e0a0 gui=none - hi Title ctermfg=74 cterm=none + hi Title ctermfg=43 cterm=none " == Text Selection == " character under the cursor @@ -477,7 +508,7 @@ elseif g:lucius_style == "blue" hi IncSearch ctermfg=87 cterm=reverse " hlsearch (last search pattern), also used for quickfix hi Search guibg=#f0b030 gui=none - hi Search ctermbg=214 cterm=none + hi Search ctermfg=0 ctermbg=214 cterm=none " == UI == " normal item in popup @@ -499,22 +530,22 @@ elseif g:lucius_style == "blue" hi StatusLineNC guifg=#8090a0 guibg=#405060 gui=none hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none " tab pages line, not active tab page label - hi TabLine guifg=#b6bf98 guibg=#363946 gui=none + hi TabLine guifg=#b6bf98 guibg=#405060 gui=none hi TabLine ctermfg=244 ctermbg=236 cterm=none " tab pages line, where there are no labels - hi TabLineFill guifg=#cfcfaf guibg=#363946 gui=none + hi TabLineFill guifg=#cfcfaf guibg=#405060 gui=none hi TabLineFill ctermfg=187 ctermbg=236 cterm=none " tab pages line, active tab page label - hi TabLineSel guifg=#efefef guibg=#414658 gui=bold + hi TabLineSel guifg=#efefef guibg=#405060 gui=bold hi TabLineSel ctermfg=254 ctermbg=236 cterm=bold " column separating vertically split windows hi VertSplit guifg=#8090a0 guibg=#405060 gui=none hi VertSplit ctermfg=242 ctermbg=237 cterm=none " line used for closed folds - hi Folded guifg=#d0e0f0 guibg=#202020 gui=none + hi Folded guifg=#d0e0f0 guibg=#102030 gui=none hi Folded ctermfg=117 ctermbg=235 cterm=none " column on side used to indicated open and closed folds - hi FoldColumn guifg=#c0c0d0 guibg=#363946 gui=none + hi FoldColumn guifg=#c0c0d0 guibg=#405060 gui=none hi FoldColumn ctermfg=117 ctermbg=238 cterm=none " == Spelling == @@ -553,10 +584,10 @@ elseif g:lucius_style == "blue" hi ErrorMsg guifg=#ee0000 guibg=NONE gui=none hi ErrorMsg ctermfg=196 ctermbg=NONE cterm=none " columns where signs are displayed (used in IDEs) - hi SignColumn guifg=#9fafaf guibg=#181818 gui=none + hi SignColumn guifg=#9fafaf guibg=#102030 gui=none hi SignColumn ctermfg=145 ctermbg=233 cterm=none " line numbers - hi LineNr guifg=#818698 guibg=#363946 + hi LineNr guifg=#a0b0c0 guibg=#405060 hi LineNr ctermfg=245 ctermbg=237 " the 'more' prompt when output takes more than one line hi MoreMsg guifg=#2e8b57 gui=none @@ -571,10 +602,10 @@ elseif g:lucius_style == "blue" hi WarningMsg guifg=#e5786d gui=none hi WarningMsg ctermfg=173 cterm=none " current match in the wildmenu completion - hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline + hi WildMenu guifg=#cae682 guibg=#405060 gui=bold,underline hi WildMenu ctermfg=16 ctermbg=186 cterm=bold " color column highlighting - hi ColorColumn guifg=NONE guibg=#403630 gui=none + hi ColorColumn guifg=NONE guibg=#403040 gui=none hi ColorColumn ctermfg=NONE ctermbg=95 cterm=none " left blank, hidden hi Ignore guifg=bg diff --git a/doc/gundo.txt b/doc/gundo.txt index c94f3b6..d9d3995 100644 --- a/doc/gundo.txt +++ b/doc/gundo.txt @@ -14,6 +14,8 @@ CONTENTS *Gundo-contents* 3.4 gundo_right ............... |gundo_right| 3.5 gundo_help ................ |gundo_help| 3.6 gundo_disable ............. |gundo_disable| + 3.7 gundo_map_move_older ...... |gundo_map_move_older| + gundo_map_move_newer ...... |gundo_map_move_newer| 4. License ........................ |GundoLicense| 5. Bugs ........................... |GundoBugs| 6. Contributing ................... |GundoContributing| @@ -176,6 +178,16 @@ them may not have Python support. Default: 0 (Gundo is enabled as usual) +------------------------------------------------------------------------------ +3.7 g:gundo_map_move_older, g:gundo_map_move_newer *gundo_map_move_older* + *gundo_map_move_newer* + +These options let you change the keys that navigate the undo graph. This is +useful if you use a Dvorak keyboard and have changed your movement keys. + +Default: gundo_map_move_older = "j" + gundo_map_move_newer = "k" + ============================================================================== 4. License *GundoLicense* @@ -199,6 +211,14 @@ GitHub: http://github.com/sjl/gundo.vim/ ============================================================================== 7. Changelog *GundoChangelog* +v2.1.0 + * Warnings about having an incompatible Vim and/or Python installation + are now deferred until the first time you try to use Gundo, instead + of being displayed on launch. + * The and mappings are now configurable with + g:gundo_map_move_older and g:gundo_map_move_newer. + * The o, and keys are now mapped in the Gundo pane. + * Improve and add several unit tests for Gundo. v2.0.0 * Make GundoToggle close the Gundo windows if they're visible but not the current window, instead of moving to them. diff --git a/doc/tagbar.txt b/doc/tagbar.txt new file mode 100644 index 0000000..805fa7a --- /dev/null +++ b/doc/tagbar.txt @@ -0,0 +1,663 @@ +*tagbar.txt* Display tags of a file in their correct scope + +Author: Jan Larres +Licence: Vim licence, see |license| +Homepage: http://majutsushi.github.com/tagbar/ +Version: 1.5 + +============================================================================== +Contents *tagbar* *tagbar-contents* + + 1. Intro ........................... |tagbar-intro| + Pseudo-tags ................... |tagbar-pseudotags| + Supported features ............ |tagbar-features| + 2. Requirements .................... |tagbar-requirements| + 3. Installation .................... |tagbar-installation| + 4. Usage ........................... |tagbar-usage| + Commands ...................... |tagbar-commands| + Key mappings .................. |tagbar-keys| + 5. Configuration ................... |tagbar-configuration| + 6. Extending Tagbar ................ |tagbar-extend| + 7. Bugs and limitations ............ |tagbar-bugs| + 8. History ......................... |tagbar-history| + 9. Todo ............................ |tagbar-todo| + 10. Credits ......................... |tagbar-credits| + +============================================================================== +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 +their scope. This means that for example methods in C++ are displayed under +the class they are defined in. + +Let's say we have the following code inside of a C++ file: +> + namespace { + char a; + + class Foo + { + public: + Foo(); + ~Foo(); + private: + int var; + }; + }; +< +Then Tagbar would display the tag information like so: +> + __anon1* : namespace + Foo : class + +Foo() + +~Foo() + -var + a +< +This example shows several important points. First, the tags are listed +indented below the scope they are defined in. Second, the type of a scope is +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* + +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 +example the namespace doesn't have a name and thus ctags doesn't generate a +tag for it, but since it has children it still needs to be displayed using an +auto-generated name. + +Another case where pseudo-tags appear is in C++ implementation files. Since +classes are usually defined in a header file but the member methods and +variables in the implementation file the class itself won't generate a tag +in that file. + +Since pseudo-tags don't really exist they cannot be jumped to from the Tagbar +window. + +Pseudo-tags are denoted with an asterisk ('*') at the end of their name. + +------------------------------------------------------------------------------ +SUPPORTED FEATURES *tagbar-features* + +The following features are supported by Tagbar: + + - Display tags under their correct scope. + - Automatically update the tags when switching between buffers and editing + files. + - Display visibility information of tags if available. + - Highlight the tag near the cursor while editing files. + - Jump to a tag from the Tagbar window. + - Display the complete prototype of a tag. + - Tags can be sorted either by name or order of appearance in the file. + - Scopes can be folded to hide uninteresting information. + - Supports all of the languages that ctags does, i.e. Ant, Assembler, ASP, + Awk, Basic, BETA, C, C++, C#, COBOL, DosBatch, Eiffel, Erlang, Flex, + Fortran, HTML, Java, JavaScript, Lisp, Lua, Make, MatLab, OCaml, Pascal, + Perl, PHP, Python, REXX, Ruby, Scheme, Shell script, SLang, SML, SQL, Tcl, + Tex, Vera, Verilog, VHDL, Vim and YACC. + - Can be extended to support arbitrary new types. + +============================================================================== +2. Requirements *tagbar-requirements* + +The following requirements have to be met in order to be able to use tagbar: + + - Vim 7.0 or higher. Older versions will not work since Tagbar uses data + structures that were only introduced in Vim 7. + - Exuberant ctags 5.5 or higher. Ctags is the program that generates the + tag information that Tagbar uses. It is shipped with most Linux + distributions, otherwise it can be downloaded from the following + website: + + http://ctags.sourceforge.net/ + + Tagbar will work on any platform that ctags runs on -- this includes + UNIX derivatives, Mac OS X and Windows. Note that other versions like + GNU ctags will not work. + Tagbar generates the tag information by itself and doesn't need already + existing tag files. + - File type detection must be turned on in vim. This can be done with the + following command in your vimrc: +> + filetype on +< + See |filetype| for more information. + - Tagbar will not work in |restricted-mode|. + +============================================================================== +3. Installation *tagbar-installation* + +Use the normal Vimball install method for installing tagbar.vba: +> + vim tagbar.vba + :so % + :q +< +Alternatively you can clone the git repository and then add the path to +'runtimepath' or use the pathogen plugin. Don't forget to run |:helptags| if +you're not using pathogen. + +If the ctags executable is not installed in one of the directories in your +$PATH environment variable you have to set the g:tagbar_ctags_bin variable, +see |g:tagbar_ctags_bin|. + +============================================================================== +4. Usage *tagbar-usage* + +There are essentially two ways to use Tagbar: + + 1. Have it running all the time in a window on the side of the screen. In + this case Tagbar will update its contents whenever the source file is + changed and highlight the tag the cursor is currently on in the file. If + a tag is selected in Tagbar the file window will jump to the tag and the + Tagbar window will stay open. |g:tagbar_autoclose| has to be unset for + this mode. + 2. Only open Tagbar when you want to jump to a specific tag and have it + close automatically once you have selected one. This can be useful for + example for small screens where a permanent window would take up too much + space. You have to set the option |g:tagbar_autoclose| in this case. The + cursor will also automatically jump to the Tagbar window when opening it. + +Opening and closing the Tagbar window~ +Use |:TagbarOpen| or |:TagbarToggle| to open the Tagbar window if it is +closed. By default the window is opened on the right side, set the option +|g:tagbar_left| to open it on the left instead. If the window is already open, +|:TagbarOpen| will jump to it and |:TagbarToggle| will close it again. +|:TagbarClose| will simply close the window if it is open. + +It is probably a good idea to assign a key to these commands. For example, put +this in your |vimrc|: +> + nnoremap :TagbarToggle +< +You can then open and close Tagbar by simply pressing the key. + +You can also use |:TagbarOpenAutoClose| to open the Tagbar window, jump to it +and have it close automatically on tag selection regardless of the +|g:tagbar_autoclose| setting. + +Jumping to tags~ +When you're inside the Tagbar window you can jump to the definition of a tag +by moving the cursor to a tag and pressing or double-clicking on it +with the mouse. The source file will then move to the definition and put the +cursor in the corresponding line. This won't work for pseudo-tags. + +Sorting~ +You can sort the tags in the Tagbar window in two ways: by name or by file +order. Sorting them by name simply displays the tags in their alphabetical +order under their corresponding scope. Sorting by file order means that the +tags keep the order they have in the source file, but are still associated +with the correct scope. You can change the sort order by pressing the "s" key +in the Tagbar window. The current sort order is displayed in the statusbar of +the Tagbar window. + +Folding~ +The displayed scopes (and unscoped types) can be folded to hide untinteresting +information. Unfortunately the folding state is lost once you leave the Tagbar +window, see |tagbar-bugs|. + +Displaying the prototype of a tag~ +Tagbar can display the prototype of a tag. More precisely it can display the +line in which the tag is defined. This can be done by either pressing +when on a tag or hovering over a tag with the mouse. In the former case the +prototype will be displayed in the command line |Command-line|, in the latter +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* + +:TagbarOpen + Open the Tagbar if it is closed. In case it is already open jump to it. + +:TagbarClose + Close the Tagbar window if it is open. + +:TagbarToggle + Open the Tagbar window if it is closed or close it if it is open. + +:TagbarOpenAutoClose + Open the Tagbar window and close it on tag selection, regardless of the + setting of |g:tagbar_autoclose|. If it was already open jump to it. + +------------------------------------------------------------------------------ +KEY MAPPINGS *tagbar-keys* + +These mappings are valid in the Tagbar window: + + Display key mapping help. +/ Jump to the tag under the cursor. Doesn't work for pseudo-tags. +<2-LeftMouse> Same as . + Display the prototype of the current tag (i.e. the line defining + it) in the command line. ++ Open the fold under the cursor. +- Close the fold under the cursor. +* Open all folds. += Close all folds. +s Toggle sort order between name and file order. +x Toggle zooming the window. +q Close the Tagbar window. + +============================================================================== +5. Configuration *tagbar-configuration* + + *g:tagbar_ctags_bin* +g:tagbar_ctags_bin~ +Use this option to specify the location of your ctags executable. Only needed +if it is not in one of the directories in your $PATH environment variable. + +Example: +> + let g:tagbar_ctags_bin = 'C:\Ctags5.8\ctags.exe' +< + + *g:tagbar_left* +g:tagbar_left~ +By default the Tagbar window will be opened on the right-hand side of vim. Set +this option to open it on the left instead. + +Example: +> + let g:tagbar_left = 1 +< + + *g:tagbar_width* +g:tagbar_width~ +Width of the Tagbar window in characters. The default is 40. + +Example: +> + let g:tagbar_width = 30 +< + + *g:tagbar_autoclose* +g:tagbar_autoclose~ +If you set this option the Tagbar window will automatically close when you +jump to a tag. The default is to not automatically close the window. + +Example: +> + let g:tagbar_autoclose = 1 +< + + *g:tagbar_autofocus* +g:tagbar_autofocus~ +If you set this option the cursor will move to the Tagbar window when it is +opened. The default is to not move the cursor to the window. + +Example: +> + let g:tagbar_autofocus = 1 +< + + *g:tagbar_sort* +g:tagbar_sort~ +If this option is set the tags are sorted according to their name. If it is +unset they are sorted according to their order in the source file. The default +is to sort them by name. + +Example: +> + let g:tagbar_sort = 0 +< + + *g:tagbar_compact* +g:tagbar_compact~ +Setting this option will result in Tagbar omitting the short help at the +top of the window and the blank lines in between top-level scopes in order to +save screen real estate. The default is to not use compact mode. + +Example: +> + let g:tagbar_compact = 1 +< + + *g:tagbar_expand* +g:tagbar_expand~ +If this option is set the Vim window will be expanded by the width of the +Tagbar window if using a GUI version of Vim. The default is not to expand the +window. + +Example: +> + let g:tagbar_expand = 1 +< + +============================================================================== +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 +existing types and to add completely new types. + +Every type definition in Tagbar is a dictionary with the following keys: + +ctagstype: The name of the language as recognized by ctags. Use the command > + ctags --list-languages +< to get a list of the languages ctags supports. The case doesn't + matter. +kinds: A list of the "language kinds" that should be listed in Tagbar, + ordered by the order they should appear in in the Tagbar window. + Use the command > + ctags --list-kinds={language name} +< to get a list of the kinds ctags supports for a given language. An + entry in this list is a string with two parts separated by a + colon: the first part is the one-character abbreviation that ctags + uses, and the second part is an arbitrary string that will be used + in Tagbar as the header for the tags of this kind that are not + listed under a specific scope. For example, the string > + "f:functions" +< would list all the function definitions in a file under the header + "functions". +sro: The scope resolution operator. For example, in C++ it is "::" and + in Java it is ".". When in doubt run ctags as shown above and look + at the output. +kind2scope: A dictionary describing the mapping of tag kinds (in their + one-character representation) to the scopes their children will + appear in, for example classes, structs etc. + Unfortunately there is no ctags option to list the scopes, you + have to look at the tags ctags generates manually. For example, + let's say we have a C++ file "test.cpp" with the following + contents: > + class Foo + { + public: + Foo(); + ~Foo(); + private: + int var; + }; +< We then run ctags in the followin way: > + ctags -f - --format=2 --excmd=pattern --fields=nksazSmt --extra= test.cpp +< Then the output for the variable "var" would look like this: > + var tmp.cpp /^ int var;$/;" kind:m line:11 class:Foo access:private +< This shows that the scope name for an entry in a C++ class is + simply "class". So this would be the word that the "kind" + character of a class has to be mapped to. +scope2kind: The opposite of the above, mapping scopes to the kinds of their + parents. Most of the time it is the exact inverse of the above, + but in some cases it can be different, for example when more than + one kind maps to the same scope. If it is the exact inverse for + your language you only need to specify one of the two keys. +replace: If you set this entry to 1 your definition will completely replace +{optional} an existing default definition. This is useful if you want to + disable scopes for a file type for some reason. Note that in this + case you have to provide all the needed entries yourself! +sort: This entry can be used to override the global sort setting for +{optional} this specific file type. The meaning of the value is the same as + with the global setting, that is if you want to sort tags by name + set it to 1 and if you want to sort them according to their order + in the file set it to 0. +deffile: The path to a file with additional ctags definitions (see the +{optional} section below on adding a new definition for what exactly that + means). This is especially useful for ftplugins since they can + provide a complete type definition with ctags and Tagbar + configurations without requiring user intervention. + Let's say you have an ftplugin that adds support for the language + "mylang", and your directory structure looks like this: > + ctags/mylang.cnf + ftplugin/mylang.vim +< Then the "deffile" entry would look like this to allow for the + plugin to be installed in an arbitray location (for example + with pathogen): > + 'deffile' : expand(':p:h:h') . '/ctags/mylang.cnf' +< + +You then have to assign this dictionary to a variable with the name +> + g:tagbar_type_{vim filetype} +< +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: +> + :set filetype? +< +and vim will display the file type of the current buffer. + +Example: C++~ +Here is a complete example that shows the default configuration for C++ as +used in Tagbar. +> + let g:tagbar_type_cpp = { + \ 'ctagstype' : 'c++', + \ 'kinds' : [ + \ 'd:macros', + \ 'p:prototypes', + \ 'g:enums', + \ 'e:enumerators', + \ 't:typedefs', + \ 'n:namespaces', + \ 'c:classes', + \ 's:structs', + \ 'u:unions', + \ 'f:functions', + \ 'm:members', + \ 'v:variables' + \ ], + \ 'sro' : '::', + \ 'kind2scope' : { + \ 'g' : 'enum', + \ 'n' : 'namespace', + \ 'c' : 'class', + \ 's' : 'struct', + \ 'u' : 'union' + \ }, + \ 'scope2kind' : { + \ 'enum' : 'g', + \ 'namespace' : 'n', + \ 'class' : 'c', + \ 'struct' : 's', + \ 'union' : 'u' + \ } + \ } +< + +Which of the keys you have to specify depends on what you want to do. + +Changing an existing definition~ +If you want to change an existing definition you only need to specify the +parts that you want to change. It probably only makes sense to change "kinds" +and/or "scopes", which would be the case if you wanted to exclude certain +kinds from appearing in Tagbar or if you want to change their order. As an +example, if you didn't want Tagbar to show prototypes for C++ files and switch +the order of enums and typedefs, you would do it like this: +> + let g:tagbar_type_cpp = { + \ 'kinds' : [ + \ 'd:macros', + \ 'g:enums', + \ 't:typedefs', + \ 'e:enumerators', + \ 'n:namespaces', + \ 'c:classes', + \ 's:structs', + \ 'u:unions', + \ 'f:functions', + \ 'm:members', + \ 'v:variables' + \ ] + \ } +< +Compare with the complete example above to see the exact change. + +Adding a definition for a new language/file type~ +In order to be able to add a new language to Tagbar you first have to create a +configuration for ctags that it can use to parse the files. This can be done +in two ways: + + 1. Use the --regex argument for specifying regular expressions that are used + to parse the files. An example of this is given below. A disadvantage of + this approach is that you can't specify scopes. + 2. Write a parser plugin in C for ctags. This approach is much more powerful + than the regex approach since you can make use of all of ctags' + functionality but it also requires much more work. Read the ctags + documentation for more information about how to do this. + +For the first approach the only keys that are needed in the Tagbar definition +are "ctagstype" and "kinds". A definition that supports scopes has to define +those two and in addition "scopes", "sro" and at least one of "kind2scope" and +"scope2kind". + +Let's assume we want to add support for LaTeX to Tagbar using the regex +approach. First we put the following text into ~/.ctags or a file pointed to +by the "deffile" definition entry: +> + --langdef=latex + --langmap=latex:.tex + --regex-latex=/^\\tableofcontents/TABLE OF CONTENTS/s,toc/ + --regex-latex=/^\\frontmatter/FRONTMATTER/s,frontmatter/ + --regex-latex=/^\\mainmatter/MAINMATTER/s,mainmatter/ + --regex-latex=/^\\backmatter/BACKMATTER/s,backmatter/ + --regex-latex=/^\\bibliography\{/BIBLIOGRAPHY/s,bibliography/ + --regex-latex=/^\\part[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/PART \2/s,part/ + --regex-latex=/^\\part[[:space:]]*\*[[:space:]]*\{([^}]+)\}/PART \1/s,part/ + --regex-latex=/^\\chapter[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/CHAP \2/s,chapter/ + --regex-latex=/^\\chapter[[:space:]]*\*[[:space:]]*\{([^}]+)\}/CHAP \1/s,chapter/ + --regex-latex=/^\\section[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\. \2/s,section/ + --regex-latex=/^\\section[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\. \1/s,section/ + --regex-latex=/^\\subsection[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\.\. \2/s,subsection/ + --regex-latex=/^\\subsection[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\.\. \1/s,subsection/ + --regex-latex=/^\\subsubsection[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\.\.\. \2/s,subsubsection/ + --regex-latex=/^\\subsubsection[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\.\.\. \1/s,subsubsection/ + --regex-latex=/^\\includegraphics[[:space:]]*(\[[^]]*\])?[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\3/g,graphic+listing/ + --regex-latex=/^\\lstinputlisting[[:space:]]*(\[[^]]*\])?[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\3/g,graphic+listing/ + --regex-latex=/\\label[[:space:]]*\{([^}]+)\}/\1/l,label/ + --regex-latex=/\\ref[[:space:]]*\{([^}]+)\}/\1/r,ref/ + --regex-latex=/\\pageref[[:space:]]*\{([^}]+)\}/\1/p,pageref/ +< +This will create a new language definition with the name "latex" and associate +it with files with the extension ".tex". It will also define the kinds "s" for +sections, chapters and the like, "g" for included graphics, "l" for labels, +"r" for references and "p" for page references. See the ctags documentation +for more information about the exact syntax. + +Now we have to create the Tagbar language definition in our vimrc: +> + let g:tagbar_type_tex = { + \ 'ctagstype' : 'latex', + \ 'kinds' : [ + \ 's:sections', + \ 'g:graphics', + \ 'l:labels', + \ 'r:refs', + \ 'p:pagerefs' + \ ], + \ 'sort' : 0, + \ 'deffile' : expand(':p:h:h') . '/ctags/latex.cnf' + \ } +< +The "deffile" field is of course only needed if the ctags definition actually +is in that file and not in ~/.ctags. + +Sort has been disabled for LaTeX so that the sections appear in their correct +order. They unfortunately can't be shown nested with their correct scopes +since as already mentioned the regular expression approach doesn't support +that. + +Tagbar should now be able to show the sections and other tags from LaTeX +files. + +============================================================================== +7. Bugs and limitations *tagbar-bugs* + + - Nested pseudo-tags cannot be properly parsed since only the direct parent + scope of a tag gets assigned a type, the type of the grandparents is not + reported by ctags (assuming the grandparents don't have direct, real + children). + + For example, if we have a C++ with the following content: +> + foo::Bar::init() + { + // ... + } + foo::Baz::method() + { + // ... + } +< + In this case the type of "foo" is not known. Is it a namespace? A class? + For this reason the methods are displayed in Tagbar like this: +> + foo::Bar* : class + init() + foo::Baz* : class + method() +< + - Scope-defining tags at the top level that have the same name but a + different kind/scope type can lead to an incorrect display. For example, + the following Python code will incorrectly insert a pseudo-tag "Inner2" + into the "test" class: +> + class test: + class Inner: + def foo(self): + pass + + def test(): + class Inner2: + def bar(self): + pass +< + I haven't found a clean way around this yet, but it shouldn't be much of a + problem in practice anyway. Tags with the same name at any other level are + no problem, though. + + - The fold state of the Tagbar window is lost when the window is left. + Again, I don't know of any proper way around this that still allows + auto-updating -- |winsaveview()| doesn't really help here. + +============================================================================== +8. History *tagbar-history* + +1.5 (2011-03-06) + - Type definitions can now include a path to a file with the ctags + definition. This is especially useful for ftplugins that can now ship + with a complete ctags and Tagbar configuration without requiring user + intervention. Thanks to Jan Christoph Ebersbach for the suggestion. + - Added autofocus setting by Taybin Rutkin. This will put the cursor in + the Tagbar window when it is opened. + - The "scopes" field is no longer needed in type definitions, the + information is already there in "scope2kind". Existing definitions will + be ignored. + - Some fixes and improvements related to redrawing and window switching. + +1.2 (2011-02-28) + - Fix typo in Ruby definition + +1.1 (2011-02-26) + - Don't lose syntax highlighting when ':syntax enable' is called + - Allow expanding the Vim window when Tagbar is opened + +1.0 (2011-02-23) + - Initial release + +============================================================================== +9. Todo *tagbar-todo* + + - Allow filtering the Tagbar content by some criteria like tag name, + visibility, kind ... + - Integrate Tagbar with the FSwitch plugin to provide header file + information in C/C++. + - Allow jumping to a tag in the preview window, a split window or a new tab. + +============================================================================== +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 +Lakshmanan and uses a small amount of code from it. + +Original taglist copyright notice: +Permission is hereby granted to use and distribute this code, with or without +modifications, provided that this copyright notice is copied with it. Like +anything else that's free, taglist.vim is provided *as is* and comes with no +warranty of any kind, either expressed or implied. In no event will the +copyright holder be liable for any damamges resulting from the use of this +software. + +============================================================================== + vim: tw=78 ts=8 sw=8 sts=8 noet ft=help diff --git a/doc/tags b/doc/tags index 7f48190..21abdfc 100644 --- a/doc/tags +++ b/doc/tags @@ -367,6 +367,14 @@ g:loremipsum_paragraph_template loremipsum.txt /*g:loremipsum_paragraph_template g:loremipsum_words loremipsum.txt /*g:loremipsum_words* g:snippets_dir snipMate.txt /*g:snippets_dir* g:snips_author snipMate.txt /*g:snips_author* +g:tagbar_autoclose tagbar.txt /*g:tagbar_autoclose* +g:tagbar_autofocus tagbar.txt /*g:tagbar_autofocus* +g:tagbar_compact tagbar.txt /*g:tagbar_compact* +g:tagbar_ctags_bin tagbar.txt /*g:tagbar_ctags_bin* +g:tagbar_expand tagbar.txt /*g:tagbar_expand* +g:tagbar_left tagbar.txt /*g:tagbar_left* +g:tagbar_sort tagbar.txt /*g:tagbar_sort* +g:tagbar_width tagbar.txt /*g:tagbar_width* g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length* g:vimwiki_auto_checkbox vimwiki.txt /*g:vimwiki_auto_checkbox* g:vimwiki_badsyms vimwiki.txt /*g:vimwiki_badsyms* @@ -398,6 +406,8 @@ g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc* gundo.txt gundo.txt /*gundo.txt* gundo_disable gundo.txt /*gundo_disable* gundo_help gundo.txt /*gundo_help* +gundo_map_move_newer gundo.txt /*gundo_map_move_newer* +gundo_map_move_older gundo.txt /*gundo_map_move_older* gundo_preview_bottom gundo.txt /*gundo_preview_bottom* gundo_preview_height gundo.txt /*gundo_preview_height* gundo_right gundo.txt /*gundo_right* @@ -861,6 +871,23 @@ surround-mappings surround.txt /*surround-mappings* surround-replacements surround.txt /*surround-replacements* surround-targets surround.txt /*surround-targets* surround.txt surround.txt /*surround.txt* +tagbar tagbar.txt /*tagbar* +tagbar-bugs tagbar.txt /*tagbar-bugs* +tagbar-commands tagbar.txt /*tagbar-commands* +tagbar-configuration tagbar.txt /*tagbar-configuration* +tagbar-contents tagbar.txt /*tagbar-contents* +tagbar-credits tagbar.txt /*tagbar-credits* +tagbar-extend tagbar.txt /*tagbar-extend* +tagbar-features tagbar.txt /*tagbar-features* +tagbar-history tagbar.txt /*tagbar-history* +tagbar-installation tagbar.txt /*tagbar-installation* +tagbar-intro tagbar.txt /*tagbar-intro* +tagbar-keys tagbar.txt /*tagbar-keys* +tagbar-pseudotags tagbar.txt /*tagbar-pseudotags* +tagbar-requirements tagbar.txt /*tagbar-requirements* +tagbar-todo tagbar.txt /*tagbar-todo* +tagbar-usage tagbar.txt /*tagbar-usage* +tagbar.txt tagbar.txt /*tagbar.txt* vS surround.txt /*vS* v_m mark.txt /*v_m* v_r mark.txt /*v_r* diff --git a/plugin/gundo.vim b/plugin/gundo.vim index 5f3d7bd..dc61e20 100644 --- a/plugin/gundo.vim +++ b/plugin/gundo.vim @@ -17,7 +17,10 @@ endif let loaded_gundo = 1"}}} if v:version < '703'"{{{ - echo "Gundo requires Vim 7.3+" + function! s:GundoDidNotLoad() + echohl WarningMsg|echomsg "Gundo unavailable: requires Vim 7.3+"|echohl None + endfunction + command! -nargs=0 GundoToggle call s:GundoDidNotLoad() finish endif"}}} @@ -30,15 +33,15 @@ import vim if sys.version_info[:2] < (2, 4): vim.command('let s:has_supported_python = 0') ENDPYTHON - - " Python version is too old - if !s:has_supported_python - echo "Gundo requires that Vim be compiled with Python 2.4+" - finish - endif else - " no Python support - echo "Gundo requires that Vim be compiled with Python 2.4+" + let s:has_supported_python = 0 +endif + +if !s:has_supported_python + function! s:GundoDidNotLoad() + echohl WarningMsg|echomsg "Gundo requires Vim to be compiled with Python 2.4+"|echohl None + endfunction + command! -nargs=0 GundoToggle call s:GundoDidNotLoad() finish endif"}}} @@ -57,6 +60,12 @@ endif"}}} if !exists('g:gundo_help')"{{{ let g:gundo_help = 1 endif"}}} +if !exists("g:gundo_map_move_older")"{{{ + let g:gundo_map_move_older = 'j' +endif"}}} +if !exists("g:gundo_map_move_newer")"{{{ + let g:gundo_map_move_newer = 'k' +endif"}}} "}}} @@ -118,108 +127,6 @@ def draw_edges(edges, nodeline, interline): if nodeline[i] != "+": nodeline[i] = "-" -def ascii(buf, state, type, char, text, coldata): - """prints an ASCII graph of the DAG - - takes the following arguments (one call per node in the graph): - - - buffer to write to - - Somewhere to keep the needed state in (init to asciistate()) - - Column of the current node in the set of ongoing edges. - - Type indicator of node data == ASCIIDATA. - - Payload: (char, lines): - - Character to use as node's symbol. - - List of lines to display as the node's text. - - Edges; a list of (col, next_col) indicating the edges between - the current node and its parents. - - Number of columns (ongoing edges) in the current revision. - - The difference between the number of columns (ongoing edges) - in the next revision and the number of columns (ongoing edges) - in the current revision. That is: -1 means one column removed; - 0 means no columns added or removed; 1 means one column added. - """ - - idx, edges, ncols, coldiff = coldata - assert -2 < coldiff < 2 - if coldiff == -1: - # Transform - # - # | | | | | | - # o | | into o---+ - # |X / |/ / - # | | | | - fix_long_right_edges(edges) - - # add_padding_line says whether to rewrite - # - # | | | | | | | | - # | o---+ into | o---+ - # | / / | | | # <--- padding line - # o | | | / / - # o | | - add_padding_line = (len(text) > 2 and coldiff == -1 and - [x for (x, y) in edges if x + 1 < y]) - - # fix_nodeline_tail says whether to rewrite - # - # | | o | | | | o | | - # | | |/ / | | |/ / - # | o | | into | o / / # <--- fixed nodeline tail - # | |/ / | |/ / - # o | | o | | - fix_nodeline_tail = len(text) <= 2 and not add_padding_line - - # nodeline is the line containing the node character (typically o) - nodeline = ["|", " "] * idx - nodeline.extend([char, " "]) - - nodeline.extend( - get_nodeline_edges_tail(idx, state[1], ncols, coldiff, - state[0], fix_nodeline_tail)) - - # shift_interline is the line containing the non-vertical - # edges between this entry and the next - shift_interline = ["|", " "] * idx - if coldiff == -1: - n_spaces = 1 - edge_ch = "/" - elif coldiff == 0: - n_spaces = 2 - edge_ch = "|" - else: - n_spaces = 3 - edge_ch = "\\" - shift_interline.extend(n_spaces * [" "]) - shift_interline.extend([edge_ch, " "] * (ncols - idx - 1)) - - # draw edges from the current node to its parents - draw_edges(edges, nodeline, shift_interline) - - # lines is the list of all graph lines to print - lines = [nodeline] - if add_padding_line: - lines.append(get_padding_line(idx, ncols, edges)) - lines.append(shift_interline) - - # make sure that there are as many graph lines as there are - # log strings - while len(text) < len(lines): - text.append("") - if len(lines) < len(text): - extra_interline = ["|", " "] * (ncols + coldiff) - while len(lines) < len(text): - lines.append(extra_interline) - - # print lines - indentation_level = max(ncols, ncols + coldiff) - for (line, logstr) in zip(lines, text): - ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) - buf.write(ln.rstrip() + '\n') - - # ... and start over - state[0] = coldiff - state[1] = idx - def fix_long_right_edges(edges): for (i, (start, end)) in enumerate(edges): if end > start: @@ -428,7 +335,7 @@ def _undo_to(n): INLINE_HELP = '''\ -" Gundo for %s [%d] +" Gundo for %s (%d) " j/k - move between undo states " p - preview diff of selected and current states " - revert to selected state @@ -525,9 +432,12 @@ endfunction"}}} "{{{ Gundo buffer settings function! s:GundoMapGraph()"{{{ + exec 'nnoremap