--- /dev/null
+.VimballRecord
+.netrwhist
--- /dev/null
+[submodule "addons/checksyntax"]
+ path = addons/checksyntax
+ url = git://github.com/tomtom/checksyntax_vim.git
+[submodule "addons/snipmate"]
+ path = addons/snipmate
+ url = git://github.com/MarcWeber/snipmate.vim.git
+[submodule "addons/snipmate-snippets"]
+ path = addons/snipmate-snippets
+ url = git://github.com/honza/snipmate-snippets.git
+[submodule "addons/tlib"]
+ path = addons/tlib
+ url = git://github.com/tomtom/tlib_vim.git
+[submodule "addons/vim-addon-manager"]
+ path = addons/vim-addon-manager
+ url = https://github.com/MarcWeber/vim-addon-manager.git
+[submodule "addons/vim-addon-manager-known-repositories"]
+ path = addons/vim-addon-manager-known-repositories
+ url = git://github.com/MarcWeber/vim-addon-manager-known-repositories.git
+[submodule "addons/vim-addon-mw-utils"]
+ path = addons/vim-addon-mw-utils
+ url = git://github.com/MarcWeber/vim-addon-mw-utils.git
+[submodule "addons/fugitive"]
+ path = addons/fugitive
+ url = git://github.com/tpope/vim-fugitive
+[submodule "addons/github-altercation-vim-colors-solarized"]
+ path = addons/github-altercation-vim-colors-solarized
+ url = git://github.com/altercation/vim-colors-solarized
+[submodule "addons/Screen_vim__gnu_screentmux"]
+ path = addons/Screen_vim__gnu_screentmux
+ url = git://github.com/ervandew/screen
+[submodule "addons/surround"]
+ path = addons/surround
+ url = git://github.com/tpope/vim-surround
+[submodule "addons/Vim-R-plugin"]
+ path = addons/Vim-R-plugin
+ url = git://github.com/jcfaria/Vim-R-plugin
--- /dev/null
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" General
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set nocompatible " get out of horrible vi-compatible mode
+filetype indent plugin on | syn on
+set history=1000 " How many lines of history to remember
+set cf " enable error files and error jumping
+set ffs=unix,dos,mac " support all three, in this order
+set viminfo+=! " make sure it can save viminfo
+set isk+=_,@,- " none of these should be word dividers, so make them not be
+set nobackup " real man don't use backups ;)
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Theme/Colors
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+syntax on " syntax highlighting on
+
+set background=dark
+set t_Co=256
+colorscheme desert
+"colorscheme xoria256
+"let g:solarized_termcolors=256
+"colorscheme solarized
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Vim UI
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set wildmenu " turn on wild menu
+set ruler " Always show current positions along the bottom
+"set number " turn on line numbers
+set lz " do not redraw while running macros (much faster) (LazyRedraw)
+set hid " you can change buffer without saving
+set backspace=2 " make backspace work normal
+set whichwrap+=<,>,h,l " backspace and cursor keys wrap to
+set mouse=a " use mouse everywhere
+set shortmess=atI " shortens messages to avoid 'press a key' prompt
+set report=0 " tell us when anything is changed via :...
+" make the splitters between windows be blank
+set fillchars=vert:\ ,stl:\ ,stlnc:\
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Visual Cues
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set showmatch " show matching brackets
+set mat=5 " how many tenths of a second to blink matching brackets for
+set nohlsearch " do not highlight searched for phrases
+set incsearch " BUT do highlight as you type you search phrase
+set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
+set so=10 " Keep 10 lines (top/bottom) for scope
+set novisualbell " don't blink
+set noerrorbells " no noises
+"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
+set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]
+set laststatus=2 " always show the status line
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Text Formatting/Layout
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set fo=tcrqn " See Help (complex)
+set si " smartindent
+set tabstop=4 " tab spacing (settings below are just to unify it)
+set softtabstop=4 " unify
+set shiftwidth=4 " unify
+set expandtab " space instead of tabs please!
+set nowrap " do not wrap lines
+autocmd FileType c,cpp,slang set cindent
+autocmd FileType c,cpp,slang set textwidth=79
+
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Folding
+" Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set foldenable " Turn on folding
+set foldmethod=indent " Make folding indent sensitive
+set foldlevel=100 " Don't autofold anything (but I can still fold manually)
+set foldopen-=search " don't open folds when you search into them
+set foldopen-=undo " don't open folds when you undo stuff
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Mouse Settings
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set mouse=a " mouse support in all modes
+set mousehide " hide the mouse when typing text
+
+" ,p and shift-insert will paste the X buffer, even on the command line
+nmap <LocalLeader>p i<S-MiddleMouse><ESC>
+imap <S-Insert> <S-MiddleMouse>
+cmap <S-Insert> <S-MiddleMouse>
+
+" this makes the mouse paste a block of text without formatting it
+" (good for code)
+map <MouseMiddle> <esc>"*p
+
+" Convenient for non italian keyboard
+map ò :
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Matchit
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let b:match_ignorecase = 1
+
+" make tab in v mode ident code
+vmap <tab> >gv
+vmap <s-tab> <gv
+
+" make tab in normal mode ident code
+nmap <tab> I<tab><esc>
+nmap <s-tab> ^i<bs><esc>
+
+"Easy to access esc key
+map! <C-h> <Esc>
+map <C-h> <Esc>
+
+" paste mode - this will avoid unexpected effects when you
+" cut or copy some text from one window and paste it in Vim.
+set pastetoggle=<F6>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Perl
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let perl_extended_vars=1 " highlight advanced perl vars inside strings
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Custom Functions
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Select range, then hit :SuperRetab($width) - by p0g and FallingCow
+function! SuperRetab(width) range
+ silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
+endfunction
+
+"switch spellcheck languages
+let g:myLangList = [ "none", "it", "en_us" ]
+function! MySpellLang()
+"loop through languages
+if !exists( "b:myLang" )
+ let b:myLang=0
+endif
+let b:myLang = b:myLang + 1
+if b:myLang >= len(g:myLangList) | let b:myLang = 0 | endif
+
+if b:myLang== 0 | setlocal spell nospell | endif
+if b:myLang== 1 | setlocal spell spelllang=it | endif
+if b:myLang== 2 | setlocal spell spelllang=en_us | endif
+
+echo "language spell:" g:myLangList[b:myLang]
+endfunction
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Mappings
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" alt-i (normal mode) inserts a single char, and then switches back to normal
+map <A-i> i <ESC>r
+map <F10> <ESC>ggVG:call SuperRetab()<left>
+" encypt the file (toggle)
+map <F12> ggVGg?
+map <F8> :call MySpellLang()<CR>
+map <F7> :TlistOpen<ESC>
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Autocommands
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
+autocmd BufNewFile *.sh call append(0, "#!/bin/bash")
+autocmd BufNewFile *.pl call append(0, "#!/usr/bin/perl")
+autocmd BufNewFile *.py call append(0, "#!/bin/python")
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Useful abbrevs
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
+
+" Latex abbrevs
+"iab cha \chapter{}<ESC>i
+"iab sub \subsection{}
+"iab sec \section{}
+"iab ite \item
+"iab enu \begin{enumerate}<CR>\end{enumerate}<ESC>O
+"iab footn \footnote{}
+"iab tabb \begin{tabbing}<CR>\end{tabbing}<ESC>O
+
+"""""""""""""""""""""""""""
+set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%)\ -\ %{v:servername}
+if &term == "screen"
+ set t_ts=^[k
+ set t_fs=^[\
+endif
+if &term == "screen" || &term == "xterm"
+ set title
+endif
+
+" vim-addon-manager
+"
+fun SetupVAM()
+ let addons_base = expand('$HOME') . '/.vim/addons'
+ exec 'set runtimepath+='.addons_base.'/vim-addon-manager'
+
+ " unix based os users may want to use this code checking out VAM
+ " if !isdirectory(addons_base.'/vim-addon-manager')
+ " exec '!p='.shellescape(addons_base).'; mkdir -p "$p" && cd "$p" && git clone --depth 1 git://github.com/MarcWeber/vim-addon-manager.git'
+ " endif
+
+ " commenting try .. endtry because trace is lost if you use it.
+ " There should be no exception anyway
+ try
+
+ let g:solarized_termcolors=256
+ call vam#ActivateAddons(['github:altercation/vim-colors-solarized'])
+ call vam#ActivateAddons(['surround','checksyntax','snipmate','snipmate-snippets','gnupg','LargeFile','taglist-plus'], {'auto_install' : 0})
+ " pluginA could be github:YourName see vam#install#RewriteName()
+ catch /.*/
+ echoe v:exception
+ endtry
+endf
+call SetupVAM()
+
+let ft_addons = {
+ \ '^\%(R\|r\)$': [ 'Screen_vim__gnu_screentmux', 'Vim-R-plugin' ],
+\ }
+au FileType * for l in values(filter(copy(ft_addons), string(expand('<amatch>')).' =~ v:key')) | call vam#ActivateAddons(l, {'force_loading_plugins_now':1}) | endfor
+" experimental: run after gui has been started (gvim) [3]
+" option1: au VimEnter * call SetupVAM()
+" option2: au GUIEnter * call SetupVAM()
+" See BUGS sections below [*]
--- /dev/null
+*LargeFile.txt* Editing Large Files Quickly Sep 23, 2008
+
+Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
+ (remove NOSPAM from Campbell's email first)
+Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *LargeFile-copyright*
+ The VIM LICENSE applies to LargeFile.vim
+ (see |copyright|) except use "LargeFile" instead of "Vim"
+ No warranty, express or implied. Use At-Your-Own-Risk.
+
+==============================================================================
+1. Large File Plugin *largefile* {{{1
+
+The LargeFile plugin is fairly short -- it simply sets up an |autocmd| that
+checks for large files. There is one parameter: >
+ g:LargeFile
+which, by default, is 20MB. Thus with this value of g:LargeFile, 20MByte
+files and larger are considered to be "large files"; smaller ones aren't. Of
+course, you as a user may set g:LargeFile to whatever you want in your
+<.vimrc> (in units of MBytes).
+
+LargeFile.vim always assumes that when the file size is larger than what
+can fit into a signed integer (2^31, ie. about 2GB) that the file is "Large".
+
+Basically, this autocmd simply turns off a number of features in Vim,
+including event handling, undo, and syntax highlighting, in the interest of
+speed and responsiveness.
+
+LargeFile.vim borrows from vimtip#611.
+
+To undo what LargeFile does, type >
+ :Unlarge
+<
+To redo what LargeFile does, type >
+ :Large
+<
+Note that LargeFile cannot alleviate hardware limitations; vim on 32-bit
+machines are limited to editing 2G files. If your vim is compiled on a 64-bit
+machine such that it can take advantage of the additional address space, then
+presumably vim could edit up to 9.7 quadrillion byte files (not that I've ever
+tried that!).
+
+==============================================================================
+2. History *largefile-history* {{{1
+
+ 4 : Jan 03, 2008 * made LargeFile.vim :AutoInstall:-able by getscript
+ Apr 11, 2008 * (Daniel Shahaf suggested) that :Large! do the large-file
+ handling irregardless of file size. Implemented.
+ Sep 23, 2008 * if getfsize() returns -2 then the file is assumed to be
+ large
+ 3 : May 24, 2007 * Unlarge command included
+ * If getfsize() returns something less than -1, then it
+ will automatically be assumed to be a large file.
+
+==============================================================================
+vim:tw=78:ts=8:ft=help:fdm=marker:
--- /dev/null
+LargeFile-copyright LargeFile.txt /*LargeFile-copyright*
+LargeFile.txt LargeFile.txt /*LargeFile.txt*
+largefile LargeFile.txt /*largefile*
+largefile-history LargeFile.txt /*largefile-history*
--- /dev/null
+" LargeFile: Sets up an autocmd to make editing large files work with celerity
+" Author: Charles E. Campbell, Jr.
+" Date: Sep 23, 2008
+" Version: 4
+" GetLatestVimScripts: 1506 1 :AutoInstall: LargeFile.vim
+
+" ---------------------------------------------------------------------
+" Load Once: {{{1
+if exists("g:loaded_LargeFile") || &cp
+ finish
+endif
+let g:loaded_LargeFile = "v4"
+let s:keepcpo = &cpo
+set cpo&vim
+
+" ---------------------------------------------------------------------
+" Commands: {{{1
+com! Unlarge call s:Unlarge()
+com! -bang Large call s:LargeFile(<bang>0,expand("%"))
+
+" ---------------------------------------------------------------------
+" Options: {{{1
+if !exists("g:LargeFile")
+ let g:LargeFile= 20 " in megabytes
+endif
+
+" ---------------------------------------------------------------------
+" LargeFile Autocmd: {{{1
+" for large files: turns undo, syntax highlighting, undo off etc
+" (based on vimtip#611)
+augroup LargeFile
+ au!
+ au BufReadPre * call <SID>LargeFile(0,expand("<afile>"))
+ au BufReadPost *
+ \ if &ch < 2 && (getfsize(expand("<afile>")) >= g:LargeFile*1024*1024 || getfsize(expand("<afile>")) == -2)
+ \| echomsg "***note*** handling a large file"
+ \| endif
+augroup END
+
+" ---------------------------------------------------------------------
+" s:LargeFile: {{{2
+fun! s:LargeFile(force,fname)
+" call Dfunc("LargeFile(force=".a:force." fname<".a:fname.">)")
+ if a:force || getfsize(a:fname) >= g:LargeFile*1024*1024 || getfsize(a:fname) <= -2
+ syn clear
+ let b:eikeep = &ei
+ let b:ulkeep = &ul
+ let b:bhkeep = &bh
+ let b:fdmkeep= &fdm
+ let b:swfkeep= &swf
+ set ei=FileType
+ setlocal noswf bh=unload fdm=manual ul=-1
+ let fname=escape(substitute(a:fname,'\','/','g'),' ')
+ exe "au LargeFile BufEnter ".fname." set ul=-1"
+ exe "au LargeFile BufLeave ".fname." let &ul=".b:ulkeep."|set ei=".b:eikeep
+ exe "au LargeFile BufUnload ".fname." au! LargeFile * ". fname
+ echomsg "***note*** handling a large file"
+ endif
+" call Dret("s:LargeFile")
+endfun
+
+" ---------------------------------------------------------------------
+" s:Unlarge: this function will undo what the LargeFile autocmd does {{{2
+fun! s:Unlarge()
+" call Dfunc("s:Unlarge()")
+ if exists("b:eikeep") |let &ei = b:eikeep |endif
+ if exists("b:ulkeep") |let &ul = b:ulkeep |endif
+ if exists("b:bhkeep") |let &bh = b:bhkeep |endif
+ if exists("b:fdmkeep")|let &fdm = b:fdmkeep|endif
+ if exists("b:swfkeep")|let &swf = b:swfkeep|endif
+ syn on
+ doau FileType
+" call Dret("s:Unlarge")
+endfun
+
+" ---------------------------------------------------------------------
+" Restore: {{{1
+let &cpo= s:keepcpo
+unlet s:keepcpo
+" vim: ts=4 fdm=marker
--- /dev/null
+Subproject commit 3120f09f62f8924d3ab8583f02061aad9edb6460
--- /dev/null
+Subproject commit d1c4e23857225aa52a407b0ccab534dc1e7c55ea
--- /dev/null
+Subproject commit a91faeb042a1a252563c3272e8caab9d62045861
--- /dev/null
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" CSCOPE settings for vim
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" This file contains some boilerplate settings for vim's cscope interface,
+" plus some keyboard mappings that I've found useful.
+"
+" USAGE:
+" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
+" 'plugin' directory in some other directory that is in your
+" 'runtimepath'.
+"
+" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
+" your ~/.vimrc file (or cut and paste it into your .vimrc).
+"
+" NOTE:
+" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
+" keeps timing you out before you can complete them, try changing your timeout
+" settings, as explained below.
+"
+" Happy cscoping,
+"
+" Jason Duell jduell@alumni.princeton.edu 2002/3/7
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+
+" This tests to see if vim was configured with the '--enable-cscope' option
+" when it was compiled. If it wasn't, time to recompile vim...
+if has("cscope")
+
+ """"""""""""" Standard cscope/vim boilerplate
+
+ " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
+ set cscopetag
+
+ " check cscope for definition of a symbol before checking ctags: set to 1
+ " if you want the reverse search order.
+ set csto=0
+
+ " add any cscope database in current directory
+ if filereadable("cscope.out")
+ cs add cscope.out
+ " else add the database pointed to by environment variable
+ elseif $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ endif
+
+ " show msg when any other cscope db added
+ set cscopeverbose
+
+
+ """"""""""""" My cscope/vim key mappings
+ "
+ " The following maps all invoke one of the following cscope search types:
+ "
+ " 's' symbol: find all references to the token under cursor
+ " 'g' global: find global definition(s) of the token under cursor
+ " 'c' calls: find all calls to the function name under cursor
+ " 't' text: find all instances of the text under cursor
+ " 'e' egrep: egrep search for the word under cursor
+ " 'f' file: open the filename under cursor
+ " 'i' includes: find files that include the filename under cursor
+ " 'd' called: find functions that function under cursor calls
+ "
+ " Below are three sets of the maps: one set that just jumps to your
+ " search result, one that splits the existing vim window horizontally and
+ " diplays your search result in the new window, and one that does the same
+ " thing, but does a vertical split instead (vim 6 only).
+ "
+ " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
+ " unlikely that you need their default mappings (CTRL-\'s default use is
+ " as part of CTRL-\ CTRL-N typemap, which basically just does the same
+ " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
+ " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
+ " of these maps to use other keys. One likely candidate is 'CTRL-_'
+ " (which also maps to CTRL-/, which is easier to type). By default it is
+ " used to switch between Hebrew and English keyboard mode.
+ "
+ " All of the maps involving the <cfile> macro use '^<cfile>$': this is so
+ " that searches over '#include <time.h>" return only references to
+ " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
+ " files that contain 'time.h' as part of their name).
+
+
+ " To do the first type of search, hit 'CTRL-\', followed by one of the
+ " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
+ " search will be displayed in the current window. You can use CTRL-T to
+ " go back to where you were before the search.
+ "
+
+ nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
+ " makes the vim window split horizontally, with search result displayed in
+ " the new window.
+ "
+ " (Note: earlier versions of vim may not have the :scs command, but it
+ " can be simulated roughly via:
+ " nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
+
+ nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ " Hitting CTRL-space *twice* before the search type does a vertical
+ " split instead of a horizontal one (vim 6 and up only)
+ "
+ " (Note: you may wish to put a 'set splitright' in your .vimrc
+ " if you prefer the new window on the right instead of the left
+
+ nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ """"""""""""" key map timeouts
+ "
+ " By default Vim will only wait 1 second for each keystroke in a mapping.
+ " You may find that too short with the above typemaps. If so, you should
+ " either turn off mapping timeouts via 'notimeout'.
+ "
+ "set notimeout
+ "
+ " Or, you can keep timeouts, by uncommenting the timeoutlen line below,
+ " with your own personal favorite value (in milliseconds):
+ "
+ "set timeoutlen=4000
+ "
+ " Either way, since mapping timeout settings by default also set the
+ " timeouts for multicharacter 'keys codes' (like <F1>), you should also
+ " set ttimeout and ttimeoutlen: otherwise, you will experience strange
+ " delays as vim waits for a keystroke after you hit ESC (it will be
+ " waiting to see if the ESC is actually part of a key code like <F1>).
+ "
+ "set ttimeout
+ "
+ " personally, I find a tenth of a second to work well for key code
+ " timeouts. If you experience problems and have a slow terminal or network
+ " connection, set it higher. If you don't set ttimeoutlen, the value for
+ " timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
+ "
+ "set ttimeoutlen=100
+
+endif
+
+
--- /dev/null
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" CSCOPE settings for vim
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" This file contains some boilerplate settings for vim's cscope interface,
+" plus some keyboard mappings that I've found useful.
+"
+" USAGE:
+" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
+" 'plugin' directory in some other directory that is in your
+" 'runtimepath'.
+"
+" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
+" your ~/.vimrc file (or cut and paste it into your .vimrc).
+"
+" NOTE:
+" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
+" keeps timing you out before you can complete them, try changing your timeout
+" settings, as explained below.
+"
+" Happy cscoping,
+"
+" Jason Duell jduell@alumni.princeton.edu 2002/3/7
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+
+" This tests to see if vim was configured with the '--enable-cscope' option
+" when it was compiled. If it wasn't, time to recompile vim...
+if has("cscope")
+
+ """"""""""""" Standard cscope/vim boilerplate
+
+ " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
+ set cscopetag
+
+ " check cscope for definition of a symbol before checking ctags: set to 1
+ " if you want the reverse search order.
+ set csto=0
+
+ " add any cscope database in current directory
+ if filereadable("cscope.out")
+ cs add cscope.out
+ " else add the database pointed to by environment variable
+ elseif $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ endif
+
+ " show msg when any other cscope db added
+ set cscopeverbose
+
+
+ """"""""""""" My cscope/vim key mappings
+ "
+ " The following maps all invoke one of the following cscope search types:
+ "
+ " 's' symbol: find all references to the token under cursor
+ " 'g' global: find global definition(s) of the token under cursor
+ " 'c' calls: find all calls to the function name under cursor
+ " 't' text: find all instances of the text under cursor
+ " 'e' egrep: egrep search for the word under cursor
+ " 'f' file: open the filename under cursor
+ " 'i' includes: find files that include the filename under cursor
+ " 'd' called: find functions that function under cursor calls
+ "
+ " Below are three sets of the maps: one set that just jumps to your
+ " search result, one that splits the existing vim window horizontally and
+ " diplays your search result in the new window, and one that does the same
+ " thing, but does a vertical split instead (vim 6 only).
+ "
+ " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
+ " unlikely that you need their default mappings (CTRL-\'s default use is
+ " as part of CTRL-\ CTRL-N typemap, which basically just does the same
+ " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
+ " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
+ " of these maps to use other keys. One likely candidate is 'CTRL-_'
+ " (which also maps to CTRL-/, which is easier to type). By default it is
+ " used to switch between Hebrew and English keyboard mode.
+ "
+ " All of the maps involving the <cfile> macro use '^<cfile>$': this is so
+ " that searches over '#include <time.h>" return only references to
+ " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
+ " files that contain 'time.h' as part of their name).
+
+
+ " To do the first type of search, hit 'CTRL-\', followed by one of the
+ " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
+ " search will be displayed in the current window. You can use CTRL-T to
+ " go back to where you were before the search.
+ "
+
+ nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
+ " makes the vim window split horizontally, with search result displayed in
+ " the new window.
+ "
+ " (Note: earlier versions of vim may not have the :scs command, but it
+ " can be simulated roughly via:
+ " nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
+
+ nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ " Hitting CTRL-space *twice* before the search type does a vertical
+ " split instead of a horizontal one (vim 6 and up only)
+ "
+ " (Note: you may wish to put a 'set splitright' in your .vimrc
+ " if you prefer the new window on the right instead of the left
+
+ nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
+
+
+ """"""""""""" key map timeouts
+ "
+ " By default Vim will only wait 1 second for each keystroke in a mapping.
+ " You may find that too short with the above typemaps. If so, you should
+ " either turn off mapping timeouts via 'notimeout'.
+ "
+ "set notimeout
+ "
+ " Or, you can keep timeouts, by uncommenting the timeoutlen line below,
+ " with your own personal favorite value (in milliseconds):
+ "
+ "set timeoutlen=4000
+ "
+ " Either way, since mapping timeout settings by default also set the
+ " timeouts for multicharacter 'keys codes' (like <F1>), you should also
+ " set ttimeout and ttimeoutlen: otherwise, you will experience strange
+ " delays as vim waits for a keystroke after you hit ESC (it will be
+ " waiting to see if the ESC is actually part of a key code like <F1>).
+ "
+ "set ttimeout
+ "
+ " personally, I find a tenth of a second to work well for key code
+ " timeouts. If you experience problems and have a slow terminal or network
+ " connection, set it higher. If you don't set ttimeoutlen, the value for
+ " timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
+ "
+ "set ttimeoutlen=100
+
+endif
+
+
--- /dev/null
+Subproject commit f43393dd9a3bfe01c19af4d3c67e4c4782f09f34
--- /dev/null
+Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21
--- /dev/null
+" Name: gnupg.vim
+" Version: $Id: gnupg.vim 3026 2010-01-27 08:18:04Z mbr $
+" Author: Markus Braun <markus.braun@krawel.de>
+" Summary: Vim plugin for transparent editing of gpg encrypted files.
+" Licence: This program is free software; you can redistribute it and/or
+" modify it under the terms of the GNU General Public License.
+" See http://www.gnu.org/copyleft/gpl.txt
+"
+" Section: Documentation {{{1
+"
+" Description: {{{2
+"
+" This script implements transparent editing of gpg encrypted files. The
+" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such
+" a file the content is decrypted, when opening a new file the script will
+" ask for the recipients of the encrypted file. The file content will be
+" encrypted to all recipients before it is written. The script turns off
+" viminfo and swapfile to increase security.
+"
+" Installation: {{{2
+"
+" Copy the gnupg.vim file to the $HOME/.vim/plugin directory.
+" Refer to ':help add-plugin', ':help add-global-plugin' and ':help
+" runtimepath' for more details about Vim plugins.
+"
+" From "man 1 gpg-agent":
+"
+" ...
+" You should always add the following lines to your .bashrc or whatever
+" initialization file is used for all shell invocations:
+"
+" GPG_TTY=`tty`
+" export GPG_TTY
+"
+" It is important that this environment variable always reflects the out‐
+" put of the tty command. For W32 systems this option is not required.
+" ...
+"
+" Most distributions provide software to ease handling of gpg and gpg-agent.
+" Examples are keychain or seahorse.
+"
+" Commands: {{{2
+"
+" :GPGEditRecipients
+" Opens a scratch buffer to change the list of recipients. Recipients that
+" are unknown (not in your public key) are highlighted and have
+" a prepended "!". Closing the buffer makes the changes permanent.
+"
+" :GPGViewRecipients
+" Prints the list of recipients.
+"
+" :GPGEditOptions
+" Opens a scratch buffer to change the options for encryption (symmetric,
+" asymmetric, signing). Closing the buffer makes the changes permanent.
+" WARNING: There is no check of the entered options, so you need to know
+" what you are doing.
+"
+" :GPGViewOptions
+" Prints the list of options.
+"
+" Variables: {{{2
+"
+" g:GPGExecutable
+" If set used as gpg executable, otherwise the system chooses what is run
+" when "gpg" is called. Defaults to "gpg".
+"
+" g:GPGUseAgent
+" If set to 0 a possible available gpg-agent won't be used. Defaults to 1.
+"
+" g:GPGPreferSymmetric
+" If set to 1 symmetric encryption is preferred for new files. Defaults to 0.
+"
+" g:GPGPreferArmor
+" If set to 1 armored data is preferred for new files. Defaults to 0.
+"
+" g:GPGPreferSign
+" If set to 1 signed data is preferred for new files. Defaults to 0.
+"
+" g:GPGDefaultRecipients
+" If set, these recipients are used as defaults when no other recipient is
+" defined. This variable is a Vim list. Default is unset.
+"
+" Known Issues: {{{2
+"
+" In some cases gvim can't decryt files
+
+" This is caused by the fact that a running gvim has no TTY and thus gpg is
+" not able to ask for the passphrase by itself. This is a problem for Windows
+" and Linux versions of gvim and could not be solved unless a "terminal
+" emulation" is implemented for gvim. To circumvent this you have to use any
+" combination of gpg-agent and a graphical pinentry program:
+"
+" - gpg-agent only:
+" you need to provide the passphrase for the needed key to gpg-agent
+" in a terminal before you open files with gvim which require this key.
+"
+" - pinentry only:
+" you will get a popup window every time you open a file that needs to
+" be decrypted.
+"
+" - gpgagent and pinentry:
+" you will get a popup window the first time you open a file that
+" needs to be decrypted.
+"
+" Credits: {{{2
+"
+" - Mathieu Clabaut for inspirations through his vimspell.vim script.
+" - Richard Bronosky for patch to enable ".pgp" suffix.
+" - Erik Remmelzwaal for patch to enable windows support and patient beta
+" testing.
+" - Lars Becker for patch to make gpg2 working.
+" - Thomas Arendsen Hein for patch to convert encoding of gpg output
+" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model
+" and patient beta testing.
+" - Giel van Schijndel for patch to get GPG_TTY dynamically.
+" - Sebastian Luettich for patch to fix issue with symmetric encryption an set
+" recipients.
+" - Tim Swast for patch to generate signed files
+"
+" Section: Plugin header {{{1
+
+" guard against multiple loads {{{2
+if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)"))
+ finish
+endif
+let g:loaded_gnupg = "$Revision: 3026 $"
+
+" check for correct vim version {{{2
+if (v:version < 700)
+ echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.0' | echohl None
+ finish
+endif
+
+" Section: Autocmd setup {{{1
+
+augroup GnuPG
+ autocmd!
+
+ " initialize the internal variables
+ autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit()
+ " force the user to edit the recipient list if he opens a new file and public
+ " keys are preferred
+ autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endif
+ " do the decryption
+ autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt()
+
+ " convert all text to encrypted text before writing
+ autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
+ " undo the encryption so we are back in the normal text, directly
+ " after the file has been written.
+ autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost()
+
+ " cleanup on leaving vim
+ autocmd VimLeave *.\(gpg\|asc\|pgp\) call s:GPGCleanup()
+augroup END
+
+" Section: Constants {{{1
+
+let s:GPGMagicString = "\t \t"
+
+" Section: Highlight setup {{{1
+
+highlight default link GPGWarning WarningMsg
+highlight default link GPGError ErrorMsg
+highlight default link GPGHighlightUnknownRecipient ErrorMsg
+
+" Section: Functions {{{1
+
+" Function: s:GPGInit() {{{2
+"
+" initialize the plugin
+"
+function s:GPGInit()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGInit()")
+
+ " first make sure nothing is written to ~/.viminfo while editing
+ " an encrypted file.
+ set viminfo=
+
+ " we don't want a swap file, as it writes unencrypted data to disk
+ set noswapfile
+
+ " check what gpg command to use
+ if (!exists("g:GPGExecutable"))
+ let g:GPGExecutable = "gpg --trust-model always"
+ endif
+
+ " check if gpg-agent is allowed
+ if (!exists("g:GPGUseAgent"))
+ let g:GPGUseAgent = 1
+ endif
+
+ " check if symmetric encryption is preferred
+ if (!exists("g:GPGPreferSymmetric"))
+ let g:GPGPreferSymmetric = 0
+ endif
+
+ " check if armored files are preferred
+ if (!exists("g:GPGPreferArmor"))
+ let g:GPGPreferArmor = 0
+ endif
+
+ " check if signed files are preferred
+ if (!exists("g:GPGPreferSign"))
+ let g:GPGPreferSign = 0
+ endif
+
+ " start with empty default recipients if none is defined so far
+ if (!exists("g:GPGDefaultRecipients"))
+ let g:GPGDefaultRecipients = []
+ endif
+
+ " print version
+ call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg)
+
+ " determine if gnupg can use the gpg-agent
+ if (exists("$GPG_AGENT_INFO") && g:GPGUseAgent == 1)
+ if (!exists("$GPG_TTY") && !has("gui_running"))
+ let $GPG_TTY = system("tty")
+ if (v:shell_error)
+ let $GPG_TTY = ""
+ echohl GPGError
+ echom "The GPG_TTY is not set and no TTY could be found using the `tty` command!"
+ echom "gpg-agent might not work."
+ echohl None
+ endif
+ endif
+ let s:GPGCommand = g:GPGExecutable . " --use-agent"
+ else
+ let s:GPGCommand = g:GPGExecutable . " --no-use-agent"
+ endif
+
+ " don't use tty in gvim
+ " FIXME find a better way to avoid an error.
+ " with this solution only --use-agent will work
+ if (has("gui_running"))
+ let s:GPGCommand = s:GPGCommand . " --no-tty"
+ endif
+
+ " setup shell environment for unix and windows
+ let s:shellredirsave = &shellredir
+ let s:shellsave = &shell
+ if (has("unix"))
+ " unix specific settings
+ let s:shellredir = ">%s 2>&1"
+ let s:shell = '/bin/sh'
+ let s:stderrredirnull = '2>/dev/null'
+ let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand
+ else
+ " windows specific settings
+ let s:shellredir = '>%s'
+ let s:shell = &shell
+ let s:stderrredirnull = '2>nul'
+ endif
+
+ call s:GPGDebug(3, "shellredirsave: " . s:shellredirsave)
+ call s:GPGDebug(3, "shellsave: " . s:shellsave)
+
+ call s:GPGDebug(3, "shell: " . s:shell)
+ call s:GPGDebug(3, "shellcmdflag: " . &shellcmdflag)
+ call s:GPGDebug(3, "shellxquote: " . &shellxquote)
+ call s:GPGDebug(3, "shellredir: " . s:shellredir)
+ call s:GPGDebug(3, "stderrredirnull: " . s:stderrredirnull)
+
+ call s:GPGDebug(3, "shell implementation: " . resolve(s:shell))
+
+ " find the supported algorithms
+ let commandline = s:GPGCommand . " --version"
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ let s:GPGPubkey = substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGCipher = substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGHash = substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGCompress = substitute(output, ".*Compress.\\{-}: \\(.\\{-}\\)\n.*", "\\1", "")
+
+ call s:GPGDebug(2, "public key algorithms: " . s:GPGPubkey)
+ call s:GPGDebug(2, "cipher algorithms: " . s:GPGCipher)
+ call s:GPGDebug(2, "hashing algorithms: " . s:GPGHash)
+ call s:GPGDebug(2, "compression algorithms: " . s:GPGCompress)
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGInit()")
+endfunction
+
+" Function: s:GPGCleanup() {{{2
+"
+" cleanup on leaving vim
+"
+function s:GPGCleanup()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()")
+
+ " wipe out screen
+ new +only
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()")
+endfunction
+
+" Function: s:GPGDecrypt() {{{2
+"
+" decrypt the buffer and find all recipients of the encrypted file
+"
+function s:GPGDecrypt()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGDecrypt()")
+
+ " switch to binary mode to read the encrypted file
+ set bin
+
+ " get the filename of the current buffer
+ let filename = escape(expand("%:p"), '\"')
+
+ " clear GPGEncrypted, GPGRecipients and GPGOptions
+ let b:GPGEncrypted = 0
+ let b:GPGRecipients = []
+ let b:GPGOptions = []
+
+ " find the recipients of the file
+ let commandline = s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\""
+ call s:GPGDebug(3, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(3, "output: ". output)
+
+ " check if the file is symmetric/asymmetric encrypted
+ if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0)
+ " file is symmetric encrypted
+ let b:GPGEncrypted = 1
+ call s:GPGDebug(1, "this file is symmetric encrypted")
+
+ let b:GPGOptions += ["symmetric"]
+
+ " find the used cipher algorithm
+ let cipher = substitute(output, ".*gpg: \\([^ ]\\+\\) encrypted data.*", "\\1", "")
+ if (match(s:GPGCipher, "\\<" . cipher . "\\>") >= 0)
+ let b:GPGOptions += ["cipher-algo " . cipher]
+ call s:GPGDebug(1, "cipher-algo is " . cipher)
+ else
+ echohl GPGWarning
+ echom "The cipher " . cipher . " is not known by the local gpg command. Using default!"
+ echo
+ echohl None
+ endif
+ elseif (match(output, "gpg: public key is [[:xdigit:]]\\{8}") >= 0)
+ " file is asymmetric encrypted
+ let b:GPGEncrypted = 1
+ call s:GPGDebug(1, "this file is asymmetric encrypted")
+
+ let b:GPGOptions += ["encrypt"]
+
+ " find the used public keys
+ let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}")
+ while (start >= 0)
+ let start = start + strlen("gpg: public key is ")
+ let recipient = strpart(output, start, 8)
+ call s:GPGDebug(1, "recipient is " . recipient)
+ let name = s:GPGNameToID(recipient)
+ if (strlen(name) > 0)
+ let b:GPGRecipients += [name]
+ call s:GPGDebug(1, "name of recipient is " . name)
+ else
+ let b:GPGRecipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ end
+ let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}", start)
+ endwhile
+ else
+ " file is not encrypted
+ let b:GPGEncrypted = 0
+ call s:GPGDebug(1, "this file is not encrypted")
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ set nobin
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+ return
+ endif
+
+ " check if the message is armored
+ if (match(output, "gpg: armor header") >= 0)
+ call s:GPGDebug(1, "this file is armored")
+ let b:GPGOptions += ["armor"]
+ endif
+
+ " finally decrypt the buffer content
+ " since even with the --quiet option passphrase typos will be reported,
+ " we must redirect stderr (using shell temporarily)
+ call s:GPGDebug(1, "decrypting file")
+ let commandline = "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull
+ call s:GPGDebug(1, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ execute commandline
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ if (v:shell_error) " message could not be decrypted
+ silent u
+ echohl GPGError
+ let blackhole = input("Message could not be decrypted! (Press ENTER)")
+ echohl None
+ bwipeout
+ set nobin
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+ return
+ endif
+
+ " turn off binary mode
+ set nobin
+
+ " call the autocommand for the file minus .gpg$
+ execute ":doautocmd BufReadPost " . escape(expand("%:r"), ' *?\"'."'")
+ call s:GPGDebug(2, "called autocommand for " . escape(expand("%:r"), ' *?\"'."'"))
+
+ " refresh screen
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+endfunction
+
+" Function: s:GPGEncrypt() {{{2
+"
+" encrypts the buffer to all previous recipients
+"
+function s:GPGEncrypt()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncrypt()")
+
+ " save window view
+ let s:GPGWindowView = winsaveview()
+ call s:GPGDebug(2, "saved window view " . string(s:GPGWindowView))
+
+ " store encoding and switch to a safe one
+ if (&fileencoding != &encoding)
+ let s:GPGEncoding = &encoding
+ let &encoding = &fileencoding
+ call s:GPGDebug(2, "encoding was \"" . s:GPGEncoding . "\", switched to \"" . &encoding . "\"")
+ else
+ let s:GPGEncoding = ""
+ call s:GPGDebug(2, "encoding and fileencoding are the same (\"" . &encoding . "\"), not switching")
+ endif
+
+ " switch buffer to binary mode
+ set bin
+
+ " guard for unencrypted files
+ if (!exists("b:GPGEncrypted") || b:GPGEncrypted == 0)
+ echohl GPGError
+ let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)")
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+ return
+ endif
+
+ " initialize GPGOptions if not happened before
+ if (!exists("b:GPGOptions") || len(b:GPGOptions) == 0)
+ let b:GPGOptions = []
+ if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 1)
+ let b:GPGOptions += ["symmetric"]
+ let b:GPGRecipients = []
+ else
+ let b:GPGOptions += ["encrypt"]
+ endif
+ if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
+ let b:GPGOptions += ["armor"]
+ endif
+ if (exists("g:GPGPreferSign") && g:GPGPreferSign == 1)
+ let b:GPGOptions += ["sign"]
+ endif
+ call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions))
+ endif
+
+ " built list of options
+ let options = ""
+ for option in b:GPGOptions
+ let options = options . " --" . option . " "
+ endfor
+
+ " check here again if all recipients are available in the keyring
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients)
+
+ " check if there are unknown recipients and warn
+ if (len(unknownrecipients) > 0)
+ echohl GPGWarning
+ echom "Please use GPGEditRecipients to correct!!"
+ echo
+ echohl None
+
+ " Let user know whats happend and copy known_recipients back to buffer
+ let dummy = input("Press ENTER to quit")
+ endif
+
+ " built list of recipients
+ if (len(recipients) > 0)
+ for gpgid in recipients
+ let options = options . " -r " . gpgid
+ endfor
+ else
+ if (match(b:GPGOptions, "encrypt") >= 0)
+ echohl GPGError
+ echom "There are no recipients!!"
+ echom "Please use GPGEditRecipients to correct!!"
+ echo
+ echohl None
+ endif
+ endif
+
+ " encrypt the buffer
+ let commandline = "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull
+ call s:GPGDebug(1, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ silent execute commandline
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ if (v:shell_error) " message could not be encrypted
+ " delete content of the buffer to be sure no data is written unencrypted
+ " content will be recovered in GPGEncryptPost()
+ silent normal! 1GdG
+
+ echohl GPGError
+ let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)")
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+ return
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+endfunction
+
+" Function: s:GPGEncryptPost() {{{2
+"
+" undo changes don by encrypt, after writing
+"
+function s:GPGEncryptPost()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncryptPost()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()")
+ return
+ endif
+
+ " undo encryption of buffer content
+ silent u
+
+ " switch back from binary mode
+ set nobin
+
+ " restore encoding
+ if (s:GPGEncoding != "")
+ let &encoding = s:GPGEncoding
+ call s:GPGDebug(2, "restored encoding \"" . &encoding . "\"")
+ endif
+
+ " restore window view
+ call winrestview(s:GPGWindowView)
+ call s:GPGDebug(2, "restored window view" . string(s:GPGWindowView))
+
+ " refresh screen
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()")
+endfunction
+
+" Function: s:GPGViewRecipients() {{{2
+"
+" echo the recipients
+"
+function s:GPGViewRecipients()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewRecipients()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()")
+ return
+ endif
+
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients)
+
+ echo 'This file has following recipients (Unknown recipients have a prepended "!"):'
+ " echo the recipients
+ for name in recipients
+ let name = s:GPGIDToName(name)
+ echo name
+ endfor
+
+ " echo the unknown recipients
+ echohl GPGWarning
+ for name in unknownrecipients
+ let name = "!" . name
+ echo name
+ endfor
+ echohl None
+
+ " check if there is any known recipient
+ if (len(recipients) == 0)
+ echohl GPGError
+ echom 'There are no known recipients!'
+ echohl None
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()")
+endfunction
+
+" Function: s:GPGEditRecipients() {{{2
+"
+" create a scratch buffer with all recipients to add/remove recipients
+"
+function s:GPGEditRecipients()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditRecipients()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()")
+ return
+ endif
+
+ " only do this if it isn't already a GPGRecipients_* buffer
+ if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
+
+ " save buffer name
+ let buffername = bufname("%")
+ let editbuffername = "GPGRecipients_" . buffername
+
+ " check if this buffer exists
+ if (!bufexists(editbuffername))
+ " create scratch buffer
+ execute 'silent! split ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the recipients after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
+ else
+ if (bufwinnr(editbuffername) >= 0)
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
+ else
+ " split scratch buffer window
+ execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the recipients after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
+ endif
+
+ " empty the buffer
+ silent normal! 1GdG
+ endif
+
+ " Mark the buffer as a scratch buffer
+ setlocal buftype=acwrite
+ setlocal bufhidden=hide
+ setlocal noswapfile
+ setlocal nowrap
+ setlocal nobuflisted
+ setlocal nonumber
+
+ " so we know for which other buffer this edit buffer is
+ let b:GPGCorrespondingTo = buffername
+
+ " put some comments to the scratch buffer
+ silent put ='GPG: ----------------------------------------------------------------------'
+ silent put ='GPG: Please edit the list of recipients, one recipient per line.'
+ silent put ='GPG: Unknown recipients have a prepended \"!\".'
+ silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
+ silent put ='GPG: Data after recipients between and including \"(\" and \")\" is ignored.'
+ silent put ='GPG: Closing this buffer commits changes.'
+ silent put ='GPG: ----------------------------------------------------------------------'
+
+ " get the recipients
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(getbufvar(b:GPGCorrespondingTo, "GPGRecipients"))
+
+ " if there are no known or unknown recipients, use the default ones
+ if (len(recipients) == 0 && len(unknownrecipients) == 0)
+ if (type(g:GPGDefaultRecipients) == type([]))
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(g:GPGDefaultRecipients)
+ else
+ echohl GPGWarning
+ echom "g:GPGDefaultRecipients is not a Vim list, please correct this in your vimrc!"
+ echohl None
+ endif
+ endif
+
+ " put the recipients in the scratch buffer
+ for name in recipients
+ let name = s:GPGIDToName(name)
+ silent put =name
+ endfor
+
+ " put the unknown recipients in the scratch buffer
+ let syntaxPattern = "\\(nonexxistinwordinthisbuffer"
+ for name in unknownrecipients
+ let name = "!" . name
+ let syntaxPattern = syntaxPattern . "\\|" . name
+ silent put =name
+ endfor
+ let syntaxPattern = syntaxPattern . "\\)"
+
+ " define highlight
+ if (has("syntax") && exists("g:syntax_on"))
+ execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"'
+ highlight clear GPGUnknownRecipient
+ highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
+
+ syntax match GPGComment "^GPG:.*$"
+ execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"'
+ highlight clear GPGComment
+ highlight link GPGComment Comment
+ endif
+
+ " delete the empty first line
+ silent normal! 1Gdd
+
+ " jump to the first recipient
+ silent normal! G
+
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()")
+endfunction
+
+" Function: s:GPGFinishRecipientsBuffer() {{{2
+"
+" create a new recipient list from RecipientsBuffer
+"
+function s:GPGFinishRecipientsBuffer()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishRecipientsBuffer()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()")
+ return
+ endif
+
+ " go to buffer before doing work
+ if (bufnr("%") != expand("<abuf>"))
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
+ endif
+
+ " delete the autocommand
+ autocmd! * <buffer>
+
+
+ " get the recipients from the scratch buffer
+ let recipients = []
+ let lines = getline(1,"$")
+ for recipient in lines
+ " delete all text after magic string
+ let recipient = substitute(recipient, s:GPGMagicString . ".*$", "", "")
+
+ " delete all spaces at beginning and end of the recipient
+ " also delete a '!' at the beginning of the recipient
+ let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
+
+ " delete comment lines
+ let recipient = substitute(recipient, "^GPG:.*$", "", "")
+
+ " only do this if the line is not empty
+ if (strlen(recipient) > 0)
+ let gpgid = s:GPGNameToID(recipient)
+ if (strlen(gpgid) > 0)
+ if (match(recipients, gpgid) < 0)
+ let recipients += [gpgid]
+ endif
+ else
+ if (match(recipients, recipient) < 0)
+ let recipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ endif
+ endif
+ endif
+ endfor
+
+ " write back the new recipient list to the corresponding buffer and mark it
+ " as modified. Buffer is now for sure a encrypted buffer.
+ call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients)
+ call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
+ call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1)
+
+ " check if there is any known recipient
+ if (len(recipients) == 0)
+ echohl GPGError
+ echom 'There are no known recipients!'
+ echohl None
+ endif
+
+ " reset modified flag
+ set nomodified
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()")
+endfunction
+
+" Function: s:GPGViewOptions() {{{2
+"
+" echo the recipients
+"
+function s:GPGViewOptions()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewOptions()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()")
+ return
+ endif
+
+ if (exists("b:GPGOptions"))
+ echo 'This file has following options:'
+ " echo the options
+ for option in b:GPGOptions
+ echo option
+ endfor
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()")
+endfunction
+
+" Function: s:GPGEditOptions() {{{2
+"
+" create a scratch buffer with all recipients to add/remove recipients
+"
+function s:GPGEditOptions()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditOptions()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()")
+ return
+ endif
+
+ " only do this if it isn't already a GPGOptions_* buffer
+ if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
+
+ " save buffer name
+ let buffername = bufname("%")
+ let editbuffername = "GPGOptions_" . buffername
+
+ " check if this buffer exists
+ if (!bufexists(editbuffername))
+ " create scratch buffer
+ execute 'silent! split ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the options after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
+ else
+ if (bufwinnr(editbuffername) >= 0)
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
+ else
+ " split scratch buffer window
+ execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the options after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
+ endif
+
+ " empty the buffer
+ silent normal! 1GdG
+ endif
+
+ " Mark the buffer as a scratch buffer
+ setlocal buftype=nofile
+ setlocal noswapfile
+ setlocal nowrap
+ setlocal nobuflisted
+ setlocal nonumber
+
+ " so we know for which other buffer this edit buffer is
+ let b:GPGCorrespondingTo = buffername
+
+ " put some comments to the scratch buffer
+ silent put ='GPG: ----------------------------------------------------------------------'
+ silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!'
+ silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!'
+ silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd.'
+ silent put ='GPG: Please edit the list of options, one option per line.'
+ silent put ='GPG: Please refer to the gpg documentation for valid options.'
+ silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
+ silent put ='GPG: Closing this buffer commits changes.'
+ silent put ='GPG: ----------------------------------------------------------------------'
+
+ " put the options in the scratch buffer
+ let options = getbufvar(b:GPGCorrespondingTo, "GPGOptions")
+
+ for option in options
+ silent put =option
+ endfor
+
+ " delete the empty first line
+ silent normal! 1Gdd
+
+ " jump to the first option
+ silent normal! G
+
+ " define highlight
+ if (has("syntax") && exists("g:syntax_on"))
+ syntax match GPGComment "^GPG:.*$"
+ highlight clear GPGComment
+ highlight link GPGComment Comment
+ endif
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()")
+endfunction
+
+" Function: s:GPGFinishOptionsBuffer() {{{2
+"
+" create a new option list from OptionsBuffer
+"
+function s:GPGFinishOptionsBuffer()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishOptionsBuffer()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()")
+ return
+ endif
+
+ " go to buffer before doing work
+ if (bufnr("%") != expand("<abuf>"))
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
+ endif
+
+ " clear options and unknownOptions
+ let options = []
+ let unknownOptions = []
+
+ " delete the autocommand
+ autocmd! * <buffer>
+
+ " get the options from the scratch buffer
+ let lines = getline(1, "$")
+ for option in lines
+ " delete all spaces at beginning and end of the option
+ " also delete a '!' at the beginning of the option
+ let option = substitute(option, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
+ " delete comment lines
+ let option = substitute(option, "^GPG:.*$", "", "")
+
+ " only do this if the line is not empty
+ if (strlen(option) > 0 && match(options, option) < 0)
+ let options += [option]
+ endif
+ endfor
+
+ " write back the new option list to the corresponding buffer and mark it
+ " as modified
+ call setbufvar(b:GPGCorrespondingTo, "GPGOptions", options)
+ call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
+
+ " reset modified flag
+ set nomodified
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()")
+endfunction
+
+" Function: s:GPGCheckRecipients(tocheck) {{{2
+"
+" check if recipients are known
+" Returns: two lists recipients and unknownrecipients
+"
+function s:GPGCheckRecipients(tocheck)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCheckRecipients()")
+
+ let recipients = []
+ let unknownrecipients = []
+
+ if (type(a:tocheck) == type([]))
+ for recipient in a:tocheck
+ let gpgid = s:GPGNameToID(recipient)
+ if (strlen(gpgid) > 0)
+ if (match(recipients, gpgid) < 0)
+ let recipients += [gpgid]
+ endif
+ else
+ if (match(unknownrecipients, recipient) < 0)
+ let unknownrecipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ endif
+ end
+ endfor
+ endif
+
+ call s:GPGDebug(2, "recipients are: " . string(recipients))
+ call s:GPGDebug(2, "unknown recipients are: " . string(unknownrecipients))
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCheckRecipients()")
+ return [ recipients, unknownrecipients ]
+endfunction
+
+" Function: s:GPGNameToID(name) {{{2
+"
+" find GPG key ID corresponding to a name
+" Returns: ID for the given name
+"
+function s:GPGNameToID(name)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGNameToID()")
+
+ " ask gpg for the id for a name
+ let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\""
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8,
+ " so convert it, if necessary
+ if (&encoding != "utf-8")
+ let output = iconv(output, "utf-8", &encoding)
+ endif
+ let lines = split(output, "\n")
+
+ " parse the output of gpg
+ let pubseen = 0
+ let counter = 0
+ let gpgids = []
+ let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
+ for line in lines
+ let fields = split(line, ":")
+ " search for the next uid
+ if (pubseen == 1)
+ if (fields[0] == "uid")
+ let choices = choices . " " . fields[9] . "\n"
+ else
+ let pubseen = 0
+ endif
+ endif
+
+ " search for the next pub
+ if (pubseen == 0)
+ if (fields[0] == "pub")
+ let identity = fields[4]
+ let gpgids += [identity]
+ if exists("*strftime")
+ let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n"
+ else
+ let choices = choices . counter . ": ID: 0x" . identity . "\n"
+ endif
+ let counter = counter+1
+ let pubseen = 1
+ endif
+ endif
+
+ endfor
+
+ " counter > 1 means we have more than one results
+ let answer = 0
+ if (counter > 1)
+ let choices = choices . "Enter number: "
+ let answer = input(choices, "0")
+ while (answer == "")
+ let answer = input("Enter number: ", "0")
+ endwhile
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()")
+ return get(gpgids, answer, "")
+endfunction
+
+" Function: s:GPGIDToName(identity) {{{2
+"
+" find name corresponding to a GPG key ID
+" Returns: Name for the given ID
+"
+function s:GPGIDToName(identity)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGIDToName()")
+
+ " TODO is the encryption subkey really unique?
+
+ " ask gpg for the id for a name
+ let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8,
+ " so convert it, if necessary
+ if (&encoding != "utf-8")
+ let output = iconv(output, "utf-8", &encoding)
+ endif
+ let lines = split(output, "\n")
+
+ " parse the output of gpg
+ let pubseen = 0
+ let uid = ""
+ for line in lines
+ let fields = split(line, ":")
+ if (pubseen == 0) " search for the next pub
+ if (fields[0] == "pub")
+ let pubseen = 1
+ endif
+ else " search for the next uid
+ if (fields[0] == "uid")
+ let pubseen = 0
+ if exists("*strftime")
+ let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . " created at " . strftime("%c", fields[5]) . ")"
+ else
+ let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . ")"
+ endif
+ break
+ endif
+ endif
+ endfor
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()")
+ return uid
+endfunction
+
+" Function: s:GPGDebug(level, text) {{{2
+"
+" output debug message, if this message has high enough importance
+" only define function if GPGDebugLevel set at all
+"
+function s:GPGDebug(level, text)
+ if exists("g:GPGDebugLevel") && g:GPGDebugLevel >= a:level
+ if exists("g:GPGDebugLog")
+ execute "redir >> " . g:GPGDebugLog
+ echom "GnuPG: " . a:text
+ redir END
+ else
+ echom "GnuPG: " . a:text
+ endif
+ endif
+endfunction
+
+" Section: Commands {{{1
+
+command! GPGViewRecipients call s:GPGViewRecipients()
+command! GPGEditRecipients call s:GPGEditRecipients()
+command! GPGViewOptions call s:GPGViewOptions()
+command! GPGEditOptions call s:GPGEditOptions()
+
+" Section: Menu {{{1
+
+if (has("menu"))
+ amenu <silent> Plugin.GnuPG.View\ Recipients :GPGViewRecipients<CR>
+ amenu <silent> Plugin.GnuPG.Edit\ Recipients :GPGEditRecipients<CR>
+ amenu <silent> Plugin.GnuPG.View\ Options :GPGViewOptions<CR>
+ amenu <silent> Plugin.GnuPG.Edit\ Options :GPGEditOptions<CR>
+endif
+
+" vim600: set foldmethod=marker foldlevel=0 :
--- /dev/null
+" Name: gnupg.vim
+" Version: $Id: gnupg.vim 3026 2010-01-27 08:18:04Z mbr $
+" Author: Markus Braun <markus.braun@krawel.de>
+" Summary: Vim plugin for transparent editing of gpg encrypted files.
+" Licence: This program is free software; you can redistribute it and/or
+" modify it under the terms of the GNU General Public License.
+" See http://www.gnu.org/copyleft/gpl.txt
+"
+" Section: Documentation {{{1
+"
+" Description: {{{2
+"
+" This script implements transparent editing of gpg encrypted files. The
+" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such
+" a file the content is decrypted, when opening a new file the script will
+" ask for the recipients of the encrypted file. The file content will be
+" encrypted to all recipients before it is written. The script turns off
+" viminfo and swapfile to increase security.
+"
+" Installation: {{{2
+"
+" Copy the gnupg.vim file to the $HOME/.vim/plugin directory.
+" Refer to ':help add-plugin', ':help add-global-plugin' and ':help
+" runtimepath' for more details about Vim plugins.
+"
+" From "man 1 gpg-agent":
+"
+" ...
+" You should always add the following lines to your .bashrc or whatever
+" initialization file is used for all shell invocations:
+"
+" GPG_TTY=`tty`
+" export GPG_TTY
+"
+" It is important that this environment variable always reflects the out‐
+" put of the tty command. For W32 systems this option is not required.
+" ...
+"
+" Most distributions provide software to ease handling of gpg and gpg-agent.
+" Examples are keychain or seahorse.
+"
+" Commands: {{{2
+"
+" :GPGEditRecipients
+" Opens a scratch buffer to change the list of recipients. Recipients that
+" are unknown (not in your public key) are highlighted and have
+" a prepended "!". Closing the buffer makes the changes permanent.
+"
+" :GPGViewRecipients
+" Prints the list of recipients.
+"
+" :GPGEditOptions
+" Opens a scratch buffer to change the options for encryption (symmetric,
+" asymmetric, signing). Closing the buffer makes the changes permanent.
+" WARNING: There is no check of the entered options, so you need to know
+" what you are doing.
+"
+" :GPGViewOptions
+" Prints the list of options.
+"
+" Variables: {{{2
+"
+" g:GPGExecutable
+" If set used as gpg executable, otherwise the system chooses what is run
+" when "gpg" is called. Defaults to "gpg".
+"
+" g:GPGUseAgent
+" If set to 0 a possible available gpg-agent won't be used. Defaults to 1.
+"
+" g:GPGPreferSymmetric
+" If set to 1 symmetric encryption is preferred for new files. Defaults to 0.
+"
+" g:GPGPreferArmor
+" If set to 1 armored data is preferred for new files. Defaults to 0.
+"
+" g:GPGPreferSign
+" If set to 1 signed data is preferred for new files. Defaults to 0.
+"
+" g:GPGDefaultRecipients
+" If set, these recipients are used as defaults when no other recipient is
+" defined. This variable is a Vim list. Default is unset.
+"
+" Known Issues: {{{2
+"
+" In some cases gvim can't decryt files
+
+" This is caused by the fact that a running gvim has no TTY and thus gpg is
+" not able to ask for the passphrase by itself. This is a problem for Windows
+" and Linux versions of gvim and could not be solved unless a "terminal
+" emulation" is implemented for gvim. To circumvent this you have to use any
+" combination of gpg-agent and a graphical pinentry program:
+"
+" - gpg-agent only:
+" you need to provide the passphrase for the needed key to gpg-agent
+" in a terminal before you open files with gvim which require this key.
+"
+" - pinentry only:
+" you will get a popup window every time you open a file that needs to
+" be decrypted.
+"
+" - gpgagent and pinentry:
+" you will get a popup window the first time you open a file that
+" needs to be decrypted.
+"
+" Credits: {{{2
+"
+" - Mathieu Clabaut for inspirations through his vimspell.vim script.
+" - Richard Bronosky for patch to enable ".pgp" suffix.
+" - Erik Remmelzwaal for patch to enable windows support and patient beta
+" testing.
+" - Lars Becker for patch to make gpg2 working.
+" - Thomas Arendsen Hein for patch to convert encoding of gpg output
+" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model
+" and patient beta testing.
+" - Giel van Schijndel for patch to get GPG_TTY dynamically.
+" - Sebastian Luettich for patch to fix issue with symmetric encryption an set
+" recipients.
+" - Tim Swast for patch to generate signed files
+"
+" Section: Plugin header {{{1
+
+" guard against multiple loads {{{2
+if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)"))
+ finish
+endif
+let g:loaded_gnupg = "$Revision: 3026 $"
+
+" check for correct vim version {{{2
+if (v:version < 700)
+ echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.0' | echohl None
+ finish
+endif
+
+" Section: Autocmd setup {{{1
+
+augroup GnuPG
+ autocmd!
+
+ " initialize the internal variables
+ autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit()
+ " force the user to edit the recipient list if he opens a new file and public
+ " keys are preferred
+ autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endif
+ " do the decryption
+ autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt()
+
+ " convert all text to encrypted text before writing
+ autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
+ " undo the encryption so we are back in the normal text, directly
+ " after the file has been written.
+ autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost()
+
+ " cleanup on leaving vim
+ autocmd VimLeave *.\(gpg\|asc\|pgp\) call s:GPGCleanup()
+augroup END
+
+" Section: Constants {{{1
+
+let s:GPGMagicString = "\t \t"
+
+" Section: Highlight setup {{{1
+
+highlight default link GPGWarning WarningMsg
+highlight default link GPGError ErrorMsg
+highlight default link GPGHighlightUnknownRecipient ErrorMsg
+
+" Section: Functions {{{1
+
+" Function: s:GPGInit() {{{2
+"
+" initialize the plugin
+"
+function s:GPGInit()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGInit()")
+
+ " first make sure nothing is written to ~/.viminfo while editing
+ " an encrypted file.
+ set viminfo=
+
+ " we don't want a swap file, as it writes unencrypted data to disk
+ set noswapfile
+
+ " check what gpg command to use
+ if (!exists("g:GPGExecutable"))
+ let g:GPGExecutable = "gpg --trust-model always"
+ endif
+
+ " check if gpg-agent is allowed
+ if (!exists("g:GPGUseAgent"))
+ let g:GPGUseAgent = 1
+ endif
+
+ " check if symmetric encryption is preferred
+ if (!exists("g:GPGPreferSymmetric"))
+ let g:GPGPreferSymmetric = 0
+ endif
+
+ " check if armored files are preferred
+ if (!exists("g:GPGPreferArmor"))
+ let g:GPGPreferArmor = 0
+ endif
+
+ " check if signed files are preferred
+ if (!exists("g:GPGPreferSign"))
+ let g:GPGPreferSign = 0
+ endif
+
+ " start with empty default recipients if none is defined so far
+ if (!exists("g:GPGDefaultRecipients"))
+ let g:GPGDefaultRecipients = []
+ endif
+
+ " print version
+ call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg)
+
+ " determine if gnupg can use the gpg-agent
+ if (exists("$GPG_AGENT_INFO") && g:GPGUseAgent == 1)
+ if (!exists("$GPG_TTY") && !has("gui_running"))
+ let $GPG_TTY = system("tty")
+ if (v:shell_error)
+ let $GPG_TTY = ""
+ echohl GPGError
+ echom "The GPG_TTY is not set and no TTY could be found using the `tty` command!"
+ echom "gpg-agent might not work."
+ echohl None
+ endif
+ endif
+ let s:GPGCommand = g:GPGExecutable . " --use-agent"
+ else
+ let s:GPGCommand = g:GPGExecutable . " --no-use-agent"
+ endif
+
+ " don't use tty in gvim
+ " FIXME find a better way to avoid an error.
+ " with this solution only --use-agent will work
+ if (has("gui_running"))
+ let s:GPGCommand = s:GPGCommand . " --no-tty"
+ endif
+
+ " setup shell environment for unix and windows
+ let s:shellredirsave = &shellredir
+ let s:shellsave = &shell
+ if (has("unix"))
+ " unix specific settings
+ let s:shellredir = ">%s 2>&1"
+ let s:shell = '/bin/sh'
+ let s:stderrredirnull = '2>/dev/null'
+ let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand
+ else
+ " windows specific settings
+ let s:shellredir = '>%s'
+ let s:shell = &shell
+ let s:stderrredirnull = '2>nul'
+ endif
+
+ call s:GPGDebug(3, "shellredirsave: " . s:shellredirsave)
+ call s:GPGDebug(3, "shellsave: " . s:shellsave)
+
+ call s:GPGDebug(3, "shell: " . s:shell)
+ call s:GPGDebug(3, "shellcmdflag: " . &shellcmdflag)
+ call s:GPGDebug(3, "shellxquote: " . &shellxquote)
+ call s:GPGDebug(3, "shellredir: " . s:shellredir)
+ call s:GPGDebug(3, "stderrredirnull: " . s:stderrredirnull)
+
+ call s:GPGDebug(3, "shell implementation: " . resolve(s:shell))
+
+ " find the supported algorithms
+ let commandline = s:GPGCommand . " --version"
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ let s:GPGPubkey = substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGCipher = substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGHash = substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "")
+ let s:GPGCompress = substitute(output, ".*Compress.\\{-}: \\(.\\{-}\\)\n.*", "\\1", "")
+
+ call s:GPGDebug(2, "public key algorithms: " . s:GPGPubkey)
+ call s:GPGDebug(2, "cipher algorithms: " . s:GPGCipher)
+ call s:GPGDebug(2, "hashing algorithms: " . s:GPGHash)
+ call s:GPGDebug(2, "compression algorithms: " . s:GPGCompress)
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGInit()")
+endfunction
+
+" Function: s:GPGCleanup() {{{2
+"
+" cleanup on leaving vim
+"
+function s:GPGCleanup()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()")
+
+ " wipe out screen
+ new +only
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()")
+endfunction
+
+" Function: s:GPGDecrypt() {{{2
+"
+" decrypt the buffer and find all recipients of the encrypted file
+"
+function s:GPGDecrypt()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGDecrypt()")
+
+ " switch to binary mode to read the encrypted file
+ set bin
+
+ " get the filename of the current buffer
+ let filename = escape(expand("%:p"), '\"')
+
+ " clear GPGEncrypted, GPGRecipients and GPGOptions
+ let b:GPGEncrypted = 0
+ let b:GPGRecipients = []
+ let b:GPGOptions = []
+
+ " find the recipients of the file
+ let commandline = s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\""
+ call s:GPGDebug(3, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(3, "output: ". output)
+
+ " check if the file is symmetric/asymmetric encrypted
+ if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0)
+ " file is symmetric encrypted
+ let b:GPGEncrypted = 1
+ call s:GPGDebug(1, "this file is symmetric encrypted")
+
+ let b:GPGOptions += ["symmetric"]
+
+ " find the used cipher algorithm
+ let cipher = substitute(output, ".*gpg: \\([^ ]\\+\\) encrypted data.*", "\\1", "")
+ if (match(s:GPGCipher, "\\<" . cipher . "\\>") >= 0)
+ let b:GPGOptions += ["cipher-algo " . cipher]
+ call s:GPGDebug(1, "cipher-algo is " . cipher)
+ else
+ echohl GPGWarning
+ echom "The cipher " . cipher . " is not known by the local gpg command. Using default!"
+ echo
+ echohl None
+ endif
+ elseif (match(output, "gpg: public key is [[:xdigit:]]\\{8}") >= 0)
+ " file is asymmetric encrypted
+ let b:GPGEncrypted = 1
+ call s:GPGDebug(1, "this file is asymmetric encrypted")
+
+ let b:GPGOptions += ["encrypt"]
+
+ " find the used public keys
+ let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}")
+ while (start >= 0)
+ let start = start + strlen("gpg: public key is ")
+ let recipient = strpart(output, start, 8)
+ call s:GPGDebug(1, "recipient is " . recipient)
+ let name = s:GPGNameToID(recipient)
+ if (strlen(name) > 0)
+ let b:GPGRecipients += [name]
+ call s:GPGDebug(1, "name of recipient is " . name)
+ else
+ let b:GPGRecipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ end
+ let start = match(output, "gpg: public key is [[:xdigit:]]\\{8}", start)
+ endwhile
+ else
+ " file is not encrypted
+ let b:GPGEncrypted = 0
+ call s:GPGDebug(1, "this file is not encrypted")
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ set nobin
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+ return
+ endif
+
+ " check if the message is armored
+ if (match(output, "gpg: armor header") >= 0)
+ call s:GPGDebug(1, "this file is armored")
+ let b:GPGOptions += ["armor"]
+ endif
+
+ " finally decrypt the buffer content
+ " since even with the --quiet option passphrase typos will be reported,
+ " we must redirect stderr (using shell temporarily)
+ call s:GPGDebug(1, "decrypting file")
+ let commandline = "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull
+ call s:GPGDebug(1, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ execute commandline
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ if (v:shell_error) " message could not be decrypted
+ silent u
+ echohl GPGError
+ let blackhole = input("Message could not be decrypted! (Press ENTER)")
+ echohl None
+ bwipeout
+ set nobin
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+ return
+ endif
+
+ " turn off binary mode
+ set nobin
+
+ " call the autocommand for the file minus .gpg$
+ execute ":doautocmd BufReadPost " . escape(expand("%:r"), ' *?\"'."'")
+ call s:GPGDebug(2, "called autocommand for " . escape(expand("%:r"), ' *?\"'."'"))
+
+ " refresh screen
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
+endfunction
+
+" Function: s:GPGEncrypt() {{{2
+"
+" encrypts the buffer to all previous recipients
+"
+function s:GPGEncrypt()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncrypt()")
+
+ " save window view
+ let s:GPGWindowView = winsaveview()
+ call s:GPGDebug(2, "saved window view " . string(s:GPGWindowView))
+
+ " store encoding and switch to a safe one
+ if (&fileencoding != &encoding)
+ let s:GPGEncoding = &encoding
+ let &encoding = &fileencoding
+ call s:GPGDebug(2, "encoding was \"" . s:GPGEncoding . "\", switched to \"" . &encoding . "\"")
+ else
+ let s:GPGEncoding = ""
+ call s:GPGDebug(2, "encoding and fileencoding are the same (\"" . &encoding . "\"), not switching")
+ endif
+
+ " switch buffer to binary mode
+ set bin
+
+ " guard for unencrypted files
+ if (!exists("b:GPGEncrypted") || b:GPGEncrypted == 0)
+ echohl GPGError
+ let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)")
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+ return
+ endif
+
+ " initialize GPGOptions if not happened before
+ if (!exists("b:GPGOptions") || len(b:GPGOptions) == 0)
+ let b:GPGOptions = []
+ if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 1)
+ let b:GPGOptions += ["symmetric"]
+ let b:GPGRecipients = []
+ else
+ let b:GPGOptions += ["encrypt"]
+ endif
+ if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
+ let b:GPGOptions += ["armor"]
+ endif
+ if (exists("g:GPGPreferSign") && g:GPGPreferSign == 1)
+ let b:GPGOptions += ["sign"]
+ endif
+ call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions))
+ endif
+
+ " built list of options
+ let options = ""
+ for option in b:GPGOptions
+ let options = options . " --" . option . " "
+ endfor
+
+ " check here again if all recipients are available in the keyring
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients)
+
+ " check if there are unknown recipients and warn
+ if (len(unknownrecipients) > 0)
+ echohl GPGWarning
+ echom "Please use GPGEditRecipients to correct!!"
+ echo
+ echohl None
+
+ " Let user know whats happend and copy known_recipients back to buffer
+ let dummy = input("Press ENTER to quit")
+ endif
+
+ " built list of recipients
+ if (len(recipients) > 0)
+ for gpgid in recipients
+ let options = options . " -r " . gpgid
+ endfor
+ else
+ if (match(b:GPGOptions, "encrypt") >= 0)
+ echohl GPGError
+ echom "There are no recipients!!"
+ echom "Please use GPGEditRecipients to correct!!"
+ echo
+ echohl None
+ endif
+ endif
+
+ " encrypt the buffer
+ let commandline = "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull
+ call s:GPGDebug(1, "command: " . commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ silent execute commandline
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ if (v:shell_error) " message could not be encrypted
+ " delete content of the buffer to be sure no data is written unencrypted
+ " content will be recovered in GPGEncryptPost()
+ silent normal! 1GdG
+
+ echohl GPGError
+ let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)")
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+ return
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()")
+endfunction
+
+" Function: s:GPGEncryptPost() {{{2
+"
+" undo changes don by encrypt, after writing
+"
+function s:GPGEncryptPost()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncryptPost()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()")
+ return
+ endif
+
+ " undo encryption of buffer content
+ silent u
+
+ " switch back from binary mode
+ set nobin
+
+ " restore encoding
+ if (s:GPGEncoding != "")
+ let &encoding = s:GPGEncoding
+ call s:GPGDebug(2, "restored encoding \"" . &encoding . "\"")
+ endif
+
+ " restore window view
+ call winrestview(s:GPGWindowView)
+ call s:GPGDebug(2, "restored window view" . string(s:GPGWindowView))
+
+ " refresh screen
+ redraw!
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()")
+endfunction
+
+" Function: s:GPGViewRecipients() {{{2
+"
+" echo the recipients
+"
+function s:GPGViewRecipients()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewRecipients()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()")
+ return
+ endif
+
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(b:GPGRecipients)
+
+ echo 'This file has following recipients (Unknown recipients have a prepended "!"):'
+ " echo the recipients
+ for name in recipients
+ let name = s:GPGIDToName(name)
+ echo name
+ endfor
+
+ " echo the unknown recipients
+ echohl GPGWarning
+ for name in unknownrecipients
+ let name = "!" . name
+ echo name
+ endfor
+ echohl None
+
+ " check if there is any known recipient
+ if (len(recipients) == 0)
+ echohl GPGError
+ echom 'There are no known recipients!'
+ echohl None
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()")
+endfunction
+
+" Function: s:GPGEditRecipients() {{{2
+"
+" create a scratch buffer with all recipients to add/remove recipients
+"
+function s:GPGEditRecipients()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditRecipients()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()")
+ return
+ endif
+
+ " only do this if it isn't already a GPGRecipients_* buffer
+ if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
+
+ " save buffer name
+ let buffername = bufname("%")
+ let editbuffername = "GPGRecipients_" . buffername
+
+ " check if this buffer exists
+ if (!bufexists(editbuffername))
+ " create scratch buffer
+ execute 'silent! split ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the recipients after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
+ else
+ if (bufwinnr(editbuffername) >= 0)
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
+ else
+ " split scratch buffer window
+ execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the recipients after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
+ endif
+
+ " empty the buffer
+ silent normal! 1GdG
+ endif
+
+ " Mark the buffer as a scratch buffer
+ setlocal buftype=acwrite
+ setlocal bufhidden=hide
+ setlocal noswapfile
+ setlocal nowrap
+ setlocal nobuflisted
+ setlocal nonumber
+
+ " so we know for which other buffer this edit buffer is
+ let b:GPGCorrespondingTo = buffername
+
+ " put some comments to the scratch buffer
+ silent put ='GPG: ----------------------------------------------------------------------'
+ silent put ='GPG: Please edit the list of recipients, one recipient per line.'
+ silent put ='GPG: Unknown recipients have a prepended \"!\".'
+ silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
+ silent put ='GPG: Data after recipients between and including \"(\" and \")\" is ignored.'
+ silent put ='GPG: Closing this buffer commits changes.'
+ silent put ='GPG: ----------------------------------------------------------------------'
+
+ " get the recipients
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(getbufvar(b:GPGCorrespondingTo, "GPGRecipients"))
+
+ " if there are no known or unknown recipients, use the default ones
+ if (len(recipients) == 0 && len(unknownrecipients) == 0)
+ if (type(g:GPGDefaultRecipients) == type([]))
+ let [ recipients, unknownrecipients ] = s:GPGCheckRecipients(g:GPGDefaultRecipients)
+ else
+ echohl GPGWarning
+ echom "g:GPGDefaultRecipients is not a Vim list, please correct this in your vimrc!"
+ echohl None
+ endif
+ endif
+
+ " put the recipients in the scratch buffer
+ for name in recipients
+ let name = s:GPGIDToName(name)
+ silent put =name
+ endfor
+
+ " put the unknown recipients in the scratch buffer
+ let syntaxPattern = "\\(nonexxistinwordinthisbuffer"
+ for name in unknownrecipients
+ let name = "!" . name
+ let syntaxPattern = syntaxPattern . "\\|" . name
+ silent put =name
+ endfor
+ let syntaxPattern = syntaxPattern . "\\)"
+
+ " define highlight
+ if (has("syntax") && exists("g:syntax_on"))
+ execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"'
+ highlight clear GPGUnknownRecipient
+ highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
+
+ syntax match GPGComment "^GPG:.*$"
+ execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"'
+ highlight clear GPGComment
+ highlight link GPGComment Comment
+ endif
+
+ " delete the empty first line
+ silent normal! 1Gdd
+
+ " jump to the first recipient
+ silent normal! G
+
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()")
+endfunction
+
+" Function: s:GPGFinishRecipientsBuffer() {{{2
+"
+" create a new recipient list from RecipientsBuffer
+"
+function s:GPGFinishRecipientsBuffer()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishRecipientsBuffer()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()")
+ return
+ endif
+
+ " go to buffer before doing work
+ if (bufnr("%") != expand("<abuf>"))
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
+ endif
+
+ " delete the autocommand
+ autocmd! * <buffer>
+
+
+ " get the recipients from the scratch buffer
+ let recipients = []
+ let lines = getline(1,"$")
+ for recipient in lines
+ " delete all text after magic string
+ let recipient = substitute(recipient, s:GPGMagicString . ".*$", "", "")
+
+ " delete all spaces at beginning and end of the recipient
+ " also delete a '!' at the beginning of the recipient
+ let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
+
+ " delete comment lines
+ let recipient = substitute(recipient, "^GPG:.*$", "", "")
+
+ " only do this if the line is not empty
+ if (strlen(recipient) > 0)
+ let gpgid = s:GPGNameToID(recipient)
+ if (strlen(gpgid) > 0)
+ if (match(recipients, gpgid) < 0)
+ let recipients += [gpgid]
+ endif
+ else
+ if (match(recipients, recipient) < 0)
+ let recipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ endif
+ endif
+ endif
+ endfor
+
+ " write back the new recipient list to the corresponding buffer and mark it
+ " as modified. Buffer is now for sure a encrypted buffer.
+ call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients)
+ call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
+ call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1)
+
+ " check if there is any known recipient
+ if (len(recipients) == 0)
+ echohl GPGError
+ echom 'There are no known recipients!'
+ echohl None
+ endif
+
+ " reset modified flag
+ set nomodified
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()")
+endfunction
+
+" Function: s:GPGViewOptions() {{{2
+"
+" echo the recipients
+"
+function s:GPGViewOptions()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewOptions()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()")
+ return
+ endif
+
+ if (exists("b:GPGOptions"))
+ echo 'This file has following options:'
+ " echo the options
+ for option in b:GPGOptions
+ echo option
+ endfor
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()")
+endfunction
+
+" Function: s:GPGEditOptions() {{{2
+"
+" create a scratch buffer with all recipients to add/remove recipients
+"
+function s:GPGEditOptions()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditOptions()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()")
+ return
+ endif
+
+ " only do this if it isn't already a GPGOptions_* buffer
+ if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
+
+ " save buffer name
+ let buffername = bufname("%")
+ let editbuffername = "GPGOptions_" . buffername
+
+ " check if this buffer exists
+ if (!bufexists(editbuffername))
+ " create scratch buffer
+ execute 'silent! split ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the options after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
+ else
+ if (bufwinnr(editbuffername) >= 0)
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
+ else
+ " split scratch buffer window
+ execute 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
+
+ " add a autocommand to regenerate the options after a write
+ autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
+ endif
+
+ " empty the buffer
+ silent normal! 1GdG
+ endif
+
+ " Mark the buffer as a scratch buffer
+ setlocal buftype=nofile
+ setlocal noswapfile
+ setlocal nowrap
+ setlocal nobuflisted
+ setlocal nonumber
+
+ " so we know for which other buffer this edit buffer is
+ let b:GPGCorrespondingTo = buffername
+
+ " put some comments to the scratch buffer
+ silent put ='GPG: ----------------------------------------------------------------------'
+ silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!'
+ silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!'
+ silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd.'
+ silent put ='GPG: Please edit the list of options, one option per line.'
+ silent put ='GPG: Please refer to the gpg documentation for valid options.'
+ silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
+ silent put ='GPG: Closing this buffer commits changes.'
+ silent put ='GPG: ----------------------------------------------------------------------'
+
+ " put the options in the scratch buffer
+ let options = getbufvar(b:GPGCorrespondingTo, "GPGOptions")
+
+ for option in options
+ silent put =option
+ endfor
+
+ " delete the empty first line
+ silent normal! 1Gdd
+
+ " jump to the first option
+ silent normal! G
+
+ " define highlight
+ if (has("syntax") && exists("g:syntax_on"))
+ syntax match GPGComment "^GPG:.*$"
+ highlight clear GPGComment
+ highlight link GPGComment Comment
+ endif
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()")
+endfunction
+
+" Function: s:GPGFinishOptionsBuffer() {{{2
+"
+" create a new option list from OptionsBuffer
+"
+function s:GPGFinishOptionsBuffer()
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishOptionsBuffer()")
+
+ " guard for unencrypted files
+ if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
+ echohl GPGWarning
+ echom "File is not encrypted, all GPG functions disabled!"
+ echohl None
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()")
+ return
+ endif
+
+ " go to buffer before doing work
+ if (bufnr("%") != expand("<abuf>"))
+ " switch to scratch buffer window
+ execute 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
+ endif
+
+ " clear options and unknownOptions
+ let options = []
+ let unknownOptions = []
+
+ " delete the autocommand
+ autocmd! * <buffer>
+
+ " get the options from the scratch buffer
+ let lines = getline(1, "$")
+ for option in lines
+ " delete all spaces at beginning and end of the option
+ " also delete a '!' at the beginning of the option
+ let option = substitute(option, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
+ " delete comment lines
+ let option = substitute(option, "^GPG:.*$", "", "")
+
+ " only do this if the line is not empty
+ if (strlen(option) > 0 && match(options, option) < 0)
+ let options += [option]
+ endif
+ endfor
+
+ " write back the new option list to the corresponding buffer and mark it
+ " as modified
+ call setbufvar(b:GPGCorrespondingTo, "GPGOptions", options)
+ call setbufvar(b:GPGCorrespondingTo, "&mod", 1)
+
+ " reset modified flag
+ set nomodified
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()")
+endfunction
+
+" Function: s:GPGCheckRecipients(tocheck) {{{2
+"
+" check if recipients are known
+" Returns: two lists recipients and unknownrecipients
+"
+function s:GPGCheckRecipients(tocheck)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCheckRecipients()")
+
+ let recipients = []
+ let unknownrecipients = []
+
+ if (type(a:tocheck) == type([]))
+ for recipient in a:tocheck
+ let gpgid = s:GPGNameToID(recipient)
+ if (strlen(gpgid) > 0)
+ if (match(recipients, gpgid) < 0)
+ let recipients += [gpgid]
+ endif
+ else
+ if (match(unknownrecipients, recipient) < 0)
+ let unknownrecipients += [recipient]
+ echohl GPGWarning
+ echom "The recipient \"" . recipient . "\" is not in your public keyring!"
+ echohl None
+ endif
+ end
+ endfor
+ endif
+
+ call s:GPGDebug(2, "recipients are: " . string(recipients))
+ call s:GPGDebug(2, "unknown recipients are: " . string(unknownrecipients))
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCheckRecipients()")
+ return [ recipients, unknownrecipients ]
+endfunction
+
+" Function: s:GPGNameToID(name) {{{2
+"
+" find GPG key ID corresponding to a name
+" Returns: ID for the given name
+"
+function s:GPGNameToID(name)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGNameToID()")
+
+ " ask gpg for the id for a name
+ let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\""
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8,
+ " so convert it, if necessary
+ if (&encoding != "utf-8")
+ let output = iconv(output, "utf-8", &encoding)
+ endif
+ let lines = split(output, "\n")
+
+ " parse the output of gpg
+ let pubseen = 0
+ let counter = 0
+ let gpgids = []
+ let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
+ for line in lines
+ let fields = split(line, ":")
+ " search for the next uid
+ if (pubseen == 1)
+ if (fields[0] == "uid")
+ let choices = choices . " " . fields[9] . "\n"
+ else
+ let pubseen = 0
+ endif
+ endif
+
+ " search for the next pub
+ if (pubseen == 0)
+ if (fields[0] == "pub")
+ let identity = fields[4]
+ let gpgids += [identity]
+ if exists("*strftime")
+ let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n"
+ else
+ let choices = choices . counter . ": ID: 0x" . identity . "\n"
+ endif
+ let counter = counter+1
+ let pubseen = 1
+ endif
+ endif
+
+ endfor
+
+ " counter > 1 means we have more than one results
+ let answer = 0
+ if (counter > 1)
+ let choices = choices . "Enter number: "
+ let answer = input(choices, "0")
+ while (answer == "")
+ let answer = input("Enter number: ", "0")
+ endwhile
+ endif
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()")
+ return get(gpgids, answer, "")
+endfunction
+
+" Function: s:GPGIDToName(identity) {{{2
+"
+" find name corresponding to a GPG key ID
+" Returns: Name for the given ID
+"
+function s:GPGIDToName(identity)
+ call s:GPGDebug(3, ">>>>>>>> Entering s:GPGIDToName()")
+
+ " TODO is the encryption subkey really unique?
+
+ " ask gpg for the id for a name
+ let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity
+ call s:GPGDebug(2, "command: ". commandline)
+ let &shellredir = s:shellredir
+ let &shell = s:shell
+ let output = system(commandline)
+ let &shellredir = s:shellredirsave
+ let &shell = s:shellsave
+ call s:GPGDebug(2, "output: ". output)
+
+ " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8,
+ " so convert it, if necessary
+ if (&encoding != "utf-8")
+ let output = iconv(output, "utf-8", &encoding)
+ endif
+ let lines = split(output, "\n")
+
+ " parse the output of gpg
+ let pubseen = 0
+ let uid = ""
+ for line in lines
+ let fields = split(line, ":")
+ if (pubseen == 0) " search for the next pub
+ if (fields[0] == "pub")
+ let pubseen = 1
+ endif
+ else " search for the next uid
+ if (fields[0] == "uid")
+ let pubseen = 0
+ if exists("*strftime")
+ let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . " created at " . strftime("%c", fields[5]) . ")"
+ else
+ let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . ")"
+ endif
+ break
+ endif
+ endif
+ endfor
+
+ call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()")
+ return uid
+endfunction
+
+" Function: s:GPGDebug(level, text) {{{2
+"
+" output debug message, if this message has high enough importance
+" only define function if GPGDebugLevel set at all
+"
+function s:GPGDebug(level, text)
+ if exists("g:GPGDebugLevel") && g:GPGDebugLevel >= a:level
+ if exists("g:GPGDebugLog")
+ execute "redir >> " . g:GPGDebugLog
+ echom "GnuPG: " . a:text
+ redir END
+ else
+ echom "GnuPG: " . a:text
+ endif
+ endif
+endfunction
+
+" Section: Commands {{{1
+
+command! GPGViewRecipients call s:GPGViewRecipients()
+command! GPGEditRecipients call s:GPGEditRecipients()
+command! GPGViewOptions call s:GPGViewOptions()
+command! GPGEditOptions call s:GPGEditOptions()
+
+" Section: Menu {{{1
+
+if (has("menu"))
+ amenu <silent> Plugin.GnuPG.View\ Recipients :GPGViewRecipients<CR>
+ amenu <silent> Plugin.GnuPG.Edit\ Recipients :GPGEditRecipients<CR>
+ amenu <silent> Plugin.GnuPG.View\ Options :GPGViewOptions<CR>
+ amenu <silent> Plugin.GnuPG.Edit\ Options :GPGEditOptions<CR>
+endif
+
+" vim600: set foldmethod=marker foldlevel=0 :
--- /dev/null
+" Vim color file
+"
+" Author: Tomas Restrepo <tomas@winterdom.com>
+"
+" Note: Based on the monokai theme for textmate
+" by Wimer Hazenberg and its darker variant
+" by Hamish Stuart Macpherson
+"
+
+hi clear
+
+set background=dark
+if version > 580
+ " no guarantees for version 5.8 and below, but this makes it stop
+ " complaining
+ hi clear
+ if exists("syntax_on")
+ syntax reset
+ endif
+endif
+let g:colors_name="molokai"
+
+if exists("g:molokai_original")
+ let s:molokai_original = g:molokai_original
+else
+ let s:molokai_original = 0
+endif
+
+
+hi Boolean guifg=#AE81FF
+hi Character guifg=#E6DB74
+hi Number guifg=#AE81FF
+hi String guifg=#E6DB74
+hi Conditional guifg=#F92672 gui=bold
+hi Constant guifg=#AE81FF gui=bold
+hi Cursor guifg=#000000 guibg=#F8F8F0
+hi Debug guifg=#BCA3A3 gui=bold
+hi Define guifg=#66D9EF
+hi Delimiter guifg=#8F8F8F
+hi DiffAdd guibg=#13354A
+hi DiffChange guifg=#89807D guibg=#4C4745
+hi DiffDelete guifg=#960050 guibg=#1E0010
+hi DiffText guibg=#4C4745 gui=italic,bold
+
+hi Directory guifg=#A6E22E gui=bold
+hi Error guifg=#960050 guibg=#1E0010
+hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
+hi Exception guifg=#A6E22E gui=bold
+hi Float guifg=#AE81FF
+hi FoldColumn guifg=#465457 guibg=#000000
+hi Folded guifg=#465457 guibg=#000000
+hi Function guifg=#A6E22E
+hi Identifier guifg=#FD971F
+hi Ignore guifg=#808080 guibg=bg
+hi IncSearch guifg=#C4BE89 guibg=#000000
+
+hi Keyword guifg=#F92672 gui=bold
+hi Label guifg=#E6DB74 gui=none
+hi Macro guifg=#C4BE89 gui=italic
+hi SpecialKey guifg=#66D9EF gui=italic
+
+hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
+hi ModeMsg guifg=#E6DB74
+hi MoreMsg guifg=#E6DB74
+hi Operator guifg=#F92672
+
+" complete menu
+hi Pmenu guifg=#66D9EF guibg=#000000
+hi PmenuSel guibg=#808080
+hi PmenuSbar guibg=#080808
+hi PmenuThumb guifg=#66D9EF
+
+hi PreCondit guifg=#A6E22E gui=bold
+hi PreProc guifg=#A6E22E
+hi Question guifg=#66D9EF
+hi Repeat guifg=#F92672 gui=bold
+hi Search guifg=#FFFFFF guibg=#455354
+" marks column
+hi SignColumn guifg=#A6E22E guibg=#232526
+hi SpecialChar guifg=#F92672 gui=bold
+hi SpecialComment guifg=#465457 gui=bold
+hi Special guifg=#66D9EF guibg=bg gui=italic
+hi SpecialKey guifg=#888A85 gui=italic
+if has("spell")
+ hi SpellBad guisp=#FF0000 gui=undercurl
+ hi SpellCap guisp=#7070F0 gui=undercurl
+ hi SpellLocal guisp=#70F0F0 gui=undercurl
+ hi SpellRare guisp=#FFFFFF gui=undercurl
+endif
+hi Statement guifg=#F92672 gui=bold
+hi StatusLine guifg=#455354 guibg=fg
+hi StatusLineNC guifg=#808080 guibg=#080808
+hi StorageClass guifg=#FD971F gui=italic
+hi Structure guifg=#66D9EF
+hi Tag guifg=#F92672 gui=italic
+hi Title guifg=#ef5939
+hi Todo guifg=#FFFFFF guibg=bg gui=bold
+
+hi Typedef guifg=#66D9EF
+hi Type guifg=#66D9EF gui=none
+hi Underlined guifg=#808080 gui=underline
+
+hi VertSplit guifg=#808080 guibg=#080808 gui=bold
+hi VisualNOS guibg=#403D3D
+hi Visual guibg=#403D3D
+hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
+hi WildMenu guifg=#66D9EF guibg=#000000
+
+if s:molokai_original == 1
+ hi Normal guifg=#F8F8F2 guibg=#272822
+ hi Comment guifg=#75715E
+ hi CursorLine guibg=#3E3D32
+ hi CursorColumn guibg=#3E3D32
+ hi LineNr guifg=#BCBCBC guibg=#3B3A32
+ hi NonText guifg=#BCBCBC guibg=#3B3A32
+else
+ hi Normal guifg=#F8F8F2 guibg=#1B1D1E
+ hi Comment guifg=#465457
+ hi CursorLine guibg=#293739
+ hi CursorColumn guibg=#293739
+ hi LineNr guifg=#BCBCBC guibg=#232526
+ hi NonText guifg=#BCBCBC guibg=#232526
+end
+
+"
+" Support for 256-color terminal
+"
+if &t_Co > 255
+ hi Boolean ctermfg=135
+ hi Character ctermfg=144
+ hi Number ctermfg=135
+ hi String ctermfg=144
+ hi Conditional ctermfg=161 cterm=bold
+ hi Constant ctermfg=135 cterm=bold
+ hi Cursor ctermfg=16 ctermbg=253
+ hi Debug ctermfg=225 cterm=bold
+ hi Define ctermfg=81
+ hi Delimiter ctermfg=241
+
+ hi DiffAdd ctermbg=24
+ hi DiffChange ctermfg=181 ctermbg=239
+ hi DiffDelete ctermfg=162 ctermbg=53
+ hi DiffText ctermbg=102 cterm=bold
+
+ hi Directory ctermfg=118 cterm=bold
+ hi Error ctermfg=219 ctermbg=89
+ hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
+ hi Exception ctermfg=118 cterm=bold
+ hi Float ctermfg=135
+ hi FoldColumn ctermfg=67 ctermbg=16
+ hi Folded ctermfg=67 ctermbg=16
+ hi Function ctermfg=118
+ hi Identifier ctermfg=208
+ hi Ignore ctermfg=244 ctermbg=232
+ hi IncSearch ctermfg=193 ctermbg=16
+
+ hi Keyword ctermfg=161 cterm=bold
+ hi Label ctermfg=229 cterm=none
+ hi Macro ctermfg=193
+ hi SpecialKey ctermfg=81
+
+ hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
+ hi ModeMsg ctermfg=229
+ hi MoreMsg ctermfg=229
+ hi Operator ctermfg=161
+
+ " complete menu
+ hi Pmenu ctermfg=81 ctermbg=16
+ hi PmenuSel ctermbg=244
+ hi PmenuSbar ctermbg=232
+ hi PmenuThumb ctermfg=81
+
+ hi PreCondit ctermfg=118 cterm=bold
+ hi PreProc ctermfg=118
+ hi Question ctermfg=81
+ hi Repeat ctermfg=161 cterm=bold
+ hi Search ctermfg=253 ctermbg=66
+
+ " marks column
+ hi SignColumn ctermfg=118 ctermbg=235
+ hi SpecialChar ctermfg=161 cterm=bold
+ hi SpecialComment ctermfg=245 cterm=bold
+ hi Special ctermfg=81 ctermbg=232
+ hi SpecialKey ctermfg=245
+
+ hi Statement ctermfg=161 cterm=bold
+ hi StatusLine ctermfg=238 ctermbg=253
+ hi StatusLineNC ctermfg=244 ctermbg=232
+ hi StorageClass ctermfg=208
+ hi Structure ctermfg=81
+ hi Tag ctermfg=161
+ hi Title ctermfg=166
+ hi Todo ctermfg=231 ctermbg=232 cterm=bold
+
+ hi Typedef ctermfg=81
+ hi Type ctermfg=81 cterm=none
+ hi Underlined ctermfg=244 cterm=underline
+
+ hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
+ hi VisualNOS ctermbg=238
+ hi Visual ctermbg=235
+ hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
+ hi WildMenu ctermfg=81 ctermbg=16
+
+ hi Normal ctermfg=252 ctermbg=233
+ hi Comment ctermfg=59
+ hi CursorLine ctermbg=234 cterm=none
+ hi CursorColumn ctermbg=234
+ hi LineNr ctermfg=250 ctermbg=234
+ hi NonText ctermfg=250 ctermbg=234
+end
--- /dev/null
+" Vim color file
+"
+" Author: Tomas Restrepo <tomas@winterdom.com>
+"
+" Note: Based on the monokai theme for textmate
+" by Wimer Hazenberg and its darker variant
+" by Hamish Stuart Macpherson
+"
+
+hi clear
+
+set background=dark
+if version > 580
+ " no guarantees for version 5.8 and below, but this makes it stop
+ " complaining
+ hi clear
+ if exists("syntax_on")
+ syntax reset
+ endif
+endif
+let g:colors_name="molokai"
+
+if exists("g:molokai_original")
+ let s:molokai_original = g:molokai_original
+else
+ let s:molokai_original = 0
+endif
+
+
+hi Boolean guifg=#AE81FF
+hi Character guifg=#E6DB74
+hi Number guifg=#AE81FF
+hi String guifg=#E6DB74
+hi Conditional guifg=#F92672 gui=bold
+hi Constant guifg=#AE81FF gui=bold
+hi Cursor guifg=#000000 guibg=#F8F8F0
+hi Debug guifg=#BCA3A3 gui=bold
+hi Define guifg=#66D9EF
+hi Delimiter guifg=#8F8F8F
+hi DiffAdd guibg=#13354A
+hi DiffChange guifg=#89807D guibg=#4C4745
+hi DiffDelete guifg=#960050 guibg=#1E0010
+hi DiffText guibg=#4C4745 gui=italic,bold
+
+hi Directory guifg=#A6E22E gui=bold
+hi Error guifg=#960050 guibg=#1E0010
+hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
+hi Exception guifg=#A6E22E gui=bold
+hi Float guifg=#AE81FF
+hi FoldColumn guifg=#465457 guibg=#000000
+hi Folded guifg=#465457 guibg=#000000
+hi Function guifg=#A6E22E
+hi Identifier guifg=#FD971F
+hi Ignore guifg=#808080 guibg=bg
+hi IncSearch guifg=#C4BE89 guibg=#000000
+
+hi Keyword guifg=#F92672 gui=bold
+hi Label guifg=#E6DB74 gui=none
+hi Macro guifg=#C4BE89 gui=italic
+hi SpecialKey guifg=#66D9EF gui=italic
+
+hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
+hi ModeMsg guifg=#E6DB74
+hi MoreMsg guifg=#E6DB74
+hi Operator guifg=#F92672
+
+" complete menu
+hi Pmenu guifg=#66D9EF guibg=#000000
+hi PmenuSel guibg=#808080
+hi PmenuSbar guibg=#080808
+hi PmenuThumb guifg=#66D9EF
+
+hi PreCondit guifg=#A6E22E gui=bold
+hi PreProc guifg=#A6E22E
+hi Question guifg=#66D9EF
+hi Repeat guifg=#F92672 gui=bold
+hi Search guifg=#FFFFFF guibg=#455354
+" marks column
+hi SignColumn guifg=#A6E22E guibg=#232526
+hi SpecialChar guifg=#F92672 gui=bold
+hi SpecialComment guifg=#465457 gui=bold
+hi Special guifg=#66D9EF guibg=bg gui=italic
+hi SpecialKey guifg=#888A85 gui=italic
+if has("spell")
+ hi SpellBad guisp=#FF0000 gui=undercurl
+ hi SpellCap guisp=#7070F0 gui=undercurl
+ hi SpellLocal guisp=#70F0F0 gui=undercurl
+ hi SpellRare guisp=#FFFFFF gui=undercurl
+endif
+hi Statement guifg=#F92672 gui=bold
+hi StatusLine guifg=#455354 guibg=fg
+hi StatusLineNC guifg=#808080 guibg=#080808
+hi StorageClass guifg=#FD971F gui=italic
+hi Structure guifg=#66D9EF
+hi Tag guifg=#F92672 gui=italic
+hi Title guifg=#ef5939
+hi Todo guifg=#FFFFFF guibg=bg gui=bold
+
+hi Typedef guifg=#66D9EF
+hi Type guifg=#66D9EF gui=none
+hi Underlined guifg=#808080 gui=underline
+
+hi VertSplit guifg=#808080 guibg=#080808 gui=bold
+hi VisualNOS guibg=#403D3D
+hi Visual guibg=#403D3D
+hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
+hi WildMenu guifg=#66D9EF guibg=#000000
+
+if s:molokai_original == 1
+ hi Normal guifg=#F8F8F2 guibg=#272822
+ hi Comment guifg=#75715E
+ hi CursorLine guibg=#3E3D32
+ hi CursorColumn guibg=#3E3D32
+ hi LineNr guifg=#BCBCBC guibg=#3B3A32
+ hi NonText guifg=#BCBCBC guibg=#3B3A32
+else
+ hi Normal guifg=#F8F8F2 guibg=#1B1D1E
+ hi Comment guifg=#465457
+ hi CursorLine guibg=#293739
+ hi CursorColumn guibg=#293739
+ hi LineNr guifg=#BCBCBC guibg=#232526
+ hi NonText guifg=#BCBCBC guibg=#232526
+end
+
+"
+" Support for 256-color terminal
+"
+if &t_Co > 255
+ hi Boolean ctermfg=135
+ hi Character ctermfg=144
+ hi Number ctermfg=135
+ hi String ctermfg=144
+ hi Conditional ctermfg=161 cterm=bold
+ hi Constant ctermfg=135 cterm=bold
+ hi Cursor ctermfg=16 ctermbg=253
+ hi Debug ctermfg=225 cterm=bold
+ hi Define ctermfg=81
+ hi Delimiter ctermfg=241
+
+ hi DiffAdd ctermbg=24
+ hi DiffChange ctermfg=181 ctermbg=239
+ hi DiffDelete ctermfg=162 ctermbg=53
+ hi DiffText ctermbg=102 cterm=bold
+
+ hi Directory ctermfg=118 cterm=bold
+ hi Error ctermfg=219 ctermbg=89
+ hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
+ hi Exception ctermfg=118 cterm=bold
+ hi Float ctermfg=135
+ hi FoldColumn ctermfg=67 ctermbg=16
+ hi Folded ctermfg=67 ctermbg=16
+ hi Function ctermfg=118
+ hi Identifier ctermfg=208
+ hi Ignore ctermfg=244 ctermbg=232
+ hi IncSearch ctermfg=193 ctermbg=16
+
+ hi Keyword ctermfg=161 cterm=bold
+ hi Label ctermfg=229 cterm=none
+ hi Macro ctermfg=193
+ hi SpecialKey ctermfg=81
+
+ hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
+ hi ModeMsg ctermfg=229
+ hi MoreMsg ctermfg=229
+ hi Operator ctermfg=161
+
+ " complete menu
+ hi Pmenu ctermfg=81 ctermbg=16
+ hi PmenuSel ctermbg=244
+ hi PmenuSbar ctermbg=232
+ hi PmenuThumb ctermfg=81
+
+ hi PreCondit ctermfg=118 cterm=bold
+ hi PreProc ctermfg=118
+ hi Question ctermfg=81
+ hi Repeat ctermfg=161 cterm=bold
+ hi Search ctermfg=253 ctermbg=66
+
+ " marks column
+ hi SignColumn ctermfg=118 ctermbg=235
+ hi SpecialChar ctermfg=161 cterm=bold
+ hi SpecialComment ctermfg=245 cterm=bold
+ hi Special ctermfg=81 ctermbg=232
+ hi SpecialKey ctermfg=245
+
+ hi Statement ctermfg=161 cterm=bold
+ hi StatusLine ctermfg=238 ctermbg=253
+ hi StatusLineNC ctermfg=244 ctermbg=232
+ hi StorageClass ctermfg=208
+ hi Structure ctermfg=81
+ hi Tag ctermfg=161
+ hi Title ctermfg=166
+ hi Todo ctermfg=231 ctermbg=232 cterm=bold
+
+ hi Typedef ctermfg=81
+ hi Type ctermfg=81 cterm=none
+ hi Underlined ctermfg=244 cterm=underline
+
+ hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
+ hi VisualNOS ctermbg=238
+ hi Visual ctermbg=235
+ hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
+ hi WildMenu ctermfg=81 ctermbg=16
+
+ hi Normal ctermfg=252 ctermbg=233
+ hi Comment ctermfg=59
+ hi CursorLine ctermbg=234 cterm=none
+ hi CursorColumn ctermbg=234
+ hi LineNr ctermfg=250 ctermbg=234
+ hi NonText ctermfg=250 ctermbg=234
+end
--- /dev/null
+1.1
\ No newline at end of file
--- /dev/null
+Subproject commit 4c6655a22f56269a236eead281cdd510aeff19d3
--- /dev/null
+Subproject commit b1c30e017ef5c703e36ca7a79e102507a042b5a5
--- /dev/null
+Subproject commit 1a73f607f8f5477d6942df2eb6e7245c4864f4d3
--- /dev/null
+taglist-plus.vim
+================
+
+This is a fork of the popular taglist.vim plugin.
+
+Taglist-plus provides excellent Javascript support via jsctags. See [here][1]
+for examples.
+
+This plugin can also be obtained through [vim.org][2].
+
+Installation
+------------
+
+Unzip the plugin files to your `.vim` directory.
+
+For great Javascript support, jsctags is required as well.
+
+jsctags can be obtained via [github][4]. It requires a recent version of
+node.js -- the default one provided in Maverick Meerkat won't cut it. You can
+[build it from source][6] or get it via [this PPA][5].
+
+If you're going the PPA route, you'll need to map `nodejs` to `node`. Here are
+the commands:
+<pre>
+sudo add-apt-repository ppa:richarvey/nodester
+sudo apt-get update
+sudo apt-get install nodejs
+sudo ln -s /usr/bin/nodejs /usr/local/bin/node
+</pre>
+
+Usage
+-----
+
+`:TlistToggle` brings up the taglist window. More commands can be found via
+`:help taglist-commands`.
+
+[1]:http://discontinuously.com/2011/03/vim-support-javascript-taglist-plus/
+[2]:https://github.com/int3/vim-taglist-plus
+[3]:http://www.vim.org/scripts/script.php?script_id=3504
+[4]:https://github.com/mozilla/doctorjs
+[5]:https://launchpad.net/~richarvey/+archive/nodester
+[6]:http://nodejs.org/#download
--- /dev/null
+*taglist-plus.txt* Plugin for browsing source code
+
+Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
+Modified By: Jezreel Ng (jezreel AT gmail DOT com)
+For Vim version 6.0 and above
+
+1. Overview |taglist-intro|
+2. Requirements |taglist-requirements|
+3. Installation |taglist-install|
+4. Usage |taglist-using|
+5. Options |taglist-options|
+6. Commands |taglist-commands|
+7. Global functions |taglist-functions|
+8. Extending |taglist-extend|
+9. FAQ |taglist-faq|
+10. License |taglist-license|
+11. Todo |taglist-todo|
+
+==============================================================================
+ *taglist-intro*
+1. Overview~
+
+The "Tag List" plugin is a source code browser plugin for Vim. This plugin
+allows you to efficiently browse through source code files for different
+programming languages. The "Tag List" plugin provides the following features:
+
+ * Displays the tags (functions, classes, structures, variables, etc.)
+ defined in a file in a vertically or horizontally split Vim window.
+ * In GUI Vim, optionally displays the tags in the Tags drop-down menu and
+ in the popup menu.
+ * Automatically updates the taglist window as you switch between
+ files/buffers. As you open new files, the tags defined in the new files
+ are added to the existing file list and the tags defined in all the
+ files are displayed grouped by the filename.
+ * When a tag name is selected from the taglist window, positions the
+ cursor at the definition of the tag in the source file.
+ * Automatically highlights the current tag name.
+ * Groups the tags by their type and displays them in a foldable tree.
+ * Can display the prototype and scope of a tag.
+ * Can optionally display the tag prototype instead of the tag name in the
+ taglist window.
+ * The tag list can be sorted either by name or by chronological order.
+ * Supports the following language files: Assembly, ASP, Awk, Beta, C,
+ C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp,
+ Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang,
+ SML, Sql, TCL, Verilog, Vim and Yacc.
+ * Can be easily extended to support new languages. Support for
+ existing languages can be modified easily.
+ * Provides functions to display the current tag name in the Vim status
+ line or the window title bar.
+ * The list of tags and files in the taglist can be saved and
+ restored across Vim sessions.
+ * Provides commands to get the name and prototype of the current tag.
+ * Runs in both console/terminal and GUI versions of Vim.
+ * Works with the winmanager plugin. Using the winmanager plugin, you
+ can use Vim plugins like the file explorer, buffer explorer and the
+ taglist plugin at the same time like an IDE.
+ * Can be used in both Unix and MS-Windows systems.
+
+==============================================================================
+ *taglist-requirements*
+2. Requirements~
+
+The taglist plugin requires the following:
+
+ * Vim version 6.0 and above
+ * Exuberant ctags 5.0 and above
+
+The taglist plugin will work on all the platforms where the exuberant ctags
+utility and Vim are supported (this includes MS-Windows and Unix based
+systems).
+
+The taglist plugin relies on the exuberant ctags utility to dynamically
+generate the tag listing. The exuberant ctags utility must be installed in
+your system to use this plugin. The exuberant ctags utility is shipped with
+most of the Linux distributions. You can download the exuberant ctags utility
+from
+>
+ http://ctags.sourceforge.net
+<
+The taglist plugin doesn't use or create a tags file and there is no need to
+create a tags file to use this plugin. The taglist plugin will not work with
+the GNU ctags or the Unix ctags utility.
+
+This plugin relies on the Vim "filetype" detection mechanism to determine the
+type of the current file. You have to turn on the Vim filetype detection by
+adding the following line to your .vimrc file:
+>
+ filetype on
+<
+The taglist plugin will not work if you run Vim in the restricted mode (using
+the -Z command-line argument).
+
+The taglist plugin uses the Vim system() function to invoke the exuberant
+ctags utility. If Vim is compiled without the system() function then you
+cannot use the taglist plugin. Some of the Linux distributions (Suse) compile
+Vim without the system() function for security reasons.
+
+==============================================================================
+ *taglist-install*
+3. Installation~
+
+1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the
+ $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should
+ have the following two files (the directory structure should be preserved):
+
+ plugin/taglist.vim - main taglist plugin file
+ doc/taglist.txt - documentation (help) file
+
+ Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more
+ details about installing Vim plugins.
+2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc
+ directory, start Vim and run the ":helptags ." command to process the
+ taglist help file. Without this step, you cannot jump to the taglist help
+ topics.
+3. If the exuberant ctags utility is not present in one of the directories in
+ the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to
+ point to the location of the exuberant ctags utility (not to the directory)
+ in the .vimrc file.
+4. If you are running a terminal/console version of Vim and the terminal
+ doesn't support changing the window width then set the
+ 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file.
+5. Restart Vim.
+6. You can now use the ":TlistToggle" command to open/close the taglist
+ window. You can use the ":help taglist" command to get more information
+ about using the taglist plugin.
+
+To uninstall the taglist plugin, remove the plugin/taglist.vim and
+doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory.
+
+==============================================================================
+ *taglist-using*
+4. Usage~
+
+The taglist plugin can be used in several different ways.
+
+1. You can keep the taglist window open during the entire editing session. On
+ opening the taglist window, the tags defined in all the files in the Vim
+ buffer list will be displayed in the taglist window. As you edit files, the
+ tags defined in them will be added to the taglist window. You can select a
+ tag from the taglist window and jump to it. The current tag will be
+ highlighted in the taglist window. You can close the taglist window when
+ you no longer need the window.
+2. You can configure the taglist plugin to process the tags defined in all the
+ edited files always. In this configuration, even if the taglist window is
+ closed and the taglist menu is not displayed, the taglist plugin will
+ processes the tags defined in newly edited files. You can then open the
+ taglist window only when you need to select a tag and then automatically
+ close the taglist window after selecting the tag.
+3. You can configure the taglist plugin to display only the tags defined in
+ the current file in the taglist window. By default, the taglist plugin
+ displays the tags defined in all the files in the Vim buffer list. As you
+ switch between files, the taglist window will be refreshed to display only
+ the tags defined in the current file.
+4. In GUI Vim, you can use the Tags pull-down and popup menu created by the
+ taglist plugin to display the tags defined in the current file and select a
+ tag to jump to it. You can use the menu without opening the taglist window.
+ By default, the Tags menu is disabled.
+5. You can configure the taglist plugin to display the name of the current tag
+ in the Vim window status line or in the Vim window title bar. For this to
+ work without the taglist window or menu, you need to configure the taglist
+ plugin to process the tags defined in a file always.
+6. You can save the tags defined in multiple files to a taglist session file
+ and load it when needed. You can also configure the taglist plugin to not
+ update the taglist window when editing new files. You can then manually add
+ files to the taglist window.
+
+Opening the taglist window~
+You can open the taglist window using the ":TlistOpen" or the ":TlistToggle"
+commands. The ":TlistOpen" command opens the taglist window and jumps to it.
+The ":TlistToggle" command opens or closes (toggle) the taglist window and the
+cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen'
+variable is set to 1, then the ":TlistToggle" command opens the taglist window
+and moves the cursor to the taglist window.
+
+You can map a key to invoke these commands. For example, the following command
+creates a normal mode mapping for the <F8> key to toggle the taglist window.
+>
+ nnoremap <silent> <F8> :TlistToggle<CR>
+<
+Add the above mapping to your ~/.vimrc or $HOME/_vimrc file.
+
+To automatically open the taglist window on Vim startup, set the
+'Tlist_Auto_Open' variable to 1.
+
+You can also open the taglist window on startup using the following command
+line:
+>
+ $ vim +TlistOpen
+<
+Closing the taglist window~
+You can close the taglist window from the taglist window by pressing 'q' or
+using the Vim ":q" command. You can also use any of the Vim window commands to
+close the taglist window. Invoking the ":TlistToggle" command when the taglist
+window is opened, closes the taglist window. You can also use the
+":TlistClose" command to close the taglist window.
+
+To automatically close the taglist window when a tag or file is selected, you
+can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the
+taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1.
+
+Jumping to a tag or a file~
+You can select a tag in the taglist window either by pressing the <Enter> key
+or by double clicking the tag name using the mouse. To jump to a tag on a
+single mouse click set the 'Tlist_Use_SingleClick' variable to 1.
+
+If the selected file is already opened in a window, then the cursor is moved
+to that window. If the file is not currently opened in a window then the file
+is opened in the window used by the taglist plugin to show the previously
+selected file. If there are no usable windows, then the file is opened in a
+new window. The file is not opened in special windows like the quickfix
+window, preview window and windows containing buffer with the 'buftype' option
+set.
+
+To jump to the tag in a new window, press the 'o' key. To open the file in the
+previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump
+to the tag but still keep the cursor in the taglist window (preview).
+
+To open the selected file in a tab, use the 't' key. If the file is already
+present in a tab then the cursor is moved to that tab otherwise the file is
+opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist
+window is automatically opened in the newly created tab.
+
+Instead of jumping to a tag, you can open a file by pressing the <Enter> key
+or by double clicking the file name using the mouse.
+
+In the taglist window, you can use the [[ or <Backspace> key to jump to the
+beginning of the previous file. You can use the ]] or <Tab> key to jump to the
+beginning of the next file. When you reach the first or last file, the search
+wraps around and the jumps to the next/previous file.
+
+Highlighting the current tag~
+The taglist plugin automatically highlights the name of the current tag in the
+taglist window. The Vim |CursorHold| autocmd event is used for this. If the
+current tag name is not visible in the taglist window, then the taglist window
+contents are scrolled to make that tag name visible. You can also use the
+":TlistHighlightTag" command to force the highlighting of the current tag.
+
+The tag name is highlighted if no activity is performed for |'updatetime'|
+milliseconds. The default value for this Vim option is 4 seconds. To avoid
+unexpected problems, you should not set the |'updatetime'| option to a very
+low value.
+
+To disable the automatic highlighting of the current tag name in the taglist
+window, set the 'Tlist_Auto_Highlight_Tag' variable to zero.
+
+When entering a Vim buffer/window, the taglist plugin automatically highlights
+the current tag in that buffer/window. If you like to disable the automatic
+highlighting of the current tag when entering a buffer, set the
+'Tlist_Highlight_Tag_On_BufEnter' variable to zero.
+
+Adding files to the taglist~
+When the taglist window is opened, all the files in the Vim buffer list are
+processed and the supported files are added to the taglist. When you edit a
+file in Vim, the taglist plugin automatically processes this file and adds it
+to the taglist. If you close the taglist window, the tag information in the
+taglist is retained.
+
+To process files even when the taglist window is not open, set the
+'Tlist_Process_File_Always' variable to 1.
+
+You can manually add multiple files to the taglist without opening them using
+the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands.
+
+For example, to add all the C files in the /my/project/dir directory to the
+taglist, you can use the following command:
+>
+ :TlistAddFiles /my/project/dir/*.c
+<
+Note that when adding several files with a large number of tags or a large
+number of files, it will take several seconds to several minutes for the
+taglist plugin to process all the files. You should not interrupt the taglist
+plugin by pressing <CTRL-C>.
+
+You can recursively add multiple files from a directory tree using the
+":TlistAddFilesRecursive" command:
+>
+ :TlistAddFilesRecursive /my/project/dir *.c
+<
+This command takes two arguments. The first argument specifies the directory
+from which to recursively add the files. The second optional argument
+specifies the wildcard matching pattern for selecting the files to add. The
+default pattern is * and all the files are added.
+
+Displaying tags for only one file~
+The taglist window displays the tags for all the files in the Vim buffer list
+and all the manually added files. To display the tags for only the current
+active buffer, set the 'Tlist_Show_One_File' variable to 1.
+
+Removing files from the taglist~
+You can remove a file from the taglist window, by pressing the 'd' key when the
+cursor is on one of the tags listed for the file in the taglist window. The
+removed file will no longer be displayed in the taglist window in the current
+Vim session. To again display the tags for the file, open the file in a Vim
+window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command
+to add the file to the taglist.
+
+When a buffer is removed from the Vim buffer list using the ":bdelete" or the
+":bwipeout" command, the taglist is updated to remove the stored information
+for this buffer.
+
+Updating the tags displayed for a file~
+The taglist plugin keeps track of the modification time of a file. When the
+modification time changes (the file is modified), the taglist plugin
+automatically updates the tags listed for that file. The modification time of
+a file is checked when you enter a window containing that file or when you
+load that file.
+
+You can also update or refresh the tags displayed for a file by pressing the
+"u" key in the taglist window. If an existing file is modified, after the file
+is saved, the taglist plugin automatically updates the tags displayed for the
+file.
+
+You can also use the ":TlistUpdate" command to update the tags for the current
+buffer after you made some changes to it. You should save the modified buffer
+before you update the taglist window. Otherwise the listed tags will not
+include the new tags created in the buffer.
+
+If you have deleted the tags displayed for a file in the taglist window using
+the 'd' key, you can again display the tags for that file using the
+":TlistUpdate" command.
+
+Controlling the taglist updates~
+To disable the automatic processing of new files or modified files, you can
+set the 'Tlist_Auto_Update' variable to zero. When this variable is set to
+zero, the taglist is updated only when you use the ":TlistUpdate" command or
+the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use
+this option to control which files are added to the taglist.
+
+You can use the ":TlistLock" command to lock the taglist contents. After this
+command is executed, new files are not automatically added to the taglist.
+When the taglist is locked, you can use the ":TlistUpdate" command to add the
+current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to
+add new files to the taglist. To unlock the taglist, use the ":TlistUnlock"
+command.
+
+Displaying the tag prototype~
+To display the prototype of the tag under the cursor in the taglist window,
+press the space bar. If you place the cursor on a tag name in the taglist
+window, then the tag prototype is displayed at the Vim status line after
+|'updatetime'| milliseconds. The default value for the |'updatetime'| Vim
+option is 4 seconds.
+
+You can get the name and prototype of a tag without opening the taglist window
+and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype"
+commands. These commands will work only if the current file is already present
+in the taglist. To use these commands without opening the taglist window, set
+the 'Tlist_Process_File_Always' variable to 1.
+
+You can use the ":TlistShowTag" command to display the name of the tag at or
+before the specified line number in the specified file. If the file name and
+line number are not supplied, then this command will display the name of the
+current tag. For example,
+>
+ :TlistShowTag
+ :TlistShowTag myfile.java 100
+<
+You can use the ":TlistShowPrototype" command to display the prototype of the
+tag at or before the specified line number in the specified file. If the file
+name and the line number are not supplied, then this command will display the
+prototype of the current tag. For example,
+>
+ :TlistShowPrototype
+ :TlistShowPrototype myfile.c 50
+<
+In the taglist window, when the mouse is moved over a tag name, the tag
+prototype is displayed in a balloon. This works only in GUI versions where
+balloon evaluation is supported.
+
+Taglist window contents~
+The taglist window contains the tags defined in various files in the taglist
+grouped by the filename and by the tag type (variable, function, class, etc.).
+For tags with scope information (like class members, structures inside
+structures, etc.), the scope information is displayed in square brackets "[]"
+after the tag name.
+
+The contents of the taglist buffer/window are managed by the taglist plugin.
+The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim
+|'modifiable'| option is turned off for the taglist buffer. You should not
+manually edit the taglist buffer, by setting the |'modifiable'| flag. If you
+manually edit the taglist buffer contents, then the taglist plugin will be out
+of sync with the taglist buffer contents and the plugin will no longer work
+correctly. To redisplay the taglist buffer contents again, close the taglist
+window and reopen it.
+
+Opening and closing the tag and file tree~
+In the taglist window, the tag names are displayed as a foldable tree using
+the Vim folding support. You can collapse the tree using the '-' key or using
+the Vim |zc| fold command. You can open the tree using the '+' key or using
+the Vim |zo| fold command. You can open all the folds using the '*' key or
+using the Vim |zR| fold command. You can also use the mouse to open/close the
+folds. You can close all the folds using the '=' key. You should not manually
+create or delete the folds in the taglist window.
+
+To automatically close the fold for the inactive files/buffers and open only
+the fold for the current buffer in the taglist window, set the
+'Tlist_File_Fold_Auto_Close' variable to 1.
+
+Sorting the tags for a file~
+The tags displayed in the taglist window can be sorted either by their name or
+by their chronological order. The default sorting method is by the order in
+which the tags appear in a file. You can change the default sort method by
+setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can
+sort the tags by their name by pressing the "s" key in the taglist window. You
+can again sort the tags by their chronological order using the "s" key. Each
+file in the taglist window can be sorted using different order.
+
+Zooming in and out of the taglist window~
+You can press the 'x' key in the taglist window to maximize the taglist
+window width/height. The window will be maximized to the maximum possible
+width/height without closing the other existing windows. You can again press
+'x' to restore the taglist window to the default width/height.
+
+ *taglist-session*
+Taglist Session~
+A taglist session refers to the group of files and their tags stored in the
+taglist in a Vim session.
+
+You can save and restore a taglist session (and all the displayed tags) using
+the ":TlistSessionSave" and ":TlistSessionLoad" commands.
+
+To save the information about the tags and files in the taglist to a file, use
+the ":TlistSessionSave" command and specify the filename:
+>
+ :TlistSessionSave <file name>
+<
+To load a saved taglist session, use the ":TlistSessionLoad" command: >
+
+ :TlistSessionLoad <file name>
+<
+When you load a taglist session file, the tags stored in the file will be
+added to the tags already stored in the taglist.
+
+The taglist session feature can be used to save the tags for large files or a
+group of frequently used files (like a project). By using the taglist session
+file, you can minimize the amount to time it takes to load/refresh the taglist
+for multiple files.
+
+You can create more than one taglist session file for multiple groups of
+files.
+
+Displaying the tag name in the Vim status line or the window title bar~
+You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist
+plugin to display the current tag name in the Vim status line or the window
+title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line()
+function to display the current tag prototype in the Vim status line or the
+window title bar.
+
+For example, the following command can be used to display the current tag name
+in the status line:
+>
+ :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
+<
+The following command can be used to display the current tag name in the
+window title bar:
+>
+ :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%)
+<
+Note that the current tag name can be displayed only after the file is
+processed by the taglist plugin. For this, you have to either set the
+'Tlist_Process_File_Always' variable to 1 or open the taglist window or use
+the taglist menu. For more information about configuring the Vim status line,
+refer to the documentation for the Vim |'statusline'| option.
+
+Changing the taglist window highlighting~
+The following Vim highlight groups are defined and used to highlight the
+various entities in the taglist window:
+
+ TagListTagName - Used for tag names
+ TagListTagScope - Used for tag scope
+ TagListTitle - Used for tag titles
+ TagListComment - Used for comments
+ TagListFileName - Used for filenames
+
+By default, these highlight groups are linked to the standard Vim highlight
+groups. If you want to change the colors used for these highlight groups,
+prefix the highlight group name with 'My' and define it in your .vimrc or
+.gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle,
+MyTagListComment and MyTagListFileName. For example, to change the colors
+used for tag names, you can use the following command:
+>
+ :highlight MyTagListTagName guifg=blue ctermfg=blue
+<
+Controlling the taglist window~
+To use a horizontally split taglist window, instead of a vertically split
+window, set the 'Tlist_Use_Horiz_Window' variable to 1.
+
+To use a vertically split taglist window on the rightmost side of the Vim
+window, set the 'Tlist_Use_Right_Window' variable to 1.
+
+You can specify the width of the vertically split taglist window, by setting
+the 'Tlist_WinWidth' variable. You can specify the height of the horizontally
+split taglist window, by setting the 'Tlist_WinHeight' variable.
+
+When opening a vertically split taglist window, the Vim window width is
+increased to accommodate the new taglist window. When the taglist window is
+closed, the Vim window is reduced. To disable this, set the
+'Tlist_Inc_Winwidth' variable to zero.
+
+To reduce the number of empty lines in the taglist window, set the
+'Tlist_Compact_Format' variable to 1.
+
+To not display the Vim fold column in the taglist window, set the
+'Tlist_Enable_Fold_Column' variable to zero.
+
+To display the tag prototypes instead of the tag names in the taglist window,
+set the 'Tlist_Display_Prototype' variable to 1.
+
+To not display the scope of the tags next to the tag names, set the
+'Tlist_Display_Tag_Scope' variable to zero.
+
+ *taglist-keys*
+Taglist window key list~
+The following table lists the description of the keys that can be used
+in the taglist window.
+
+ Key Description~
+
+ <CR> Jump to the location where the tag under cursor is
+ defined.
+ o Jump to the location where the tag under cursor is
+ defined in a new window.
+ P Jump to the tag in the previous (Ctrl-W_p) window.
+ p Display the tag definition in the file window and
+ keep the cursor in the taglist window itself.
+ t Jump to the tag in a new tab. If the file is already
+ opened in a tab, move to that tab.
+ Ctrl-t Jump to the tag in a new tab.
+ <Space> Display the prototype of the tag under the cursor.
+ For file names, display the full path to the file,
+ file type and the number of tags. For tag types, display the
+ tag type and the number of tags.
+ u Update the tags listed in the taglist window
+ s Change the sort order of the tags (by name or by order)
+ d Remove the tags for the file under the cursor
+ x Zoom-in or Zoom-out the taglist window
+ + Open a fold
+ - Close a fold
+ * Open all folds
+ = Close all folds
+ [[ Jump to the beginning of the previous file
+ <Backspace> Jump to the beginning of the previous file
+ ]] Jump to the beginning of the next file
+ <Tab> Jump to the beginning of the next file
+ q Close the taglist window
+ <F1> Display help
+
+The above keys will work in both the normal mode and the insert mode.
+
+ *taglist-menu*
+Taglist menu~
+When using GUI Vim, the taglist plugin can display the tags defined in the
+current file in the drop-down menu and the popup menu. By default, this
+feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu'
+variable to 1.
+
+You can jump to a tag by selecting the tag name from the menu. You can use the
+taglist menu independent of the taglist window i.e. you don't need to open the
+taglist window to get the taglist menu.
+
+When you switch between files/buffers, the taglist menu is automatically
+updated to display the tags defined in the current file/buffer.
+
+The tags are grouped by their type (variables, functions, classes, methods,
+etc.) and displayed as a separate sub-menu for each type. If all the tags
+defined in a file are of the same type (e.g. functions), then the sub-menu is
+not used.
+
+If the number of items in a tag type submenu exceeds the value specified by
+the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into
+multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25.
+The first and last tag names in the submenu are used to form the submenu name.
+The menu items are prefixed by alpha-numeric characters for easy selection by
+keyboard.
+
+If the popup menu support is enabled (the |'mousemodel'| option contains
+"popup"), then the tags menu is added to the popup menu. You can access
+the popup menu by right clicking on the GUI window.
+
+You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry.
+You can sort the tags listed in the menu either by name or by order by
+selecting the 'Tags->Sort menu by->Name/Order' menu entry.
+
+You can tear-off the Tags menu and keep it on the side of the Vim window
+for quickly locating the tags.
+
+Using the taglist plugin with the winmanager plugin~
+You can use the taglist plugin with the winmanager plugin. This will allow you
+to use the file explorer, buffer explorer and the taglist plugin at the same
+time in different windows. To use the taglist plugin with the winmanager
+plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example,
+to use the file explorer plugin and the taglist plugin at the same time, use
+the following setting: >
+
+ let winManagerWindowLayout = 'FileExplorer|TagList'
+<
+Getting help~
+If you have installed the taglist help file (this file), then you can use the
+Vim ":help taglist-<keyword>" command to get help on the various taglist
+topics.
+
+You can press the <F1> key in the taglist window to display the help
+information about using the taglist window. If you again press the <F1> key,
+the help information is removed from the taglist window.
+
+ *taglist-debug*
+Debugging the taglist plugin~
+You can use the ":TlistDebug" command to enable logging of the debug messages
+from the taglist plugin. To display the logged debug messages, you can use the
+":TlistMessages" command. To disable the logging of the debug messages, use
+the ":TlistUndebug" command.
+
+You can specify a file name to the ":TlistDebug" command to log the debug
+messages to a file. Otherwise, the debug messages are stored in a script-local
+variable. In the later case, to minimize memory usage, only the last 3000
+characters from the debug messages are stored.
+
+==============================================================================
+ *taglist-options*
+5. Options~
+
+A number of Vim variables control the behavior of the taglist plugin. These
+variables are initialized to a default value. By changing these variables you
+can change the behavior of the taglist plugin. You need to change these
+settings only if you want to change the behavior of the taglist plugin. You
+should use the |:let| command in your .vimrc file to change the setting of any
+of these variables.
+
+The configurable taglist variables are listed below. For a detailed
+description of these variables refer to the text below this table.
+
+|'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the
+ taglist.
+|'Tlist_Auto_Open'| Open the taglist window when Vim starts.
+|'Tlist_Auto_Update'| Automatically update the taglist to include
+ newly edited files.
+|'Tlist_Close_On_Select'| Close the taglist window when a file or tag is
+ selected.
+|'Tlist_Compact_Format'| Remove extra information and blank lines from
+ the taglist window.
+|'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility.
+|'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist
+ window.
+|'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name.
+|'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist
+ window.
+|'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window.
+|'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers.
+|'Tlist_GainFocus_On_ToggleOpen'|
+ Jump to taglist window on open.
+|'Tlist_Highlight_Tag_On_BufEnter'|
+ On entering a buffer, automatically highlight
+ the current tag.
+|'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate
+ the taglist window.
+|'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu.
+|'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry.
+|'Tlist_Process_File_Always'| Process files even when the taglist window is
+ closed.
+|'Tlist_Show_Menu'| Display the tags menu.
+|'Tlist_Show_One_File'| Show tags for the current buffer only.
+|'Tlist_Sort_Type'| Sort method used for arranging the tags.
+|'Tlist_Use_Horiz_Window'| Use a horizontally split window for the
+ taglist window.
+|'Tlist_Use_Right_Window'| Place the taglist window on the right side.
+|'Tlist_Use_SingleClick'| Single click on a tag jumps to it.
+|'Tlist_WinHeight'| Horizontally split taglist window height.
+|'Tlist_WinWidth'| Vertically split taglist window width.
+|'Tlist_javascript_Hide_Extras'| Hide extra tag data produced by jsctags.
+
+ *'Tlist_Auto_Highlight_Tag'*
+Tlist_Auto_Highlight_Tag~
+The taglist plugin will automatically highlight the current tag in the taglist
+window. If you want to disable this, then you can set the
+'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current
+tag highlighting is disabled, the tags for a new file will still be added to
+the taglist window.
+>
+ let Tlist_Auto_Highlight_Tag = 0
+<
+With the above variable set to 1, you can use the ":TlistHighlightTag" command
+to highlight the current tag.
+
+ *'Tlist_Auto_Open'*
+Tlist_Auto_Open~
+To automatically open the taglist window, when you start Vim, you can set the
+'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and
+the taglist window will not be opened automatically on Vim startup.
+>
+ let Tlist_Auto_Open = 1
+<
+The taglist window is opened only when a supported type of file is opened on
+Vim startup. For example, if you open text files, then the taglist window will
+not be opened.
+
+ *'Tlist_Auto_Update'*
+Tlist_Auto_Update~
+When a new file is edited, the tags defined in the file are automatically
+processed and added to the taglist. To stop adding new files to the taglist,
+set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set
+to 1.
+>
+ let Tlist_Auto_Update = 0
+<
+With the above variable set to 1, you can use the ":TlistUpdate" command to
+add the tags defined in the current file to the taglist.
+
+ *'Tlist_Close_On_Select'*
+Tlist_Close_On_Select~
+If you want to close the taglist window when a file or tag is selected, then
+set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is
+set zero and when you select a tag or file from the taglist window, the window
+is not closed.
+>
+ let Tlist_Close_On_Select = 1
+<
+ *'Tlist_Compact_Format'*
+Tlist_Compact_Format~
+By default, empty lines are used to separate different tag types displayed for
+a file and the tags displayed for different files in the taglist window. If
+you want to display as many tags as possible in the taglist window, you can
+set the 'Tlist_Compact_Format' variable to 1 to get a compact display.
+>
+ let Tlist_Compact_Format = 1
+<
+ *'Tlist_Ctags_Cmd'*
+Tlist_Ctags_Cmd~
+The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant
+ctags utility. If exuberant ctags is present in any one of the directories in
+the PATH environment variable, then there is no need to set this variable.
+
+The exuberant ctags tool can be installed under different names. When the
+taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it
+checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in
+the PATH environment variable. If any one of the named executable is found,
+then the Tlist_Ctags_Cmd variable is set to that name.
+
+If exuberant ctags is not present in one of the directories specified in the
+PATH environment variable, then set this variable to point to the location of
+the ctags utility in your system. Note that this variable should point to the
+fully qualified exuberant ctags location and NOT to the directory in which
+exuberant ctags is installed. If the exuberant ctags tool is not found in
+either PATH or in the specified location, then the taglist plugin will not be
+loaded. Examples:
+>
+ let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe'
+ let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
+<
+ *'Tlist_Display_Prototype'*
+Tlist_Display_Prototype~
+By default, only the tag name will be displayed in the taglist window. If you
+like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype'
+variable to 1. By default, this variable is set to zero and only tag names
+will be displayed.
+>
+ let Tlist_Display_Prototype = 1
+<
+ *'Tlist_Display_Tag_Scope'*
+Tlist_Display_Tag_Scope~
+By default, the scope of a tag (like a C++ class) will be displayed in
+square brackets next to the tag name. If you don't want the tag scopes
+to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default,
+this variable is set to 1 and the tag scopes will be displayed.
+>
+ let Tlist_Display_Tag_Scope = 0
+<
+ *'Tlist_Enable_Fold_Column'*
+Tlist_Enable_Fold_Column~
+By default, the Vim fold column is enabled and displayed in the taglist
+window. If you wish to disable this (for example, when you are working with a
+narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column'
+variable to zero.
+>
+ let Tlist_Enable_Fold_Column = 1
+<
+ *'Tlist_Exit_OnlyWindow'*
+Tlist_Exit_OnlyWindow~
+If you want to exit Vim if only the taglist window is currently opened, then
+set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is
+set to zero and the Vim instance will not be closed if only the taglist window
+is present.
+>
+ let Tlist_Exit_OnlyWindow = 1
+<
+ *'Tlist_File_Fold_Auto_Close'*
+Tlist_File_Fold_Auto_Close~
+By default, the tags tree displayed in the taglist window for all the files is
+opened. You can close/fold the tags tree for the files manually. To
+automatically close the tags tree for inactive files, you can set the
+'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1,
+the tags tree for the current buffer is automatically opened and for all the
+other buffers is closed.
+>
+ let Tlist_File_Fold_Auto_Close = 1
+<
+ *'Tlist_GainFocus_On_ToggleOpen'*
+Tlist_GainFocus_On_ToggleOpen~
+When the taglist window is opened using the ':TlistToggle' command, this
+option controls whether the cursor is moved to the taglist window or remains
+in the current window. By default, this option is set to 0 and the cursor
+remains in the current window. When this variable is set to 1, the cursor
+moves to the taglist window after opening the taglist window.
+>
+ let Tlist_GainFocus_On_ToggleOpen = 1
+<
+ *'Tlist_Highlight_Tag_On_BufEnter'*
+Tlist_Highlight_Tag_On_BufEnter~
+When you enter a Vim buffer/window, the current tag in that buffer/window is
+automatically highlighted in the taglist window. If the current tag name is
+not visible in the taglist window, then the taglist window contents are
+scrolled to make that tag name visible. If you like to disable the automatic
+highlighting of the current tag when entering a buffer, you can set the
+'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for
+this variable is 1.
+>
+ let Tlist_Highlight_Tag_On_BufEnter = 0
+<
+ *'Tlist_Inc_Winwidth'*
+Tlist_Inc_Winwidth~
+By default, when the width of the window is less than 100 and a new taglist
+window is opened vertically, then the window width is increased by the value
+set in the 'Tlist_WinWidth' variable to accommodate the new window. The value
+of this variable is used only if you are using a vertically split taglist
+window.
+
+If your terminal doesn't support changing the window width from Vim (older
+version of xterm running in a Unix system) or if you see any weird problems in
+the screen due to the change in the window width or if you prefer not to
+adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero.
+CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command
+window then you must set this variable to zero, otherwise the system may hang
+due to a Vim limitation (explained in :help win32-problems)
+>
+ let Tlist_Inc_Winwidth = 0
+<
+ *'Tlist_Max_Submenu_Items'*
+Tlist_Max_Submenu_Items~
+If a file contains too many tags of a particular type (function, variable,
+class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items'
+variable, then the menu for that tag type will be split into multiple
+sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is
+25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable:
+>
+ let Tlist_Max_Submenu_Items = 20
+<
+The name of the submenu is formed using the names of the first and the last
+tag entries in that submenu.
+
+ *'Tlist_Max_Tag_Length'*
+Tlist_Max_Tag_Length~
+Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be
+used to form the tag type submenu name. The default value for this variable is
+10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or
+less characters:
+>
+ let Tlist_Max_Tag_Length = 10
+<
+ *'Tlist_Process_File_Always'*
+Tlist_Process_File_Always~
+By default, the taglist plugin will generate and process the tags defined in
+the newly opened files only when the taglist window is opened or when the
+taglist menu is enabled. When the taglist window is closed, the taglist plugin
+will stop processing the tags for newly opened files.
+
+You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list
+of tags for new files even when the taglist window is closed and the taglist
+menu is disabled.
+>
+ let Tlist_Process_File_Always = 1
+<
+To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the
+taglist window and the taglist menu, you should set this variable to 1.
+
+ *'Tlist_Show_Menu'*
+Tlist_Show_Menu~
+When using GUI Vim, you can display the tags defined in the current file in a
+menu named "Tags". By default, this feature is turned off. To turn on this
+feature, set the 'Tlist_Show_Menu' variable to 1:
+>
+ let Tlist_Show_Menu = 1
+<
+ *'Tlist_Show_One_File'*
+Tlist_Show_One_File~
+By default, the taglist plugin will display the tags defined in all the loaded
+buffers in the taglist window. If you prefer to display the tags defined only
+in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When
+this variable is set to 1, as you switch between buffers, the taglist window
+will be refreshed to display the tags for the current buffer and the tags for
+the previous buffer will be removed.
+>
+ let Tlist_Show_One_File = 1
+<
+ *'Tlist_Sort_Type'*
+Tlist_Sort_Type~
+The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the
+taglist window. The tags can be sorted either alphabetically by their name or
+by the order of their appearance in the file (chronological order). By
+default, the tag names will be listed by the order in which they are defined
+in the file. You can change the sort type (from name to order or from order to
+name) by pressing the "s" key in the taglist window. You can also change the
+default sort order by setting 'Tlist_Sort_Type' to "name" or "order":
+>
+ let Tlist_Sort_Type = "name"
+<
+ *'Tlist_Use_Horiz_Window'*
+Tlist_Use_Horiz_Window~
+Be default, the tag names are displayed in a vertically split window. If you
+prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window'
+variable to 1. If you are running MS-Windows version of Vim in a MS-DOS
+command window, then you should use a horizontally split window instead of a
+vertically split window. Also, if you are using an older version of xterm in a
+Unix system that doesn't support changing the xterm window width, you should
+use a horizontally split window.
+>
+ let Tlist_Use_Horiz_Window = 1
+<
+ *'Tlist_Use_Right_Window'*
+Tlist_Use_Right_Window~
+By default, the vertically split taglist window will appear on the left hand
+side. If you prefer to open the window on the right hand side, you can set the
+'Tlist_Use_Right_Window' variable to 1:
+>
+ let Tlist_Use_Right_Window = 1
+<
+ *'Tlist_Use_SingleClick'*
+Tlist_Use_SingleClick~
+By default, when you double click on the tag name using the left mouse
+button, the cursor will be positioned at the definition of the tag. You
+can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when
+you single click on the tag name using the mouse. By default this variable
+is set to zero.
+>
+ let Tlist_Use_SingleClick = 1
+<
+Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize
+the taglist window using the mouse, then Vim will crash. This problem is fixed
+in Vim 6.3 and above. In the meantime, instead of resizing the taglist window
+using the mouse, you can use normal Vim window resizing commands to resize the
+taglist window.
+
+ *'Tlist_WinHeight'*
+Tlist_WinHeight~
+The default height of the horizontally split taglist window is 10. This can be
+changed by modifying the 'Tlist_WinHeight' variable:
+>
+ let Tlist_WinHeight = 20
+<
+The |'winfixheight'| option is set for the taglist window, to maintain the
+height of the taglist window, when new Vim windows are opened and existing
+windows are closed.
+
+ *'Tlist_WinWidth'*
+Tlist_WinWidth~
+The default width of the vertically split taglist window is 30. This can be
+changed by modifying the 'Tlist_WinWidth' variable:
+>
+ let Tlist_WinWidth = 20
+<
+Setting Tlist_WinWidth to 'auto' causes the taglist window to resize
+automatically to fit the contents.
+
+Note that the value of the |'winwidth'| option setting determines the minimum
+width of the current window. If you set the 'Tlist_WinWidth' variable to a
+value less than that of the |'winwidth'| option setting, then Vim will use the
+value of the |'winwidth'| option.
+
+When new Vim windows are opened and existing windows are closed, the taglist
+plugin will try to maintain the width of the taglist window to the size
+specified by the 'Tlist_WinWidth' variable.
+
+ *'Tlist_javascript_Hide_Extras'*
+Tlist_javascript_Hide_Extras~
+
+To hide the type inference data generated by jsctags, modify this variable:
+
+ let Tlist_javascript_Hide_Extras = ['type']
+
+Note that 'javascript' here is not capitalized!
+
+==============================================================================
+ *taglist-commands*
+6. Commands~
+
+The taglist plugin provides the following ex-mode commands:
+
+|:TlistAddFiles| Add multiple files to the taglist.
+|:TlistAddFilesRecursive|
+ Add files recursively to the taglist.
+|:TlistClose| Close the taglist window.
+|:TlistDebug| Start logging of taglist debug messages.
+|:TlistLock| Stop adding new files to the taglist.
+|:TlistMessages| Display the logged taglist plugin debug messages.
+|:TlistOpen| Open and jump to the taglist window.
+|:TlistSessionSave| Save the information about files and tags in the
+ taglist to a session file.
+|:TlistSessionLoad| Load the information about files and tags stored
+ in a session file to taglist.
+|:TlistShowPrototype| Display the prototype of the tag at or before the
+ specified line number.
+|:TlistShowTag| Display the name of the tag defined at or before the
+ specified line number.
+|:TlistHighlightTag| Highlight the current tag in the taglist window.
+|:TlistToggle| Open or close (toggle) the taglist window.
+|:TlistUndebug| Stop logging of taglist debug messages.
+|:TlistUnlock| Start adding new files to the taglist.
+|:TlistUpdate| Update the tags for the current buffer.
+
+ *:TlistAddFiles*
+:TlistAddFiles {file(s)} [file(s) ...]
+ Add one or more specified files to the taglist. You can
+ specify multiple filenames using wildcards. To specify a
+ file name with space character, you should escape the space
+ character with a backslash.
+ Examples:
+>
+ :TlistAddFiles *.c *.cpp
+ :TlistAddFiles file1.html file2.html
+<
+ If you specify a large number of files, then it will take some
+ time for the taglist plugin to process all of them. The
+ specified files will not be edited in a Vim window and will
+ not be added to the Vim buffer list.
+
+ *:TlistAddFilesRecursive*
+:TlistAddFilesRecursive {directory} [ {pattern} ]
+ Add files matching {pattern} recursively from the specified
+ {directory} to the taglist. If {pattern} is not specified,
+ then '*' is assumed. To specify the current directory, use "."
+ for {directory}. To specify a directory name with space
+ character, you should escape the space character with a
+ backslash.
+ Examples:
+>
+ :TlistAddFilesRecursive myproject *.java
+ :TlistAddFilesRecursive smallproject
+<
+ If large number of files are present in the specified
+ directory tree, then it will take some time for the taglist
+ plugin to process all of them.
+
+ *:TlistClose*
+:TlistClose Close the taglist window. This command can be used from any
+ one of the Vim windows.
+
+ *:TlistDebug*
+:TlistDebug [filename]
+ Start logging of debug messages from the taglist plugin.
+ If {filename} is specified, then the debug messages are stored
+ in the specified file. Otherwise, the debug messages are
+ stored in a script local variable. If the file {filename} is
+ already present, then it is overwritten.
+
+ *:TlistLock*
+:TlistLock
+ Lock the taglist and don't process new files. After this
+ command is executed, newly edited files will not be added to
+ the taglist.
+
+ *:TlistMessages*
+:TlistMessages
+ Display the logged debug messages from the taglist plugin
+ in a window. This command works only when logging to a
+ script-local variable.
+
+ *:TlistOpen*
+:TlistOpen Open and jump to the taglist window. Creates the taglist
+ window, if the window is not opened currently. After executing
+ this command, the cursor is moved to the taglist window. When
+ the taglist window is opened for the first time, all the files
+ in the buffer list are processed and the tags defined in them
+ are displayed in the taglist window.
+
+ *:TlistSessionSave*
+:TlistSessionSave {filename}
+ Saves the information about files and tags in the taglist to
+ the specified file. This command can be used to save and
+ restore the taglist contents across Vim sessions.
+
+ *:TlistSessionLoad*
+:TlistSessionLoad {filename}
+ Load the information about files and tags stored in the
+ specified session file to the taglist.
+
+ *:TlistShowPrototype*
+:TlistShowPrototype [filename] [linenumber]
+ Display the prototype of the tag at or before the specified
+ line number. If the file name and the line number are not
+ specified, then the current file name and line number are
+ used. A tag spans multiple lines starting from the line where
+ it is defined to the line before the next tag. This command
+ displays the prototype for the tag for any line number in this
+ range.
+
+ *:TlistShowTag*
+:TlistShowTag [filename] [linenumber]
+ Display the name of the tag defined at or before the specified
+ line number. If the file name and the line number are not
+ specified, then the current file name and line number are
+ used. A tag spans multiple lines starting from the line where
+ it is defined to the line before the next tag. This command
+ displays the tag name for any line number in this range.
+
+ *:TlistHighlightTag*
+:TlistHighlightTag
+ Highlight the current tag in the taglist window. By default,
+ the taglist plugin periodically updates the taglist window to
+ highlight the current tag. This command can be used to force
+ the taglist plugin to highlight the current tag.
+
+ *:TlistToggle*
+:TlistToggle Open or close (toggle) the taglist window. Opens the taglist
+ window, if the window is not opened currently. Closes the
+ taglist window, if the taglist window is already opened. When
+ the taglist window is opened for the first time, all the files
+ in the buffer list are processed and the tags are displayed in
+ the taglist window. After executing this command, the cursor
+ is not moved from the current window to the taglist window.
+
+ *:TlistUndebug*
+:TlistUndebug
+ Stop logging of debug messages from the taglist plugin.
+
+ *:TlistUnlock*
+:TlistUnlock
+ Unlock the taglist and start processing newly edited files.
+
+ *:TlistUpdate*
+:TlistUpdate Update the tags information for the current buffer. This
+ command can be used to re-process the current file/buffer and
+ get the tags information. As the taglist plugin uses the file
+ saved in the disk (instead of the file displayed in a Vim
+ buffer), you should save a modified buffer before you update
+ the taglist. Otherwise the listed tags will not include the
+ new tags created in the buffer. You can use this command even
+ when the taglist window is not opened.
+
+==============================================================================
+ *taglist-functions*
+7. Global functions~
+
+The taglist plugin provides several global functions that can be used from
+other Vim plugins to interact with the taglist plugin. These functions are
+described below.
+
+|Tlist_Update_File_Tags()| Update the tags for the specified file
+|Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or
+ before the specified line number in the
+ specified file.
+|Tlist_Get_Tagname_By_Line()| Return the name of the tag at or
+ before the specified line number in
+ the specified file.
+|Tlist_Set_App()| Set the name of the application
+ controlling the taglist window.
+
+ *Tlist_Update_File_Tags()*
+Tlist_Update_File_Tags({filename}, {filetype})
+ Update the tags for the file {filename}. The second argument
+ specifies the Vim filetype for the file. If the taglist plugin
+ has not processed the file previously, then the exuberant
+ ctags tool is invoked to generate the tags for the file.
+
+ *Tlist_Get_Tag_Prototype_By_Line()*
+Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}])
+ Return the prototype of the tag at or before the specified
+ line number in the specified file. If the filename and line
+ number are not specified, then the current buffer name and the
+ current line number are used.
+
+ *Tlist_Get_Tagname_By_Line()*
+Tlist_Get_Tagname_By_Line([{filename}, {linenumber}])
+ Return the name of the tag at or before the specified line
+ number in the specified file. If the filename and line number
+ are not specified, then the current buffer name and the
+ current line number are used.
+
+ *Tlist_Set_App()*
+Tlist_Set_App({appname})
+ Set the name of the plugin that controls the taglist plugin
+ window and buffer. This can be used to integrate the taglist
+ plugin with other Vim plugins.
+
+ For example, the winmanager plugin and the Cream package use
+ this function and specify the appname as "winmanager" and
+ "cream" respectively.
+
+ By default, the taglist plugin is a stand-alone plugin and
+ controls the taglist window and buffer. If the taglist window
+ is controlled by an external plugin, then the appname should
+ be set appropriately.
+
+==============================================================================
+ *taglist-extend*
+8. Extending~
+
+The taglist plugin supports all the languages supported by the exuberant ctags
+tool, which includes the following languages: Assembly, ASP, Awk, Beta, C,
+C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua,
+Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql,
+TCL, Verilog, Vim and Yacc.
+
+You can extend the taglist plugin to add support for new languages and also
+modify the support for the above listed languages.
+
+You should NOT make modifications to the taglist plugin script file to add
+support for new languages. You will lose these changes when you upgrade to the
+next version of the taglist plugin. Instead you should follow the below
+described instructions to extend the taglist plugin.
+
+You can extend the taglist plugin by setting variables in the .vimrc or _vimrc
+file. The name of these variables depends on the language name and is
+described below.
+
+Modifying support for an existing language~
+To modify the support for an already supported language, you have to set the
+tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx
+with the Vim filetype name for the language file. For example, to modify the
+support for the perl language files, you have to set the tlist_perl_settings
+variable. To modify the support for java files, you have to set the
+tlist_java_settings variable.
+
+To determine the filetype name used by Vim for a file, use the following
+command in the buffer containing the file:
+
+ :set filetype
+
+The above command will display the Vim filetype for the current buffer.
+
+The format of the value set in the tlist_xxx_settings variable is
+
+ <language_name>;flag1:name1;flag2:name2;flag3:name3
+
+The different fields in the value are separated by the ';' character.
+
+The first field 'language_name' is the name used by exuberant ctags to refer
+to this language file. This name can be different from the file type name used
+by Vim. For example, for C++, the language name used by ctags is 'c++' but the
+filetype name used by Vim is 'cpp'. To get the list of language names
+supported by exuberant ctags, use the following command:
+
+ $ ctags --list-maps=all
+
+The remaining fields follow the format "flag:name". The sub-field 'flag' is
+the language specific flag used by exuberant ctags to generate the
+corresponding tags. For example, for the C language, to list only the
+functions, the 'f' flag is used. To get the list of flags supported by
+exuberant ctags for the various languages use the following command:
+
+ $ ctags --list-kinds=all
+
+The sub-field 'name' specifies the title text to use for displaying the tags
+of a particular type. For example, 'name' can be set to 'functions'. This
+field can be set to any text string name.
+
+For example, to list only the classes and functions defined in a C++ language
+file, add the following line to your .vimrc file:
+
+ let tlist_cpp_settings = 'c++;c:class;f:function'
+
+In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name
+used by the exuberant ctags tool. 'c' and 'f' are the flags passed to
+exuberant ctags to list C++ classes and functions and 'class' is the title
+used for the class tags and 'function' is the title used for the function tags
+in the taglist window.
+
+For example, to display only functions defined in a C file and to use "My
+Functions" as the title for the function tags, use
+
+ let tlist_c_settings = 'c;f:My Functions'
+
+When you set the tlist_xxx_settings variable, you will override the default
+setting used by the taglist plugin for the 'xxx' language. You cannot add to
+the default options used by the taglist plugin for a particular file type. To
+add to the options used by the taglist plugin for a language, copy the option
+values from the taglist plugin file to your .vimrc file and modify it.
+
+Adding support for a new language~
+If you want to add support for a new language to the taglist plugin, you need
+to first extend the exuberant ctags tool. For more information about extending
+exuberant ctags, visit the following page:
+
+ http://ctags.sourceforge.net/EXTENDING.html
+
+To add support for a new language, set the tlist_xxx_settings variable in the
+~/.vimrc file appropriately as described above. Replace 'xxx' in the variable
+name with the Vim filetype name for the new language.
+
+For example, to extend the taglist plugin to support the latex language, you
+can use the following line (assuming, you have already extended exuberant
+ctags to support the latex language):
+
+ let tlist_tex_settings='latex;b:bibitem;c:command;l:label'
+
+With the above line, when you edit files of filetype "tex" in Vim, the taglist
+plugin will invoke the exuberant ctags tool passing the "latex" filetype and
+the flags b, c and l to generate the tags. The text heading 'bibitem',
+'command' and 'label' will be used in the taglist window for the tags which
+are generated for the flags b, c and l respectively.
+
+==============================================================================
+ *taglist-faq*
+9. Frequently Asked Questions~
+
+Q. The taglist plugin doesn't work. The taglist window is empty and the tags
+ defined in a file are not displayed.
+A. Are you using Vim version 6.0 and above? The taglist plugin relies on the
+ features supported by Vim version 6.0 and above. You can use the following
+ command to get the Vim version:
+>
+ $ vim --version
+<
+ Are you using exuberant ctags version 5.0 and above? The taglist plugin
+ relies on the features supported by exuberant ctags and will not work with
+ GNU ctags or the Unix ctags utility. You can use the following command to
+ determine whether the ctags installed in your system is exuberant ctags:
+>
+ $ ctags --version
+<
+ Is exuberant ctags present in one of the directories in your PATH? If not,
+ you need to set the Tlist_Ctags_Cmd variable to point to the location of
+ exuberant ctags. Use the following Vim command to verify that this is setup
+ correctly:
+>
+ :echo system(Tlist_Ctags_Cmd . ' --version')
+<
+ The above command should display the version information for exuberant
+ ctags.
+
+ Did you turn on the Vim filetype detection? The taglist plugin relies on
+ the filetype detected by Vim and passes the filetype to the exuberant ctags
+ utility to parse the tags. Check the output of the following Vim command:
+>
+ :filetype
+<
+ The output of the above command should contain "filetype detection:ON".
+ To turn on the filetype detection, add the following line to the .vimrc or
+ _vimrc file:
+>
+ filetype on
+<
+ Is your version of Vim compiled with the support for the system() function?
+ The following Vim command should display 1:
+>
+ :echo exists('*system')
+<
+ In some Linux distributions (particularly Suse Linux), the default Vim
+ installation is built without the support for the system() function. The
+ taglist plugin uses the system() function to invoke the exuberant ctags
+ utility. You need to rebuild Vim after enabling the support for the
+ system() function. If you use the default build options, the system()
+ function will be supported.
+
+ Do you have the |'shellslash'| option set? You can try disabling the
+ |'shellslash'| option. When the taglist plugin invokes the exuberant ctags
+ utility with the path to the file, if the incorrect slashes are used, then
+ you will see errors.
+
+ Check the shell related Vim options values using the following command:
+>
+ :set shell? shellcmdflag? shellpipe?
+ :set shellquote? shellredir? shellxquote?
+<
+ If these options are set in your .vimrc or _vimrc file, try removing those
+ lines.
+
+ Are you using a Unix shell in a MS-Windows environment? For example,
+ the Unix shell from the MKS-toolkit. Do you have the SHELL environment
+ set to point to this shell? You can try resetting the SHELL environment
+ variable.
+
+ If you are using a Unix shell on MS-Windows, you should try to use
+ exuberant ctags that is compiled for Unix-like environments so that
+ exuberant ctags will understand path names with forward slash characters.
+
+ Is your filetype supported by the exuberant ctags utility? The file types
+ supported by the exuberant ctags utility are listed in the ctags help. If a
+ file type is not supported, you have to extend exuberant ctags. You can use
+ the following command to list the filetypes supported by exuberant ctags:
+>
+ ctags --list-languages
+<
+ Run the following command from the shell prompt and check whether the tags
+ defined in your file are listed in the output from exuberant ctags:
+>
+ ctags -f - --format=2 --excmd=pattern --fields=nks <filename>
+<
+ If you see your tags in the output from the above command, then the
+ exuberant ctags utility is properly parsing your file.
+
+ Do you have the .ctags or _ctags or the ctags.cnf file in your home
+ directory for specifying default options or for extending exuberant ctags?
+ If you do have this file, check the options in this file and make sure
+ these options are not interfering with the operation of the taglist plugin.
+
+ If you are using MS-Windows, check the value of the TEMP and TMP
+ environment variables. If these environment variables are set to a path
+ with space characters in the name, then try using the DOS 8.3 short name
+ for the path or set them to a path without the space characters in the
+ name. For example, if the temporary directory name is "C:\Documents and
+ Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to
+ the following:
+>
+ set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp
+<
+ If exuberant ctags is installed in a directory with space characters in the
+ name, then try adding the directory to the PATH environment variable or try
+ setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags
+ or try copying the exuberant ctags to a path without space characters in
+ the name. For example, if exuberant ctags is installed in the directory
+ "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable
+ as below:
+>
+ let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe'
+<
+ If you are using a cygwin compiled version of exuberant ctags on MS-Windows,
+ make sure that either you have the cygwin compiled sort utility installed
+ and available in your PATH or compile exuberant ctags with internal sort
+ support. Otherwise, when exuberant ctags sorts the tags output by invoking
+ the sort utility, it may end up invoking the MS-Windows version of
+ sort.exe, thereby resulting in failure.
+
+Q. When I try to open the taglist window, I am seeing the following error
+ message. How do I fix this problem?
+
+ Taglist: Failed to generate tags for /my/path/to/file
+ ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
+
+A. The taglist plugin will work only with the exuberant ctags tool. You
+ cannot use the GNU ctags or the Unix ctags program with the taglist plugin.
+ You will see an error message similar to the one shown above, if you try
+ use a non-exuberant ctags program with Vim. To fix this problem, either add
+ the exuberant ctags tool location to the PATH environment variable or set
+ the 'Tlist_Ctags_Cmd' variable.
+
+Q. A file has more than one tag with the same name. When I select a tag name
+ from the taglist window, the cursor is positioned at the incorrect tag
+ location.
+A. The taglist plugin uses the search pattern generated by the exuberant ctags
+ utility to position the cursor at the location of a tag definition. If a
+ file has more than one tag with the same name and same prototype, then the
+ search pattern will be the same. In this case, when searching for the tag
+ pattern, the cursor may be positioned at the incorrect location.
+
+Q. I have made some modifications to my file and introduced new
+ functions/classes/variables. I have not yet saved my file. The taglist
+ plugin is not displaying the new tags when I update the taglist window.
+A. The exuberant ctags utility will process only files that are present in the
+ disk. To list the tags defined in a file, you have to save the file and
+ then update the taglist window.
+
+Q. I have created a ctags file using the exuberant ctags utility for my source
+ tree. How do I configure the taglist plugin to use this tags file?
+A. The taglist plugin doesn't use a tags file stored in disk. For every opened
+ file, the taglist plugin invokes the exuberant ctags utility to get the
+ list of tags dynamically. The Vim system() function is used to invoke
+ exuberant ctags and get the ctags output. This function internally uses a
+ temporary file to store the output. This file is deleted after the output
+ from the command is read. So you will never see the file that contains the
+ output of exuberant ctags.
+
+Q. When I set the |'updatetime'| option to a low value (less than 1000) and if
+ I keep pressing a key with the taglist window open, the current buffer
+ contents are changed. Why is this?
+A. The taglist plugin uses the |CursorHold| autocmd to highlight the current
+ tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds.
+ If the |'updatetime'| option is set to a low value, then the CursorHold
+ autocmd will be triggered frequently. As the taglist plugin changes
+ the focus to the taglist window to highlight the current tag, this could
+ interfere with the key movement resulting in changing the contents of
+ the current buffer. The workaround for this problem is to not set the
+ |'updatetime'| option to a low value.
+
+==============================================================================
+ *taglist-license*
+10. License~
+Permission is hereby granted to use and distribute the taglist plugin, 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.
+
+==============================================================================
+ *taglist-todo*
+11. Todo~
+
+1. Group tags according to the scope and display them. For example,
+ group all the tags belonging to a C++/Java class
+2. Support for displaying tags in a modified (not-yet-saved) file.
+3. Automatically open the taglist window only for selected filetypes.
+ For other filetypes, close the taglist window.
+4. When using the shell from the MKS toolkit, the taglist plugin
+ doesn't work.
+5. The taglist plugin doesn't work with files edited remotely using the
+ netrw plugin. The exuberant ctags utility cannot process files over
+ scp/rcp/ftp, etc.
+
+==============================================================================
+
+vim:tw=78:ts=8:noet:ft=help:
--- /dev/null
+'Tlist_Auto_Highlight_Tag' taglist-plus.txt /*'Tlist_Auto_Highlight_Tag'*
+'Tlist_Auto_Open' taglist-plus.txt /*'Tlist_Auto_Open'*
+'Tlist_Auto_Update' taglist-plus.txt /*'Tlist_Auto_Update'*
+'Tlist_Close_On_Select' taglist-plus.txt /*'Tlist_Close_On_Select'*
+'Tlist_Compact_Format' taglist-plus.txt /*'Tlist_Compact_Format'*
+'Tlist_Ctags_Cmd' taglist-plus.txt /*'Tlist_Ctags_Cmd'*
+'Tlist_Display_Prototype' taglist-plus.txt /*'Tlist_Display_Prototype'*
+'Tlist_Display_Tag_Scope' taglist-plus.txt /*'Tlist_Display_Tag_Scope'*
+'Tlist_Enable_Fold_Column' taglist-plus.txt /*'Tlist_Enable_Fold_Column'*
+'Tlist_Exit_OnlyWindow' taglist-plus.txt /*'Tlist_Exit_OnlyWindow'*
+'Tlist_File_Fold_Auto_Close' taglist-plus.txt /*'Tlist_File_Fold_Auto_Close'*
+'Tlist_GainFocus_On_ToggleOpen' taglist-plus.txt /*'Tlist_GainFocus_On_ToggleOpen'*
+'Tlist_Highlight_Tag_On_BufEnter' taglist-plus.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
+'Tlist_Inc_Winwidth' taglist-plus.txt /*'Tlist_Inc_Winwidth'*
+'Tlist_Max_Submenu_Items' taglist-plus.txt /*'Tlist_Max_Submenu_Items'*
+'Tlist_Max_Tag_Length' taglist-plus.txt /*'Tlist_Max_Tag_Length'*
+'Tlist_Process_File_Always' taglist-plus.txt /*'Tlist_Process_File_Always'*
+'Tlist_Show_Menu' taglist-plus.txt /*'Tlist_Show_Menu'*
+'Tlist_Show_One_File' taglist-plus.txt /*'Tlist_Show_One_File'*
+'Tlist_Sort_Type' taglist-plus.txt /*'Tlist_Sort_Type'*
+'Tlist_Use_Horiz_Window' taglist-plus.txt /*'Tlist_Use_Horiz_Window'*
+'Tlist_Use_Right_Window' taglist-plus.txt /*'Tlist_Use_Right_Window'*
+'Tlist_Use_SingleClick' taglist-plus.txt /*'Tlist_Use_SingleClick'*
+'Tlist_WinHeight' taglist-plus.txt /*'Tlist_WinHeight'*
+'Tlist_WinWidth' taglist-plus.txt /*'Tlist_WinWidth'*
+'Tlist_javascript_Hide_Extras' taglist-plus.txt /*'Tlist_javascript_Hide_Extras'*
+:TlistAddFiles taglist-plus.txt /*:TlistAddFiles*
+:TlistAddFilesRecursive taglist-plus.txt /*:TlistAddFilesRecursive*
+:TlistClose taglist-plus.txt /*:TlistClose*
+:TlistDebug taglist-plus.txt /*:TlistDebug*
+:TlistHighlightTag taglist-plus.txt /*:TlistHighlightTag*
+:TlistLock taglist-plus.txt /*:TlistLock*
+:TlistMessages taglist-plus.txt /*:TlistMessages*
+:TlistOpen taglist-plus.txt /*:TlistOpen*
+:TlistSessionLoad taglist-plus.txt /*:TlistSessionLoad*
+:TlistSessionSave taglist-plus.txt /*:TlistSessionSave*
+:TlistShowPrototype taglist-plus.txt /*:TlistShowPrototype*
+:TlistShowTag taglist-plus.txt /*:TlistShowTag*
+:TlistToggle taglist-plus.txt /*:TlistToggle*
+:TlistUndebug taglist-plus.txt /*:TlistUndebug*
+:TlistUnlock taglist-plus.txt /*:TlistUnlock*
+:TlistUpdate taglist-plus.txt /*:TlistUpdate*
+Tlist_Get_Tag_Prototype_By_Line() taglist-plus.txt /*Tlist_Get_Tag_Prototype_By_Line()*
+Tlist_Get_Tagname_By_Line() taglist-plus.txt /*Tlist_Get_Tagname_By_Line()*
+Tlist_Set_App() taglist-plus.txt /*Tlist_Set_App()*
+Tlist_Update_File_Tags() taglist-plus.txt /*Tlist_Update_File_Tags()*
+taglist-commands taglist-plus.txt /*taglist-commands*
+taglist-debug taglist-plus.txt /*taglist-debug*
+taglist-extend taglist-plus.txt /*taglist-extend*
+taglist-faq taglist-plus.txt /*taglist-faq*
+taglist-functions taglist-plus.txt /*taglist-functions*
+taglist-install taglist-plus.txt /*taglist-install*
+taglist-intro taglist-plus.txt /*taglist-intro*
+taglist-keys taglist-plus.txt /*taglist-keys*
+taglist-license taglist-plus.txt /*taglist-license*
+taglist-menu taglist-plus.txt /*taglist-menu*
+taglist-options taglist-plus.txt /*taglist-options*
+taglist-plus.txt taglist-plus.txt /*taglist-plus.txt*
+taglist-requirements taglist-plus.txt /*taglist-requirements*
+taglist-session taglist-plus.txt /*taglist-session*
+taglist-todo taglist-plus.txt /*taglist-todo*
+taglist-using taglist-plus.txt /*taglist-using*
--- /dev/null
+" File: taglist-plus.vim
+" Authors: Jezreel Ng (jezreel AT gmail DOT com)
+" Yegappan Lakshmanan (yegappan AT yahoo DOT com)
+" Version: 1.0
+ "Last Modified: March 16, 2011
+ "Copyright: Copyright (C) 2011 Jezeel Ng
+" Copyright (C) 2002-2007 Yegappan Lakshmanan
+" 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.
+"
+" For more information about using this plugin, after installing the
+" taglist plugin, use the ":help taglist" command.
+"
+" Installation
+" ------------
+" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim
+" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should
+" unzip the following two files (the directory structure should be
+" preserved):
+"
+" plugin/taglist-plus.vim - main taglist plugin file
+" doc/taglist-plus.txt - documentation (help) file
+"
+" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'
+" Vim help pages for more details about installing Vim plugins.
+" 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
+" $VIM/vimfiles/doc directory, start Vim and run the ":helptags ."
+" command to process the taglist help file.
+" 3. If the exuberant ctags utility is not present in your PATH, then set the
+" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags
+" utility (not to the directory) in the .vimrc file.
+" 4. If you are running a terminal/console version of Vim and the
+" terminal doesn't support changing the window width then set the
+" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file.
+" 5. Restart Vim.
+" 6. You can now use the ":TlistToggle" command to open/close the taglist
+" window. You can use the ":help taglist" command to get more
+" information about using the taglist plugin.
+"
+" ****************** Do not modify after this line ************************
+
+" Line continuation used here
+let s:cpo_save = &cpo
+set cpo&vim
+
+if !exists('loaded_taglist')
+ " First time loading the taglist plugin
+ "
+ " To speed up the loading of Vim, the taglist plugin uses autoload
+ " mechanism to load the taglist functions.
+ " Only define the configuration variables, user commands and some
+ " auto-commands and finish sourcing the file
+
+ " The taglist plugin requires the built-in Vim system() function. If this
+ " function is not available, then don't load the plugin.
+ if !exists('*system')
+ echomsg 'Taglist: Vim system() built-in function is not available. ' .
+ \ 'Plugin is not loaded.'
+ let loaded_taglist = 'no'
+ let &cpo = s:cpo_save
+ finish
+ endif
+
+ " Location of the exuberant ctags tool
+ if !exists('Tlist_Ctags_Cmd')
+ if executable('exuberant-ctags')
+ " On Debian Linux, exuberant ctags is installed
+ " as exuberant-ctags
+ let Tlist_Ctags_Cmd = 'exuberant-ctags'
+ elseif executable('exctags')
+ " On Free-BSD, exuberant ctags is installed as exctags
+ let Tlist_Ctags_Cmd = 'exctags'
+ elseif executable('ctags')
+ let Tlist_Ctags_Cmd = 'ctags'
+ elseif executable('ctags.exe')
+ let Tlist_Ctags_Cmd = 'ctags.exe'
+ elseif executable('tags')
+ let Tlist_Ctags_Cmd = 'tags'
+ else
+ echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' .
+ \ 'not found in PATH. Plugin is not loaded.'
+ " Skip loading the plugin
+ let loaded_taglist = 'no'
+ let &cpo = s:cpo_save
+ finish
+ endif
+ endif
+
+
+ " Automatically open the taglist window on Vim startup
+ if !exists('Tlist_Auto_Open')
+ let Tlist_Auto_Open = 0
+ endif
+
+ " When the taglist window is toggle opened, move the cursor to the
+ " taglist window
+ if !exists('Tlist_GainFocus_On_ToggleOpen')
+ let Tlist_GainFocus_On_ToggleOpen = 0
+ endif
+
+ " Process files even when the taglist window is not open
+ if !exists('Tlist_Process_File_Always')
+ let Tlist_Process_File_Always = 0
+ endif
+
+ if !exists('Tlist_Show_Menu')
+ let Tlist_Show_Menu = 0
+ endif
+
+ " Tag listing sort type - 'name' or 'order'
+ if !exists('Tlist_Sort_Type')
+ let Tlist_Sort_Type = 'order'
+ endif
+
+ " Tag listing window split (horizontal/vertical) control
+ if !exists('Tlist_Use_Horiz_Window')
+ let Tlist_Use_Horiz_Window = 0
+ endif
+
+ " Open the vertically split taglist window on the left or on the right
+ " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to
+ " zero (i.e. only for vertically split windows)
+ if !exists('Tlist_Use_Right_Window')
+ let Tlist_Use_Right_Window = 0
+ endif
+
+ " Increase Vim window width to display vertically split taglist window.
+ " For MS-Windows version of Vim running in a MS-DOS window, this must be
+ " set to 0 otherwise the system may hang due to a Vim limitation.
+ if !exists('Tlist_Inc_Winwidth')
+ if (has('win16') || has('win95')) && !has('gui_running')
+ let Tlist_Inc_Winwidth = 0
+ else
+ let Tlist_Inc_Winwidth = 1
+ endif
+ endif
+
+ " Vertically split taglist window width setting
+ if !exists('Tlist_WinWidth')
+ let Tlist_WinWidth = 30
+ let s:auto_width = 0
+ elseif Tlist_WinWidth == 'auto'
+ let Tlist_WinWidth = 30
+ let s:auto_width = 1
+ endif
+
+ " Horizontally split taglist window height setting
+ if !exists('Tlist_WinHeight')
+ let Tlist_WinHeight = 10
+ endif
+
+ " Display tag prototypes or tag names in the taglist window
+ if !exists('Tlist_Display_Prototype')
+ let Tlist_Display_Prototype = 0
+ endif
+
+ " Display tag scopes in the taglist window
+ if !exists('Tlist_Display_Tag_Scope')
+ let Tlist_Display_Tag_Scope = 1
+ endif
+
+ " Use single left mouse click to jump to a tag. By default this is disabled.
+ " Only double click using the mouse will be processed.
+ if !exists('Tlist_Use_SingleClick')
+ let Tlist_Use_SingleClick = 0
+ endif
+
+ " Control whether additional help is displayed as part of the taglist or
+ " not. Also, controls whether empty lines are used to separate the tag
+ " tree.
+ if !exists('Tlist_Compact_Format')
+ let Tlist_Compact_Format = 0
+ endif
+
+ " Exit Vim if only the taglist window is currently open. By default, this is
+ " set to zero.
+ if !exists('Tlist_Exit_OnlyWindow')
+ let Tlist_Exit_OnlyWindow = 0
+ endif
+
+ " Automatically close the folds for the non-active files in the taglist
+ " window
+ if !exists('Tlist_File_Fold_Auto_Close')
+ let Tlist_File_Fold_Auto_Close = 0
+ endif
+
+ " Close the taglist window when a tag is selected
+ if !exists('Tlist_Close_On_Select')
+ let Tlist_Close_On_Select = 0
+ endif
+
+ " Automatically update the taglist window to display tags for newly
+ " edited files
+ if !exists('Tlist_Auto_Update')
+ let Tlist_Auto_Update = 1
+ endif
+
+ " Automatically highlight the current tag
+ if !exists('Tlist_Auto_Highlight_Tag')
+ let Tlist_Auto_Highlight_Tag = 1
+ endif
+
+ " Automatically highlight the current tag on entering a buffer
+ if !exists('Tlist_Highlight_Tag_On_BufEnter')
+ let Tlist_Highlight_Tag_On_BufEnter = 1
+ endif
+
+ " Enable fold column to display the folding for the tag tree
+ if !exists('Tlist_Enable_Fold_Column')
+ let Tlist_Enable_Fold_Column = 1
+ endif
+
+ " Display the tags for only one file in the taglist window
+ if !exists('Tlist_Show_One_File')
+ let Tlist_Show_One_File = 0
+ endif
+
+ if !exists('Tlist_Max_Submenu_Items')
+ let Tlist_Max_Submenu_Items = 20
+ endif
+
+ if !exists('Tlist_Max_Tag_Length')
+ let Tlist_Max_Tag_Length = 10
+ endif
+
+ " Do not change the name of the taglist title variable. The winmanager
+ " plugin relies on this name to determine the title for the taglist
+ " plugin.
+ let TagList_title = "__Tag_List__"
+
+ " Taglist debug messages
+ let s:tlist_msg = ''
+
+ " Define the taglist autocommand to automatically open the taglist window
+ " on Vim startup
+ if g:Tlist_Auto_Open
+ autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open()
+ endif
+
+ " Refresh the taglist
+ if g:Tlist_Process_File_Always
+ autocmd BufEnter * call s:Tlist_Refresh()
+ endif
+
+ if g:Tlist_Show_Menu
+ autocmd GUIEnter * call s:Tlist_Menu_Init()
+ endif
+
+ " When the taglist buffer is created when loading a Vim session file,
+ " the taglist buffer needs to be initialized. The BufFilePost event
+ " is used to handle this case.
+ autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load()
+
+ " Define the user commands to manage the taglist window
+ command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle()
+ command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open()
+ " For backwards compatiblity define the Tlist command
+ command! -nargs=0 -bar Tlist TlistToggle
+ command! -nargs=+ -complete=file TlistAddFiles
+ \ call s:Tlist_Add_Files(<f-args>)
+ command! -nargs=+ -complete=dir TlistAddFilesRecursive
+ \ call s:Tlist_Add_Files_Recursive(<f-args>)
+ command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close()
+ command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File()
+ command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag(
+ \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1)
+ " For backwards compatiblity define the TlistSync command
+ command! -nargs=0 -bar TlistSync TlistHighlightTag
+ command! -nargs=* -complete=buffer TlistShowPrototype
+ \ echo Tlist_Get_Tag_Prototype_By_Line(<f-args>)
+ command! -nargs=* -complete=buffer TlistShowTag
+ \ echo Tlist_Get_Tagname_By_Line(<f-args>)
+ command! -nargs=* -complete=file TlistSessionLoad
+ \ call s:Tlist_Session_Load(<q-args>)
+ command! -nargs=* -complete=file TlistSessionSave
+ \ call s:Tlist_Session_Save(<q-args>)
+ command! -bar TlistLock let Tlist_Auto_Update=0
+ command! -bar TlistUnlock let Tlist_Auto_Update=1
+
+ " Commands for enabling/disabling debug and to display debug messages
+ command! -nargs=? -complete=file -bar TlistDebug
+ \ call s:Tlist_Debug_Enable(<q-args>)
+ command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable()
+ command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show()
+
+ " Define autocommands to autoload the taglist plugin when needed.
+
+ " Trick to get the current script ID
+ map <SID>xx <SID>xx
+ let s:tlist_sid = substitute(maparg('<SID>xx'), '<SNR>\(\d\+_\)xx$',
+ \ '\1', '')
+ unmap <SID>xx
+
+ exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' .
+ \ escape(expand('<sfile>'), ' ')
+ exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' .
+ \ escape(expand('<sfile>'), ' ')
+ exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' .
+ \ escape(expand('<sfile>'), ' ')
+ exe 'autocmd FuncUndefined Tlist_* source ' .
+ \ escape(expand('<sfile>'), ' ')
+ exe 'autocmd FuncUndefined TagList_* source ' .
+ \ escape(expand('<sfile>'), ' ')
+
+ let loaded_taglist = 'fast_load_done'
+
+ if g:Tlist_Show_Menu && has('gui_running')
+ call s:Tlist_Menu_Init()
+ endif
+
+ " restore 'cpo'
+ let &cpo = s:cpo_save
+ finish
+endif
+
+if !exists('s:tlist_sid')
+ " Two or more versions of taglist plugin are installed. Don't
+ " load this version of the plugin.
+ finish
+endif
+
+unlet! s:tlist_sid
+
+if loaded_taglist != 'fast_load_done'
+ " restore 'cpo'
+ let &cpo = s:cpo_save
+ finish
+endif
+
+" Taglist plugin functionality is available
+let loaded_taglist = 'available'
+
+"------------------- end of user configurable options --------------------
+
+" Default language specific settings for supported file types and tag types
+"
+" Variable name format:
+"
+" s:tlist_def_{vim_ftype}_settings
+"
+" vim_ftype - Filetype detected by Vim
+"
+" Value format:
+"
+" <ctags_ftype>;<flag>:<name>;<flag>:<name>;...
+"
+" ctags_ftype - File type supported by exuberant ctags
+" flag - Flag supported by exuberant ctags to generate a tag type
+" name - Name of the tag type used in the taglist window to display the
+" tags of this type
+"
+
+" assembly language
+let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type'
+
+" aspperl language
+let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable'
+
+" aspvbs language
+let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable'
+
+" awk language
+let s:tlist_def_awk_settings = 'awk;f:function'
+
+" beta language
+let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern'
+
+" c language
+let s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' .
+ \ 'v:variable;f:function'
+
+" c++ language
+let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' .
+ \ 'c:class;g:enum;s:struct;u:union;f:function'
+
+" c# language
+let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' .
+ \ 'E:event;g:enum;s:struct;i:interface;' .
+ \ 'p:properties;m:method'
+
+" cobol language
+let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' .
+ \ 'P:program;s:section'
+
+" eiffel language
+let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature'
+
+" erlang language
+let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function'
+
+" expect (same as tcl) language
+let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure'
+
+" fortran language
+let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' .
+ \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' .
+ \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine'
+
+" HTML language
+let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function'
+
+" java language
+let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' .
+ \ 'f:field;m:method'
+
+" javascript language
+let s:tlist_def_javascript_settings = 'javascript;f:function;v:variable'
+if !exists('Tlist_javascript_Ctags_Cmd') && executable('jsctags')
+ let Tlist_javascript_Ctags_Cmd = 'jsctags'
+endif
+let Tlist_javascript_Ctags_Allowed_Flags = ['-f', '--sort']
+
+" lisp language
+let s:tlist_def_lisp_settings = 'lisp;f:function'
+
+" lua language
+let s:tlist_def_lua_settings = 'lua;f:function'
+
+" makefiles
+let s:tlist_def_make_settings = 'make;m:macro'
+
+" pascal language
+let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure'
+
+" perl language
+let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine'
+
+" php language
+let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function'
+
+" python language
+let s:tlist_def_python_settings = 'python;c:class;m:member;f:function'
+
+" rexx language
+let s:tlist_def_rexx_settings = 'rexx;s:subroutine'
+
+" ruby language
+let s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' .
+ \ 'm:singleton method'
+
+" scheme language
+let s:tlist_def_scheme_settings = 'scheme;s:set;f:function'
+
+" shell language
+let s:tlist_def_sh_settings = 'sh;f:function'
+
+" C shell language
+let s:tlist_def_csh_settings = 'sh;f:function'
+
+" Z shell language
+let s:tlist_def_zsh_settings = 'sh;f:function'
+
+" slang language
+let s:tlist_def_slang_settings = 'slang;n:namespace;f:function'
+
+" sml language
+let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' .
+ \ 'r:structure;t:type;v:value;f:function'
+
+" sql language
+let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' .
+ \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure'
+
+" tcl language
+let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure'
+
+" vera language
+let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' .
+ \ 'f:function;g:enum;m:member;p:program;' .
+ \ 'P:prototype;t:task;T:typedef;v:variable;' .
+ \ 'x:externvar'
+
+"verilog language
+let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' .
+ \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function'
+
+" vim language
+let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function'
+
+" yacc language
+let s:tlist_def_yacc_settings = 'yacc;l:label'
+
+"------------------- end of language specific options --------------------
+
+" Vim window size is changed by the taglist plugin or not
+let s:tlist_winsize_chgd = -1
+" Taglist window is maximized or not
+let s:tlist_win_maximized = 0
+" Name of files in the taglist
+let s:tlist_file_names=''
+" Number of files in the taglist
+let s:tlist_file_count = 0
+" Number of filetypes supported by taglist
+let s:tlist_ftype_count = 0
+" Is taglist part of other plugins like winmanager or cream?
+let s:tlist_app_name = "none"
+" Are we displaying brief help text
+let s:tlist_brief_help = 1
+" List of files removed on user request
+let s:tlist_removed_flist = ""
+" Index of current file displayed in the taglist window
+let s:tlist_cur_file_idx = -1
+" Taglist menu is empty or not
+let s:tlist_menu_empty = 1
+
+" An autocommand is used to refresh the taglist window when entering any
+" buffer. We don't want to refresh the taglist window if we are entering the
+" file window from one of the taglist functions. The 'Tlist_Skip_Refresh'
+" variable is used to skip the refresh of the taglist window and is set
+" and cleared appropriately.
+let s:Tlist_Skip_Refresh = 0
+
+" Tlist_Window_Display_Help()
+function! s:Tlist_Window_Display_Help()
+ if s:tlist_app_name == "winmanager"
+ " To handle a bug in the winmanager plugin, add a space at the
+ " last line
+ call setline('$', ' ')
+ endif
+
+ if s:tlist_brief_help
+ " Add the brief help
+ call append(0, '" Press <F1> to display help text')
+ else
+ " Add the extensive help
+ call append(0, '" <enter> : Jump to tag definition')
+ call append(1, '" o : Jump to tag definition in new window')
+ call append(2, '" p : Preview the tag definition')
+ call append(3, '" <space> : Display tag prototype')
+ call append(4, '" u : Update tag list')
+ call append(5, '" s : Select sort field')
+ call append(6, '" d : Remove file from taglist')
+ call append(7, '" x : Zoom-out/Zoom-in taglist window')
+ call append(8, '" m : Toggle display of more tag info')
+ call append(9, '" + : Open a fold')
+ call append(10, '" - : Close a fold')
+ call append(11, '" * : Open all folds')
+ call append(12, '" = : Close all folds')
+ call append(13, '" [[ : Move to the start of previous file')
+ call append(14, '" ]] : Move to the start of next file')
+ call append(15, '" q : Close the taglist window')
+ call append(16, '" <F1> : Remove help text')
+ endif
+endfunction
+
+" Tlist_Window_Toggle_Help_Text()
+" Toggle taglist plugin help text between the full version and the brief
+" version
+function! s:Tlist_Window_Toggle_Help_Text()
+ if g:Tlist_Compact_Format
+ " In compact display mode, do not display help
+ return
+ endif
+
+ " Include the empty line displayed after the help text
+ let brief_help_size = 1
+ let full_help_size = 16
+
+ setlocal modifiable
+
+ " Set report option to a huge value to prevent informational messages
+ " while deleting the lines
+ let old_report = &report
+ set report=99999
+
+ " Remove the currently highlighted tag. Otherwise, the help text
+ " might be highlighted by mistake
+ match none
+
+ " Toggle between brief and full help text
+ if s:tlist_brief_help
+ let s:tlist_brief_help = 0
+
+ " Remove the previous help
+ exe '1,' . brief_help_size . ' delete _'
+
+ " Adjust the start/end line numbers for the files
+ call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size)
+ else
+ let s:tlist_brief_help = 1
+
+ " Remove the previous help
+ exe '1,' . full_help_size . ' delete _'
+
+ " Adjust the start/end line numbers for the files
+ call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size)
+ endif
+
+ call s:Tlist_Window_Display_Help()
+
+ " Restore the report option
+ let &report = old_report
+
+ setlocal nomodifiable
+endfunction
+
+" Taglist debug support
+let s:tlist_debug = 0
+
+" File for storing the debug messages
+let s:tlist_debug_file = ''
+
+" Tlist_Debug_Enable
+" Enable logging of taglist debug messages.
+function! s:Tlist_Debug_Enable(...)
+ let s:tlist_debug = 1
+
+ " Check whether a valid file name is supplied.
+ if a:1 != ''
+ let s:tlist_debug_file = fnamemodify(a:1, ':p')
+
+ " Empty the log file
+ exe 'redir! > ' . s:tlist_debug_file
+ redir END
+
+ " Check whether the log file is present/created
+ if !filewritable(s:tlist_debug_file)
+ call s:Tlist_Warning_Msg('Taglist: Unable to create log file '
+ \ . s:tlist_debug_file)
+ let s:tlist_debug_file = ''
+ endif
+ endif
+endfunction
+
+" Tlist_Debug_Disable
+" Disable logging of taglist debug messages.
+function! s:Tlist_Debug_Disable(...)
+ let s:tlist_debug = 0
+ let s:tlist_debug_file = ''
+endfunction
+
+" Tlist_Debug_Show
+" Display the taglist debug messages in a new window
+function! s:Tlist_Debug_Show()
+ if s:tlist_msg == ''
+ call s:Tlist_Warning_Msg('Taglist: No debug messages')
+ return
+ endif
+
+ " Open a new window to display the taglist debug messages
+ new taglist_debug.txt
+ " Delete all the lines (if the buffer already exists)
+ silent! %delete _
+ " Add the messages
+ silent! put =s:tlist_msg
+ " Move the cursor to the first line
+ normal! gg
+endfunction
+
+" Tlist_Log_Msg
+" Log the supplied debug message along with the time
+function! s:Tlist_Log_Msg(msg)
+ if s:tlist_debug
+ if s:tlist_debug_file != ''
+ exe 'redir >> ' . s:tlist_debug_file
+ silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n"
+ redir END
+ else
+ " Log the message into a variable
+ " Retain only the last 3000 characters
+ let len = strlen(s:tlist_msg)
+ if len > 3000
+ let s:tlist_msg = strpart(s:tlist_msg, len - 3000)
+ endif
+ let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' .
+ \ a:msg . "\n"
+ endif
+ endif
+endfunction
+
+" Tlist_Warning_Msg()
+" Display a message using WarningMsg highlight group
+function! s:Tlist_Warning_Msg(msg)
+ echohl WarningMsg
+ echomsg a:msg
+ echohl None
+endfunction
+
+" Last returned file index for file name lookup.
+" Used to speed up file lookup
+let s:tlist_file_name_idx_cache = -1
+
+" Tlist_Get_File_Index()
+" Return the index of the specified filename
+function! s:Tlist_Get_File_Index(fname)
+ if s:tlist_file_count == 0 || a:fname == ''
+ return -1
+ endif
+
+ " If the new filename is same as the last accessed filename, then
+ " return that index
+ if s:tlist_file_name_idx_cache != -1 &&
+ \ s:tlist_file_name_idx_cache < s:tlist_file_count
+ if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname
+ " Same as the last accessed file
+ return s:tlist_file_name_idx_cache
+ endif
+ endif
+
+ " First, check whether the filename is present
+ let s_fname = a:fname . "\n"
+ let i = stridx(s:tlist_file_names, s_fname)
+ if i == -1
+ let s:tlist_file_name_idx_cache = -1
+ return -1
+ endif
+
+ " Second, compute the file name index
+ let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g')
+ let s:tlist_file_name_idx_cache = strlen(nl_txt)
+ return s:tlist_file_name_idx_cache
+endfunction
+
+" Last returned file index for line number lookup.
+" Used to speed up file lookup
+let s:tlist_file_lnum_idx_cache = -1
+
+" Tlist_Window_Get_File_Index_By_Linenum()
+" Return the index of the filename present in the specified line number
+" Line number refers to the line number in the taglist window
+function! s:Tlist_Window_Get_File_Index_By_Linenum(lnum)
+ call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')')
+
+ " First try to see whether the new line number is within the range
+ " of the last returned file
+ if s:tlist_file_lnum_idx_cache != -1 &&
+ \ s:tlist_file_lnum_idx_cache < s:tlist_file_count
+ if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start &&
+ \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end
+ return s:tlist_file_lnum_idx_cache
+ endif
+ endif
+
+ let fidx = -1
+
+ if g:Tlist_Show_One_File
+ " Displaying only one file in the taglist window. Check whether
+ " the line is within the tags displayed for that file
+ if s:tlist_cur_file_idx != -1
+ if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start
+ \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end
+ let fidx = s:tlist_cur_file_idx
+ endif
+
+ endif
+ else
+ " Do a binary search in the taglist
+ let left = 0
+ let right = s:tlist_file_count - 1
+
+ while left < right
+ let mid = (left + right) / 2
+
+ if a:lnum >= s:tlist_{mid}_start && a:lnum <= s:tlist_{mid}_end
+ let s:tlist_file_lnum_idx_cache = mid
+ return mid
+ endif
+
+ if a:lnum < s:tlist_{mid}_start
+ let right = mid - 1
+ else
+ let left = mid + 1
+ endif
+ endwhile
+
+ if left >= 0 && left < s:tlist_file_count
+ \ && a:lnum >= s:tlist_{left}_start
+ \ && a:lnum <= s:tlist_{left}_end
+ let fidx = left
+ endif
+ endif
+
+ let s:tlist_file_lnum_idx_cache = fidx
+
+ return fidx
+endfunction
+
+" Tlist_Exe_Cmd_No_Acmds
+" Execute the specified Ex command after disabling autocommands
+function! s:Tlist_Exe_Cmd_No_Acmds(cmd)
+ let old_eventignore = &eventignore
+ set eventignore=all
+ exe a:cmd
+ let &eventignore = old_eventignore
+endfunction
+
+" Tlist_Skip_File()
+" Check whether tag listing is supported for the specified file
+function! s:Tlist_Skip_File(filename, ftype)
+ " Skip buffers with no names and buffers with filetype not set
+ if a:filename == '' || a:ftype == ''
+ return 1
+ endif
+
+ " Skip files which are not supported by exuberant ctags
+ " First check whether default settings for this filetype are available.
+ " If it is not available, then check whether user specified settings are
+ " available. If both are not available, then don't list the tags for this
+ " filetype
+ let var = 's:tlist_def_' . a:ftype . '_settings'
+ if !exists(var)
+ let var = 'g:tlist_' . a:ftype . '_settings'
+ if !exists(var)
+ return 1
+ endif
+ endif
+
+ " Skip files which are not readable or files which are not yet stored
+ " to the disk
+ if !filereadable(a:filename)
+ return 1
+ endif
+
+ return 0
+endfunction
+
+" Tlist_User_Removed_File
+" Returns 1 if a file is removed by a user from the taglist
+function! s:Tlist_User_Removed_File(filename)
+ return stridx(s:tlist_removed_flist, a:filename . "\n") != -1
+endfunction
+
+" Tlist_Update_Remove_List
+" Update the list of user removed files from the taglist
+" add == 1, add the file to the removed list
+" add == 0, delete the file from the removed list
+function! s:Tlist_Update_Remove_List(filename, add)
+ if a:add
+ let s:tlist_removed_flist = s:tlist_removed_flist . a:filename . "\n"
+ else
+ let idx = stridx(s:tlist_removed_flist, a:filename . "\n")
+ let text_before = strpart(s:tlist_removed_flist, 0, idx)
+ let rem_text = strpart(s:tlist_removed_flist, idx)
+ let next_idx = stridx(rem_text, "\n")
+ let text_after = strpart(rem_text, next_idx + 1)
+
+ let s:tlist_removed_flist = text_before . text_after
+ endif
+endfunction
+
+" Tlist_FileType_Init
+" Initialize the ctags arguments and tag variable for the specified
+" file type
+function! s:Tlist_FileType_Init(ftype)
+ call s:Tlist_Log_Msg('Tlist_FileType_Init (' . a:ftype . ')')
+ " If the user didn't specify any settings, then use the default
+ " ctags args. Otherwise, use the settings specified by the user
+ let var = 'g:tlist_' . a:ftype . '_settings'
+ if exists(var)
+ " User specified ctags arguments
+ let settings = {var} . ';'
+ else
+ " Default ctags arguments
+ let var = 's:tlist_def_' . a:ftype . '_settings'
+ if !exists(var)
+ " No default settings for this file type. This filetype is
+ " not supported
+ return 0
+ endif
+ let settings = s:tlist_def_{a:ftype}_settings . ';'
+ endif
+
+ let msg = 'Taglist: Invalid ctags option setting - ' . settings
+
+ " Format of the option that specifies the filetype and ctags arugments:
+ "
+ " <language_name>;flag1:name1;flag2:name2;flag3:name3
+ "
+
+ " Extract the file type to pass to ctags. This may be different from the
+ " file type detected by Vim
+ let pos = stridx(settings, ';')
+ if pos == -1
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ let ctags_ftype = strpart(settings, 0, pos)
+ if ctags_ftype == ''
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ " Make sure a valid filetype is supplied. If the user didn't specify a
+ " valid filetype, then the ctags option settings may be treated as the
+ " filetype
+ if ctags_ftype =~ ':'
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+
+ " Remove the file type from settings
+ let settings = strpart(settings, pos + 1)
+ if settings == ''
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+
+ " Process all the specified ctags flags. The format is
+ " flag1:name1;flag2:name2;flag3:name3
+ let ctags_flags = ''
+ let cnt = 0
+ while settings != ''
+ " Extract the flag
+ let pos = stridx(settings, ':')
+ if pos == -1
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ let flag = strpart(settings, 0, pos)
+ if flag == ''
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ " Remove the flag from settings
+ let settings = strpart(settings, pos + 1)
+
+ " Extract the tag type name
+ let pos = stridx(settings, ';')
+ if pos == -1
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ let name = strpart(settings, 0, pos)
+ if name == ''
+ call s:Tlist_Warning_Msg(msg)
+ return 0
+ endif
+ let settings = strpart(settings, pos + 1)
+
+ let cnt = cnt + 1
+
+ let s:tlist_{a:ftype}_{cnt}_name = flag
+ let s:tlist_{a:ftype}_{cnt}_fullname = name
+ let ctags_flags = ctags_flags . flag
+ endwhile
+
+ let s:tlist_{a:ftype}_ctags_args = { '--language-force=': ctags_ftype,
+ \ '--'.ctags_ftype.'-types=': ctags_flags }
+ let s:tlist_{a:ftype}_count = cnt
+ let s:tlist_{a:ftype}_ctags_flags = ctags_flags
+
+ " Save the filetype name
+ let s:tlist_ftype_{s:tlist_ftype_count}_name = a:ftype
+ let s:tlist_ftype_count = s:tlist_ftype_count + 1
+
+ return 1
+endfunction
+
+" Tlist_Detect_Filetype
+" Determine the filetype for the specified file using the filetypedetect
+" autocmd.
+function! s:Tlist_Detect_Filetype(fname)
+ " Ignore the filetype autocommands
+ let old_eventignore = &eventignore
+ set eventignore=FileType
+
+ " Save the 'filetype', as this will be changed temporarily
+ let old_filetype = &filetype
+
+ " Run the filetypedetect group of autocommands to determine
+ " the filetype
+ exe 'doautocmd filetypedetect BufRead ' . a:fname
+
+ " Save the detected filetype
+ let ftype = &filetype
+
+ " Restore the previous state
+ let &filetype = old_filetype
+ let &eventignore = old_eventignore
+
+ return ftype
+endfunction
+
+" Tlist_Get_Buffer_Filetype
+" Get the filetype for the specified buffer
+function! s:Tlist_Get_Buffer_Filetype(bnum)
+ let buf_ft = getbufvar(a:bnum, '&filetype')
+
+ if bufloaded(a:bnum)
+ " For loaded buffers, the 'filetype' is already determined
+ return buf_ft
+ endif
+
+ " For unloaded buffers, if the 'filetype' option is set, return it
+ if buf_ft != ''
+ return buf_ft
+ endif
+
+ " Skip non-existent buffers
+ if !bufexists(a:bnum)
+ return ''
+ endif
+
+ " For buffers whose filetype is not yet determined, try to determine
+ " the filetype
+ let bname = bufname(a:bnum)
+
+ return s:Tlist_Detect_Filetype(bname)
+endfunction
+
+" Tlist_Discard_TagInfo
+" Discard the stored tag information for a file
+function! s:Tlist_Discard_TagInfo(fidx)
+ call s:Tlist_Log_Msg('Tlist_Discard_TagInfo (' .
+ \ s:tlist_{a:fidx}_filename . ')')
+ let ftype = s:tlist_{a:fidx}_filetype
+
+ " Discard information about the tags defined in the file
+ let i = 1
+ while i <= s:tlist_{a:fidx}_tag_count
+ let fidx_i = 's:tlist_' . a:fidx . '_' . i
+ unlet! {fidx_i}_tag
+ unlet! {fidx_i}_tag_name
+ unlet! {fidx_i}_tag_type
+ unlet! {fidx_i}_ttype_idx
+ unlet! {fidx_i}_tag_proto
+ unlet! {fidx_i}_tag_searchpat
+ unlet! {fidx_i}_tag_linenum
+ let i = i + 1
+ endwhile
+
+ let s:tlist_{a:fidx}_tag_count = 0
+
+ " Discard information about tag type groups
+ let i = 1
+ while i <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{i}_name
+ if s:tlist_{a:fidx}_{ttype} != ''
+ let fidx_ttype = 's:tlist_' . a:fidx . '_' . ttype
+ let {fidx_ttype} = ''
+ let {fidx_ttype}_offset = 0
+ let cnt = {fidx_ttype}_count
+ let {fidx_ttype}_count = 0
+ let j = 1
+ while j <= cnt
+ unlet! {fidx_ttype}_{j}
+ let j = j + 1
+ endwhile
+ endif
+ let i = i + 1
+ endwhile
+
+ " Discard the stored menu command also
+ let s:tlist_{a:fidx}_menu_cmd = ''
+endfunction
+
+" Tlist_Window_Update_Line_Offsets
+" Update the line offsets for tags for files starting from start_idx
+" and displayed in the taglist window by the specified offset
+function! s:Tlist_Window_Update_Line_Offsets(start_idx, increment, offset)
+ let i = a:start_idx
+
+ while i < s:tlist_file_count
+ if s:tlist_{i}_visible
+ " Update the start/end line number only if the file is visible
+ if a:increment
+ let s:tlist_{i}_start = s:tlist_{i}_start + a:offset
+ let s:tlist_{i}_end = s:tlist_{i}_end + a:offset
+ else
+ let s:tlist_{i}_start = s:tlist_{i}_start - a:offset
+ let s:tlist_{i}_end = s:tlist_{i}_end - a:offset
+ endif
+ endif
+ let i = i + 1
+ endwhile
+endfunction
+
+" Tlist_Discard_FileInfo
+" Discard the stored information for a file
+function! s:Tlist_Discard_FileInfo(fidx)
+ call s:Tlist_Log_Msg('Tlist_Discard_FileInfo (' .
+ \ s:tlist_{a:fidx}_filename . ')')
+ call s:Tlist_Discard_TagInfo(a:fidx)
+
+ let ftype = s:tlist_{a:fidx}_filetype
+
+ let i = 1
+ while i <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{i}_name
+ unlet! s:tlist_{a:fidx}_{ttype}
+ unlet! s:tlist_{a:fidx}_{ttype}_offset
+ unlet! s:tlist_{a:fidx}_{ttype}_count
+ let i = i + 1
+ endwhile
+
+ unlet! s:tlist_{a:fidx}_filename
+ unlet! s:tlist_{a:fidx}_sort_type
+ unlet! s:tlist_{a:fidx}_filetype
+ unlet! s:tlist_{a:fidx}_mtime
+ unlet! s:tlist_{a:fidx}_start
+ unlet! s:tlist_{a:fidx}_end
+ unlet! s:tlist_{a:fidx}_valid
+ unlet! s:tlist_{a:fidx}_visible
+ unlet! s:tlist_{a:fidx}_tag_count
+ unlet! s:tlist_{a:fidx}_menu_cmd
+endfunction
+
+" Tlist_Window_Remove_File_From_Display
+" Remove the specified file from display
+function! s:Tlist_Window_Remove_File_From_Display(fidx)
+ call s:Tlist_Log_Msg('Tlist_Window_Remove_File_From_Display (' .
+ \ s:tlist_{a:fidx}_filename . ')')
+ " If the file is not visible then no need to remove it
+ if !s:tlist_{a:fidx}_visible
+ return
+ endif
+
+ " Remove the tags displayed for the specified file from the window
+ let start = s:tlist_{a:fidx}_start
+ " Include the empty line after the last line also
+ if g:Tlist_Compact_Format
+ let end = s:tlist_{a:fidx}_end
+ else
+ let end = s:tlist_{a:fidx}_end + 1
+ endif
+
+ setlocal modifiable
+ exe 'silent! ' . start . ',' . end . 'delete _'
+ setlocal nomodifiable
+
+ " Correct the start and end line offsets for all the files following
+ " this file, as the tags for this file are removed
+ call s:Tlist_Window_Update_Line_Offsets(a:fidx + 1, 0, end - start + 1)
+endfunction
+
+" Tlist_Remove_File
+" Remove the file under the cursor or the specified file index
+" user_request - User requested to remove the file from taglist
+function! s:Tlist_Remove_File(file_idx, user_request)
+ let fidx = a:file_idx
+
+ if fidx == -1
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.'))
+ if fidx == -1
+ return
+ endif
+ endif
+ call s:Tlist_Log_Msg('Tlist_Remove_File (' .
+ \ s:tlist_{fidx}_filename . ', ' . a:user_request . ')')
+
+ let save_winnr = winnr()
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ " Taglist window is open, remove the file from display
+
+ if save_winnr != winnum
+ let old_eventignore = &eventignore
+ set eventignore=all
+ exe winnum . 'wincmd w'
+ endif
+
+ call s:Tlist_Window_Remove_File_From_Display(fidx)
+
+ if save_winnr != winnum
+ exe save_winnr . 'wincmd w'
+ let &eventignore = old_eventignore
+ endif
+ endif
+
+ let fname = s:tlist_{fidx}_filename
+
+ if a:user_request
+ " As the user requested to remove the file from taglist,
+ " add it to the removed list
+ call s:Tlist_Update_Remove_List(fname, 1)
+ endif
+
+ " Remove the file name from the taglist list of filenames
+ let idx = stridx(s:tlist_file_names, fname . "\n")
+ let text_before = strpart(s:tlist_file_names, 0, idx)
+ let rem_text = strpart(s:tlist_file_names, idx)
+ let next_idx = stridx(rem_text, "\n")
+ let text_after = strpart(rem_text, next_idx + 1)
+ let s:tlist_file_names = text_before . text_after
+
+ call s:Tlist_Discard_FileInfo(fidx)
+
+ " Shift all the file variables by one index
+ let i = fidx + 1
+
+ while i < s:tlist_file_count
+ let j = i - 1
+
+ let s:tlist_{j}_filename = s:tlist_{i}_filename
+ let s:tlist_{j}_sort_type = s:tlist_{i}_sort_type
+ let s:tlist_{j}_filetype = s:tlist_{i}_filetype
+ let s:tlist_{j}_mtime = s:tlist_{i}_mtime
+ let s:tlist_{j}_start = s:tlist_{i}_start
+ let s:tlist_{j}_end = s:tlist_{i}_end
+ let s:tlist_{j}_valid = s:tlist_{i}_valid
+ let s:tlist_{j}_visible = s:tlist_{i}_visible
+ let s:tlist_{j}_tag_count = s:tlist_{i}_tag_count
+ let s:tlist_{j}_menu_cmd = s:tlist_{i}_menu_cmd
+
+ let k = 1
+ while k <= s:tlist_{j}_tag_count
+ let s:tlist_{j}_{k}_tag = s:tlist_{i}_{k}_tag
+ let s:tlist_{j}_{k}_tag_name = s:tlist_{i}_{k}_tag_name
+ let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k)
+ let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx
+ let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k)
+ let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k)
+ let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k)
+ let k = k + 1
+ endwhile
+
+ let ftype = s:tlist_{i}_filetype
+
+ let k = 1
+ while k <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{k}_name
+ let s:tlist_{j}_{ttype} = s:tlist_{i}_{ttype}
+ let s:tlist_{j}_{ttype}_offset = s:tlist_{i}_{ttype}_offset
+ let s:tlist_{j}_{ttype}_count = s:tlist_{i}_{ttype}_count
+ if s:tlist_{j}_{ttype} != ''
+ let l = 1
+ while l <= s:tlist_{j}_{ttype}_count
+ let s:tlist_{j}_{ttype}_{l} = s:tlist_{i}_{ttype}_{l}
+ let l = l + 1
+ endwhile
+ endif
+ let k = k + 1
+ endwhile
+
+ " As the file and tag information is copied to the new index,
+ " discard the previous information
+ call s:Tlist_Discard_FileInfo(i)
+
+ let i = i + 1
+ endwhile
+
+ " Reduce the number of files displayed
+ let s:tlist_file_count = s:tlist_file_count - 1
+
+ if g:Tlist_Show_One_File
+ " If the tags for only one file is displayed and if we just
+ " now removed that file, then invalidate the current file idx
+ if s:tlist_cur_file_idx == fidx
+ let s:tlist_cur_file_idx = -1
+ endif
+ endif
+endfunction
+
+" Tlist_Window_Goto_Window
+" Goto the taglist window
+function! s:Tlist_Window_Goto_Window()
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ if winnr() != winnum
+ call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w')
+ endif
+ endif
+endfunction
+
+" Tlist_Window_Create
+" Create a new taglist window. If it is already open, jump to it
+function! s:Tlist_Window_Create()
+ call s:Tlist_Log_Msg('Tlist_Window_Create()')
+ " If the window is open, jump to it
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ " Jump to the existing window
+ if winnr() != winnum
+ exe winnum . 'wincmd w'
+ endif
+ return
+ endif
+
+ " If used with winmanager don't open windows. Winmanager will handle
+ " the window/buffer management
+ if s:tlist_app_name == "winmanager"
+ return
+ endif
+
+ " Create a new window. If user prefers a horizontal window, then open
+ " a horizontally split window. Otherwise open a vertically split
+ " window
+ if g:Tlist_Use_Horiz_Window
+ " Open a horizontally split window
+ let win_dir = 'botright'
+ " Horizontal window height
+ let win_size = g:Tlist_WinHeight
+ else
+ if s:tlist_winsize_chgd == -1
+ " Open a vertically split window. Increase the window size, if
+ " needed, to accomodate the new window
+ if g:Tlist_Inc_Winwidth &&
+ \ &columns < (80 + g:Tlist_WinWidth)
+ " Save the original window position
+ let s:tlist_pre_winx = getwinposx()
+ let s:tlist_pre_winy = getwinposy()
+
+ " one extra column is needed to include the vertical split
+ let &columns= &columns + g:Tlist_WinWidth + 1
+
+ let s:tlist_winsize_chgd = 1
+ else
+ let s:tlist_winsize_chgd = 0
+ endif
+ endif
+
+ if g:Tlist_Use_Right_Window
+ " Open the window at the rightmost place
+ let win_dir = 'botright vertical'
+ else
+ " Open the window at the leftmost place
+ let win_dir = 'topleft vertical'
+ endif
+ let win_size = g:Tlist_WinWidth
+ endif
+
+ " If the tag listing temporary buffer already exists, then reuse it.
+ " Otherwise create a new buffer
+ let bufnum = bufnr(g:TagList_title)
+ if bufnum == -1
+ " Create a new buffer
+ let wcmd = g:TagList_title
+ else
+ " Edit the existing buffer
+ let wcmd = '+buffer' . bufnum
+ endif
+
+ " Create the taglist window
+ exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd
+
+ " Save the new window position
+ let s:tlist_winx = getwinposx()
+ let s:tlist_winy = getwinposy()
+
+ " Initialize the taglist window
+ call s:Tlist_Window_Init()
+endfunction
+
+" Tlist_Window_Zoom
+" Zoom (maximize/minimize) the taglist window
+function! s:Tlist_Window_Zoom()
+ if s:tlist_win_maximized
+ " Restore the window back to the previous size
+ if g:Tlist_Use_Horiz_Window
+ exe 'resize ' . g:Tlist_WinHeight
+ else
+ exe 'vert resize ' . g:Tlist_WinWidth
+ endif
+ let s:tlist_win_maximized = 0
+ else
+ " Set the window size to the maximum possible without closing other
+ " windows
+ if g:Tlist_Use_Horiz_Window
+ resize
+ else
+ vert resize
+ endif
+ let s:tlist_win_maximized = 1
+ endif
+endfunction
+
+" Tlist_Ballon_Expr
+" When the mouse cursor is over a tag in the taglist window, display the
+" tag prototype (balloon)
+function! Tlist_Ballon_Expr()
+ " Get the file index
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(v:beval_lnum)
+ if fidx == -1
+ return ''
+ endif
+
+ " Get the tag output line for the current tag
+ let tidx = s:Tlist_Window_Get_Tag_Index(fidx, v:beval_lnum)
+ if tidx == 0
+ return ''
+ endif
+
+ " Get the tag search pattern and display it
+ return s:Tlist_Get_Tag_Prototype(fidx, tidx)
+endfunction
+
+" Tlist_Window_Check_Width
+" Check the width of the taglist window. For horizontally split windows, the
+" 'winfixheight' option is used to fix the height of the window. For
+" vertically split windows, Vim doesn't support the 'winfixwidth' option. So
+" need to handle window width changes from this function.
+function! s:Tlist_Window_Check_Width()
+ let tlist_winnr = bufwinnr(g:TagList_title)
+ if tlist_winnr == -1
+ return
+ endif
+
+ let width = winwidth(tlist_winnr)
+ if width != g:Tlist_WinWidth
+ call s:Tlist_Log_Msg("Tlist_Window_Check_Width: Changing window " .
+ \ "width from " . width . " to " . g:Tlist_WinWidth)
+ let save_winnr = winnr()
+ if save_winnr != tlist_winnr
+ call s:Tlist_Exe_Cmd_No_Acmds(tlist_winnr . 'wincmd w')
+ endif
+ exe 'vert resize ' . g:Tlist_WinWidth
+ if save_winnr != tlist_winnr
+ call s:Tlist_Exe_Cmd_No_Acmds('wincmd p')
+ endif
+ endif
+endfunction
+
+" Tlist_Window_Exit_Only_Window
+" If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the
+" taglist window is present.
+function! s:Tlist_Window_Exit_Only_Window()
+ " Before quitting Vim, delete the taglist buffer so that
+ " the '0 mark is correctly set to the previous buffer.
+ if v:version < 700
+ if winbufnr(2) == -1
+ bdelete
+ quit
+ endif
+ else
+ if winbufnr(2) == -1
+ if tabpagenr('$') == 1
+ " Only one tag page is present
+ bdelete
+ quit
+ else
+ " More than one tab page is present. Close only the current
+ " tab page
+ close
+ endif
+ endif
+ endif
+endfunction
+
+" Tlist_Window_Init
+" Set the default options for the taglist window
+function! s:Tlist_Window_Init()
+ call s:Tlist_Log_Msg('Tlist_Window_Init()')
+
+ " The 'readonly' option should not be set for the taglist buffer.
+ " If Vim is started as "view/gview" or if the ":view" command is
+ " used, then the 'readonly' option is set for all the buffers.
+ " Unset it for the taglist buffer
+ setlocal noreadonly
+
+ " Set the taglist buffer filetype to taglist
+ setlocal filetype=taglist
+
+ " Define taglist window element highlighting
+ syntax match TagListComment '^" .*'
+ syntax match TagListFileName '^[^" ].*$'
+ syntax match TagListTitle '^ \S.*$'
+ syntax region TagListTagScope1 start='\[' end='\]' contains=TagListTagScope1 nextgroup=TagListTagScope2 skipwhite
+ syntax region TagListTagScope2 start='\[' end='\]' contained contains=TaglistTagScope2
+
+ " Define the highlighting only if colors are supported
+ if has('gui_running') || &t_Co > 2
+ " Colors to highlight various taglist window elements
+ " If user defined highlighting group exists, then use them.
+ " Otherwise, use default highlight groups.
+ if hlexists('MyTagListTagName')
+ highlight link TagListTagName MyTagListTagName
+ else
+ highlight default link TagListTagName Search
+ endif
+ " Colors to highlight comments and titles
+ if hlexists('MyTagListComment')
+ highlight link TagListComment MyTagListComment
+ else
+ highlight clear TagListComment
+ highlight default link TagListComment Comment
+ endif
+ if hlexists('MyTagListTitle')
+ highlight link TagListTitle MyTagListTitle
+ else
+ highlight clear TagListTitle
+ highlight default link TagListTitle Title
+ endif
+ if hlexists('MyTagListFileName')
+ highlight link TagListFileName MyTagListFileName
+ else
+ highlight clear TagListFileName
+ highlight default TagListFileName guibg=Grey ctermbg=darkgray
+ \ guifg=white ctermfg=white
+ endif
+ if hlexists('MyTagListTagScope')
+ highlight link TagListTagScope1 MyTagListTagScope
+ else
+ highlight clear TagListTagScope1
+ highlight clear TagListTagScope2
+ highlight default link TagListTagScope1 Identifier
+ highlight default link TagListTagScope2 Keyword
+ endif
+ else
+ highlight default TagListTagName term=reverse cterm=reverse
+ endif
+
+ " Folding related settings
+ setlocal foldenable
+ setlocal foldminlines=0
+ setlocal foldmethod=manual
+ setlocal foldlevel=9999
+ if g:Tlist_Enable_Fold_Column
+ setlocal foldcolumn=3
+ else
+ setlocal foldcolumn=0
+ endif
+ setlocal foldtext=v:folddashes.getline(v:foldstart)
+
+ if s:tlist_app_name != "winmanager"
+ " Mark buffer as scratch
+ silent! setlocal buftype=nofile
+ if s:tlist_app_name == "none"
+ silent! setlocal bufhidden=delete
+ endif
+ silent! setlocal noswapfile
+ " Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted
+ " buffers. So if the taglist buffer is unlisted, multiple taglist
+ " windows will be opened. This bug is fixed in Vim 6.1 and above
+ if v:version >= 601
+ silent! setlocal nobuflisted
+ endif
+ endif
+
+ silent! setlocal nowrap
+
+ " If the 'number' option is set in the source window, it will affect the
+ " taglist window. So forcefully disable 'number' option for the taglist
+ " window
+ silent! setlocal nonumber
+
+ " Use fixed height when horizontally split window is used
+ if g:Tlist_Use_Horiz_Window
+ if v:version >= 602
+ set winfixheight
+ endif
+ endif
+ if !g:Tlist_Use_Horiz_Window && v:version >= 700
+ set winfixwidth
+ endif
+
+ " Setup balloon evaluation to display tag prototype
+ if v:version >= 700 && has('balloon_eval')
+ setlocal balloonexpr=Tlist_Ballon_Expr()
+ set ballooneval
+ endif
+
+ " Setup the cpoptions properly for the maps to work
+ let old_cpoptions = &cpoptions
+ set cpoptions&vim
+
+ " Create buffer local mappings for jumping to the tags and sorting the list
+ nnoremap <buffer> <silent> <CR>
+ \ :call <SID>Tlist_Window_Jump_To_Tag('useopen')<CR>
+ " If more languages are required, generate this from a list of options
+ nnoremap <buffer> <silent> m
+ \ :call <SID>Tlist_Window_Toggle_Extra('javascript', 'type')<CR>
+ nnoremap <buffer> <silent> o
+ \ :call <SID>Tlist_Window_Jump_To_Tag('newwin')<CR>
+ nnoremap <buffer> <silent> p
+ \ :call <SID>Tlist_Window_Jump_To_Tag('preview')<CR>
+ nnoremap <buffer> <silent> P
+ \ :call <SID>Tlist_Window_Jump_To_Tag('prevwin')<CR>
+ if v:version >= 700
+ nnoremap <buffer> <silent> t
+ \ :call <SID>Tlist_Window_Jump_To_Tag('checktab')<CR>
+ nnoremap <buffer> <silent> <C-t>
+ \ :call <SID>Tlist_Window_Jump_To_Tag('newtab')<CR>
+ endif
+ nnoremap <buffer> <silent> <2-LeftMouse>
+ \ :call <SID>Tlist_Window_Jump_To_Tag('useopen')<CR>
+ nnoremap <buffer> <silent> s
+ \ :call <SID>Tlist_Change_Sort('cmd', 'toggle', '')<CR>
+ nnoremap <buffer> <silent> + :silent! foldopen<CR>
+ nnoremap <buffer> <silent> - :silent! foldclose<CR>
+ nnoremap <buffer> <silent> * :silent! %foldopen!<CR>
+ nnoremap <buffer> <silent> = :silent! %foldclose<CR>
+ nnoremap <buffer> <silent> <kPlus> :silent! foldopen<CR>
+ nnoremap <buffer> <silent> <kMinus> :silent! foldclose<CR>
+ nnoremap <buffer> <silent> <kMultiply> :silent! %foldopen!<CR>
+ nnoremap <buffer> <silent> <Space> :call <SID>Tlist_Window_Show_Info()<CR>
+ nnoremap <buffer> <silent> u :call <SID>Tlist_Window_Update_File()<CR>
+ nnoremap <buffer> <silent> d :call <SID>Tlist_Remove_File(-1, 1)<CR>
+ nnoremap <buffer> <silent> x :call <SID>Tlist_Window_Zoom()<CR>
+ nnoremap <buffer> <silent> [[ :call <SID>Tlist_Window_Move_To_File(-1)<CR>
+ nnoremap <buffer> <silent> <BS> :call <SID>Tlist_Window_Move_To_File(-1)<CR>
+ nnoremap <buffer> <silent> ]] :call <SID>Tlist_Window_Move_To_File(1)<CR>
+ nnoremap <buffer> <silent> <Tab> :call <SID>Tlist_Window_Move_To_File(1)<CR>
+ nnoremap <buffer> <silent> <F1> :call <SID>Tlist_Window_Toggle_Help_Text()<CR>
+ nnoremap <buffer> <silent> q :close<CR>
+
+ " Insert mode mappings
+ inoremap <buffer> <silent> <CR>
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('useopen')<CR>
+ " Windows needs return
+ inoremap <buffer> <silent> <Return>
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('useopen')<CR>
+ inoremap <buffer> <silent> o
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('newwin')<CR>
+ inoremap <buffer> <silent> p
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('preview')<CR>
+ inoremap <buffer> <silent> P
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('prevwin')<CR>
+ if v:version >= 700
+ inoremap <buffer> <silent> t
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('checktab')<CR>
+ inoremap <buffer> <silent> <C-t>
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('newtab')<CR>
+ endif
+ inoremap <buffer> <silent> <2-LeftMouse>
+ \ <C-o>:call <SID>Tlist_Window_Jump_To_Tag('useopen')<CR>
+ inoremap <buffer> <silent> s
+ \ <C-o>:call <SID>Tlist_Change_Sort('cmd', 'toggle', '')<CR>
+ inoremap <buffer> <silent> + <C-o>:silent! foldopen<CR>
+ inoremap <buffer> <silent> - <C-o>:silent! foldclose<CR>
+ inoremap <buffer> <silent> * <C-o>:silent! %foldopen!<CR>
+ inoremap <buffer> <silent> = <C-o>:silent! %foldclose<CR>
+ inoremap <buffer> <silent> <kPlus> <C-o>:silent! foldopen<CR>
+ inoremap <buffer> <silent> <kMinus> <C-o>:silent! foldclose<CR>
+ inoremap <buffer> <silent> <kMultiply> <C-o>:silent! %foldopen!<CR>
+ inoremap <buffer> <silent> <Space> <C-o>:call
+ \ <SID>Tlist_Window_Show_Info()<CR>
+ inoremap <buffer> <silent> u
+ \ <C-o>:call <SID>Tlist_Window_Update_File()<CR>
+ inoremap <buffer> <silent> d <C-o>:call <SID>Tlist_Remove_File(-1, 1)<CR>
+ inoremap <buffer> <silent> x <C-o>:call <SID>Tlist_Window_Zoom()<CR>
+ inoremap <buffer> <silent> [[ <C-o>:call <SID>Tlist_Window_Move_To_File(-1)<CR>
+ inoremap <buffer> <silent> <BS> <C-o>:call <SID>Tlist_Window_Move_To_File(-1)<CR>
+ inoremap <buffer> <silent> ]] <C-o>:call <SID>Tlist_Window_Move_To_File(1)<CR>
+ inoremap <buffer> <silent> <Tab> <C-o>:call <SID>Tlist_Window_Move_To_File(1)<CR>
+ inoremap <buffer> <silent> <F1> <C-o>:call <SID>Tlist_Window_Toggle_Help_Text()<CR>
+ inoremap <buffer> <silent> q <C-o>:close<CR>
+
+ " Map single left mouse click if the user wants this functionality
+ if g:Tlist_Use_SingleClick == 1
+ " Contributed by Bindu Wavell
+ " attempt to perform single click mapping, it would be much
+ " nicer if we could nnoremap <buffer> ... however vim does
+ " not fire the <buffer> <leftmouse> when you use the mouse
+ " to enter a buffer.
+ let clickmap = ':if bufname("%") =~ "__Tag_List__" <bar> ' .
+ \ 'call <SID>Tlist_Window_Jump_To_Tag("useopen") ' .
+ \ '<bar> endif <CR>'
+ if maparg('<leftmouse>', 'n') == ''
+ " no mapping for leftmouse
+ exe ':nnoremap <silent> <leftmouse> <leftmouse>' . clickmap
+ else
+ " we have a mapping
+ let mapcmd = ':nnoremap <silent> <leftmouse> <leftmouse>'
+ let mapcmd = mapcmd . substitute(substitute(
+ \ maparg('<leftmouse>', 'n'), '|', '<bar>', 'g'),
+ \ '\c^<leftmouse>', '', '')
+ let mapcmd = mapcmd . clickmap
+ exe mapcmd
+ endif
+ endif
+
+ " Define the taglist autocommands
+ augroup TagListAutoCmds
+ autocmd!
+ " Display the tag prototype for the tag under the cursor.
+ autocmd CursorHold __Tag_List__ call s:Tlist_Window_Show_Info()
+ " Highlight the current tag periodically
+ autocmd CursorHold * silent call s:Tlist_Window_Highlight_Tag(
+ \ fnamemodify(bufname('%'), ':p'), line('.'), 1, 0)
+
+ " Adjust the Vim window width when taglist window is closed
+ autocmd BufUnload __Tag_List__ call s:Tlist_Post_Close_Cleanup()
+ " Close the fold for this buffer when leaving the buffer
+ if g:Tlist_File_Fold_Auto_Close
+ autocmd BufEnter * silent
+ \ call s:Tlist_Window_Open_File_Fold(expand('<abuf>'))
+ endif
+ " Exit Vim itself if only the taglist window is present (optional)
+ if g:Tlist_Exit_OnlyWindow
+ autocmd BufEnter __Tag_List__ nested
+ \ call s:Tlist_Window_Exit_Only_Window()
+ endif
+ if s:tlist_app_name != "winmanager" &&
+ \ !g:Tlist_Process_File_Always &&
+ \ (!has('gui_running') || !g:Tlist_Show_Menu)
+ " Auto refresh the taglist window
+ autocmd BufEnter * call s:Tlist_Refresh()
+ endif
+
+ if !g:Tlist_Use_Horiz_Window
+ if v:version < 700
+ autocmd WinEnter * call s:Tlist_Window_Check_Width()
+ endif
+ endif
+ if v:version >= 700
+ autocmd TabEnter * silent call s:Tlist_Refresh_Folds()
+ endif
+ augroup end
+
+ " Restore the previous cpoptions settings
+ let &cpoptions = old_cpoptions
+endfunction
+
+" Tlist_Window_Refresh
+" Display the tags for all the files in the taglist window
+function! s:Tlist_Window_Refresh()
+ call s:Tlist_Log_Msg('Tlist_Window_Refresh()')
+ " Set report option to a huge value to prevent informational messages
+ " while deleting the lines
+ let old_report = &report
+ set report=99999
+
+ " Mark the buffer as modifiable
+ setlocal modifiable
+
+ " Delete the contents of the buffer to the black-hole register
+ silent! %delete _
+
+ " As we have cleared the taglist window, mark all the files
+ " as not visible
+ let i = 0
+ while i < s:tlist_file_count
+ let s:tlist_{i}_visible = 0
+ let i = i + 1
+ endwhile
+
+ if g:Tlist_Compact_Format == 0
+ " Display help in non-compact mode
+ call s:Tlist_Window_Display_Help()
+ endif
+
+ " Mark the buffer as not modifiable
+ setlocal nomodifiable
+
+ " Restore the report option
+ let &report = old_report
+
+ " If the tags for only one file should be displayed in the taglist
+ " window, then no need to add the tags here. The bufenter autocommand
+ " will add the tags for that file.
+ if g:Tlist_Show_One_File
+ return
+ endif
+
+ " List all the tags for the previously processed files
+ " Do this only if taglist is configured to display tags for more than
+ " one file. Otherwise, when Tlist_Show_One_File is configured,
+ " tags for the wrong file will be displayed.
+ let i = 0
+ while i < s:tlist_file_count
+ call s:Tlist_Window_Refresh_File(s:tlist_{i}_filename,
+ \ s:tlist_{i}_filetype)
+ let i = i + 1
+ endwhile
+
+ if g:Tlist_Auto_Update
+ " Add and list the tags for all buffers in the Vim buffer list
+ let i = 1
+ let last_bufnum = bufnr('$')
+ while i <= last_bufnum
+ if buflisted(i)
+ let fname = fnamemodify(bufname(i), ':p')
+ let ftype = s:Tlist_Get_Buffer_Filetype(i)
+ " If the file doesn't support tag listing, skip it
+ if !s:Tlist_Skip_File(fname, ftype)
+ call s:Tlist_Window_Refresh_File(fname, ftype)
+ endif
+ endif
+ let i = i + 1
+ endwhile
+ endif
+
+ " If Tlist_File_Fold_Auto_Close option is set, then close all the folds
+ if g:Tlist_File_Fold_Auto_Close
+ " Close all the folds
+ silent! %foldclose
+ endif
+
+ if !g:Tlist_Use_Horiz_Window && s:auto_width
+ exe 'vertical resize '.g:Tlist_WinWidth
+ endif
+
+ " Move the cursor to the top of the taglist window
+ normal! gg
+endfunction
+
+" Tlist_Post_Close_Cleanup()
+" Close the taglist window and adjust the Vim window width
+function! s:Tlist_Post_Close_Cleanup()
+ call s:Tlist_Log_Msg('Tlist_Post_Close_Cleanup()')
+ " Mark all the files as not visible
+ let i = 0
+ while i < s:tlist_file_count
+ let s:tlist_{i}_visible = 0
+ let i = i + 1
+ endwhile
+
+ " Remove the taglist autocommands
+ silent! autocmd! TagListAutoCmds
+
+ " Clear all the highlights
+ match none
+
+ silent! syntax clear TagListTitle
+ silent! syntax clear TagListComment
+ silent! syntax clear TagListTagScope
+
+ " Remove the left mouse click mapping if it was setup initially
+ if g:Tlist_Use_SingleClick
+ if hasmapto('<LeftMouse>')
+ nunmap <LeftMouse>
+ endif
+ endif
+
+ if s:tlist_app_name != "winmanager"
+ if g:Tlist_Use_Horiz_Window || g:Tlist_Inc_Winwidth == 0 ||
+ \ s:tlist_winsize_chgd != 1 ||
+ \ &columns < (80 + g:Tlist_WinWidth)
+ " No need to adjust window width if using horizontally split taglist
+ " window or if columns is less than 101 or if the user chose not to
+ " adjust the window width
+ else
+ " If the user didn't manually move the window, then restore the window
+ " position to the pre-taglist position
+ if s:tlist_pre_winx != -1 && s:tlist_pre_winy != -1 &&
+ \ getwinposx() == s:tlist_winx &&
+ \ getwinposy() == s:tlist_winy
+ exe 'winpos ' . s:tlist_pre_winx . ' ' . s:tlist_pre_winy
+ endif
+
+ " Adjust the Vim window width
+ let &columns= &columns - (g:Tlist_WinWidth + 1)
+ endif
+ endif
+
+ let s:tlist_winsize_chgd = -1
+
+ " Reset taglist state variables
+ if s:tlist_app_name == "winmanager"
+ let s:tlist_app_name = "none"
+ endif
+ let s:tlist_window_initialized = 0
+endfunction
+
+" Tlist_Window_Refresh_File()
+" List the tags defined in the specified file in a Vim window
+function! s:Tlist_Window_Refresh_File(filename, ftype)
+ call s:Tlist_Log_Msg('Tlist_Window_Refresh_File (' . a:filename . ')')
+ " First check whether the file already exists
+ let fidx = s:Tlist_Get_File_Index(a:filename)
+ if fidx != -1
+ let file_listed = 1
+ else
+ let file_listed = 0
+ endif
+
+ if !file_listed
+ " Check whether this file is removed based on user request
+ " If it is, then don't display the tags for this file
+ if s:Tlist_User_Removed_File(a:filename)
+ return
+ endif
+ endif
+
+ if file_listed && s:tlist_{fidx}_visible
+ " Check whether the file tags are currently valid
+ if s:tlist_{fidx}_valid
+ " Goto the first line in the file
+ exe s:tlist_{fidx}_start
+
+ " If the line is inside a fold, open the fold
+ if foldclosed('.') != -1
+ exe "silent! " . s:tlist_{fidx}_start . "," .
+ \ s:tlist_{fidx}_end . "foldopen!"
+ endif
+ return
+ endif
+
+ " Discard and remove the tags for this file from display
+ call s:Tlist_Discard_TagInfo(fidx)
+ call s:Tlist_Window_Remove_File_From_Display(fidx)
+ endif
+
+ " Process and generate a list of tags defined in the file
+ if !file_listed || !s:tlist_{fidx}_valid
+ let ret_fidx = s:Tlist_Process_File(a:filename, a:ftype)
+ if ret_fidx == -1
+ return
+ endif
+ let fidx = ret_fidx
+ endif
+
+ " Set report option to a huge value to prevent informational messages
+ " while adding lines to the taglist window
+ let old_report = &report
+ set report=99999
+
+ if g:Tlist_Show_One_File
+ " Remove the previous file
+ if s:tlist_cur_file_idx != -1
+ call s:Tlist_Window_Remove_File_From_Display(s:tlist_cur_file_idx)
+ let s:tlist_{s:tlist_cur_file_idx}_visible = 0
+ let s:tlist_{s:tlist_cur_file_idx}_start = 0
+ let s:tlist_{s:tlist_cur_file_idx}_end = 0
+ endif
+ let s:tlist_cur_file_idx = fidx
+ endif
+
+ " Mark the buffer as modifiable
+ setlocal modifiable
+
+ " Add new files to the end of the window. For existing files, add them at
+ " the same line where they were previously present. If the file is not
+ " visible, then add it at the end
+ if s:tlist_{fidx}_start == 0 || !s:tlist_{fidx}_visible
+ if g:Tlist_Compact_Format
+ let s:tlist_{fidx}_start = line('$')
+ else
+ let s:tlist_{fidx}_start = line('$') + 1
+ endif
+ endif
+
+ let s:tlist_{fidx}_visible = 1
+
+ " Goto the line where this file should be placed
+ if g:Tlist_Compact_Format
+ exe s:tlist_{fidx}_start
+ else
+ exe s:tlist_{fidx}_start - 1
+ endif
+
+ let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' .
+ \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')'
+ if g:Tlist_Compact_Format == 0
+ silent! put =txt
+ else
+ silent! put! =txt
+ " Move to the next line
+ exe line('.') + 1
+ endif
+ let file_start = s:tlist_{fidx}_start
+
+ " Add the tag names grouped by tag type to the buffer with a title
+ let i = 1
+ let ttype_cnt = s:tlist_{a:ftype}_count
+ while i <= ttype_cnt
+ let ttype = s:tlist_{a:ftype}_{i}_name
+ " Add the tag type only if there are tags for that type
+ let fidx_ttype = 's:tlist_' . fidx . '_' . ttype
+ let ttype_txt = {fidx_ttype}
+ if ttype_txt != ''
+ let txt = ' ' . s:tlist_{a:ftype}_{i}_fullname
+ if g:Tlist_Compact_Format == 0
+ let ttype_start_lnum = line('.') + 1
+ silent! put =txt
+ else
+ let ttype_start_lnum = line('.')
+ silent! put! =txt
+ endif
+ silent! put =ttype_txt
+
+ let {fidx_ttype}_offset = ttype_start_lnum - file_start
+
+ " create a fold for this tag type
+ let fold_start = ttype_start_lnum
+ let fold_end = fold_start + {fidx_ttype}_count
+ exe fold_start . ',' . fold_end . 'fold'
+
+ " Adjust the cursor position
+ if g:Tlist_Compact_Format == 0
+ exe ttype_start_lnum + {fidx_ttype}_count
+ else
+ exe ttype_start_lnum + {fidx_ttype}_count + 1
+ endif
+
+ if g:Tlist_Compact_Format == 0
+ " Separate the tag types by a empty line
+ silent! put =''
+ endif
+ endif
+ let i = i + 1
+ endwhile
+
+ if s:tlist_{fidx}_tag_count == 0
+ if g:Tlist_Compact_Format == 0
+ silent! put =''
+ endif
+ endif
+
+ let s:tlist_{fidx}_end = line('.') - 1
+
+ " Create a fold for the entire file
+ exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold'
+ exe 'silent! ' . s:tlist_{fidx}_start . ',' .
+ \ s:tlist_{fidx}_end . 'foldopen!'
+
+ " Goto the starting line for this file,
+ exe s:tlist_{fidx}_start
+
+ if s:tlist_app_name == "winmanager"
+ " To handle a bug in the winmanager plugin, add a space at the
+ " last line
+ call setline('$', ' ')
+ endif
+
+ " Mark the buffer as not modifiable
+ setlocal nomodifiable
+
+ " Restore the report option
+ let &report = old_report
+
+ " Update the start and end line numbers for all the files following this
+ " file
+ let start = s:tlist_{fidx}_start
+ " include the empty line after the last line
+ if g:Tlist_Compact_Format
+ let end = s:tlist_{fidx}_end
+ else
+ let end = s:tlist_{fidx}_end + 1
+ endif
+ call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1)
+
+ if !g:Tlist_Use_Horiz_Window && s:auto_width
+ exe 'vertical resize '.g:Tlist_WinWidth
+ endif
+
+ " Now that we have updated the taglist window, update the tags
+ " menu (if present)
+ if g:Tlist_Show_Menu
+ call s:Tlist_Menu_Update_File(1)
+ endif
+endfunction
+
+" Tlist_Init_File
+" Initialize the variables for a new file
+function! s:Tlist_Init_File(filename, ftype)
+ call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')')
+ " Add new files at the end of the list
+ let fidx = s:tlist_file_count
+ let s:tlist_file_count = s:tlist_file_count + 1
+ " Add the new file name to the taglist list of file names
+ let s:tlist_file_names = s:tlist_file_names . a:filename . "\n"
+
+ " Initialize the file variables
+ let s:tlist_{fidx}_filename = a:filename
+ let s:tlist_{fidx}_sort_type = g:Tlist_Sort_Type
+ let s:tlist_{fidx}_filetype = a:ftype
+ let s:tlist_{fidx}_mtime = -1
+ let s:tlist_{fidx}_start = 0
+ let s:tlist_{fidx}_end = 0
+ let s:tlist_{fidx}_valid = 0
+ let s:tlist_{fidx}_visible = 0
+ let s:tlist_{fidx}_tag_count = 0
+ let s:tlist_{fidx}_menu_cmd = ''
+
+ " Initialize the tag type variables
+ let i = 1
+ while i <= s:tlist_{a:ftype}_count
+ let ttype = s:tlist_{a:ftype}_{i}_name
+ let s:tlist_{fidx}_{ttype} = ''
+ let s:tlist_{fidx}_{ttype}_offset = 0
+ let s:tlist_{fidx}_{ttype}_count = 0
+ let i = i + 1
+ endwhile
+
+ return fidx
+endfunction
+
+" Tlist_Get_Tag_Type_By_Tag
+" Return the tag type for the specified tag index
+function! s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx)
+ let ttype_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_type'
+
+ " Already parsed and have the tag name
+ if exists(ttype_var)
+ return {ttype_var}
+ endif
+
+ let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag
+ let {ttype_var} = s:Tlist_Extract_Tagtype(tag_line)
+
+ return {ttype_var}
+endfunction
+
+" Tlist_Get_Tag_Prototype
+function! s:Tlist_Get_Tag_Prototype(fidx, tidx)
+ let tproto_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_proto'
+
+ " Already parsed and have the tag prototype
+ if exists(tproto_var)
+ return {tproto_var}
+ endif
+
+ " Parse and extract the tag prototype
+ let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag
+ let start = stridx(tag_line, '/^') + 2
+ let end = stridx(tag_line, '/;"' . "\t")
+ if tag_line[end - 1] == '$'
+ let end = end -1
+ endif
+ let tag_proto = strpart(tag_line, start, end - start)
+ let {tproto_var} = substitute(tag_proto, '\s*', '', '')
+
+ return {tproto_var}
+endfunction
+
+" Tlist_Get_Tag_SearchPat
+function! s:Tlist_Get_Tag_SearchPat(fidx, tidx)
+ let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat'
+
+ " Already parsed and have the tag search pattern
+ if exists(tpat_var)
+ return {tpat_var}
+ endif
+
+ " Parse and extract the tag search pattern
+ let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag
+ let start = stridx(tag_line, '/^') + 2
+ let end = stridx(tag_line, '/;"' . "\t")
+ if tag_line[end - 1] == '$'
+ let end = end -1
+ endif
+ let {tpat_var} = '\V\^' . strpart(tag_line, start, end - start) .
+ \ (tag_line[end] == '$' ? '\$' : '')
+
+ return {tpat_var}
+endfunction
+
+" Tlist_Get_Tag_Linenum
+" Return the tag line number, given the tag index
+function! s:Tlist_Get_Tag_Linenum(fidx, tidx)
+ let tline_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_linenum'
+
+ " Already parsed and have the tag line number
+ if exists(tline_var)
+ return {tline_var}
+ endif
+
+ " Parse and extract the tag line number
+ let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag
+ let start = match(tag_line, 'line\(no\)\?:')
+ let start = stridx(tag_line, ':', start) + 1
+ let end = stridx(tag_line, "\t", start)
+
+ if end < start
+ let {tline_var} = strpart(tag_line, start) + 0
+ else
+ let {tline_var} = strpart(tag_line, start, end - start) + 0
+ endif
+
+ return {tline_var}
+endfunction
+
+" Tlist_Parse_Tagline
+" Parse a tag line from the ctags output. Separate the tag output based on the
+" tag type and store it in the tag type variable.
+" The format of each line in the ctags output is:
+"
+" tag_name<TAB>file_name<TAB>ex_cmd;"<TAB>extension_fields
+"
+function! s:Tlist_Parse_Tagline(tag_line,ftype)
+ if a:tag_line == ''
+ " Skip empty lines
+ return
+ endif
+
+ " Extract the tag type
+ let ttype = s:Tlist_Extract_Tagtype(a:tag_line)
+
+ " Make sure the tag type is a valid and supported one
+ if ttype == '' || stridx(s:ctags_flags, ttype) == -1
+ " Line is not in proper tags format or Tag type is not supported
+ return
+ endif
+
+ " Update the total tag count
+ let s:tidx = s:tidx + 1
+
+ " The following variables are used to optimize this code. Vim is slow in
+ " using curly brace names. To reduce the amount of processing needed, the
+ " curly brace variables are pre-processed here
+ let fidx_tidx = 's:tlist_' . s:fidx . '_' . s:tidx
+ let fidx_ttype = 's:tlist_' . s:fidx . '_' . ttype
+
+ " Update the count of this tag type
+ let ttype_idx = {fidx_ttype}_count + 1
+ let {fidx_ttype}_count = ttype_idx
+
+ " Store the ctags output for this tag
+ let {fidx_tidx}_tag = a:tag_line
+
+ " Store the tag index and the tag type index (back pointers)
+ let {fidx_ttype}_{ttype_idx} = s:tidx
+ let {fidx_tidx}_ttype_idx = ttype_idx
+
+ " Extract the tag name
+ let tag_name = strpart(a:tag_line, 0, stridx(a:tag_line, "\t"))
+
+ " Extract the tag scope/prototype
+ if g:Tlist_Display_Prototype
+ let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(s:fidx, s:tidx)
+ else
+ let ttxt = ' ' . tag_name
+
+ " Add the tag scope, if it is available and is configured. Tag
+ " scope is the last field after the 'line:<num>\t' field
+ if g:Tlist_Display_Tag_Scope
+ let ttxt .= s:Tlist_Get_Scope_String(a:tag_line, a:ftype)
+ endif
+ endif
+
+ if !g:Tlist_Use_Horiz_Window && s:auto_width
+ " Add 3 for the fold columns
+ let g:Tlist_WinWidth = max([g:Tlist_WinWidth, strlen(ttxt)+3])
+ endif
+
+ " Add this tag to the tag type variable
+ let {fidx_ttype} = {fidx_ttype} . ttxt . "\n"
+
+ " Save the tag name
+ let {fidx_tidx}_tag_name = tag_name
+endfunction
+
+function! s:Tlist_Get_Scope_String(tag_line, ftype)
+ let ttxt = ''
+ let tag_scopes = s:Tlist_Extract_Tag_Scope(a:tag_line)
+ for [extradata_name, extradata_content] in items(tag_scopes)
+ if !exists('g:Tlist_{a:ftype}_Hide_Extras') || match(g:Tlist_{a:ftype}_Hide_Extras, extradata_name) == -1
+ let ttxt = ttxt . ' [' . extradata_content . ']'
+ endif
+ endfor
+ return ttxt
+endfunction
+
+" Tlist_Process_File
+" Get the list of tags defined in the specified file and store them
+" in Vim variables. Returns the file index where the tags are stored.
+function! s:Tlist_Process_File(filename, ftype)
+ call s:Tlist_Log_Msg('Tlist_Process_File (' . a:filename . ', ' .
+ \ a:ftype . ')')
+ " Check whether this file is supported
+ if s:Tlist_Skip_File(a:filename, a:ftype)
+ return -1
+ endif
+
+ " If the tag types for this filetype are not yet created, then create
+ " them now
+ let var = 's:tlist_' . a:ftype . '_count'
+ if !exists(var)
+ if s:Tlist_FileType_Init(a:ftype) == 0
+ return -1
+ endif
+ endif
+
+ " If this file is already processed, then use the cached values
+ let fidx = s:Tlist_Get_File_Index(a:filename)
+ if fidx == -1
+ " First time, this file is loaded
+ let fidx = s:Tlist_Init_File(a:filename, a:ftype)
+ else
+ " File was previously processed. Discard the tag information
+ call s:Tlist_Discard_TagInfo(fidx)
+ endif
+
+ let s:tlist_{fidx}_valid = 1
+
+ " Exuberant ctags arguments to generate a tag list
+ let ctags_args = { '-f': ' -', '--format=': '2', '--excmd=': 'pattern', '--fields=': 'nks' }
+
+ " Form the ctags argument depending on the sort type
+ if s:tlist_{fidx}_sort_type == 'name'
+ let ctags_args['--sort'] = '=yes'
+ else
+ let ctags_args['--sort'] = '=no'
+ endif
+
+ " Add the filetype specific arguments
+ call extend(ctags_args, s:tlist_{a:ftype}_ctags_args)
+
+ " Ctags command to produce output with regexp for locating the tags
+ if exists('g:Tlist_{a:ftype}_Ctags_Cmd')
+ let ctags_cmd = g:Tlist_{a:ftype}_Ctags_Cmd
+ let ctags_args = filter(ctags_args, 'match(g:Tlist_javascript_Ctags_Allowed_Flags, "^".v:key."$") != -1')
+ else
+ let ctags_cmd = g:Tlist_Ctags_Cmd
+ endif
+ let ctags_cmd = ctags_cmd . ' ' . join(values(map(ctags_args, 'v:key . v:val')))
+ let ctags_cmd = ctags_cmd . ' "' . a:filename . '"'
+
+ if &shellxquote == '"'
+ " Double-quotes within double-quotes will not work in the
+ " command-line.If the 'shellxquote' option is set to double-quotes,
+ " then escape the double-quotes in the ctags command-line.
+ let ctags_cmd = escape(ctags_cmd, '"')
+ endif
+
+ " In Windows 95, if not using cygwin, disable the 'shellslash'
+ " option. Otherwise, this will cause problems when running the
+ " ctags command.
+ if has('win95') && !has('win32unix')
+ let old_shellslash = &shellslash
+ set noshellslash
+ endif
+
+ if has('win32') && !has('win32unix') && !has('win95')
+ \ && (&shell =~ 'cmd.exe')
+ " Windows does not correctly deal with commands that have more than 1
+ " set of double quotes. It will strip them all resulting in:
+ " 'C:\Program' is not recognized as an internal or external command
+ " operable program or batch file. To work around this, place the
+ " command inside a batch file and call the batch file.
+ " Do this only on Win2K, WinXP and above.
+ " Contributed by: David Fishburn.
+ let s:taglist_tempfile = fnamemodify(tempname(), ':h') .
+ \ '\taglist.cmd'
+ exe 'redir! > ' . s:taglist_tempfile
+ silent echo ctags_cmd
+ redir END
+
+ call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd)
+ let ctags_cmd = '"' . s:taglist_tempfile . '"'
+ endif
+
+ call s:Tlist_Log_Msg('Cmd: ' . ctags_cmd)
+
+ " Run ctags and get the tag list
+ let cmd_output = system(ctags_cmd)
+
+ " Restore the value of the 'shellslash' option.
+ if has('win95') && !has('win32unix')
+ let &shellslash = old_shellslash
+ endif
+
+ if exists('s:taglist_tempfile')
+ " Delete the temporary cmd file created on MS-Windows
+ call delete(s:taglist_tempfile)
+ endif
+
+ " Handle errors
+ if v:shell_error
+ let msg = "Taglist: Failed to generate tags for " . a:filename
+ call s:Tlist_Warning_Msg(msg)
+ if cmd_output != ''
+ call s:Tlist_Warning_Msg(cmd_output)
+ endif
+ return fidx
+ endif
+
+ " Store the modification time for the file
+ let s:tlist_{fidx}_mtime = getftime(a:filename)
+
+ " No tags for current file
+ if cmd_output == ''
+ call s:Tlist_Log_Msg('No tags defined in ' . a:filename)
+ return fidx
+ endif
+
+ call s:Tlist_Log_Msg('Generated tags information for ' . a:filename)
+
+ if v:version > 601
+ " The following script local variables are used by the
+ " Tlist_Parse_Tagline() function.
+ let s:ctags_flags = s:tlist_{a:ftype}_ctags_flags
+ let s:fidx = fidx
+ let s:tidx = 0
+
+ " Tlist_Parse_Tagline will adjust this accordingly
+ if !g:Tlist_Use_Horiz_Window && s:auto_width
+ let g:Tlist_WinWidth = 0
+ endif
+
+ " Process the ctags output one line at a time. The substitute()
+ " command is used to parse the tag lines instead of using the
+ " matchstr()/stridx()/strpart() functions for performance reason
+ call substitute(cmd_output, "\\([^\n]\\+\\)\n",
+ \ '\=s:Tlist_Parse_Tagline(submatch(1),a:ftype)', 'g')
+
+ " Save the number of tags for this file
+ let s:tlist_{fidx}_tag_count = s:tidx
+
+ " The following script local variables are no longer needed
+ unlet! s:ctags_flags
+ unlet! s:tidx
+ unlet! s:fidx
+ else
+ " Due to a bug in Vim earlier than version 6.1,
+ " we cannot use substitute() to parse the ctags output.
+ " Instead the slow str*() functions are used
+ let ctags_flags = s:tlist_{a:ftype}_ctags_flags
+ let tidx = 0
+
+ while cmd_output != ''
+ " Extract one line at a time
+ let idx = stridx(cmd_output, "\n")
+ let one_line = strpart(cmd_output, 0, idx)
+ " Remove the line from the tags output
+ let cmd_output = strpart(cmd_output, idx + 1)
+
+ if one_line == ''
+ " Line is not in proper tags format
+ continue
+ endif
+
+ " Extract the tag type
+ let ttype = s:Tlist_Extract_Tagtype(one_line)
+
+ " Make sure the tag type is a valid and supported one
+ if ttype == '' || stridx(ctags_flags, ttype) == -1
+ " Line is not in proper tags format or Tag type is not
+ " supported
+ continue
+ endif
+
+ " Update the total tag count
+ let tidx = tidx + 1
+
+ " The following variables are used to optimize this code. Vim is
+ " slow in using curly brace names. To reduce the amount of
+ " processing needed, the curly brace variables are pre-processed
+ " here
+ let fidx_tidx = 's:tlist_' . fidx . '_' . tidx
+ let fidx_ttype = 's:tlist_' . fidx . '_' . ttype
+
+ " Update the count of this tag type
+ let ttype_idx = {fidx_ttype}_count + 1
+ let {fidx_ttype}_count = ttype_idx
+
+ " Store the ctags output for this tag
+ let {fidx_tidx}_tag = one_line
+
+ " Store the tag index and the tag type index (back pointers)
+ let {fidx_ttype}_{ttype_idx} = tidx
+ let {fidx_tidx}_ttype_idx = ttype_idx
+
+ " Extract the tag name
+ let tag_name = strpart(one_line, 0, stridx(one_line, "\t"))
+
+ " Extract the tag scope/prototype
+ if g:Tlist_Display_Prototype
+ let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(fidx, tidx)
+ else
+ let ttxt = ' ' . tag_name
+
+ " Add the tag scope, if it is available and is configured. Tag
+ " scope is the last field after the 'line:<num>\t' field
+ if g:Tlist_Display_Tag_Scope
+ let ttxt .= s:Tlist_Get_Scope_String(a:tag_line, a:ftype)
+ endif
+ endif
+
+ " Add this tag to the tag type variable
+ let {fidx_ttype} = {fidx_ttype} . ttxt . "\n"
+
+ " Save the tag name
+ let {fidx_tidx}_tag_name = tag_name
+ endwhile
+
+ " Save the number of tags for this file
+ let s:tlist_{fidx}_tag_count = tidx
+ endif
+
+ call s:Tlist_Log_Msg('Processed ' . s:tlist_{fidx}_tag_count .
+ \ ' tags in ' . a:filename)
+
+ return fidx
+endfunction
+
+" Tlist_Update_File
+" Update the tags for a file (if needed)
+function! Tlist_Update_File(filename, ftype)
+ call s:Tlist_Log_Msg('Tlist_Update_File (' . a:filename . ')')
+ " If the file doesn't support tag listing, skip it
+ if s:Tlist_Skip_File(a:filename, a:ftype)
+ return
+ endif
+
+ " Convert the file name to a full path
+ let fname = fnamemodify(a:filename, ':p')
+
+ " First check whether the file already exists
+ let fidx = s:Tlist_Get_File_Index(fname)
+
+ if fidx != -1 && s:tlist_{fidx}_valid
+ " File exists and the tags are valid
+ " Check whether the file was modified after the last tags update
+ " If it is modified, then update the tags
+ if s:tlist_{fidx}_mtime == getftime(fname)
+ return
+ endif
+ else
+ " If the tags were removed previously based on a user request,
+ " as we are going to update the tags (based on the user request),
+ " remove the filename from the deleted list
+ call s:Tlist_Update_Remove_List(fname, 0)
+ endif
+
+ " If the taglist window is opened, update it
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum == -1
+ " Taglist window is not present. Just update the taglist
+ " and return
+ call s:Tlist_Process_File(fname, a:ftype)
+ else
+ if g:Tlist_Show_One_File && s:tlist_cur_file_idx != -1
+ " If tags for only one file are displayed and we are not
+ " updating the tags for that file, then no need to
+ " refresh the taglist window. Otherwise, the taglist
+ " window should be updated.
+ if s:tlist_{s:tlist_cur_file_idx}_filename != fname
+ call s:Tlist_Process_File(fname, a:ftype)
+ return
+ endif
+ endif
+
+ " Save the current window number
+ let save_winnr = winnr()
+
+ " Goto the taglist window
+ call s:Tlist_Window_Goto_Window()
+
+ " Save the cursor position
+ let save_line = line('.')
+ let save_col = col('.')
+
+ " Update the taglist window
+ call s:Tlist_Window_Refresh_File(fname, a:ftype)
+
+ " Restore the cursor position
+ if v:version >= 601
+ call cursor(save_line, save_col)
+ else
+ exe save_line
+ exe 'normal! ' . save_col . '|'
+ endif
+
+ if winnr() != save_winnr
+ " Go back to the original window
+ call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w')
+ endif
+ endif
+
+ " Update the taglist menu
+ if g:Tlist_Show_Menu
+ call s:Tlist_Menu_Update_File(1)
+ endif
+endfunction
+
+" Tlist_Window_Close
+" Close the taglist window
+function! s:Tlist_Window_Close()
+ call s:Tlist_Log_Msg('Tlist_Window_Close()')
+ " Make sure the taglist window exists
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum == -1
+ call s:Tlist_Warning_Msg('Error: Taglist window is not open')
+ return
+ endif
+
+ if winnr() == winnum
+ " Already in the taglist window. Close it and return.
+ " Store the buffer that was selected prior to the taglist buffer
+ let prev_buf = bufnr('#')
+ if winbufnr(2) != -1
+ " If a window other than the taglist window is open,
+ " then only close the taglist window.
+ close
+ call s:Tlist_Exe_Cmd_No_Acmds(bufwinnr(prev_buf) . 'wincmd w')
+ endif
+ else
+ " Goto the taglist window, close it and then come back to the
+ " original window
+ let curbufnr = bufnr('%')
+ exe winnum . 'wincmd w'
+ close
+ " Need to jump back to the original window only if we are not
+ " already in that window
+ let winnum = bufwinnr(curbufnr)
+ if winnr() != winnum
+ exe winnum . 'wincmd w'
+ endif
+ endif
+endfunction
+
+" Tlist_Window_Mark_File_Window
+" Mark the current window as the file window to use when jumping to a tag.
+" Only if the current window is a non-plugin, non-preview and non-taglist
+" window
+function! s:Tlist_Window_Mark_File_Window()
+ if getbufvar('%', '&buftype') == '' && !&previewwindow
+ let w:tlist_file_window = "yes"
+ endif
+endfunction
+
+" Tlist_Window_Open
+" Open and refresh the taglist window
+function! s:Tlist_Window_Open()
+ call s:Tlist_Log_Msg('Tlist_Window_Open()')
+ " If the window is open, jump to it
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ " Jump to the existing window
+ if winnr() != winnum
+ exe winnum . 'wincmd w'
+ endif
+ return
+ endif
+
+ if s:tlist_app_name == "winmanager"
+ " Taglist plugin is no longer part of the winmanager app
+ let s:tlist_app_name = "none"
+ endif
+
+ " Get the filename and filetype for the specified buffer
+ let curbuf_name = fnamemodify(bufname('%'), ':p')
+ let curbuf_ftype = s:Tlist_Get_Buffer_Filetype('%')
+ let cur_lnum = line('.')
+
+ " Mark the current window as the desired window to open a file when a tag
+ " is selected.
+ call s:Tlist_Window_Mark_File_Window()
+
+ " Open the taglist window
+ call s:Tlist_Window_Create()
+
+ call s:Tlist_Window_Refresh()
+
+ if g:Tlist_Show_One_File
+ " Add only the current buffer and file
+ "
+ " If the file doesn't support tag listing, skip it
+ if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype)
+ call s:Tlist_Window_Refresh_File(curbuf_name, curbuf_ftype)
+ endif
+ endif
+
+ if g:Tlist_File_Fold_Auto_Close
+ " Open the fold for the current file, as all the folds in
+ " the taglist window are closed
+ let fidx = s:Tlist_Get_File_Index(curbuf_name)
+ if fidx != -1
+ exe "silent! " . s:tlist_{fidx}_start . "," .
+ \ s:tlist_{fidx}_end . "foldopen!"
+ endif
+ endif
+
+ " Highlight the current tag
+ call s:Tlist_Window_Highlight_Tag(curbuf_name, cur_lnum, 1, 1)
+endfunction
+
+" Tlist_Window_Toggle()
+" Open or close a taglist window
+function! s:Tlist_Window_Toggle()
+ call s:Tlist_Log_Msg('Tlist_Window_Toggle()')
+ " If taglist window is open then close it.
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ call s:Tlist_Window_Close()
+ return
+ endif
+
+ " Store the current buffer
+ let current_buf = winbufnr(0)
+ call s:Tlist_Window_Open()
+
+ " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not
+ " set
+ if !g:Tlist_GainFocus_On_ToggleOpen
+ let prev_win = bufwinnr(current_buf)
+ call s:Tlist_Exe_Cmd_No_Acmds(prev_win . 'wincmd w')
+ endif
+
+ " Update the taglist menu
+ if g:Tlist_Show_Menu
+ call s:Tlist_Menu_Update_File(0)
+ endif
+endfunction
+
+" Tlist_Process_Filelist
+" Process multiple files. Each filename is separated by "\n"
+" Returns the number of processed files
+function! s:Tlist_Process_Filelist(file_names)
+ let flist = a:file_names
+
+ " Enable lazy screen updates
+ let old_lazyredraw = &lazyredraw
+ set lazyredraw
+
+ " Keep track of the number of processed files
+ let fcnt = 0
+
+ " Process one file at a time
+ while flist != ''
+ let nl_idx = stridx(flist, "\n")
+ let one_file = strpart(flist, 0, nl_idx)
+
+ " Remove the filename from the list
+ let flist = strpart(flist, nl_idx + 1)
+
+ if one_file == ''
+ continue
+ endif
+
+ " Skip directories
+ if isdirectory(one_file)
+ continue
+ endif
+
+ let ftype = s:Tlist_Detect_Filetype(one_file)
+
+ echon "\r "
+ echon "\rProcessing tags for " . fnamemodify(one_file, ':p:t')
+
+ let fcnt = fcnt + 1
+
+ call Tlist_Update_File(one_file, ftype)
+ endwhile
+
+ " Clear the displayed informational messages
+ echon "\r "
+
+ " Restore the previous state
+ let &lazyredraw = old_lazyredraw
+
+ return fcnt
+endfunction
+
+" Tlist_Process_Dir
+" Process the files in a directory matching the specified pattern
+function! s:Tlist_Process_Dir(dir_name, pat)
+ let flist = glob(a:dir_name . '/' . a:pat) . "\n"
+
+ let fcnt = s:Tlist_Process_Filelist(flist)
+
+ let len = strlen(a:dir_name)
+ if a:dir_name[len - 1] == '\' || a:dir_name[len - 1] == '/'
+ let glob_expr = a:dir_name . '*'
+ else
+ let glob_expr = a:dir_name . '/*'
+ endif
+ let all_files = glob(glob_expr) . "\n"
+
+ while all_files != ''
+ let nl_idx = stridx(all_files, "\n")
+ let one_file = strpart(all_files, 0, nl_idx)
+
+ let all_files = strpart(all_files, nl_idx + 1)
+ if one_file == ''
+ continue
+ endif
+
+ " Skip non-directory names
+ if !isdirectory(one_file)
+ continue
+ endif
+
+ echon "\r "
+ echon "\rProcessing files in directory " . fnamemodify(one_file, ':t')
+ let fcnt = fcnt + s:Tlist_Process_Dir(one_file, a:pat)
+ endwhile
+
+ return fcnt
+endfunction
+
+" Tlist_Add_Files_Recursive
+" Add files recursively from a directory
+function! s:Tlist_Add_Files_Recursive(dir, ...)
+ let dir_name = fnamemodify(a:dir, ':p')
+ if !isdirectory(dir_name)
+ call s:Tlist_Warning_Msg('Error: ' . dir_name . ' is not a directory')
+ return
+ endif
+
+ if a:0 == 1
+ " User specified file pattern
+ let pat = a:1
+ else
+ " Default file pattern
+ let pat = '*'
+ endif
+
+ echon "\r "
+ echon "\rProcessing files in directory " . fnamemodify(dir_name, ':t')
+ let fcnt = s:Tlist_Process_Dir(dir_name, pat)
+
+ echon "\rAdded " . fcnt . " files to the taglist"
+endfunction
+
+" Tlist_Add_Files
+" Add the specified list of files to the taglist
+function! s:Tlist_Add_Files(...)
+ let flist = ''
+ let i = 1
+
+ " Get all the files matching the file patterns supplied as argument
+ while i <= a:0
+ let flist = flist . glob(a:{i}) . "\n"
+ let i = i + 1
+ endwhile
+
+ if flist == ''
+ call s:Tlist_Warning_Msg('Error: No matching files are found')
+ return
+ endif
+
+ let fcnt = s:Tlist_Process_Filelist(flist)
+ echon "\rAdded " . fcnt . " files to the taglist"
+endfunction
+
+" Tlist_Extract_Tagtype
+" Extract the tag type from the tag text
+function! s:Tlist_Extract_Tagtype(tag_line)
+ " The tag type is after the tag prototype field. The prototype field
+ " ends with the /;"\t string. We add 4 at the end to skip the characters
+ " in this special string..
+ let start = strridx(a:tag_line, '/;"' . "\t") + 4
+ let end = match(a:tag_line, 'line\(no\)\?:') - 1
+ let ttype = strpart(a:tag_line, start, end - start)
+
+ return ttype
+endfunction
+
+" Tlist_Extract_Tag_Scope
+" Extract the tag scope from the tag text
+function! s:Tlist_Extract_Tag_Scope(tag_line)
+ let start = match(a:tag_line, 'line\(no\)\?:')
+ let end = stridx(a:tag_line, "\t", start)
+ if end <= start
+ return {}
+ endif
+
+ let tag_extras = {}
+
+ let tag_extra = strpart(a:tag_line, end + 1)
+ while tag_extra != ''
+ let tag_extra_separator_start = stridx(tag_extra, ':')
+ let tag_extra_content_start = tag_extra_separator_start + 1
+ let tag_extra_content_end = stridx(tag_extra, "\t")
+ if tag_extra_content_end == -1
+ let tag_extra_content_end = strlen(tag_extra)
+ endif
+ let tag_extra_name = strpart(tag_extra, 0, tag_extra_separator_start)
+ let tag_extra_content = strpart(tag_extra, tag_extra_content_start, tag_extra_content_end - tag_extra_content_start)
+ let tag_extras[tag_extra_name] = tag_extra_content
+ let tag_extra = strpart(tag_extra, tag_extra_content_end + 1)
+ endwhile
+
+ return tag_extras
+endfunction
+
+function! s:Tlist_Window_Toggle_Extra(ftype, extra_name)
+ if !exists('g:Tlist_{a:ftype}_Hide_Extras')
+ return
+ endif
+ let index = index(g:Tlist_{a:ftype}_Hide_Extras, a:extra_name)
+ if index == -1
+ call add(g:Tlist_{a:ftype}_Hide_Extras, a:extra_name)
+ else
+ unlet g:Tlist_{a:ftype}_Hide_Extras[index]
+ endif
+ if s:auto_width
+ let g:Tlist_WinWidth = 30
+ endif
+
+ let cur_lnum = line('.')
+ let cur_col = col('.')
+ call s:Tlist_Window_Update_File()
+ call s:Tlist_Window_Check_Width()
+ call cursor(cur_lnum, cur_col)
+endfunction
+
+" Tlist_Refresh()
+" Refresh the taglist
+function! s:Tlist_Refresh()
+ call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' .
+ \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')')
+ " If we are entering the buffer from one of the taglist functions, then
+ " no need to refresh the taglist window again.
+ if s:Tlist_Skip_Refresh
+ " We still need to update the taglist menu
+ if g:Tlist_Show_Menu
+ call s:Tlist_Menu_Update_File(0)
+ endif
+ return
+ endif
+
+ " If part of the winmanager plugin and not configured to process
+ " tags always and not configured to display the tags menu, then return
+ if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always
+ \ && !g:Tlist_Show_Menu
+ return
+ endif
+
+ " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help
+ if &buftype != ''
+ return
+ endif
+
+ let filename = fnamemodify(bufname('%'), ':p')
+ let ftype = s:Tlist_Get_Buffer_Filetype('%')
+
+ " If the file doesn't support tag listing, skip it
+ if s:Tlist_Skip_File(filename, ftype)
+ return
+ endif
+
+ let tlist_win = bufwinnr(g:TagList_title)
+
+ " If the taglist window is not opened and not configured to process
+ " tags always and not displaying the tags menu, then return
+ if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu
+ return
+ endif
+
+ let fidx = s:Tlist_Get_File_Index(filename)
+ if fidx == -1
+ " Check whether this file is removed based on user request
+ " If it is, then don't display the tags for this file
+ if s:Tlist_User_Removed_File(filename)
+ return
+ endif
+
+ " If the taglist should not be auto updated, then return
+ if !g:Tlist_Auto_Update
+ return
+ endif
+ endif
+
+ let cur_lnum = line('.')
+
+ if fidx == -1
+ " Update the tags for the file
+ let fidx = s:Tlist_Process_File(filename, ftype)
+ else
+ let mtime = getftime(filename)
+ if s:tlist_{fidx}_mtime != mtime
+ " Invalidate the tags listed for this file
+ let s:tlist_{fidx}_valid = 0
+
+ " Update the taglist and the window
+ call Tlist_Update_File(filename, ftype)
+
+ " Store the new file modification time
+ let s:tlist_{fidx}_mtime = mtime
+ endif
+ endif
+
+ " Update the taglist window
+ if tlist_win != -1
+ " Disable screen updates
+ let old_lazyredraw = &lazyredraw
+ set nolazyredraw
+
+ " Save the current window number
+ let save_winnr = winnr()
+
+ " Goto the taglist window
+ call s:Tlist_Window_Goto_Window()
+
+ if !g:Tlist_Auto_Highlight_Tag || !g:Tlist_Highlight_Tag_On_BufEnter
+ " Save the cursor position
+ let save_line = line('.')
+ let save_col = col('.')
+ endif
+
+ " Update the taglist window
+ call s:Tlist_Window_Refresh_File(filename, ftype)
+
+ " Open the fold for the file
+ exe "silent! " . s:tlist_{fidx}_start . "," .
+ \ s:tlist_{fidx}_end . "foldopen!"
+
+ if g:Tlist_Highlight_Tag_On_BufEnter && g:Tlist_Auto_Highlight_Tag
+ if g:Tlist_Show_One_File && s:tlist_cur_file_idx != fidx
+ " If displaying tags for only one file in the taglist
+ " window and about to display the tags for a new file,
+ " then center the current tag line for the new file
+ let center_tag_line = 1
+ else
+ let center_tag_line = 0
+ endif
+
+ " Highlight the current tag
+ call s:Tlist_Window_Highlight_Tag(filename, cur_lnum, 1, center_tag_line)
+ else
+ " Restore the cursor position
+ if v:version >= 601
+ call cursor(save_line, save_col)
+ else
+ exe save_line
+ exe 'normal! ' . save_col . '|'
+ endif
+ endif
+
+ " Jump back to the original window
+ if save_winnr != winnr()
+ call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w')
+ endif
+
+ " Restore screen updates
+ let &lazyredraw = old_lazyredraw
+ endif
+
+ " Update the taglist menu
+ if g:Tlist_Show_Menu
+ call s:Tlist_Menu_Update_File(0)
+ endif
+endfunction
+
+" Tlist_Change_Sort()
+" Change the sort order of the tag listing
+" caller == 'cmd', command used in the taglist window
+" caller == 'menu', taglist menu
+" action == 'toggle', toggle sort from name to order and vice versa
+" action == 'set', set the sort order to sort_type
+function! s:Tlist_Change_Sort(caller, action, sort_type)
+ call s:Tlist_Log_Msg('Tlist_Change_Sort (caller = ' . a:caller .
+ \ ', action = ' . a:action . ', sort_type = ' . a:sort_type . ')')
+ if a:caller == 'cmd'
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.'))
+ if fidx == -1
+ return
+ endif
+
+ " Remove the previous highlighting
+ match none
+ elseif a:caller == 'menu'
+ let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p'))
+ if fidx == -1
+ return
+ endif
+ endif
+
+ if a:action == 'toggle'
+ let sort_type = s:tlist_{fidx}_sort_type
+
+ " Toggle the sort order from 'name' to 'order' and vice versa
+ if sort_type == 'name'
+ let s:tlist_{fidx}_sort_type = 'order'
+ else
+ let s:tlist_{fidx}_sort_type = 'name'
+ endif
+ else
+ let s:tlist_{fidx}_sort_type = a:sort_type
+ endif
+
+ " Invalidate the tags listed for this file
+ let s:tlist_{fidx}_valid = 0
+
+ if a:caller == 'cmd'
+ " Save the current line for later restoration
+ let curline = '\V\^' . getline('.') . '\$'
+
+ call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename,
+ \ s:tlist_{fidx}_filetype)
+
+ exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!'
+
+ " Go back to the cursor line before the tag list is sorted
+ call search(curline, 'w')
+
+ call s:Tlist_Menu_Update_File(1)
+ else
+ call s:Tlist_Menu_Remove_File()
+
+ call s:Tlist_Refresh()
+ endif
+endfunction
+
+" Tlist_Update_Current_File()
+" Update taglist for the current buffer by regenerating the tag list
+" Contributed by WEN Guopeng.
+function! s:Tlist_Update_Current_File()
+ call s:Tlist_Log_Msg('Tlist_Update_Current_File()')
+ if winnr() == bufwinnr(g:TagList_title)
+ " In the taglist window. Update the current file
+ call s:Tlist_Window_Update_File()
+ else
+ " Not in the taglist window. Update the current buffer
+ let filename = fnamemodify(bufname('%'), ':p')
+ let fidx = s:Tlist_Get_File_Index(filename)
+ if fidx != -1
+ let s:tlist_{fidx}_valid = 0
+ endif
+ let ft = s:Tlist_Get_Buffer_Filetype('%')
+ call Tlist_Update_File(filename, ft)
+ endif
+endfunction
+
+" Tlist_Window_Update_File()
+" Update the tags displayed in the taglist window
+function! s:Tlist_Window_Update_File()
+ call s:Tlist_Log_Msg('Tlist_Window_Update_File()')
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.'))
+ if fidx == -1
+ return
+ endif
+
+ " Remove the previous highlighting
+ match none
+
+ " Save the current line for later restoration
+ let curline = '\V\^' . getline('.') . '\$'
+
+ let s:tlist_{fidx}_valid = 0
+
+ " Update the taglist window
+ call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename,
+ \ s:tlist_{fidx}_filetype)
+
+ exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!'
+
+ " Go back to the tag line before the list is updated
+ call search(curline, 'w')
+endfunction
+
+" Tlist_Window_Get_Tag_Type_By_Linenum()
+" Return the tag type index for the specified line in the taglist window
+function! s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum)
+ let ftype = s:tlist_{a:fidx}_filetype
+
+ " Determine to which tag type the current line number belongs to using the
+ " tag type start line number and the number of tags in a tag type
+ let i = 1
+ while i <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{i}_name
+ let start_lnum =
+ \ s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset
+ let end = start_lnum + s:tlist_{a:fidx}_{ttype}_count
+ if a:lnum >= start_lnum && a:lnum <= end
+ break
+ endif
+ let i = i + 1
+ endwhile
+
+ " Current line doesn't belong to any of the displayed tag types
+ if i > s:tlist_{ftype}_count
+ return ''
+ endif
+
+ return ttype
+endfunction
+
+" Tlist_Window_Get_Tag_Index()
+" Return the tag index for the specified line in the taglist window
+function! s:Tlist_Window_Get_Tag_Index(fidx, lnum)
+ let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(a:fidx, a:lnum)
+
+ " Current line doesn't belong to any of the displayed tag types
+ if ttype == ''
+ return 0
+ endif
+
+ " Compute the index into the displayed tags for the tag type
+ let ttype_lnum = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset
+ let tidx = a:lnum - ttype_lnum
+ if tidx == 0
+ return 0
+ endif
+
+ " Get the corresponding tag line and return it
+ return s:tlist_{a:fidx}_{ttype}_{tidx}
+endfunction
+
+" Tlist_Window_Highlight_Line
+" Highlight the current line
+function! s:Tlist_Window_Highlight_Line()
+ " Clear previously selected name
+ match none
+
+ " Highlight the current line
+ if g:Tlist_Display_Prototype == 0
+ let pat = '/\%' . line('.') . 'l\s\+\zs.*/'
+ else
+ let pat = '/\%' . line('.') . 'l.*/'
+ endif
+
+ exe 'match TagListTagName ' . pat
+endfunction
+
+" Tlist_Window_Open_File
+" Open the specified file in either a new window or an existing window
+" and place the cursor at the specified tag pattern
+function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat)
+ call s:Tlist_Log_Msg('Tlist_Window_Open_File (' . a:filename . ',' .
+ \ a:win_ctrl . ')')
+ let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh
+ let s:Tlist_Skip_Refresh = 1
+
+ if s:tlist_app_name == "winmanager"
+ " Let the winmanager edit the file
+ call WinManagerFileEdit(a:filename, a:win_ctrl == 'newwin')
+ else
+
+ if a:win_ctrl == 'newtab'
+ " Create a new tab
+ exe 'tabnew ' . escape(a:filename, ' ')
+ " Open the taglist window in the new tab
+ call s:Tlist_Window_Open()
+ endif
+
+ if a:win_ctrl == 'checktab'
+ " Check whether the file is present in any of the tabs.
+ " If the file is present in the current tab, then use the
+ " current tab.
+ if bufwinnr(a:filename) != -1
+ let file_present_in_tab = 1
+ let i = tabpagenr()
+ else
+ let i = 1
+ let bnum = bufnr(a:filename)
+ let file_present_in_tab = 0
+ while i <= tabpagenr('$')
+ if index(tabpagebuflist(i), bnum) != -1
+ let file_present_in_tab = 1
+ break
+ endif
+ let i += 1
+ endwhile
+ endif
+
+ if file_present_in_tab
+ " Goto the tab containing the file
+ exe 'tabnext ' . i
+ else
+ " Open a new tab
+ exe 'tabnew ' . escape(a:filename, ' ')
+
+ " Open the taglist window
+ call s:Tlist_Window_Open()
+ endif
+ endif
+
+ let winnum = -1
+ if a:win_ctrl == 'prevwin'
+ " Open the file in the previous window, if it is usable
+ let cur_win = winnr()
+ wincmd p
+ if &buftype == '' && !&previewwindow
+ exe "edit " . escape(a:filename, ' ')
+ let winnum = winnr()
+ else
+ " Previous window is not usable
+ exe cur_win . 'wincmd w'
+ endif
+ endif
+
+ " Goto the window containing the file. If the window is not there, open a
+ " new window
+ if winnum == -1
+ let winnum = bufwinnr(a:filename)
+ endif
+
+ if winnum == -1
+ " Locate the previously used window for opening a file
+ let fwin_num = 0
+ let first_usable_win = 0
+
+ let i = 1
+ let bnum = winbufnr(i)
+ while bnum != -1
+ if getwinvar(i, 'tlist_file_window') == 'yes'
+ let fwin_num = i
+ break
+ endif
+ if first_usable_win == 0 &&
+ \ getbufvar(bnum, '&buftype') == '' &&
+ \ !getwinvar(i, '&previewwindow')
+ " First non-taglist, non-plugin and non-preview window
+ let first_usable_win = i
+ endif
+ let i = i + 1
+ let bnum = winbufnr(i)
+ endwhile
+
+ " If a previously used window is not found, then use the first
+ " non-taglist window
+ if fwin_num == 0
+ let fwin_num = first_usable_win
+ endif
+
+ if fwin_num != 0
+ " Jump to the file window
+ exe fwin_num . "wincmd w"
+
+ " If the user asked to jump to the tag in a new window, then split
+ " the existing window into two.
+ if a:win_ctrl == 'newwin'
+ split
+ endif
+ exe "edit " . escape(a:filename, ' ')
+ else
+ " Open a new window
+ if g:Tlist_Use_Horiz_Window
+ exe 'leftabove split ' . escape(a:filename, ' ')
+ else
+ if winbufnr(2) == -1
+ " Only the taglist window is present
+ if g:Tlist_Use_Right_Window
+ exe 'leftabove vertical split ' .
+ \ escape(a:filename, ' ')
+ else
+ exe 'rightbelow vertical split ' .
+ \ escape(a:filename, ' ')
+ endif
+
+ " Go to the taglist window to change the window size to
+ " the user configured value
+ call s:Tlist_Exe_Cmd_No_Acmds('wincmd p')
+ if g:Tlist_Use_Horiz_Window
+ exe 'resize ' . g:Tlist_WinHeight
+ else
+ exe 'vertical resize ' . g:Tlist_WinWidth
+ endif
+ " Go back to the file window
+ call s:Tlist_Exe_Cmd_No_Acmds('wincmd p')
+ else
+ " A plugin or help window is also present
+ wincmd w
+ exe 'leftabove split ' . escape(a:filename, ' ')
+ endif
+ endif
+ endif
+ " Mark the window, so that it can be reused.
+ call s:Tlist_Window_Mark_File_Window()
+ else
+ if v:version >= 700
+ " If the file is opened in more than one window, then check
+ " whether the last accessed window has the selected file.
+ " If it does, then use that window.
+ let lastwin_bufnum = winbufnr(winnr('#'))
+ if bufnr(a:filename) == lastwin_bufnum
+ let winnum = winnr('#')
+ endif
+ endif
+ exe winnum . 'wincmd w'
+
+ " If the user asked to jump to the tag in a new window, then split the
+ " existing window into two.
+ if a:win_ctrl == 'newwin'
+ split
+ endif
+ endif
+ endif
+
+ " Jump to the tag
+ if a:tagpat != ''
+ " Add the current cursor position to the jump list, so that user can
+ " jump back using the ' and ` marks.
+ mark '
+ silent call search(a:tagpat, 'w')
+
+ " Bring the line to the middle of the window
+ normal! z.
+
+ " If the line is inside a fold, open the fold
+ if foldclosed('.') != -1
+ .foldopen
+ endif
+ endif
+
+ " If the user selects to preview the tag then jump back to the
+ " taglist window
+ if a:win_ctrl == 'preview'
+ " Go back to the taglist window
+ let winnum = bufwinnr(g:TagList_title)
+ exe winnum . 'wincmd w'
+ else
+ " If the user has selected to close the taglist window, when a
+ " tag is selected, close the taglist window
+ if g:Tlist_Close_On_Select
+ call s:Tlist_Window_Goto_Window()
+ close
+
+ " Go back to the window displaying the selected file
+ let wnum = bufwinnr(a:filename)
+ if wnum != -1 && wnum != winnr()
+ call s:Tlist_Exe_Cmd_No_Acmds(wnum . 'wincmd w')
+ endif
+ endif
+ endif
+
+ let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh
+endfunction
+
+" Tlist_Window_Jump_To_Tag()
+" Jump to the location of the current tag
+" win_ctrl == useopen - Reuse the existing file window
+" win_ctrl == newwin - Open a new window
+" win_ctrl == preview - Preview the tag
+" win_ctrl == prevwin - Open in previous window
+" win_ctrl == newtab - Open in new tab
+function! s:Tlist_Window_Jump_To_Tag(win_ctrl)
+ call s:Tlist_Log_Msg('Tlist_Window_Jump_To_Tag(' . a:win_ctrl . ')')
+ " Do not process comment lines and empty lines
+ let curline = getline('.')
+ if curline =~ '^\s*$' || curline[0] == '"'
+ return
+ endif
+
+ " If inside a closed fold, then use the first line of the fold
+ " and jump to the file.
+ let lnum = foldclosed('.')
+ if lnum == -1
+ " Jump to the selected tag or file
+ let lnum = line('.')
+ else
+ " Open the closed fold
+ .foldopen!
+ endif
+
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum)
+ if fidx == -1
+ return
+ endif
+
+ " Get the tag output for the current tag
+ let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum)
+ if tidx != 0
+ let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, tidx)
+
+ " Highlight the tagline
+ call s:Tlist_Window_Highlight_Line()
+ else
+ " Selected a line which is not a tag name. Just edit the file
+ let tagpat = ''
+ endif
+
+ call s:Tlist_Window_Open_File(a:win_ctrl, s:tlist_{fidx}_filename, tagpat)
+endfunction
+
+" Tlist_Window_Show_Info()
+" Display information about the entry under the cursor
+function! s:Tlist_Window_Show_Info()
+ call s:Tlist_Log_Msg('Tlist_Window_Show_Info()')
+
+ " Clear the previously displayed line
+ echo
+
+ " Do not process comment lines and empty lines
+ let curline = getline('.')
+ if curline =~ '^\s*$' || curline[0] == '"'
+ return
+ endif
+
+ " If inside a fold, then don't display the prototype
+ if foldclosed('.') != -1
+ return
+ endif
+
+ let lnum = line('.')
+
+ " Get the file index
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum)
+ if fidx == -1
+ return
+ endif
+
+ if lnum == s:tlist_{fidx}_start
+ " Cursor is on a file name
+ let fname = s:tlist_{fidx}_filename
+ if strlen(fname) > 50
+ let fname = fnamemodify(fname, ':t')
+ endif
+ echo fname . ', Filetype=' . s:tlist_{fidx}_filetype .
+ \ ', Tag count=' . s:tlist_{fidx}_tag_count
+ return
+ endif
+
+ " Get the tag output line for the current tag
+ let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum)
+ if tidx == 0
+ " Cursor is on a tag type
+ let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum)
+ if ttype == ''
+ return
+ endif
+
+ let ttype_name = ''
+
+ let ftype = s:tlist_{fidx}_filetype
+ let i = 1
+ while i <= s:tlist_{ftype}_count
+ if ttype == s:tlist_{ftype}_{i}_name
+ let ttype_name = s:tlist_{ftype}_{i}_fullname
+ break
+ endif
+ let i = i + 1
+ endwhile
+
+ echo 'Tag type=' . ttype_name .
+ \ ', Tag count=' . s:tlist_{fidx}_{ttype}_count
+ return
+ endif
+
+ " Get the tag search pattern and display it
+ echo s:Tlist_Get_Tag_Prototype(fidx, tidx)
+endfunction
+
+" Tlist_Find_Nearest_Tag_Idx
+" Find the tag idx nearest to the supplied line number
+" Returns -1, if a tag couldn't be found for the specified line number
+function! s:Tlist_Find_Nearest_Tag_Idx(fidx, linenum)
+ let sort_type = s:tlist_{a:fidx}_sort_type
+
+ let left = 1
+ let right = s:tlist_{a:fidx}_tag_count
+
+ if sort_type == 'order'
+ " Tags sorted by order, use a binary search.
+ " The idea behind this function is taken from the ctags.vim script (by
+ " Alexey Marinichev) available at the Vim online website.
+
+ " If the current line is the less than the first tag, then no need to
+ " search
+ let first_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, 1)
+
+ if a:linenum < first_lnum
+ return -1
+ endif
+
+ while left < right
+ let middle = (right + left + 1) / 2
+ let middle_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, middle)
+
+ if middle_lnum == a:linenum
+ let left = middle
+ break
+ endif
+
+ if middle_lnum > a:linenum
+ let right = middle - 1
+ else
+ let left = middle
+ endif
+ endwhile
+ else
+ " Tags sorted by name, use a linear search. (contributed by Dave
+ " Eggum).
+ " Look for a tag with a line number less than or equal to the supplied
+ " line number. If multiple tags are found, then use the tag with the
+ " line number closest to the supplied line number. IOW, use the tag
+ " with the highest line number.
+ let closest_lnum = 0
+ let final_left = 0
+ while left <= right
+ let lnum = s:Tlist_Get_Tag_Linenum(a:fidx, left)
+
+ if lnum < a:linenum && lnum > closest_lnum
+ let closest_lnum = lnum
+ let final_left = left
+ elseif lnum == a:linenum
+ let closest_lnum = lnum
+ let final_left = left
+ break
+ else
+ let left = left + 1
+ endif
+ endwhile
+ if closest_lnum == 0
+ return -1
+ endif
+ if left >= right
+ let left = final_left
+ endif
+ endif
+
+ return left
+endfunction
+
+" Tlist_Window_Highlight_Tag()
+" Highlight the current tag
+" cntx == 1, Called by the taglist plugin itself
+" cntx == 2, Forced by the user through the TlistHighlightTag command
+" center = 1, move the tag line to the center of the taglist window
+function! s:Tlist_Window_Highlight_Tag(filename, cur_lnum, cntx, center)
+ " Highlight the current tag only if the user configured the
+ " taglist plugin to do so or if the user explictly invoked the
+ " command to highlight the current tag.
+ if !g:Tlist_Auto_Highlight_Tag && a:cntx == 1
+ return
+ endif
+
+ if a:filename == ''
+ return
+ endif
+
+ " Make sure the taglist window is present
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum == -1
+ call s:Tlist_Warning_Msg('Error: Taglist window is not open')
+ return
+ endif
+
+ let fidx = s:Tlist_Get_File_Index(a:filename)
+ if fidx == -1
+ return
+ endif
+
+ " If the file is currently not displayed in the taglist window, then retrn
+ if !s:tlist_{fidx}_visible
+ return
+ endif
+
+ " If there are no tags for this file, then no need to proceed further
+ if s:tlist_{fidx}_tag_count == 0
+ return
+ endif
+
+ " Ignore all autocommands
+ let old_ei = &eventignore
+ set eventignore=all
+
+ " Save the original window number
+ let org_winnr = winnr()
+
+ if org_winnr == winnum
+ let in_taglist_window = 1
+ else
+ let in_taglist_window = 0
+ endif
+
+ " Go to the taglist window
+ if !in_taglist_window
+ exe winnum . 'wincmd w'
+ endif
+
+ " Clear previously selected name
+ match none
+
+ let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, a:cur_lnum)
+ if tidx == -1
+ " Make sure the current tag line is visible in the taglist window.
+ " Calling the winline() function makes the line visible. Don't know
+ " of a better way to achieve this.
+ let lnum = line('.')
+
+ if lnum < s:tlist_{fidx}_start || lnum > s:tlist_{fidx}_end
+ " Move the cursor to the beginning of the file
+ exe s:tlist_{fidx}_start
+ endif
+
+ if foldclosed('.') != -1
+ .foldopen
+ endif
+
+ call winline()
+
+ if !in_taglist_window
+ exe org_winnr . 'wincmd w'
+ endif
+
+ " Restore the autocommands
+ let &eventignore = old_ei
+ return
+ endif
+
+ " Extract the tag type
+ let ttype = s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx)
+
+ " Compute the line number
+ " Start of file + Start of tag type + offset
+ let lnum = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset +
+ \ s:tlist_{fidx}_{tidx}_ttype_idx
+
+ " Goto the line containing the tag
+ exe lnum
+
+ " Open the fold
+ if foldclosed('.') != -1
+ .foldopen
+ endif
+
+ if a:center
+ " Move the tag line to the center of the taglist window
+ normal! z.
+ else
+ " Make sure the current tag line is visible in the taglist window.
+ " Calling the winline() function makes the line visible. Don't know
+ " of a better way to achieve this.
+ call winline()
+ endif
+
+ " Highlight the tag name
+ call s:Tlist_Window_Highlight_Line()
+
+ " Go back to the original window
+ if !in_taglist_window
+ exe org_winnr . 'wincmd w'
+ endif
+
+ " Restore the autocommands
+ let &eventignore = old_ei
+ return
+endfunction
+
+" Tlist_Get_Tag_Prototype_By_Line
+" Get the prototype for the tag on or before the specified line number in the
+" current buffer
+function! Tlist_Get_Tag_Prototype_By_Line(...)
+ if a:0 == 0
+ " Arguments are not supplied. Use the current buffer name
+ " and line number
+ let filename = bufname('%')
+ let linenr = line('.')
+ elseif a:0 == 2
+ " Filename and line number are specified
+ let filename = a:1
+ let linenr = a:2
+ if linenr !~ '\d\+'
+ " Invalid line number
+ return ""
+ endif
+ else
+ " Sufficient arguments are not supplied
+ let msg = 'Usage: Tlist_Get_Tag_Prototype_By_Line <filename> ' .
+ \ '<line_number>'
+ call s:Tlist_Warning_Msg(msg)
+ return ""
+ endif
+
+ " Expand the file to a fully qualified name
+ let filename = fnamemodify(filename, ':p')
+ if filename == ''
+ return ""
+ endif
+
+ let fidx = s:Tlist_Get_File_Index(filename)
+ if fidx == -1
+ return ""
+ endif
+
+ " If there are no tags for this file, then no need to proceed further
+ if s:tlist_{fidx}_tag_count == 0
+ return ""
+ endif
+
+ " Get the tag text using the line number
+ let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr)
+ if tidx == -1
+ return ""
+ endif
+
+ return s:Tlist_Get_Tag_Prototype(fidx, tidx)
+endfunction
+
+" Tlist_Get_Tagname_By_Line
+" Get the tag name on or before the specified line number in the
+" current buffer
+function! Tlist_Get_Tagname_By_Line(...)
+ if a:0 == 0
+ " Arguments are not supplied. Use the current buffer name
+ " and line number
+ let filename = bufname('%')
+ let linenr = line('.')
+ elseif a:0 == 2
+ " Filename and line number are specified
+ let filename = a:1
+ let linenr = a:2
+ if linenr !~ '\d\+'
+ " Invalid line number
+ return ""
+ endif
+ else
+ " Sufficient arguments are not supplied
+ let msg = 'Usage: Tlist_Get_Tagname_By_Line <filename> <line_number>'
+ call s:Tlist_Warning_Msg(msg)
+ return ""
+ endif
+
+ " Make sure the current file has a name
+ let filename = fnamemodify(filename, ':p')
+ if filename == ''
+ return ""
+ endif
+
+ let fidx = s:Tlist_Get_File_Index(filename)
+ if fidx == -1
+ return ""
+ endif
+
+ " If there are no tags for this file, then no need to proceed further
+ if s:tlist_{fidx}_tag_count == 0
+ return ""
+ endif
+
+ " Get the tag name using the line number
+ let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr)
+ if tidx == -1
+ return ""
+ endif
+
+ return s:tlist_{fidx}_{tidx}_tag_name
+endfunction
+
+" Tlist_Window_Move_To_File
+" Move the cursor to the beginning of the current file or the next file
+" or the previous file in the taglist window
+" dir == -1, move to start of current or previous function
+" dir == 1, move to start of next function
+function! s:Tlist_Window_Move_To_File(dir)
+ if foldlevel('.') == 0
+ " Cursor is on a non-folded line (it is not in any of the files)
+ " Move it to a folded line
+ if a:dir == -1
+ normal! zk
+ else
+ " While moving down to the start of the next fold,
+ " no need to do go to the start of the next file.
+ normal! zj
+ return
+ endif
+ endif
+
+ let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.'))
+ if fidx == -1
+ return
+ endif
+
+ let cur_lnum = line('.')
+
+ if a:dir == -1
+ if cur_lnum > s:tlist_{fidx}_start
+ " Move to the beginning of the current file
+ exe s:tlist_{fidx}_start
+ return
+ endif
+
+ if fidx != 0
+ " Move to the beginning of the previous file
+ let fidx = fidx - 1
+ else
+ " Cursor is at the first file, wrap around to the last file
+ let fidx = s:tlist_file_count - 1
+ endif
+
+ exe s:tlist_{fidx}_start
+ return
+ else
+ " Move to the beginning of the next file
+ let fidx = fidx + 1
+
+ if fidx >= s:tlist_file_count
+ " Cursor is at the last file, wrap around to the first file
+ let fidx = 0
+ endif
+
+ if s:tlist_{fidx}_start != 0
+ exe s:tlist_{fidx}_start
+ endif
+ return
+ endif
+endfunction
+
+" Tlist_Session_Load
+" Load a taglist session (information about all the displayed files
+" and the tags) from the specified file
+function! s:Tlist_Session_Load(...)
+ if a:0 == 0 || a:1 == ''
+ call s:Tlist_Warning_Msg('Usage: TlistSessionLoad <filename>')
+ return
+ endif
+
+ let sessionfile = a:1
+
+ if !filereadable(sessionfile)
+ let msg = 'Taglist: Error - Unable to open file ' . sessionfile
+ call s:Tlist_Warning_Msg(msg)
+ return
+ endif
+
+ " Mark the current window as the file window
+ call s:Tlist_Window_Mark_File_Window()
+
+ " Source the session file
+ exe 'source ' . sessionfile
+
+ let new_file_count = g:tlist_file_count
+ unlet! g:tlist_file_count
+
+ let i = 0
+ while i < new_file_count
+ let ftype = g:tlist_{i}_filetype
+ unlet! g:tlist_{i}_filetype
+
+ if !exists('s:tlist_' . ftype . '_count')
+ if s:Tlist_FileType_Init(ftype) == 0
+ let i = i + 1
+ continue
+ endif
+ endif
+
+ let fname = g:tlist_{i}_filename
+ unlet! g:tlist_{i}_filename
+
+ let fidx = s:Tlist_Get_File_Index(fname)
+ if fidx != -1
+ let s:tlist_{fidx}_visible = 0
+ let i = i + 1
+ continue
+ else
+ " As we are loading the tags from the session file, if this
+ " file was previously deleted by the user, now we need to
+ " add it back. So remove the file from the deleted list.
+ call s:Tlist_Update_Remove_List(fname, 0)
+ endif
+
+ let fidx = s:Tlist_Init_File(fname, ftype)
+
+ let s:tlist_{fidx}_filename = fname
+
+ let s:tlist_{fidx}_sort_type = g:tlist_{i}_sort_type
+ unlet! g:tlist_{i}_sort_type
+
+ let s:tlist_{fidx}_filetype = ftype
+ let s:tlist_{fidx}_mtime = getftime(fname)
+
+ let s:tlist_{fidx}_start = 0
+ let s:tlist_{fidx}_end = 0
+
+ let s:tlist_{fidx}_valid = 1
+
+ let s:tlist_{fidx}_tag_count = g:tlist_{i}_tag_count
+ unlet! g:tlist_{i}_tag_count
+
+ let j = 1
+ while j <= s:tlist_{fidx}_tag_count
+ let s:tlist_{fidx}_{j}_tag = g:tlist_{i}_{j}_tag
+ let s:tlist_{fidx}_{j}_tag_name = g:tlist_{i}_{j}_tag_name
+ let s:tlist_{fidx}_{j}_ttype_idx = g:tlist_{i}_{j}_ttype_idx
+ unlet! g:tlist_{i}_{j}_tag
+ unlet! g:tlist_{i}_{j}_tag_name
+ unlet! g:tlist_{i}_{j}_ttype_idx
+ let j = j + 1
+ endwhile
+
+ let j = 1
+ while j <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{j}_name
+
+ if exists('g:tlist_' . i . '_' . ttype)
+ let s:tlist_{fidx}_{ttype} = g:tlist_{i}_{ttype}
+ unlet! g:tlist_{i}_{ttype}
+ let s:tlist_{fidx}_{ttype}_offset = 0
+ let s:tlist_{fidx}_{ttype}_count = g:tlist_{i}_{ttype}_count
+ unlet! g:tlist_{i}_{ttype}_count
+
+ let k = 1
+ while k <= s:tlist_{fidx}_{ttype}_count
+ let s:tlist_{fidx}_{ttype}_{k} = g:tlist_{i}_{ttype}_{k}
+ unlet! g:tlist_{i}_{ttype}_{k}
+ let k = k + 1
+ endwhile
+ else
+ let s:tlist_{fidx}_{ttype} = ''
+ let s:tlist_{fidx}_{ttype}_offset = 0
+ let s:tlist_{fidx}_{ttype}_count = 0
+ endif
+
+ let j = j + 1
+ endwhile
+
+ let i = i + 1
+ endwhile
+
+ " If the taglist window is open, then update it
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum != -1
+ let save_winnr = winnr()
+
+ " Goto the taglist window
+ call s:Tlist_Window_Goto_Window()
+
+ " Refresh the taglist window
+ call s:Tlist_Window_Refresh()
+
+ " Go back to the original window
+ if save_winnr != winnr()
+ call s:Tlist_Exe_Cmd_No_Acmds('wincmd p')
+ endif
+ endif
+endfunction
+
+" Tlist_Session_Save
+" Save a taglist session (information about all the displayed files
+" and the tags) into the specified file
+function! s:Tlist_Session_Save(...)
+ if a:0 == 0 || a:1 == ''
+ call s:Tlist_Warning_Msg('Usage: TlistSessionSave <filename>')
+ return
+ endif
+
+ let sessionfile = a:1
+
+ if s:tlist_file_count == 0
+ " There is nothing to save
+ call s:Tlist_Warning_Msg('Warning: Taglist is empty. Nothing to save.')
+ return
+ endif
+
+ if filereadable(sessionfile)
+ let ans = input('Do you want to overwrite ' . sessionfile . ' (Y/N)?')
+ if ans !=? 'y'
+ return
+ endif
+
+ echo "\n"
+ endif
+
+ let old_verbose = &verbose
+ set verbose&vim
+
+ exe 'redir! > ' . sessionfile
+
+ silent! echo '" Taglist session file. This file is auto-generated.'
+ silent! echo '" File information'
+ silent! echo 'let tlist_file_count = ' . s:tlist_file_count
+
+ let i = 0
+
+ while i < s:tlist_file_count
+ " Store information about the file
+ silent! echo 'let tlist_' . i . "_filename = '" .
+ \ s:tlist_{i}_filename . "'"
+ silent! echo 'let tlist_' . i . '_sort_type = "' .
+ \ s:tlist_{i}_sort_type . '"'
+ silent! echo 'let tlist_' . i . '_filetype = "' .
+ \ s:tlist_{i}_filetype . '"'
+ silent! echo 'let tlist_' . i . '_tag_count = ' .
+ \ s:tlist_{i}_tag_count
+ " Store information about all the tags
+ let j = 1
+ while j <= s:tlist_{i}_tag_count
+ let txt = escape(s:tlist_{i}_{j}_tag, '"\\')
+ silent! echo 'let tlist_' . i . '_' . j . '_tag = "' . txt . '"'
+ silent! echo 'let tlist_' . i . '_' . j . '_tag_name = "' .
+ \ s:tlist_{i}_{j}_tag_name . '"'
+ silent! echo 'let tlist_' . i . '_' . j . '_ttype_idx' . ' = ' .
+ \ s:tlist_{i}_{j}_ttype_idx
+ let j = j + 1
+ endwhile
+
+ " Store information about all the tags grouped by their type
+ let ftype = s:tlist_{i}_filetype
+ let j = 1
+ while j <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{j}_name
+ if s:tlist_{i}_{ttype}_count != 0
+ let txt = escape(s:tlist_{i}_{ttype}, '"\')
+ let txt = substitute(txt, "\n", "\\\\n", 'g')
+ silent! echo 'let tlist_' . i . '_' . ttype . ' = "' .
+ \ txt . '"'
+ silent! echo 'let tlist_' . i . '_' . ttype . '_count = ' .
+ \ s:tlist_{i}_{ttype}_count
+ let k = 1
+ while k <= s:tlist_{i}_{ttype}_count
+ silent! echo 'let tlist_' . i . '_' . ttype . '_' . k .
+ \ ' = ' . s:tlist_{i}_{ttype}_{k}
+ let k = k + 1
+ endwhile
+ endif
+ let j = j + 1
+ endwhile
+
+ silent! echo
+
+ let i = i + 1
+ endwhile
+
+ redir END
+
+ let &verbose = old_verbose
+endfunction
+
+" Tlist_Buffer_Removed
+" A buffer is removed from the Vim buffer list. Remove the tags defined
+" for that file
+function! s:Tlist_Buffer_Removed(filename)
+ call s:Tlist_Log_Msg('Tlist_Buffer_Removed (' . a:filename . ')')
+
+ " Make sure a valid filename is supplied
+ if a:filename == ''
+ return
+ endif
+
+ " Get tag list index of the specified file
+ let fidx = s:Tlist_Get_File_Index(a:filename)
+ if fidx == -1
+ " File not present in the taglist
+ return
+ endif
+
+ " Remove the file from the list
+ call s:Tlist_Remove_File(fidx, 0)
+endfunction
+
+" When a buffer is deleted, remove the file from the taglist
+autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand('<afile>:p'))
+
+" Tlist_Window_Open_File_Fold
+" Open the fold for the specified file and close the fold for all the
+" other files
+function! s:Tlist_Window_Open_File_Fold(acmd_bufnr)
+ call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')')
+
+ " Make sure the taglist window is present
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum == -1
+ call s:Tlist_Warning_Msg('Taglist: Error - Taglist window is not open')
+ return
+ endif
+
+ " Save the original window number
+ let org_winnr = winnr()
+ if org_winnr == winnum
+ let in_taglist_window = 1
+ else
+ let in_taglist_window = 0
+ endif
+
+ if in_taglist_window
+ " When entering the taglist window, no need to update the folds
+ return
+ endif
+
+ " Go to the taglist window
+ if !in_taglist_window
+ call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w')
+ endif
+
+ " Close all the folds
+ silent! %foldclose
+
+ " Get tag list index of the specified file
+ let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p')
+ if filereadable(fname)
+ let fidx = s:Tlist_Get_File_Index(fname)
+ if fidx != -1
+ " Open the fold for the file
+ exe "silent! " . s:tlist_{fidx}_start . "," .
+ \ s:tlist_{fidx}_end . "foldopen"
+ endif
+ endif
+
+ " Go back to the original window
+ if !in_taglist_window
+ call s:Tlist_Exe_Cmd_No_Acmds(org_winnr . 'wincmd w')
+ endif
+endfunction
+
+" Tlist_Window_Check_Auto_Open
+" Open the taglist window automatically on Vim startup.
+" Open the window only when files present in any of the Vim windows support
+" tags.
+function! s:Tlist_Window_Check_Auto_Open()
+ let open_window = 0
+
+ let i = 1
+ let buf_num = winbufnr(i)
+ while buf_num != -1
+ let filename = fnamemodify(bufname(buf_num), ':p')
+ let ft = s:Tlist_Get_Buffer_Filetype(buf_num)
+ if !s:Tlist_Skip_File(filename, ft)
+ let open_window = 1
+ break
+ endif
+ let i = i + 1
+ let buf_num = winbufnr(i)
+ endwhile
+
+ if open_window
+ call s:Tlist_Window_Toggle()
+ endif
+endfunction
+
+" Tlist_Refresh_Folds
+" Remove and create the folds for all the files displayed in the taglist
+" window. Used after entering a tab. If this is not done, then the folds
+" are not properly created for taglist windows displayed in multiple tabs.
+function! s:Tlist_Refresh_Folds()
+ let winnum = bufwinnr(g:TagList_title)
+ if winnum == -1
+ return
+ endif
+
+ let save_wnum = winnr()
+ exe winnum . 'wincmd w'
+
+ " First remove all the existing folds
+ normal! zE
+
+ " Create the folds for each in the tag list
+ let fidx = 0
+ while fidx < s:tlist_file_count
+ let ftype = s:tlist_{fidx}_filetype
+
+ " Create the folds for each tag type in a file
+ let j = 1
+ while j <= s:tlist_{ftype}_count
+ let ttype = s:tlist_{ftype}_{j}_name
+ if s:tlist_{fidx}_{ttype}_count
+ let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset
+ let e = s + s:tlist_{fidx}_{ttype}_count
+ exe s . ',' . e . 'fold'
+ endif
+ let j = j + 1
+ endwhile
+
+ exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold'
+ exe 'silent! ' . s:tlist_{fidx}_start . ',' .
+ \ s:tlist_{fidx}_end . 'foldopen!'
+ let fidx = fidx + 1
+ endwhile
+
+ exe save_wnum . 'wincmd w'
+endfunction
+
+function! s:Tlist_Menu_Add_Base_Menu()
+ call s:Tlist_Log_Msg('Adding the base menu')
+
+ " Add the menu
+ anoremenu <silent> T&ags.Refresh\ menu :call <SID>Tlist_Menu_Refresh()<CR>
+ anoremenu <silent> T&ags.Sort\ menu\ by.Name
+ \ :call <SID>Tlist_Change_Sort('menu', 'set', 'name')<CR>
+ anoremenu <silent> T&ags.Sort\ menu\ by.Order
+ \ :call <SID>Tlist_Change_Sort('menu', 'set', 'order')<CR>
+ anoremenu T&ags.-SEP1- :
+
+ if &mousemodel =~ 'popup'
+ anoremenu <silent> PopUp.T&ags.Refresh\ menu
+ \ :call <SID>Tlist_Menu_Refresh()<CR>
+ anoremenu <silent> PopUp.T&ags.Sort\ menu\ by.Name
+ \ :call <SID>Tlist_Change_Sort('menu', 'set', 'name')<CR>
+ anoremenu <silent> PopUp.T&ags.Sort\ menu\ by.Order
+ \ :call <SID>Tlist_Change_Sort('menu', 'set', 'order')<CR>
+ anoremenu PopUp.T&ags.-SEP1- :
+ endif
+endfunction
+
+let s:menu_char_prefix =
+ \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+" Tlist_Menu_Get_Tag_Type_Cmd
+" Get the menu command for the specified tag type
+" fidx - File type index
+" ftype - File Type
+" add_ttype_name - To add or not to add the tag type name to the menu entries
+" ttype_idx - Tag type index
+function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx)
+ " Curly brace variable name optimization
+ let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx
+
+ let ttype = s:tlist_{ftype_ttype_idx}_name
+ if a:add_ttype_name
+ " If the tag type name contains space characters, escape it. This
+ " will be used to create the menu entries.
+ let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ')
+ endif
+
+ " Curly brace variable name optimization
+ let fidx_ttype = a:fidx . '_' . ttype
+
+ " Number of tag entries for this tag type
+ let tcnt = s:tlist_{fidx_ttype}_count
+ if tcnt == 0 " No entries for this tag type
+ return ''
+ endif
+
+ let mcmd = ''
+
+ " Create the menu items for the tags.
+ " Depending on the number of tags of this type, split the menu into
+ " multiple sub-menus, if needed.
+ if tcnt > g:Tlist_Max_Submenu_Items
+ let j = 1
+ while j <= tcnt
+ let final_index = j + g:Tlist_Max_Submenu_Items - 1
+ if final_index > tcnt
+ let final_index = tcnt
+ endif
+
+ " Extract the first and last tag name and form the
+ " sub-menu name
+ let tidx = s:tlist_{fidx_ttype}_{j}
+ let first_tag = s:tlist_{a:fidx}_{tidx}_tag_name
+
+ let tidx = s:tlist_{fidx_ttype}_{final_index}
+ let last_tag = s:tlist_{a:fidx}_{tidx}_tag_name
+
+ " Truncate the names, if they are greater than the
+ " max length
+ let first_tag = strpart(first_tag, 0, g:Tlist_Max_Tag_Length)
+ let last_tag = strpart(last_tag, 0, g:Tlist_Max_Tag_Length)
+
+ " Form the menu command prefix
+ let m_prefix = 'anoremenu <silent> T\&ags.'
+ if a:add_ttype_name
+ let m_prefix = m_prefix . ttype_fullname . '.'
+ endif
+ let m_prefix = m_prefix . first_tag . '\.\.\.' . last_tag . '.'
+
+ " Character prefix used to number the menu items (hotkey)
+ let m_prefix_idx = 0
+
+ while j <= final_index
+ let tidx = s:tlist_{fidx_ttype}_{j}
+
+ let tname = s:tlist_{a:fidx}_{tidx}_tag_name
+
+ let mcmd = mcmd . m_prefix . '\&' .
+ \ s:menu_char_prefix[m_prefix_idx] . '\.' .
+ \ tname . ' :call <SID>Tlist_Menu_Jump_To_Tag(' .
+ \ tidx . ')<CR>|'
+
+ let m_prefix_idx = m_prefix_idx + 1
+ let j = j + 1
+ endwhile
+ endwhile
+ else
+ " Character prefix used to number the menu items (hotkey)
+ let m_prefix_idx = 0
+
+ let m_prefix = 'anoremenu <silent> T\&ags.'
+ if a:add_ttype_name
+ let m_prefix = m_prefix . ttype_fullname . '.'
+ endif
+ let j = 1
+ while j <= tcnt
+ let tidx = s:tlist_{fidx_ttype}_{j}
+
+ let tname = s:tlist_{a:fidx}_{tidx}_tag_name
+
+ let mcmd = mcmd . m_prefix . '\&' .
+ \ s:menu_char_prefix[m_prefix_idx] . '\.' .
+ \ tname . ' :call <SID>Tlist_Menu_Jump_To_Tag(' . tidx
+ \ . ')<CR>|'
+
+ let m_prefix_idx = m_prefix_idx + 1
+ let j = j + 1
+ endwhile
+ endif
+
+ return mcmd
+endfunction
+
+" Update the taglist menu with the tags for the specified file
+function! s:Tlist_Menu_File_Refresh(fidx)
+ call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename)
+ " The 'B' flag is needed in the 'cpoptions' option
+ let old_cpoptions = &cpoptions
+ set cpoptions&vim
+
+ exe s:tlist_{a:fidx}_menu_cmd
+
+ " Update the popup menu (if enabled)
+ if &mousemodel =~ 'popup'
+ let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.',
+ \ ' PopUp.T\\\&ags.', "g")
+ exe cmd
+ endif
+
+ " The taglist menu is not empty now
+ let s:tlist_menu_empty = 0
+
+ " Restore the 'cpoptions' settings
+ let &cpoptions = old_cpoptions
+endfunction
+
+" Tlist_Menu_Update_File
+" Add the taglist menu
+function! s:Tlist_Menu_Update_File(clear_menu)
+ if !has('gui_running')
+ " Not running in GUI mode
+ return
+ endif
+
+ call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu)
+
+ " Remove the tags menu
+ if a:clear_menu
+ call s:Tlist_Menu_Remove_File()
+
+ endif
+
+ " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help
+ if &buftype != ''
+ return
+ endif
+
+ let filename = fnamemodify(bufname('%'), ':p')
+ let ftype = s:Tlist_Get_Buffer_Filetype('%')
+
+ " If the file doesn't support tag listing, skip it
+ if s:Tlist_Skip_File(filename, ftype)
+ return
+ endif
+
+ let fidx = s:Tlist_Get_File_Index(filename)
+ if fidx == -1 || !s:tlist_{fidx}_valid
+ " Check whether this file is removed based on user request
+ " If it is, then don't display the tags for this file
+ if s:Tlist_User_Removed_File(filename)
+ return
+ endif
+
+ " Process the tags for the file
+ let fidx = s:Tlist_Process_File(filename, ftype)
+ if fidx == -1
+ return
+ endif
+ endif
+
+ let fname = escape(fnamemodify(bufname('%'), ':t'), '.')
+ if fname != ''
+ exe 'anoremenu T&ags.' . fname . ' <Nop>'
+ anoremenu T&ags.-SEP2- :
+ endif
+
+ if !s:tlist_{fidx}_tag_count
+ return
+ endif
+
+ if s:tlist_{fidx}_menu_cmd != ''
+ " Update the menu with the cached command
+ call s:Tlist_Menu_File_Refresh(fidx)
+
+ return
+ endif
+
+ " We are going to add entries to the tags menu, so the menu won't be
+ " empty
+ let s:tlist_menu_empty = 0
+
+ let cmd = ''
+
+ " Determine whether the tag type name needs to be added to the menu
+ " If more than one tag type is present in the taglisting for a file,
+ " then the tag type name needs to be present
+ let add_ttype_name = -1
+ let i = 1
+ while i <= s:tlist_{ftype}_count && add_ttype_name < 1
+ let ttype = s:tlist_{ftype}_{i}_name
+ if s:tlist_{fidx}_{ttype}_count
+ let add_ttype_name = add_ttype_name + 1
+ endif
+ let i = i + 1
+ endwhile
+
+ " Process the tags by the tag type and get the menu command
+ let i = 1
+ while i <= s:tlist_{ftype}_count
+ let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i)
+ if mcmd != ''
+ let cmd = cmd . mcmd
+ endif
+
+ let i = i + 1
+ endwhile
+
+ " Cache the menu command for reuse
+ let s:tlist_{fidx}_menu_cmd = cmd
+
+ " Update the menu
+ call s:Tlist_Menu_File_Refresh(fidx)
+endfunction
+
+" Tlist_Menu_Remove_File
+" Remove the tags displayed in the tags menu
+function! s:Tlist_Menu_Remove_File()
+ if !has('gui_running') || s:tlist_menu_empty
+ return
+ endif
+
+ call s:Tlist_Log_Msg('Removing the tags menu for a file')
+
+ " Cleanup the Tags menu
+ silent! unmenu T&ags
+ if &mousemodel =~ 'popup'
+ silent! unmenu PopUp.T&ags
+ endif
+
+ " Add a dummy menu item to retain teared off menu
+ noremenu T&ags.Dummy l
+
+ silent! unmenu! T&ags
+ if &mousemodel =~ 'popup'
+ silent! unmenu! PopUp.T&ags
+ endif
+
+ call s:Tlist_Menu_Add_Base_Menu()
+
+ " Remove the dummy menu item
+ unmenu T&ags.Dummy
+
+ let s:tlist_menu_empty = 1
+endfunction
+
+" Tlist_Menu_Refresh
+" Refresh the taglist menu
+function! s:Tlist_Menu_Refresh()
+ call s:Tlist_Log_Msg('Refreshing the tags menu')
+ let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p'))
+ if fidx != -1
+ " Invalidate the cached menu command
+ let s:tlist_{fidx}_menu_cmd = ''
+ endif
+
+ " Update the taglist, menu and window
+ call s:Tlist_Update_Current_File()
+endfunction
+
+" Tlist_Menu_Jump_To_Tag
+" Jump to the selected tag
+function! s:Tlist_Menu_Jump_To_Tag(tidx)
+ let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p'))
+ if fidx == -1
+ return
+ endif
+
+ let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx)
+ if tagpat == ''
+ return
+ endif
+
+ " Add the current cursor position to the jump list, so that user can
+ " jump back using the ' and ` marks.
+ mark '
+
+ silent call search(tagpat, 'w')
+
+ " Bring the line to the middle of the window
+ normal! z.
+
+ " If the line is inside a fold, open the fold
+ if foldclosed('.') != -1
+ .foldopen
+ endif
+endfunction
+
+" Tlist_Menu_Init
+" Initialize the taglist menu
+function! s:Tlist_Menu_Init()
+ call s:Tlist_Menu_Add_Base_Menu()
+
+ " Automatically add the tags defined in the current file to the menu
+ augroup TagListMenuCmds
+ autocmd!
+
+ if !g:Tlist_Process_File_Always
+ autocmd BufEnter * call s:Tlist_Refresh()
+ endif
+ autocmd BufLeave * call s:Tlist_Menu_Remove_File()
+ augroup end
+
+ call s:Tlist_Menu_Update_File(0)
+endfunction
+
+" Tlist_Vim_Session_Load
+" Initialize the taglist window/buffer, which is created when loading
+" a Vim session file.
+function! s:Tlist_Vim_Session_Load()
+ call s:Tlist_Log_Msg('Tlist_Vim_Session_Load')
+
+ " Initialize the taglist window
+ call s:Tlist_Window_Init()
+
+ " Refresh the taglist window
+ call s:Tlist_Window_Refresh()
+endfunction
+
+" Tlist_Set_App
+" Set the name of the external plugin/application to which taglist
+" belongs.
+" Taglist plugin is part of another plugin like cream or winmanager.
+function! Tlist_Set_App(name)
+ if a:name == ""
+ return
+ endif
+
+ let s:tlist_app_name = a:name
+endfunction
+
+" Winmanager integration
+
+" Initialization required for integration with winmanager
+function! TagList_Start()
+ " If current buffer is not taglist buffer, then don't proceed
+ if bufname('%') != '__Tag_List__'
+ return
+ endif
+
+ call Tlist_Set_App('winmanager')
+
+ " Get the current filename from the winmanager plugin
+ let bufnum = WinManagerGetLastEditedFile()
+ if bufnum != -1
+ let filename = fnamemodify(bufname(bufnum), ':p')
+ let ftype = s:Tlist_Get_Buffer_Filetype(bufnum)
+ endif
+
+ " Initialize the taglist window, if it is not already initialized
+ if !exists('s:tlist_window_initialized') || !s:tlist_window_initialized
+ call s:Tlist_Window_Init()
+ call s:Tlist_Window_Refresh()
+ let s:tlist_window_initialized = 1
+ endif
+
+ " Update the taglist window
+ if bufnum != -1
+ if !s:Tlist_Skip_File(filename, ftype) && g:Tlist_Auto_Update
+ call s:Tlist_Window_Refresh_File(filename, ftype)
+ endif
+ endif
+endfunction
+
+function! TagList_IsValid()
+ return 0
+endfunction
+
+function! TagList_WrapUp()
+ return 0
+endfunction
+
+" restore 'cpo'
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
--- /dev/null
+Subproject commit 992c21804d003faffcaec0014a5f61e2ce76f57e
--- /dev/null
+Subproject commit 4b144911640d8e01a618d90df45422067f2d8481
--- /dev/null
+Subproject commit 942bc285696f6f2cbda9a2b7c2ddd755fdcff592
--- /dev/null
+Subproject commit a1b611ab22745f8b877d8de4f09985a0ddf3acfd
--- /dev/null
+" Vim color file
+"
+" Name: xoria256.vim
+" Version: 1.5
+" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
+"
+" Should work in recent 256 color terminals. 88-color terms like urxvt are
+" NOT supported.
+"
+" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
+" similar value.
+"
+" Color numbers (0-255) see:
+" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
+"
+" For a specific filetype highlighting rules issue :syntax list when a file of
+" that type is opened.
+
+" Initialization {{{
+if &t_Co != 256 && ! has("gui_running")
+ echomsg ""
+ echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
+ echomsg ""
+ finish
+endif
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "xoria256"
+"}}}
+" Colours {{{1
+"" General {{{2
+hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
+hi Cursor ctermbg=214 guibg=#ffaf00
+hi CursorColumn ctermbg=238 guibg=#444444
+hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
+hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
+" TODO
+" hi MoreMsg
+hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
+hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
+hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
+hi PmenuSbar ctermbg=252 guibg=#d0d0d0
+hi PmenuThumb ctermfg=243 guifg=#767676
+hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
+hi SignColumn ctermfg=248 guifg=#a8a8a8
+hi SpecialKey ctermfg=77 guifg=#5fdf5f
+hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
+hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
+hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
+hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
+hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" FIXME
+hi Title ctermfg=225 guifg=#ffdfff
+hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
+hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
+hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
+" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
+hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
+" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
+hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
+
+"" Syntax highlighting {{{2
+hi Comment ctermfg=244 guifg=#808080
+hi Constant ctermfg=229 guifg=#ffffaf
+hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
+hi Ignore ctermfg=238 guifg=#444444
+hi Number ctermfg=180 guifg=#dfaf87
+hi PreProc ctermfg=150 guifg=#afdf87
+hi Special ctermfg=174 guifg=#df8787
+hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
+hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
+
+"" Special {{{2
+""" .diff {{{3
+hi diffAdded ctermfg=150 guifg=#afdf87
+hi diffRemoved ctermfg=174 guifg=#df8787
+""" vimdiff {{{3
+hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
+"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
+hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
+hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
+hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
+""" HTML {{{3
+" hi htmlTag ctermfg=146 guifg=#afafdf
+" hi htmlEndTag ctermfg=146 guifg=#afafdf
+hi htmlTag ctermfg=244
+hi htmlEndTag ctermfg=244
+hi htmlArg ctermfg=182 guifg=#dfafdf
+hi htmlValue ctermfg=187 guifg=#dfdfaf
+hi htmlTitle ctermfg=254 ctermbg=95
+" hi htmlArg ctermfg=146
+" hi htmlTagName ctermfg=146
+" hi htmlString ctermfg=187
+""" django {{{3
+hi djangoVarBlock ctermfg=180
+hi djangoTagBlock ctermfg=150
+hi djangoStatement ctermfg=146
+hi djangoFilter ctermfg=174
+""" python {{{3
+hi pythonExceptions ctermfg=174
+""" NERDTree {{{3
+hi Directory ctermfg=110 guifg=#87afdf
+hi treeCWD ctermfg=180 guifg=#dfaf87
+hi treeClosable ctermfg=174 guifg=#df8787
+hi treeOpenable ctermfg=150 guifg=#afdf87
+hi treePart ctermfg=244 guifg=#808080
+hi treeDirSlash ctermfg=244 guifg=#808080
+hi treeLink ctermfg=182 guifg=#dfafdf
+
+""" VimDebug {{{3
+" FIXME
+" you may want to set SignColumn highlight in your .vimrc
+" :help sign
+" :help SignColumn
+
+" hi currentLine term=reverse cterm=reverse gui=reverse
+" hi breakPoint term=NONE cterm=NONE gui=NONE
+" hi empty term=NONE cterm=NONE gui=NONE
+
+" sign define currentLine linehl=currentLine
+" sign define breakPoint linehl=breakPoint text=>>
+" sign define both linehl=currentLine text=>>
+" sign define empty linehl=empty
+
--- /dev/null
+" Vim color file
+"
+" Name: xoria256.vim
+" Version: 1.5
+" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
+"
+" Should work in recent 256 color terminals. 88-color terms like urxvt are
+" NOT supported.
+"
+" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
+" similar value.
+"
+" Color numbers (0-255) see:
+" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
+"
+" For a specific filetype highlighting rules issue :syntax list when a file of
+" that type is opened.
+
+" Initialization {{{
+if &t_Co != 256 && ! has("gui_running")
+ echomsg ""
+ echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
+ echomsg ""
+ finish
+endif
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "xoria256"
+"}}}
+" Colours {{{1
+"" General {{{2
+hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
+hi Cursor ctermbg=214 guibg=#ffaf00
+hi CursorColumn ctermbg=238 guibg=#444444
+hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
+hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
+" TODO
+" hi MoreMsg
+hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
+hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
+hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
+hi PmenuSbar ctermbg=252 guibg=#d0d0d0
+hi PmenuThumb ctermfg=243 guifg=#767676
+hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
+hi SignColumn ctermfg=248 guifg=#a8a8a8
+hi SpecialKey ctermfg=77 guifg=#5fdf5f
+hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
+hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
+hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
+hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
+hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" FIXME
+hi Title ctermfg=225 guifg=#ffdfff
+hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
+hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
+hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
+" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
+hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
+" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
+hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
+
+"" Syntax highlighting {{{2
+hi Comment ctermfg=244 guifg=#808080
+hi Constant ctermfg=229 guifg=#ffffaf
+hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
+hi Ignore ctermfg=238 guifg=#444444
+hi Number ctermfg=180 guifg=#dfaf87
+hi PreProc ctermfg=150 guifg=#afdf87
+hi Special ctermfg=174 guifg=#df8787
+hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
+hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
+
+"" Special {{{2
+""" .diff {{{3
+hi diffAdded ctermfg=150 guifg=#afdf87
+hi diffRemoved ctermfg=174 guifg=#df8787
+""" vimdiff {{{3
+hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
+"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
+hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
+hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
+hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
+""" HTML {{{3
+" hi htmlTag ctermfg=146 guifg=#afafdf
+" hi htmlEndTag ctermfg=146 guifg=#afafdf
+hi htmlTag ctermfg=244
+hi htmlEndTag ctermfg=244
+hi htmlArg ctermfg=182 guifg=#dfafdf
+hi htmlValue ctermfg=187 guifg=#dfdfaf
+hi htmlTitle ctermfg=254 ctermbg=95
+" hi htmlArg ctermfg=146
+" hi htmlTagName ctermfg=146
+" hi htmlString ctermfg=187
+""" django {{{3
+hi djangoVarBlock ctermfg=180
+hi djangoTagBlock ctermfg=150
+hi djangoStatement ctermfg=146
+hi djangoFilter ctermfg=174
+""" python {{{3
+hi pythonExceptions ctermfg=174
+""" NERDTree {{{3
+hi Directory ctermfg=110 guifg=#87afdf
+hi treeCWD ctermfg=180 guifg=#dfaf87
+hi treeClosable ctermfg=174 guifg=#df8787
+hi treeOpenable ctermfg=150 guifg=#afdf87
+hi treePart ctermfg=244 guifg=#808080
+hi treeDirSlash ctermfg=244 guifg=#808080
+hi treeLink ctermfg=182 guifg=#dfafdf
+
+""" VimDebug {{{3
+" FIXME
+" you may want to set SignColumn highlight in your .vimrc
+" :help sign
+" :help SignColumn
+
+" hi currentLine term=reverse cterm=reverse gui=reverse
+" hi breakPoint term=NONE cterm=NONE gui=NONE
+" hi empty term=NONE cterm=NONE gui=NONE
+
+" sign define currentLine linehl=currentLine
+" sign define breakPoint linehl=breakPoint text=>>
+" sign define both linehl=currentLine text=>>
+" sign define empty linehl=empty
+
--- /dev/null
+1.5
\ No newline at end of file
--- /dev/null
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "earendel"
+
+execute "command! -nargs=1 Colo set background=<args>"
+
+if &background == "light"
+ hi Normal ctermbg=15 ctermfg=0 guibg=#ffffff guifg=#000000 gui=none
+
+ hi Cursor guibg=#000000 guifg=#ffffff gui=none
+ hi CursorColumn ctermbg=7 ctermfg=fg guibg=#dfdfdf gui=none
+ hi CursorLine ctermbg=7 ctermfg=fg guibg=#dfdfdf gui=none
+ hi DiffAdd guibg=#bae981 guifg=fg gui=none
+ hi DiffChange guibg=#8495e6 guifg=fg gui=none
+ hi DiffDelete guibg=#ff95a5 guifg=fg gui=none
+ hi DiffText guibg=#b9c2f0 guifg=fg gui=bold
+ hi Directory guibg=bg guifg=#272fc2 gui=none
+ hi ErrorMsg guibg=#ca001f guifg=#ffffff gui=bold
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#656565 gui=none
+ hi Folded guibg=#cacaca guifg=#324263 gui=bold
+ hi IncSearch guibg=#f7b69d gui=none
+ hi LineNr guibg=bg guifg=#656565 gui=none
+ hi ModeMsg ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold
+ hi MoreMsg guibg=bg guifg=#4a4a4a gui=bold
+ hi NonText ctermfg=8 guibg=bg guifg=#656565 gui=bold
+ hi Pmenu guibg=#aab8d5 guifg=fg gui=none
+ hi PmenuSbar guibg=#6a83b5 guifg=fg gui=none
+ hi PmenuSel guibg=#fee06b guifg=fg gui=none
+ hi PmenuThumb guibg=#c7cfe2 guifg=fg gui=none
+ hi Question guibg=bg guifg=#4a4a4a gui=bold
+ hi Search guibg=#fee481 gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#656565 gui=none
+ hi SpecialKey guibg=bg guifg=#844631 gui=none
+ hi StatusLine ctermbg=0 ctermfg=15 guibg=#96aad3 guifg=fg gui=bold
+ hi StatusLineNC ctermbg=7 ctermfg=fg guibg=#bcc7de guifg=#384547 gui=none
+ if has("spell")
+ hi SpellBad guisp=#ca001f gui=undercurl
+ hi SpellCap guisp=#272fc2 gui=undercurl
+ hi SpellLocal guisp=#0f8674 gui=undercurl
+ hi SpellRare guisp=#d16c7a gui=undercurl
+ endif
+ hi TabLine guibg=#d4d4d4 guifg=fg gui=underline
+ hi TabLineFill guibg=#d4d4d4 guifg=fg gui=underline
+ hi TabLineSel guibg=bg guifg=fg gui=bold
+ hi Title guifg=fg gui=bold
+ hi VertSplit ctermbg=7 ctermfg=fg guibg=#bcc7de guifg=#384547 gui=none
+ if version >= 700
+ hi Visual ctermbg=7 ctermfg=fg guibg=#b5c5e6 gui=none
+ else
+ hi Visual ctermbg=7 ctermfg=fg guibg=#b5c5e6 guifg=fg gui=none
+ endif
+ hi VisualNOS ctermbg=8 ctermfg=fg guibg=bg guifg=#4069bf gui=bold,underline
+ hi WarningMsg guibg=bg guifg=#ca001f gui=bold
+ hi WildMenu guibg=#fedc56 guifg=fg gui=bold
+
+ hi Comment guibg=bg guifg=#558817 gui=none
+ hi Constant guibg=bg guifg=#a8660d gui=none
+ hi Error guibg=bg guifg=#bf001d gui=none
+ hi Identifier guibg=bg guifg=#0e7c6b gui=none
+ hi Ignore guibg=bg guifg=bg gui=none
+ hi lCursor guibg=#79bf21 guifg=#ffffff gui=none
+ hi MatchParen guibg=#0f8674 guifg=#ffffff gui=none
+ hi PreProc guibg=bg guifg=#a33243 gui=none
+ hi Special guibg=bg guifg=#844631 gui=none
+ hi Statement guibg=bg guifg=#2239a8 gui=bold
+ hi Todo guibg=#fedc56 guifg=#512b1e gui=bold
+ hi Type guibg=bg guifg=#1d318d gui=bold
+ hi Underlined ctermbg=bg ctermfg=fg guibg=bg guifg=#272fc2 gui=underline
+
+ hi htmlBold ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold
+ hi htmlBoldItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,italic
+ hi htmlBoldUnderline ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,underline
+ hi htmlBoldUnderlineItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,underline,italic
+ hi htmlItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=italic
+ hi htmlUnderline ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=underline
+ hi htmlUnderlineItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=underline,italic
+else
+ hi Normal ctermbg=0 ctermfg=7 guibg=#181818 guifg=#cacaca gui=none
+
+ hi Cursor guibg=#e5e5e5 guifg=#000000 gui=none
+ hi CursorColumn ctermbg=8 ctermfg=15 guibg=#404040 gui=none
+ hi CursorLine ctermbg=8 ctermfg=15 guibg=#404040 gui=none
+ hi DiffAdd guibg=#558817 guifg=#dadada gui=none
+ hi DiffChange guibg=#1b2e85 guifg=#dadada gui=none
+ hi DiffDelete guibg=#9f0018 guifg=#dadada gui=none
+ hi DiffText guibg=#2540ba guifg=#dadada gui=bold
+ hi Directory guibg=bg guifg=#8c91e8 gui=none
+ hi ErrorMsg guibg=#ca001f guifg=#e5e5e5 gui=bold
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#9a9a9a gui=none
+ hi Folded guibg=#555555 guifg=#bfcadf gui=bold
+ hi IncSearch guibg=#a7380e guifg=#dadada gui=none
+ hi LineNr guibg=bg guifg=#9a9a9a gui=none
+ hi ModeMsg ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold
+ hi MoreMsg guibg=bg guifg=#b5b5b5 gui=bold
+ hi NonText ctermfg=8 guibg=bg guifg=#9a9a9a gui=bold
+ hi Pmenu guibg=#3d5078 guifg=#dadada gui=none
+ hi PmenuSbar guibg=#324263 guifg=#dadada gui=none
+ hi PmenuSel guibg=#f3c201 guifg=#000000 gui=none
+ hi PmenuThumb guibg=#5c77ad guifg=#dadada gui=none
+ hi Question guibg=bg guifg=#b5b5b5 gui=bold
+ hi Search guibg=#947601 guifg=#dadada gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#9a9a9a gui=none
+ hi SpecialKey guibg=bg guifg=#d3a901 gui=none
+ hi StatusLine ctermbg=7 ctermfg=0 guibg=#41609e guifg=#e5e5e5 gui=bold
+ hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#35466a guifg=#afbacf gui=none
+ if has("spell")
+ hi SpellBad guisp=#ea0023 gui=undercurl
+ hi SpellCap guisp=#8c91e8 gui=undercurl
+ hi SpellLocal guisp=#16c9ae gui=undercurl
+ hi SpellRare guisp=#e09ea8 gui=undercurl
+ endif
+ hi TabLine guibg=#4a4a4a guifg=#e5e5e5 gui=underline
+ hi TabLineFill guibg=#4a4a4a guifg=#e5e5e5 gui=underline
+ hi TabLineSel guibg=bg guifg=#e5e5e5 gui=bold
+ hi Title ctermbg=bg ctermfg=15 guifg=#e5e5e5 gui=bold
+ hi VertSplit ctermbg=7 ctermfg=0 guibg=#35466a guifg=#afbacf gui=none
+ if version >= 700
+ hi Visual ctermbg=7 ctermfg=0 guibg=#274278 gui=none
+ else
+ hi Visual ctermbg=7 ctermfg=0 guibg=#274278 guifg=fg gui=none
+ endif
+ hi VisualNOS ctermbg=8 ctermfg=0 guibg=bg guifg=#5c77ad gui=bold,underline
+ hi WarningMsg guibg=bg guifg=#ea0023 gui=bold
+ hi WildMenu guibg=#fbca01 guifg=#000000 gui=bold
+
+ hi Comment guibg=bg guifg=#77be21 gui=none
+ hi Constant guibg=bg guifg=#dc8511 gui=none
+ hi Error guibg=bg guifg=#ea0023 gui=none
+ hi Identifier guibg=bg guifg=#16c9ae gui=none
+ hi Ignore guibg=bg guifg=bg gui=none
+ hi lCursor guibg=#c4ec93 guifg=#000000 gui=none
+ hi MatchParen guibg=#17d2b7 guifg=#000000 gui=none
+ hi PreProc guibg=bg guifg=#e09ea8 gui=none
+ hi Special guibg=bg guifg=#d3a901 gui=none
+ hi Statement guibg=bg guifg=#a7b4ed gui=bold
+ hi Todo guibg=#fedc56 guifg=#512b1e gui=bold
+ hi Type guibg=bg guifg=#95a4ea gui=bold
+ hi Underlined ctermbg=bg ctermfg=15 guibg=bg guifg=#8c91e8 gui=underline
+
+ hi htmlBold ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold
+ hi htmlBoldItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,italic
+ hi htmlBoldUnderline ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,underline
+ hi htmlBoldUnderlineItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic
+ hi htmlItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=italic
+ hi htmlUnderline ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=underline
+ hi htmlUnderlineItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=underline,italic
+endif
+
+hi! default link bbcodeBold htmlBold
+hi! default link bbcodeBoldItalic htmlBoldItalic
+hi! default link bbcodeBoldItalicUnderline htmlBoldUnderlineItalic
+hi! default link bbcodeBoldUnderline htmlBoldUnderline
+hi! default link bbcodeItalic htmlItalic
+hi! default link bbcodeItalicUnderline htmlUnderlineItalic
+hi! default link bbcodeUnderline htmlUnderline
--- /dev/null
+" Vim color file
+" Name: gentooish.vim
+" Author: Brian Carper<brian@briancarper.net>
+" Version: 0.3
+
+set background=dark
+hi clear
+if exists("syntax_on")
+ syntax reset
+endif
+
+if has('gui_running')
+ hi Normal gui=NONE guifg=#cccccc guibg=#191919
+
+ hi IncSearch gui=NONE guifg=#000000 guibg=#8bff95
+ hi Search gui=NONE guifg=#cccccc guibg=#863132
+ hi ErrorMsg gui=NONE guifg=#cccccc guibg=#863132
+ hi WarningMsg gui=NONE guifg=#cccccc guibg=#863132
+ hi ModeMsg gui=NONE guifg=#cccccc guibg=NONE
+ hi MoreMsg gui=NONE guifg=#cccccc guibg=NONE
+ hi Question gui=NONE guifg=#cccccc guibg=NONE
+
+ hi StatusLine gui=BOLD guifg=#cccccc guibg=#333333
+ hi User1 gui=BOLD guifg=#999999 guibg=#333333
+ hi User2 gui=BOLD guifg=#8bff95 guibg=#333333
+ hi StatusLineNC gui=NONE guifg=#999999 guibg=#333333
+ hi VertSplit gui=NONE guifg=#cccccc guibg=#333333
+
+ hi WildMenu gui=BOLD guifg=#cf7dff guibg=#1F0F29
+
+ hi DiffText gui=NONE guifg=#000000 guibg=#4cd169
+ hi DiffChange gui=NONE guifg=NONE guibg=#541691
+ hi DiffDelete gui=NONE guifg=#cccccc guibg=#863132
+ hi DiffAdd gui=NONE guifg=#cccccc guibg=#306d30
+
+ hi Cursor gui=NONE guifg=#000000 guibg=#8bff95
+
+ hi Folded gui=NONE guifg=#aaa400 guibg=#000000
+ hi FoldColumn gui=NONE guifg=#cccccc guibg=#000000
+
+ hi Directory gui=NONE guifg=#8bff95 guibg=NONE
+ hi LineNr gui=NONE guifg=#bbbbbb guibg=#222222
+ hi NonText gui=NONE guifg=#555555 guibg=NONE
+ hi SpecialKey gui=NONE guifg=#6f6f2f guibg=NONE
+ hi Title gui=NONE guifg=#9a383a guibg=NONE
+ hi Visual gui=NONE guifg=#cccccc guibg=#1d474f
+
+ hi Comment gui=NONE guifg=#666666 guibg=NONE
+ hi Constant gui=NONE guifg=#b8bb00 guibg=NONE
+ hi Boolean gui=NONE guifg=#00ff00 guibg=NONE
+ hi String gui=NONE guifg=#5dff9e guibg=#0f291a
+ hi Error gui=NONE guifg=#990000 guibg=#000000
+ hi Identifier gui=NONE guifg=#4cbbd1 guibg=NONE
+ hi Ignore gui=NONE guifg=#555555
+ hi Number gui=NONE guifg=#ddaa66 guibg=NONE
+ hi PreProc gui=NONE guifg=#9a383a guibg=NONE
+
+ hi Special gui=NONE guifg=#ffcd8b guibg=NONE
+
+ hi Statement gui=NONE guifg=#4cd169 guibg=NONE
+ hi Todo gui=NONE guifg=#cccccc guibg=#863132
+ hi Type gui=NONE guifg=#c476f1 guibg=NONE
+ hi Underlined gui=UNDERLINE guifg=#cccccc guibg=NONE
+
+ hi Visual gui=NONE guifg=#ffffff guibg=#6e4287
+ hi VisualNOS gui=NONE guifg=#cccccc guibg=#000000
+
+ hi CursorLine gui=NONE guifg=NONE guibg=#222222
+ hi CursorColumn gui=NONE guifg=NONE guibg=#222222
+
+ hi lispList gui=NONE guifg=#555555
+
+ if v:version >= 700
+ hi Pmenu gui=NONE guifg=#cccccc guibg=#222222
+ hi PMenuSel gui=BOLD guifg=#c476f1 guibg=#000000
+ hi PmenuSbar gui=NONE guifg=#cccccc guibg=#000000
+ hi PmenuThumb gui=NONE guifg=#cccccc guibg=#333333
+
+ hi SpellBad gui=undercurl guisp=#cc6666
+ hi SpellRare gui=undercurl guisp=#cc66cc
+ hi SpellLocal gui=undercurl guisp=#cccc66
+ hi SpellCap gui=undercurl guisp=#66cccc
+
+ hi MatchParen gui=NONE guifg=#ffffff guibg=#005500
+ endif
+else
+ " Dumped via CSApprox, then edited slightly
+ " (http://www.vim.org/scripts/script.php?script_id=2390)
+ hi SpecialKey term=bold ctermfg=58
+ hi NonText term=bold ctermfg=240
+ hi Directory term=bold ctermfg=120
+ hi ErrorMsg term=standout ctermfg=252 ctermbg=95
+ hi IncSearch term=reverse ctermfg=16 ctermbg=120
+ hi Search term=reverse ctermfg=252 ctermbg=95
+ hi MoreMsg term=bold ctermfg=252
+ hi ModeMsg term=bold ctermfg=252
+ hi LineNr term=underline ctermfg=250 ctermbg=235
+ hi Question term=standout ctermfg=252
+ hi StatusLine term=bold,reverse cterm=bold ctermfg=252 ctermbg=236
+ hi StatusLineNC term=reverse cterm=bold ctermfg=240 ctermbg=236
+ hi VertSplit term=reverse ctermfg=252 ctermbg=236
+ hi Title term=bold ctermfg=95
+ hi Visual term=reverse ctermfg=231 ctermbg=60
+ hi VisualNOS term=bold,underline ctermfg=252 ctermbg=16
+ hi WarningMsg term=standout ctermfg=252 ctermbg=95
+ hi WildMenu term=standout cterm=bold ctermfg=177 ctermbg=16
+ hi Folded term=standout ctermfg=142 ctermbg=16
+ hi FoldColumn term=standout ctermfg=252 ctermbg=16
+ hi DiffAdd term=bold ctermfg=252 ctermbg=59
+ hi DiffChange term=bold ctermbg=54
+ hi DiffDelete term=bold ctermfg=252 ctermbg=95
+ hi DiffText term=reverse ctermfg=16 ctermbg=77
+ hi SignColumn term=standout ctermfg=51 ctermbg=250
+ hi TabLine term=underline cterm=underline ctermbg=248
+ hi TabLineSel term=bold cterm=bold
+ hi TabLineFill term=reverse ctermfg=234 ctermbg=252
+ hi CursorColumn term=reverse ctermbg=235
+ hi CursorLine term=underline ctermbg=235
+ hi Cursor ctermfg=16 ctermbg=120
+ hi lCursor ctermfg=234 ctermbg=252
+ hi Normal ctermfg=252 ctermbg=234
+ hi Comment term=bold ctermfg=241
+ hi Constant term=underline ctermfg=142
+ hi Special term=bold ctermfg=222
+ hi Identifier term=underline ctermfg=74
+ hi Statement term=bold ctermfg=77
+ hi PreProc term=underline ctermfg=95
+ hi Type term=underline ctermfg=177
+ hi Underlined term=underline cterm=underline ctermfg=252
+ hi Ignore ctermfg=240
+ hi Error term=reverse ctermfg=88 ctermbg=16
+ hi Todo term=standout ctermfg=252 ctermbg=95
+ hi String ctermfg=85 ctermbg=16
+ hi Number ctermfg=179
+ hi Boolean ctermfg=46
+ hi Special term=bold ctermfg=222
+ hi Identifier term=underline ctermfg=74
+ hi Statement term=bold ctermfg=77
+ hi PreProc term=underline ctermfg=95
+ hi Type term=underline ctermfg=177
+ hi Underlined term=underline cterm=underline ctermfg=252
+ hi Ignore ctermfg=240
+ hi Error term=reverse ctermfg=88 ctermbg=16
+ hi Todo term=standout ctermfg=252 ctermbg=95
+ hi String ctermfg=85 ctermbg=16
+ hi Number ctermfg=179
+ hi Boolean ctermfg=46
+ hi User1 cterm=bold ctermfg=246 ctermbg=236
+ hi User2 cterm=bold ctermfg=120 ctermbg=236
+ if v:version >= 700
+ hi SpellBad term=reverse cterm=undercurl ctermfg=167
+ hi SpellCap term=reverse cterm=undercurl ctermfg=80
+ hi SpellRare term=reverse cterm=undercurl ctermfg=170
+ hi SpellLocal term=underline cterm=undercurl ctermfg=185
+ hi Pmenu ctermfg=252 ctermbg=235
+ hi PmenuSel cterm=bold ctermfg=177 ctermbg=16
+ hi PmenuSbar ctermfg=252 ctermbg=16
+ hi PmenuThumb ctermfg=252 ctermbg=236
+ hi MatchParen term=reverse ctermfg=231 ctermbg=22
+ endif
+endif
+
+
--- /dev/null
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "jellybeans"
+
+if version >= 700
+ hi CursorLine guibg=#1c1c1c cterm=none
+ hi CursorColumn guibg=#1c1c1c
+ hi MatchParen guifg=white guibg=#80a090 gui=bold
+
+ "Tabpages
+ hi TabLine guifg=black guibg=#b0b8c0 gui=italic
+ hi TabLineFill guifg=#9098a0
+ hi TabLineSel guifg=black guibg=#f0f0f0 gui=italic,bold
+
+ "P-Menu (auto-completion)
+ hi Pmenu guifg=white guibg=#000000
+ hi PmenuSel guifg=#101010 guibg=#eeeeee
+ "PmenuSbar
+ "PmenuThumb
+endif
+
+hi Visual guibg=#404040
+
+"hi Cursor guifg=NONE guibg=#586068
+hi Cursor guibg=#b0d0f0
+
+hi Normal guifg=#e8e8d3 guibg=#151515 ctermfg=white ctermbg=none
+"hi LineNr guifg=#808080 guibg=#e0e0e0
+hi LineNr guifg=#605958 guibg=#151515 gui=none ctermfg=black
+"hi Comment guifg=#5f5a60 gui=italic
+hi Comment guifg=#888888 gui=italic ctermbg=none ctermfg=grey
+hi Todo guifg=#808080 guibg=NONE gui=bold,italic
+
+hi StatusLine guifg=#f0f0f0 guibg=#101010 gui=italic
+hi StatusLineNC guifg=#a0a0a0 guibg=#181818 gui=italic
+hi VertSplit guifg=#181818 guibg=#181818 gui=italic
+
+hi Folded guibg=#384048 guifg=#a0a8b0 gui=italic ctermbg=none ctermfg=black
+hi FoldColumn guibg=#384048 guifg=#a0a8b0
+hi SignColumn guibg=#384048 guifg=#a0a8b0
+
+hi Title guifg=#70b950 gui=bold
+
+hi Constant guifg=#cf6a4c ctermfg=red
+hi String guifg=#799d6a ctermfg=green
+hi Delimiter guifg=#668799 ctermfg=grey
+hi Special guifg=#99ad6a ctermfg=green
+"hi Number guifg=#ff00fc
+"hi Float
+"hi Identifier guifg=#7587a6
+hi Identifier guifg=#c6b6ee ctermfg=lightcyan
+" Type d: 'class'
+"hi Structure guifg=#9B859D gui=underline
+hi Structure guifg=#8fbfdc gui=NONE ctermfg=lightcyan
+hi Function guifg=#fad07a ctermfg=yellow
+" dylan: method, library, ... d: if, return, ...
+"hi Statement guifg=#7187a1 gui=NONE
+hi Statement guifg=#8197bf gui=NONE ctermfg=darkblue
+" Keywords d: import, module...
+hi PreProc guifg=#8fbfdc ctermfg=lightblue
+
+hi link Operator Normal
+
+hi Type guifg=#ffb964 gui=NONE ctermfg=yellow
+hi NonText guifg=#808080 guibg=#151515
+
+"hi Macro guifg=#a0b0c0 gui=underline
+
+"Tabs, trailing spaces, etc (lcs)
+hi SpecialKey guifg=#808080 guibg=#343434
+
+"hi TooLong guibg=#ff0000 guifg=#f8f8f8
+
+hi Search guifg=#f0a0c0 guibg=#302028 gui=underline ctermbg=none ctermfg=magenta cterm=underline
+
+hi Directory guifg=#dad085 gui=NONE
+hi Error guibg=#602020
+
+" Diff
+
+hi link diffRemoved Constant
+hi link diffAdded String
+
+" VimDiff
+
+hi DiffAdd guibg=#032218 ctermbg=darkgreen ctermfg=black
+hi DiffChange guibg=#100920 ctermbg=darkmagenta ctermfg=black
+hi DiffDelete guibg=#220000 guifg=#220000 ctermbg=darkred ctermfg=black
+hi DiffText guibg=#000940 ctermbg=darkred
+
+" PHP
+
+"hi phpFunctions guifg=#c676be
+hi link phpFunctions Function
+hi StorageClass guifg=#c59f6f ctermfg=red
+
+" Ruby
+
+hi link rubySharpBang Comment
+hi rubyClass guifg=#447799 ctermfg=darkblue
+hi rubyIdentifier guifg=#c6b6fe
+
+hi rubyInstanceVariable guifg=#c6b6fe ctermfg=cyan
+"hi rubySymbol guifg=#6677ff
+hi rubySymbol guifg=#7697d6 ctermfg=blue
+hi link rubyGlobalVariable rubyInstanceVariable
+hi link rubyModule rubyClass
+hi rubyControl guifg=#7597c6
+
+hi link rubyString Special
+hi rubyStringDelimiter guifg=#556633 ctermfg=darkgreen
+hi link rubyInterpolationDelimiter Identifier
+
+hi rubyRegexpDelimiter guifg=#540063 ctermfg=magenta
+hi rubyRegexp guifg=#dd0093 ctermfg=darkmagenta
+hi rubyRegexpSpecial guifg=#a40073 ctermfg=magenta
+
+hi rubyPredefinedIdentifier guifg=#de5577 ctermfg=red
+
+" Tag list
+hi link TagListFileName Directory
--- /dev/null
+" Vim color file
+"
+" Author: Tomas Restrepo <tomas@winterdom.com>
+"
+" Note: Based on the monokai theme for textmate
+" by Wimer Hazenberg and its darker variant
+" by Hamish Stuart Macpherson
+"
+
+hi clear
+
+set background=dark
+if version > 580
+ " no guarantees for version 5.8 and below, but this makes it stop
+ " complaining
+ hi clear
+ if exists("syntax_on")
+ syntax reset
+ endif
+endif
+let g:colors_name="molokai"
+
+if exists("g:molokai_original")
+ let s:molokai_original = g:molokai_original
+else
+ let s:molokai_original = 0
+endif
+
+
+hi Boolean guifg=#AE81FF
+hi Character guifg=#E6DB74
+hi Number guifg=#AE81FF
+hi String guifg=#E6DB74
+hi Conditional guifg=#F92672 gui=bold
+hi Constant guifg=#AE81FF gui=bold
+hi Cursor guifg=#000000 guibg=#F8F8F0
+hi Debug guifg=#BCA3A3 gui=bold
+hi Define guifg=#66D9EF
+hi Delimiter guifg=#8F8F8F
+hi DiffAdd guibg=#13354A
+hi DiffChange guifg=#89807D guibg=#4C4745
+hi DiffDelete guifg=#960050 guibg=#1E0010
+hi DiffText guibg=#4C4745 gui=italic,bold
+
+hi Directory guifg=#A6E22E gui=bold
+hi Error guifg=#960050 guibg=#1E0010
+hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
+hi Exception guifg=#A6E22E gui=bold
+hi Float guifg=#AE81FF
+hi FoldColumn guifg=#465457 guibg=#000000
+hi Folded guifg=#465457 guibg=#000000
+hi Function guifg=#A6E22E
+hi Identifier guifg=#FD971F
+hi Ignore guifg=#808080 guibg=bg
+hi IncSearch guifg=#C4BE89 guibg=#000000
+
+hi Keyword guifg=#F92672 gui=bold
+hi Label guifg=#E6DB74 gui=none
+hi Macro guifg=#C4BE89 gui=italic
+hi SpecialKey guifg=#66D9EF gui=italic
+
+hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
+hi ModeMsg guifg=#E6DB74
+hi MoreMsg guifg=#E6DB74
+hi Operator guifg=#F92672
+
+" complete menu
+hi Pmenu guifg=#66D9EF guibg=#000000
+hi PmenuSel guibg=#808080
+hi PmenuSbar guibg=#080808
+hi PmenuThumb guifg=#66D9EF
+
+hi PreCondit guifg=#A6E22E gui=bold
+hi PreProc guifg=#A6E22E
+hi Question guifg=#66D9EF
+hi Repeat guifg=#F92672 gui=bold
+hi Search guifg=#FFFFFF guibg=#455354
+" marks column
+hi SignColumn guifg=#A6E22E guibg=#232526
+hi SpecialChar guifg=#F92672 gui=bold
+hi SpecialComment guifg=#465457 gui=bold
+hi Special guifg=#66D9EF guibg=bg gui=italic
+hi SpecialKey guifg=#888A85 gui=italic
+if has("spell")
+ hi SpellBad guisp=#FF0000 gui=undercurl
+ hi SpellCap guisp=#7070F0 gui=undercurl
+ hi SpellLocal guisp=#70F0F0 gui=undercurl
+ hi SpellRare guisp=#FFFFFF gui=undercurl
+endif
+hi Statement guifg=#F92672 gui=bold
+hi StatusLine guifg=#455354 guibg=fg
+hi StatusLineNC guifg=#808080 guibg=#080808
+hi StorageClass guifg=#FD971F gui=italic
+hi Structure guifg=#66D9EF
+hi Tag guifg=#F92672 gui=italic
+hi Title guifg=#ef5939
+hi Todo guifg=#FFFFFF guibg=bg gui=bold
+
+hi Typedef guifg=#66D9EF
+hi Type guifg=#66D9EF gui=none
+hi Underlined guifg=#808080 gui=underline
+
+hi VertSplit guifg=#808080 guibg=#080808 gui=bold
+hi VisualNOS guibg=#403D3D
+hi Visual guibg=#403D3D
+hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
+hi WildMenu guifg=#66D9EF guibg=#000000
+
+if s:molokai_original == 1
+ hi Normal guifg=#F8F8F2 guibg=#272822
+ hi Comment guifg=#75715E
+ hi CursorLine guibg=#3E3D32
+ hi CursorColumn guibg=#3E3D32
+ hi LineNr guifg=#BCBCBC guibg=#3B3A32
+ hi NonText guifg=#BCBCBC guibg=#3B3A32
+else
+ hi Normal guifg=#F8F8F2 guibg=#1B1D1E
+ hi Comment guifg=#465457
+ hi CursorLine guibg=#293739
+ hi CursorColumn guibg=#293739
+ hi LineNr guifg=#BCBCBC guibg=#232526
+ hi NonText guifg=#BCBCBC guibg=#232526
+end
+
+"
+" Support for 256-color terminal
+"
+if &t_Co > 255
+ hi Boolean ctermfg=135
+ hi Character ctermfg=144
+ hi Number ctermfg=135
+ hi String ctermfg=144
+ hi Conditional ctermfg=161 cterm=bold
+ hi Constant ctermfg=135 cterm=bold
+ hi Cursor ctermfg=16 ctermbg=253
+ hi Debug ctermfg=225 cterm=bold
+ hi Define ctermfg=81
+ hi Delimiter ctermfg=241
+
+ hi DiffAdd ctermbg=24
+ hi DiffChange ctermfg=181 ctermbg=239
+ hi DiffDelete ctermfg=162 ctermbg=53
+ hi DiffText ctermbg=102 cterm=bold
+
+ hi Directory ctermfg=118 cterm=bold
+ hi Error ctermfg=219 ctermbg=89
+ hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
+ hi Exception ctermfg=118 cterm=bold
+ hi Float ctermfg=135
+ hi FoldColumn ctermfg=67 ctermbg=16
+ hi Folded ctermfg=67 ctermbg=16
+ hi Function ctermfg=118
+ hi Identifier ctermfg=208 cterm=none
+ hi Ignore ctermfg=244 ctermbg=232
+ hi IncSearch ctermfg=193 ctermbg=16
+
+ hi Keyword ctermfg=161 cterm=bold
+ hi Label ctermfg=229 cterm=none
+ hi Macro ctermfg=193
+ hi SpecialKey ctermfg=81
+
+ hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
+ hi ModeMsg ctermfg=229
+ hi MoreMsg ctermfg=229
+ hi Operator ctermfg=161
+
+ " complete menu
+ hi Pmenu ctermfg=81 ctermbg=16
+ hi PmenuSel ctermbg=244
+ hi PmenuSbar ctermbg=232
+ hi PmenuThumb ctermfg=81
+
+ hi PreCondit ctermfg=118 cterm=bold
+ hi PreProc ctermfg=118
+ hi Question ctermfg=81
+ hi Repeat ctermfg=161 cterm=bold
+ hi Search ctermfg=253 ctermbg=66
+
+ " marks column
+ hi SignColumn ctermfg=118 ctermbg=235
+ hi SpecialChar ctermfg=161 cterm=bold
+ hi SpecialComment ctermfg=245 cterm=bold
+ hi Special ctermfg=81 ctermbg=232
+ hi SpecialKey ctermfg=245
+
+ hi Statement ctermfg=161 cterm=bold
+ hi StatusLine ctermfg=238 ctermbg=253
+ hi StatusLineNC ctermfg=244 ctermbg=232
+ hi StorageClass ctermfg=208
+ hi Structure ctermfg=81
+ hi Tag ctermfg=161
+ hi Title ctermfg=166
+ hi Todo ctermfg=231 ctermbg=232 cterm=bold
+
+ hi Typedef ctermfg=81
+ hi Type ctermfg=81 cterm=none
+ hi Underlined ctermfg=244 cterm=underline
+
+ hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
+ hi VisualNOS ctermbg=238
+ hi Visual ctermbg=235
+ hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
+ hi WildMenu ctermfg=81 ctermbg=16
+
+ hi Normal ctermfg=252 ctermbg=233
+ hi Comment ctermfg=59
+ hi CursorLine ctermbg=234 cterm=none
+ hi CursorColumn ctermbg=234
+ hi LineNr ctermfg=250 ctermbg=234
+ hi NonText ctermfg=250 ctermbg=234
+end
--- /dev/null
+if exists("g:moria_style")
+ let s:moria_style = g:moria_style
+else
+ let s:moria_style = &background
+endif
+
+if exists("g:moria_monochrome")
+ let s:moria_monochrome = g:moria_monochrome
+else
+ let s:moria_monochrome = 0
+endif
+
+if exists("g:moria_fontface")
+ let s:moria_fontface = g:moria_fontface
+else
+ let s:moria_fontface = "plain"
+endif
+
+execute "command! -nargs=1 Colo let g:moria_style = \"<args>\" | colo moria"
+
+if s:moria_style == "black" || s:moria_style == "dark"
+ set background=dark
+elseif s:moria_style == "light" || s:moria_style == "white"
+ set background=light
+else
+ let s:moria_style = &background
+endif
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "moria"
+
+if &background == "dark"
+ if s:moria_style == "dark"
+ hi Normal ctermbg=Black ctermfg=LightGray guibg=#202020 guifg=#d0d0d0 gui=none
+
+ hi CursorColumn ctermbg=DarkGray ctermfg=White guibg=#404040 gui=none
+ hi CursorLine ctermbg=DarkGray ctermfg=White guibg=#404040 gui=none
+ elseif s:moria_style == "black"
+ hi Normal ctermbg=Black ctermfg=LightGray guibg=#000000 guifg=#d0d0d0 gui=none
+
+ hi CursorColumn ctermbg=DarkGray ctermfg=White guibg=#3a3a3a gui=none
+ hi CursorLine ctermbg=DarkGray ctermfg=White guibg=#3a3a3a gui=none
+ endif
+ if s:moria_monochrome == 1
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#a0a0a0 gui=none
+ hi LineNr guifg=#a0a0a0 gui=none
+ hi MoreMsg guibg=bg guifg=#b6b6b6 gui=bold
+ hi NonText ctermfg=DarkGray guibg=bg guifg=#a0a0a0 gui=bold
+ hi Pmenu guibg=#909090 guifg=#000000 gui=none
+ hi PmenuSbar guibg=#707070 guifg=fg gui=none
+ hi PmenuThumb guibg=#d0d0d0 guifg=bg gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#a0a0a0 gui=none
+ hi StatusLine ctermbg=LightGray ctermfg=Black guibg=#4c4c4c guifg=fg gui=bold
+ hi StatusLineNC ctermbg=DarkGray ctermfg=Black guibg=#404040 guifg=fg gui=none
+ hi TabLine guibg=#6e6e6e guifg=fg gui=underline
+ hi TabLineFill guibg=#6e6e6e guifg=fg gui=underline
+ hi VertSplit ctermbg=LightGray ctermfg=Black guibg=#404040 guifg=fg gui=none
+ if s:moria_fontface == "mixed"
+ hi Folded guibg=#4e4e4e guifg=#c0c0c0 gui=bold
+ else
+ hi Folded guibg=#4e4e4e guifg=#c0c0c0 gui=none
+ endif
+ else
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#8fa5d1 gui=none
+ hi LineNr guifg=#8fa5d1 gui=none
+ hi MoreMsg guibg=bg guifg=#97abd5 gui=bold
+ hi NonText ctermfg=DarkGray guibg=bg guifg=#8fa5d1 gui=bold
+ hi Pmenu guibg=#6381be guifg=#000000 gui=none
+ hi PmenuSbar guibg=#41609e guifg=fg gui=none
+ hi PmenuThumb guibg=#bdcae3 guifg=bg gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#8fa5d1 gui=none
+ hi StatusLine ctermbg=LightGray ctermfg=Black guibg=#334b7d guifg=fg gui=bold
+ hi StatusLineNC ctermbg=DarkGray ctermfg=Black guibg=#25365a guifg=fg gui=none
+ hi TabLine guibg=#41609e guifg=fg gui=underline
+ hi TabLineFill guibg=#41609e guifg=fg gui=underline
+ hi VertSplit ctermbg=LightGray ctermfg=Black guibg=#25365a guifg=fg gui=none
+ if s:moria_fontface == "mixed"
+ hi Folded guibg=#4e4e4e guifg=#bdcae3 gui=bold
+ else
+ hi Folded guibg=#4e4e4e guifg=#bdcae3 gui=none
+ endif
+ endif
+ hi Cursor guibg=#ffa500 guifg=bg gui=none
+ hi DiffAdd guibg=#008b00 guifg=fg gui=none
+ hi DiffChange guibg=#00008b guifg=fg gui=none
+ hi DiffDelete guibg=#8b0000 guifg=fg gui=none
+ hi DiffText guibg=#0000cd guifg=fg gui=bold
+ hi Directory guibg=bg guifg=#1e90ff gui=none
+ hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold
+ hi IncSearch guibg=#e0cd78 guifg=#000000 gui=none
+ hi ModeMsg guibg=bg guifg=fg gui=bold
+ hi PmenuSel guibg=#e0e000 guifg=#000000 gui=none
+ hi Question guibg=bg guifg=#e8b87e gui=bold
+ hi Search guibg=#90e090 guifg=#000000 gui=none
+ hi SpecialKey guibg=bg guifg=#e8b87e gui=none
+ if has("spell")
+ hi SpellBad guisp=#ee2c2c gui=undercurl
+ hi SpellCap guisp=#2c2cee gui=undercurl
+ hi SpellLocal guisp=#2ceeee gui=undercurl
+ hi SpellRare guisp=#ee2cee gui=undercurl
+ endif
+ hi TabLineSel guibg=bg guifg=fg gui=bold
+ hi Title ctermbg=Black ctermfg=White guifg=fg gui=bold
+ if version >= 700
+ hi Visual ctermbg=LightGray ctermfg=Black guibg=#606060 gui=none
+ else
+ hi Visual ctermbg=LightGray ctermfg=Black guibg=#606060 guifg=fg gui=none
+ endif
+ hi VisualNOS ctermbg=DarkGray ctermfg=Black guibg=bg guifg=#a0a0a0 gui=bold,underline
+ hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold
+ hi WildMenu guibg=#e0e000 guifg=#000000 gui=bold
+
+ hi Comment guibg=bg guifg=#d0d0a0 gui=none
+ hi Constant guibg=bg guifg=#87df71 gui=none
+ hi Error guibg=bg guifg=#ee2c2c gui=none
+ hi Identifier guibg=bg guifg=#7ee0ce gui=none
+ hi Ignore guibg=bg guifg=bg gui=none
+ hi lCursor guibg=#00e700 guifg=#000000 gui=none
+ hi MatchParen guibg=#008b8b gui=none
+ hi PreProc guibg=bg guifg=#d7a0d7 gui=none
+ hi Special guibg=bg guifg=#e8b87e gui=none
+ hi Todo guibg=#e0e000 guifg=#000000 gui=none
+ hi Underlined ctermbg=Black ctermfg=White guibg=bg guifg=#00a0ff gui=underline
+
+ if s:moria_fontface == "mixed"
+ hi Statement guibg=bg guifg=#7ec0ee gui=bold
+ hi Type guibg=bg guifg=#f09479 gui=bold
+ else
+ hi Statement guibg=bg guifg=#7ec0ee gui=none
+ hi Type guibg=bg guifg=#f09479 gui=none
+ endif
+
+ hi htmlBold ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=bold
+ hi htmlBoldItalic ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=bold,italic
+ hi htmlBoldUnderline ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=bold,underline
+ hi htmlBoldUnderlineItalic ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=bold,underline,italic
+ hi htmlItalic ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=italic
+ hi htmlUnderline ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=underline
+ hi htmlUnderlineItalic ctermbg=Black ctermfg=White guibg=bg guifg=fg gui=underline,italic
+elseif &background == "light"
+ if s:moria_style == "light"
+ hi Normal ctermbg=White ctermfg=Black guibg=#f0f0f0 guifg=#000000 gui=none
+
+ hi CursorColumn ctermbg=LightGray ctermfg=Black guibg=#d8d8d8 gui=none
+ hi CursorLine ctermbg=LightGray ctermfg=Black guibg=#d8d8d8 gui=none
+ elseif s:moria_style == "white"
+ hi Normal ctermbg=White ctermfg=Black guibg=#ffffff guifg=#000000 gui=none
+
+ hi CursorColumn ctermbg=LightGray ctermfg=Black guibg=#dfdfdf gui=none
+ hi CursorLine ctermbg=LightGray ctermfg=Black guibg=#dfdfdf gui=none
+ endif
+ if s:moria_monochrome == 1
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#7a7a7a gui=none
+ hi Folded guibg=#cfcfcf guifg=#404040 gui=bold
+ hi LineNr guifg=#7a7a7a gui=none
+ hi MoreMsg guibg=bg guifg=#505050 gui=bold
+ hi NonText ctermfg=DarkGray guibg=bg guifg=#7a7a7a gui=bold
+ hi Pmenu guibg=#9a9a9a guifg=#000000 gui=none
+ hi PmenuSbar guibg=#808080 guifg=fg gui=none
+ hi PmenuThumb guibg=#c0c0c0 guifg=fg gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#7a7a7a gui=none
+ hi StatusLine ctermbg=Black ctermfg=White guibg=#a0a0a0 guifg=fg gui=bold
+ hi StatusLineNC ctermbg=LightGray ctermfg=Black guibg=#b0b0b0 guifg=fg gui=none
+ hi TabLine guibg=#cdcdcd guifg=fg gui=underline
+ hi TabLineFill guibg=#cdcdcd guifg=fg gui=underline
+ hi VertSplit ctermbg=LightGray ctermfg=Black guibg=#b0b0b0 guifg=fg gui=none
+ else
+ hi FoldColumn ctermbg=bg guibg=bg guifg=#375288 gui=none
+ hi Folded guibg=#cfcfcf guifg=#25365a gui=bold
+ hi LineNr guifg=#375288 gui=none
+ hi MoreMsg guibg=bg guifg=#2f4471 gui=bold
+ hi NonText ctermfg=DarkGray guibg=bg guifg=#375288 gui=bold
+ hi Pmenu guibg=#708bc5 guifg=#000000 gui=none
+ hi PmenuSbar guibg=#4a6db5 guifg=fg gui=none
+ hi PmenuThumb guibg=#a6b7db guifg=fg gui=none
+ hi SignColumn ctermbg=bg guibg=bg guifg=#375288 gui=none
+ hi StatusLine ctermbg=Black ctermfg=White guibg=#8fa5d1 guifg=fg gui=bold
+ hi StatusLineNC ctermbg=LightGray ctermfg=Black guibg=#a6b7db guifg=fg gui=none
+ hi TabLine guibg=#b8c6e2 guifg=fg gui=underline
+ hi TabLineFill guibg=#b8c6e2 guifg=fg gui=underline
+ hi VertSplit ctermbg=LightGray ctermfg=Black guibg=#a6b7db guifg=fg gui=none
+ endif
+ hi Cursor guibg=#883400 guifg=bg gui=none
+ hi DiffAdd guibg=#008b00 guifg=#ffffff gui=none
+ hi DiffChange guibg=#00008b guifg=#ffffff gui=none
+ hi DiffDelete guibg=#8b0000 guifg=#ffffff gui=none
+ hi DiffText guibg=#0000cd guifg=#ffffff gui=bold
+ hi Directory guibg=bg guifg=#0000f0 gui=none
+ hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold
+ hi IncSearch guibg=#ffcd78 gui=none
+ hi ModeMsg ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=bold
+ hi PmenuSel guibg=#ffff00 guifg=#000000 gui=none
+ hi Question guibg=bg guifg=#813f11 gui=bold
+ hi Search guibg=#a0f0a0 gui=none
+ hi SpecialKey guibg=bg guifg=#912f11 gui=none
+ if has("spell")
+ hi SpellBad guisp=#ee2c2c gui=undercurl
+ hi SpellCap guisp=#2c2cee gui=undercurl
+ hi SpellLocal guisp=#008b8b gui=undercurl
+ hi SpellRare guisp=#ee2cee gui=undercurl
+ endif
+ hi TabLineSel guibg=bg guifg=fg gui=bold
+ hi Title guifg=fg gui=bold
+ if version >= 700
+ hi Visual ctermbg=LightGray ctermfg=Black guibg=#c4c4c4 gui=none
+ else
+ hi Visual ctermbg=LightGray ctermfg=Black guibg=#c4c4c4 guifg=fg gui=none
+ endif
+ hi VisualNOS ctermbg=DarkGray ctermfg=Black guibg=bg guifg=#a0a0a0 gui=bold,underline
+ hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold
+ hi WildMenu guibg=#ffff00 guifg=fg gui=bold
+
+ hi Comment guibg=bg guifg=#786000 gui=none
+ hi Constant guibg=bg guifg=#077807 gui=none
+ hi Error guibg=bg guifg=#ee2c2c gui=none
+ hi Identifier guibg=bg guifg=#007080 gui=none
+ hi Ignore guibg=bg guifg=bg gui=none
+ hi lCursor guibg=#008000 guifg=#ffffff gui=none
+ hi MatchParen guibg=#00ffff gui=none
+ hi PreProc guibg=bg guifg=#800090 gui=none
+ hi Special guibg=bg guifg=#912f11 gui=none
+ hi Statement guibg=bg guifg=#1f3f81 gui=bold
+ hi Todo guibg=#ffff00 guifg=fg gui=none
+ hi Type guibg=bg guifg=#912f11 gui=bold
+ hi Underlined ctermbg=White ctermfg=Black guibg=bg guifg=#0000cd gui=underline
+
+ hi htmlBold ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=bold
+ hi htmlBoldItalic ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=bold,italic
+ hi htmlBoldUnderline ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=bold,underline
+ hi htmlBoldUnderlineItalic ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=bold,underline,italic
+ hi htmlItalic ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=italic
+ hi htmlUnderline ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=underline
+ hi htmlUnderlineItalic ctermbg=White ctermfg=Black guibg=bg guifg=fg gui=underline,italic
+endif
+
+hi! default link bbcodeBold htmlBold
+hi! default link bbcodeBoldItalic htmlBoldItalic
+hi! default link bbcodeBoldItalicUnderline htmlBoldUnderlineItalic
+hi! default link bbcodeBoldUnderline htmlBoldUnderline
+hi! default link bbcodeItalic htmlItalic
+hi! default link bbcodeItalicUnderline htmlUnderlineItalic
+hi! default link bbcodeUnderline htmlUnderline
--- /dev/null
+" Vim color file
+" Maintainer: Tim Alexeevsky <realtim@mail.ru>
+" Last Change: 2002-03-14
+" Version: 0.5
+" URL: http://sunsite.cs.msu.su/~tim/vim/sand.vim
+"
+" Thanx to Hans Fugal for his colorscheme_template.vim
+
+set background=light
+hi clear
+if exists("syntax_on")
+ syntax reset
+endif
+let g:colors_name="sand"
+
+highlight Normal guibg=cornsilk guifg=NONE
+highlight PreProc guibg=NONE guifg=Maroon4
+highlight Comment guibg=NONE guifg=SteelBlue4
+highlight Constant guibg=NONE guifg=NavajoWhite4
+highlight Special guibg=NONE guifg=SlateBlue4
+highlight Identifier guibg=NONE guifg=SeaGreen
+highlight Statement guibg=NONE guifg=bisque4
+highlight Type guibg=NONE guifg=DarkOliveGreen
+highlight Todo guibg=LightYellow3 guifg=Blue4
+highlight NonText guibg=NONE guifg=DarkGreen
+highlight LineNr guibg=NONE guifg=Brown
+highlight StatusLineNC guifg=#8090a0
+highlight StatusLine guifg=#005070
+
+"vim: tw=0 sw=3 ts=3 sts=3 et
--- /dev/null
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "twilight"
+
+let s:grey_blue = '#8a9597'
+let s:light_grey_blue = '#a0a8b0'
+let s:dark_grey_blue = '#34383c'
+let s:mid_grey_blue = '#64686c'
+let s:beige = '#ceb67f'
+let s:light_orange = '#ebc471'
+let s:yellow = '#e3d796'
+let s:violet = '#a999ac'
+let s:green = '#a2a96f'
+let s:lightgreen = '#c2c98f'
+let s:red = '#d08356'
+let s:cyan = '#74dad9'
+let s:darkgrey = '#1a1a1a'
+let s:grey = '#303030'
+let s:lightgrey = '#605958'
+let s:white = '#fffedc'
+
+if version >= 700
+ hi CursorLine guibg=#262626
+ hi CursorColumn guibg=#262626
+ hi MatchParen guifg=white guibg=#80a090 gui=bold
+
+ "Tabpages
+ hi TabLine guifg=#a09998 guibg=#202020 gui=underline
+ hi TabLineFill guifg=#a09998 guibg=#202020 gui=underline
+ hi TabLineSel guifg=#a09998 guibg=#404850 gui=underline
+
+ "P-Menu (auto-completion)
+ hi Pmenu guifg=#605958 guibg=#303030 gui=underline
+ hi PmenuSel guifg=#a09998 guibg=#404040 gui=underline
+ "PmenuSbar
+ "PmenuThumb
+endif
+
+hi Visual guibg=#404040
+
+"hi Cursor guifg=NONE guibg=#586068
+hi Cursor guibg=#b0d0f0
+
+
+exe 'hi Normal guifg='.s:white .' guibg='.s:darkgrey
+exe 'hi Underlined guifg='.s:white .' guibg='.s:darkgrey .' gui=underline'
+exe 'hi NonText guifg='.s:lightgrey .' guibg='.s:grey
+exe 'hi SpecialKey guifg='.s:grey .' guibg='.s:darkgrey
+
+exe 'hi LineNr guifg='.s:mid_grey_blue .' guibg='.s:dark_grey_blue .' gui=none'
+exe 'hi StatusLine guifg='.s:white .' guibg='.s:grey .' gui=italic,underline'
+exe 'hi StatusLineNC guifg='.s:lightgrey .' guibg='.s:grey .' gui=italic,underline'
+exe 'hi VertSplit guifg='.s:grey .' guibg='.s:grey .' gui=none'
+
+exe 'hi Folded guifg='.s:grey_blue .' guibg='.s:dark_grey_blue .' gui=none'
+exe 'hi FoldColumn guifg='.s:grey_blue .' guibg='.s:dark_grey_blue .' gui=none'
+exe 'hi SignColumn guifg='.s:grey_blue .' guibg='.s:dark_grey_blue .' gui=none'
+
+exe 'hi Comment guifg='.s:mid_grey_blue .' guibg='.s:darkgrey .' gui=italic'
+exe 'hi TODO guifg='.s:grey_blue .' guibg='.s:darkgrey .' gui=italic,bold'
+
+exe 'hi Title guifg='.s:red .' guibg='.s:darkgrey .' gui=underline'
+
+exe 'hi Constant guifg='.s:red .' guibg='.s:darkgrey .' gui=none'
+exe 'hi String guifg='.s:green .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Special guifg='.s:lightgreen .' guibg='.s:darkgrey .' gui=none'
+
+exe 'hi Identifier guifg='.s:grey_blue .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Statement guifg='.s:beige .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Conditional guifg='.s:beige .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Repeat guifg='.s:beige .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Structure guifg='.s:beige .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Function guifg='.s:violet .' guibg='.s:darkgrey .' gui=none'
+
+exe 'hi PreProc guifg='.s:grey_blue .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Operator guifg='.s:light_orange .' guibg='.s:darkgrey .' gui=none'
+exe 'hi Type guifg='.s:yellow .' guibg='.s:darkgrey .' gui=italic'
+
+"hi Identifier guifg=#7587a6
+" Type d: 'class'
+"hi Structure guifg=#9B859D gui=underline
+"hi Function guifg=#dad085
+" dylan: method, library, ... d: if, return, ...
+"hi Statement guifg=#7187a1 gui=NONE
+" Keywords d: import, module...
+"hi PreProc guifg=#8fbfdc
+"gui=underline
+"hi Operator guifg=#a07020
+"hi Repeat guifg=#906040 gui=underline
+"hi Type guifg=#708090
+
+"hi Type guifg=#f9ee98 gui=NONE
+
+"hi NonText guifg=#808080 guibg=#303030
+
+"hi Macro guifg=#a0b0c0 gui=underline
+
+"Tabs, trailing spaces, etc (lcs)
+"hi SpecialKey guifg=#808080 guibg=#343434
+
+"hi TooLong guibg=#ff0000 guifg=#f8f8f8
+
+hi Search guifg=#606000 guibg=#c0c000 gui=bold
+
+hi Directory guifg=#dad085 gui=NONE
+hi Error guibg=#602020
+
--- /dev/null
+" Maintainer: Lars H. Nielsen (dengmao@gmail.com)
+" Last Change: January 22 2007
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "wombat"
+
+
+" Vim >= 7.0 specific colors
+if version >= 700
+ hi CursorLine guibg=#2d2d2d
+ hi CursorColumn guibg=#2d2d2d
+ hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold
+ hi Pmenu guifg=#f6f3e8 guibg=#444444
+ hi PmenuSel guifg=#000000 guibg=#cae682
+endif
+
+" General colors
+hi Cursor guifg=NONE guibg=#656565 gui=none
+hi Normal guifg=#f6f3e8 guibg=#242424 gui=none
+hi NonText guifg=#808080 guibg=#303030 gui=none
+hi LineNr guifg=#857b6f guibg=#000000 gui=none
+hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic
+hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none
+hi VertSplit guifg=#444444 guibg=#444444 gui=none
+hi Folded guibg=#384048 guifg=#a0a8b0 gui=none
+hi Title guifg=#f6f3e8 guibg=NONE gui=bold
+hi Visual guifg=#f6f3e8 guibg=#444444 gui=none
+hi SpecialKey guifg=#808080 guibg=#343434 gui=none
+
+" Syntax highlighting
+hi Comment guifg=#99968b gui=italic
+hi Todo guifg=#8f8f8f gui=italic
+hi Constant guifg=#e5786d gui=none
+hi String guifg=#95e454 gui=italic
+hi Identifier guifg=#cae682 gui=none
+hi Function guifg=#cae682 gui=none
+hi Type guifg=#cae682 gui=none
+hi Statement guifg=#8ac6f2 gui=none
+hi Keyword guifg=#8ac6f2 gui=none
+hi PreProc guifg=#e5786d gui=none
+hi Number guifg=#e5786d gui=none
+hi Special guifg=#e7f6da gui=none
+
+
--- /dev/null
+" Vim color file
+"
+" Name: xoria256.vim
+" Version: 1.5
+" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
+"
+" Should work in recent 256 color terminals. 88-color terms like urxvt are
+" NOT supported.
+"
+" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
+" similar value.
+"
+" Color numbers (0-255) see:
+" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
+"
+" For a specific filetype highlighting rules issue :syntax list when a file of
+" that type is opened.
+
+" Initialization {{{
+if &t_Co != 256 && ! has("gui_running")
+ echomsg ""
+ echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
+ echomsg ""
+ finish
+endif
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+ syntax reset
+endif
+
+let colors_name = "xoria256"
+"}}}
+" Colours {{{1
+"" General {{{2
+hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
+hi Cursor ctermbg=214 guibg=#ffaf00
+hi CursorColumn ctermbg=238 guibg=#444444
+hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
+hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
+hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
+hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
+" TODO
+" hi MoreMsg
+hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
+hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
+hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
+hi PmenuSbar ctermbg=252 guibg=#d0d0d0
+hi PmenuThumb ctermfg=243 guifg=#767676
+hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
+hi SignColumn ctermfg=248 guifg=#a8a8a8
+hi SpecialKey ctermfg=77 guifg=#5fdf5f
+hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
+hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
+hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
+hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
+hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
+hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" FIXME
+hi Title ctermfg=225 guifg=#ffdfff
+hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
+hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
+hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
+" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
+" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
+hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
+" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
+hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
+hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
+
+"" Syntax highlighting {{{2
+hi Comment ctermfg=244 guifg=#808080
+hi Constant ctermfg=229 guifg=#ffffaf
+hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
+hi Ignore ctermfg=238 guifg=#444444
+hi Number ctermfg=180 guifg=#dfaf87
+hi PreProc ctermfg=150 guifg=#afdf87
+hi Special ctermfg=174 guifg=#df8787
+hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
+hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
+
+"" Special {{{2
+""" .diff {{{3
+hi diffAdded ctermfg=150 guifg=#afdf87
+hi diffRemoved ctermfg=174 guifg=#df8787
+""" vimdiff {{{3
+hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
+"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
+hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
+hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
+hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
+""" HTML {{{3
+" hi htmlTag ctermfg=146 guifg=#afafdf
+" hi htmlEndTag ctermfg=146 guifg=#afafdf
+hi htmlTag ctermfg=244
+hi htmlEndTag ctermfg=244
+hi htmlArg ctermfg=182 guifg=#dfafdf
+hi htmlValue ctermfg=187 guifg=#dfdfaf
+hi htmlTitle ctermfg=254 ctermbg=95
+" hi htmlArg ctermfg=146
+" hi htmlTagName ctermfg=146
+" hi htmlString ctermfg=187
+""" django {{{3
+hi djangoVarBlock ctermfg=180
+hi djangoTagBlock ctermfg=150
+hi djangoStatement ctermfg=146
+hi djangoFilter ctermfg=174
+""" python {{{3
+hi pythonExceptions ctermfg=174
+""" NERDTree {{{3
+hi Directory ctermfg=110 guifg=#87afdf
+hi treeCWD ctermfg=180 guifg=#dfaf87
+hi treeClosable ctermfg=174 guifg=#df8787
+hi treeOpenable ctermfg=150 guifg=#afdf87
+hi treePart ctermfg=244 guifg=#808080
+hi treeDirSlash ctermfg=244 guifg=#808080
+hi treeLink ctermfg=182 guifg=#dfafdf
+
+""" VimDebug {{{3
+" FIXME
+" you may want to set SignColumn highlight in your .vimrc
+" :help sign
+" :help SignColumn
+
+" hi currentLine term=reverse cterm=reverse gui=reverse
+" hi breakPoint term=NONE cterm=NONE gui=NONE
+" hi empty term=NONE cterm=NONE gui=NONE
+
+" sign define currentLine linehl=currentLine
+" sign define breakPoint linehl=breakPoint text=>>
+" sign define both linehl=currentLine text=>>
+" sign define empty linehl=empty
+
--- /dev/null
+" Vim color file
+" Maintainer: Jani Nurminen <slinky@iki.fi>
+" Last Change: $Id: zenburn.vim,v 2.2 2008/07/10 19:51:09 slinky Exp slinky $
+" URL: http://slinky.imukuppi.org/zenburnpage/
+" License: GPL
+"
+" Nothing too fancy, just some alien fruit salad to keep you in the zone.
+" This syntax file was designed to be used with dark environments and
+" low light situations. Of course, if it works during a daybright office, go
+" ahead :)
+"
+" Owes heavily to other Vim color files! With special mentions
+" to "BlackDust", "Camo" and "Desert".
+"
+" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn.
+" See also :help syntax
+"
+" Credits:
+" - Jani Nurminen - original Zenburn
+" - Steve Hall & Cream posse - higher-contrast Visual selection
+" - Kurt Maier - 256 color console coloring, low and high contrast toggle,
+" bug fixing
+" - Charlie - spotted too bright StatusLine in non-high contrast mode
+"
+" CONFIGURABLE PARAMETERS:
+"
+" You can use the default (don't set any parameters), or you can
+" set some parameters to tweak the Zenburn colours.
+"
+" * You can now set a darker background for bright environments. To activate, use:
+" contrast Zenburn, use:
+"
+" let g:zenburn_high_Contrast = 1
+"
+" * To get more contrast to the Visual selection, use
+"
+" let g:zenburn_alternate_Visual = 1
+"
+" * To use alternate colouring for Error message, use
+"
+" let g:zenburn_alternate_Error = 1
+"
+" * The new default for Include is a duller orange. To use the original
+" colouring for Include, use
+"
+" let g:zenburn_alternate_Include = 1
+"
+" * To turn the parameter(s) back to defaults, use UNLET:
+"
+" unlet g:zenburn_alternate_Include
+"
+" Setting to 0 won't work!
+"
+" That's it, enjoy!
+"
+" TODO
+" - Visual alternate color is broken? Try GVim >= 7.0.66 if you have trouble
+" - IME colouring (CursorIM)
+
+set background=dark
+hi clear
+if exists("syntax_on")
+ syntax reset
+endif
+let g:colors_name="zenburn"
+
+hi Boolean guifg=#dca3a3
+hi Character guifg=#dca3a3 gui=bold
+hi Comment guifg=#7f9f7f gui=italic
+hi Conditional guifg=#f0dfaf gui=bold
+hi Constant guifg=#dca3a3 gui=bold
+hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold
+hi Debug guifg=#bca3a3 gui=bold
+hi Define guifg=#ffcfaf gui=bold
+hi Delimiter guifg=#8f8f8f
+hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold
+hi DiffChange guibg=#333333
+hi DiffDelete guifg=#333333 guibg=#464646
+hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold
+hi Directory guifg=#dcdccc gui=bold
+hi ErrorMsg guifg=#80d4aa guibg=#2f2f2f gui=bold
+hi Exception guifg=#c3bf9f gui=bold
+hi Float guifg=#c0bed1
+hi FoldColumn guifg=#93b3a3 guibg=#3f4040
+hi Folded guifg=#93b3a3 guibg=#3f4040
+hi Function guifg=#efef8f
+hi Identifier guifg=#efdcbc
+hi IncSearch guibg=#f8f893 guifg=#385f38
+hi Keyword guifg=#f0dfaf gui=bold
+hi Label guifg=#dfcfaf gui=underline
+hi LineNr guifg=#9fafaf guibg=#262626
+hi Macro guifg=#ffcfaf gui=bold
+hi ModeMsg guifg=#ffcfaf gui=none
+hi MoreMsg guifg=#ffffff gui=bold
+hi NonText guifg=#404040
+hi Number guifg=#8cd0d3
+hi Operator guifg=#f0efd0
+hi PreCondit guifg=#dfaf8f gui=bold
+hi PreProc guifg=#ffcfaf gui=bold
+hi Question guifg=#ffffff gui=bold
+hi Repeat guifg=#ffd7a7 gui=bold
+hi Search guifg=#ffffe0 guibg=#284f28
+hi SpecialChar guifg=#dca3a3 gui=bold
+hi SpecialComment guifg=#82a282 gui=bold
+hi Special guifg=#cfbfaf
+hi SpecialKey guifg=#9ece9e
+hi Statement guifg=#e3ceab gui=none
+hi StatusLine guifg=#313633 guibg=#ccdc90
+hi StatusLineNC guifg=#2e3330 guibg=#88b090
+hi StorageClass guifg=#c3bf9f gui=bold
+hi String guifg=#cc9393
+hi Structure guifg=#efefaf gui=bold
+hi Tag guifg=#e89393 gui=bold
+hi Title guifg=#efefef gui=bold
+hi Todo guifg=#dfdfdf guibg=bg gui=bold
+hi Typedef guifg=#dfe4cf gui=bold
+hi Type guifg=#dfdfbf gui=bold
+hi Underlined guifg=#dcdccc gui=underline
+hi VertSplit guifg=#2e3330 guibg=#688060
+hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline
+hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold
+hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline
+
+hi SpellBad guisp=#bc6c4c guifg=#dc8c6c
+hi SpellCap guisp=#6c6c9c guifg=#8c8cbc
+hi SpellRare guisp=#bc6c9c guifg=#bc8cbc
+hi SpellLocal guisp=#7cac7c guifg=#9ccc9c
+
+" Entering Kurt zone
+if &t_Co > 255
+ hi Boolean ctermfg=181
+ hi Character ctermfg=181 cterm=bold
+ hi Comment ctermfg=108
+ hi Conditional ctermfg=223 cterm=bold
+ hi Constant ctermfg=181 cterm=bold
+ hi Cursor ctermfg=233 ctermbg=109 cterm=bold
+ hi Debug ctermfg=181 cterm=bold
+ hi Define ctermfg=223 cterm=bold
+ hi Delimiter ctermfg=245
+ hi DiffAdd ctermfg=66 ctermbg=237 cterm=bold
+ hi DiffChange ctermbg=236
+ hi DiffDelete ctermfg=236 ctermbg=238
+ hi DiffText ctermfg=217 ctermbg=237 cterm=bold
+ hi Directory ctermfg=188 cterm=bold
+ hi ErrorMsg ctermfg=115 ctermbg=236 cterm=bold
+ hi Exception ctermfg=249 cterm=bold
+ hi Float ctermfg=251
+ hi FoldColumn ctermfg=109 ctermbg=238
+ hi Folded ctermfg=109 ctermbg=238
+ hi Function ctermfg=228
+ hi Identifier ctermfg=223
+ hi IncSearch ctermbg=228 ctermfg=238
+ hi Keyword ctermfg=223 cterm=bold
+ hi Label ctermfg=187 cterm=underline
+ hi LineNr ctermfg=248 ctermbg=235
+ hi Macro ctermfg=223 cterm=bold
+ hi ModeMsg ctermfg=223 cterm=none
+ hi MoreMsg ctermfg=15 cterm=bold
+ hi NonText ctermfg=238
+ hi Number ctermfg=116
+ hi Operator ctermfg=230
+ hi PreCondit ctermfg=180 cterm=bold
+ hi PreProc ctermfg=223 cterm=bold
+ hi Question ctermfg=15 cterm=bold
+ hi Repeat ctermfg=223 cterm=bold
+ hi Search ctermfg=230 ctermbg=236
+ hi SpecialChar ctermfg=181 cterm=bold
+ hi SpecialComment ctermfg=108 cterm=bold
+ hi Special ctermfg=181
+ hi SpecialKey ctermfg=151
+ hi Statement ctermfg=187 ctermbg=234 cterm=none
+ hi StatusLine ctermfg=236 ctermbg=186
+ hi StatusLineNC ctermfg=235 ctermbg=108
+ hi StorageClass ctermfg=249 cterm=bold
+ hi String ctermfg=174
+ hi Structure ctermfg=229 cterm=bold
+ hi Tag ctermfg=181 cterm=bold
+ hi Title ctermfg=7 ctermbg=234 cterm=bold
+ hi Todo ctermfg=108 ctermbg=234 cterm=bold
+ hi Typedef ctermfg=253 cterm=bold
+ hi Type ctermfg=187 cterm=bold
+ hi Underlined ctermfg=188 ctermbg=234 cterm=bold
+ hi VertSplit ctermfg=236 ctermbg=65
+ hi VisualNOS ctermfg=236 ctermbg=210 cterm=bold
+ hi WarningMsg ctermfg=15 ctermbg=236 cterm=bold
+ hi WildMenu ctermbg=236 ctermfg=194 cterm=bold
+ if exists("g:zenburn_high_Contrast")
+ hi Normal ctermfg=188 ctermbg=234
+ else
+ hi Normal ctermfg=188 ctermbg=237
+ hi Cursor ctermbg=109
+ hi diffadd ctermbg=237
+ hi diffdelete ctermbg=238
+ hi difftext ctermbg=237
+ hi errormsg ctermbg=237
+ hi foldcolumn ctermbg=238
+ hi folded ctermbg=238
+ hi incsearch ctermbg=228
+ hi linenr ctermbg=238
+ hi search ctermbg=238
+ hi statement ctermbg=237
+ hi statusline ctermbg=144
+ hi statuslinenc ctermbg=108
+ hi title ctermbg=237
+ hi todo ctermbg=237
+ hi underlined ctermbg=237
+ hi vertsplit ctermbg=65
+ hi visualnos ctermbg=210
+ hi warningmsg ctermbg=236
+ hi wildmenu ctermbg=236
+ endif
+endif
+
+if exists("g:zenburn_high_Contrast")
+ " use new darker background
+ hi Normal guifg=#dcdccc guibg=#1f1f1f
+ hi CursorLine guibg=#121212 gui=bold
+ hi Pmenu guibg=#242424 guifg=#ccccbc
+ hi PMenuSel guibg=#353a37 guifg=#ccdc90 gui=bold
+ hi PmenuSbar guibg=#2e3330 guifg=#000000
+ hi PMenuThumb guibg=#a0afa0 guifg=#040404
+ hi MatchParen guifg=#f0f0c0 guibg=#383838 gui=bold
+ hi SignColumn guifg=#9fafaf guibg=#181818 gui=bold
+ hi TabLineFill guifg=#cfcfaf guibg=#181818 gui=bold
+ hi TabLineSel guifg=#efefef guibg=#1c1c1b gui=bold
+ hi TabLine guifg=#b6bf98 guibg=#181818 gui=bold
+ hi CursorColumn guifg=#dcdccc guibg=#2b2b2b
+else
+ " Original, lighter background
+ hi Normal guifg=#dcdccc guibg=#3f3f3f
+ hi CursorLine guibg=#434443
+ hi Pmenu guibg=#2c2e2e guifg=#9f9f9f
+ hi PMenuSel guibg=#242424 guifg=#d0d0a0 gui=bold
+ hi PmenuSbar guibg=#2e3330 guifg=#000000
+ hi PMenuThumb guibg=#a0afa0 guifg=#040404
+ hi MatchParen guifg=#b2b2a0 guibg=#2e2e2e gui=bold
+ hi SignColumn guifg=#9fafaf guibg=#343434 gui=bold
+ hi TabLineFill guifg=#cfcfaf guibg=#353535 gui=bold
+ hi TabLineSel guifg=#efefef guibg=#3a3a39 gui=bold
+ hi TabLine guifg=#b6bf98 guibg=#353535 gui=bold
+ hi CursorColumn guifg=#dcdccc guibg=#4f4f4f
+endif
+
+
+if exists("g:zenburn_alternate_Visual")
+ " Visual with more contrast, thanks to Steve Hall & Cream posse
+ " gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier
+ hi Visual guifg=#000000 guibg=#71d3b4 gui=none
+ hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none
+else
+ " use default visual
+ hi Visual guifg=#233323 guibg=#71d3b4 gui=none
+ hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none
+endif
+
+if exists("g:zenburn_alternate_Error")
+ " use a bit different Error
+ hi Error guifg=#ef9f9f guibg=#201010 gui=bold
+else
+ " default
+ hi Error guifg=#e37170 guibg=#332323 gui=none
+endif
+
+if exists("g:zenburn_alternate_Include")
+ " original setting
+ hi Include guifg=#ffcfaf gui=bold
+else
+ " new, less contrasted one
+ hi Include guifg=#dfaf8f gui=bold
+endif
+ " TODO check for more obscure syntax groups that they're ok