vim-scripts-20130814ubuntu1/0000755000000000000000000000000012204336114012444 5ustar vim-scripts-20130814ubuntu1/autoload/0000755000000000000000000000000012204336114014254 5ustar vim-scripts-20130814ubuntu1/autoload/omni/0000755000000000000000000000000012204336114015216 5ustar vim-scripts-20130814ubuntu1/autoload/omni/cpp/0000755000000000000000000000000012204336114016000 5ustar vim-scripts-20130814ubuntu1/autoload/omni/cpp/includes.vim0000644000000000000000000001056012204336073020331 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 let g:omni#cpp#includes#CACHE_INCLUDES = {} let g:omni#cpp#includes#CACHE_FILE_TIME = {} let s:rePreprocIncludePart = '\C#\s*include\s*' let s:reIncludeFilePart = '\(<\|"\)\(\f\|\s\)\+\(>\|"\)' let s:rePreprocIncludeFile = s:rePreprocIncludePart . s:reIncludeFilePart " Get the include list of a file function! omni#cpp#includes#GetList(...) if a:0 > 0 return s:GetIncludeListFromFile(a:1, (a:0 > 1)? a:2 : 0 ) else return s:GetIncludeListFromCurrentBuffer() endif endfunc " Get the include list from the current buffer function! s:GetIncludeListFromCurrentBuffer() let listIncludes = [] let originalPos = getpos('.') call setpos('.', [0, 1, 1, 0]) let curPos = [1,1] let alreadyInclude = {} while curPos != [0,0] let curPos = searchpos('\C\(^'.s:rePreprocIncludeFile.'\)', 'W') if curPos != [0,0] let szLine = getline('.') let startPos = curPos[1] let endPos = matchend(szLine, s:reIncludeFilePart, startPos-1) if endPos!=-1 let szInclusion = szLine[startPos-1:endPos-1] let szIncludeFile = substitute(szInclusion, '\('.s:rePreprocIncludePart.'\)\|[<>""]', '', 'g') let szResolvedInclude = omni#cpp#utils#ResolveFilePath(szIncludeFile) " Protection over self inclusion if szResolvedInclude != '' && szResolvedInclude != omni#cpp#utils#ResolveFilePath(getreg('%')) let includePos = curPos if !has_key(alreadyInclude, szResolvedInclude) call extend(listIncludes, [{'pos' : includePos, 'include' : szResolvedInclude}]) let alreadyInclude[szResolvedInclude] = 1 endif endif endif endif endwhile call setpos('.', originalPos) return listIncludes endfunc " Get the include list from a file function! s:GetIncludeListFromFile(szFilePath, bUpdate) let listIncludes = [] if a:szFilePath == '' return listIncludes endif if !a:bUpdate && has_key(g:omni#cpp#includes#CACHE_INCLUDES, a:szFilePath) return copy(g:omni#cpp#includes#CACHE_INCLUDES[a:szFilePath]) endif let g:omni#cpp#includes#CACHE_FILE_TIME[a:szFilePath] = getftime(a:szFilePath) let szFixedPath = escape(a:szFilePath, g:omni#cpp#utils#szEscapedCharacters) execute 'silent! lvimgrep /\C\(^'.s:rePreprocIncludeFile.'\)/gj '.szFixedPath let listQuickFix = getloclist(0) let alreadyInclude = {} for qf in listQuickFix let szLine = qf.text let startPos = qf.col let endPos = matchend(szLine, s:reIncludeFilePart, startPos-1) if endPos!=-1 let szInclusion = szLine[startPos-1:endPos-1] let szIncludeFile = substitute(szInclusion, '\('.s:rePreprocIncludePart.'\)\|[<>""]', '', 'g') let szResolvedInclude = omni#cpp#utils#ResolveFilePath(szIncludeFile) " Protection over self inclusion if szResolvedInclude != '' && szResolvedInclude != a:szFilePath let includePos = [qf.lnum, qf.col] if !has_key(alreadyInclude, szResolvedInclude) call extend(listIncludes, [{'pos' : includePos, 'include' : szResolvedInclude}]) let alreadyInclude[szResolvedInclude] = 1 endif endif endif endfor let g:omni#cpp#includes#CACHE_INCLUDES[a:szFilePath] = listIncludes return copy(listIncludes) endfunc " For debug purpose function! omni#cpp#includes#Display() let szPathBuffer = omni#cpp#utils#ResolveFilePath(getreg('%')) call s:DisplayIncludeTree(szPathBuffer, 0) endfunc " For debug purpose function! s:DisplayIncludeTree(szFilePath, indent, ...) let includeGuard = {} if a:0 >0 let includeGuard = a:1 endif let szFilePath = omni#cpp#utils#ResolveFilePath(a:szFilePath) if has_key(includeGuard, szFilePath) return else let includeGuard[szFilePath] = 1 endif let szIndent = repeat(' ', a:indent) echo szIndent . a:szFilePath let incList = omni#cpp#includes#GetList(a:szFilePath) for inc in incList call s:DisplayIncludeTree(inc.include, a:indent+1, includeGuard) endfor endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/items.vim0000644000000000000000000005520512204336073017651 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 " Build the item list of an instruction " An item is an instruction between a -> or . or ->* or .* " We can sort an item in different kinds: " eg: ((MyClass1*)(pObject))->_memberOfClass1.get() ->show() " | cast | | member | | method | | method | " @return a list of item " an item is a dictionnary where keys are: " tokens = list of token " kind = itemVariable|itemCast|itemCppCast|itemTemplate|itemFunction|itemUnknown|itemThis|itemScope function! omni#cpp#items#Get(tokens, ...) let bGetWordUnderCursor = (a:0>0)? a:1 : 0 let result = [] let itemsDelimiters = ['->', '.', '->*', '.*'] let tokens = reverse(omni#cpp#utils#BuildParenthesisGroups(a:tokens)) " fsm states: " 0 = initial state " TODO: add description of fsm states let state=(bGetWordUnderCursor)? 1 : 0 let item = {'tokens' : [], 'kind' : 'itemUnknown'} let parenGroup=-1 for token in tokens if state==0 if index(itemsDelimiters, token.value)>=0 let item = {'tokens' : [], 'kind' : 'itemUnknown'} let state = 1 elseif token.value=='::' let state = 9 let item.kind = 'itemScope' " Maybe end of tokens elseif token.kind =='cppOperatorPunctuator' " If it's a cppOperatorPunctuator and the current token is not " a itemsDelimiters or '::' we can exit let state=-1 break endif elseif state==1 call insert(item.tokens, token) if token.kind=='cppWord' " It's an attribute member or a variable let item.kind = 'itemVariable' let state = 2 " Maybe end of tokens elseif token.value=='this' let item.kind = 'itemThis' let state = 2 " Maybe end of tokens elseif token.value==')' let parenGroup = token.group let state = 3 elseif token.value==']' let parenGroup = token.group let state = 4 elseif token.kind == 'cppDigit' let state = -1 break endif elseif state==2 if index(itemsDelimiters, token.value)>=0 call insert(result, item) let item = {'tokens' : [], 'kind' : 'itemUnknown'} let state = 1 elseif token.value == '::' call insert(item.tokens, token) " We have to get namespace or classscope let state = 8 " Maybe end of tokens else call insert(result, item) let state=-1 break endif elseif state==3 call insert(item.tokens, token) if token.value=='(' && token.group == parenGroup let state = 5 " Maybe end of tokens endif elseif state==4 call insert(item.tokens, token) if token.value=='[' && token.group == parenGroup let state = 1 endif elseif state==5 if token.kind=='cppWord' " It's a function or method let item.kind = 'itemFunction' call insert(item.tokens, token) let state = 2 " Maybe end of tokens elseif token.value == '>' " Maybe a cpp cast or template let item.kind = 'itemTemplate' call insert(item.tokens, token) let parenGroup = token.group let state = 6 else " Perhaps it's a C cast eg: ((void*)(pData)) or a variable eg:(*pData) let item.kind = omni#cpp#utils#GetCastType(item.tokens) let state=-1 call insert(result, item) break endif elseif state==6 call insert(item.tokens, token) if token.value == '<' && token.group == parenGroup " Maybe a cpp cast or template let state = 7 endif elseif state==7 call insert(item.tokens, token) if token.kind=='cppKeyword' " It's a cpp cast let item.kind = omni#cpp#utils#GetCastType(item.tokens) let state=-1 call insert(result, item) break else " Template ? let state=-1 call insert(result, item) break endif elseif state==8 if token.kind=='cppWord' call insert(item.tokens, token) let state = 2 " Maybe end of tokens else let state=-1 call insert(result, item) break endif elseif state==9 if token.kind == 'cppWord' call insert(item.tokens, token) let state = 10 " Maybe end of tokens else let state=-1 call insert(result, item) break endif elseif state==10 if token.value == '::' call insert(item.tokens, token) let state = 9 " Maybe end of tokens else let state=-1 call insert(result, item) break endif endif endfor if index([2, 5, 8, 9, 10], state)>=0 if state==5 let item.kind = omni#cpp#utils#GetCastType(item.tokens) endif call insert(result, item) endif return result endfunc " Resolve type information of items " @param namespaces: list of namespaces used in the file " @param szCurrentClassScope: the current class scope, only used for the first " item to detect if this item is a class member (attribute, method) " @param items: list of item, can be an empty list @see GetItemsToComplete function! omni#cpp#items#ResolveItemsTypeInfo(contextStack, items) " Note: kind = itemVariable|cCast|cppCast|template|function|itemUnknown|this " For the first item, if it's a variable we try to detect the type of the " variable with the function searchdecl. If it fails, thanks to the " current class scope, we try to detect if the variable is an attribute " member. " If the kind of the item is a function, we have to first check if the " function is a method of the class, if it fails we try to get a match in " the global namespace. After that we get the returned type of the " function. " It the kind is a C cast or C++ cast, there is no problem, it's the " easiest case. We just extract the type of the cast. let szCurrentContext = '' let typeInfo = {} " Note: We search the decl only for the first item let bSearchDecl = 1 for item in a:items let curItem = item if index(['itemVariable', 'itemFunction'], curItem.kind)>=0 " Note: a variable can be : MyNs::MyClass::_var or _var or (*pVar) " or _var[0][0] let szSymbol = s:GetSymbol(curItem.tokens) " If we have MyNamespace::myVar " We add MyNamespace in the context stack set szSymbol to myVar if match(szSymbol, '::\w\+$') >= 0 let szCurrentContext = substitute(szSymbol, '::\w\+$', '', 'g') let szSymbol = matchstr(szSymbol, '\w\+$') endif let tmpContextStack = a:contextStack if szCurrentContext != '' let tmpContextStack = [szCurrentContext] + a:contextStack endif if curItem.kind == 'itemVariable' let typeInfo = s:GetTypeInfoOfVariable(tmpContextStack, szSymbol, bSearchDecl) else let typeInfo = s:GetTypeInfoOfReturnedType(tmpContextStack, szSymbol) endif elseif curItem.kind == 'itemThis' if len(a:contextStack) let typeInfo = omni#cpp#utils#CreateTypeInfo(substitute(a:contextStack[0], '^::', '', 'g')) endif elseif curItem.kind == 'itemCast' let typeInfo = omni#cpp#utils#CreateTypeInfo(s:ResolveCCast(curItem.tokens)) elseif curItem.kind == 'itemCppCast' let typeInfo = omni#cpp#utils#CreateTypeInfo(s:ResolveCppCast(curItem.tokens)) elseif curItem.kind == 'itemScope' let typeInfo = omni#cpp#utils#CreateTypeInfo(substitute(s:TokensToString(curItem.tokens), '\s', '', 'g')) endif if omni#cpp#utils#IsTypeInfoValid(typeInfo) let szCurrentContext = omni#cpp#utils#GetTypeInfoString(typeInfo) endif let bSearchDecl = 0 endfor return typeInfo endfunc " Get symbol name function! s:GetSymbol(tokens) let szSymbol = '' let state = 0 for token in a:tokens if state == 0 if token.value == '::' let szSymbol .= token.value let state = 1 elseif token.kind == 'cppWord' let szSymbol .= token.value let state = 2 " Maybe end of token endif elseif state == 1 if token.kind == 'cppWord' let szSymbol .= token.value let state = 2 " Maybe end of token else " Error break endif elseif state == 2 if token.value == '::' let szSymbol .= token.value let state = 1 else break endif endif endfor return szSymbol endfunc " Search a declaration. " eg: std::map " can be empty " Note: The returned type info can be a typedef " The typedef resolution is done later " @return " - a dictionnary where keys are " - type: the type of value same as type() " - value: the value function! s:GetTypeInfoOfVariable(contextStack, szVariable, bSearchDecl) let result = {} if a:bSearchDecl " Search type of declaration "let result = s:SearchTypeInfoOfDecl(a:szVariable) let result = s:SearchDecl(a:szVariable) endif if result=={} let szFilter = "index(['m', 'v'], v:val.kind[0])>=0" let tagItem = s:ResolveSymbol(a:contextStack, a:szVariable, szFilter) if tagItem=={} return result endif let szCmdWithoutVariable = substitute(omni#cpp#utils#ExtractCmdFromTagItem(tagItem), '\C\<'.a:szVariable.'\>.*', '', 'g') let tokens = omni#cpp#tokenizer#Tokenize(omni#cpp#utils#GetCodeFromLine(szCmdWithoutVariable)) let result = omni#cpp#utils#CreateTypeInfo(omni#cpp#utils#ExtractTypeInfoFromTokens(tokens)) " TODO: Namespace resolution for result if result != {} && result.value=='' " result.value=='' " eg: " struct " { " }gVariable; if has_key(tagItem, 'typeref') " Maybe the variable is a global var of an " unnamed class, struct or union. " eg: " 1) " struct " { " }gVariable; " In this case we need the tags (the patched version) " Note: We can have a named type like this: " 2) " class A " { " }gVariable; if s:IsUnnamedType(tagItem) " It's an unnamed type we are in the case 1) let result = omni#cpp#utils#CreateTypeInfo(tagItem) else " It's not an unnamed type we are in the case 2) " eg: tagItem.typeref = 'struct:MY_STRUCT::MY_SUBSTRUCT' let szTypeRef = substitute(tagItem.typeref, '^\w\+:', '', '') " eg: szTypeRef = 'MY_STRUCT::MY_SUBSTRUCT' let result = omni#cpp#utils#CreateTypeInfo(szTypeRef) endif endif endif endif return result endfunc " Get the type info string from the returned type of function function! s:GetTypeInfoOfReturnedType(contextStack, szFunctionName) let result = {} let szFilter = "index(['f', 'p'], v:val.kind[0])>=0" let tagItem = s:ResolveSymbol(a:contextStack, a:szFunctionName, szFilter) if tagItem != {} let szCmdWithoutVariable = substitute(omni#cpp#utils#ExtractCmdFromTagItem(tagItem), '\C\<'.a:szFunctionName.'\>.*', '', 'g') let tokens = omni#cpp#tokenizer#Tokenize(omni#cpp#utils#GetCodeFromLine(szCmdWithoutVariable)) let result = omni#cpp#utils#CreateTypeInfo(omni#cpp#utils#ExtractTypeInfoFromTokens(tokens)) " TODO: Namespace resolution for result return result endif return result endfunc " Resolve a symbol, return a tagItem " Gets the first symbol found in the context stack function! s:ResolveSymbol(contextStack, szSymbol, szTagFilter) let tagItem = {} for szCurrentContext in a:contextStack if szCurrentContext != '::' let szTagQuery = substitute(szCurrentContext, '^::', '', 'g').'::'.a:szSymbol else let szTagQuery = a:szSymbol endif let tagList = omni#common#utils#TagListNoThrow('^'.szTagQuery.'$') call filter(tagList, a:szTagFilter) if len(tagList) let tagItem = tagList[0] break endif endfor return tagItem endfunc " Return if the tag item represent an unnamed type function! s:IsUnnamedType(tagItem) let bResult = 0 if has_key(a:tagItem, 'typeref') " Note: Thanks for __anon ! let bResult = match(a:tagItem.typeref, '\C\<__anon') >= 0 endif return bResult endfunc " Search the declaration of a variable and return the type info function! s:SearchTypeInfoOfDecl(szVariable) let szReVariable = '\C\<'.a:szVariable.'\>' let originalPos = getpos('.') let origPos = originalPos[1:2] let curPos = origPos let stopPos = origPos while curPos !=[0,0] " We go to the start of the current scope let curPos = searchpairpos('{', '', '}', 'bW', g:omni#cpp#utils#expIgnoreComments) if curPos != [0,0] let matchPos = curPos " Now want to search our variable but we don't want to go in child " scope while matchPos != [0,0] let matchPos = searchpos('{\|'.szReVariable, 'W', stopPos[0]) if matchPos != [0,0] " We ignore matches under comment if omni#cpp#utils#IsCursorInCommentOrString() continue endif " Getting the current line let szLine = getline('.') if match(szLine, szReVariable)>=0 " We found our variable " Check if the current instruction is a decl instruction let tokens = omni#cpp#utils#TokenizeCurrentInstruction() let szTypeInfo = s:ExtractTypeInfoFromDecl(tokens) if szTypeInfo != '' call setpos('.', originalPos) return omni#cpp#utils#CreateTypeInfo(szTypeInfo) endif else " We found a child scope, we don't want to go in, thus " we search for the end } of this child scope let bracketEnd = searchpairpos('{', '', '}', 'nW', g:omni#cpp#utils#expIgnoreComments) if bracketEnd == [0,0] break endif if bracketEnd[0] >= stopPos[0] " The end of the scope is after our cursor we stop " the search break else " We move the cursor and continue to search our " variable call setpos('.', [0, bracketEnd[0], bracketEnd[1], 0]) endif endif endif endwhile " Backing to the start of the scope call setpos('.', [0,curPos[0], curPos[1], 0]) let stopPos = curPos endif endwhile let result = {} if s:LocalSearchDecl(a:szVariable)==0 && !omni#cpp#utils#IsCursorInCommentOrString() let tokens = omni#cpp#utils#TokenizeCurrentInstruction() let szTypeInfo = s:ExtractTypeInfoFromDecl(tokens) if szTypeInfo != '' let result = omni#cpp#utils#CreateTypeInfo(szTypeInfo) endif endif call setpos('.', originalPos) return result endfunc " Search a declaration " @return " - tokens of the current instruction if success " - empty list if failure function! s:SearchDecl(szVariable) let result = {} let originalPos = getpos('.') let searchResult = s:LocalSearchDecl(a:szVariable) if searchResult==0 " searchdecl() may detect a decl if the variable is in a conditional " instruction (if, elseif, while etc...) " We have to check if the detected decl is really a decl instruction let tokens = omni#cpp#utils#TokenizeCurrentInstruction() for token in tokens " Simple test if index(['if', 'elseif', 'while', 'for', 'switch'], token.value)>=0 " Invalid declaration instruction call setpos('.', originalPos) return result endif endfor let szTypeInfo = s:ExtractTypeInfoFromDecl(tokens) if szTypeInfo != '' let result = omni#cpp#utils#CreateTypeInfo(szTypeInfo) endif endif call setpos('.', originalPos) return result endfunc " Extract the type info string from an instruction. " We use a small parser to extract the type " We parse the code according to a C++ BNF from: http://www.nongnu.org/hcb/#basic.link " @param tokens: token list of the current instruction function! s:ExtractTypeInfoFromDecl(tokens) return omni#cpp#utils#ExtractTypeInfoFromTokens(a:tokens) endfunc " Convert tokens to string function! s:TokensToString(tokens) let result = '' for token in a:tokens let result = result . token.value . ' ' endfor return result[:-2] endfunc " Resolve a cast. " Resolve a C++ cast " @param list of token. tokens must be a list that represents " a cast expression (C++ cast) the function does not control " if it's a cast or not " eg: static_cast(something) " @return type info string function! s:ResolveCppCast(tokens) return omni#cpp#utils#ExtractTypeInfoFromTokens(s:ResolveCast(a:tokens, '<', '>')) endfunc " Resolve a cast. " Resolve a C cast " @param list of token. tokens must be a list that represents " a cast expression (C cast) the function does not control " if it's a cast or not " eg: (MyClass*)something " @return type info string function! s:ResolveCCast(tokens) return omni#cpp#utils#ExtractTypeInfoFromTokens(s:ResolveCast(a:tokens, '(', ')')) endfunc " Resolve a cast. " Resolve a C cast " @param list of token. tokens must be a list that represents " a cast expression (C cast) the function does not control " if it's a cast or not " eg: (MyClass*)something " @return type tokens function! s:ResolveCast(tokens, startChar, endChar) let tokens = omni#cpp#utils#BuildParenthesisGroups(a:tokens) " We remove useless parenthesis eg: (((MyClass))) let tokens = omni#cpp#utils#SimplifyParenthesis(tokens) let countItem=0 let startIndex = -1 let endIndex = -1 let i = 0 for token in tokens if startIndex==-1 if token.value==a:startChar let countItem += 1 let startIndex = i endif else if token.value==a:startChar let countItem += 1 elseif token.value==a:endChar let countItem -= 1 endif if countItem==0 let endIndex = i break endif endif let i+=1 endfor return tokens[startIndex+1 : endIndex-1] endfunc " Replacement for build-in function 'searchdecl' " It does not require that the upper-level bracket is in the first column. " Otherwise it should be equal to 'searchdecl(name, 0, 1)' " @param name: name of variable to find declaration for function! s:LocalSearchDecl(name) if g:OmniCpp_LocalSearchDecl == 0 let bUserIgnoreCase = &ignorecase " Forcing the noignorecase option " avoid bug when, for example, if we have a declaration like this : "A a;" set noignorecase let result = searchdecl(a:name, 0, 1) " Restoring user's setting let &ignorecase = bUserIgnoreCase return result endif let lastpos = getpos('.') let winview = winsaveview() let lastfoldenable = &foldenable let &foldenable = 0 " We add \C (noignorecase) to " avoid bug when, for example, if we have a declaration like this : "A a;" let varname = "\\C\\<" . a:name . "\\>" " Go to first blank line before begin of highest scope normal 99[{ let scopepos = getpos('.') while (line('.') > 1) && (len(split(getline('.'))) > 0) call cursor(line('.')-1, 0) endwhile let declpos = [ 0, 0, 0, 0 ] while search(varname, '', scopepos[1]) > 0 " Check if we are a string or a comment if omni#cpp#utils#IsCursorInCommentOrString() continue endif " Remember match let declpos = getpos('.') endwhile if declpos[1] != 0 " We found a match call winrestview(winview) call setpos('.', declpos) let &foldenable = lastfoldenable return 0 endif while search(varname, '', lastpos[1]) > 0 " Check if current scope is ending before variable let old_cur = getpos('.') normal ]} let new_cur = getpos('.') call setpos('.', old_cur) if (new_cur[1] < lastpos[1]) || ((new_cur[1] == lastpos[1]) && (new_cur[2] < lastpos[2])) continue endif " Check if we are a string or a comment if omni#cpp#utils#IsCursorInCommentOrString() continue endif " We found match call winrestview(winview) call setpos('.', old_cur) let &foldenable = lastfoldenable return 0 endwhile " No match found. call winrestview(winview) let &foldenable = lastfoldenable return 1 endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/settings.vim0000644000000000000000000000541012204336073020361 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 function! omni#cpp#settings#Init() " Global scope search on/off " 0 = disabled " 1 = enabled if !exists('g:OmniCpp_GlobalScopeSearch') let g:OmniCpp_GlobalScopeSearch = 1 endif " Sets the namespace search method " 0 = disabled " 1 = search namespaces in the current file " 2 = search namespaces in the current file and included files if !exists('g:OmniCpp_NamespaceSearch') let g:OmniCpp_NamespaceSearch = 1 endif " Set the class scope completion mode " 0 = auto " 1 = show all members (static, public, protected and private) if !exists('g:OmniCpp_DisplayMode') let g:OmniCpp_DisplayMode = 0 endif " Set if the scope is displayed in the abbr column of the popup " 0 = no " 1 = yes if !exists('g:OmniCpp_ShowScopeInAbbr') let g:OmniCpp_ShowScopeInAbbr = 0 endif " Set if the function prototype is displayed in the abbr column of the popup " 0 = no " 1 = yes if !exists('g:OmniCpp_ShowPrototypeInAbbr') let g:OmniCpp_ShowPrototypeInAbbr = 0 endif " Set if the access (+,#,-) is displayed " 0 = no " 1 = yes if !exists('g:OmniCpp_ShowAccess') let g:OmniCpp_ShowAccess = 1 endif " Set the list of default namespaces " eg: ['std'] if !exists('g:OmniCpp_DefaultNamespaces') let g:OmniCpp_DefaultNamespaces = [] endif " Set MayComplete to '.' " 0 = disabled " 1 = enabled " default = 1 if !exists('g:OmniCpp_MayCompleteDot') let g:OmniCpp_MayCompleteDot = 1 endif " Set MayComplete to '->' " 0 = disabled " 1 = enabled " default = 1 if !exists('g:OmniCpp_MayCompleteArrow') let g:OmniCpp_MayCompleteArrow = 1 endif " Set MayComplete to dot " 0 = disabled " 1 = enabled " default = 0 if !exists('g:OmniCpp_MayCompleteScope') let g:OmniCpp_MayCompleteScope = 0 endif " When completeopt does not contain longest option, this setting " controls the behaviour of the popup menu selection when starting the completion " 0 = don't select first item " 1 = select first item (inserting it to the text) " 2 = select first item (without inserting it to the text) " default = 0 if !exists('g:OmniCpp_SelectFirstItem') let g:OmniCpp_SelectFirstItem= 0 endif " Use local search function for variable definitions " 0 = use standard vim search function " 1 = use local search function " default = 0 if !exists('g:OmniCpp_LocalSearchDecl') let g:OmniCpp_LocalSearchDecl= 0 endif endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/utils.vim0000644000000000000000000004723712204336073017676 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 let g:omni#cpp#utils#CACHE_TAG_INHERITS = {} let g:omni#cpp#utils#szFilterGlobalScope = "(!has_key(v:val, 'class') && !has_key(v:val, 'struct') && !has_key(v:val, 'union') && !has_key(v:val, 'namespace')" let g:omni#cpp#utils#szFilterGlobalScope .= "&& (!has_key(v:val, 'enum') || (has_key(v:val, 'enum') && v:val.enum =~ '^\\w\\+$')))" " Expression used to ignore comments " Note: this expression drop drastically the performance "let omni#cpp#utils#expIgnoreComments = 'match(synIDattr(synID(line("."), col("."), 1), "name"), '\CcComment')!=-1' " This one is faster but not really good for C comments let omni#cpp#utils#reIgnoreComment = escape('\/\/\|\/\*\|\*\/', '*/\') let omni#cpp#utils#expIgnoreComments = 'getline(".") =~ g:omni#cpp#utils#reIgnoreComment' " Characters to escape in a filename for vimgrep "TODO: Find more characters to escape let omni#cpp#utils#szEscapedCharacters = ' %#' " Resolve the path of the file " TODO: absolute file path function! omni#cpp#utils#ResolveFilePath(szFile) let result = '' let listPath = split(globpath(&path, a:szFile), "\n") if len(listPath) let result = listPath[0] endif return simplify(result) endfunc " Get code without comments and with empty strings " szSingleLine must not have carriage return function! omni#cpp#utils#GetCodeFromLine(szSingleLine) " We set all strings to empty strings, it's safer for " the next of the process let szResult = substitute(a:szSingleLine, '".*"', '""', 'g') " Removing c++ comments, we can use the pattern ".*" because " we are modifying a line let szResult = substitute(szResult, '\/\/.*', '', 'g') " Now we have the entire code in one line and we can remove C comments return s:RemoveCComments(szResult) endfunc " Remove C comments on a line function! s:RemoveCComments(szLine) let result = a:szLine " We have to match the first '/*' and first '*/' let startCmt = match(result, '\/\*') let endCmt = match(result, '\*\/') while startCmt!=-1 && endCmt!=-1 && startCmt0 let result = result[ : startCmt-1 ] . result[ endCmt+2 : ] else " Case where '/*' is at the start of the line let result = result[ endCmt+2 : ] endif let startCmt = match(result, '\/\*') let endCmt = match(result, '\*\/') endwhile return result endfunc " Get a c++ code from current buffer from [lineStart, colStart] to " [lineEnd, colEnd] without c++ and c comments, without end of line " and with empty strings if any " @return a string function! omni#cpp#utils#GetCode(posStart, posEnd) let posStart = a:posStart let posEnd = a:posEnd if a:posStart[0]>a:posEnd[0] let posStart = a:posEnd let posEnd = a:posStart elseif a:posStart[0]==a:posEnd[0] && a:posStart[1]>a:posEnd[1] let posStart = a:posEnd let posEnd = a:posStart endif " Getting the lines let lines = getline(posStart[0], posEnd[0]) let lenLines = len(lines) " Formatting the result let result = '' if lenLines==1 let sStart = posStart[1]-1 let sEnd = posEnd[1]-1 let line = lines[0] let lenLastLine = strlen(line) let sEnd = (sEnd>lenLastLine)?lenLastLine : sEnd if sStart >= 0 let result = omni#cpp#utils#GetCodeFromLine(line[ sStart : sEnd ]) endif elseif lenLines>1 let sStart = posStart[1]-1 let sEnd = posEnd[1]-1 let lenLastLine = strlen(lines[-1]) let sEnd = (sEnd>lenLastLine)?lenLastLine : sEnd if sStart >= 0 let lines[0] = lines[0][ sStart : ] let lines[-1] = lines[-1][ : sEnd ] for aLine in lines let result = result . omni#cpp#utils#GetCodeFromLine(aLine)." " endfor let result = result[:-2] endif endif " Now we have the entire code in one line and we can remove C comments return s:RemoveCComments(result) endfunc " Extract the scope (context) of a tag item " eg: ::MyNamespace " @return a string of the scope. a scope from tag always starts with '::' function! omni#cpp#utils#ExtractScope(tagItem) let listKindScope = ['class', 'struct', 'union', 'namespace', 'enum'] let szResult = '::' for scope in listKindScope if has_key(a:tagItem, scope) let szResult = szResult . a:tagItem[scope] break endif endfor return szResult endfunc " Simplify scope string, remove consecutive '::' if any function! omni#cpp#utils#SimplifyScope(szScope) let szResult = substitute(a:szScope, '\(::\)\+', '::', 'g') if szResult=='::' return szResult else return substitute(szResult, '::$', '', 'g') endif endfunc " Check if the cursor is in comment function! omni#cpp#utils#IsCursorInCommentOrString() return match(synIDattr(synID(line("."), col(".")-1, 1), "name"), '\C\=0 endfunc " Tokenize the current instruction until the cursor position. " @return list of tokens function! omni#cpp#utils#TokenizeCurrentInstruction(...) let szAppendText = '' if a:0>0 let szAppendText = a:1 endif let startPos = searchpos('[;{}]\|\%^', 'bWn') let curPos = getpos('.')[1:2] " We don't want the character under the cursor let column = curPos[1]-1 let curPos[1] = (column<1)?1:column return omni#cpp#tokenizer#Tokenize(omni#cpp#utils#GetCode(startPos, curPos)[1:] . szAppendText) endfunc " Tokenize the current instruction until the word under the cursor. " @return list of tokens function! omni#cpp#utils#TokenizeCurrentInstructionUntilWord() let startPos = searchpos('[;{}]\|\%^', 'bWn') " Saving the current cursor pos let originalPos = getpos('.') " We go at the end of the word execute 'normal gee' let curPos = getpos('.')[1:2] " Restoring the original cursor pos call setpos('.', originalPos) let szCode = omni#cpp#utils#GetCode(startPos, curPos)[1:] return omni#cpp#tokenizer#Tokenize(szCode) endfunc " Build parenthesis groups " add a new key 'group' in the token " where value is the group number of the parenthesis " eg: (void*)(MyClass*) " group1 group0 " if a parenthesis is unresolved the group id is -1 " @return a copy of a:tokens with parenthesis group function! omni#cpp#utils#BuildParenthesisGroups(tokens) let tokens = copy(a:tokens) let kinds = {'(': '()', ')' : '()', '[' : '[]', ']' : '[]', '<' : '<>', '>' : '<>', '{': '{}', '}': '{}'} let unresolved = {'()' : [], '[]': [], '<>' : [], '{}' : []} let groupId = 0 " Note: we build paren group in a backward way " because we can often have parenthesis unbalanced " instruction " eg: doSomething(_member.get()-> for token in reverse(tokens) if index([')', ']', '>', '}'], token.value)>=0 let token['group'] = groupId call extend(unresolved[kinds[token.value]], [token]) let groupId+=1 elseif index(['(', '[', '<', '{'], token.value)>=0 if len(unresolved[kinds[token.value]]) let tokenResolved = remove(unresolved[kinds[token.value]], -1) let token['group'] = tokenResolved.group else let token['group'] = -1 endif endif endfor return reverse(tokens) endfunc " Determine if tokens represent a C cast " @return " - itemCast " - itemCppCast " - itemVariable " - itemThis function! omni#cpp#utils#GetCastType(tokens) " Note: a:tokens is not modified let tokens = omni#cpp#utils#SimplifyParenthesis(omni#cpp#utils#BuildParenthesisGroups(a:tokens)) if tokens[0].value == '(' return 'itemCast' elseif index(['static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast'], tokens[0].value)>=0 return 'itemCppCast' else for token in tokens if token.value=='this' return 'itemThis' endif endfor return 'itemVariable' endif endfunc " Remove useless parenthesis function! omni#cpp#utils#SimplifyParenthesis(tokens) "Note: a:tokens is not modified let tokens = a:tokens " We remove useless parenthesis eg: (((MyClass))) if len(tokens)>2 while tokens[0].value=='(' && tokens[-1].value==')' && tokens[0].group==tokens[-1].group let tokens = tokens[1:-2] endwhile endif return tokens endfunc " Function create a type info function! omni#cpp#utils#CreateTypeInfo(param) let type = type(a:param) return {'type': type, 'value':a:param} endfunc " Extract type info from a tag item " eg: ::MyNamespace::MyClass function! omni#cpp#utils#ExtractTypeInfoFromTag(tagItem) let szTypeInfo = omni#cpp#utils#ExtractScope(a:tagItem) . '::' . substitute(a:tagItem.name, '.*::', '', 'g') return omni#cpp#utils#SimplifyScope(szTypeInfo) endfunc " Build a class inheritance list function! omni#cpp#utils#GetClassInheritanceList(namespaces, typeInfo) let result = [] for tagItem in omni#cpp#utils#GetResolvedTags(a:namespaces, a:typeInfo) call extend(result, [omni#cpp#utils#ExtractTypeInfoFromTag(tagItem)]) endfor return result endfunc " Get class inheritance list where items in the list are tag items. " TODO: Verify inheritance order function! omni#cpp#utils#GetResolvedTags(namespaces, typeInfo) let result = [] let tagItem = omni#cpp#utils#GetResolvedTagItem(a:namespaces, a:typeInfo) if tagItem!={} let szTypeInfo = omni#cpp#utils#ExtractTypeInfoFromTag(tagItem) if has_key(g:omni#cpp#utils#CACHE_TAG_INHERITS, szTypeInfo) let result = g:omni#cpp#utils#CACHE_TAG_INHERITS[szTypeInfo] else call extend(result, [tagItem]) if has_key(tagItem, 'inherits') for baseClassTypeInfo in split(tagItem.inherits, ',') let namespaces = [omni#cpp#utils#ExtractScope(tagItem), '::'] call extend(result, omni#cpp#utils#GetResolvedTags(namespaces, omni#cpp#utils#CreateTypeInfo(baseClassTypeInfo))) endfor endif let g:omni#cpp#utils#CACHE_TAG_INHERITS[szTypeInfo] = result endif endif return result endfunc " Get a tag item after a scope resolution and typedef resolution function! omni#cpp#utils#GetResolvedTagItem(namespaces, typeInfo) let typeInfo = {} if type(a:typeInfo) == 1 let typeInfo = omni#cpp#utils#CreateTypeInfo(a:typeInfo) else let typeInfo = a:typeInfo endif let result = {} if !omni#cpp#utils#IsTypeInfoValid(typeInfo) return result endif " Unnamed type case eg: '1::2' if typeInfo.type == 4 " Here there is no typedef or namespace to resolve, the tagInfo.value is a tag item " representing a variable ('v') a member ('m') or a typedef ('t') and the typename is " always in global scope return typeInfo.value endif " Named type case eg: 'MyNamespace::MyClass' let szTypeInfo = omni#cpp#utils#GetTypeInfoString(typeInfo) " Resolving namespace alias " TODO: For the next release "let szTypeInfo = omni#cpp#namespaces#ResolveAlias(g:omni#cpp#namespaces#CacheAlias, szTypeInfo) if szTypeInfo=='::' return result endif " We can only get members of class, struct, union and namespace let szTagFilter = "index(['c', 's', 'u', 'n', 't'], v:val.kind[0])>=0" let szTagQuery = szTypeInfo if s:IsTypeInfoResolved(szTypeInfo) " The type info is already resolved, we remove the starting '::' let szTagQuery = substitute(szTypeInfo, '^::', '', 'g') if len(split(szTagQuery, '::'))==1 " eg: ::MyClass " Here we have to get tags that have no parent scope " That's why we change the szTagFilter let szTagFilter .= '&& ' . g:omni#cpp#utils#szFilterGlobalScope let tagList = omni#common#utils#TagListNoThrow('^'.szTagQuery.'$') call filter(tagList, szTagFilter) if len(tagList) let result = tagList[0] endif else " eg: ::MyNamespace::MyClass let tagList = omni#common#utils#TagListNoThrow('^'.szTagQuery.'$') call filter(tagList, szTagFilter) if len(tagList) let result = tagList[0] endif endif else " The type is not resolved let tagList = omni#common#utils#TagListNoThrow('^'.szTagQuery.'$') call filter(tagList, szTagFilter) if len(tagList) " Resolving scope (namespace, nested class etc...) let szScopeOfTypeInfo = s:ExtractScopeFromTypeInfo(szTypeInfo) if s:IsTypeInfoResolved(szTypeInfo) let result = s:GetTagOfSameScope(tagList, szScopeOfTypeInfo) else " For each namespace of the namespace list we try to get a tag " that can be in the same scope if g:OmniCpp_NamespaceSearch && &filetype != 'c' for scope in a:namespaces let szTmpScope = omni#cpp#utils#SimplifyScope(scope.'::'.szScopeOfTypeInfo) let result = s:GetTagOfSameScope(tagList, szTmpScope) if result!={} break endif endfor else let szTmpScope = omni#cpp#utils#SimplifyScope('::'.szScopeOfTypeInfo) let result = s:GetTagOfSameScope(tagList, szTmpScope) endif endif endif endif if result!={} " We have our tagItem but maybe it's a typedef or an unnamed type if result.kind[0]=='t' " Here we can have a typedef to another typedef, a class, struct, union etc " but we can also have a typedef to an unnamed type, in that " case the result contains a 'typeref' key let namespaces = [omni#cpp#utils#ExtractScope(result), '::'] if has_key(result, 'typeref') let result = omni#cpp#utils#GetResolvedTagItem(namespaces, omni#cpp#utils#CreateTypeInfo(result)) else let szCmd = omni#cpp#utils#ExtractCmdFromTagItem(result) let szCode = substitute(omni#cpp#utils#GetCodeFromLine(szCmd), '\C\<'.result.name.'\>.*', '', 'g') let szTypeInfo = omni#cpp#utils#ExtractTypeInfoFromTokens(omni#cpp#tokenizer#Tokenize(szCode)) let result = omni#cpp#utils#GetResolvedTagItem(namespaces, omni#cpp#utils#CreateTypeInfo(szTypeInfo)) " TODO: Namespace resolution for result endif endif endif return result endfunc " Returns if the type info is valid " @return " - 1 if valid " - 0 otherwise function! omni#cpp#utils#IsTypeInfoValid(typeInfo) if a:typeInfo=={} return 0 else if a:typeInfo.type == 1 && a:typeInfo.value=='' " String case return 0 elseif a:typeInfo.type == 4 && a:typeInfo.value=={} " Dictionary case return 0 endif endif return 1 endfunc " Get the string of the type info function! omni#cpp#utils#GetTypeInfoString(typeInfo) if a:typeInfo.type == 1 return a:typeInfo.value else return substitute(a:typeInfo.value.typeref, '^\w\+:', '', 'g') endif endfunc " A resolved type info starts with '::' " @return " - 1 if type info starts with '::' " - 0 otherwise function! s:IsTypeInfoResolved(szTypeInfo) return match(a:szTypeInfo, '^::')!=-1 endfunc " A returned type info's scope may not have the global namespace '::' " eg: '::NameSpace1::NameSpace2::MyClass' => '::NameSpace1::NameSpace2' " 'NameSpace1::NameSpace2::MyClass' => 'NameSpace1::NameSpace2' function! s:ExtractScopeFromTypeInfo(szTypeInfo) let szScope = substitute(a:szTypeInfo, '\w\+$', '', 'g') if szScope =='::' return szScope else return substitute(szScope, '::$', '', 'g') endif endfunc " @return " - the tag with the same scope " - {} otherwise function! s:GetTagOfSameScope(listTags, szScopeToMatch) for tagItem in a:listTags let szScopeOfTag = omni#cpp#utils#ExtractScope(tagItem) if szScopeOfTag == a:szScopeToMatch return tagItem endif endfor return {} endfunc " Extract the cmd of a tag item without regexp function! omni#cpp#utils#ExtractCmdFromTagItem(tagItem) let line = a:tagItem.cmd let re = '\(\/\^\)\|\(\$\/\)' if match(line, re)!=-1 let line = substitute(line, re, '', 'g') return line else " TODO: the cmd is a line number return '' endif endfunc " Extract type from tokens. " eg: examples of tokens format " 'const MyClass&' " 'const map < int, int >&' " 'MyNs::MyClass' " '::MyClass**' " 'MyClass a, *b = NULL, c[1] = {}; " 'hello(MyClass a, MyClass* b' " @return the type info string eg: ::std::map " can be empty function! omni#cpp#utils#ExtractTypeInfoFromTokens(tokens) let szResult = '' let state = 0 let tokens = omni#cpp#utils#BuildParenthesisGroups(a:tokens) " If there is an unbalanced parenthesis we are in a parameter list let bParameterList = 0 for token in tokens if token.value == '(' && token.group==-1 let bParameterList = 1 break endif endfor if bParameterList let tokens = reverse(tokens) let state = 0 let parenGroup = -1 for token in tokens if state==0 if token.value=='>' let parenGroup = token.group let state=1 elseif token.kind == 'cppWord' let szResult = token.value.szResult let state=2 elseif index(['*', '&'], token.value)<0 break endif elseif state==1 if token.value=='<' && token.group==parenGroup let state=0 endif elseif state==2 if token.value=='::' let szResult = token.value.szResult let state=3 else break endif elseif state==3 if token.kind == 'cppWord' let szResult = token.value.szResult let state=2 else break endif endif endfor return szResult endif for token in tokens if state==0 if token.value == '::' let szResult .= token.value let state = 1 elseif token.kind == 'cppWord' let szResult .= token.value let state = 2 " Maybe end of token endif elseif state==1 if token.kind == 'cppWord' let szResult .= token.value let state = 2 " Maybe end of token else break endif elseif state==2 if token.value == '::' let szResult .= token.value let state = 1 else break endif endif endfor return szResult endfunc " Get the preview window string function! omni#cpp#utils#GetPreviewWindowStringFromTagItem(tagItem) let szResult = '' let szResult .= 'name: '.a:tagItem.name."\n" for tagKey in keys(a:tagItem) if index(['name', 'static'], tagKey)>=0 continue endif let szResult .= tagKey.': '.a:tagItem[tagKey]."\n" endfor return substitute(szResult, "\n$", '', 'g') endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/tokenizer.vim0000644000000000000000000000773612204336073020550 0ustar " Description: Omni completion tokenizer " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 " TODO: Generic behaviour for Tokenize() " From the C++ BNF let s:cppKeyword = ['asm', 'auto', 'bool', 'break', 'case', 'catch', 'char', 'class', 'const', 'const_cast', 'continue', 'default', 'delete', 'do', 'double', 'dynamic_cast', 'else', 'enum', 'explicit', 'export', 'extern', 'false', 'float', 'for', 'friend', 'goto', 'if', 'inline', 'int', 'long', 'mutable', 'namespace', 'new', 'operator', 'private', 'protected', 'public', 'register', 'reinterpret_cast', 'return', 'short', 'signed', 'sizeof', 'static', 'static_cast', 'struct', 'switch', 'template', 'this', 'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile', 'wchar_t', 'while', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'] let s:reCppKeyword = '\C\<'.join(s:cppKeyword, '\>\|\<').'\>' " The order of items in this list is very important because we use this list to build a regular " expression (see below) for tokenization let s:cppOperatorPunctuator = ['->*', '->', '--', '-=', '-', '!=', '!', '##', '#', '%:%:', '%=', '%>', '%:', '%', '&&', '&=', '&', '(', ')', '*=', '*', ',', '...', '.*', '.', '/=', '/', '::', ':>', ':', ';', '?', '[', ']', '^=', '^', '{', '||', '|=', '|', '}', '~', '++', '+=', '+', '<<=', '<%', '<:', '<<', '<=', '<', '==', '=', '>>=', '>>', '>=', '>'] " We build the regexp for the tokenizer let s:reCComment = '\/\*\|\*\/' let s:reCppComment = '\/\/' let s:reComment = s:reCComment.'\|'.s:reCppComment let s:reCppOperatorOrPunctuator = escape(join(s:cppOperatorPunctuator, '\|'), '*./^~[]') " Tokenize a c++ code " a token is dictionary where keys are: " - kind = cppKeyword|cppWord|cppOperatorPunctuator|unknown|cComment|cppComment|cppDigit " - value = 'something' " Note: a cppWord is any word that is not a cpp keyword function! omni#cpp#tokenizer#Tokenize(szCode) let result = [] " The regexp to find a token, a token is a keyword, word or " c++ operator or punctuator. To work properly we have to put " spaces and tabs to our regexp. let reTokenSearch = '\(\w\+\)\|\s\+\|'.s:reComment.'\|'.s:reCppOperatorOrPunctuator " eg: 'using namespace std;' " ^ ^ " start=0 end=5 let startPos = 0 let endPos = matchend(a:szCode, reTokenSearch) let len = endPos-startPos while endPos!=-1 " eg: 'using namespace std;' " ^ ^ " start=0 end=5 " token = 'using' " We also remove space and tabs let token = substitute(strpart(a:szCode, startPos, len), '\s', '', 'g') " eg: 'using namespace std;' " ^ ^ " start=5 end=15 let startPos = endPos let endPos = matchend(a:szCode, reTokenSearch, startPos) let len = endPos-startPos " It the token is empty we continue if token=='' continue endif " Building the token let resultToken = {'kind' : 'unknown', 'value' : token} " Classify the token if token =~ '^\d\+' " It's a digit let resultToken.kind = 'cppDigit' elseif token=~'^\w\+$' " It's a word let resultToken.kind = 'cppWord' " But maybe it's a c++ keyword if match(token, s:reCppKeyword)>=0 let resultToken.kind = 'cppKeyword' endif else if match(token, s:reComment)>=0 if index(['/*','*/'],token)>=0 let resultToken.kind = 'cComment' else let resultToken.kind = 'cppComment' endif else " It's an operator let resultToken.kind = 'cppOperatorPunctuator' endif endif " We have our token, let's add it to the result list call extend(result, [resultToken]) endwhile return result endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/complete.vim0000644000000000000000000005035612204336073020342 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 27 sept. 2007 if v:version < 700 echohl WarningMsg echomsg "omni#cpp#complete.vim: Please install vim 7.0 or higher for omni-completion" echohl None finish endif call omni#cpp#settings#Init() let s:OmniCpp_ShowScopeInAbbr = g:OmniCpp_ShowScopeInAbbr let s:OmniCpp_ShowPrototypeInAbbr = g:OmniCpp_ShowPrototypeInAbbr let s:OmniCpp_ShowAccess = g:OmniCpp_ShowAccess let s:szCurrentWorkingDir = getcwd() " Cache data let s:CACHE_TAG_POPUP_ITEMS = {} let s:CACHE_TAG_FILES = {} let s:CACHE_TAG_ENV = '' let s:CACHE_OVERLOADED_FUNCTIONS = {} " Has preview window? let s:hasPreviewWindow = match(&completeopt, 'preview')>=0 let s:hasPreviewWindowOld = s:hasPreviewWindow " Popup item list let s:popupItemResultList = [] " May complete indicator let s:bMayComplete = 0 " Init mappings function! omni#cpp#complete#Init() call omni#cpp#settings#Init() set omnifunc=omni#cpp#complete#Main inoremap omni#cpp#maycomplete#Complete() inoremap . omni#cpp#maycomplete#Dot() inoremap > omni#cpp#maycomplete#Arrow() inoremap : omni#cpp#maycomplete#Scope() endfunc " Find the start position of the completion function! s:FindStartPositionOfCompletion() " Locate the start of the item, including ".", "->" and "[...]". let line = getline('.') let start = col('.') - 1 let lastword = -1 while start > 0 if line[start - 1] =~ '\w' let start -= 1 elseif line[start - 1] =~ '\.' " Searching for dot '.' if lastword == -1 let lastword = start endif let start -= 1 elseif start > 1 && line[start - 2] == '-' && line[start - 1] == '>' " Searching for '->' if lastword == -1 let lastword = start endif let start -= 2 elseif start > 1 && line[start - 2] == ':' && line[start - 1] == ':' " Searching for '::' for namespaces and class if lastword == -1 let lastword = start endif let start -= 2 elseif line[start - 1] == ']' " Skip over [...]. let n = 0 let start -= 1 while start > 0 let start -= 1 if line[start] == '[' if n == 0 break endif let n -= 1 elseif line[start] == ']' " nested [] let n += 1 endif endwhile else break endif endwhile if lastword==-1 " For completion on the current scope let lastword = start endif return lastword endfunc " Returns if szKey1.szKey2 is in the cache " @return " - 0 = key not found " - 1 = szKey1.szKey2 found " - 2 = szKey1.[part of szKey2] found function! s:IsCached(cache, szKey1, szKey2) " Searching key in the result cache let szResultKey = a:szKey1 . a:szKey2 let result = [0, szResultKey] if a:szKey2 != '' let szKey = a:szKey2 while len(szKey)>0 if has_key(a:cache, a:szKey1 . szKey) let result[1] = a:szKey1 . szKey if szKey != a:szKey2 let result[0] = 2 else let result[0] = 1 endif break endif let szKey = szKey[:-2] endwhile else if has_key(a:cache, szResultKey) let result[0] = 1 endif endif return result endfunc " Extend a tag item to a popup item function! s:ExtendTagItemToPopupItem(tagItem, szTypeName) let tagItem = a:tagItem " Add the access let szItemMenu = '' let accessChar = {'public': '+','protected': '#','private': '-'} if g:OmniCpp_ShowAccess if has_key(tagItem, 'access') && has_key(accessChar, tagItem.access) let szItemMenu = szItemMenu.accessChar[tagItem.access] else let szItemMenu = szItemMenu." " endif endif " Formating optional menu string we extract the scope information let szName = substitute(tagItem.name, '.*::', '', 'g') let szItemWord = szName let szAbbr = szName if !g:OmniCpp_ShowScopeInAbbr let szScopeOfTag = omni#cpp#utils#ExtractScope(tagItem) let szItemMenu = szItemMenu.' '.szScopeOfTag[2:] let szItemMenu = substitute(szItemMenu, '\s\+$', '', 'g') else let szAbbr = tagItem.name endif if g:OmniCpp_ShowAccess let szItemMenu = substitute(szItemMenu, '^\s\+$', '', 'g') else let szItemMenu = substitute(szItemMenu, '\(^\s\+\)\|\(\s\+$\)', '', 'g') endif " Formating information for the preview window if index(['f', 'p'], tagItem.kind[0])>=0 let szItemWord .= '(' if g:OmniCpp_ShowPrototypeInAbbr && has_key(tagItem, 'signature') let szAbbr .= tagItem.signature else let szAbbr .= '(' endif endif let szItemInfo = '' if s:hasPreviewWindow let szItemInfo = omni#cpp#utils#GetPreviewWindowStringFromTagItem(tagItem) endif " If a function is a ctor we add a new key in the tagItem if index(['f', 'p'], tagItem.kind[0])>=0 if match(szName, '^\~') < 0 && a:szTypeName =~ '\C\<'.szName.'$' " It's a ctor let tagItem['ctor'] = 1 elseif has_key(tagItem, 'access') && tagItem.access == 'friend' " Friend function let tagItem['friendfunc'] = 1 endif endif " Extending the tag item to a popup item let tagItem['word'] = szItemWord let tagItem['abbr'] = szAbbr let tagItem['menu'] = szItemMenu let tagItem['info'] = szItemInfo let tagItem['dup'] = (s:hasPreviewWindow && index(['f', 'p', 'm'], tagItem.kind[0])>=0) return tagItem endfunc " Get tag popup item list function! s:TagPopupList(szTypeName, szBase) let result = [] " Searching key in the result cache let cacheResult = s:IsCached(s:CACHE_TAG_POPUP_ITEMS, a:szTypeName, a:szBase) " Building the tag query, we don't forget dtors when a:szBase=='' if a:szTypeName!='' " Scope search let szTagQuery = '^' . a:szTypeName . '::' . a:szBase . '\~\?\w\+$' else " Global search let szTagQuery = '^' . a:szBase . '\w\+$' endif " If the result is already in the cache we return it if cacheResult[0] let result = s:CACHE_TAG_POPUP_ITEMS[ cacheResult[1] ] if cacheResult[0] == 2 let result = filter(copy(result), 'v:val.name =~ szTagQuery' ) endif return result endif try " Getting tags let result = omni#common#utils#TagList(szTagQuery) " We extend tag items to popup items call map(result, 's:ExtendTagItemToPopupItem(v:val, a:szTypeName)') " We store the result in a cache if cacheResult[1] != '' let s:CACHE_TAG_POPUP_ITEMS[ cacheResult[1] ] = result endif catch /^TagList:UserInterrupt$/ endtry return result endfunc " Find complete matches for a completion on the global scope function! s:SearchGlobalMembers(szBase) if a:szBase != '' let tagPopupList = s:TagPopupList('', a:szBase) let tagPopupList = filter(copy(tagPopupList), g:omni#cpp#utils#szFilterGlobalScope) call extend(s:popupItemResultList, tagPopupList) endif endfunc " Search class, struct, union members " @param resolvedTagItem: a resolved tag item " @param szBase: string base " @return list of tag items extended to popup items function! s:SearchMembers(resolvedTagItem, szBase) let result = [] if a:resolvedTagItem == {} return result endif " Get type info without the starting '::' let szTagName = omni#cpp#utils#ExtractTypeInfoFromTag(a:resolvedTagItem)[2:] " Unnamed type case. A tag item representing an unnamed type is a variable " ('v') a member ('m') or a typedef ('t') if index(['v', 't', 'm'], a:resolvedTagItem.kind[0])>=0 && has_key(a:resolvedTagItem, 'typeref') " We remove the 'struct:' or 'class:' etc... let szTagName = substitute(a:resolvedTagItem.typeref, '^\w\+:', '', 'g') endif return copy(s:TagPopupList(szTagName, a:szBase)) endfunc " Return if the tag env has changed function! s:HasTagEnvChanged() if s:CACHE_TAG_ENV == &tags return 0 else let s:CACHE_TAG_ENV = &tags return 1 endif endfunc " Return if a tag file has changed in tagfiles() function! s:HasATagFileOrTagEnvChanged() if s:HasTagEnvChanged() let s:CACHE_TAG_FILES = {} return 1 endif let result = 0 for tagFile in tagfiles() if tagFile == "" continue endif if has_key(s:CACHE_TAG_FILES, tagFile) let currentFiletime = getftime(tagFile) if currentFiletime > s:CACHE_TAG_FILES[tagFile] " The file has changed, updating the cache let s:CACHE_TAG_FILES[tagFile] = currentFiletime let result = 1 endif else " We store the time of the file let s:CACHE_TAG_FILES[tagFile] = getftime(tagFile) let result = 1 endif endfor return result endfunc " Initialization call s:HasATagFileOrTagEnvChanged() " Filter same function signatures of base classes function! s:FilterOverloadedFunctions(tagPopupList) let result = [] for tagPopupItem in a:tagPopupList if has_key(tagPopupItem, 'kind') && index(['f', 'p'], tagPopupItem.kind[0])>=0 && has_key(tagPopupItem, 'signature') if !has_key(s:CACHE_OVERLOADED_FUNCTIONS, tagPopupItem.word . tagPopupItem.signature) let s:CACHE_OVERLOADED_FUNCTIONS[tagPopupItem.word . tagPopupItem.signature] = 1 call extend(result, [tagPopupItem]) endif else call extend(result, [tagPopupItem]) endif endfor return result endfunc " Access filter function! s:GetAccessFilter(szFilter, szAccessFilter) let szFilter = a:szFilter if g:OmniCpp_DisplayMode == 0 if a:szAccessFilter == 'public' " We only get public members let szFilter .= "&& v:val.access == 'public'" elseif a:szAccessFilter == 'protected' " We get public and protected members let szFilter .= "&& v:val.access != 'private'" endif endif return szFilter endfunc " Filter class members in the popup menu after a completion with -> or . function! s:FilterClassMembers(tagPopupList, szAccessFilter) let szFilter = "(!has_key(v:val, 'friendfunc') && !has_key(v:val, 'ctor') && has_key(v:val, 'kind') && index(['m', 'p', 'f'], v:val.kind[0])>=0 && has_key(v:val, 'access'))" call filter(a:tagPopupList, s:GetAccessFilter(szFilter, a:szAccessFilter)) call extend(s:popupItemResultList, s:FilterOverloadedFunctions(a:tagPopupList)) endfunc " Filter class scope members in the popup menu after a completion with :: " We only display attribute and functions members that " have an access information. We also display nested " class, struct, union, and enums, typedefs function! s:FilterClassScopeMembers(tagPopupList, szAccessFilter) let szFilter = "!has_key(v:val, 'friendfunc') && has_key(v:val, 'kind') && (index(['m', 'p', 'f'], v:val.kind[0])>=0 && has_key(v:val, 'access'))" let szFilter = s:GetAccessFilter(szFilter, a:szAccessFilter) let szFilter .= "|| index(['c','e','g','s','t','u'], v:val.kind[0])>=0" call filter(a:tagPopupList, szFilter) call extend(s:popupItemResultList, s:FilterOverloadedFunctions(a:tagPopupList)) endfunc " Filter static class members in the popup menu function! s:FilterStaticClassMembers(tagPopupList, szAccessFilter) let szFilter = "!has_key(v:val, 'friendfunc') && has_key(v:val, 'kind') && (index(['m', 'p', 'f'], v:val.kind[0])>=0 && has_key(v:val, 'access') && match(v:val.cmd, '\\Cstatic')!=-1)" let szFilter = s:GetAccessFilter(szFilter, a:szAccessFilter) let szFilter = szFilter . "|| index(['c','e','g','n','s','t','u','v'], v:val.kind[0])>=0" call filter(a:tagPopupList, szFilter) call extend(s:popupItemResultList, s:FilterOverloadedFunctions(a:tagPopupList)) endfunc " Filter scope members in the popup menu function! s:FilterNamespaceScopeMembers(tagPopupList) call extend(s:popupItemResultList, a:tagPopupList) endfunc " Init data at the start of completion function! s:InitComplete() " Reset the popup item list let s:popupItemResultList = [] let s:CACHE_OVERLOADED_FUNCTIONS = {} " Reset includes cache when the current working directory has changed let szCurrentWorkingDir = getcwd() if s:szCurrentWorkingDir != szCurrentWorkingDir let s:szCurrentWorkingDir = szCurrentWorkingDir let g:omni#cpp#includes#CACHE_INCLUDES = {} let g:omni#cpp#includes#CACHE_FILE_TIME = {} endif " Has preview window ? let s:hasPreviewWindow = match(&completeopt, 'preview')>=0 let bResetCache = 0 " Reset tag env or tag files dependent caches if s:HasATagFileOrTagEnvChanged() let bResetCache = 1 endif if (s:OmniCpp_ShowScopeInAbbr != g:OmniCpp_ShowScopeInAbbr) \|| (s:OmniCpp_ShowPrototypeInAbbr != g:OmniCpp_ShowPrototypeInAbbr) \|| (s:OmniCpp_ShowAccess != g:OmniCpp_ShowAccess) let s:OmniCpp_ShowScopeInAbbr = g:OmniCpp_ShowScopeInAbbr let s:OmniCpp_ShowPrototypeInAbbr = g:OmniCpp_ShowPrototypeInAbbr let s:OmniCpp_ShowAccess = g:OmniCpp_ShowAccess let bResetCache = 1 endif if s:hasPreviewWindow != s:hasPreviewWindowOld let s:hasPreviewWindowOld = s:hasPreviewWindow let bResetCache = 1 endif if bResetCache let g:omni#cpp#namespaces#CacheResolve = {} let s:CACHE_TAG_POPUP_ITEMS = {} let g:omni#cpp#utils#CACHE_TAG_INHERITS = {} call garbagecollect() endif " Check for updates for szIncludeName in keys(g:omni#cpp#includes#CACHE_INCLUDES) let fTime = getftime(szIncludeName) let bNeedUpdate = 0 if has_key(g:omni#cpp#includes#CACHE_FILE_TIME, szIncludeName) if fTime != g:omni#cpp#includes#CACHE_FILE_TIME[szIncludeName] let bNeedUpdate = 1 endif else let g:omni#cpp#includes#CACHE_FILE_TIME[szIncludeName] = fTime let bNeedUpdate = 1 endif if bNeedUpdate " We have to update include list and namespace map of this file call omni#cpp#includes#GetList(szIncludeName, 1) call omni#cpp#namespaces#GetMapFromBuffer(szIncludeName, 1) endif endfor let s:bDoNotComplete = 0 endfunc " This function is used for the 'omnifunc' option. function! omni#cpp#complete#Main(findstart, base) if a:findstart "call omni#common#debug#Start() call s:InitComplete() " Note: if s:bMayComplete==1 g:omni#cpp#items#data is build by MayComplete functions if !s:bMayComplete " If the cursor is in a comment we go out if omni#cpp#utils#IsCursorInCommentOrString() " Returning -1 is not enough we have to set a variable to let " the second call of omni#cpp#complete knows that the " cursor was in a comment " Why is there a second call when the first call returns -1 ? let s:bDoNotComplete = 1 return -1 endif " We get items here (whend a:findstart==1) because GetItemsToComplete() " depends on the cursor position. " When a:findstart==0 the cursor position is modified let g:omni#cpp#items#data = omni#cpp#items#Get(omni#cpp#utils#TokenizeCurrentInstruction()) endif " Get contexts stack let s:contextStack = omni#cpp#namespaces#GetContexts() " Reinit of may complete indicator let s:bMayComplete = 0 return s:FindStartPositionOfCompletion() endif " If the cursor is in a comment we return an empty result if s:bDoNotComplete let s:bDoNotComplete = 0 return [] endif if len(g:omni#cpp#items#data)==0 " A) CURRENT_SCOPE_COMPLETION_MODE " 1) Displaying data of each context let szAccessFilter = 'all' for szCurrentContext in s:contextStack if szCurrentContext == '::' continue endif let resolvedTagItem = omni#cpp#utils#GetResolvedTagItem(s:contextStack, omni#cpp#utils#CreateTypeInfo(szCurrentContext)) if resolvedTagItem != {} " We don't search base classes because bases classes are " already in the context stack let tagPopupList = s:SearchMembers(resolvedTagItem, a:base) if index(['c','s'], resolvedTagItem.kind[0])>=0 " It's a class or struct call s:FilterClassScopeMembers(tagPopupList, szAccessFilter) let szAccessFilter = 'protected' else " It's a namespace or union, we display all members call s:FilterNamespaceScopeMembers(tagPopupList) endif endif endfor " 2) Displaying global scope members if g:OmniCpp_GlobalScopeSearch call s:SearchGlobalMembers(a:base) endif else let typeInfo = omni#cpp#items#ResolveItemsTypeInfo(s:contextStack, g:omni#cpp#items#data) if typeInfo != {} if g:omni#cpp#items#data[-1].kind == 'itemScope' " B) SCOPE_COMPLETION_MODE if omni#cpp#utils#GetTypeInfoString(typeInfo)=='' call s:SearchGlobalMembers(a:base) else for resolvedTagItem in omni#cpp#utils#GetResolvedTags(s:contextStack, typeInfo) let tagPopupList = s:SearchMembers(resolvedTagItem, a:base) if index(['c','s'], resolvedTagItem.kind[0])>=0 let szTypeInfo = omni#cpp#utils#ExtractTypeInfoFromTag(resolvedTagItem) if g:OmniCpp_DisplayMode==0 " We want to complete a class or struct " If this class is a base class so we display all class members if index(s:contextStack, szTypeInfo)<0 let szAccessFilter = 'public' call s:FilterStaticClassMembers(tagPopupList, szAccessFilter) else let szAccessFilter = (s:contextStack[0] == szTypeInfo)? 'all' : 'protected' call s:FilterClassScopeMembers(tagPopupList, szAccessFilter) endif else if index(s:contextStack, szTypeInfo)<0 let szAccessFilter = 'public' else let szAccessFilter = (s:contextStack[0] == szTypeInfo)? 'all' : 'protected' endif call s:FilterClassScopeMembers(tagPopupList, szAccessFilter) endif else " We want to complete a namespace call s:FilterNamespaceScopeMembers(tagPopupList) endif endfor endif else " C) CLASS_MEMBERS_COMPLETION_MODE for resolvedTagItem in omni#cpp#utils#GetResolvedTags(s:contextStack, typeInfo) let szTypeInfo = omni#cpp#utils#ExtractTypeInfoFromTag(resolvedTagItem) if index(s:contextStack, szTypeInfo)<0 let szAccessFilter = 'public' else let szAccessFilter = (s:contextStack[0] == szTypeInfo)? 'all' : 'protected' endif call s:FilterClassMembers(s:SearchMembers(resolvedTagItem, a:base), szAccessFilter) endfor endif endif endif "call omni#common#debug#End() return s:popupItemResultList endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/maycomplete.vim0000644000000000000000000000610712204336073021044 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 " Check if we can use omni completion in the current buffer function! s:CanUseOmnicompletion() " For C and C++ files and only if the omnifunc is omni#cpp#complete#Main return (index(['c', 'cpp'], &filetype)>=0 && &omnifunc == 'omni#cpp#complete#Main' && !omni#cpp#utils#IsCursorInCommentOrString()) endfunc " Return the mapping of omni completion function! omni#cpp#maycomplete#Complete() let szOmniMapping = "\\" " 0 = don't select first item " 1 = select first item (inserting it to the text, default vim behaviour) " 2 = select first item (without inserting it to the text) if g:OmniCpp_SelectFirstItem == 0 " We have to force the menuone option to avoid confusion when there is " only one popup item set completeopt-=menu set completeopt+=menuone let szOmniMapping .= "\" elseif g:OmniCpp_SelectFirstItem == 2 " We have to force the menuone option to avoid confusion when there is " only one popup item set completeopt-=menu set completeopt+=menuone let szOmniMapping .= "\" let szOmniMapping .= "\=pumvisible() ? \"\\\" : \"\"\" endif return szOmniMapping endfunc " May complete function for dot function! omni#cpp#maycomplete#Dot() if s:CanUseOmnicompletion() && g:OmniCpp_MayCompleteDot let g:omni#cpp#items#data = omni#cpp#items#Get(omni#cpp#utils#TokenizeCurrentInstruction('.')) if len(g:omni#cpp#items#data) let s:bMayComplete = 1 return '.' . omni#cpp#maycomplete#Complete() endif endif return '.' endfunc " May complete function for arrow function! omni#cpp#maycomplete#Arrow() if s:CanUseOmnicompletion() && g:OmniCpp_MayCompleteArrow let index = col('.') - 2 if index >= 0 let char = getline('.')[index] if char == '-' let g:omni#cpp#items#data = omni#cpp#items#Get(omni#cpp#utils#TokenizeCurrentInstruction('>')) if len(g:omni#cpp#items#data) let s:bMayComplete = 1 return '>' . omni#cpp#maycomplete#Complete() endif endif endif endif return '>' endfunc " May complete function for double points function! omni#cpp#maycomplete#Scope() if s:CanUseOmnicompletion() && g:OmniCpp_MayCompleteScope let index = col('.') - 2 if index >= 0 let char = getline('.')[index] if char == ':' let g:omni#cpp#items#data = omni#cpp#items#Get(omni#cpp#utils#TokenizeCurrentInstruction(':')) if len(g:omni#cpp#items#data) if len(g:omni#cpp#items#data[-1].tokens) && g:omni#cpp#items#data[-1].tokens[-1].value != '::' let s:bMayComplete = 1 return ':' . omni#cpp#maycomplete#Complete() endif endif endif endif endif return ':' endfunc vim-scripts-20130814ubuntu1/autoload/omni/cpp/namespaces.vim0000644000000000000000000007042712204336073020652 0ustar " Description: Omni completion script for cpp files " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 let g:omni#cpp#namespaces#CacheResolve = {} let g:omni#cpp#namespaces#CacheUsing = {} " TODO: For the next release "let g:omni#cpp#namespaces#CacheAlias = {} " Get the using namespace list from a line function! s:GetNamespaceAliasListFromLine(szLine) let result = {} let tokens = omni#cpp#tokenizer#Tokenize(a:szLine) let szAlias = '' let szNamespace = '' let state = 0 for token in tokens if state==0 let szAlias = '' let szNamespace = '' if token.value == '/*' let state = 1 elseif token.value == '//' " It's a comment let state = -1 break elseif token.value == 'namespace' let state = 2 endif elseif state==1 if token.value == '*/' let state=0 endif elseif state==2 if token.kind == 'cppWord' let szAlias .= token.value let state = 3 else let state = -1 break endif elseif state == 3 if token.value == '=' let state = 4 else let state = -1 break endif elseif state == 4 if token.value == '::' let szNamespace .= token.value let state = 5 elseif token.kind == 'cppWord' let szNamespace .= token.value let state = 6 " Maybe end of tokens endif elseif state==5 if token.kind == 'cppWord' let szNamespace .= token.value let state = 6 " Maybe end of tokens else " Error, we can't have 'namespace ALIAS = Something::' let state = -1 break endif elseif state==6 if token.value == '::' let szNamespace .= token.value let state = 5 else call extend(result, {szAlias : szNamespace}) let state = 0 endif endif endfor if state == 6 call extend(result, {szAlias : szNamespace}) endif return result endfunc " Get the using namespace list from a line function! s:GetNamespaceListFromLine(szLine) let result = [] let tokens = omni#cpp#tokenizer#Tokenize(a:szLine) let szNamespace = '' let state = 0 for token in tokens if state==0 let szNamespace = '' if token.value == '/*' let state = 1 elseif token.value == '//' " It's a comment let state = -1 break elseif token.value == 'using' let state = 2 endif elseif state==1 if token.value == '*/' let state=0 endif elseif state==2 if token.value == 'namespace' let state = 3 else " Error, 'using' must be followed by 'namespace' let state = -1 break endif elseif state==3 if token.value == '::' let szNamespace .= token.value let state = 4 elseif token.kind == 'cppWord' let szNamespace .= token.value let state = 5 " Maybe end of tokens endif elseif state==4 if token.kind == 'cppWord' let szNamespace .= token.value let state = 5 " Maybe end of tokens else " Error, we can't have 'using namespace Something::' let state = -1 break endif elseif state==5 if token.value == '::' let szNamespace .= token.value let state = 4 else call extend(result, [szNamespace]) let state = 0 endif endif endfor if state == 5 call extend(result, [szNamespace]) endif return result endfunc " Get the namespace list from a namespace map function! s:GetUsingNamespaceListFromMap(namespaceMap, ...) let stopLine = 0 if a:0>0 let stopLine = a:1 endif let result = [] let keys = sort(keys(a:namespaceMap), 'omni#common#utils#CompareNumber') for i in keys if stopLine != 0 && i > stopLine break endif call extend(result, a:namespaceMap[i]) endfor return result endfunc " Get global using namespace list from the current buffer function! omni#cpp#namespaces#GetListFromCurrentBuffer(...) let namespaceMap = s:GetAllUsingNamespaceMapFromCurrentBuffer() let result = [] if namespaceMap != {} let result = s:GetUsingNamespaceListFromMap(namespaceMap, (a:0 > 0)? a:1 : line('.')) endif return result endfunc " Get global using namespace map from the current buffer and include files recursively function! s:GetAllUsingNamespaceMapFromCurrentBuffer(...) let includeGuard = (a:0>0)? a:1 : {} let szBufferName = getreg("%") let szFilePath = omni#cpp#utils#ResolveFilePath(szBufferName) let szFilePath = (szFilePath=='')? szBufferName : szFilePath let namespaceMap = {} if has_key(includeGuard, szFilePath) return namespaceMap else let includeGuard[szFilePath] = 1 endif let namespaceMap = omni#cpp#namespaces#GetMapFromCurrentBuffer() if g:OmniCpp_NamespaceSearch != 2 " We don't search included files if OmniCpp_NamespaceSearch != 2 return namespaceMap endif for inc in omni#cpp#includes#GetList() let lnum = inc.pos[0] let tmpMap = s:GetAllUsingNamespaceMapFromFile(inc.include, includeGuard) if tmpMap != {} if has_key(namespaceMap, lnum) call extend(namespaceMap[lnum], s:GetUsingNamespaceListFromMap(tmpMap)) else let namespaceMap[lnum] = s:GetUsingNamespaceListFromMap(tmpMap) endif endif endfor return namespaceMap endfunc " Get global using namespace map from a file and include files recursively function! s:GetAllUsingNamespaceMapFromFile(szFilePath, ...) let includeGuard = {} if a:0 >0 let includeGuard = a:1 endif let szFilePath = omni#cpp#utils#ResolveFilePath(a:szFilePath) let szFilePath = (szFilePath=='')? a:szFilePath : szFilePath let namespaceMap = {} if has_key(includeGuard, szFilePath) return namespaceMap else let includeGuard[szFilePath] = 1 endif " If g:OmniCpp_NamespaceSearch == 1 (search namespaces only in the current " buffer) we don't use cache for the current buffer let namespaceMap = omni#cpp#namespaces#GetMapFromBuffer(szFilePath, g:OmniCpp_NamespaceSearch==1) if g:OmniCpp_NamespaceSearch != 2 " We don't search included files if OmniCpp_NamespaceSearch != 2 return namespaceMap endif for inc in omni#cpp#includes#GetList(szFilePath) let lnum = inc.pos[0] let tmpMap = s:GetAllUsingNamespaceMapFromFile(inc.include, includeGuard) if tmpMap != {} if has_key(namespaceMap, lnum) call extend(namespaceMap[lnum], s:GetUsingNamespaceListFromMap(tmpMap)) else let namespaceMap[lnum] = s:GetUsingNamespaceListFromMap(tmpMap) endif endif endfor return namespaceMap endfunc " Get global using namespace map from a the current buffer function! omni#cpp#namespaces#GetMapFromCurrentBuffer() let namespaceMap = {} let originalPos = getpos('.') call setpos('.', [0, 1, 1, 0]) let curPos = [1,1] while curPos != [0,0] let curPos = searchpos('\C^using\s\+namespace', 'W') if curPos != [0,0] let szLine = getline('.') let startPos = curPos[1] let endPos = match(szLine, ';', startPos-1) if endPos!=-1 " We get the namespace list from the line let namespaceMap[curPos[0]] = s:GetNamespaceListFromLine(szLine) endif endif endwhile call setpos('.', originalPos) return namespaceMap endfunc " Get global using namespace map from a file function! omni#cpp#namespaces#GetMapFromBuffer(szFilePath, ...) let bUpdate = 0 if a:0 > 0 let bUpdate = a:1 endif let szFilePath = omni#cpp#utils#ResolveFilePath(a:szFilePath) let szFilePath = (szFilePath=='')? a:szFilePath : szFilePath if !bUpdate && has_key(g:omni#cpp#namespaces#CacheUsing, szFilePath) return copy(g:omni#cpp#namespaces#CacheUsing[szFilePath]) endif let namespaceMap = {} " The file exists, we get the global namespaces in this file let szFixedPath = escape(szFilePath, g:omni#cpp#utils#szEscapedCharacters) execute 'silent! lvimgrep /\C^using\s\+namespace/gj '.szFixedPath " key = line number " value = list of namespaces let listQuickFix = getloclist(0) for qf in listQuickFix let szLine = qf.text let startPos = qf.col let endPos = match(szLine, ';', startPos-1) if endPos!=-1 " We get the namespace list from the line let namespaceMap[qf.lnum] = s:GetNamespaceListFromLine(szLine) endif endfor if szFixedPath != '' let g:omni#cpp#namespaces#CacheUsing[szFixedPath] = namespaceMap endif return copy(namespaceMap) endfunc " Get the stop position when searching for local variables function! s:GetStopPositionForLocalSearch() " Stop position when searching a local variable let originalPos = getpos('.') let origPos = originalPos[1:2] let stopPosition = origPos let curPos = origPos while curPos !=[0,0] let stopPosition = curPos let curPos = searchpairpos('{', '', '}', 'bW', g:omni#cpp#utils#expIgnoreComments) endwhile call setpos('.', originalPos) return stopPosition endfunc " Get namespaces alias used at the cursor postion in a vim buffer " Note: The result depends on the current cursor position " @return " - Map of namespace alias function! s:GetNamespaceAliasMap() " We store the cursor position because searchpairpos() moves the cursor let result = {} let originalPos = getpos('.') let origPos = originalPos[1:2] let stopPos = s:GetStopPositionForLocalSearch() let stopLine = stopPos[0] let curPos = origPos let lastLine = 0 let nextStopLine = origPos[0] let szReAlias = '\Cnamespace\s\+\w\+\s\+=' while curPos !=[0,0] let curPos = searchpos('}\|\('. szReAlias .'\)', 'bW',stopLine) if curPos!=[0,0] && curPos[0]!=lastLine let lastLine = curPos[0] let szLine = getline('.') if origPos[0] == curPos[0] " We get the line until cursor position let szLine = szLine[:origPos[1]] endif let szLine = omni#cpp#utils#GetCodeFromLine(szLine) if match(szLine, szReAlias)<0 " We found a '}' let curPos = searchpairpos('{', '', '}', 'bW', g:omni#cpp#utils#expIgnoreComments) else " We get the namespace alias from the line call extend(result, s:GetNamespaceAliasListFromLine(szLine)) let nextStopLine = curPos[0] endif endif endwhile " Setting the cursor to the original position call setpos('.', originalPos) call s:ResolveAliasKeys(result) return result endfunc " Resolve an alias " eg: namespace IAmAnAlias1 = Ns1 " eg: namespace IAmAnAlias2 = IAmAnAlias1::Ns2 " => IAmAnAlias2 = Ns1::Ns2 function! s:ResolveAliasKey(mapNamespaceAlias, szAlias) let szResult = a:mapNamespaceAlias[a:szAlias] " ::Ns1::Ns2::Ns3 => ['Ns1', 'Ns2', 'Ns3'] let listNamespace = split(szResult, '::') if len(listNamespace) " szBeginPart = 'Ns1' let szBeginPart = remove(listNamespace, 0) " Is 'Ns1' an alias ? if has_key(a:mapNamespaceAlias, szBeginPart) && szBeginPart != a:szAlias " Resolving alias 'Ns1' " eg: Ns1 = NsResolved let szResult = s:ResolveAliasKey(a:mapNamespaceAlias, szBeginPart) " szEndPart = 'Ns2::Ns3' let szEndPart = join(listNamespace, '::') if szEndPart != '' " Concatenation => szResult = 'NsResolved::Ns2::Ns3' let szResult .= '::' . szEndPart endif endif endif return szResult endfunc " Resolve all keys in the namespace alias map function! s:ResolveAliasKeys(mapNamespaceAlias) let mapNamespaceAlias = a:mapNamespaceAlias call map(mapNamespaceAlias, 's:ResolveAliasKey(mapNamespaceAlias, v:key)') endfunc " Resolve namespace alias function! omni#cpp#namespaces#ResolveAlias(mapNamespaceAlias, szNamespace) let szResult = a:szNamespace " ::Ns1::Ns2::Ns3 => ['Ns1', 'Ns2', 'Ns3'] let listNamespace = split(a:szNamespace, '::') if len(listNamespace) " szBeginPart = 'Ns1' let szBeginPart = remove(listNamespace, 0) " Is 'Ns1' an alias ? if has_key(a:mapNamespaceAlias, szBeginPart) " Resolving alias 'Ns1' " eg: Ns1 = NsResolved let szResult = a:mapNamespaceAlias[szBeginPart] " szEndPart = 'Ns2::Ns3' let szEndPart = join(listNamespace, '::') if szEndPart != '' " Concatenation => szResult = 'NsResolved::Ns2::Ns3' let szResult .= '::' . szEndPart endif " If a:szNamespace starts with '::' we add '::' to the beginning " of the result if match(a:szNamespace, '^::')>=0 let szResult = omni#cpp#utils#SimplifyScope('::' . szResult) endif endif endif return szResult endfunc " Resolve namespace alias function! s:ResolveAliasInNamespaceList(mapNamespaceAlias, listNamespaces) call map(a:listNamespaces, 'omni#cpp#namespaces#ResolveAlias(a:mapNamespaceAlias, v:val)') endfunc " Get namespaces used at the cursor postion in a vim buffer " Note: The result depends on the current cursor position " @return " - List of namespace used in the reverse order function! omni#cpp#namespaces#GetUsingNamespaces() " We have to get local using namespace declarations " We need the current cursor position and the position of the start of the " current scope " We store the cursor position because searchpairpos() moves the cursor let result = [] let originalPos = getpos('.') let origPos = originalPos[1:2] let stopPos = s:GetStopPositionForLocalSearch() let stopLine = stopPos[0] let curPos = origPos let lastLine = 0 let nextStopLine = origPos[0] while curPos !=[0,0] let curPos = searchpos('\C}\|\(using\s\+namespace\)', 'bW',stopLine) if curPos!=[0,0] && curPos[0]!=lastLine let lastLine = curPos[0] let szLine = getline('.') if origPos[0] == curPos[0] " We get the line until cursor position let szLine = szLine[:origPos[1]] endif let szLine = omni#cpp#utils#GetCodeFromLine(szLine) if match(szLine, '\Cusing\s\+namespace')<0 " We found a '}' let curPos = searchpairpos('{', '', '}', 'bW', g:omni#cpp#utils#expIgnoreComments) else " We get the namespace list from the line let result = s:GetNamespaceListFromLine(szLine) + result let nextStopLine = curPos[0] endif endif endwhile " Setting the cursor to the original position call setpos('.', originalPos) " 2) Now we can get all global using namespace declaration from the " beginning of the file to nextStopLine let result = omni#cpp#namespaces#GetListFromCurrentBuffer(nextStopLine) + result " Resolving alias in the namespace list " TODO: For the next release "let g:omni#cpp#namespaces#CacheAlias= s:GetNamespaceAliasMap() "call s:ResolveAliasInNamespaceList(g:omni#cpp#namespaces#CacheAlias, result) return ['::'] + result endfunc " Resolve a using namespace regarding the current context " For each namespace used: " - We get all possible contexts where the namespace " can be define " - We do a comparison test of each parent contexts with the current " context list " - If one and only one parent context is present in the " current context list we add the namespace in the current " context " - If there is more than one of parent contexts in the " current context the namespace is ambiguous " @return " - result item " - kind = 0|1 " - 0 = unresolved or error " - 1 = resolved " - value = resolved namespace function! s:ResolveNamespace(namespace, mapCurrentContexts) let result = {'kind':0, 'value': ''} " If the namespace is already resolved we add it in the list of " current contexts if match(a:namespace, '^::')>=0 let result.kind = 1 let result.value = a:namespace return result elseif match(a:namespace, '\w\+::\w\+')>=0 let mapCurrentContextsTmp = copy(a:mapCurrentContexts) let resolvedItem = {} for nsTmp in split(a:namespace, '::') let resolvedItem = s:ResolveNamespace(nsTmp, mapCurrentContextsTmp) if resolvedItem.kind " Note: We don't extend the map let mapCurrentContextsTmp = {resolvedItem.value : 1} else break endif endfor if resolvedItem!={} && resolvedItem.kind let result.kind = 1 let result.value = resolvedItem.value endif return result endif " We get all possible parent contexts of this namespace let listTagsOfNamespace = [] if has_key(g:omni#cpp#namespaces#CacheResolve, a:namespace) let listTagsOfNamespace = g:omni#cpp#namespaces#CacheResolve[a:namespace] else let listTagsOfNamespace = omni#common#utils#TagList('^'.a:namespace.'$') let g:omni#cpp#namespaces#CacheResolve[a:namespace] = listTagsOfNamespace endif if len(listTagsOfNamespace)==0 return result endif call filter(listTagsOfNamespace, 'v:val.kind[0]=="n"') " We extract parent context from tags " We use a map to avoid multiple entries let mapContext = {} for tagItem in listTagsOfNamespace let szParentContext = omni#cpp#utils#ExtractScope(tagItem) let mapContext[szParentContext] = 1 endfor let listParentContext = keys(mapContext) " Now for each parent context we test if the context is in the current " contexts list let listResolvedNamespace = [] for szParentContext in listParentContext if has_key(a:mapCurrentContexts, szParentContext) call extend(listResolvedNamespace, [omni#cpp#utils#SimplifyScope(szParentContext.'::'.a:namespace)]) endif endfor " Now we know if the namespace is ambiguous or not let len = len(listResolvedNamespace) if len==1 " Namespace resolved let result.kind = 1 let result.value = listResolvedNamespace[0] elseif len > 1 " Ambiguous namespace, possible matches are in listResolvedNamespace else " Other cases endif return result endfunc " Resolve namespaces "@return " - List of resolved namespaces function! omni#cpp#namespaces#ResolveAll(namespacesUsed) " We add the default context '::' let contextOrder = 0 let mapCurrentContexts = {} " For each namespace used: " - We get all possible contexts where the namespace " can be define " - We do a comparison test of each parent contexts with the current " context list " - If one and only one parent context is present in the " current context list we add the namespace in the current " context " - If there is more than one of parent contexts in the " current context the namespace is ambiguous for ns in a:namespacesUsed let resolvedItem = s:ResolveNamespace(ns, mapCurrentContexts) if resolvedItem.kind let contextOrder+=1 let mapCurrentContexts[resolvedItem.value] = contextOrder endif endfor " Build the list of current contexts from the map, we have to keep the " order let mapReorder = {} for key in keys(mapCurrentContexts) let mapReorder[ mapCurrentContexts[key] ] = key endfor let result = [] for key in sort(keys(mapReorder)) call extend(result, [mapReorder[key]]) endfor return result endfunc " Build the context stack function! s:BuildContextStack(namespaces, szCurrentScope) let result = copy(a:namespaces) if a:szCurrentScope != '::' let tagItem = omni#cpp#utils#GetResolvedTagItem(a:namespaces, omni#cpp#utils#CreateTypeInfo(a:szCurrentScope)) if has_key(tagItem, 'inherits') let listBaseClass = omni#cpp#utils#GetClassInheritanceList(a:namespaces, omni#cpp#utils#CreateTypeInfo(a:szCurrentScope)) let result = listBaseClass + result elseif has_key(tagItem, 'kind') && index(['c', 's', 'u', 'n'], tagItem.kind[0])>=0 call insert(result, omni#cpp#utils#ExtractTypeInfoFromTag(tagItem)) endif endif return result endfunc " Returns the class scope at the current position of the cursor " @return a string that represents the class scope " eg: ::NameSpace1::Class1 " The returned string always starts with '::' " Note: In term of performance it's the weak point of the script function! s:GetClassScopeAtCursor() " We store the cursor position because searchpairpos() moves the cursor let originalPos = getpos('.') let endPos = originalPos[1:2] let listCode = [] let result = {'namespaces': [], 'scope': ''} while endPos!=[0,0] let endPos = searchpairpos('{', '', '}', 'bW', g:omni#cpp#utils#expIgnoreComments) let szReStartPos = '[;{}]\|\%^' let startPos = searchpairpos(szReStartPos, '', '{', 'bWn', g:omni#cpp#utils#expIgnoreComments) " If the file starts with a comment so the startPos can be [0,0] " we change it to [1,1] if startPos==[0,0] let startPos = [1,1] endif " Get lines backward from cursor position to last ; or { or } " or when we are at the beginning of the file. " We store lines in listCode if endPos!=[0,0] " We remove the last character which is a '{' " We also remove starting { or } or ; if exits let szCodeWithoutComments = substitute(omni#cpp#utils#GetCode(startPos, endPos)[:-2], '^[;{}]', '', 'g') call insert(listCode, {'startLine' : startPos[0], 'code' : szCodeWithoutComments}) endif endwhile " Setting the cursor to the original position call setpos('.', originalPos) let listClassScope = [] let bResolved = 0 let startLine = 0 " Now we can check in the list of code if there is a function for code in listCode " We get the name of the namespace, class, struct or union " and we store it in listClassScope let tokens = omni#cpp#tokenizer#Tokenize(code.code) let bContinue=0 let bAddNamespace = 0 let state=0 for token in tokens if state==0 if index(['namespace', 'class', 'struct', 'union'], token.value)>=0 if token.value == 'namespace' let bAddNamespace = 1 endif let state= 1 " Maybe end of tokens endif elseif state==1 if token.kind == 'cppWord' " eg: namespace MyNs { class MyCl {}; } " => listClassScope = [MyNs, MyCl] call extend( listClassScope , [token.value] ) " Add the namespace in result if bAddNamespace call extend(result.namespaces, [token.value]) let bAddNamespace = 0 endif let bContinue=1 break endif endif endfor if bContinue==1 continue endif " Simple test to check if we have a chance to find a " class method let aPos = matchend(code.code, '::\s*\~*\s*\w\+\s*(') if aPos ==-1 continue endif let startLine = code.startLine let listTmp = [] " eg: 'void MyNamespace::MyClass::foo(' " => tokens = ['MyClass', '::', 'MyNamespace', 'void'] let tokens = reverse(omni#cpp#tokenizer#Tokenize(code.code[:aPos-1])[:-4]) let state = 0 " Reading tokens backward for token in tokens if state==0 if token.kind=='cppWord' call insert(listTmp, token.value) let state=1 endif elseif state==1 if token.value=='::' let state=2 else break endif elseif state==2 if token.kind=='cppWord' call insert(listTmp, token.value) let state=1 else break endif endif endfor if len(listTmp) if len(listClassScope) let bResolved = 1 " Merging class scopes " eg: current class scope = 'MyNs::MyCl1' " method class scope = 'MyCl1::MyCl2' " If we add the method class scope to current class scope " we'll have MyNs::MyCl1::MyCl1::MyCl2 => it's wrong " we want MyNs::MyCl1::MyCl2 let index = 0 for methodClassScope in listTmp if methodClassScope==listClassScope[-1] let listTmp = listTmp[index+1:] break else let index+=1 endif endfor endif call extend(listClassScope, listTmp) break endif endfor let szClassScope = '::' if len(listClassScope) if bResolved let szClassScope .= join(listClassScope, '::') else let szClassScope = join(listClassScope, '::') " The class scope is not resolved, we have to check using " namespace declarations and search the class scope in each " namespace if startLine != 0 let namespaces = ['::'] + omni#cpp#namespaces#GetListFromCurrentBuffer(startLine) let namespaces = omni#cpp#namespaces#ResolveAll(namespaces) let tagItem = omni#cpp#utils#GetResolvedTagItem(namespaces, omni#cpp#utils#CreateTypeInfo(szClassScope)) if tagItem != {} let szClassScope = omni#cpp#utils#ExtractTypeInfoFromTag(tagItem) endif endif endif endif let result.scope = szClassScope return result endfunc " Get all contexts at the cursor position function! omni#cpp#namespaces#GetContexts() " Get the current class scope at the cursor, the result depends on the current cursor position let scopeItem = s:GetClassScopeAtCursor() let listUsingNamespace = copy(g:OmniCpp_DefaultNamespaces) call extend(listUsingNamespace, scopeItem.namespaces) if g:OmniCpp_NamespaceSearch && &filetype != 'c' " Get namespaces used in the file until the cursor position let listUsingNamespace = omni#cpp#namespaces#GetUsingNamespaces() + listUsingNamespace " Resolving namespaces, removing ambiguous namespaces let namespaces = omni#cpp#namespaces#ResolveAll(listUsingNamespace) else let namespaces = ['::'] + listUsingNamespace endif call reverse(namespaces) " Building context stack from namespaces and the current class scope return s:BuildContextStack(namespaces, scopeItem.scope) endfunc vim-scripts-20130814ubuntu1/autoload/omni/common/0000755000000000000000000000000012204336114016506 5ustar vim-scripts-20130814ubuntu1/autoload/omni/common/debug.vim0000644000000000000000000000173012204336073020316 0ustar " Description: Omni completion debug functions " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 let s:CACHE_DEBUG_TRACE = [] " Start debug, clear the debug file function! omni#common#debug#Start() let s:CACHE_DEBUG_TRACE = [] call extend(s:CACHE_DEBUG_TRACE, ['============ Debug Start ============']) call writefile(s:CACHE_DEBUG_TRACE, "Omni.dbg") endfunc " End debug, write to debug file function! omni#common#debug#End() call extend(s:CACHE_DEBUG_TRACE, ["============= Debug End ============="]) call extend(s:CACHE_DEBUG_TRACE, [""]) call writefile(s:CACHE_DEBUG_TRACE, "Omni.dbg") endfunc " Debug trace function function! omni#common#debug#Trace(szFuncName, ...) let szTrace = a:szFuncName let paramNum = a:0 if paramNum>0 let szTrace .= ':' endif for i in range(paramNum) let szTrace = szTrace .' ('. string(eval('a:'.string(i+1))).')' endfor call extend(s:CACHE_DEBUG_TRACE, [szTrace]) endfunc vim-scripts-20130814ubuntu1/autoload/omni/common/utils.vim0000644000000000000000000000367012204336073020375 0ustar " Description: Omni completion utils " Maintainer: Vissale NEANG " Last Change: 26 sept. 2007 " For sort numbers in list function! omni#common#utils#CompareNumber(i1, i2) let num1 = eval(a:i1) let num2 = eval(a:i2) return num1 == num2 ? 0 : num1 > num2 ? 1 : -1 endfunc " TagList function calling the vim taglist() with try catch " The only throwed exception is 'TagList:UserInterrupt' " We also force the noignorecase option to avoid linear search when calling " taglist() function! omni#common#utils#TagList(szTagQuery) let result = [] let bUserIgnoreCase = &ignorecase " Forcing noignorecase search => binary search can be used in taglist() " if tags in the tag file are sorted if bUserIgnoreCase set noignorecase endif try let result = taglist(a:szTagQuery) catch /^Vim:Interrupt$/ " Restoring user's setting if bUserIgnoreCase set ignorecase endif throw 'TagList:UserInterrupt' catch "Note: it seems that ctags can generate corrupted files, in this case "taglist() will fail to read the tagfile and an exception from "has_add() is thrown endtry " Restoring user's setting if bUserIgnoreCase set ignorecase endif return result endfunc " Same as TagList but don't throw exception function! omni#common#utils#TagListNoThrow(szTagQuery) let result = [] try let result = omni#common#utils#TagList(a:szTagQuery) catch endtry return result endfunc " Get the word under the cursor function! omni#common#utils#GetWordUnderCursor() let szLine = getline('.') let startPos = getpos('.')[2]-1 let startPos = (startPos < 0)? 0 : startPos if szLine[startPos] =~ '\w' let startPos = searchpos('\<\w\+', 'cbn', line('.'))[1] - 1 endif let startPos = (startPos < 0)? 0 : startPos let szResult = matchstr(szLine, '\w\+', startPos) return szResult endfunc vim-scripts-20130814ubuntu1/autoload/AlignMaps.vim0000644000000000000000000003023412204336073016652 0ustar " AlignMaps.vim : support functions for AlignMaps " Author: Charles E. Campbell " Date: Mar 12, 2013 " Version: 43 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " 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, " Align.vim is provided *as is* and comes with no warranty " of any kind, either expressed or implied. By using this " plugin, you agree that in no event will the copyright " holder be liable for any damages resulting from the use "redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() " --------------------------------------------------------------------- " Load Once: {{{1 if &cp || exists("g:loaded_AlignMaps") finish endif let g:loaded_AlignMaps= "v43" let s:keepcpo = &cpo set cpo&vim "DechoTabOn " ===================================================================== " Functions: {{{1 " --------------------------------------------------------------------- " AlignMaps#WrapperStart: {{{2 fun! AlignMaps#WrapperStart(vis) range " call Dfunc("AlignMaps#WrapperStart(vis=".a:vis.")") if a:vis keepj norm! ' endif if line("'y") == 0 || line("'z") == 0 || !exists("s:alignmaps_wrapcnt") || s:alignmaps_wrapcnt <= 0 " call Decho("wrapper initialization") let s:alignmaps_wrapcnt = 1 let s:alignmaps_keepgd = &gdefault let s:alignmaps_keepsearch = @/ let s:alignmaps_keepch = &ch let s:alignmaps_keepmy = SaveMark("'y") let s:alignmaps_keepmz = SaveMark("'z") let s:alignmaps_posn = SaveWinPosn(0) " set up fencepost blank lines put ='' keepj norm! mz'a put! ='' ky let s:alignmaps_zline = line("'z") exe "keepj 'y,'zs/@/\177/ge" else " call Decho("embedded wrapper") let s:alignmaps_wrapcnt = s:alignmaps_wrapcnt + 1 keepj norm! 'yjma'zk endif " change some settings to align-standard values set nogd set ch=2 AlignPush keepj norm! 'zk " call Dret("AlignMaps#WrapperStart : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) endfun " --------------------------------------------------------------------- " AlignMaps#WrapperEnd: {{{2 fun! AlignMaps#WrapperEnd() range " call Dfunc("AlignMaps#WrapperEnd() alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) " remove trailing white space introduced by whatever in the modification zone keepj 'y,'zs/ \+$//e " restore AlignCtrl settings AlignPop let s:alignmaps_wrapcnt= s:alignmaps_wrapcnt - 1 if s:alignmaps_wrapcnt <= 0 " initial wrapper ending exe "keepj 'y,'zs/\177/@/ge" " if the 'z line hasn't moved, then go ahead and restore window position let zstationary= s:alignmaps_zline == line("'z") " remove fencepost blank lines. " restore 'a keepj norm! 'yjmakdd'zdd " restore original 'y, 'z, and window positioning call RestoreMark(s:alignmaps_keepmy) call RestoreMark(s:alignmaps_keepmz) if zstationary > 0 call RestoreWinPosn(s:alignmaps_posn) " call Decho("restored window positioning") endif " restoration of options let &gd= s:alignmaps_keepgd let &ch= s:alignmaps_keepch let @/ = s:alignmaps_keepsearch " remove script variables unlet s:alignmaps_keepch unlet s:alignmaps_keepsearch unlet s:alignmaps_keepmy unlet s:alignmaps_keepmz unlet s:alignmaps_keepgd unlet s:alignmaps_posn endif " call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) endfun " --------------------------------------------------------------------- " AlignMaps#MakeMap: make both a normal-mode and a visual mode map for mapname {{{2 fun! AlignMaps#MakeMap(mapname) if exists("g:maplocalleader") let maplead= g:maplocalleader elseif exists("g:mapleader") let maplead= g:mapleader else let maplead= '\' endif exe "nmap ".maplead.a:mapname." AM_".a:mapname exe "vmap ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."" endfun " --------------------------------------------------------------------- " AlignMaps#StdAlign: some semi-standard align calls {{{2 fun! AlignMaps#StdAlign(mode) range " call Dfunc("AlignMaps#StdAlign(mode=".a:mode.")") if a:mode == 1 " align on @ " call Decho("align on @") AlignCtrl mIp1P1=l @ 'a,.Align elseif a:mode == 2 " align on @, retaining all initial white space on each line " call Decho("align on @, retaining all initial white space on each line") AlignCtrl mWp1P1=l @ 'a,.Align elseif a:mode == 3 " like mode 2, but ignore /* */-style comments " call Decho("like mode 2, but ignore /* */-style comments") AlignCtrl v ^\s*/[/*] AlignCtrl mWp1P1=l @ 'a,.Align else echoerr "(AlignMaps) AlignMaps#StdAlign doesn't support mode#".a:mode endif " call Dret("AlignMaps#StdAlign") endfun " --------------------------------------------------------------------- " AlignMaps#CharJoiner: joins lines which end in the given character (spaces {{{2 " at end are ignored) fun! AlignMaps#CharJoiner(chr) " call Dfunc("AlignMaps#CharJoiner(chr=".a:chr.")") let aline = line("'a") let rep = line(".") - aline while rep > 0 keepj norm! 'a while match(getline(aline),a:chr . "\s*$") != -1 && rep >= 0 " while = at end-of-line, delete it and join with next keepj norm! 'a$ j! let rep = rep - 1 endwhile " update rep(eat) count let rep = rep - 1 if rep <= 0 " terminate loop if at end-of-block break endif " prepare for next line keepj norm! jma let aline = line("'a") endwhile " call Dret("AlignMaps#CharJoiner") endfun " --------------------------------------------------------------------- " AlignMaps#Equals: supports \t= and \T= {{{2 fun! AlignMaps#Equals() range " call Dfunc("AlignMaps#Equals()") keepj 'a,'zs/\s\+\([.*/+\-%|&\~^]\==\)/ \1/e keepj 'a,'zs@ \+\([.*/+\-%|&\~^]\)=@\1=@ge keepj 'a,'zs/==/\="\\"/ge keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\"/ge keepj norm g'zk AlignCtrl mIp1P1=l = AlignCtrl g = keepj 'a,'z-1Align keepj 'a,'z-1s@\([.*/%|&\~^!=]\)\( \+\)=@\2\1=@ge keepj 'a,'z-1s@[^+\-]\zs\([+\-]\)\( \+\)=@\2\1=@ge keepj 'a,'z-1s/\( \+\);/;\1/ge if &ft == "c" || &ft == "cpp" " call Decho("exception for ".&ft) keepj 'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e keepj 'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e if exists("g:mapleader") exe "keepj norm 'zk" call AlignMaps#StdAlign(1) else exe "keepj norm 'zk" call AlignMaps#StdAlign(1) endif keepj 'y,'zs/^\(\s*\) @/\1/e endif keepj 'a,'z-1s/\%x0f/=/ge keepj 'y,'zs/ @//eg " call Dret("AlignMaps#Equals") endfun " --------------------------------------------------------------------- " AlignMaps#Afnc: useful for splitting one-line function beginnings {{{2 " into one line per argument format fun! AlignMaps#Afnc() " call Dfunc("AlignMaps#Afnc()") " keep display quiet let chkeep = &l:ch let gdkeep = &l:gd let wwkeep = &l:ww let vekeep = &l:ve setlocal ch=2 nogd ve= ww=b,s,<,>,[,] " will use marks y,z ; save current values let mykeep = SaveMark("'y") let mzkeep = SaveMark("'z") " Find beginning of function -- be careful to skip over comments let cmmntid = synIDtrans(hlID("Comment")) let stringid = synIDtrans(hlID("String")) exe "keepj norm! ]]" while search(")","bW") != 0 " call Decho("line=".line(".")." col=".col(".")) let parenid= synIDtrans(synID(line("."),col("."),1)) if parenid != cmmntid && parenid != stringid break endif endwhile keepj norm! %my keepj s/(\s*\(\S\)/(\r \1/e exe "keepj norm! `y%" keepj s/)\s*\(\/[*/]\)/)\r\1/e exe "keepj norm! `y%mz" keepj 'y,'zs/\s\+$//e keepj 'y,'zs/^\s\+//e keepj 'y+1,'zs/^/ / " insert newline after every comma only one parenthesis deep exe "sil! keepj norm! `y\h" let parens = 1 let cmmnt = 0 let cmmntline= -1 while parens >= 1 exe 'keepj norm! ma "ay`a ' " call Decho("parens=".parens." cmmnt=".cmmnt." cmmntline=".cmmntline." line(.)=".line(".")." @a<".@a."> line<".getline(".").">") if @a == "(" let parens= parens + 1 elseif @a == ")" let parens= parens - 1 " comment bypass: /* ... */ or //... elseif cmmnt == 0 && @a == '/' let cmmnt= 1 elseif cmmnt == 1 if @a == '/' let cmmnt = 2 " //... let cmmntline= line(".") elseif @a == '*' let cmmnt= 3 " /*... else let cmmnt= 0 endif elseif cmmnt == 2 && line(".") != cmmntline let cmmnt = 0 let cmmntline= -1 elseif cmmnt == 3 && @a == '*' let cmmnt= 4 elseif cmmnt == 4 if @a == '/' let cmmnt= 0 " ...*/ elseif @a != '*' let cmmnt= 3 endif elseif @a == "," && parens == 1 && cmmnt == 0 exe "keepj norm! i\\" endif endwhile sil! keepj norm! `y%mz% sil! keepj 'y,'zg/^\s*$/d " perform substitutes to mark fields for Align sil! keepj 'y+1,'zv/^\//s/^\s\+\(\S\)/ \1/e sil! keepj 'y+1,'zv/^\//s/\(\S\)\s\+/\1 /eg sil! keepj 'y+1,'zv/^\//s/\* \+/*/ge sil! keepj 'y+1,'zv/^\//s/\w\zs\s*\*/ */ge " func " ws <- declaration -> <-ptr -> <-var-> <-[array][] -> <-glop-> <-end-> sil! keepj 'y+1,'zv/^\//s/^\s*\(\(\K\k*\s*\)\+\)\s\+\([(*]*\)\s*\(\K\k*\)\s*\(\(\[.\{-}]\)*\)\s*\(.\{-}\)\=\s*\([,)]\)\s*$/ \1@#\3@\4\5@\7\8/e sil! keepj 'y+1,'z+1g/^\s*\/[*/]/norm! kJ sil! keepj 'y+1,'z+1s%/[*/]%@&@%ge sil! keepj 'y+1,'z+1s%*/%@&%ge AlignCtrl mIp0P0=l @ sil! keepj 'y+1,'zAlign sil! keepj 'y,'zs%@\(/[*/]\)@%\t\1 %e sil! keepj 'y,'zs%@\*/% */%e sil! keepj 'y,'zs/@\([,)]\)/\1/ sil! keepj 'y,'zs/@/ / AlignCtrl mIlrp0P0= # @ sil! keepj 'y+1,'zAlign sil! keepj 'y+1,'zs/#/ / sil! keepj 'y+1,'zs/@// sil! keepj 'y+1,'zs/\(\s\+\)\([,)]\)/\2\1/e " Restore call RestoreMark(mykeep) call RestoreMark(mzkeep) let &l:ch= chkeep let &l:gd= gdkeep let &l:ww= wwkeep let &l:ve= vekeep " call Dret("AlignMaps#Afnc") endfun " --------------------------------------------------------------------- " AlignMaps#FixMultiDec: converts a type arg,arg,arg; line to multiple lines {{{2 fun! AlignMaps#FixMultiDec() " call Dfunc("AlignMaps#FixMultiDec()") " save register x let xkeep = @x let curline = getline(".") " call Decho("curline<".curline.">") let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+[(*]*\h.*$','\1','') " call Decho("@x<".@x.">") " transform line exe 'keepj s/,/;\r'.@x.' /ge' "restore register x let @x= xkeep " call Dret("AlignMaps#FixMultiDec : my=".line("'y")." mz=".line("'z")) endfun " --------------------------------------------------------------------- " AlignMaps#AlignMapsClean: this function removes the AlignMaps plugin {{{2 fun! AlignMaps#AlignMapsClean() " call Dfunc("AlignMaps#AlignMapsClean()") for home in split(&rtp,',') + [''] " call Decho("considering home<".home.">") if isdirectory(home) if filereadable(home."/autoload/AlignMaps.vim") " call Decho("deleting ".home."/autoload/AlignMaps.vim") call delete(home."/autoload/AlignMaps.vim") endif if filereadable(home."/plugin/AlignMapsPlugin.vim") " call Decho("deleting ".home."/plugin/AlignMapsPlugin.vim") call delete(home."/plugin/AlignMapsPlugin.vim") endif endif endfor " call Dret("AlignMaps#AlignMapsClean") endfun " --------------------------------------------------------------------- " AlignMaps#Vis: interfaces with visual maps {{{2 fun! AlignMaps#Vis(plugmap) range " call Dfunc("AlignMaps#VisCall(plugmap<".a:plugmap.">) ".a:firstline.",".a:lastline) let amark= SaveMark("a") exe a:firstline ka exe a:lastline if exists("g:maplocalleader") let maplead= g:maplocalleader elseif exists("g:mapleader") let maplead= g:mapleader else let maplead= '\' endif " call Decho("exe norm ".maplead.a:plugmap) exe " norm ".maplead.a:plugmap call RestoreMark(amark) " call Dret("AlignMaps#VisCall") endfun " --------------------------------------------------------------------- " Restore: {{{1 let &cpo= s:keepcpo unlet s:keepcpo " vim: ts=4 fdm=marker vim-scripts-20130814ubuntu1/autoload/Align.vim0000644000000000000000000011473712204336073016044 0ustar " Align: tool to align multiple fields based on one or more separators " Author: Charles E. Campbell " Date: Mar 12, 2013 " Version: 37 " GetLatestVimScripts: 294 1 :AutoInstall: Align.vim " GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " 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, " Align.vim is provided *as is* and comes with no warranty " of any kind, either expressed or implied. By using this " plugin, you agree that in no event will the copyright " holder be liable for any damages resulting from the use " of this software. " " Romans 1:16,17a : For I am not ashamed of the gospel of Christ, for it is {{{1 " the power of God for salvation for everyone who believes; for the Jew first, " and also for the Greek. For in it is revealed God's righteousness from " faith to faith. "redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() " --------------------------------------------------------------------- " Load Once: {{{1 if exists("g:loaded_Align") || &cp finish endif let g:loaded_Align = "v37" if v:version < 700 echohl WarningMsg echo "***warning*** this version of Align needs vim 7.0" echohl Normal finish endif let s:keepcpo= &cpo set cpo&vim "DechoTabOn " --------------------------------------------------------------------- " Debugging Support: {{{1 "if !exists("g:loaded_Decho") | runtime plugin/Decho.vim | endif " --------------------------------------------------------------------- " Options: {{{1 if !exists("g:Align_xstrlen") if exists("g:drawit_xstrlen") let g:Align_xstrlen= g:drawit_xstrlen elseif exists("g:netrw_xstrlen") let g:Align_xstrlen= g:netrw_xstrlen elseif &enc == "latin1" || !has("multi_byte") let g:Align_xstrlen= 0 else let g:Align_xstrlen= 1 endif endif " --------------------------------------------------------------------- " Align#AlignCtrl: enter alignment patterns here {{{1 " " Styles = all alignment-break patterns are equivalent " C cycle through alignment-break pattern(s) " l left-justified alignment " r right-justified alignment " c center alignment " - skip separator, treat as part of field " : treat rest of line as field " + repeat previous [lrc] style " < left justify separators " > right justify separators " | center separators " " Builds = s:AlignPat s:AlignCtrl s:AlignPatQty " C s:AlignPat s:AlignCtrl s:AlignPatQty " p s:AlignPrePad " P s:AlignPostPad " w s:AlignLeadKeep " W s:AlignLeadKeep " I s:AlignLeadKeep " l s:AlignStyle " r s:AlignStyle " - s:AlignStyle " + s:AlignStyle " : s:AlignStyle " c s:AlignStyle " g s:AlignGPat " v s:AlignVPat " < s:AlignSep " > s:AlignSep " | s:AlignSep fun! Align#AlignCtrl(...) " call Dfunc("Align#AlignCtrl(...) a:0=".a:0) " save options that may be changed later call s:SaveUserOptions() " turn ignorecase off setlocal noic " clear visual mode so that old visual-mode selections don't " get applied to new invocations of Align(). if v:version < 602 if !exists("s:Align_gavemsg") let s:Align_gavemsg= 1 echomsg "Align needs at least Vim version 6.2 to clear visual-mode selection" endif elseif exists("s:dovisclear") " call Decho("clearing visual mode a:0=".a:0." a:1<".a:1.">") let clearvmode= visualmode(1) endif " set up a list akin to an argument list if a:0 > 0 let A= s:QArgSplitter(a:1) else let A=[0] endif if A[0] > 0 let style = A[1] " Check for bad separator patterns (zero-length matches) " (but zero-length patterns for g/v is ok) if style !~# '[gv]' let ipat= 2 while ipat <= A[0] if "" =~ A[ipat] echoerr "(AlignCtrl) separator<".A[ipat]."> matches zero-length string" call s:RestoreUserOptions() " call Dret("Align#AlignCtrl") return endif let ipat= ipat + 1 endwhile endif endif " call Decho("(AlignCtrl) passed bad-separator pattern check (no zero-length matches)") " call Decho("(AlignCtrl) A[0]=".A[0]) if !exists("s:AlignStyle") let s:AlignStyle= 'l' endif if !exists("s:AlignPrePad") let s:AlignPrePad= 0 endif if !exists("s:AlignPostPad") let s:AlignPostPad= 0 endif if !exists("s:AlignLeadKeep") let s:AlignLeadKeep= 'w' endif if A[0] == 0 " ---------------------- " List current selection " ---------------------- if !exists("s:AlignPatQty") let s:AlignPatQty= 0 endif echo "AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep " call Decho("(AlignCtrl) AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep) if exists("s:AlignGPat") && !exists("s:AlignVPat") echo "AlignGPat<".s:AlignGPat.">" elseif !exists("s:AlignGPat") && exists("s:AlignVPat") echo "AlignVPat<".s:AlignVPat.">" elseif exists("s:AlignGPat") && exists("s:AlignVPat") echo "AlignGPat<".s:AlignGPat."> AlignVPat<".s:AlignVPat.">" endif let ipat= 1 while ipat <= s:AlignPatQty echo "Pat".ipat."<".s:AlignPat_{ipat}.">" " call Decho("(AlignCtrl) Pat".ipat."<".s:AlignPat_{ipat}.">") let ipat= ipat + 1 endwhile else " ---------------------------------- " Process alignment control settings " ---------------------------------- " call Decho("process the alignctrl settings") " call Decho("style<".style.">") if style ==? "default" " Default: preserve initial leading whitespace, left-justified, " alignment on '=', one space padding on both sides if exists("s:AlignCtrlStackQty") " clear AlignCtrl stack while s:AlignCtrlStackQty > 0 call Align#AlignPop() endwhile unlet s:AlignCtrlStackQty endif " Set AlignCtrl to its default value call Align#AlignCtrl("Ilp1P1=<",'=') call Align#AlignCtrl("g") call Align#AlignCtrl("v") let s:dovisclear = 1 call s:RestoreUserOptions() " call Dret("Align#AlignCtrl") return endif if style =~# 'm' " map support: Do an AlignPush now and the next call to Align() " will do an AlignPop at exit " call Decho("style case m: do AlignPush") call Align#AlignPush() let s:DoAlignPop= 1 endif " = : record a list of alignment patterns that are equivalent if style =~# "=" || (A[0] >= 2 && style !~# "C" && s:AlignCtrl =~# '=') " call Decho("style case =: record list of equiv alignment patterns") let s:AlignCtrl = '=' if A[0] >= 2 let s:AlignPatQty= 1 let s:AlignPat_1 = A[2] let ipat = 3 while ipat <= A[0] let s:AlignPat_1 = s:AlignPat_1.'\|'.A[ipat] let ipat = ipat + 1 endwhile let s:AlignPat_1= '\('.s:AlignPat_1.'\)' " call Decho("AlignCtrl<".s:AlignCtrl."> AlignPat<".s:AlignPat_1.">") endif "c : cycle through alignment pattern(s) elseif style =~# 'C' || (A[0] >= 2 && s:AlignCtrl =~# '=') " call Decho("style case C: cycle through alignment pattern(s)") let s:AlignCtrl = 'C' if A[0] >= 2 let s:AlignPatQty= A[0] - 1 let ipat = 1 while ipat < A[0] let s:AlignPat_{ipat}= A[ipat+1] " call Decho("AlignCtrl<".s:AlignCtrl."> AlignQty=".s:AlignPatQty." AlignPat_".ipat."<".s:AlignPat_{ipat}.">") let ipat= ipat + 1 endwhile endif endif if style =~# 'p' let s:AlignPrePad= substitute(style,'^.*p\(\d\+\).*$','\1','') " call Decho("style case p".s:AlignPrePad.": pre-separator padding") if s:AlignPrePad == "" echoerr "(AlignCtrl) 'p' needs to be followed by a numeric argument'" call s:RestoreUserOptions() " call Dret("Align#AlignCtrl") return endif endif if style =~# 'P' let s:AlignPostPad= substitute(style,'^.*P\(\d\+\).*$','\1','') " call Decho("style case P".s:AlignPostPad.": post-separator padding") if s:AlignPostPad == "" echoerr "(AlignCtrl) 'P' needs to be followed by a numeric argument'" call s:RestoreUserOptions() " call Dret("Align#AlignCtrl") return endif endif if style =~# 'w' " call Decho("style case w: ignore leading whitespace") let s:AlignLeadKeep= 'w' elseif style =~# 'W' " call Decho("style case W: keep leading whitespace") let s:AlignLeadKeep= 'W' elseif style =~# 'I' " call Decho("style case I: retain initial leading whitespace") let s:AlignLeadKeep= 'I' endif if style =~# 'g' " first list item is a "g" selector pattern " call Decho("style case g: global selector pattern") if A[0] < 2 if exists("s:AlignVPat") unlet s:AlignVPat " call Decho("unlet s:AlignGPat") endif else let s:AlignGPat= A[2] " call Decho("s:AlignGPat<".s:AlignGPat.">") endif elseif style =~# 'v' " first list item is a "v" selector pattern " call Decho("style case v: global selector anti-pattern") if A[0] < 2 if exists("s:AlignGPat") unlet s:AlignGPat " call Decho("unlet s:AlignVPat") endif else let s:AlignVPat= A[2] " call Decho("s:AlignVPat<".s:AlignVPat.">") endif endif "[-lrc+:] : set up s:AlignStyle if style =~# '[-lrc+:*]' " call Decho("style case [-lrc+:]: field justification") let s:AlignStyle= substitute(style,'[^-lrc:+*]','','g') " call Decho("AlignStyle<".s:AlignStyle.">") endif "[<>|] : set up s:AlignSep if style =~# '[<>|]' " call Decho("style case [-lrc+:]: separator justification") let s:AlignSep= substitute(style,'[^<>|]','','g') " call Decho("AlignSep ".s:AlignSep) endif endif " sanity if !exists("s:AlignCtrl") let s:AlignCtrl= '=' endif " restore options and return call s:RestoreUserOptions() " call Dret("Align#AlignCtrl ".s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle) return s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle endfun " --------------------------------------------------------------------- " s:MakeSpace: returns a string with spacecnt blanks {{{1 fun! s:MakeSpace(spacecnt) " call Dfunc("MakeSpace(spacecnt=".a:spacecnt.")") let str = "" let spacecnt = a:spacecnt while spacecnt > 0 let str = str . " " let spacecnt = spacecnt - 1 endwhile " call Dret("MakeSpace <".str.">") return str endfun " --------------------------------------------------------------------- " Align#Align: align selected text based on alignment pattern(s) {{{1 fun! Align#Align(hasctrl,...) range " call Dfunc("Align#Align(hasctrl=".a:hasctrl.",...) a:0=".a:0) " sanity checks if string(a:hasctrl) != "0" && string(a:hasctrl) != "1" echohl Error|echo 'usage: Align#Align(hasctrl<'.a:hasctrl.'> (should be 0 or 1),"separator(s)" (you have '.a:0.') )'|echohl None " call Dret("Align#Align") return endif if exists("s:AlignStyle") && s:AlignStyle == ":" echohl Error |echo '(Align#Align) your AlignStyle is ":", which implies "do-no-alignment"!'|echohl None " call Dret("Align#Align") return endif " save user options call s:SaveUserOptions() " set up a list akin to an argument list if a:0 > 0 let A= s:QArgSplitter(a:1) else let A=[0] endif " if :Align! was used, then the first argument is (should be!) an AlignCtrl string " Note that any alignment control set this way will be temporary. let hasctrl= a:hasctrl " call Decho("hasctrl=".hasctrl) if a:hasctrl && A[0] >= 1 " call Decho("Align! : using A[1]<".A[1]."> for AlignCtrl") if A[1] =~ '[gv]' let hasctrl= hasctrl + 1 call Align#AlignCtrl('m') call Align#AlignCtrl(A[1],A[2]) " call Decho("Align! : also using A[2]<".A[2]."> for AlignCtrl") elseif A[1] !~ 'm' call Align#AlignCtrl(A[1]."m") else call Align#AlignCtrl(A[1]) endif endif " Check for bad separator patterns (zero-length matches) let ipat= 1 + hasctrl while ipat <= A[0] if "" =~ A[ipat] echoerr "(Align) separator<".A[ipat]."> matches zero-length string" call s:RestoreUserOptions() " call Dret("Align#Align") return endif let ipat= ipat + 1 endwhile " record current search pattern for subsequent restoration " (these are all global-only options) set noic report=10000 nohls if A[0] > hasctrl " Align will accept a list of separator regexps " call Decho("A[0]=".A[0].": accepting list of separator regexp") if s:AlignCtrl =~# "=" "= : consider all separators to be equivalent " call Decho("AlignCtrl: record list of equivalent alignment patterns") let s:AlignCtrl = '=' let s:AlignPat_1 = A[1 + hasctrl] let s:AlignPatQty= 1 let ipat = 2 + hasctrl while ipat <= A[0] let s:AlignPat_1 = s:AlignPat_1.'\|'.A[ipat] let ipat = ipat + 1 endwhile let s:AlignPat_1= '\('.s:AlignPat_1.'\)' " call Decho("AlignCtrl<".s:AlignCtrl."> AlignPat<".s:AlignPat_1.">") elseif s:AlignCtrl =~# 'C' "c : cycle through alignment pattern(s) " call Decho("AlignCtrl: cycle through alignment pattern(s)") let s:AlignCtrl = 'C' let s:AlignPatQty= A[0] - hasctrl let ipat = 1 while ipat <= s:AlignPatQty let s:AlignPat_{ipat}= A[(ipat + hasctrl)] " call Decho("AlignCtrl<".s:AlignCtrl."> AlignQty=".s:AlignPatQty." AlignPat_".ipat."<".s:AlignPat_{ipat}.">") let ipat= ipat + 1 endwhile endif endif " Initialize so that begline " is greater than the line's string length -> ragged right. " Have to be careful about visualmode() -- it returns the last visual " mode used whether or not it was used currently. let begcol = virtcol("'<")-1 let endcol = virtcol("'>")-1 if begcol > endcol let begcol = virtcol("'>")-1 let endcol = virtcol("'<")-1 endif " call Decho("begcol=".begcol." endcol=".endcol) let begline = a:firstline let endline = a:lastline if begline > endline let begline = a:lastline let endline = a:firstline endif " Expand range to cover align-able lines when the given range is only the current line. " Look for the first line above the current line that matches the first separator pattern, and " look for the last line below the current line that matches the first separator pattern. if begline == endline " call Decho("case begline == endline") if !exists("s:AlignPat_{1}") echohl Error|echo "(Align) no separators specified!"|echohl None call s:RestoreUserOptions() " call Dret("Align#Align") return endif let seppat = s:AlignPat_{1} let begline= search('^\%(\%('.seppat.'\)\@!.\)*$',"bnW") if begline == 0|let begline= 1|else|let begline= begline + 1|endif let endline= search('^\%(\%('.seppat.'\)\@!.\)*$',"nW") if endline == 0|let endline= line("$")|else|let endline= endline - 1|endif " call Decho("begline=".begline." endline=".endline." curline#".line(".")) endif " call Decho("begline=".begline." endline=".endline) let fieldcnt = 0 if (begline == line("'>") && endline == line("'<")) || (begline == line("'<") && endline == line("'>")) let vmode= visualmode() " call Decho("vmode=".vmode) if vmode == "\" let ragged = ( col("'>") > s:Strlen(getline("'>")) || col("'<") > s:Strlen(getline("'<")) ) else let ragged= 1 endif else let ragged= 1 endif if ragged let begcol= 0 endif " call Decho("lines[".begline.",".endline."] col[".begcol.",".endcol."] ragged=".ragged." AlignCtrl<".s:AlignCtrl.">") " record initial whitespace if s:AlignLeadKeep == 'W' let wskeep = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')") endif " Align needs these options setl et set paste " convert selected range of lines to use spaces instead of tabs " but if first line's initial white spaces are to be retained " then use 'em if begcol <= 0 && s:AlignLeadKeep == 'I' " retain first leading whitespace for all subsequent lines let bgntxt= substitute(getline(begline),'^\(\s*\).\{-}$','\1','') " exception: retain first leading whitespace predicated on g and v patterns " if such a selected line exists if exists("s:AlignGPat") let firstgline= search(s:AlignGPat,"cnW",endline) if firstgline > 0 let bgntxt= substitute(getline(firstgline),'^\(\s*\).\{-}$','\1','') endif elseif exists("s:AlignVPat") let firstvline= search(s:AlignVPat,"cnW",endline) if firstvline > 0 let bgntxt= substitute('^\%(\%('.getline(firstvline).')\@!\)*$','^\(\s*\).\{-}$','\1','') endif endif " call Decho("retaining 1st leading whitespace: bgntxt<".bgntxt.">") let &l:et= s:keep_et endif exe begline.",".endline."ret" " record transformed to spaces leading whitespace if s:AlignLeadKeep == 'W' let wsblanks = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')") endif " Execute two passes " First pass: collect alignment data (max field sizes) " Second pass: perform alignment let pass= 1 while pass <= 2 " call Decho(" ") " call Decho("---- Pass ".pass.": ----") let curline= begline while curline <= endline " Process each line let txt = getline(curline) " call Decho(" ") " call Decho("Pass".pass.": Line ".curline." <".txt.">") " AlignGPat support: allows a selector pattern (akin to g/selector/cmd ) if exists("s:AlignGPat") " call Decho("Pass".pass.": AlignGPat<".s:AlignGPat.">") if match(txt,s:AlignGPat) == -1 " call Decho("Pass".pass.": skipping") let curline= curline + 1 continue endif endif " AlignVPat support: allows a selector pattern (akin to v/selector/cmd ) if exists("s:AlignVPat") " call Decho("Pass".pass.": AlignVPat<".s:AlignVPat.">") if match(txt,s:AlignVPat) != -1 " call Decho("Pass".pass.": skipping") let curline= curline + 1 continue endif endif " Always skip blank lines if match(txt,'^\s*$') != -1 " call Decho("Pass".pass.": skipping") let curline= curline + 1 continue endif " Extract visual-block selected text (init bgntxt, endtxt) let txtlen= s:Strlen(txt) if begcol > 0 " Record text to left of selected area let bgntxt= strpart(txt,0,begcol) " call Decho("Pass".pass.": record text to left: bgntxt<".bgntxt.">") elseif s:AlignLeadKeep == 'W' let bgntxt= substitute(txt,'^\(\s*\).\{-}$','\1','') " call Decho("Pass".pass.": retaining all leading ws: bgntxt<".bgntxt.">") elseif s:AlignLeadKeep == 'w' || !exists("bgntxt") " No beginning text let bgntxt= "" " call Decho("Pass".pass.": no beginning text") endif if ragged let endtxt= "" else " Elide any text lying outside selected columnar region let endtxt= strpart(txt,endcol+1,txtlen-endcol) let txt = strpart(txt,begcol,endcol-begcol+1) endif " call Decho(" ") " call Decho("Pass".pass.": bgntxt<".bgntxt.">") " call Decho("Pass".pass.": txt<". txt .">") " call Decho("Pass".pass.": endtxt<".endtxt.">") if !exists("s:AlignPat_{1}") echohl Error|echo "(Align) no separators specified!"|echohl None call s:RestoreUserOptions() " call Dret("Align#Align") return endif " Initialize for both passes let seppat = s:AlignPat_{1} let ifield = 1 let ipat = 1 let bgnfield = 0 let endfield = 0 let alignstyle = s:AlignStyle let doend = 1 let newtxt = "" let alignprepad = s:AlignPrePad let alignpostpad= s:AlignPostPad let alignsep = s:AlignSep let alignophold = " " let alignop = 'l' " call Decho("Pass".pass.": initial alignstyle<".alignstyle."> seppat<".seppat.">") " Process each field on the line while doend > 0 " C-style: cycle through pattern(s) if s:AlignCtrl == 'C' && doend == 1 let seppat = s:AlignPat_{ipat} " call Decho("Pass".pass.": processing field: AlignCtrl=".s:AlignCtrl." ipat=".ipat." seppat<".seppat.">") let ipat = ipat + 1 if ipat > s:AlignPatQty let ipat = 1 endif endif " cyclic alignment/justification operator handling let alignophold = alignop let alignop = strpart(alignstyle,0,1) if alignop == '+' || doend == 2 let alignop= alignophold else let alignstyle = strpart(alignstyle,1).strpart(alignstyle,0,1) let alignopnxt = strpart(alignstyle,0,1) if alignop == ':' let seppat = '$' let doend = 2 " call Decho("Pass".pass.": alignop<:> case: setting seppat<$> doend==2") endif endif " cyclic separator alignment specification handling let alignsepop= strpart(alignsep,0,1) let alignsep = strpart(alignsep,1).alignsepop " ------------------------------------------------------ " mark end-of-field and the subsequent end-of-separator. " ------------------------------------------------------ let endfield = match(txt,seppat,bgnfield) let sepfield = matchend(txt,seppat,bgnfield) let skipfield= sepfield " call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop) " Mark eof: Extend field if alignop is '*' and AlignSkip() is true. if alignop == '*' && exists("g:AlignSkip") && type(g:AlignSkip) == 2 " call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop) " a '*' acts like a '-' while the g:AlignSkip function reference is true except that alignop doesn't advance while g:AlignSkip(curline,endfield) && endfield != -1 let endfield = match(txt,seppat,skipfield) let sepfield = matchend(txt,seppat,skipfield) let skipfield = sepfield " call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">") endwhile let alignop = strpart(alignstyle,0,1) let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1) " call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop." (after *)") endif " Mark eof: Extend field if alignop is '-' while alignop == '-' && endfield != -1 let endfield = match(txt,seppat,skipfield) let sepfield = matchend(txt,seppat,skipfield) let skipfield = sepfield let alignop = strpart(alignstyle,0,1) let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1) " call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">") endwhile let seplen= sepfield - endfield " call Decho("Pass".pass.": seplen=[sepfield=".sepfield."] - [endfield=".endfield."]=".seplen) if endfield != -1 if pass == 1 " --------------------------------------------------------------------- " Pass 1: Update FieldSize to max " call Decho("Pass".pass.": before lead/trail remove: field<".strpart(txt,bgnfield,endfield-bgnfield).">") let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\1','') if s:AlignLeadKeep == 'W' let field = bgntxt.field let bgntxt= "" endif let fieldlen= s:Strlen(field) if !exists("FieldSize_{ifield}") let FieldSize_{ifield}= fieldlen " call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (init)") elseif fieldlen > FieldSize_{ifield} let FieldSize_{ifield}= fieldlen " call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (fieldlen>FieldSize_".ifield.")") endif if !exists("SepSize_{ifield}") let SepSize_{ifield}= seplen " call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (init)") elseif seplen > SepSize_{ifield} let SepSize_{ifield}= seplen " call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (seplen>SepSize_".ifield.")") endif else " --------------------------------------------------------------------- " Pass 2: Perform Alignment let prepad = strpart(alignprepad,0,1) let postpad = strpart(alignpostpad,0,1) let alignprepad = strpart(alignprepad,1).strpart(alignprepad,0,1) let alignpostpad = strpart(alignpostpad,1).strpart(alignpostpad,0,1) let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\1','') " call Decho("Pass".pass.": alignprepad <".alignprepad."> prepad =".prepad) " call Decho("Pass".pass.": alignpostpad<".alignpostpad."> postpad=".postpad) if s:AlignLeadKeep == 'W' let field = bgntxt.field let bgntxt= "" endif if doend == 2 let prepad = 0 let postpad= 0 endif let fieldlen = s:Strlen(field) let sep = s:MakeSpace(prepad).strpart(txt,endfield,sepfield-endfield).s:MakeSpace(postpad) " call Decho("Pass".pass.": sep<".sep."> (after prepad, sepfield-endfield,postpad)") if seplen < SepSize_{ifield} if alignsepop == "<" " left-justify separators let sep = sep.s:MakeSpace(SepSize_{ifield}-seplen) " call Decho("Pass".pass.": sep<".sep."> (left-justified)") elseif alignsepop == ">" " right-justify separators let sep = s:MakeSpace(SepSize_{ifield}-seplen).sep " call Decho("Pass".pass.": sep<".sep."> (right-justified)") else " center-justify separators let sepleft = (SepSize_{ifield} - seplen)/2 let sepright = SepSize_{ifield} - seplen - sepleft let sep = s:MakeSpace(sepleft).sep.s:MakeSpace(sepright) " call Decho("Pass".pass.": sep<".sep."> (center-justified)") endif endif let spaces = FieldSize_{ifield} - fieldlen " call Decho("Pass".pass.": spaces=[FieldSize_".ifield."=".FieldSize_{ifield}."] - [fieldlen=".fieldlen."]=".spaces) " call Decho("Pass".pass.": Field #".ifield."<".field."> spaces=".spaces." be[".bgnfield.",".endfield."] pad=".prepad.','.postpad." FS_".ifield."<".FieldSize_{ifield}."> sep<".sep."> ragged=".ragged." doend=".doend." alignop<".alignop.">") " Perform alignment according to alignment style justification if spaces > 0 if alignop == 'c' " center the field let spaceleft = spaces/2 let spaceright= FieldSize_{ifield} - spaceleft - fieldlen let newtxt = newtxt.s:MakeSpace(spaceleft).field.s:MakeSpace(spaceright).sep elseif alignop == 'r' " right justify the field let newtxt= newtxt.s:MakeSpace(spaces).field.sep elseif ragged && doend == 2 " left justify rightmost field (no trailing blanks needed) let newtxt= newtxt.field else " left justfiy the field let newtxt= newtxt.field.s:MakeSpace(spaces).sep endif elseif ragged && doend == 2 " field at maximum field size and no trailing blanks needed let newtxt= newtxt.field else " field is at maximum field size already let newtxt= newtxt.field.sep endif " call Decho("Pass".pass.": newtxt<".newtxt.">") endif " pass 1/2 " bgnfield indexes to end of separator at right of current field " Update field counter let bgnfield= sepfield let ifield = ifield + 1 if doend == 2 let doend= 0 endif " handle end-of-text as end-of-field elseif doend == 1 let seppat = '$' let doend = 2 else let doend = 0 endif " endfield != -1 endwhile " doend loop (as well as regularly separated fields) if pass == 2 " Write altered line to buffer " call Decho("Pass".pass.": bgntxt<".bgntxt."> curline=".curline) " call Decho("Pass".pass.": newtxt<".newtxt.">") " call Decho("Pass".pass.": endtxt<".endtxt.">") keepj call setline(curline,bgntxt.newtxt.endtxt) endif " call Decho("Pass".pass.": line#".curline."<".getline(".")."> (end-of-while)") let curline = curline + 1 endwhile " curline loop let pass= pass + 1 endwhile " pass loop " call Decho("end of two pass loop") " call Decho("ENDWHILE: cursor at (".line(".").",".col(".").") curline#".curline) " restore original leading whitespace if s:AlignLeadKeep == 'W' let iline= begline let i = 0 " call Decho("restore original leading whitespace") while iline <= endline " call Decho("exe ".iline."s/^".wsblanks[i]."/".wskeep[i]."/") exe "keepj ".iline."s/^".wsblanks[i]."/".wskeep[i]."/" let iline= iline + 1 let i = i + 1 endwhile endif if exists("s:DoAlignPop") " AlignCtrl Map support call Align#AlignPop() unlet s:DoAlignPop endif " restore user options and return call s:RestoreUserOptions() " call Dret("Align#Align") return endfun " --------------------------------------------------------------------- " Align#AlignPush: this command/function pushes an alignment control string onto a stack {{{1 fun! Align#AlignPush() " call Dfunc("Align#AlignPush()") " initialize the stack if !exists("s:AlignCtrlStackQty") let s:AlignCtrlStackQty= 1 else let s:AlignCtrlStackQty= s:AlignCtrlStackQty + 1 endif " construct an AlignCtrlStack entry if !exists("s:AlignSep") let s:AlignSep= '' endif let s:AlignCtrlStack_{s:AlignCtrlStackQty}= s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle.s:AlignSep " call Decho("AlignPush: AlignCtrlStack_".s:AlignCtrlStackQty."<".s:AlignCtrlStack_{s:AlignCtrlStackQty}.">") " push [GV] patterns onto their own stack if exists("s:AlignGPat") let s:AlignGPat_{s:AlignCtrlStackQty}= s:AlignGPat else let s:AlignGPat_{s:AlignCtrlStackQty}= "" endif if exists("s:AlignVPat") let s:AlignVPat_{s:AlignCtrlStackQty}= s:AlignVPat else let s:AlignVPat_{s:AlignCtrlStackQty}= "" endif " call Dret("Align#AlignPush") endfun " --------------------------------------------------------------------- " Align#AlignPop: this command/function pops an alignment pattern from a stack {{{1 " and into the AlignCtrl variables. fun! Align#AlignPop() " call Dfunc("Align#AlignPop()") " sanity checks if !exists("s:AlignCtrlStackQty") echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop" " call Dret("Align#AlignPop <> : AlignPush needs to have been called first") return "" endif if s:AlignCtrlStackQty <= 0 unlet s:AlignCtrlStackQty echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop" " call Dret("Align#AlignPop <> : AlignPop needs to have been called first") return "" endif " pop top of AlignCtrlStack and pass value to AlignCtrl let retval=s:AlignCtrlStack_{s:AlignCtrlStackQty} unlet s:AlignCtrlStack_{s:AlignCtrlStackQty} call Align#AlignCtrl(retval) " pop G pattern stack if s:AlignGPat_{s:AlignCtrlStackQty} != "" call Align#AlignCtrl('g',s:AlignGPat_{s:AlignCtrlStackQty}) else call Align#AlignCtrl('g') endif unlet s:AlignGPat_{s:AlignCtrlStackQty} " pop V pattern stack if s:AlignVPat_{s:AlignCtrlStackQty} != "" call Align#AlignCtrl('v',s:AlignVPat_{s:AlignCtrlStackQty}) else call Align#AlignCtrl('v') endif unlet s:AlignVPat_{s:AlignCtrlStackQty} let s:AlignCtrlStackQty= s:AlignCtrlStackQty - 1 " call Dret("Align#AlignPop <".retval."> : AlignCtrlStackQty=".s:AlignCtrlStackQty) return retval endfun " --------------------------------------------------------------------- " Align#AlignReplaceQuotedSpaces: {{{1 fun! Align#AlignReplaceQuotedSpaces() " call Dfunc("Align#AlignReplaceQuotedSpaces()") let l:line = getline(line(".")) let l:linelen = s:Strlen(l:line) let l:startingPos = 0 let l:startQuotePos = 0 let l:endQuotePos = 0 let l:spacePos = 0 let l:quoteRe = '\\\@, is needed. {{{1 " However, doesn't split at all, so this function returns a list " of arguments which has been: " * split at whitespace " * unless inside "..."s. One may escape characters with a backslash inside double quotes. " along with a leading length-of-list. " " Examples: %Align "\"" will align on "s " %Align " " will align on spaces " " The resulting list: qarglist[0] corresponds to a:0 " qarglist[i] corresponds to a:{i} fun! s:QArgSplitter(qarg) " call Dfunc("s:QArgSplitter(qarg<".a:qarg.">)") if a:qarg =~ '".*"' " handle "..." args, which may include whitespace let qarglist = [] let args = a:qarg " call Decho("handle quoted arguments: args<".args.">") while args != "" let iarg = 0 let arglen = strlen(args) " call Decho(".args[".iarg."]<".args[iarg]."> arglen=".arglen) " find index to first not-escaped '"' " call Decho("find index to first not-escaped \"") while args[iarg] != '"' && iarg < arglen if args[iarg] == '\' let args= strpart(args,1) endif let iarg= iarg + 1 endwhile " call Decho(".args<".args."> iarg=".iarg." arglen=".arglen) if iarg > 0 " handle left of quote or remaining section " call Decho(".handle left of quote or remaining section") if args[iarg] == '"' let qarglist= qarglist + split(strpart(args,0,iarg-1)) else let qarglist= qarglist + split(strpart(args,0,iarg)) endif let args = strpart(args,iarg) let arglen = strlen(args) elseif iarg < arglen && args[0] == '"' " handle "quoted" section " call Decho(".handle quoted section") let iarg= 1 while args[iarg] != '"' && iarg < arglen if args[iarg] == '\' let args= strpart(args,1) endif let iarg= iarg + 1 endwhile " call Decho(".args<".args."> iarg=".iarg." arglen=".arglen) if args[iarg] == '"' call add(qarglist,strpart(args,1,iarg-1)) let args= strpart(args,iarg+1) else let qarglist = qarglist + split(args) let args = "" endif endif " call Decho(".qarglist".string(qarglist)." iarg=".iarg." args<".args.">") endwhile " call Decho("end of loop (handling quoted arguments)") else " split at all whitespace " call Decho("split at all whitespace") let qarglist= split(a:qarg,"[ \t]") endif let qarglistlen= len(qarglist) let qarglist = insert(qarglist,qarglistlen) " call Dret("s:QArgSplitter ".string(qarglist)) return qarglist endfun " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its {{{1 " using two-byte etc characters. " Currently, its only used if g:Align_xstrlen is set to a " nonzero value. Solution from Nicolai Weibull, vim docs " (:help strlen()), Tony Mechelynck, and my own invention. fun! s:Strlen(x) " call Dfunc("s:Strlen(x<".a:x."> g:Align_xstrlen=".g:Align_xstrlen) if type(g:Align_xstrlen) == 1 " allow user to specify a function to compute the string length exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" elseif g:Align_xstrlen == 1 " number of codepoints (Latin a + combining circumflex is two codepoints) " (comment from TM, solution from NW) let ret= strlen(substitute(a:x,'.','c','g')) elseif g:Align_xstrlen == 2 " number of spacing codepoints (Latin a + combining circumflex is one spacing " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) " (comment from TM, solution from TM) let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) elseif g:Align_xstrlen == 3 " virtual length (counting, for instance, tabs as anything between 1 and " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately " preceded by lam, one otherwise, etc.) " (comment from TM, solution from me) let modkeep= &l:mod exe "norm! o\" call setline(line("."),a:x) let ret= virtcol("$") - 1 d keepj norm! k let &l:mod= modkeep else " at least give a decent default if v:version >= 703 let ret= strdisplaywidth(a:x) else let ret= strlen(a:x) endif endif " call Dret("s:Strlen ".ret) return ret endfun " --------------------------------------------------------------------- " s:SaveUserOptions: {{{1 fun! s:SaveUserOptions() " call Dfunc("s:SaveUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) if !exists("s:saved_user_options") let s:saved_user_options = 1 let s:keep_search = @/ let s:keep_et = &l:et let s:keep_hls = &hls let s:keep_ic = &ic let s:keep_paste = &paste let s:keep_report = &report else let s:saved_user_options = s:saved_user_options + 1 endif " call Dret("s:SaveUserOptions : s:saved_user_options=".s:saved_user_options) endfun " --------------------------------------------------------------------- " s:RestoreUserOptions: {{{1 fun! s:RestoreUserOptions() " call Dfunc("s:RestoreUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) if exists("s:saved_user_options") && s:saved_user_options == 1 let @/ = s:keep_search let &l:et = s:keep_et let &hls = s:keep_hls let &ic = s:keep_ic let &paste = s:keep_paste let &report = s:keep_report unlet s:keep_search unlet s:keep_et unlet s:keep_hls unlet s:keep_ic unlet s:keep_paste unlet s:keep_report unlet s:saved_user_options elseif exists("s:saved_user_options") let s:saved_user_options= s:saved_user_options - 1 endif " call Dret("s:RestoreUserOptions : s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) endfun " --------------------------------------------------------------------- " Set up default values: {{{1 "call Decho("-- Begin AlignCtrl Initialization --") call Align#AlignCtrl("default") "call Decho("-- End AlignCtrl Initialization --") " --------------------------------------------------------------------- " Restore: {{{1 let &cpo= s:keepcpo unlet s:keepcpo " vim: ts=4 fdm=marker vim-scripts-20130814ubuntu1/autoload/deb.vim0000644000000000000000000001606512204336073015537 0ustar " Vim autoload file for browsing debian package. " copyright (C) 2007-2008, arno renevier " Distributed under the GNU General Public License (version 2 or above) " Last Change: 2008 april 1 " " Inspired by autoload/tar.vim by Charles E Campbell " " Latest version of that file can be found at " http://www.fdn.fr/~arenevier/vim/autoload/deb.vim " It should also be available at " http://www.vim.org/scripts/script.php?script_id=1970 if &cp || exists("g:loaded_deb") || v:version < 700 finish endif let g:loaded_deb= "v1.4" fun! deb#read(debfile, member) " checks if ar and tar are installed if !s:hascmd("ar") || !s:hascmd("tar") return endif let l:target = a:member let l:archmember = s:dataFileName(a:debfile) " default archive member to extract if l:archmember == "" echohl WarningMsg | echo "***error*** (deb#read) no valid data file found in debian archive" return elseif l:archmember == "data.tar.gz" let l:unpcmp = "tar zxfO " elseif l:archmember == "data.tar.bz2" let l:unpcmp = "tar jxfO " elseif l:archmember == "data.tar.lzma" if !s:hascmd("lzma") return endif let l:unpcmp = "lzma -d | tar xfO " elseif l:archmember == "data.tar" let l:unpcmp = "tar xfO " endif if a:member =~ '^\* ' " information control file let l:archmember = "control.tar.gz" let l:target = substitute(l:target, "^\* ", "", "") let l:unpcmp = "tar zxfO " elseif a:member =~ ' -> ' " symbolic link let l:target = split(a:member,' -> ')[0] let l:linkname = split(a:member,' -> ')[1] if l:linkname =~ "^\/" " direct symlink: path is already absolute let l:target = ".".l:linkname else " transform relative path to absolute path " first, get basename for target let l:target = substitute(l:target, "\/[^/]*$", "", "") " while it begins with ../ while l:linkname =~ "^\.\.\/" " removes one level of ../ in linkname let l:linkname = substitute(l:linkname, "^\.\.\/", "", "") " go one directory up in target let l:target = substitute(l:target, "\/[^/]*$", "", "") endwhile let l:target = l:target."/".l:linkname endif endif " we may preprocess some files (such as man pages, or changelogs) let l:preproccmd = "" " " unzip man pages " if l:target =~ "\.\/usr\/share\/man\/.*\.gz$" " try to fail gracefully if a command is not available if !s:hascmd("gzip") return elseif !s:hascmd("nroff") let l:preproccmd = "| gzip -cd" elseif !s:hascmd("col") let l:preproccmd = "| gzip -cd | nroff -mandoc" else let l:preproccmd = "| gzip -cd | nroff -mandoc | col -b" endif " " unzip other .gz files " elseif l:target =~ '.*\.gz$' if !s:hascmd("gzip") return endif let l:preproccmd = "| gzip -cd" endif " read content exe "silent r! ar p " . s:QuoteFile(a:debfile) . " " . s:QuoteFile(l:archmember) . " | " . l:unpcmp . " - " . s:QuoteFile(l:target) . l:preproccmd " error will be treated in calling function if v:shell_error != 0 return endif exe "file deb:".l:target 0d setlocal nomodifiable nomodified readonly endfun fun! deb#browse(file) " checks if necessary utils are installed if !s:hascmd("dpkg") || !s:hascmd("ar") || !s:hascmd("tar") return endif " checks if file is readable if !filereadable(a:file) return endif if a:file =~ "'" echohl WarningMsg | echo "***error*** (deb#Browse) filename cannot contain quote character (" . a:file . ")" return endif let keepmagic = &magic set magic " set filetype to "deb" set ft=deb setlocal modifiable noreadonly " set header exe "$put ='".'\"'." deb.vim version ".g:loaded_deb."'" exe "$put ='".'\"'." Browsing debian package ".a:file."'" $put='' " package info "exe "silent read! dpkg -I ".a:file "$put='' " display information control files let l:infopos = line(".") exe "silent read! ar p " . s:QuoteFile(a:file) . " control.tar.gz | tar zt" $put='' " display data files let l:listpos = line(".") exe "silent read! dpkg -c ". s:QuoteFile(a:file) " format information control list " removes '* ./' line exe (l:infopos + 1). 'd' " add a star before each line exe "silent " . (l:infopos + 1). ',' . (l:listpos - 2) . 's/^/\* /' " format data list exe "silent " . l:listpos . ',$s/^.*\s\(\.\/\(\S\|\).*\)$/\1/' if v:shell_error != 0 echohl WarningMsg | echo "***warning*** (deb#Browse) error when listing content of " . a:file let &magic = keepmagic return endif 0d setlocal nomodifiable readonly noremap :call DebBrowseSelect() let &magic = keepmagic endfun fun! s:DebBrowseSelect() let l:fname= getline(".") " sanity check if (l:fname !~ '^\.\/') && (l:fname !~ '^\* \.\/') return endif if l:fname =~ "'" echohl WarningMsg | echo "***error*** (DebBrowseSelect) filename cannot contain quote character (" . l:fname . ")" return endif " do nothing on directories " TODO: find a way to detect symlinks to directories, to be able not to " open them if (l:fname =~ '\/$') return endif " need to get it now since a new window will open let l:curfile= expand("%") " open new window new wincmd _ call deb#read(l:curfile, l:fname) if v:shell_error != 0 echohl WarningMsg | echo "***warning*** (DebBrowseSelect) error when reading " . l:fname return endif filetype detect " zipped files, are unziped in deb#read, but filetype may not " automatically work. if l:fname =~ "\.\/usr\/share\/man\/.*\.gz$" set filetype=man elseif l:fname =~ "\.\/usr\/share\/doc\/.*\/changelog.Debian.gz$" set filetype=debchangelog endif endfun " return data file name for debian package. This can be either data.tar.gz, " data.tar.bz2 or data.tar.lzma fun s:dataFileName(deb) for fn in ["data.tar.gz", "data.tar.bz2", "data.tar.lzma", "data.tar"] " [0:-2] is to remove trailing null character from command output if (system("ar t " . "'" . a:deb . "'" . " " . fn))[0:-2] == fn return fn endif endfor return "" " no debian data format in this archive endfun fun s:QuoteFile(file) " we need to escape %, #, <, and > " see :help cmdline-specialk return "'" . substitute(a:file, '\([%#<>]\)', '\\\1', 'g') . "'" endfun " return 1 if cmd exists " display error message and return 0 otherwise fun s:hascmd(cmd) if executable(a:cmd) return 1 else echohl Error | echo "***error*** " . a:cmd . " not available on your system" return 0 else endfu vim-scripts-20130814ubuntu1/plugin/0000755000000000000000000000000012204336114013742 5ustar vim-scripts-20130814ubuntu1/plugin/tetris.vim0000644000000000000000000001773512204336073016012 0ustar " Name: Tetris (game) " Version: 0.52fix " News: norm -> norm! (no remapping) " Maintainer, main author: Gergely Kontra " Co-autors, helpers: " Michael Geddes v0.4, color, Plugin support, code optimizing " Peter ??? raindog Timing help, bug reports " Dan Sharp Bug reports, improvements " If your name is not here, but should be, drop me a mail " TODO FocusGained FocusLost Auto calibration during play let s:s='-Tetris_game-' let s:WIDTH=10|let s:NEXTXPOS=16|let s:NEXTYPOS=2 let s:CLEAR=0|let s:CHECK=1|let s:DRAW=2 let s:shs=7|let s:cols=7 fu! s:Put(l,c,pos,m) let sh00=0x0f00|let sh01=0x2222|let sh02=0x0f00|let sh03=0x2222 let sh10=0x0660|let sh11=0x0660|let sh12=0x0660|let sh13=0x0040 "cheat let sh20=0x0644|let sh21=0x0e20|let sh22=0x2260|let sh23=0x0470 let sh30=0x0740|let sh31=0x0622|let sh32=0x02e0|let sh33=0x4460 let sh40=0x4620|let sh41=0x0360|let sh42=0x4620|let sh43=0x0360 let sh50=0x2640|let sh51=0x0630|let sh52=0x2640|let sh53=0x0630 let sh60=0x0720|let sh61=0x2620|let sh62=0x2700|let sh63=0x2320 let sgn0='[]'|let sgn1='MM'|let sgn2='{}'|let sgn3='XX'|let sgn4='@@'|let sgn5='<>'|let sgn6='$$' exe 'norm! '.a:l.'G'.(a:c*2+1)."|a\" let c=1|let r=1 let s=(a:c!=s:NEXTXPOS)?(sh{b:sh}{a:pos}):(sh{b:nsh}{a:pos}) wh r<5 if s%2 if a:m==s:DRAW exe "norm! R".sgn{a:c!=s:NEXTXPOS?(b:col):(b:ncol)}."\l" elsei a:m==s:CHECK let ch=getline('.')[col('.')-1] if (b:col4 let c=1 norm! 8hj let r=r+1 en let s=s/2 endw norm! ggr# retu 1 endf let s:i=24|let s:r=''|wh s:i|let s:r=s:r."\"|let s:i=s:i-1|endw fu! s:Cnt(i) let m=search('^ ##[^#.]\{'.2*s:WIDTH.'}##') if !m|retu|en wh m>1 exe 'norm!' m.'GR'.s:r."\" let m=m-1 endw match Wall /\./ redr sl 150m match none redr sl 150m exe "norm! 9G".a:i."\" let l=getline(9) let s:score=0+strpart(l,match(l,'[1-9]')) if s:score>=s:nxLevel if s:nxLevel==10 && exists('s:starttime') exe 'redir >>' s:top10.'_stat' echo 'CNT='.s:CNT.' CNT2='.s:CNT2.' '.(localtime()-s:starttime) ' sec ' s:TICKS ' ticks' redir END en let s:DTIME=s:DTIME*7/8 let s:COUNTER=(s:CNT*s:DTIME)/1000 let s:nxLevel=s:nxLevel+10 en cal s:Cnt(a:i*2) endf fu! s:Resume() exe bufwinnr(bufnr(s:s)).'winc w' res 21 setl ma se gcr=a:hor1-blinkon0 ve=all se noea endf fun! s:Pause() let &gcr=s:gcr let &ve=s:ve setl noma let &ea=s:wa exe bufwinnr(s:ow).'winc w' retu 1 endf fu! s:Sort() wh line('.')>1&&matchstr(getline(line('.')-1),'\d\+$'):p:h').'/.tetris') let s:top10f=escape(s:top10,'\%#') fu! s:End() exe 'redir >>' s:top10.'_stat' echo|let i=0|wh i<7|echon 'Sh'.i.' '.s:sh{i}.' '|let i=i+1|endw|echo redir END norm! 22GdG let &gcr=s:gcr let &ea=s:wa se nolz exe 'vsp' s:top10f if line('$')<10 || matchstr(getline('$'),'\d\+$')" sil! cal s:Sort() sil w el let s:pos=0 en 1|setl bh=delete|vert res 43|noh exe 'match Search /.*\%'.s:pos.'l.*/' echo | echo redr|echon 'Press a key to quit game'|cal getchar()|q let i=21|wh i|del|sl 40ms|let i=i-1|redr|endw|bd let &ve=s:ve let &lz=s:lz endf fu! s:Init() let s:nxLevel=10 let s:ow=bufnr('%') let s:score=0 exe 'sp '.escape(s:s,' ').'|set ma|1,$d' let b:col=0 let b:ncol=localtime()%(s:cols) let b:nsh=0 let b:sh=0 let b:pos=0 let b:x=6 let b:y=20 let s:starttime=localtime() let s:TICKS=0 let s:gcr=&gcr let s:wa=&ea let s:ve=&ve let s:lz=&lz let i=0|wh i<7|let s:sh{i}=0|let i=i+1|endw se ve=all setl bh=delete noswf bt=nofile nf= gcr=a:hor1-blinkon0 nolz exe "norm!i ##\".s:WIDTH."a..\2a#\yy19pGo0\ #\".(2*s:WIDTH+4-1)."a#\yy3pgg" hi Bg term=reverse ctermfg=Black ctermbg=Black guifg=Black guibg=Black syn match Bg "\." hi Wall term=reverse ctermfg=DarkBlue ctermbg=DarkBlue guifg=DarkBlue guibg=DarkBlue syn match Wall "#" hi Shape0 ctermfg=DarkGrey ctermbg=DarkGrey guifg=DarkGrey guibg=DarkGrey syn match Shape0 "[[\]]" hi Shape1 term=reverse ctermfg=LightGreen ctermfg=LightGreen guifg=LightGreen guibg=LightGreen syn match Shape1 "MM" hi Shape2 term=reverse ctermfg=LightBlue ctermbg=LightBlue guifg=LightBlue guibg=LightBlue syn match Shape2 "{}" hi Red term=reverse ctermfg=LightRed ctermbg=LightRed guifg=LightRed guibg=LightRed syn match Red "XX" hi Shape4 term=reverse ctermfg=DarkYellow ctermbg=DarkYellow guifg=DarkYellow guibg=DarkYellow syn match Shape4 "@@" hi Shape5 term=reverse ctermfg=DarkMagenta ctermbg=DarkMagenta guifg=DarkMagenta guibg=DarkMagenta syn match Shape5 "<>" hi Shape6 term=reverse ctermfg=DarkCyan ctermbg=DarkCyan guifg=DarkCyan guibg=DarkCyan syn match Shape6 "$\$" let n="\9hji" let v="##########".n let f="#........#".n exe "norm! 21\_50\|" exe "norm! 1G32\i".v.f.f.f.f.v."\8G32\iScore:\j2h6i0\" exe "norm! jj32\iKeys:\bjih,l: Left, Right\2Fhjij,k: Down, Rotate\" exe "norm! Fjji' ': Drop\2F'ji+,=: Speed up" exe "norm! 2F+jiq,q: Pause, Quit\" if !exists('s:CNT') let s:CNT=0 echon '' | echon 'Patience! Calibrating delay...' let t0=localtime() let t1=t0|wh t1==t0|let t1=localtime()|endw let t0=t1|wh t1==t0|let t0=localtime()|cal s:Loop('h')|let s:CNT=s:CNT+1|endw let t0=localtime() let t1=t0|wh t1==t0|let t1=localtime()|endw let one=1|let s:CNT2=0|let t0=t1 wh t1==t0 let s:CNT2=s:CNT2+1|let t0=localtime()|exe 'sleep' one.'m' endw let s:DELAY=(1000/s:CNT)-((1000-s:CNT2)/s:CNT2) let s:DELAY2=0 if s:DELAY<0 echo 'Hmmm. Loop execution needs more time, than exe "sleep" one."m"' let s:DELAY2=-s:DELAY let s:DELAY=1 let s=s:CNT let s:CNT=s:CNT2 let s:CNT2=s en en let s:DTIME=300 let s:COUNTER=(s:CNT*s:DTIME)/1000 echon 'Delay:'.s:DELAY.' Counter: '.s:COUNTER if !exists('s:name') || s:name=='' let s:name=strpart(inputdialog("What's your name?\nIt will be used in the top10 list"),0,30) en let s:mode=confirm('Game mode',"Traditional\nRotating")-1 endf fu! s:Loop(c) let c=a:c cal s:Put(b:y,b:x,b:pos,s:CLEAR) if c=~ '[hjikl]' let nx=b:x+((c=='h')?-1:((c=='l')?1:0)) let ny=b:y+((c=='j')?1:0) let npos=(c!~'[ik]')?(b:pos):(c=='i'?((b:pos+1)%4):((b:pos+3)%4)) if s:Put(ny,nx,npos,s:CHECK) let b:x=nx let b:y=ny let b:pos=npos endif elsei c==' ' wh s:Put(b:y+1,b:x,b:pos,s:CHECK) let b:y=b:y+1 endw elsei c=="\" || c=='q' cal s:End() retu 2 elsei c=~'[+=]' let s:COUNTER=s:COUNTER-1 en cal s:Put(b:y,b:x,b:pos,s:DRAW) redr if c=='p'|retu s:Pause()|en retu 0 endf fu! s:Main() if !buflisted(s:s) cal s:Init() el let s:ow=bufnr('%') if bufwinnr(bufnr(s:s))==-1 new|exe 'b' bufnr(s:s) en cal s:Resume() unlet s:starttime en setl ma let CURRXPOS=6 | let CURRYPOS=1 wh 1 wh 1 let s:TICKS=s:TICKS+1|let cnt=s:COUNTER wh cnt let cnt=cnt-1 let c=getchar(0) if c let c=nr2char(c)|let r=s:Loop(c) if r|retu r|en if s:DELAY2 exe 'sl' s:DELAY2.'m' en el exe 'sl '.s:DELAY.'m' en endw "timeout cal s:Put(b:y,b:x,b:pos,s:CLEAR) " try to move down if !s:Put(b:y+1,b:x,b:pos,s:CHECK) cal s:Put(b:y,b:x,b:pos,s:DRAW)|brea en let b:y=b:y+1|cal s:Put(b:y,b:x,b:pos,s:DRAW)|redr endw cal s:Cnt(1) if s:mode exe "norm!1G7|\19j2ld18lP" en cal s:Put(s:NEXTYPOS,s:NEXTXPOS,0,s:CLEAR) let b:sh=b:nsh|let b:col=b:ncol let b:nsh=(localtime()+8*b:sh)%s:shs let s:sh{b:nsh}=s:sh{b:nsh}+1 let b:ncol=(b:ncol+1)%(s:cols) let b:pos=0 cal s:Put(s:NEXTYPOS,s:NEXTXPOS,0,s:DRAW) let b:x=CURRXPOS|let b:y=CURRYPOS if !s:Put(b:y,b:x,b:pos,s:CHECK) cal s:End() retu 0 en cal s:Put(b:y,b:x,b:pos,s:DRAW) redr endw endf nmap te :cal Main() " vi:sw=1 vim-scripts-20130814ubuntu1/plugin/a.vim0000644000000000000000000007530012204336073014710 0ustar " Copyright (c) 1998-2006 " Michael Sharpe " " We grant permission to use, copy modify, distribute, and sell this " software for any purpose without fee, provided that the above copyright " notice and this text are not removed. We make no guarantee about the " suitability of this software for any purpose and we are not liable " for any damages resulting from its use. Further, we are under no " obligation to maintain or extend this software. It is provided on an " "as is" basis without any expressed or implied warranty. " Directory & regex enhancements added by Bindu Wavell who is well known on " vim.sf.net " " Patch for spaces in files/directories from Nathan Stien (also reported by " Soeren Sonnenburg) " Do not load a.vim if is has already been loaded. if exists("loaded_alternateFile") finish endif if (v:progname == "ex") finish endif let loaded_alternateFile = 1 let alternateExtensionsDict = {} " setup the default set of alternate extensions. The user can override in thier " .vimrc if the defaults are not suitable. To override in a .vimrc simply set a " g:alternateExtensions_ variable to a comma separated list of alternates, " where is the extension to map. " E.g. let g:alternateExtensions_CPP = "inc,h,H,HPP,hpp" " let g:alternateExtensions_{'aspx.cs'} = "aspx" " This variable will be increased when an extension with greater number of dots " is added by the AddAlternateExtensionMapping call. let s:maxDotsInExtension = 1 " Function : AddAlternateExtensionMapping (PRIVATE) " Purpose : simple helper function to add the default alternate extension " mappings. " Args : extension -- the extension to map " alternates -- comma separated list of alternates extensions " Returns : nothing " Author : Michael Sharpe function! AddAlternateExtensionMapping(extension, alternates) " This code does not actually work for variables like foo{'a.b.c.d.e'} "let varName = "g:alternateExtensions_" . a:extension "if (!exists(varName)) " let g:alternateExtensions_{a:extension} = a:alternates "endif " This code handles extensions which contains a dot. exists() fails with " such names. "let v:errmsg = "" " FIXME this line causes ex to return 1 instead of 0 for some reason?? "silent! echo g:alternateExtensions_{a:extension} "if (v:errmsg != "") "let g:alternateExtensions_{a:extension} = a:alternates "endif let g:alternateExtensionsDict[a:extension] = a:alternates let dotsNumber = strlen(substitute(a:extension, "[^.]", "", "g")) if s:maxDotsInExtension < dotsNumber let s:maxDotsInExtension = dotsNumber endif endfunction " Add all the default extensions " Mappings for C and C++ call AddAlternateExtensionMapping('h',"c,cpp,cxx,cc,CC") call AddAlternateExtensionMapping('H',"C,CPP,CXX,CC") call AddAlternateExtensionMapping('hpp',"cpp,c") call AddAlternateExtensionMapping('HPP',"CPP,C") call AddAlternateExtensionMapping('c',"h") call AddAlternateExtensionMapping('C',"H") call AddAlternateExtensionMapping('cpp',"h,hpp") call AddAlternateExtensionMapping('CPP',"H,HPP") call AddAlternateExtensionMapping('cc',"h") call AddAlternateExtensionMapping('CC',"H,h") call AddAlternateExtensionMapping('cxx',"h") call AddAlternateExtensionMapping('CXX',"H") " Mappings for PSL7 call AddAlternateExtensionMapping('psl',"ph") call AddAlternateExtensionMapping('ph',"psl") " Mappings for ADA call AddAlternateExtensionMapping('adb',"ads") call AddAlternateExtensionMapping('ads',"adb") " Mappings for lex and yacc files call AddAlternateExtensionMapping('l',"y,yacc,ypp") call AddAlternateExtensionMapping('lex',"yacc,y,ypp") call AddAlternateExtensionMapping('lpp',"ypp,y,yacc") call AddAlternateExtensionMapping('y',"l,lex,lpp") call AddAlternateExtensionMapping('yacc',"lex,l,lpp") call AddAlternateExtensionMapping('ypp',"lpp,l,lex") " Mappings for OCaml call AddAlternateExtensionMapping('ml',"mli") call AddAlternateExtensionMapping('mli',"ml") " ASP stuff call AddAlternateExtensionMapping('aspx.cs', 'aspx') call AddAlternateExtensionMapping('aspx.vb', 'aspx') call AddAlternateExtensionMapping('aspx', 'aspx.cs,aspx.vb') " Setup default search path, unless the user has specified " a path in their [._]vimrc. if (!exists('g:alternateSearchPath')) let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc' endif " If this variable is true then a.vim will not alternate to a file/buffer which " does not exist. E.g while editing a.c and the :A will not swtich to a.h " unless it exists. if (!exists('g:alternateNoDefaultAlternate')) " by default a.vim will alternate to a file which does not exist let g:alternateNoDefaultAlternate = 0 endif " If this variable is true then a.vim will convert the alternate filename to a " filename relative to the current working directory. " Feature by Nathan Huizinga if (!exists('g:alternateRelativeFiles')) " by default a.vim will not convert the filename to one relative to the " current working directory let g:alternateRelativeFiles = 0 endif " Function : GetNthItemFromList (PRIVATE) " Purpose : Support reading items from a comma seperated list " Used to iterate all the extensions in an extension spec " Used to iterate all path prefixes " Args : list -- the list (extension spec, file paths) to iterate " n -- the extension to get " Returns : the nth item (extension, path) from the list (extension " spec), or "" for failure " Author : Michael Sharpe " History : Renamed from GetNthExtensionFromSpec to GetNthItemFromList " to reflect a more generic use of this function. -- Bindu function! GetNthItemFromList(list, n) let itemStart = 0 let itemEnd = -1 let pos = 0 let item = "" let i = 0 while (i != a:n) let itemStart = itemEnd + 1 let itemEnd = match(a:list, ",", itemStart) let i = i + 1 if (itemEnd == -1) if (i == a:n) let itemEnd = strlen(a:list) endif break endif endwhile if (itemEnd != -1) let item = strpart(a:list, itemStart, itemEnd - itemStart) endif return item endfunction " Function : ExpandAlternatePath (PRIVATE) " Purpose : Expand path info. A path with a prefix of "wdr:" will be " treated as relative to the working directory (i.e. the " directory where vim was started.) A path prefix of "abs:" will " be treated as absolute. No prefix or "sfr:" will result in the " path being treated as relative to the source file (see sfPath " argument). " " A prefix of "reg:" will treat the pathSpec as a regular " expression substitution that is applied to the source file " path. The format is: " " reg: " " seperator character, we often use one of [/|%#] " is what you are looking for " is the output pattern " can be g for global replace or empty " " EXAMPLE: 'reg:/inc/src/g/' will replace every instance " of 'inc' with 'src' in the source file path. It is possible " to use match variables so you could do something like: " 'reg:|src/\([^/]*\)|inc/\1||' (see 'help :substitute', " 'help pattern' and 'help sub-replace-special' for more details " " NOTE: a.vim uses ',' (comma) internally so DON'T use it " in your regular expressions or other pathSpecs unless you update " the rest of the a.vim code to use some other seperator. " " Args : pathSpec -- path component (or substitution patterns) " sfPath -- source file path " Returns : a path that can be used by AlternateFile() " Author : Bindu Wavell function! ExpandAlternatePath(pathSpec, sfPath) let prfx = strpart(a:pathSpec, 0, 4) if (prfx == "wdr:" || prfx == "abs:") let path = strpart(a:pathSpec, 4) elseif (prfx == "reg:") let re = strpart(a:pathSpec, 4) let sep = strpart(re, 0, 1) let patend = match(re, sep, 1) let pat = strpart(re, 1, patend - 1) let subend = match(re, sep, patend + 1) let sub = strpart(re, patend+1, subend - patend - 1) let flag = strpart(re, strlen(re) - 2) if (flag == sep) let flag = '' endif let path = substitute(a:sfPath, pat, sub, flag) "call confirm('PAT: [' . pat . '] SUB: [' . sub . ']') "call confirm(a:sfPath . ' => ' . path) else let path = a:pathSpec if (prfx == "sfr:") let path = strpart(path, 4) endif let path = a:sfPath . "/" . path endif return path endfunction " Function : FindFileInSearchPath (PRIVATE) " Purpose : Searches for a file in the search path list " Args : filename -- name of the file to search for " pathList -- the path list to search " relPathBase -- the path which relative paths are expanded from " Returns : An expanded filename if found, the empty string otherwise " Author : Michael Sharpe (feline@irendi.com) " History : inline code written by Bindu Wavell originally function! FindFileInSearchPath(fileName, pathList, relPathBase) let filepath = "" let m = 1 let pathListLen = strlen(a:pathList) if (pathListLen > 0) while (1) let pathSpec = GetNthItemFromList(a:pathList, m) if (pathSpec != "") let path = ExpandAlternatePath(pathSpec, a:relPathBase) let fullname = path . "/" . a:fileName let foundMatch = BufferOrFileExists(fullname) if (foundMatch) let filepath = fullname break endif else break endif let m = m + 1 endwhile endif return filepath endfunction " Function : FindFileInSearchPathEx (PRIVATE) " Purpose : Searches for a file in the search path list " Args : filename -- name of the file to search for " pathList -- the path list to search " relPathBase -- the path which relative paths are expanded from " count -- find the count'th occurence of the file on the path " Returns : An expanded filename if found, the empty string otherwise " Author : Michael Sharpe (feline@irendi.com) " History : Based on FindFileInSearchPath() but with extensions function! FindFileInSearchPathEx(fileName, pathList, relPathBase, count) let filepath = "" let m = 1 let spath = "" let pathListLen = strlen(a:pathList) if (pathListLen > 0) while (1) let pathSpec = GetNthItemFromList(a:pathList, m) if (pathSpec != "") let path = ExpandAlternatePath(pathSpec, a:relPathBase) if (spath != "") let spath = spath . ',' endif let spath = spath . path else break endif let m = m + 1 endwhile endif if (&path != "") if (spath != "") let spath = spath . ',' endif let spath = spath . &path endif let filepath = findfile(a:fileName, spath, a:count) return filepath endfunction " Function : EnumerateFilesByExtension (PRIVATE) " Purpose : enumerates all files by a particular list of alternate extensions. " Args : path -- path of a file (not including the file) " baseName -- base name of the file to be expanded " extension -- extension whose alternates are to be enumerated " Returns : comma separated list of files with extensions " Author : Michael Sharpe function! EnumerateFilesByExtension(path, baseName, extension) let enumeration = "" let extSpec = "" let v:errmsg = "" silent! echo g:alternateExtensions_{a:extension} if (v:errmsg == "") let extSpec = g:alternateExtensions_{a:extension} endif if (extSpec == "") if (has_key(g:alternateExtensionsDict, a:extension)) let extSpec = g:alternateExtensionsDict[a:extension] endif endif if (extSpec != "") let n = 1 let done = 0 while (!done) let ext = GetNthItemFromList(extSpec, n) if (ext != "") if (a:path != "") let newFilename = a:path . "/" . a:baseName . "." . ext else let newFilename = a:baseName . "." . ext endif if (enumeration == "") let enumeration = newFilename else let enumeration = enumeration . "," . newFilename endif else let done = 1 endif let n = n + 1 endwhile endif return enumeration endfunction " Function : EnumerateFilesByExtensionInPath (PRIVATE) " Purpose : enumerates all files by expanding the path list and the extension " list. " Args : baseName -- base name of the file " extension -- extension whose alternates are to be enumerated " pathList -- the list of paths to enumerate " relPath -- the path of the current file for expansion of relative " paths in the path list. " Returns : A comma separated list of paths with extensions " Author : Michael Sharpe function! EnumerateFilesByExtensionInPath(baseName, extension, pathList, relPathBase) let enumeration = "" let filepath = "" let m = 1 let pathListLen = strlen(a:pathList) if (pathListLen > 0) while (1) let pathSpec = GetNthItemFromList(a:pathList, m) if (pathSpec != "") let path = ExpandAlternatePath(pathSpec, a:relPathBase) let pe = EnumerateFilesByExtension(path, a:baseName, a:extension) if (enumeration == "") let enumeration = pe else let enumeration = enumeration . "," . pe endif else break endif let m = m + 1 endwhile endif return enumeration endfunction " Function : DetermineExtension (PRIVATE) " Purpose : Determines the extension of a filename based on the register " alternate extension. This allow extension which contain dots to " be considered. E.g. foo.aspx.cs to foo.aspx where an alternate " exists for the aspx.cs extension. Note that this will only accept " extensions which contain less than 5 dots. This is only " implemented in this manner for simplicity...it is doubtful that " this will be a restriction in non-contrived situations. " Args : The path to the file to find the extension in " Returns : The matched extension if any " Author : Michael Sharpe (feline@irendi.com) " History : idea from Tom-Erik Duestad " Notes : there is some magic occuring here. The exists() function does not " work well when the curly brace variable has dots in it. And why " should it, dots are not valid in variable names. But the exists " function is wierd too. Lets say foo_c does exist. Then " exists("foo_c.e.f") will be true...even though the variable does " not exist. However the curly brace variables do work when the " variable has dots in it. E.g foo_{'c'} is different from " foo_{'c.d.e'}...and foo_{'c'} is identical to foo_c and " foo_{'c.d.e'} is identical to foo_c.d.e right? Yes in the current " implementation of vim. To trick vim to test for existence of such " variables echo the curly brace variable and look for an error " message. function! DetermineExtension(path) let mods = ":t" let i = 0 while i <= s:maxDotsInExtension let mods = mods . ":e" let extension = fnamemodify(a:path, mods) if (has_key(g:alternateExtensionsDict, extension)) return extension endif let v:errmsg = "" silent! echo g:alternateExtensions_{extension} if (v:errmsg == "") return extension endif let i = i + 1 endwhile return "" endfunction " Function : AlternateFile (PUBLIC) " Purpose : Opens a new buffer by looking at the extension of the current " buffer and finding the corresponding file. E.g. foo.c <--> foo.h " Args : accepts one argument. If present it used the argument as the new " extension. " Returns : nothing " Author : Michael Sharpe " History : + When an alternate can't be found in the same directory as the " source file, a search path will be traversed looking for the " alternates. " + Moved some code into a separate function, minor optimization " + rework to favor files in memory based on complete enumeration of " all files extensions and paths function! AlternateFile(splitWindow, ...) let extension = DetermineExtension(expand("%:p")) let baseName = substitute(expand("%:t"), "\." . extension . '$', "", "") let currentPath = expand("%:p:h") if (a:0 != 0) let newFullname = currentPath . "/" . baseName . "." . a:1 call FindOrCreateBuffer(newFullname, a:splitWindow, 0) else let allfiles = "" if (extension != "") let allfiles1 = EnumerateFilesByExtension(currentPath, baseName, extension) let allfiles2 = EnumerateFilesByExtensionInPath(baseName, extension, g:alternateSearchPath, currentPath) if (allfiles1 != "") if (allfiles2 != "") let allfiles = allfiles1 . ',' . allfiles2 else let allfiles = allfiles1 endif else let allfiles = allfiles2 endif endif if (allfiles != "") let bestFile = "" let bestScore = 0 let score = 0 let n = 1 let onefile = GetNthItemFromList(allfiles, n) let bestFile = onefile while (onefile != "" && score < 2) let score = BufferOrFileExists(onefile) if (score > bestScore) let bestScore = score let bestFile = onefile endif let n = n + 1 let onefile = GetNthItemFromList(allfiles, n) endwhile if (bestScore == 0 && g:alternateNoDefaultAlternate == 1) echo "No existing alternate available" else call FindOrCreateBuffer(bestFile, a:splitWindow, 1) let b:AlternateAllFiles = allfiles endif else echo "No alternate file/buffer available" endif endif endfunction " Function : AlternateOpenFileUnderCursor (PUBLIC) " Purpose : Opens file under the cursor " Args : splitWindow -- indicates how to open the file " Returns : Nothing " Author : Michael Sharpe (feline@irendi.com) www.irendi.com function! AlternateOpenFileUnderCursor(splitWindow,...) let cursorFile = (a:0 > 0) ? a:1 : expand("") let currentPath = expand("%:p:h") let openCount = 1 let fileName = FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount) if (fileName != "") call FindOrCreateBuffer(fileName, a:splitWindow, 1) let b:openCount = openCount let b:cursorFile = cursorFile let b:currentPath = currentPath else echo "Can't find file" endif endfunction " Function : AlternateOpenNextFile (PUBLIC) " Purpose : Opens the next file corresponding to the search which found the " current file " Args : bang -- indicates what to do if the current file has not been " saved " Returns : nothing " Author : Michael Sharpe (feline@irendi.com) www.irendi.com function! AlternateOpenNextFile(bang) let cursorFile = "" if (exists("b:cursorFile")) let cursorFile = b:cursorFile endif let currentPath = "" if (exists("b:currentPath")) let currentPath = b:currentPath endif let openCount = 0 if (exists("b:openCount")) let openCount = b:openCount + 1 endif if (cursorFile != "" && currentPath != "" && openCount != 0) let fileName = FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount) if (fileName != "") call FindOrCreateBuffer(fileName, "n".a:bang, 0) let b:openCount = openCount let b:cursorFile = cursorFile let b:currentPath = currentPath else let fileName = FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, 1) if (fileName != "") call FindOrCreateBuffer(fileName, "n".a:bang, 0) let b:openCount = 1 let b:cursorFile = cursorFile let b:currentPath = currentPath else echo "Can't find next file" endif endif endif endfunction comm! -nargs=? -bang IH call AlternateOpenFileUnderCursor("n", ) comm! -nargs=? -bang IHS call AlternateOpenFileUnderCursor("h", ) comm! -nargs=? -bang IHV call AlternateOpenFileUnderCursor("v", ) comm! -nargs=? -bang IHT call AlternateOpenFileUnderCursor("t", ) comm! -nargs=? -bang IHN call AlternateOpenNextFile("") imap ih :IHS nmap ih :IHS imap is :IHS:A nmap is :IHS:A imap ihn :IHN nmap ihn :IHN "function! PrintList(theList) " let n = 1 " let oneFile = GetNthItemFromList(a:theList, n) " while (oneFile != "") " let n = n + 1 " let oneFile = GetNthItemFromList(a:theList, n) " endwhile "endfunction " Function : NextAlternate (PUBLIC) " Purpose : Used to cycle through any other alternate file which existed on " the search path. " Args : bang (IN) - used to implement the AN vs AN! functionality " Returns : nothing " Author : Michael Sharpe function! NextAlternate(bang) if (exists('b:AlternateAllFiles')) let currentFile = expand("%") let n = 1 let onefile = GetNthItemFromList(b:AlternateAllFiles, n) while (onefile != "" && !EqualFilePaths(fnamemodify(onefile,":p"), fnamemodify(currentFile,":p"))) let n = n + 1 let onefile = GetNthItemFromList(b:AlternateAllFiles, n) endwhile if (onefile != "") let stop = n let n = n + 1 let foundAlternate = 0 let nextAlternate = "" while (n != stop) let nextAlternate = GetNthItemFromList(b:AlternateAllFiles, n) if (nextAlternate == "") let n = 1 continue endif let n = n + 1 if (EqualFilePaths(fnamemodify(nextAlternate, ":p"), fnamemodify(currentFile, ":p"))) continue endif if (filereadable(nextAlternate)) " on cygwin filereadable("foo.H") returns true if "foo.h" exists if (has("unix") && $WINDIR != "" && fnamemodify(nextAlternate, ":p") ==? fnamemodify(currentFile, ":p")) continue endif let foundAlternate = 1 break endif endwhile if (foundAlternate == 1) let s:AlternateAllFiles = b:AlternateAllFiles "silent! execute ":e".a:bang." " . nextAlternate call FindOrCreateBuffer(nextAlternate, "n".a:bang, 0) let b:AlternateAllFiles = s:AlternateAllFiles else echo "Only this alternate file exists" endif else echo "Could not find current file in alternates list" endif else echo "No other alternate files exist" endif endfunction comm! -nargs=? -bang A call AlternateFile("n", ) comm! -nargs=? -bang AS call AlternateFile("h", ) comm! -nargs=? -bang AV call AlternateFile("v", ) comm! -nargs=? -bang AT call AlternateFile("t", ) comm! -nargs=? -bang AN call NextAlternate("") " Function : BufferOrFileExists (PRIVATE) " Purpose : determines if a buffer or a readable file exists " Args : fileName (IN) - name of the file to check " Returns : 2 if it exists in memory, 1 if it exists, 0 otherwise " Author : Michael Sharpe " History : Updated code to handle buffernames using just the " filename and not the path. function! BufferOrFileExists(fileName) let result = 0 let lastBuffer = bufnr("$") let i = 1 while i <= lastBuffer if EqualFilePaths(expand("#".i.":p"), a:fileName) let result = 2 break endif let i = i + 1 endwhile if (!result) let bufName = fnamemodify(a:fileName,":t") let memBufName = bufname(bufName) if (memBufName != "") let memBufBasename = fnamemodify(memBufName, ":t") if (bufName == memBufBasename) let result = 2 endif endif if (!result) let result = bufexists(bufName) || bufexists(a:fileName) || filereadable(a:fileName) endif endif if (!result) let result = filereadable(a:fileName) endif return result endfunction " Function : FindOrCreateBuffer (PRIVATE) " Purpose : searches the buffer list (:ls) for the specified filename. If " found, checks the window list for the buffer. If the buffer is in " an already open window, it switches to the window. If the buffer " was not in a window, it switches to that buffer. If the buffer did " not exist, it creates it. " Args : filename (IN) -- the name of the file " doSplit (IN) -- indicates whether the window should be split " ("v", "h", "n", "v!", "h!", "n!", "t", "t!") " findSimilar (IN) -- indicate weather existing buffers should be " prefered " Returns : nothing " Author : Michael Sharpe " History : + bufname() was not working very well with the possibly strange " paths that can abound with the search path so updated this " slightly. -- Bindu " + updated window switching code to make it more efficient -- Bindu " Allow ! to be applied to buffer/split/editing commands for more " vim/vi like consistency " + implemented fix from Matt Perry function! FindOrCreateBuffer(fileName, doSplit, findSimilar) " Check to see if the buffer is already open before re-opening it. let FILENAME = escape(a:fileName, ' ') let bufNr = -1 let lastBuffer = bufnr("$") let i = 1 if (a:findSimilar) while i <= lastBuffer if EqualFilePaths(expand("#".i.":p"), a:fileName) let bufNr = i break endif let i = i + 1 endwhile if (bufNr == -1) let bufName = bufname(a:fileName) let bufFilename = fnamemodify(a:fileName,":t") if (bufName == "") let bufName = bufname(bufFilename) endif if (bufName != "") let tail = fnamemodify(bufName, ":t") if (tail != bufFilename) let bufName = "" endif endif if (bufName != "") let bufNr = bufnr(bufName) let FILENAME = bufName endif endif endif if (g:alternateRelativeFiles == 1) let FILENAME = fnamemodify(FILENAME, ":p:.") endif let splitType = a:doSplit[0] let bang = a:doSplit[1] if (bufNr == -1) " Buffer did not exist....create it let v:errmsg="" if (splitType == "h") silent! execute ":split".bang." " . FILENAME elseif (splitType == "v") silent! execute ":vsplit".bang." " . FILENAME elseif (splitType == "t") silent! execute ":tab split".bang." " . FILENAME else silent! execute ":e".bang." " . FILENAME endif if (v:errmsg != "") echo v:errmsg endif else " Find the correct tab corresponding to the existing buffer let tabNr = -1 " iterate tab pages for i in range(tabpagenr('$')) " get the list of buffers in the tab let tabList = tabpagebuflist(i + 1) let idx = 0 " iterate each buffer in the list while idx < len(tabList) " if it matches the buffer we are looking for... if (tabList[idx] == bufNr) " ... save the number let tabNr = i + 1 break endif let idx = idx + 1 endwhile if (tabNr != -1) break endif endfor " switch the the tab containing the buffer if (tabNr != -1) execute "tabn ".tabNr endif " Buffer was already open......check to see if it is in a window let bufWindow = bufwinnr(bufNr) if (bufWindow == -1) " Buffer was not in a window so open one let v:errmsg="" if (splitType == "h") silent! execute ":sbuffer".bang." " . FILENAME elseif (splitType == "v") silent! execute ":vert sbuffer " . FILENAME elseif (splitType == "t") silent! execute ":tab sbuffer " . FILENAME else silent! execute ":buffer".bang." " . FILENAME endif if (v:errmsg != "") echo v:errmsg endif else " Buffer is already in a window so switch to the window execute bufWindow."wincmd w" if (bufWindow != winnr()) " something wierd happened...open the buffer let v:errmsg="" if (splitType == "h") silent! execute ":split".bang." " . FILENAME elseif (splitType == "v") silent! execute ":vsplit".bang." " . FILENAME elseif (splitType == "t") silent! execute ":tab split".bang." " . FILENAME else silent! execute ":e".bang." " . FILENAME endif if (v:errmsg != "") echo v:errmsg endif endif endif endif endfunction " Function : EqualFilePaths (PRIVATE) " Purpose : Compares two paths. Do simple string comparison anywhere but on " Windows. On Windows take into account that file paths could differ " in usage of separators and the fact that case does not matter. " "c:\WINDOWS" is the same path as "c:/windows". has("win32unix") Vim " version does not count as one having Windows path rules. " Args : path1 (IN) -- first path " path2 (IN) -- second path " Returns : 1 if path1 is equal to path2, 0 otherwise. " Author : Ilya Bobir function! EqualFilePaths(path1, path2) if has("win16") || has("win32") || has("win64") || has("win95") return substitute(a:path1, "\/", "\\", "g") ==? substitute(a:path2, "\/", "\\", "g") else return a:path1 == a:path2 endif endfunction vim-scripts-20130814ubuntu1/plugin/surround.vim0000644000000000000000000003655412204336073016361 0ustar " surround.vim - Surroundings " Author: Tim Pope " Version: 2.0 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim if exists("g:loaded_surround") || &cp || v:version < 700 finish endif let g:loaded_surround = 1 " Input functions {{{1 function! s:getchar() let c = getchar() if c =~ '^\d\+$' let c = nr2char(c) endif return c endfunction function! s:inputtarget() let c = s:getchar() while c =~ '^\d\+$' let c .= s:getchar() endwhile if c == " " let c .= s:getchar() endif if c =~ "\\|\\|\0" return "" else return c endif endfunction function! s:inputreplacement() let c = s:getchar() if c == " " let c .= s:getchar() endif if c =~ "\" || c =~ "\" return "" else return c endif endfunction function! s:beep() exe "norm! \" return "" endfunction function! s:redraw() redraw return "" endfunction " }}}1 " Wrapping functions {{{1 function! s:extractbefore(str) if a:str =~ '\r' return matchstr(a:str,'.*\ze\r') else return matchstr(a:str,'.*\ze\n') endif endfunction function! s:extractafter(str) if a:str =~ '\r' return matchstr(a:str,'\r\zs.*') else return matchstr(a:str,'\n\zs.*') endif endfunction function! s:fixindent(str,spc) let str = substitute(a:str,'\t',repeat(' ',&sw),'g') let spc = substitute(a:spc,'\t',repeat(' ',&sw),'g') let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g') if ! &et let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g') endif return str endfunction function! s:process(string) let i = 0 for i in range(7) let repl_{i} = '' let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) if m != '' let m = substitute(strpart(m,1),'\r.*','','') let repl_{i} = input(substitute(m,':\s*$','','').': ') endif endfor let s = "" let i = 0 while i < strlen(a:string) let char = strpart(a:string,i,1) if char2nr(char) < 8 let next = stridx(a:string,char,i+1) if next == -1 let s .= char else let insertion = repl_{char2nr(char)} let subs = strpart(a:string,i+1,next-i-1) let subs = matchstr(subs,'\r.*') while subs =~ '^\r.*\r' let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*") let subs = strpart(subs,strlen(sub)+1) let r = stridx(sub,"\r") let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'') endwhile let s .= insertion let i = next endif else let s .= char endif let i += 1 endwhile return s endfunction function! s:wrap(string,char,type,...) let keeper = a:string let newchar = a:char let s:tag = "" let type = a:type let linemode = type ==# 'V' ? 1 : 0 let special = a:0 ? a:1 : 0 let before = "" let after = "" if type ==# "V" let initspaces = matchstr(keeper,'\%^\s*') else let initspaces = matchstr(getline('.'),'\%^\s*') endif let pairs = "b()B{}r[]a<>" let extraspace = "" if newchar =~ '^ ' let newchar = strpart(newchar,1) let extraspace = ' ' endif let idx = stridx(pairs,newchar) if newchar == ' ' let before = '' let after = '' elseif exists("b:surround_".char2nr(newchar)) let all = s:process(b:surround_{char2nr(newchar)}) let before = s:extractbefore(all) let after = s:extractafter(all) elseif exists("g:surround_".char2nr(newchar)) let all = s:process(g:surround_{char2nr(newchar)}) let before = s:extractbefore(all) let after = s:extractafter(all) elseif newchar ==# "p" let before = "\n" let after = "\n\n" elseif newchar ==# 's' let before = ' ' let after = '' elseif newchar ==# ':' let before = ':' let after = '' elseif newchar =~# "[tT\<,]" let dounmapp = 0 let dounmapb = 0 if !maparg(">","c") let dounmapb = 1 " Hide from AsNeeded exe "cn"."oremap > " endif let default = "" if newchar ==# "T" if !exists("s:lastdel") let s:lastdel = "" endif let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') endif let tag = input("<",default) echo "<".substitute(tag,'>*$','>','') if dounmapb silent! cunmap > endif let s:tag = tag if tag != "" let tag = substitute(tag,'>*$','','') let s:tag = tag . '>' let before = '<'.tag.'>' if tag =~ '/$' let after = '' else let after = '' endif if newchar == "\" || newchar == "," if type ==# "v" || type ==# "V" let before .= "\n\t" endif if type ==# "v" let after = "\n". after endif endif endif elseif newchar ==# 'l' || newchar == '\' " LaTeX let env = input('\begin{') let env = '{' . env let env .= s:closematch(env) echo '\begin'.env if env != "" let before = '\begin'.env let after = '\end'.matchstr(env,'[^}]*').'}' endif elseif newchar ==# 'f' || newchar ==# 'F' let fnc = input('function: ') if fnc != "" let before = substitute(fnc,'($','','').'(' let after = ')' if newchar ==# 'F' let before .= ' ' let after = ' ' . after endif endif elseif newchar ==# "\" let fnc = input('function: ') let before = '('.fnc.' ' let after = ')' elseif idx >= 0 let spc = (idx % 3) == 1 ? " " : "" let idx = idx / 3 * 3 let before = strpart(pairs,idx+1,1) . spc let after = spc . strpart(pairs,idx+2,1) elseif newchar == "\" || newchar == "\" let before = "{\n\t" let after = "\n}" elseif newchar !~ '\a' let before = newchar let after = newchar else let before = '' let after = '' endif let after = substitute(after ,'\n','\n'.initspaces,'g') if type ==# 'V' || (special && type ==# "v") let before = substitute(before,' \+$','','') let after = substitute(after ,'^ \+','','') if after !~ '^\n' let after = initspaces.after endif if keeper !~ '\n$' && after !~ '^\n' let keeper .= "\n" elseif keeper =~ '\n$' && after =~ '^\n' let after = strpart(after,1) endif if before !~ '\n\s*$' let before .= "\n" if special let before .= "\t" endif endif endif if type ==# 'V' let before = initspaces.before endif if before =~ '\n\s*\%$' if type ==# 'v' let keeper = initspaces.keeper endif let padding = matchstr(before,'\n\zs\s\+\%$') let before = substitute(before,'\n\s\+\%$','\n','') let keeper = s:fixindent(keeper,padding) endif if type ==# 'V' let keeper = before.keeper.after elseif type =~ "^\" " Really we should be iterating over the buffer let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g') let repl = substitute(repl,'\n',' ','g') let keeper = substitute(keeper."\n",'\(.\{-\}\)\(\n\)',repl.'\n','g') let keeper = substitute(keeper,'\n\%$','','') else let keeper = before.extraspace.keeper.extraspace.after endif return keeper endfunction function! s:wrapreg(reg,char,...) let orig = getreg(a:reg) let type = substitute(getregtype(a:reg),'\d\+$','','') let special = a:0 ? a:1 : 0 let new = s:wrap(orig,a:char,type,special) call setreg(a:reg,new,type) endfunction " }}}1 function! s:insert(...) " {{{1 " Optional argument causes the result to appear on 3 lines, not 1 let linemode = a:0 ? a:1 : 0 let char = s:inputreplacement() while char == "\" || char == "\" " TODO: use total count for additional blank lines let linemode += 1 let char = s:inputreplacement() endwhile if char == "" return "" endif let cb_save = &clipboard set clipboard-=unnamed clipboard-=unnamedplus let reg_save = @@ call setreg('"',"\r",'v') call s:wrapreg('"',char,linemode) " If line mode is used and the surrounding consists solely of a suffix, " remove the initial newline. This fits a use case of mine but is a " little inconsistent. Is there anyone that would prefer the simpler " behavior of just inserting the newline? if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0 call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"')) endif " This can be used to append a placeholder to the end if exists("g:surround_insert_tail") call setreg('"',g:surround_insert_tail,"a".getregtype('"')) endif if col('.') >= col('$') norm! ""p else norm! ""P endif if linemode call s:reindent() endif norm! `] call search('\r','bW') let @@ = reg_save let &clipboard = cb_save return "\" endfunction " }}}1 function! s:reindent() " {{{1 if exists("b:surround_indent") ? b:surround_indent : (exists("g:surround_indent") && g:surround_indent) silent norm! '[='] endif endfunction " }}}1 function! s:dosurround(...) " {{{1 let scount = v:count1 let char = (a:0 ? a:1 : s:inputtarget()) let spc = "" if char =~ '^\d\+' let scount = scount * matchstr(char,'^\d\+') let char = substitute(char,'^\d\+','','') endif if char =~ '^ ' let char = strpart(char,1) let spc = 1 endif if char == 'a' let char = '>' endif if char == 'r' let char = ']' endif let newchar = "" if a:0 > 1 let newchar = a:2 if newchar == "\" || newchar == "\" || newchar == "" return s:beep() endif endif let cb_save = &clipboard set clipboard-=unnamed clipboard-=unnamedplus let append = "" let original = getreg('"') let otype = getregtype('"') call setreg('"',"") let strcount = (scount == 1 ? "" : scount) if char == '/' exe 'norm! '.strcount.'[/d'.strcount.']/' else exe 'norm! d'.strcount.'i'.char endif let keeper = getreg('"') let okeeper = keeper " for reindent below if keeper == "" call setreg('"',original,otype) let &clipboard = cb_save return "" endif let oldline = getline('.') let oldlnum = line('.') if char ==# "p" call setreg('"','','V') elseif char ==# "s" || char ==# "w" || char ==# "W" " Do nothing call setreg('"','') elseif char =~ "[\"'`]" exe "norm! i \d2i".char call setreg('"',substitute(getreg('"'),' ','','')) elseif char == '/' norm! "_x call setreg('"','/**/',"c") let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') else " One character backwards call search('.','bW') exe "norm! da".char endif let removed = getreg('"') let rem2 = substitute(removed,'\n.*','','') let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2)) let oldtail = strpart(oldline, strlen(oldline)-strlen(rem2)) let regtype = getregtype('"') if char =~# '[\[({Dsurround".char,scount) else silent! call repeat#set("\Csurround".char.newchar.s:tag,scount) endif endfunction " }}}1 function! s:changesurround() " {{{1 let a = s:inputtarget() if a == "" return s:beep() endif let b = s:inputreplacement() if b == "" return s:beep() endif call s:dosurround(a,b) endfunction " }}}1 function! s:opfunc(type,...) " {{{1 let char = s:inputreplacement() if char == "" return s:beep() endif let reg = '"' let sel_save = &selection let &selection = "inclusive" let cb_save = &clipboard set clipboard-=unnamed clipboard-=unnamedplus let reg_save = getreg(reg) let reg_type = getregtype(reg) let type = a:type if a:type == "char" silent exe 'norm! v`[o`]"'.reg.'y' let type = 'v' elseif a:type == "line" silent exe 'norm! `[V`]"'.reg.'y' let type = 'V' elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\" let &selection = sel_save let ve = &virtualedit if !(a:0 && a:1) set virtualedit= endif silent exe 'norm! gv"'.reg.'y' let &virtualedit = ve elseif a:type =~ '^\d\+$' let type = 'v' silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' if mode() ==# 'v' norm! v return s:beep() endif else let &selection = sel_save let &clipboard = cb_save return s:beep() endif let keeper = getreg(reg) if type ==# "v" && a:type !=# "v" let append = matchstr(keeper,'\_s\@Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:tag,a:type) else silent! call repeat#set("\SurroundRepeat".char.s:tag) endif endfunction function! s:opfunc2(arg) call s:opfunc(a:arg,1) endfunction " }}}1 function! s:closematch(str) " {{{1 " Close an open (, {, [, or < on the command line. let tail = matchstr(a:str,'.[^\[\](){}<>]*$') if tail =~ '^\[.\+' return "]" elseif tail =~ '^(.\+' return ")" elseif tail =~ '^{.\+' return "}" elseif tail =~ '^<.+' return ">" else return "" endif endfunction " }}}1 nnoremap SurroundRepeat . nnoremap Dsurround :call dosurround(inputtarget()) nnoremap Csurround :call changesurround() nnoremap Yssurround :call opfunc(v:count1) nnoremap YSsurround :call opfunc2(v:count1) " discards the numerical argument but there's not much we can do with it nnoremap Ysurround :set opfunc=opfuncg@ nnoremap YSurround :set opfunc=opfunc2g@ vnoremap VSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0) vnoremap VgSurround :call opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1) inoremap Isurround =insert() inoremap ISurround =insert(1) if !exists("g:surround_no_mappings") || ! g:surround_no_mappings nmap ds Dsurround nmap cs Csurround nmap ys Ysurround nmap yS YSurround nmap yss Yssurround nmap ySs YSsurround nmap ySS YSsurround xmap S VSurround xmap gS VgSurround if !hasmapto("Isurround","i") && "" == mapcheck("","i") imap Isurround endif imap s Isurround imap S ISurround endif " vim:set ft=vim sw=2 sts=2 et: vim-scripts-20130814ubuntu1/plugin/project.vim0000644000000000000000000016031312204336073016135 0ustar "============================================================================= " File: project.vim " Author: Aric Blumer (Aric.Blumer at aricvim@charter.net) " Last Change: Fri 13 Oct 2006 09:47:08 AM EDT " Version: 1.4.1 "============================================================================= " See documentation in accompanying help file " You may use this code in whatever way you see fit. if exists('loaded_project') || &cp finish endif let loaded_project=1 function! s:Project(filename) " <<< " Initialization <<< if exists("g:proj_running") if strlen(a:filename) != 0 call confirm('Project already loaded; ignoring filename "'.a:filename."\".\n".'See ":help project-invoking" for information about changing project files.', "&OK", 1) endif let filename=bufname(g:proj_running) else if strlen(a:filename) == 0 let filename ='~/.vimprojects' " Default project filename else let filename = a:filename endif endif if !exists('g:proj_window_width') let g:proj_window_width=24 " Default project window width endif if !exists('g:proj_window_increment') let g:proj_window_increment=100 " Project Window width increment endif if !exists('g:proj_flags') if has("win32") || has("mac") let g:proj_flags='imst' " Project default flags for windows/mac else let g:proj_flags='imstb' " Project default flags for everything else endif endif if !exists("g:proj_running") || (bufwinnr(g:proj_running) == -1) " Open the Project Window exec 'silent vertical new '.filename if match(g:proj_flags, '\CF') == -1 " We're floating silent! wincmd H exec 'vertical resize '.g:proj_window_width endif setlocal nomodeline else silent! 99wincmd h if bufwinnr(g:proj_running) == -1 vertical split let v:errmsg="nothing" silent! bnext if 'nothing' != v:errmsg enew endif endif return endif " Process the flags let b:proj_cd_cmd='cd' if match(g:proj_flags, '\Cl') != -1 let b:proj_cd_cmd = 'lcd' endif let b:proj_locate_command='silent! wincmd H' let b:proj_resize_command='exec ''vertical resize ''.g:proj_window_width' if match(g:proj_flags, '\CF') != -1 " Set the resize commands to nothing let b:proj_locate_command='' let b:proj_resize_command='' endif let g:proj_last_buffer = -1 ">>> " ProjFoldText() <<< " The foldtext function for displaying just the description. function! ProjFoldText() let line=substitute(getline(v:foldstart),'^[ \t#]*\([^=]*\).*', '\1', '') let line=strpart(' ', 0, (v:foldlevel - 1)).substitute(line,'\s*{\+\s*', '', '') return line endfunction ">>> " s:DoSetup() <<< " Ensure everything is set up function! s:DoSetup() setlocal foldenable foldmethod=marker foldmarker={,} commentstring=%s foldcolumn=0 nonumber noswapfile shiftwidth=1 setlocal foldtext=ProjFoldText() nobuflisted nowrap setlocal winwidth=1 if match(g:proj_flags, '\Cn') != -1 setlocal number endif endfunction ">>> call s:DoSetup() " Syntax Stuff <<< if match(g:proj_flags, '\Cs')!=-1 && has('syntax') && exists('g:syntax_on') && !has('syntax_items') syntax match projectDescriptionDir '^\s*.\{-}=\s*\(\\ \|\f\|:\|"\)\+' contains=projectDescription,projectWhiteError syntax match projectDescription '\<.\{-}='he=e-1,me=e-1 contained nextgroup=projectDirectory contains=projectWhiteError syntax match projectDescription '{\|}' syntax match projectDirectory '=\(\\ \|\f\|:\)\+' contained syntax match projectDirectory '=".\{-}"' contained syntax match projectScriptinout '\>> " s:SortR(start, end) <<< " Sort lines. SortR() is called recursively. " from ":help eval-examples" by Robert Webb, slightly modified function! s:SortR(start, end) if (a:start >= a:end) return endif let partition = a:start - 1 let middle = partition let partStr = getline((a:start + a:end) / 2) let i = a:start while (i <= a:end) let str = getline(i) if str < partStr let result = -1 elseif str > partStr let result = 1 else let result = 0 endif if (result <= 0) let partition = partition + 1 if (result == 0) let middle = partition endif if (i != partition) let str2 = getline(partition) call setline(i, str2) call setline(partition, str) endif endif let i = i + 1 endwhile if (middle != partition) let str = getline(middle) let str2 = getline(partition) call setline(middle, str2) call setline(partition, str) endif call s:SortR(a:start, partition - 1) call s:SortR(partition + 1, a:end) endfunc ">>> " s:IsAbsolutePath(path) <<< " Returns true if filename has an absolute path. function! s:IsAbsolutePath(path) if a:path =~ '^ftp:' || a:path =~ '^rcp:' || a:path =~ '^scp:' || a:path =~ '^http:' return 2 endif if a:path =~ '\$' let path=expand(a:path) " Expand any environment variables that might be in the path else let path=a:path endif if path[0] == '/' || path[0] == '~' || path[0] == '\\' || path[1] == ':' return 1 endif return 0 endfunction " >>> " s:DoSetupAndSplit() <<< " Call DoSetup to ensure the settings are correct. Split to the next " file. function! s:DoSetupAndSplit() call s:DoSetup() " Ensure that all the settings are right let n = winnr() " Determine if there is a CTRL_W-p window silent! wincmd p if n == winnr() silent! wincmd l endif if n == winnr() " If n == winnr(), then there is no CTRL_W-p window " So we have to create a new one if bufnr('%') == g:proj_running exec 'silent vertical new' else exec 'silent vertical split | silent! bnext' endif wincmd p " Go back to the Project Window and ensure it is the right width exec b:proj_locate_command exec b:proj_resize_command wincmd p endif endfunction ">>> " s:DoSetupAndSplit_au() <<< " Same as above but ensure that the Project window is the current " window. Only called from an autocommand function! s:DoSetupAndSplit_au() if winbufnr(0) != g:proj_running return endif call s:DoSetup() " Ensure that all the settings are right if winbufnr(2) == -1 " We're the only window right now. exec 'silent vertical split | bnext' if bufnr('%') == g:proj_running enew endif if bufnr('%') == g:proj_last_buffer | bnext | bprev | bnext | endif wincmd p " Go back to the Project Window and ensure it is the right width exec b:proj_locate_command exec b:proj_resize_command elseif(winnr() != 1) exec b:proj_locate_command exec b:proj_resize_command endif endfunction function! s:RecordPrevBuffer_au() let g:proj_last_buffer = bufnr('%') endfunction ">>> " s:RecursivelyConstructDirectives(lineno) <<< " Construct the inherited directives function! s:RecursivelyConstructDirectives(lineno) let lineno=s:FindFoldTop(a:lineno) let foldlineno = lineno let foldlev=foldlevel(lineno) let parent_infoline = '' if foldlev > 1 while foldlevel(lineno) >= foldlev " Go to parent fold if lineno < 1 echoerr 'Some kind of fold error. Check your syntax.' return endif let lineno = lineno - 1 endwhile let parent_infoline = s:RecursivelyConstructDirectives(lineno) endif let parent_home = s:GetHome(parent_infoline, '') let parent_c_d = s:GetCd(parent_infoline, parent_home) let parent_scriptin = s:GetScriptin(parent_infoline, parent_home) let parent_scriptout = s:GetScriptout(parent_infoline, parent_home) let parent_filter = s:GetFilter(parent_infoline, '*') let infoline = getline(foldlineno) " Extract the home directory of this fold let home=s:GetHome(infoline, parent_home) if home != '' if (foldlevel(foldlineno) == 1) && !s:IsAbsolutePath(home) call confirm('Outermost Project Fold must have absolute path! Or perhaps the path does not exist.', "&OK", 1) let home = '~' " Some 'reasonable' value endif endif " Extract any CD information let c_d = s:GetCd(infoline, home) if c_d != '' if (foldlevel(foldlineno) == 1) && !s:IsAbsolutePath(c_d) call confirm('Outermost Project Fold must have absolute CD path! Or perhaps the path does not exist.', "&OK", 1) let c_d = '.' " Some 'reasonable' value endif else let c_d=parent_c_d endif " Extract scriptin let scriptin = s:GetScriptin(infoline, home) if scriptin == '' let scriptin = parent_scriptin endif " Extract scriptout let scriptout = s:GetScriptout(infoline, home) if scriptout == '' let scriptout = parent_scriptout endif " Extract filter let filter = s:GetFilter(infoline, parent_filter) if filter == '' | let filter = parent_filter | endif return s:ConstructInfo(home, c_d, scriptin, scriptout, '', filter) endfunction ">>> " s:ConstructInfo(home, c_d, scriptin, scriptout, flags, filter) <<< function! s:ConstructInfo(home, c_d, scriptin, scriptout, flags, filter) let retval='Directory='.a:home if a:c_d[0] != '' let retval=retval.' CD='.a:c_d endif if a:scriptin[0] != '' let retval=retval.' in='.a:scriptin endif if a:scriptout[0] != '' let retval=retval.' out='.a:scriptout endif if a:filter[0] != '' let retval=retval.' filter="'.a:filter.'"' endif return retval endfunction ">>> " s:OpenEntry(line, precmd, editcmd) <<< " Get the filename under the cursor, and open a window with it. function! s:OpenEntry(line, precmd, editcmd, dir) silent exec a:precmd if (a:editcmd[0] != '') if a:dir let fname='.' else if (foldlevel(a:line) == 0) && (a:editcmd[0] != '') return 0 " If we're outside a fold, do nothing endif let fname=substitute(getline(a:line), '\s*#.*', '', '') " Get rid of comments and whitespace before comment let fname=substitute(fname, '^\s*\(.*\)', '\1', '') " Get rid of leading whitespace if strlen(fname) == 0 return 0 " The line is blank. Do nothing. endif endif else let fname='.' endif let infoline = s:RecursivelyConstructDirectives(a:line) let retval=s:OpenEntry2(a:line, infoline, fname, a:editcmd) call s:DisplayInfo() return retval endfunction ">>> " s:OpenEntry2(line, infoline, precmd, editcmd) <<< " Get the filename under the cursor, and open a window with it. function! s:OpenEntry2(line, infoline, fname, editcmd) let fname=escape(a:fname, ' %#') " Thanks to Thomas Link for cluing me in on % and # let home=s:GetHome(a:infoline, '').'/' if home=='/' echoerr 'Project structure error. Check your syntax.' return endif "Save the cd command let cd_cmd = b:proj_cd_cmd if a:editcmd[0] != '' " If editcmd is '', then just set up the environment in the Project Window call s:DoSetupAndSplit() " If it is an absolute path, don't prepend home if !s:IsAbsolutePath(fname) let fname=home.fname endif if s:IsAbsolutePath(fname) == 2 exec a:editcmd.' '.fname else silent exec 'silent '.a:editcmd.' '.fname endif else " only happens in the Project File exec 'au! BufEnter,BufLeave '.expand('%:p') endif " Extract any CD information let c_d = s:GetCd(a:infoline, home) if c_d != '' && (s:IsAbsolutePath(home) != 2) if match(g:proj_flags, '\CL') != -1 call s:SetupAutoCommand(c_d) endif if !isdirectory(glob(c_d)) call confirm("From this fold's entry,\nCD=".'"'.c_d.'" is not a valid directory.', "&OK", 1) else silent exec cd_cmd.' '.c_d endif endif " Extract any scriptin information let scriptin = s:GetScriptin(a:infoline, home) if scriptin != '' if !filereadable(glob(scriptin)) call confirm('"'.scriptin.'" not found. Ignoring.', "&OK", 1) else call s:SetupScriptAutoCommand('BufEnter', scriptin) exec 'source '.scriptin endif endif let scriptout = s:GetScriptout(a:infoline, home) if scriptout != '' if !filereadable(glob(scriptout)) call confirm('"'.scriptout.'" not found. Ignoring.', "&OK", 1) else call s:SetupScriptAutoCommand('BufLeave', scriptout) endif endif return 1 endfunction ">>> " s:DoFoldOrOpenEntry(cmd0, cmd1) <<< " Used for double clicking. If the mouse is on a fold, open/close it. If " not, try to open the file. function! s:DoFoldOrOpenEntry(cmd0, cmd1) if getline('.')=~'{\|}' || foldclosed('.') != -1 normal! za else call s:DoEnsurePlacementSize_au() call s:OpenEntry(line('.'), a:cmd0, a:cmd1, 0) if (match(g:proj_flags, '\Cc') != -1) let g:proj_mywinnumber = winbufnr(0) Project hide if(g:proj_mywinnumber != winbufnr(0)) wincmd p endif wincmd = endif endif endfunction ">>> " s:VimDirListing(filter, padding, separator, filevariable, filecount, dirvariable, dircount) <<< function! s:VimDirListing(filter, padding, separator, filevariable, filecount, dirvariable, dircount) let end = 0 let files='' let filter = a:filter " Chop up the filter " Apparently glob() cannot take something like this: glob('*.c *.h') let while_var = 1 while while_var let end = stridx(filter, ' ') if end == -1 let end = strlen(filter) let while_var = 0 endif let single=glob(strpart(filter, 0, end)) if strlen(single) != 0 let files = files.single."\010" endif let filter = strpart(filter, end + 1) endwhile " files now contains a list of everything in the directory. We need to " weed out the directories. let fnames=files let {a:filevariable}='' let {a:dirvariable}='' let {a:filecount}=0 let {a:dircount}=0 while strlen(fnames) > 0 let fname = substitute(fnames, '\(\(\f\|[ :\[\]]\)*\).*', '\1', '') let fnames = substitute(fnames, '\(\f\|[ :\[\]]\)*.\(.*\)', '\2', '') if isdirectory(glob(fname)) let {a:dirvariable}={a:dirvariable}.a:padding.fname.a:separator let {a:dircount}={a:dircount} + 1 else let {a:filevariable}={a:filevariable}.a:padding.fname.a:separator let {a:filecount}={a:filecount} + 1 endif endwhile endfunction ">>> " s:GenerateEntry(recursive, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) <<< function! s:GenerateEntry(recursive, line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) let line=a:line if a:dir =~ '\\ ' let dir='"'.substitute(a:dir, '\\ ', ' ', 'g').'"' else let dir=a:dir endif let spaces=strpart(' ', 0, a:foldlev) let c_d=(strlen(a:c_d) > 0) ? 'CD='.a:c_d.' ' : '' let c_d=(strlen(a:filter_directive) > 0) ? c_d.'filter="'.a:filter_directive.'" ': c_d call append(line, spaces.'}') call append(line, spaces.a:name.'='.dir.' '.c_d.'{') if a:recursive exec 'cd '.a:absolute_dir call s:VimDirListing("*", '', "\010", 'b:files', 'b:filecount', 'b:dirs', 'b:dircount') cd - let dirs=b:dirs let dcount=b:dircount unlet b:files b:filecount b:dirs b:dircount while dcount > 0 let dname = substitute(dirs, '\(\( \|\f\|:\)*\).*', '\1', '') let edname = escape(dname, ' ') let dirs = substitute(dirs, '\( \|\f\|:\)*.\(.*\)', '\2', '') let line=s:GenerateEntry(1, line + 1, dname, a:absolute_dir.'/'.edname, edname, '', '', a:filter, a:foldlev+1, a:sort) let dcount=dcount-1 endwhile endif return line+1 endfunction " >>> " s:DoEntryFromDir(line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) <<< " Generate the fold from the directory hierarchy (if recursive), then " fill it in with RefreshEntriesFromDir() function! s:DoEntryFromDir(recursive, line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) call s:GenerateEntry(a:recursive, a:line, a:name, escape(a:absolute_dir, ' '), escape(a:dir, ' '), escape(a:c_d, ' '), a:filter_directive, a:filter, a:foldlev, a:sort) normal! j call s:RefreshEntriesFromDir(1) endfunction ">>> " s:CreateEntriesFromDir(recursive) <<< " Prompts user for information and then calls s:DoEntryFromDir() function! s:CreateEntriesFromDir(recursive) " Save a mark for the current cursor position normal! mk let line=line('.') let name = inputdialog('Enter the Name of the Entry: ') if strlen(name) == 0 return endif let foldlev=foldlevel(line) if (foldclosed(line) != -1) || (getline(line) =~ '}') let foldlev=foldlev - 1 endif let absolute = (foldlev <= 0)?'Absolute ': '' let home='' let filter='*' if (match(g:proj_flags, '\Cb') != -1) && has('browse') " Note that browse() is inconsistent: On Win32 you can't select a " directory, and it gives you a relative path. let dir = browse(0, 'Enter the '.absolute.'Directory to Load: ', '', '') let dir = fnamemodify(dir, ':p') else let dir = inputdialog('Enter the '.absolute.'Directory to Load: ', '') endif if (dir[strlen(dir)-1] == '/') || (dir[strlen(dir)-1] == '\\') let dir=strpart(dir, 0, strlen(dir)-1) " Remove trailing / or \ endif let dir = substitute(dir, '^\~', $HOME, 'g') if (foldlev > 0) let parent_directive=s:RecursivelyConstructDirectives(line) let filter = s:GetFilter(parent_directive, '*') let home=s:GetHome(parent_directive, '') if home[strlen(home)-1] != '/' && home[strlen(home)-1] != '\\' let home=home.'/' endif unlet parent_directive if s:IsAbsolutePath(dir) " It is not a relative path Try to make it relative let hend=matchend(dir, '\C'.glob(home)) if hend != -1 let dir=strpart(dir, hend) " The directory can be a relative path else let home="" endif endif endif if strlen(home.dir) == 0 return endif if !isdirectory(home.dir) if has("unix") silent exec '!mkdir '.home.dir.' > /dev/null' else call confirm('"'.home.dir.'" is not a valid directory.', "&OK", 1) return endif endif let c_d = inputdialog('Enter the CD parameter: ', '') let filter_directive = inputdialog('Enter the File Filter: ', '') if strlen(filter_directive) != 0 let filter = filter_directive endif " If I'm on a closed fold, go to the bottom of it if foldclosedend(line) != -1 let line = foldclosedend(line) endif let foldlev = foldlevel(line) " If we're at the end of a fold . . . if getline(line) =~ '}' let foldlev = foldlev - 1 " . . . decrease the indentation by 1. endif " Do the work call s:DoEntryFromDir(a:recursive, line, name, home.dir, dir, c_d, filter_directive, filter, foldlev, 0) " Restore the cursor position normal! `k endfunction ">>> " s:RefreshEntriesFromDir(recursive) <<< " Finds metadata at the top of the fold, and then replaces all files " with the contents of the directory. Works recursively if recursive is 1. function! s:RefreshEntriesFromDir(recursive) if foldlevel('.') == 0 echo 'Nothing to refresh.' return endif " Open the fold. if getline('.') =~ '}' normal! zo[z else normal! zo]z[z endif let just_a_fold=0 let infoline = s:RecursivelyConstructDirectives(line('.')) let immediate_infoline = getline('.') if strlen(substitute(immediate_infoline, '[^=]*=\(\(\f\|:\|\\ \)*\).*', '\1', '')) == strlen(immediate_infoline) let just_a_fold = 1 endif " Extract the home directory of the fold let home = s:GetHome(infoline, '') if home == '' " No Match. This means that this is just a label with no " directory entry. if a:recursive == 0 return " We're done--nothing to do endif " Mark that it is just a fold, so later we don't delete filenames " that aren't there. let just_a_fold = 1 endif if just_a_fold == 0 " Extract the filter between quotes (we don't care what CD is). let filter = s:GetFilter(infoline, '*') " Extract the description (name) of the fold let name = substitute(infoline, '^[#\t ]*\([^=]*\)=.*', '\1', '') if strlen(name) == strlen(infoline) return " If there's no name, we're done. endif if (home == '') || (name == '') return endif " Extract the flags let flags = s:GetFlags(immediate_infoline) let sort = (match(g:proj_flags, '\CS') != -1) if flags != '' if match(flags, '\Cr') != -1 " If the flags do not contain r (refresh), then treat it just " like a fold let just_a_fold = 1 endif if match(flags, '\CS') != -1 let sort = 1 endif if match(flags, '\Cs') != -1 let sort = 0 endif else let flags='' endif endif " Move to the first non-fold boundary line normal! j " Delete filenames until we reach the end of the fold while getline('.') !~ '}' if line('.') == line('$') break endif if getline('.') !~ '{' " We haven't reached a sub-fold, so delete what's there. if (just_a_fold == 0) && (getline('.') !~ '^\s*#') && (getline('.') !~ '#.*pragma keep') d _ else " Skip lines only in a fold and comment lines normal! j endif else " We have reached a sub-fold. If we're doing recursive, then " call this function again. If not, find the end of the fold. if a:recursive == 1 call s:RefreshEntriesFromDir(1) normal! ]zj else if foldclosed('.') == -1 normal! zc endif normal! j endif endif endwhile if just_a_fold == 0 " We're not just in a fold, and we have deleted all the filenames. " Now it is time to regenerate what is in the directory. if !isdirectory(glob(home)) call confirm('"'.home.'" is not a valid directory.', "&OK", 1) else let foldlev=foldlevel('.') " T flag. Thanks Tomas Z. if (match(flags, '\Ct') != -1) || ((match(g:proj_flags, '\CT') == -1) && (match(flags, '\CT') == -1)) " Go to the top of the fold (force other folds to the " bottom) normal! [z normal! j " Skip any comments while getline('.') =~ '^\s*#' normal! j endwhile endif normal! k let cwd=getcwd() let spaces=strpart(' ', 0, foldlev) exec 'cd '.home if match(g:proj_flags, '\Ci') != -1 echon home."\r" endif call s:VimDirListing(filter, spaces, "\n", 'b:files', 'b:filecount', 'b:dirs', 'b:dircount') if b:filecount > 0 normal! mk silent! put =b:files normal! `kj if sort call s:SortR(line('.'), line('.') + b:filecount - 1) endif else normal! j endif unlet b:files b:filecount b:dirs b:dircount exec 'cd '.cwd endif endif " Go to the top of the refreshed fold. normal! [z endfunction ">>> " s:MoveUp() <<< " Moves the entity under the cursor up a line. function! s:MoveUp() let lineno=line('.') if lineno == 1 return endif let fc=foldclosed('.') let a_reg=@a if lineno == line('$') normal! "add"aP else normal! "addk"aP endif let @a=a_reg if fc != -1 normal! zc endif endfunction ">>> " s:MoveDown() <<< " Moves the entity under the cursor down a line. function! s:MoveDown() let fc=foldclosed('.') let a_reg=@a normal! "add"ap let @a=a_reg if (fc != -1) && (foldclosed('.') == -1) normal! zc endif endfunction " >>> " s:DisplayInfo() <<< " Displays filename and current working directory when i (info) is in " the flags. function! s:DisplayInfo() if match(g:proj_flags, '\Ci') != -1 echo 'file: '.expand('%').', cwd: '.getcwd().', lines: '.line('$') endif endfunction ">>> " s:SetupAutoCommand(cwd) <<< " Sets up an autocommand to ensure that the cwd is set to the one " desired for the fold regardless. :lcd only does this on a per-window " basis, not a per-buffer basis. function! s:SetupAutoCommand(cwd) if !exists("b:proj_has_autocommand") let b:proj_cwd_save = escape(getcwd(), ' ') let b:proj_has_autocommand = 1 let bufname=escape(substitute(expand('%:p', 0), '\\', '/', 'g'), ' ') exec 'au BufEnter '.bufname." let b:proj_cwd_save=escape(getcwd(), ' ') | cd ".a:cwd exec 'au BufLeave '.bufname.' exec "cd ".b:proj_cwd_save' exec 'au BufWipeout '.bufname.' au! * '.bufname endif endfunction ">>> " s:SetupScriptAutoCommand(bufcmd, script) <<< " Sets up an autocommand to run the scriptin script. function! s:SetupScriptAutoCommand(bufcmd, script) if !exists("b:proj_has_".a:bufcmd) let b:proj_has_{a:bufcmd} = 1 exec 'au '.a:bufcmd.' '.escape(substitute(expand('%:p', 0), '\\', '/', 'g'), ' ').' source '.a:script endif endfunction " >>> " s:DoEnsurePlacementSize_au() <<< " Ensure that the Project window is on the left of the window and has " the correct size. Only called from an autocommand function! s:DoEnsurePlacementSize_au() if (winbufnr(0) != g:proj_running) || (winnr() != 1) if exists("g:proj_doinghelp") if g:proj_doinghelp > 0 let g:proj_doinghelp = g:proj_doinghelp - 1 return endif unlet g:proj_doinghelp return endif exec b:proj_locate_command endif exec b:proj_resize_command endfunction ">>> " s:Spawn(number) <<< " Spawn an external command on the file function! s:Spawn(number) echo | if exists("g:proj_run".a:number) let fname=getline('.') if fname!~'{\|}' let fname=substitute(fname, '\s*#.*', '', '') let fname=substitute(fname, '^\s*\(.*\)\s*', '\1', '') if fname == '' | return | endif let parent_infoline = s:RecursivelyConstructDirectives(line('.')) let home=expand(s:GetHome(parent_infoline, '')) let c_d=expand(s:GetCd(parent_infoline, '')) let command=substitute(g:proj_run{a:number}, '%%', "\010", 'g') let command=substitute(command, '%f', escape(home.'/'.fname, '\'), 'g') let command=substitute(command, '%F', substitute(escape(home.'/'.fname, '\'), ' ', '\\\\ ', 'g'), 'g') let command=substitute(command, '%s', escape(home.'/'.fname, '\'), 'g') let command=substitute(command, '%n', escape(fname, '\'), 'g') let command=substitute(command, '%N', substitute(fname, ' ', '\\\\ ', 'g'), 'g') let command=substitute(command, '%h', escape(home, '\'), 'g') let command=substitute(command, '%H', substitute(escape(home, '\'), ' ', '\\\\ ', 'g'), 'g') if c_d != '' if c_d == home let percent_r='.' else let percent_r=substitute(home, escape(c_d.'/', '\'), '', 'g') endif else let percent_r=home endif let command=substitute(command, '%r', percent_r, 'g') let command=substitute(command, '%R', substitute(percent_r, ' ', '\\\\ ', 'g'), 'g') let command=substitute(command, '%d', escape(c_d, '\'), 'g') let command=substitute(command, '%D', substitute(escape(c_d, '\'), ' ', '\\\\ ', 'g'), 'g') let command=substitute(command, "\010", '%', 'g') exec command endif endif endfunction ">>> " s:ListSpawn(varnamesegment) <<< " List external commands function! s:ListSpawn(varnamesegment) let number = 1 while number < 10 if exists("g:proj_run".a:varnamesegment.number) echohl LineNr | echo number.':' | echohl None | echon ' '.substitute(escape(g:proj_run{a:varnamesegment}{number}, '\'), "\n", '\\n', 'g') else echohl LineNr | echo number.':' | echohl None endif let number=number + 1 endwhile endfunction ">>> " s:FindFoldTop(line) <<< " Return the line number of the directive line function! s:FindFoldTop(line) let lineno=a:line if getline(lineno) =~ '}' let lineno = lineno - 1 endif while getline(lineno) !~ '{' && lineno > 1 if getline(lineno) =~ '}' let lineno=s:FindFoldTop(lineno) endif let lineno = lineno - 1 endwhile return lineno endfunction ">>> " s:FindFoldBottom(line) <<< " Return the line number of the directive line function! s:FindFoldBottom(line) let lineno=a:line if getline(lineno) =~ '{' let lineno=lineno + 1 endif while getline(lineno) !~ '}' && lineno < line('$') if getline(lineno) =~ '{' let lineno=s:FindFoldBottom(lineno) endif let lineno = lineno + 1 endwhile return lineno endfunction ">>> " s:LoadAll(recurse, line) <<< " Load all files in a project function! s:LoadAll(recurse, line) let b:loadcount=0 function! s:SpawnExec(infoline, fname, lineno, data) if s:OpenEntry2(a:lineno, a:infoline, a:fname, 'e') wincmd p let b:loadcount=b:loadcount+1 echon b:loadcount."\r" if getchar(0) != 0 let b:stop_everything=1 endif endif endfunction call Project_ForEach(a:recurse, line('.'), "*SpawnExec", 0, '^\(.*l\)\@!') delfunction s:SpawnExec echon b:loadcount." Files Loaded\r" unlet b:loadcount if exists("b:stop_everything") | unlet b:stop_everything | endif endfunction ">>> " s:WipeAll(recurse, line) <<< " Wipe all files in a project function! s:WipeAll(recurse, line) let b:wipecount=0 let b:totalcount=0 function! s:SpawnExec(home, c_d, fname, lineno, data) let fname=escape(a:fname, ' ') if s:IsAbsolutePath(fname) let fname=fnamemodify(fname, ':n') " :n is coming, won't break anything now else let fname=fnamemodify(a:home.'/'.fname, ':n') " :n is coming, won't break anything now endif let b:totalcount=b:totalcount+1 let fname=substitute(fname, '^\~', $HOME, 'g') if bufloaded(substitute(fname, '\\ ', ' ', 'g')) if getbufvar(fname.'\>', '&modified') == 1 exec 'sb '.fname wincmd L w wincmd p endif let b:wipecount=b:wipecount+1 exec 'bwipe! '.fname endif if b:totalcount % 5 == 0 echon b:wipecount.' of '.b:totalcount."\r" redraw endif if getchar(0) != 0 let b:stop_everything=1 endif endfunction call Project_ForEach(a:recurse, line('.'), "SpawnExec", 0, '^\(.*w\)\@!') delfunction s:SpawnExec echon b:wipecount.' of '.b:totalcount." Files Wiped\r" unlet b:wipecount b:totalcount if exists("b:stop_everything") | unlet b:stop_everything | endif endfunction ">>> " s:LoadAllSplit(recurse, line) <<< " Load all files in a project using split windows. " Contributed by A. Harrison function! s:LoadAllSplit(recurse, line) let b:loadcount=0 function! s:SpawnExec(infoline, fname, lineno, data) let winNr = winnr() "get ProjectWindow number if s:OpenEntry2(a:lineno, a:infoline, a:fname, 'sp') exec winNr."wincmd w" let b:loadcount=b:loadcount+1 echon b:loadcount."\r" if getchar(0) != 0 let b:stop_everything=1 endif endif endfunction call Project_ForEach(a:recurse, line('.'), "*SpawnExec", 0, '^\(.*l\)\@!') delfunction s:SpawnExec echon b:loadcount." Files Loaded\r" unlet b:loadcount if exists("b:stop_everything") | unlet b:stop_everything | endif endfunction ">>> " s:GrepAll(recurse, lineno, pattern) <<< " Grep all files in a project, optionally recursively function! s:GrepAll(recurse, lineno, pattern) cunmap help let pattern=(a:pattern[0] == '')?input("GREP options and pattern: "):a:pattern cnoremap help let g:proj_doinghelp = 1:help if pattern[0] == '' return endif let b:escape_spaces=1 let fnames=Project_GetAllFnames(a:recurse, a:lineno, ' ') unlet b:escape_spaces cclose " Make sure grep window is closed call s:DoSetupAndSplit() if match(g:proj_flags, '\Cv') == -1 silent! exec 'silent! grep '.pattern.' '.fnames if v:shell_error != 0 echo 'GREP error. Perhaps there are too many filenames.' else copen endif else silent! exec 'silent! vimgrep '.pattern.' '.fnames copen endif endfunction ">>> " GetXXX Functions <<< function! s:GetHome(info, parent_home) " Thanks to Adam Montague for pointing out the need for @ in urls. let home=substitute(a:info, '^[^=]*=\(\(\\ \|\f\|:\|@\)\+\).*', '\1', '') if strlen(home) == strlen(a:info) let home=substitute(a:info, '.\{-}"\(.\{-}\)".*', '\1', '') if strlen(home) != strlen(a:info) | let home=escape(home, ' ') | endif endif if strlen(home) == strlen(a:info) let home=a:parent_home elseif home=='.' let home=a:parent_home elseif !s:IsAbsolutePath(home) let home=a:parent_home.'/'.home endif return home endfunction function! s:GetFilter(info, parent_filter) let filter = substitute(a:info, '.*\>> " Project_GetAllFnames(recurse, lineno, separator) <<< " Grep all files in a project, optionally recursively function! Project_GetAllFnames(recurse, lineno, separator) let b:fnamelist='' function! s:SpawnExec(home, c_d, fname, lineno, data) if exists('b:escape_spaces') let fname=escape(a:fname, ' ') else let fname=a:fname endif if !s:IsAbsolutePath(a:fname) let fname=a:home.'/'.fname endif let b:fnamelist=b:fnamelist.a:data.fname endfunction call Project_ForEach(a:recurse, line('.'), "SpawnExec", a:separator, '') delfunction s:SpawnExec let retval=b:fnamelist unlet b:fnamelist return retval endfunction ">>> " Project_GetAllFnames(recurse, lineno, separator) <<< " Grep all files in a project, optionally recursively function! Project_GetFname(line) if (foldlevel(a:line) == 0) return '' endif let fname=substitute(getline(a:line), '\s*#.*', '', '') " Get rid of comments and whitespace before comment let fname=substitute(fname, '^\s*\(.*\)', '\1', '') " Get rid of leading whitespace if strlen(fname) == 0 return '' " The line is blank. Do nothing. endif if s:IsAbsolutePath(fname) return fname endif let infoline = s:RecursivelyConstructDirectives(a:line) return s:GetHome(infoline, '').'/'.fname endfunction ">>> " Project_ForEach(recurse, lineno, cmd, data, match) <<< " Grep all files in a project, optionally recursively function! Project_ForEach(recurse, lineno, cmd, data, match) let info=s:RecursivelyConstructDirectives(a:lineno) let lineno=s:FindFoldTop(a:lineno) + 1 let flags=s:GetFlags(getline(lineno - 1)) if (flags == '') || (a:match=='') || (match(flags, a:match) != -1) call s:Project_ForEachR(a:recurse, lineno, info, a:cmd, a:data, a:match) endif endfunction function! s:Project_ForEachR(recurse, lineno, info, cmd, data, match) let home=s:GetHome(a:info, '') let c_d=s:GetCd(a:info, home) let scriptin = s:GetScriptin(a:info, home) let scriptout = s:GetScriptout(a:info, home) let filter = s:GetFilter(a:info, '') let lineno = a:lineno let curline=getline(lineno) while (curline !~ '}') && (curline < line('$')) if exists("b:stop_everything") && b:stop_everything | return 0 | endif if curline =~ '{' if a:recurse let flags=s:GetFlags(curline) if (flags == '') || (a:match=='') || (match(flags, a:match) != -1) let this_home=s:GetHome(curline, home) let this_cd=s:GetCd(curline, this_home) if this_cd=='' | let this_cd=c_d | endif let this_scriptin=s:GetScriptin(curline, this_home) if this_scriptin == '' | let this_scriptin=scriptin | endif let this_scriptout=s:GetScriptin(curline, this_home) if this_scriptout == '' | let this_scriptout=scriptout | endif let this_filter=s:GetFilter(curline, filter) let lineno=s:Project_ForEachR(1, lineno+1, \s:ConstructInfo(this_home, this_cd, this_scriptin, this_scriptout, flags, this_filter), a:cmd, a:data, a:match) else let lineno=s:FindFoldBottom(lineno) endif else let lineno=s:FindFoldBottom(lineno) endif else let fname=substitute(curline, '\s*#.*', '', '') let fname=substitute(fname, '^\s*\(.*\)', '\1', '') if (strlen(fname) != strlen(curline)) && (fname[0] != '') if a:cmd[0] == '*' call {strpart(a:cmd, 1)}(a:info, fname, lineno, a:data) else call {a:cmd}(home, c_d, fname, lineno, a:data) endif endif endif let lineno=lineno + 1 let curline=getline(lineno) endwhile return lineno endfunction ">>> " s:SpawnAll(recurse, number) <<< " Spawn an external command on the files of a project function! s:SpawnAll(recurse, number) echo | if exists("g:proj_run_fold".a:number) if g:proj_run_fold{a:number}[0] == '*' function! s:SpawnExec(home, c_d, fname, lineno, data) let command=substitute(strpart(g:proj_run_fold{a:data}, 1), '%s', escape(a:fname, ' \'), 'g') let command=substitute(command, '%f', escape(a:fname, '\'), 'g') let command=substitute(command, '%h', escape(a:home, '\'), 'g') let command=substitute(command, '%d', escape(a:c_d, '\'), 'g') let command=substitute(command, '%F', substitute(escape(a:fname, '\'), ' ', '\\\\ ', 'g'), 'g') exec command endfunction call Project_ForEach(a:recurse, line('.'), "SpawnExec", a:number, '.') delfunction s:SpawnExec else let info=s:RecursivelyConstructDirectives(line('.')) let home=s:GetHome(info, '') let c_d=s:GetCd(info, '') let b:escape_spaces=1 let fnames=Project_GetAllFnames(a:recurse, line('.'), ' ') unlet b:escape_spaces let command=substitute(g:proj_run_fold{a:number}, '%f', substitute(escape(fnames, '\'), '\\ ', ' ', 'g'), 'g') let command=substitute(command, '%s', escape(fnames, '\'), 'g') let command=substitute(command, '%h', escape(home, '\'), 'g') let command=substitute(command, '%d', escape(c_d, '\'), 'g') let command=substitute(command, '%F', escape(fnames, '\'), 'g') exec command if v:shell_error != 0 echo 'Shell error. Perhaps there are too many filenames.' endif endif endif endfunction ">>> if !exists("g:proj_running") " s:DoProjectOnly(void) <<< " Make the file window the only one. function! s:DoProjectOnly() if winbufnr(0) != g:proj_running let lzsave=&lz set lz only Project silent! wincmd p let &lz=lzsave unlet lzsave endif endfunction " >>> " Mappings <<< nnoremap \|:call DoFoldOrOpenEntry('', 'e') nnoremap \|:call DoFoldOrOpenEntry('', 'sp') nnoremap \|:call DoFoldOrOpenEntry('silent! only', 'e') nnoremap T \|:call DoFoldOrOpenEntry('', 'tabe') nmap s nnoremap S \|:call LoadAllSplit(0, line('.')) nmap o nnoremap i :echo RecursivelyConstructDirectives(line('.')) nnoremap I :echo Project_GetFname(line('.')) nmap p nmap v nnoremap l \|:call LoadAll(0, line('.')) nnoremap L \|:call LoadAll(1, line('.')) nnoremap w \|:call WipeAll(0, line('.')) nnoremap W \|:call WipeAll(1, line('.')) nnoremap W \|:call WipeAll(1, line('.')) nnoremap g \|:call GrepAll(0, line('.'), "") nnoremap G \|:call GrepAll(1, line('.'), "") nnoremap <2-LeftMouse> \|:call DoFoldOrOpenEntry('', 'e') nnoremap \|:call DoFoldOrOpenEntry('', 'sp') nnoremap nnoremap nmap nnoremap nnoremap <3-LeftMouse> nmap nmap <2-RightMouse> nmap <3-RightMouse> nmap <4-RightMouse> nnoremap \|:silent exec 'vertical resize '.(match(g:proj_flags, '\Ct')!=-1 && winwidth('.') > g:proj_window_width?(g:proj_window_width):(winwidth('.') + g:proj_window_increment)) nnoremap \|:silent call MoveUp() nnoremap \|:silent call MoveDown() nmap nmap let k=1 while k < 10 exec 'nnoremap '.k.' \|:call Spawn('.k.')' exec 'nnoremap f'.k.' \|:call SpawnAll(0, '.k.')' exec 'nnoremap F'.k.' \|:call SpawnAll(1, '.k.')' let k=k+1 endwhile nnoremap 0 \|:call ListSpawn("") nnoremap f0 \|:call ListSpawn("_fold") nnoremap F0 \|:call ListSpawn("_fold") nnoremap c :call CreateEntriesFromDir(0) nnoremap C :call CreateEntriesFromDir(1) nnoremap r :call RefreshEntriesFromDir(0) nnoremap R :call RefreshEntriesFromDir(1) " For Windows users: same as \R nnoremap :call RefreshEntriesFromDir(1) nnoremap e :call OpenEntry(line('.'), '', '', 0) nnoremap E :call OpenEntry(line('.'), '', 'e', 1) " The :help command stomps on the Project Window. Try to avoid that. " This is not perfect, but it is alot better than without the mappings. cnoremap help let g:proj_doinghelp = 1:help nnoremap :let g:proj_doinghelp = 1 " This is to avoid changing the buffer, but it is not fool-proof. nnoremap "nnoremap SourceForge.net Logo vim-scripts-20130814ubuntu1/html/plugin_gnupg.vim.html0000644000000000000000000004631712204336073017605 0ustar gnupg.vim - Plugin for transparent editing of gpg encrypted files. : vim online
    sponsor Vim development Vim logo Vim Book Ad

gnupg.vim : Plugin for transparent editing of gpg encrypted files.

 script karma  Rating 196/62, Downloaded by 3150    Comments, bugs, improvements  Vim wiki

created by
James McCoy
 
script type
utility
 
description
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.

This is a continuation of the work initially done by Markus Braun in vimscript #661.  Development takes place at https://github.com/jamessan/vim-gnupg.

Commands:

  :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:

  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.

  g:GPGUsePipes
    If set to 1, use pipes instead of temporary files when interacting with
    gnupg.  When set to 1, this can cause terminal-based gpg agents to not
    display correctly when prompting for passwords.  Defaults to 0.

  g:GPGHomedir
    If set, specifies the directory that will be used for GPG's homedir.  This
    corresponds to gpg's --homedir option.  This variable is a Vim string.

Known Issues:

  In some cases gvim can't decrypt 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.
 
install details
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 output 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.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
gnupg.vim 2.5 2012-06-01 7.2 James McCoy * Ignore keys that aren't usable for encryption instead of simply ones that are expired
gnupg.vim 2.4 2012-05-31 7.2 James McCoy * Improvements when an encrypted file is being '":read" into another buffer.
** Don't wipeout the current buffer if decryption fails.
** Use the current buffer's settings for 'swapfile' and 'undofile' instead of disabling them.
* Make 'u' a no-op immediately after loading the file, just like with normal files.
* Avoid prompting for disambiguation of keys once the user has selected which one to use.
* Ignore expired keys when trying to find a matching key for an id entered in ":GPGEditRecipients"
gnupg.vim 2.3 2011-11-23 7.2 James McCoy * Resolve the filename when saving to follow symlinks.
* Add support for specifying an alternate --homedir, using the g:GPGHomedir variable
gnupg.vim 2.2 2011-08-13 7.0 James McCoy Correctly handle the different keyid-format options
gnupg.vim 2.1 2011-08-10 7.2 James McCoy Add g:GPGUsePipes variable to avoid saving unencrypted data to tempfiles (in a private directory)
gnupg.vim 2.0 2011-06-26 7.2 James McCoy Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_Align.vim.html0000644000000000000000000004041012204336073017503 0ustar Align - Provides commands and maps to help produce aligned text, eqns, declarations, etc : vim online
    sponsor Vim development Vim logo Vim Book Ad

Align : Provides commands and maps to help produce aligned text, eqns, declarations, etc

 script karma  Rating 528/165, Downloaded by 4114

created by
Charles Campbell
 
script type
utility
 
description
Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc.  There are two basic commands provided by this package:

        AlignCtrl options sep1 sep2 sep3 ...
        [range]Align sep1 sep2 sep3 ...

The "sep#" are regular expressions which describe separators that delineate fields; Align will line up the separators. The range may be any Vim range, _including_ visual-blocks.  Align works on lines of  the form:
(ws==whitespace)

    ws-field-ws-sep-ws-field-ws-sep-ws-field-...
    ws-field-ws-sep-ws-field-ws-sep-ws-field-...

Note that white-space (ws) surrounding separators is ignored.

There are several options to help with deciding what to do with initial white space.   By default Align re-uses the first line's initial white space, but one may use AlignCtrl to retain or remove each line's initial white space.

Align handles alignment on multiple separators, not just the first one, and the separators may be the same across the line or different.

The <Align.vim> and <AlignMaps.vim> files are plugins and require vim 6.1 or higher.

EXAMPLES:

:5,10Align =
    Align on '=' signs

:'<,'>Align = + - \* /
    Align on any of the five separator characters shown.
    Note that visual block mode was used to fire off Align.

:AlignCtrl =lp1P1I
    which means:
    = all separators are equivalent
    l fields will be left-justified
    p1 pad one space before each separator
    P1 pad one space after each separator
    I  preserve and apply the first line's leading white space to all
       Align'd lines

:help align
    Gives help for Align

ALIGNMENT CONTROL

Alignment control allows for left or right justification or centering of fields, cyclic (sequentially active) or equivalent (simultaneously active) regular expressions to specify field separators, initial white space control, optional visual-block use (ie. apply Alignment only within a block), user-specified white-space padding about separators, and multiple separators.

MANY ALIGNMENT MAPS

AlignMaps.vim provides a number of maps which make using this package easy.  They typically either apply to the range 'a,. (from mark a to current line) or use the visual-selection (V, v, or ctrl-v selected):

\t=  : align assignments (don't count logic, like == or !=)
\t,  : align on commas
\t|  : align on vertical bars (|)
\tsp : align on whitespace
\tt  : align LaTeX tabular tables

AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments:

\acom : align comments
\adec : align C declarations (one variable per line)
\afnc : align ansi-style C function input arguments
\Htd  : align html tables

To see some examples of this, check out

    http://mysite.verizon.net/astronaut/vim/textab.html#Examples

(the proportional fonts used by most browsers in showing you this page preclude showing the examples here). The help for Align and AlignCtrl also contains many examples.

ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL

Sometimes one wants to align only a subset of text in a range, based on patterns or column extents.  Align supports both types of restrictions!
    
    Visual-block selection may be used to restrict Align to operate only
    within that visual block.
    
    AlignCtrl supports "g" and "v" patterns that restrict Align to
    operate on lines which match (or don't match, respectively) those
    patterns.

NEW STUFF:

There's a number of new AlignCtrl options:
    
    - allows one to skip a separator (treat it as part of a field)
    + repeat the last lrc justification (ex. lr+ == lrrrrrr... )
    : treat the rest of the line as a field; acts as a modifier
      to the last lrc.
    < left-justify the separator
    > right-justify the separator
    | center the separator

These are, except for the ":", cyclic parameters.  In other words, >< is equivalent to ><><><><... .  Thus separators can be of differing lengths (ex.  -\+ as a separator pattern can match -, --, ---, etc and the separators will be left/right/center justified as you wish).

To get some automatic aligning of = in the C and vimL languages, check out script#884 for two ftplugins (which use Align).


Alternative Aligners:
    Gergely Kontra's vimscript#176
    Johannes Zellner's http://www.zellner.org/vim/autoload/
    Mohsin Ahmed's vimtip#570

Thank you for rating Align!

---------------------------------------
DISCUSSION and COMMENTS:
---------------------------------------

Use vimtip#139 for discussion and comments.  Please use email for bugs.  Enjoy!

 
install details
1. Put <Align.tar.gz> in your .vim or _vimfiles directory.
2. gunzip Align.tar.gz
3. tar -oxvf Align.tar

Result: plugin/Align.vim
        plugin/AlignMaps.vim
        doc/Align.txt
4. Fire up vim or gvim, then
     :helptags ..path../.vim/doc
-or- : helptags ..path\_vimfiles\doc
5. Align needs vim v6.1 or later
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
Align.tar.gz 27/31 2005-04-15 6.0 Charles Campbell Align: GetLatestVimScripts/AutoInstall supported
AlignMaps: new map: \\adcom (align declaration-style comments), \\a, now wors across multiple lines with different types, cecutil.vim now used, more number alignment maps (\\aenum, \\aunum)

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo
vim-scripts-20130814ubuntu1/html/plugin_taglist.vim.html0000644000000000000000000010175212204336073020127 0ustar taglist.vim - Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc) : vim online
    sponsor Vim development Vim logo Vim Book Ad

taglist.vim : Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)

 script karma  Rating 10646/3315, Downloaded by 228650    Comments, bugs, improvements  Vim wiki

created by
Yegappan Lakshmanan
 
script type
utility
 
description
The "Tag List" plugin is a source code browser plugin for Vim and
provides an overview of the structure of source code files and allows
you to efficiently browse through source code files for different
programming languages.  You can visit the taglist plugin home page for
more information:

      http://vim-taglist.sourceforge.net

You can subscribe to the taglist mailing list to post your questions
or suggestions for improvement or to report bugs. Visit the following
page for subscribing to the mailing list:

      http://groups.yahoo.com/group/taglist/

For more information about using this plugin, after installing the
taglist plugin, use the ":help taglist" command.
 
install details
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|, |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. Without this step, you cannot jump to the taglist help
    topics.
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.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
taglist_46.zip 4.6 2013-02-27 6.0 Yegappan Lakshmanan 1. Fixed a bug in refreshing the folds in the taglist window when switching between Vim tabs with Tlist_Show_One_File enabled.
2. Update the TlistShowTag command output to display the tag scope.
3. Preserve the alternate file when opening the taglist window.
4. Restore the 'cpo' option value properly when the loading of the plugin is stopped.
5. When the plugin is recursively sourced, don't change the 'cpo' setting to the default value.
6. If a filetype contains multiple file types separated by a dot, then use the first file type.
7. When displaying tag prototypes, trim the output to fit the window width.
8. Add support for some more languages.
9. Disable the 'relativenumber' option for the taglist window.
10. On MS-Windows, use writefile() to generate the temporary batch file instead of the redir command. This fixes a problem in using the generated batch file in multi-byte encoding environments.
taglist_45.zip 4.5 2007-09-21 6.0 Yegappan Lakshmanan Fix an extra space in the check for exctags. Refresh the taglist window
folds after entering a tab. Escape special characters like backslash in
the tag name when saving a session file. Add an internal function to get
and detect file types.
taglist_44.zip 4.4 2007-05-25 6.0 Yegappan Lakshmanan The following fixes are made in this release:
1. If multiple Vim plugins register for the BufEnter autocmd, then sometimes
    the buffer name supplied to the autocmd is incorrect. Use the buffer number
    instead of buffer name in the BufEnter autocmd.
2. Add the filename to the tags menu only for valid file names.
taglist_43.zip 4.3 2007-02-22 6.0 Yegappan Lakshmanan 1. Added support for jumping to a tag/file in a new or existing tab
   from the taglist window (works only with Vim7 and above).
2. Added support for opening a tag in the previous window.
3. With the Tlist_File_Fold_Auto_Close variable set, when opening a
   file from the file explorer window, the folds in the taglist window
   are not closed correctly.  Fixed this problem.
taglist_42.zip 4.2 2006-11-14 6.0 Yegappan Lakshmanan 1. After opening a file with no tags defined in it with the
   Tlist_Compact_Format option set, if the tags are updated, the folds
   used for the files following the empty tags file are affected.
2. On MS-Windows, use a "taglist.cmd" temporary file to run exuberant
   ctags. This is to handle space characters in the file names and
   in the exuberant ctags path name.
3. In the taglist window, when a file is re-sorted or updated open the
   fold for the file.
4. When the 'shellxquote' option is set to double quotes, escape
   double quotes in the command executed for exuberant ctags.
5. On FreeBSD, exuberant ctags is installed as exctags, look for
   exctags in the PATH.
6. If two taglist plugins are present (one in the system Vim directory
   and another in the user's .vim/plugin directory), then the plugin
   in the users's .vim directory overrides the version in the system
   vim directory.
7. When the :TlistMessages command is issued display the debug
   messages in a taglist.txt buffer.
8. Clear the readonly option for the taglist buffer
9. When opening a selected file, don't use the preview window, if
   present.
taglist_41.zip 4.1 2006-09-10 6.0 Yegappan Lakshmanan When the Tlist_File_Fold_Auto_Close variable is set to 1, jumping to the taglist window closes all the folds. Modified the plugin to not close the fold for the currently active file. When the TlistLock and TlistUnlock commands are invoked, an error message is displayed. This problem is fixed.
taglist_40.zip 4.0 2006-09-06 6.0 Yegappan Lakshmanan Fixes:
Fix the problems in using the taglist plugin with Vim7 tabs. When
Tlist_File_Fold_Auto_Close is set, close the tag fold when leaving a
buffer.  When jumping to a selected tag, if the file is opened in more
than one window, use the previous window from which the user entered
the taglist window.
New features:
Support for displaying the tag prototype as a tooltip.  Support for
specifying additional commands after the taglist commands using the
bar separator.
taglist_40b4.zip 4.0b4 2006-04-12 6.0 Yegappan Lakshmanan Fixes:
1. When 'Tlist_Show_One_File' is set, after few files are opened,
   unable to select tags from the taglist window.
2. When the taglist plugin is stored in a directory with space characters
   in the name, the autoloading of taglist plugin fails.
New features:
1. Support for moving cursor to the taglist window when using the
   ":TlistToggle" command.
2. When all the tags in a file are of the same type, in the taglist
   menu, don't display the tag type.
3. Changed the '?' help key to 'F1' in the taglist window.
4. Set the filetype for the taglist buffer to 'taglist'
5. In Vim7, set the 'winfixwidth' option for the taglist window.
6. When jumping between files using the ]] or <Tab> and [[ or <Backspace>
   keys, wrap around at the first and last file.
taglist_40b3.zip 4.0b3 2005-12-28 6.0 Yegappan Lakshmanan The following changes are made in this version:

1. Delay loading of the taglist plugin to reduce the Vim startup time.
2. Support for recursively adding multiples files to the taglist using the
   ':TlistAddFilesRecursive' command.
3. New ':TlistOpen' command to open and jump to the taglist window.
4. New ':TlistToggle' command to supersede the ':Tlist' command.
5. New 'Tlist_Close_On_Select' option for closing the taglist window
   when a file is selected.
6. New 'Tlist_Auto_Update' option to enable/disable processing of newly
   edited files.
7. New ':TlistLock' and ':TlistUnlock' commands to lock and unlock the
   taglist.
8. New 'Tlist_Highlight_Tag_On_BufEnter' option to enable/disable
   highlighting of the current tag on entering a buffer.
9. When the taglist buffer is created from a Vim session file, update
   the taglist with the files from the session file.
10. Change the background color used for highlighting file names in the
    taglist window.
11. When <Space> is pressed on a file name or a tag type name in the
    taglist window, display information about the number of tags.
12. Set the 'foldlevel' option to a high value in the taglist window.
13. When refreshing the taglist window, process all the opened buffers.
14. When moving between windows, disable and enable autocommands.
15. When a file is selected from the taglist window, use a non-plugin
    window to edit the file.
16. If 'Tlist_Exit_OnlyWindow' is set and when exiting Vim, make sure
    the '0 mark is set to the previous buffer.
17. When using the taglist plugin with the winmanager plugin and
    'Tlist_Process_File_Always' is set or the taglist menu is enabled,
    sometimes, it is not possible to jump to other windows from the
    taglist window using the keyboard. Fixed this problem.
18. While opening files in a new window, use filenames instead of buffer
    numbers.
taglist_40b2.zip 4.0b2 2005-08-01 6.0 Yegappan Lakshmanan 1. Added the TlistAddFiles command to add multiple files to the taglist window without opening them.
2. Maintain the taglist window width and height across Vim window layout changes.
3. Restore the Vim window location after the taglist window is closed.
4. Use a simpler regular expression for parsing tags output.
5. When a closed fold is selected in the taglist window, open the fold and jump to the file.
6. When the Tlist_Auto_Open variable is set, open the taglist window only when a supported type of file is opened.
7. When displaying tags for a single file, center the current tag line when opening a file.
8. When jumping to a tag, add the previous location to the jump list.
9. Fixed a problem with recording timestamps in the debug messages on MS-Windows.
10. Set the ' mark when jumping to a selected tag.
taglist_40b1.zip 4.0b1 2005-04-05 6.0 Yegappan Lakshmanan Added support for optionally displaying the tags in the drop-down/popup menu. Performance enhancments, various bug fixes and debug support.
taglist.zip 3.4 2004-08-16 6.0 Yegappan Lakshmanan 1. Introduced a new option 'Tlist_Show_One_File" to display the tags for only the current buffer in the taglist window.
2. Support for not displaying the tags for a user-deleted file in the taglist window.
3. Fix for sharing the mouse single click map with other plugins
taglist.zip 3.3 2004-06-01 6.0 Yegappan Lakshmanan 1. If Tlist_Ctags_Cmd variable is not set, on startup, check for the
   presence of exuberant-ctags or ctags or tags in the PATH and set
   Tlist_Ctags_Cmd variable accordingly. If none of the executable is
   found, then the taglist plugin will not be not loaded.
2. Added a new configuration variable Tlist_Enable_Fold_Column to
   enable or disable fold columns in the taglist window.
3. Added support for setting the taglist application name used by the
   winmanager plugin and the cream package.
4. Two new key mappings ([[ and ]]) are added to the taglist window to
   move between files.
5. When a file is modified, the taglist window will be automatically
   updated (after going to some other window or buffer and then coming
   to the modified buffer).
6. Made the Tlist_Update_File_Tags() function as a global function.
   This function can be used to add or update the tags for a new file.
7. Updated the Tlist_Get_Tag_Prototype_By_Line() and the
   Tlist_Get_Tagname_By_Line() functions to get the tag name and tag
   prototype for the specified line in a file.
taglist.zip 3.2 2004-04-25 6.0 Yegappan Lakshmanan Added support for closing the tags tree for inactive files, removing the tags tree for deleted buffers, processing the tags when the taglist window is not opened, disabling the automatic highlighting of the current tag, displaying name of the current tag.
taglist.zip 3.1 2003-11-02 6.0 Yegappan Lakshmanan Added support for saving and restoring taglist sessions. Separated the taglist documentation into a separate file in Vim help format.
taglist.vim 3.0 2003-09-24 6.0 Yegappan Lakshmanan Added support for displaying tags defined in multiple files.
taglist.vim 2.8 2003-09-14 6.0 Yegappan Lakshmanan Added information about the taglist mailing list.
taglist.vim 2.7 2003-08-21 6.0 Yegappan Lakshmanan 1. Added TlistUpdate command to update the taglist window.
2. Made the taglist highlight groups user configurable.
3. Fixed a problem in the taglist integration with the winmanager plugin
taglist.vim 2.6 2003-06-09 6.0 Yegappan Lakshmanan 1. Added support for previewing a tag.
2. Added the TlistClose command to close the taglist window
3. Added the Tlist_Exit_OnlyWindow option to close the taglist window if only that window is open.
taglist.vim 2.5 2003-04-25 6.0 Yegappan Lakshmanan Added support for highlighting the tag scope. Added support for displaying namespaces in C++ files. Updated the comments.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_AlignPlugin.vim.html0000644000000000000000000006726112204336073020677 0ustar Align - Help folks to align text, eqns, declarations, tables, etc : vim online
    sponsor Vim development Vim logo Vim Book Ad

Align : Help folks to align text, eqns, declarations, tables, etc

 script karma  Rating 1621/766, Downloaded by 31538    Comments, bugs, improvements  Vim wiki

created by
Charles Campbell
 
script type
utility
 
description
                                                    [ALIGN/ALIGNMAPS NEEDS VIM 7.0 AS OF V29/34]

Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc.

Note: this plugin is not a left&right margin justification tool!  See vimscript#177, vimscript#2324, or vimscript#3728 for that.
Note: if you have vim 7.1 or later, your vimball should unpack just fine without having to update it.

There are two basic commands provided by this package:

        AlignCtrl options sep1 sep2 sep3 ...
        [range]Align sep1 sep2 sep3 ...

The "sep#" are regular expressions which describe separators that delineate fields; Align will line up the separators. The range may be any Vim range, _including_ visual-blocks.  Align works on lines of the form:
(ws==whitespace, sep==separator, field==text)

    ws-field-ws-sep-ws-field-ws-sep-ws-field-...
    ws-field-ws-sep-ws-field-ws-sep-ws-field-...

Note that white-space (ws) surrounding separators is ignored.

The Align package includes:

  Align : the basic alignment command
  AlignCtrl : provides options for the next call to :Align
  AlignMaps : many three or four key maps which support aligning C/C++ style declarations, ()?..:.., expressions, C/C++ comments, numbers, C preprocessor definitions, tables based on tabs or spaces, and more.

In addition, AutoAlign (vimscript#884) uses the Align function to align =s as you type.

Align handles alignment on multiple separators, not just the first one, and the separators may be the same across the line or different.  With AlignCtrl one may specify that separators are cyclic (re-used sequentially) or equivalent (all separators are simultaneously active).

There are several options to help with deciding what to do with initial white space.   By default Align re-uses the first line's initial white space, but one may use AlignCtrl to retain or remove each line's initial white space.

The <Align.vim> and <AlignMaps.vim> files are plugins and require vim 6.1 or higher.


EXAMPLES:

:5,10Align =
    Align on '=' signs

:'<,'>Align = + - \* /
    Align on any of the five separator characters shown.
    Note that visual block mode was used to fire off Align.

:AlignCtrl =lp1P1I
    which means:
    = all separators are equivalent
    l fields will be left-justified
    p1 pad one space before each separator
    P1 pad one space after each separator
    I  preserve and apply the first line's leading white space to all
       Align'd lines

:help align
    Gives help for Align


ALIGNMENT CONTROL

Alignment control allows for left or right justification or centering of fields, cyclic (sequentially active) or equivalent (simultaneously active) regular expressions to specify field separators, initial white space control, optional visual-block use (ie. apply Alignment only within a block), user-specified white-space padding about separators, and multiple separators.

MANY ALIGNMENT MAPS

AlignMaps.vim provides a number of maps which make using this package easy.  They typically either apply to the range 'a,. (from mark a to current line) or use the visual-selection (V, v, or ctrl-v selected):

\t=  : align assignments (don't count logic, like == or !=)
\t,  : align on commas
\t|  : align on vertical bars (|)
\tsp : align on whitespace
\tt  : align LaTeX tabular tables

AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments:

\acom : align comments
\adec : align C declarations (one variable per line)
\afnc : align ansi-style C function input arguments
\Htd  : align html tables

To see some examples of this, check out

    http://www.drchip.org/astronaut/vim/align.html#Examples

(the proportional fonts used by most browsers in showing you this page preclude showing the examples here). The help for Align and AlignCtrl also contains many examples.
(for those of you who prefer not to have the maps that AlignMaps.vim provides, simply remove the AlignMapsPlugin.vim from .vim/plugin and AlignMaps.vim from .vim/autoload - that's why AlignMaps is separate from Align)

ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL

Sometimes one wants to align only a subset of text in a range, based on patterns or column extents.  Align supports both types of restrictions!
    
    Visual-block selection may be used to restrict Align to operate only
    within that visual block.
    
    AlignCtrl supports "g" and "v" patterns that restrict Align to

    operate on lines which match (or don't match, respectively) those
    patterns.

NEW STUFF:

There's a number of new AlignCtrl options:
    
    - allows one to skip a separator (treat it as part of a field)
    + repeat the last lrc justification (ex. lr+ == lrrrrrr... )
    : treat the rest of the line as a field; acts as a modifier
      to the last lrc.
    < left-justify the separator
    > right-justify the separator
    | center the separator

These are, except for the ":", cyclic parameters.  In other words, >< is equivalent to ><><><><... .  Thus separators can be of differing lengths (ex.  -\+ as a separator pattern can match -, --, ---, etc and the separators will be left/right/center justified as you wish).

To get automatic, as-you-type, aligning of = in the C, vimL, and other languages, check out vimscript#884 for several ftplugins (which use Align).


Alternative Aligners:
    Gergely Kontra's vimscript#176

Thank you for rating Align!

---------------------------------------
DISCUSSION and COMMENTS:
---------------------------------------

Please use email for bugs.  Enjoy!

(alpha/beta version available at http://mysite.verizon.net/astronaut/vim/index.html#ALIGN)
 
install details
1. You'll need to have plugins enabled: in your home directory, have at least the following two lines in your .vimrc file:
   set nocp
   filetype plugin on

2. Using vim 7.1 or later:
  vim Align.vba.gz
   :so %
   :q

3. Using vim 7.0: see http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL to get and install an up-to-date version of vimball.  Then follow the simple directions for installation of Align/AlignMaps above!  Or, preferably: upgrade your copy of vim.

(this version of Align/AlignMaps requires vim 7.0)
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
Align.vba.gz 37/43 2013-03-12 7.0 Charles Campbell (Align) has visual maps to accompany all normal mode mappings (use V to invoke them)
(Align) a bugfix (cursor moved when g:Align_xstrlen=3)
(AlignMaps) use nnoremaps instead of nmaps
Align.vba.gz 36/42 2012-06-18 7.3 Charles Campbell new     : users may specify a function to decide whether or not a character should be skipped with the AlignCtrl \"*\" character
new     : Align will automatically grow the range if the given range is only one line to accommodate all lines which match the first separator pattern
improved: AlignMaps' \\anum, \\aenum, \\aunum and \\t=, \\T=
bugfixes: various; see :help align-history
Align.vba.gz 35/41 2009-03-04 7.0 Charles Campbell Align: save and restore of mod now done with the local version of the option
Align: new sanity check for an AlignStyle of just ":"
AlignMaps: new maps: \ts; ts: \ts< \ts= \a(
AlignMaps: default g:Align_xstrlen often is now 1 for multi-byte support
AlignMaps: bug fixed for \ts,
Align.vba.gz 34/40 2008-10-29 7.0 Charles Campbell (AlignMaps) split into plugin/ and autoload/ sections (faster [g]vim startup)
(AlignMaps) maps use <Plug>s and <script>s: allowing users to invoke the maps how they wish, and preventing user maps from interfering with the internal workings of the maps.
(Align)     bugfix - using :AlignCtrl before entering any alignment ctrl cmds was causing an error
Align.vba.gz 33/39 2008-03-06 6.0 Charles Campbell * Align now aligns multi-byte characters correctly (see :help align-strlen) -- choose g:Align_xstrlen for the type of codepoint you want handled.

* Align now accepts \"...\" arguments, so one can pass whitespace to Align as a separator

* AlignMaps' \\t= map now avoids comment aligning when the filetype is not *.c or *.cpp
Align.vba.gz 32/38 2007-08-20 7.0 Charles Campbell The <leader>tt map wasn't working right; Align now uses <q-args> instead of <f-args>, so it does the argument splitting itself, thus allowing patterns containing backslashes to be used without lots of backslash-duplication.  This allows the \tt map in AlignMaps to work, and to work without a lot of extra backslashes.
Align.vba.gz 31/36 2007-08-16 7.0 Charles Campbell New feature -- one can embed AlignCtrl settings into Align (as a one-shot):

   [range]Align! [AlignCtrl settings] pattern(s)

Plus some small improvements to some of the AlignMaps.
Align.vba.gz 30/35 2006-09-20 7.0 Charles Campbell * \acom can now work with doxygen style /// comments
* \t= and cousins used "`"s.  They now use \xff characters.
* <char-0xff> used in \t= \T= \w= and \m= instead of backquotes.
Align.vba.gz 29/34 2006-04-25 7.0 Charles Campbell Align and AlignMaps now use vim 7.0 style autoloading (quicker startup, loads only when used)
cecutil updated to use keepjumps
Now being distributed as a vimball - simply :so % it after decompressing it to install
Align.tar.gz 28/33 2005-11-21 6.0 Charles Campbell bugfix: (Align) Align now works around the report option setting.
bugfix: (Align) AlignCtrl l: wasn't behaving as expected; fixed!
bugfix: (AlignMap) \ts, now uses P1 in its AlignCtrl call
Align.tar.gz 27/32 2005-07-12 6.0 Charles Campbell Align v27 : cpo and ignorecase workarounds
AlignMaps v32: s:WrapperStart() -> AlignWrapperStart(), s:WrapperEnd() -> AlignWrapperEnd()
These changes let the wrappers be used outside of AlignMaps.vim (customized map support)
Align.tar.gz 27/31 2005-04-15 6.0 Charles Campbell Align: GetLatestVimScripts/AutoInstall supported
AlignMaps: new map: \\adcom (align declaration-style comments), \\a, now wors across multiple lines with different types, cecutil.vim now used, more number alignment maps (\\aenum, \\aunum)

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/indent_python.vim.html0000644000000000000000000002704512204336073017766 0ustar indent/python.vim - An alternative indentation script for python : vim online
    sponsor Vim development Vim logo Vim Book Ad

indent/python.vim : An alternative indentation script for python

 script karma  Rating 212/69, Downloaded by 1901

created by
Eric Mc Sween
 
script type
indent
 
description
This indentation script for python tries to match more closely what is suggested in PEP 8 (http://www.python.org/peps/pep-0008.html).  In particular, it handles continuation lines implied by open (parentheses), [brackets] and {braces} correctly and it indents multiline if/for/while statements differently.

Comments are welcome!
 
install details
Drop the script in your ~/.vim/indent directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
python.vim 0.3 2005-05-23 6.0 Eric Mc Sween Changes:
- Update one shiftwidth instead of aligning with parens that stand at the end of a line.
python.vim 0.2 2004-06-07 6.0 Eric Mc Sween Changes:
- Fix: skip parentheses in strings and comments.
- Line up elif/else and except/finally with the most probable corresponding if or try statement.
- Dedent after 'pass'. (Jeffrey Collins)
python.vim 0.1 2004-04-26 6.0 Eric Mc Sween Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_winmanager.vim.html0000644000000000000000000005731212204336073020612 0ustar winmanager - A windows style IDE for Vim 6.0 : vim online
    sponsor Vim development Vim logo Vim Book Ad

winmanager : A windows style IDE for Vim 6.0

 script karma  Rating 674/224, Downloaded by 15837

created by
Srinath Avadhanula
 
script type
utility
 
description
winmanager: A classical windows type environment for vim6.0

Snapshot                 : http://robotics.eecs.berkeley.edu/~srinath/vim/snapshot2.JPG
Detailed Instructions : http://robotics.eecs.berkeley.edu/~srinath/vim/winmanager.htm
Upates                    : http://robotics.eecs.berkeley.edu/~srinath/vim/winmanager-2.0.htm

winmanager is a plugin which implements a classical windows type IDE in Vim-6.0. Basically, you have the directory tree
and the buffer list as 2 windows which stay on the left and the editing is done in a seperate area on the left. People
have already made excellent File and Buffer explorers seperately and I thought that it might be a cool idea to combine
them both.  winmanager.vim combines the standard File Explorer which ships with Vim6.0 and a Buffer Explorer written by
Jeff Lanzarotta into one package.  It has the following features:

1. the buffer listing is dynamic: i.e as you keep changing windows, editing new files, etc, the buffer list changes
dynamically. the window also resizes dynamically, i.e it tries to occupy the minimum possible space to display all the
currently listed windows. also, only the filename (i.e without path) is displayed in this window. however, the full path
name is echoed on the command line as one moves around.

2. the file explorer window doesn't actually edit a directory. Its a new empty file with modifiable off, etc. so that it
doesnt eat up buffer numbers as you roam around the directory tree. I found the original behaviour slightly annoying...
Also, I didnt find a way to change drives i.e go from c:/ to h:/ in the original explorer.vim. therefore i have added a
tiny new mapping 'C' which changes the currently displayed directory to pwd.

Thanks!

 
install details
For version >= 2.0
=============
1. copy the file to your $HOME/.vim or $HOME\vimfiles directory

2. unzip it (its a zip file) at that location. this should create the files
   - plugin/
       winmanager.vim
       winfileexplorer.vim
       wintagexplorer.vim
   - doc/
       winmanager.txt

   IMPORTANT NOTE:
  
   i  . This version of winmanager ONLY works if you have the latest version
        bufexplorer.vim. (vimscript #42).
        The idea is that winmanager will no longer contain a duplicate copy
        of bufexplorer.vim. This reduces script bloat, makes updates easier
        and in genral makes the world a better place.
  
3. vim -c "helptags ~/.vim/doc" -c "q"  (unix)
   or
   vim -c "helptags ~/vimfiles/doc" -c "q"  (windows)
   (this step should install winmanager.txt as a local help file on your
   system. if this doesnt work, see ":he add-local-help" to see how to do
   it).

You will also need to change the mappings you might have used with
winmanager-1.x to

    map <c-w><c-f> :FirstExplorerWindow<cr>
    map <c-w><c-b> :BottomExplorerWindow<cr>
    map <c-w><c-t> :WMToggle<cr>

and the variable name g:bufExplorerWidth has been changed to
g:winManagerWidth just to be more consistent.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
winmanager.zip 2.3 2002-04-03 6.0 Srinath Avadhanula Sorry, but I just found out that I had uploaded a week old version last time which didnt have any of the promised new features, namely favorite dirs, improved wintagexplorer etc. Its a huge surprise that I didnt get flooded with complaints! oh well.. also fixed a few minor bugs with both winmanager.vim and wintagexplorer.vim, so this is not a completely wasted upload.

Please see release notes for version 2.2 for changes.
Once again, you need vimscript #42 (bufexplorer.vim) for this to work.
winmanager.zip 2.2 2002-04-01 6.0 Srinath Avadhanula New Features:
1. The file explorer now has a favorite directories option. The list of
   favourite directories is shown above the current listing with '+'
   signs prefixed to each fav dir. In order to change to a favorite
   directory, you just go to that dir and press <enter>. Set g:favDirs
   in your ~/.vimrc to use set a default list of favorite directories.
   This is a new-line seperated list of directories. For example:
        let g:favDirs =
            'e:/srinath/testing/vim/vimfiles/plugin/'."\n".
            'e:/srinath/testing/vim/vimfiles/ftplugin/'."\n".
            'e:/srinath/testing/vim/vimfiles/compiler/'
   After startup, you can use 'f' to add the currently displayed
   directory to the favourites.
   NOTE: Use full path names. Use a trailing back-slash is safe.
   NOTE: Use double quotes to enter a new-line.
   NOTE: By default, $HOME is always included in the list. Do *not*
         include it in g:favDirs.

2. wintagexplorer.vim now has a feature where it saves its display in a
   file .vimtagsdisplay in the tags directory. This speeds up display
   next time you use wintagexplorer. useful if you work with large tags
   files.
   Put
      let g:saveTagsDisplay = 0
   in your ~/.vimrc to disable this feature.

3. There are a couple of more functions which winmanager exposes.
   1. WinManagerGetLastEditedFile(n)
      returns the n^th last file being edited.
   2. IsWinManagerVisible()
      returns 1 or 0 depending on whether explorer windows are visible.
   These functions are internally necessary for adding on
   FlistTree.vim to winmanager.vim. This is a new addon to winmanager
   based on Dr. Charles E. Campbell's flisttree utility which
   graphically shows the function dependency within C files.
   FlistTree.vim is expected to be released shortly.

ug Fixes:
1. When a file is chosen from the bufexplorer list and its not currently
   visible, then the cursor jumps back to the first row.

2. Sometimes the <C-N> and <C-p> mappings would be lost, when an
   explorer didnt display properly.

3. Several bugs in wintagexplorer.vim have been resolved.
   (Thanks to Madoka Machitani and Mike Williams for valuable help).
   wintagexplorer.vim is also more intelligent about remembering its
   display.
winmanager.zip 2.1 2002-02-13 6.0 Srinath Avadhanula     1. worked on improving the speed of wintagexplorer.vim
       (the latest version is almost 3 times faster than the previous
       version and faster for larger files).
    2. removed some bugs from wintagexplorer.vim where the mappings would
       dissapear because of caching.
    3. fixed some important documentation bugs (thanks to Madoka
       Machitani.)
    4. also used an augroup for the autocommands used in winmanager to
       better handle cases where the autcommands are deleted. (thanks to
       Madoka again)
    5. made fileexplorer.vim not screw up the search history. this was
       caused because of ^"= getting into the search history.
       (thanks to Jeff Lanzarotta and Xiangjiang Ma).

     NOTE: I frequently get asked the following question:
     Q. From version 2.0, the command :GotoBufExplorerWindow does not work.
        Whats wrong?
     A. Starting from 2.0, the commands have been changed as follows:
                 old                           new
           GotoFileExplorerWindow  -----> FirstExplorerWindow
           GotoBufExplorerWindow   -----> BottomExplorerWindow
winmanager.zip 2.0 2002-01-18 6.0 Srinath Avadhanula This is a major revision of winmanager with lots of new features, improved
stability, etc.

IMPORTANT: you need to download and install the latest version of
bufexplorer (vimscript #42) to make this version of winmanager work.

1. One of the major new features of this version is (hopefully, touch wood,
etc) its stability. It has undergone extensive QA by Xiangjiang Ma (and
other users of the 2.0 beta version have also been using it for a couple of
weeks and have reported a few bugs). A big thanks to him (and others) for
all the valuable help. Infact a lot of the new features and the
implementation methods owe their style/origin to his ideas.

2. This version of winmanager no longer ships with a duplicate of
bufexplorer.vim. This has many advantages such as a reduction in script
bloat and in general promotes the idea of modularity. The latest version of
bufexplorer.vim (see above) provides hooks so that winmanager can
communicate with it. (thanks to Jeff Lanzarotta for making the necessary
changes).

3. Becuase of some new features of bufexplorer.vim, winmanager is able to
offer better dynamic behavior. For example, when you open up winmanager
when your editing only a single buffer, bufexplorer will not be shown. As
soon as at least 2 buffers are opened, bufexplorer is automatically opened.

4. This version provides an easy way to customize the window layout of
winmanager using non-default values of the global variable,
g:winManagerWindowLayout. (see ":he winmanager-customizing" for details).

5. This version also provides a way to use winmanager.vim to "edit"
directories instead of the standard exploerer.vim. To do this, you will
need to disable the standard explorer.vim (either by renaming it to
explorer.txt or putting ":let loaded_explorer = 1" in your .vimrc). You
then need to put
   :let g:defaultExplorer = 0
in your .vimrc to let winmanager know that its supposed to take over.

6. I have tried to set-up a framework wherby it is very easy to add other
IDE type plugins to winmanager. By this I mean that a plugin author
could, with the minimum of effort make a plugin which can be integrated
into winmanager.

7. For the purpose of demonstrating the first feature, in this new version,
winmanager also ships with another lightweight plugin called
tagsexplorer.vim. This is an elementary plugin which shows the tags in the
present directory in a fancy manner and offers some simple ways of
navigating between them.
To see this in action [File List] window and press CTRL-N.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/dtd2vim.html0000644000000000000000000003102312204336073015652 0ustar dtd2vim - Script for creation XML data file for Vim7 XML omni-completion from DTDs : vim online
    sponsor Vim development Vim logo Vim Book Ad

dtd2vim : Script for creation XML data file for Vim7 XML omni-completion from DTDs

 script karma  Rating 20/5, Downloaded by 429

created by
Mikolaj Machowski
 
script type
utility
 
description
Script for creation XML data file for Vim7 XML omni-completion from DTDs
Requires: perl and perlSGML (tested against 1997Sep18 version)

INSTALLATION:

   Copy into your $PATH

USAGE:

   dtd2vim <file.dtd> [<dialectname>]

This command will create file <file.vim> (remove .dtd extension and add .vim;
other extensions will remain intact).

<dialectname> (not obligatory) will be part of dictionary name and will be
used as argument for :XMLns command (file name - sans extensions) have to be
the same.

perlSGML and this script doesn't work with multiple files. User has to
prepare single DTD file to parse all data.

In created file global variable is named g:xmldata_<dialectname>. When second
argument wasn't provided 'xxxx' will be used.
After that place file in:

   ~/.vim/autoload/xml

directory. Of course it can be also global directory or other Vim data
hierarchy of files. Example for  DocBook 4.4:
DTD is in file docbook.dtd, call command with

   dtd2vim.pl docbook.dtd docbook44

Put file as:
  
   ~/.vim/autoload/xml/docbook44.vim

Omni-completion for DocBook 4.4 files will be started with:

   :XMLns docbook44

command.

 
install details
Copy in your $PATH
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
dtd2vim 2.0 2006-04-25 7.0 Mikolaj Machowski - not all element children were properly recognized
- comment out lines responsible for detection of obligatory attributes, too many false positives; uncomment on your own responsibility
dtd2vim 1.1 2006-02-18 6.0 Mikolaj Machowski - generate 'info' field for attributes and tags (/> - EMPTY tag, * - required attribute)
- no extension
dtd2vim.pl 1.0 2006-02-12 6.0 Mikolaj Machowski Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_supertab.vim.html0000644000000000000000000006373512204336073020315 0ustar SuperTab - Do all your insert-mode completion with Tab. : vim online
    sponsor Vim development Vim logo Vim Book Ad

SuperTab : Do all your insert-mode completion with Tab.

 script karma  Rating 2125/657, Downloaded by 56916    Comments, bugs, improvements  Vim wiki

created by
Eric Van Dewoestine
 
script type
utility
 
description
Overview

Supertab allows you to use <Tab> for all your insert completion needs
(:help ins-completion).

Features

- Configurable to suit you needs:
  - Default completion type to use.
  - Prevent <Tab> from completing after/before defined patterns.
  - Close vim's completion preview window when code completion is finished.
  - When using other completion types, you can configure how long to 'remember'
    the current completion type before returning to the default.
  - Don't like using <Tab>? You can also configure a different pair of keys to
    scroll forwards and backwards through completion results.
- Optional improved 'longest' completion support (after typing some characters,
  hitting <Tab> will highlight the next longest match).
- Built in 'context' completion option which chooses the appropriate completion
  type based on the text preceding the cursor.
  - You can also plug in your own functions to determine which completion type
    to use.
- Support for simple completion chaining (falling back to a different
  completion type, keyword completion for example, if omni or user completion
  returns no results).

You can also find supertab on github repository:
http://github.com/ervandew/supertab
 
install details
1. Download supertab.vmb to any directory.
2. Open the file in vim ($ vim supertab.vmb).
3. Source the file (:so %).
 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
supertab.vmb 2.0 2012-06-01 7.0 Eric Van Dewoestine - added support for chaining two completion types (falls back to the second if not results from the first).
- added setting to close completion preview window when the completion popup closes.
- improved compatibility with other plugins.
- other minor bug fixes.
supertab.vba 1.6 2011-07-20 7.0 Eric Van Dewoestine - couple longest enhancement fixes
- added ability to disable supertab via a buffer local variable
- few other miscellaneous fixes.
supertab.vba 1.5 2011-02-16 7.0 Eric Van Dewoestine - updated to support user mapped <c-n>/<c-p>
- fix logic to decide whether to scroll up or down based on current completion context
- fix <c-x><c-*> w/ longest enhancement enabled
supertab.vba 1.4 2011-01-27 7.0 Eric Van Dewoestine Fix error that occurs attempting to complete after optional alternate completion mapping or :SuperTabHelp have set the completion type.
supertab.vba 1.3 2011-01-18 7.0 Eric Van Dewoestine - fix error attempting tab completion if buffer was loaded with no autocmds fired
- fix tabbing through completion results with longest enabled when the longest text expanded is the empty string.
supertab.vba 1.2 2011-01-09 7.0 Eric Van Dewoestine - fix to not break abbreviation expansion on <cr>
- when using longest enhancement, save/restore any previous mappings for <bs>/<c-h>
- fix <cr> mapping to cooperate better with <cr> mappings of other plugins (ex. endwise)
- created variables to set user defined list of before or after patterns for which completion should not be attempted (:h supertab-preventcomplete)
supertab.vba 1.1 2010-09-27 7.0 Eric Van Dewoestine - added optional default <cr> mapping to end completion mode (enabled by default)
- added support for an enhanced longest match completion (disabled by default)
- other minor enhancements + bug fixes
supertab.vba 1.0 2009-12-03 7.0 Eric Van Dewoestine - fixed reverse cycling through result when using <c-n> completion
- now distributed as a vimball with a help file (:h supertab).  Thanks to Christophe-Marie Duquesne.
supertab.vim 0.61 2009-10-16 7.0 Eric Van Dewoestine Fixed a possible error that may occur in some rare conditions.
supertab.vim 0.60 2009-09-16 7.0 Eric Van Dewoestine - Refactored the contextual completion and default discovery support.
  - Context completion now supports plugable functions to determine which
    completion type to use.
  - Default discovery is now a part of context completion.
- NOTE: Several non-backwards compatible configuration changes where made.
  - g:SuperTabRetainCompletionType is now g:SuperTabRetainCompletionDuration
    and accepts one of 'none', 'insert', or 'session'.
  - new setting g:SuperTabCompletionContexts defines which context completion
    functions are consulted.
  - g:SuperTabDefaultCompletionTypeDiscovery is now
    g:SuperTabContextDiscoverDiscovery and requires that
    g:SuperTabContextDefaultCompletionType is set to 'context' and that
    's:ContextDiscover' is in your g:SuperTabCompletionContexts list.
Please see the updated "Global Variables" fold in supertab.vim for additional
details and examples.
supertab.vim 0.51 2009-07-11 7.0 Eric Van Dewoestine Replaced internal function s:IsWordChar with vim's keyword character class (Thanks to Ingo Karkat for the patch).
supertab.vim 0.50 2009-06-26 7.0 Eric Van Dewoestine Added check for vim 7 or greater, otherwise disable supertab support (suggested by Vincent Lee).  Also, removed any remaining pre vim 7 logic that is no longer applicable.
supertab.vim 0.49 2009-02-05 7.0 Eric Van Dewoestine fixed case where new buffer may not be initialized by super tab (thanks to Tammer Saleh for reporting the issue).
supertab.vim 0.48 2009-01-18 7.0 Eric Van Dewoestine Fixed command line completion (ctrl-x ctrl-v) when invoked from supertab.  Thanks to Frank Chang for the patch.
supertab.vim 0.47 2009-01-11 7.0 Eric Van Dewoestine fixed issue with default completion discovery option if desired type is dependent on file type plugins.  Thanks to Andreas Schneider for reporting the issue.
supertab.vim 0.46 2008-11-15 7.0 Eric Van Dewoestine Added support for default completion type 'context', which will result in super tab attempting to determine which completion type to use (file, user/omni, keyword) based on the text preceding the cursor (Based on suggestion by François Beaubert).
supertab.vim 0.45 2007-12-18 6.0 Eric Van Dewoestine - fixed possible completion error on first buffer as supertab may not have been properly initialized (thanks to bill emmons for discovering the error).
supertab.vim 0.44 2007-11-08 6.0 Eric Van Dewoestine - added config variable to specify discovery list used to determine the default completion type to use for the current buffer. (based on request by Den Yao)
- added config variables to changed the default mappings for forward backwards completion. (based on request by Li Chaoqun)
- added config variable to preselect the first entry when completeopt has 'menu' and 'longest'. (based on suggestion and patch by Mike Lundy)
supertab.vim 0.43 2007-07-12 6.0 Eric Van Dewoestine With the permission of the original author, this script is now released under the BSD license.
supertab.vim 0.42 2007-06-11 6.0 Eric Van Dewoestine - Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default).  (based on request by Charles Gruenwald)
- Applied patch to fix <s-tab> cycling through completion results. (submitted by Lukasz Krotowski)
supertab.vim 0.41 2006-08-30 6.0 Eric Van Dewoestine Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_sokoban.vim.html0000644000000000000000000003626012204336073020115 0ustar sokoban.vim - Sokoban Game for Vim! : vim online
    sponsor Vim development Vim logo Vim Book Ad

sokoban.vim : Sokoban Game for Vim!

 script karma  Rating 542/149, Downloaded by 4847

created by
Mike Sharpe
 
script type
game
 
description
The goal of VimSokoban is to push all the packages ($) into the  home area (.) of each level using hjkl keys or the arrow keys.
The arrow keys move the player (X) in the  corresponding direction, pushing a package if it is in the way and there is a clear
space on the other side.

Use the
:Sokoban       - or -    :Sokoban <level num>     (no split window)
:SokobanH     - or -    :SokobanH <level num>   (horizontal split window)
:SokobanV     - or -    :SokobanV <level num>   (vertical split window)
commands to start the game

h or <Left> - move the man left
j or <Down> - move the man down
k or <Up> - move the man up
l or <Right> - move the man right
r - restart level
n - next level
p - previous level
u - undo move

Levels came from the xsokoban distribution which is in the public domain.
http://www.cs.cornell.edu/andru/xsokoban.html

Take a look at VIM Tetris (vimscript#172) too....the game which started the VIM Game revolution :)
 
install details
Run `tar -zxf VimSokoban.tar.gz`, this will unpack the installation into the VimSokoban directory. Contained in that directory
are the levels and the sokoban.vim script. Simply add sokoban.vim to your favorite vim plugin directory or source it directly.  
The directory containing the levels is found as follows,
1) if g:SokobanLevelDirectory is set that directory is used
2) if $VIMSOKOBANDIR is set that directory is used
3) if $HOME/VimSokoban exists it is used
4) on WINDOWS, if c:\\VimSokoban exists it is used
5) if a VimSokoban directory exists below the directory where the script lives exists it is used. (this means that if sokoban.vim
    is in your plugin directory you can put the levels into a directory called VimSokoban in your plugin directory)
6) Finally, the directory where the script lives is considered. (this means that if you have the levels and the sokoban.vim
    script in the same directory it should be able to find the levels)

(when setting g:SokobanLevelDirectory or $VIMSOKOBANDIR make sure that it contains a trailing / or \ (unix/windows).

You will need a VIM window which is 80 characters wide and about 35 lines.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
VimSokoban.tar.gz 1.3 2002-03-06 6.0 Mike Sharpe set buftype and nomodifiable, remeber progress though levels, record high scores for each level.
VimSokoban.tar.gz 1.2 2002-02-21 6.0 Mike Sharpe fix bug in routine which detected when a level was complete. This meant some levels were not detected as complete e.g. level 11.
VimSokoban.tar.gz 1.1b 2002-02-19 6.0 Mike Sharpe Use the <sfile> expansion to try to locate the level directory.
VimSokoban.tar.gz 1.1a 2002-02-15 6.0 Mike Sharpe Minor tweaks to help windows find the level
directory a little more smoothly. I hope this works.
VimSokoban.tar.gz 1.1 2002-02-13 6.0 Mike Sharpe Map the j/k keys correctly.
Added SokobanH and SokobanV commands which control how the screen is split
VimSokoban.tar.gz 1.0 2002-02-11 6.0 Mike Sharpe Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_calendar.vim.html0000644000000000000000000005011712204336073020227 0ustar calendar.vim - Calendar : vim online
    sponsor Vim development Vim logo Vim Book Ad

calendar.vim : Calendar

 script karma  Rating 1527/612, Downloaded by 30862  Comments, bugs, improvements  Vim wiki

created by
Yasuhiro Matsumoto
 
script type
utility
 
description
This script create calender window.
This don't use the external program(cal).
 
install details
Copy calendar.vim to your plugin directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
calendar.vim 2.5 2011-01-27 6.0 Yasuhiro Matsumoto [fix] 7.2 don't have relativenumber.
calendar.vim 2.4 2011-01-27 6.0 Yasuhiro Matsumoto Applied patch from SethMilliken: added g:calendar_options . default is 'fdc=0 nonu nornu' . you can overwrite default behavior of calendar window.
calendar.vim 2.3 2011-01-08 6.0 Yasuhiro Matsumoto Applied patch from bw1: fixed weeknum function.
calendar.vim 2.2 2010-05-06 6.0 Yasuhiro Matsumoto Applied patch:
  http://gist.github.com/355513#file_customizable_keymap.diff
  http://gist.github.com/355513#file_winfixwidth.diff
calendar.vim 2.1 2010-03-24 6.0 Yasuhiro Matsumoto Applied patch from thinca. Thanks.
calendar.vim 2.0 2009-11-24 6.0 Yasuhiro Matsumoto Applied patch from Ingo Karkat. Thanks.

- ENH: Added a config setting g:calendar_datetime. This allows to remove the
display of the current date/time in the title (I don't like it), and offers the
window's statusline as an alternative.

- BUG: The checks for g:calendar_action and g:calendar_sign should also check
for an existing, but empty variable. Otherwise, it is not possible to disable it
in a .vimrc, because the sourcing of calendar.vim would initialize the variables.

- BUG: In s:CalendarDoAction(), the check for g:calendar_action must come after
the "navi" handling; otherwise "navi" breaks if g:calendar_action is disabled
(see above).

- ENH: The :set wrapscan is ugly, because it is a global setting. The search()
commands already pass the 'w' flag, so the only remaining issue were the
searches via /. I modified the 'G0/...' search to 'G$?' (i.e. backward from end
of buffer), so that 'wrapscan' isn't required any more. (Even better would be to
use search() for these jumps, too.) With this, I can also completely get rid of
the autocmds in case one does not want the date/time in the title, neither (see
above).

- Using :setlocal buftype=nofile instead of =nowrite; this is more suitable for
this kind of scratch buffer, and avoids that the path may be shown in the title
/ statusline (depending on the customization).

- BUG: Replaced :setlocal nowrap with 'wrap'. Without this, the 'sidescrolloff'
setting may cause the left side of the calendar to disappear if the last
inserted element is near the right window border. 'wrap' shouldn't matter,
anyway, and 'sidescrolloff' is a global setting, unfortunately.
Try :set sidescrolloff=3 in combination with :let g:calendar_navi = 'bottom' to
reproduce.

- BUG: The :normal i... for the navi rendering causes a trailing space after the
"Next>" button. This way, I cannot quickly type "G$<CR>" to activate the next
button. Now using :normal a... to append. This causes the entire navi to shift
one character to the right, but you could fix this by decreasing the column
counter.

- ENH: Use :stopinsert in case we've gotten here from insert mode (via
<C-O>:Calendar<CR>)...

- Using :wincmd w instead of :normal <C-w>; it's simpler. (And you should always
use :normal! (with a bang) to avoid interference with user remappings!)

- ENH: I noticed that <left> and <s-left> do the same thing, but in different
ways (one uses the navi and the latter is called by the former). I dropped the
unintuitive shift mappings and instead do the jumps consistently in the navi,
using the b:Calendar... variables instead of that ugly maparg() stuff.

- ENH: I noticed that <left> and <up> do the same thing. I changed <up>/<down>
to move an entire year, so one can quickly let the years pass...

- ENH: the 'q' mapping now returns to the previous window, not the first one.
calendar.vim 1.9 2009-11-20 6.0 Yasuhiro Matsumoto This is an upgrade for calendar.vim. use nnoremap.
calendar.vim 1.8 2009-10-08 6.0 Yasuhiro Matsumoto This is an upgrade for calendar.vim. fixed E382 while closing diary.
calendar.vim 1.7 2008-02-15 6.0 Yasuhiro Matsumoto This is a fixed version of calendar.vim. fixed problem of week number on 03/01/2008.
calendar.vim 1.6 2007-07-24 6.0 Yasuhiro Matsumoto Added new actions 'calendar_begin' and 'calenader_end'.
calendar.vim 1.5 2007-05-01 6.0 Yasuhiro Matsumoto This is an upgrade for calendar.vim. this include some bug fix.
calendar.vim 1.4a 2006-01-16 6.0 Yasuhiro Matsumoto This is an upgrade for calendar.vim. this include some bug fix and calendar_today action.
calendar.vim 1.4 2004-11-03 6.0 Yasuhiro Matsumoto This is an upgrade for Calendar.vim. this include 2 bug fixs and 1 improvement.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_EnhancedCommentify.vim.html0000644000000000000000000003573312204336073022225 0ustar EnhCommentify.vim - comment lines in a program : vim online
    sponsor Vim development Vim logo Vim Book Ad

EnhCommentify.vim : comment lines in a program

 script karma  Rating 1069/338, Downloaded by 13955

created by
Meikel Brandmeyer
 
script type
utility
 
description
The development of the script is done at http://ec.kotka.de. Releases may be downloaded from below.

There is a major rework for Vim7 underway. In case you are missing any features, this is the time to suggest them. Send me an email or report your bugs or suggestions in the trac at the link above. This is a serious request from me to the users. In the past a lof of people complained on mailing lists, that "this doesn't work" or "that feature is missing", without contacting me. If you don't tell the upstream author, then this won't change!

Stay tuned.
 
install details
Simply drop the script in your .vim/plugin directory. There is a detailed EnhancedCommentify.txt, since there are to much options to explain here. Put it in your .vim/doc directory and issue the ':helptags ~/.vim/doc' command. ':help EnhancedCommentify' should then give you any information you need in order to use the new features of the script.                                                                                
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
EnhancedCommentify-2.3.tar.gz 2.3 2008-02-21 6.0 Meikel Brandmeyer Still alive! Yeah! :-D

Finally a new release....

This is mainly a bugfix release:
* Fixed a typo in the apache detection. (thanks to Brian Neu)
* Fixed handling of nested comment escape strings. (thanks to Samuel Ferencik)
* Fixed broken keyboard mappings when wcm is set to <Tab>. (thanks to xpatriotx)

* Added support for viki & deplate (thanks to Thomas Link)
* Added support xslt, xsd & mail (thanks to Stefano Zacchiroli)
* Added callback-functionality to enable extension of the script without actually modifying the script.
EnhancedCommentify-2.2.tar.gz 2.2 2004-09-27 6.0 Meikel Brandmeyer New features:
* Keybindings may be turned off in the different modes. (eg. no bindings in insert mode)
* Keybindings may be local to the buffer now.
* Keybindings may be turned off in case of an unknown filetype.

Bugfixes:
* Fixed a problem with UseSyntax. (thanks to Pieter Naaijkens)
* Fixed Ocaml support. (thanks to Zhang Le)
EnhancedCommentify-2.1.tar.gz 2.1 2004-01-26 6.0 Meikel Brandmeyer This is version 2.1 of the EnhancedCommentify Script.
New features:
* one-block commenting for multipart comments
* if possible, use commentstring option in order to determine the comment strings.
* moved autocmd to BufWinEnter in order to fix modeline usage
* experimental parsing of comments option to find out middle string for new one-block feature.

Bugfixes:
* fixed problems with tabs if align-right option is used
* fixed case sensitive check for overrideEL (thanks to Steve Hall)
* fixed problems with javascript filetype (thanks to Brian Neu)
* changed init-autocmd to BufWinEnter to fix usage of modeline
EnhancedCommentify-2.0.tar.gz 2.0 2002-09-11 6.0 Meikel Brandmeyer Version 2.0 is finally out. With a whole bunch of changes. Most important:
The script is now released under BSD license. But this should be no restriction I think.
Bugfixes:
* ''' is an invalid expression (thanks to Zak Beck)
* AltOpen/Close set to '' could cause problems (thanks to Ben Kibbey)
* bug in keybinding code (thanks to Charles Campbell)
* trouble with 'C' in cpo (thanks to Luc Hermitte)
New features:
* produces now block comments, eg:
    /*int a;
    char b;*/
* option to add ident string only at opener
* options may now be set on a per buffer basis.

I can only recommend (again!) to read the help file for new options and explanations for old ones.
This release contains script und helpfile in a tar.gz.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_info.vim.html0000644000000000000000000002755012204336073017416 0ustar info.vim - GNU info documentation browser. : vim online
    sponsor Vim development Vim logo Vim Book Ad

info.vim : GNU info documentation browser.

 script karma  Rating 564/200, Downloaded by 5181

created by
Slavik Gorbanyov
 
script type
utility
 
description
requires vim 6.x and GNU info. adds new command `Info': without arguments it displays "directory" node, with single argument displays this file (eg `:Info libc'). with two arguments, first specifies file and second node to display (eg `:Info libc POSIX\ Threads' -- note space escaping). within browser, press h key to see available key shortcuts.
 
install details
copy it into ~/.vim/plugin/, then restart vim (or do :runtime info.vim).
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
info.vim 1.7 2002-11-30 6.0 Slavik Gorbanyov added varios workarounds for win32 environment.
fixed multiline cross-references matching.
info.vim 1.6 2002-11-13 6.0 Slavik Gorbanyov script now properly follows hyperlinks split across two lines.
info.vim 1.5 2002-03-20 6.0 Slavik Gorbanyov fixed issue with c-shell and stderr redirection. global search still does not work properly, sorry.
info.vim 1.2 2001-06-16 6.0 Slavik Gorbanyov Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_color_sample_pack.vim.html0000644000000000000000000003066712204336073022143 0ustar Color Sampler Pack - *NEW* [Jan 2010 Update] Top 100 Themes, GUI Menu : vim online
    sponsor Vim development Vim logo Vim Book Ad

Color Sampler Pack : *NEW* [Jan 2010 Update] Top 100 Themes, GUI Menu

 script karma  Rating 1679/620, Downloaded by 37510

created by
Robert (MetaCosm)
 
script type
color scheme
 
description
This package is simply to help people who want to try out a lot of color schemes.  It is the top 100 rated color schemes on vim.sf.net as of Jan 20th, 2010 that are are not "evil" (binding keys, changing fonts, etc) --  zipped up in a single package.  Every single theme was updated to its newest revision, and converted to unix formatted line endings.

Check out a demo of these themes at: http://www.vi-improved.org/color_sampler_pack/

The menu has been simplified based on feedback to simply three categories.  Dark / Light / Other.

This package was put together simply to save others time in downloading the color schemes.  If you are a scheme author and for some reason do not want your scheme included, please simply drop me a note.  iam -at- robertmelton.com

Now, the pack comes with an organized GUI menu, but no tool for console users.  I recommend you pick up http://www.vim.org/scripts/script.php?script_id=1488 which is a colorscheme scroller / chooser and browser.  

Many of these schemes are Gvim only, and do not support consoles well... but there is a plugin to allow Gvim only themes to work in 88/256 color terminals -> http://www.vim.org/scripts/script.php?script_id=2390.

Love it or Hate it -- Rate it.  :)
 
install details
Simply unzip, and place the files in ~/.vim/plugin and ~/.vim/colors --- it will unzip with correct dir structure, so you can just unzip to ~/.vim

Hope this helps you... join #vim on irc.freenode.net for all your vim help needs :)
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ColorSamplerPack.zip 8.03 2010-01-25 7.0 Robert (MetaCosm) [Jan 2010 Update] 30 new themes climbed into the top 100, which means 30 were deprecated.  Online demo of themes at: http://www.vi-improved.org/color_sampler_pack/ .  Total theme count, 137 (that is 100 themes, some of them have multiple sub-versions)

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_cvsmenu.vim.html0000644000000000000000000007553712204336073020153 0ustar cvsmenu.vim (updated) - CVS(NT) integration plugin (Script #58 continued since 2005) : vim online
    sponsor Vim development Vim logo Vim Book Ad

cvsmenu.vim (updated) : CVS(NT) integration plugin (Script #58 continued since 2005)

 script karma  Rating 119/40, Downloaded by 3278

created by
Yongwei Wu
 
script type
utility
 
description
Supports most cvs commands and adds some extended functions. It also works with CVSNT quite well and has some support for multiple encodings. Part of the top-level menus are as follows (screen shot: http://wyw.dcweb.cn/download.asp?path=vim&file=vim_session.png):

- Info
- Setting (switches and update)
- Keyword
- Directory (directory operations; screen shot: http://wyw.dcweb.cn/download.asp?path=vim&file=cvs_localstatus.png)
- Extra (operations on a specific revision, etc.)
- Diff (in the split-window style of Vim; screen shot: http://wyw.dcweb.cn/download.asp?path=vim&file=cvs_diff.png)
- Annotate (screen shot: http://wyw.dcweb.cn/download.asp?path=vim&file=cvs_annotate.png)
- History
- Log (screen shot: http://wyw.dcweb.cn/download.asp?path=vim&file=cvs_log.png)
- Status
- Local status (offline: displays status and version info)
- Check out
- Query update (like WinCVS/gCVS)
- Update (conflicts will be highlighted)
- Add
- Commit

The output can be sorted and is often clickable: it is easy to open conflicting files, etc. It works on single files as well as on whole directories, when called from fileexplorer. It also includes highlighting / mappings to navigate through cvs output or show conflicts.

The menu is displayed in GUI versions of Vim. However, it is useful even in text-only Vim. --- You may choose to use `wildmenu', or you can use key sequences similar to the hot keys in menu. E.g. `alt-c, i' is used to commit with the GUI menu; so `,ci' could be used in text-mode Vim to commit. The leader key, currently `,', can be easily modified in the script.

This is the re-release of Mr Thorsten Maerz's original script (vimscript #58), which was last updated in 2002. It now includes many bug fixes and enhancements. The latest revision of the cvsmenu script can also be found in the SourceForge CVS:

:pserver:anonymous@ezytools.cvs.sourceforge.net:/cvsroot/ezytools/VimTools/cvsmenu.vim

CvsMenu is able to update itself using this anonymous CVS. Find the menu items under `CVS > Settings > Install'.
 
install details
Copy to the Vim plugin directory: generally ~/.vim/plugin in UNIXs, and $VIM\vimfiles\plugin (or $HOME\vimfiles\plugin) in Windows.

Choose `CVS > Settings > Install > Install updates' in the menu, or the shortcut `,cgii', to checkout and install the latest script and documentation.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cvsmenu.vim 1.150 2009-09-24 6.0 Yongwei Wu Fix the issue that "CVS > Revert changes" discards tag/branch information;
Fix some issues related to fileencoding.
cvsmenu.vim 1.147 2008-06-29 6.0 Yongwei Wu Fix the issue that the global fileencoding can be accidentally changed by "let &fileencoding="; fix the problem that the log message is not converted to the CVScmdencoding.
cvsmenu.vim 1.145 2007-12-29 6.0 Yongwei Wu Fix the bug that the local status is not automatically refreshed when committing a file not in the current directory.
cvsmenu.vim 1.144 2007-10-26 6.0 Yongwei Wu Fix the bug that shortcut keys cannot be created in Unix when the path of cvsmenu.vim contains spaces.
cvsmenu.vim 1.143 2007-10-01 6.0 Yongwei Wu Fix the bug that the file path cannot contain spaces (in Unix and Cygwin).
cvsmenu.vim 1.142 2007-05-09 6.0 Yongwei Wu Shorten `CVScvsoutputencoding' to `CVScmdencoding';
Add a new control variable g:CVSfileencoding to ensure the result of CVS-Diff and CVS-Annotate is correct;
Set the appropriate fileencoding in CVSDoCommand.
cvsmenu.vim 1.140 2006-10-22 6.0 Yongwei Wu Re-enable password piping on Windows (tested to work with CVSNT 2.5.02 Build 2115) to make update cvsmenu.vim smoother; Change the name pattern of temporary log message file to make CVSeasylogmessage work with different versions of CVS (tested with more than 4 different CVS clients); Make some minor bug fixes.
cvsmenu.vim 1.136 2006-10-20 6.0 Yongwei Wu When vimming a CVS log message, ensure there is an empty line at the beginning, make editing start in insert mode, and make a normal-mode ENTER finish editing (can be disabled by put `let g:CVSeasylogmessage=0' in (.|_)vimrc).
cvsmenu.vim 1.135 2006-10-19 6.0 Yongwei Wu Display a message and cease to CVS diff if the file is newly added; allow using `q' to close the CVS history window.
cvsmenu.vim 1.133 2006-10-16 6.0 Yongwei Wu Use the corresponding version instead of the most recent version in the repository to Diff, as the command line `cvs diff ...' does.
cvsmenu.vim 1.132 2006-10-13 6.0 Yongwei Wu Fix the display problem of `Directory > Local status'; clean up the code a little.
cvsmenu.vim 1.127 2006-10-10 6.0 Yongwei Wu Fix the bug that `Checkout to' does not work.
cvsmenu.vim 1.126 2006-09-11 6.0 Yongwei Wu Allow non-ASCII filename to be used when encoding=utf-8.
cvsmenu.vim 1.125 2006-09-02 6.0 Yongwei Wu Truncate the Vim title after the file name so that the file name is always visible when the directory name is long.
cvsmenu.vim 1.124 2006-08-20 6.0 Yongwei Wu Map `q' to quickly close the buffer opened by cvs annotate and cvs log.
cvsmenu.vim 1.123 2006-05-21 6.0 Yongwei Wu Update broken links and make self-update work again.
cvsmenu.vim 1.122 2006-05-13 6.0 Yongwei Wu Update CVS info due to the SourceForge site change to make updating itself continue to work.
cvsmenu.vim 1.121 2005-11-16 6.0 Yongwei Wu - Use extracted cvs command (w/o `-q' etc.) to match with CVSdontconvertfor; - Ensure correct message escaping on Windows when shell=cmd.exe (regardless of shellxquote); - Documentation is updated to reflect my changes: be sure to use `CVS - Settings - Install - Install updates' (or `Download updates' followed by `Install buffer as help' on the help file buffer) to get it.
cvsmenu.vim 1.118 2005-11-09 6.0 Yongwei Wu - Deal with "`" correctly under Unix;
- Make no-reload-prompt trick work when the committed file is not in the current directory.
cvsmenu.vim 1.116 2005-11-01 6.0 Yongwei Wu - Do not allow to commit if the current file has not a name;
- Fix a bug when executing `:w file' on an unsaved named buffer.
cvsmenu.vim 1.114 2005-10-14 6.0 Yongwei Wu - Work around a problem that unedit of CVSNT may prompt to revert changes;
- Allow the ouput encoding of cvs be different from the Vim encoding (e.g., to make Chinese in annotate and the error message of CVSNT display correctly, one may now use `let CVScvsoutputencoding="gbk"' in .vimrc).
cvsmenu.vim 1.112 2005-09-22 6.0 Yongwei Wu - Rename CVSaddspaceafterannotate to CVSspacesinannotate;
- Display two missing parameters in CVS - Info;
- Avoid the reload prompt after commit;
- Do not allow to commit if the current buffer is modified.
cvsmenu.vim 1.109 2005-07-07 6.0 Yongwei Wu Fix problems with CVS annotation highlighting.
cvsmenu.vim 1.107 2005-06-08 6.0 Yongwei Wu - Allow space adjustment of output of "CVS - Annotate"  (assign a positive value to g:CVSaddspaceafterannotate) so that files that use TABs can align better.
- Output of "CVS - Annotate" is now highlighted.
cvsmenu.vim 1.104 2005-04-28 6.0 Yongwei Wu - Do not remap keys for new buffers output by cvs annotate, history, and log.
- Correct the help message for output buffer.
cvsmenu.vim 1.102 2005-04-19 6.0 Yongwei Wu Make menu commands like "CVS - Directory - Update" work in insert mode.
cvsmenu.vim 1.100 2005-04-17 6.0 Yongwei Wu Do not reload-after-commit after a directory commit (to avoid an error).

Fix CVSInstallAsPlugin and CVSInstallAsHelp so that the plugin and its help are installed to where the script is currently installed.
cvsmenu.vim 1.97 2005-04-04 6.0 Yongwei Wu Fix the broken key mapping. Now it is possible to use key sequences similar to the menu hot keys. E.g. `alt-c, i' is used to commit when the GUI menu exists; so `,ci' could be used in text-mode Vim to commit.
cvsmenu.vim 1.96 2005-03-28 6.0 Yongwei Wu Make sure the special characters "&", "<", ">", "|", and "^" are handled correctly if shell is cmd.exe and shellxquote is \" (there will be miscellaneous gotchas if the shell is command.com or shellxquote is empty).

Change the prefixing spaces in menu items to appending spaces to make wildmenu users happier (when wim includes longest).
cvsmenu.vim 1.94 2005-03-22 6.0 Yongwei Wu Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/ftplugin_po.vim.html0000644000000000000000000005170712204336073017434 0ustar po.vim - ftplugin for easier editing of GNU gettext PO files : vim online
    sponsor Vim development Vim logo Vim Book Ad

po.vim : ftplugin for easier editing of GNU gettext PO files

 script karma  Rating 182/58, Downloaded by 1528

created by
Aleksandar Jelenak
 
script type
ftplugin
 
description
This file is a Vim ftplugin for editing PO files (GNU gettext -- the GNU
i18n and l10n system). It automates over a dozen frequent tasks that
occur while editing files of this type.

                                                                                    Key mappings
Action (Insert mode)                                                GUI Vim     Vim
===============================================================
Move to an untransl. string forward                       <S-F1>      \m
Move to an untransl. string backward                   <S-F2>       \p
Copy the msgid string to msgstr                            <S-F3>      \c
Delete the msgstr string                                           <S-F4>      \d
Move to the next fuzzy translation                         <S-F5>       \f
Move to the previous fuzzy translation                 <S-F6>       \b
Label the translation fuzzy                                       <S-F7>      \z
Remove the fuzzy label                                            <S-F8>      \r
Show msgfmt statistics for the file(*)                      <S-F11>     \s
Browse through msgfmt errors for the file(*)         <S-F12>     \e
Put the translator info in the header                             \t             \t
Put the lang. team info in the header                           \l             \l
---------------------------------------------------------------
(*) Only available on UNIX computers.


                                                                                  Key mappings
Action (Normal mode)                                           GUI Vim     Vim
===============================================================
Move to an untransl. string forward                      <S-F1>      \m
Move to an untransl. string backward                  <S-F2>      \p
Move to the next fuzzy translation                        <S-F5>      \f
Move to the previous fuzzy translation                <S-F6>      \b
Label the translation fuzzy                                     <S-F7>      \z
Remove the fuzzy label                                          <S-F8>      \r
Split-open the file under cursor                                  gf           gf
Show msgfmt statistics for the file(*)                    <S-F11>     \s
Browse through msgfmt errors for the file(*)       <S-F12>     \e
Put the translator info in the header                            \t            \t
Put the lang. team info in the header                          \l            \l
---------------------------------------------------------------
(*) Only available on UNIX computers.

Remarks:
- "S" in the above key mappings stands for the <Shift> key and "\" in
  fact means "<LocalLeader>" (:help <LocalLeader>), which is "\" by
  Vim's default.
- Information about the translator and language team is supplied by two
  global variables: 'g:po_translator' and 'g:po_lang_team'. They should
  be defined in the ".vimrc" (UNIX) or "_vimrc" (Windows) file. If they
  are not defined, the default values (descriptive strings) are put
  instead.
- Vim's "gf" Normal mode command is remapped (local to the PO buffer, of
  course). It will only function on lines starting with "#: ". Search
  for the file is performed in the directories specified by the 'path'
  option. The user can supply its own addition to this option via the
  'g:po_path' global variable. Its default value for PO files can be
  found by typing ":set path?" from within a PO buffer. For the correct
  format please see ":help 'path'". Warning messages are printed if no
  or more than one file is found.
- Vim's Quickfix mode (see ":help quickfix") is used for browsing
  through msgfmt-reported errors for the file. No MO file is created
  when running the msgfmt program since its output is directed to
  "/dev/null". The user can supply command-line arguments to the msgfmt
  program via the global variable 'g:po_msgfmt_args'. All arguments are
  allowed except the "-o" for output file. The default value is
  "-vv -c".

But there's even more!

Every time the PO file is saved, a PO-formatted time stamp is
automatically added to the file header.
 
install details
    Put this file in a Vim ftplugin directory. On UNIX computers it is
    usually either "~/.vim/ftplugin" or "~/.vim/after/ftplugin". On Windows
    computers, the defaults are "$VIM\vimfiles\ftplugin" or
    "$VIM\vimfiles\after\ftplugin". For more information consult the Vim
    help, ":help 'ftplugin'" and ":help 'runtimepath'".
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
po.vim 1.2 2005-04-13 6.0 Aleksandar Jelenak No major new features, mainly work under the hood to strengthen
current functionality.

Changes:

- Smarter handling of fuzzy translation marks
- New key mappings for some commands in Normal mode
- More commands available in Normal mode
- gf mapping should hopefully be more useful now
po.vim 1.11 2003-07-10 6.0 Aleksandar Jelenak Minor update to ver. 1.1: Running msgfmt statistics for the PO file does
not produce a 'message' output file anymore.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_NERD_commenter.vim.html0000644000000000000000000011574412204336073021267 0ustar The NERD Commenter - A plugin that allows for easy commenting of code for many filetypes. : vim online
    sponsor Vim development Vim logo Vim Book Ad

The NERD Commenter : A plugin that allows for easy commenting of code for many filetypes.

 script karma  Rating 1379/446, Downloaded by 31822  Comments, bugs, improvements  Vim wiki

created by
Marty Grenfell
 
script type
utility
 
description
Grab the latest dev version from github: https://github.com/scrooloose/nerdcommenter.

The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings):

Most of the following mappings are for normal/visual mode only. The
|NERDComInsertComment| mapping is for insert mode only.

[count]<leader>cc |NERDComComment|
Comment out the current line or text selected in visual mode.


[count]<leader>cn |NERDComNestedComment|
Same as <leader>cc but forces nesting.


[count]<leader>c<space> |NERDComToggleComment|
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.


[count]<leader>cm |NERDComMinimalComment|
Comments the given lines using only one set of multipart delimiters.


[count]<leader>ci |NERDComInvertComment|
Toggles the comment state of the selected line(s) individually.


[count]<leader>cs |NERDComSexyComment|
Comments out the selected lines ``sexily''


[count]<leader>cy |NERDComYankComment|
Same as <leader>cc except that the commented line(s) are yanked first.


<leader>c$ |NERDComEOLComment|
Comments the current line from the cursor to the end of line.


<leader>cA |NERDComAppendComment|
Adds comment delimiters to the end of line and goes into insert mode between
them.


|NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.


<leader>ca |NERDComAltDelim|
Switches to the alternative set of delimiters.


[count]<leader>cl
[count]<leader>cb    |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the
left side (<leader>cl) or both sides (<leader>cb).


[count]<leader>cu |NERDComUncommentLine|
Uncomments the selected line(s).
 
install details
The NERD Commenter requires Vim 7 or higher.

Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
should have 2 files:
    plugin/NERD_commenter.vim
    doc/NERD_commenter.txt

Next, to finish installing the help file run:
    :helptags ~/.vim/doc

See |add-local-help| for more details.

Make sure that you have filetype plugins enabled, as the script makes use of
|'commentstring'| where possible (which is usually set in a filetype plugin).
See |filetype-plugin-on| for details, but basically, stick this in your vimrc
    filetype plugin on
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
nerdcommenter.zip 2.3.0 2010-12-07 7.0 Marty Grenfell - remove all filetypes which have a &commentstring in the standard vim runtime
  for vim > 7.0 unless the script stores an alternate set of delimiters
- make the script complain if the user doesnt have filetype plugins enabled
- use <leader> instead of comma to start the default mappings
- fix a couple of bugs with sexy comments - thanks to Tim Smart
- lots of refactoring
NERD_commenter.zip 2.2.2 2009-03-30 7.0 Marty Grenfell - remove the NERDShutup option and the message is
  suppresses, this makes the plugin silently rely on
  &commentstring for unknown filetypes.
- add support for dhcpd, limits, ntp, resolv, rgb, sysctl,
  udevconf and udevrules. Thanks to Thilo Six.
- match filetypes case insensitively
- add support for mp (metapost), thanks to Andrey Skvortsov.
- add support for htmlcheetah, thanks to Simon Hengel.
- add support for javacc, thanks to Matt Tolton.
- make <%# %> the default delims for eruby, thanks to tpope.
- add support for javascript.jquery, thanks to Ivan Devat.
- add support for cucumber and pdf. Fix sass and railslog
  delims, thanks to tpope
NERD_commenter.zip 2.2.1 2008-11-13 7.0 Marty Grenfell - add support for newlisp and clojure, thanks to Matthew Lee Hinman.
- fix automake comments, thanks to Elias Pipping
- make haml comments default to -# with / as the alternative delimiter,
  thanks to tpope
- add support for actionscript and processing thanks to Edwin Benavides
- add support for ps1 (powershell), thanks to Jason Mills
- add support for hostsaccess, thanks to Thomas Rowe
- add support for CVScommit
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
- use # for gitcommit comments, thanks to Simon Ruderich.
- add support for mako and genshi, thanks to Keitheis.
- add support for conkyrc, thanks to David
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
- add support for sieve, thanks to Stefan Walk
- add support for objj, thanks to Adam Thorsen.
NERD_commenter.zip 2.2.0 2008-10-03 7.0 Marty Grenfell - rewrote the mappings system to be more "standard".
  - removed all the mapping options. Now, mappings to <plug>
    mappings are used
  - see :help NERDComMappings, and :help
    NERDCreateDefaultMappings for more info
- remove "prepend comments" and "right aligned comments".
- add support for applescript, calbire, man, SVNcommit,
  potwiki, txt2tags and SVNinfo.  Thanks to nicothakis,
  timberke, sgronblo, mntnoe, Bernhard Grotz, John O'Shea,
  François and Giacomo Mariani respectively.
- bugfix for haskell delimiters. Thanks to mntnoe.
NERD_commenter.zip 2.1.18 2008-07-27 7.0 Marty Grenfell - add support for llvm. Thanks to nicothakis.
- add support for xquery. Thanks to Phillip Kovalev.
- fixed haskell delimiters (hackily). Thanks to Elias
  Pipping.
- add support for mailcap. Thanks to Pascal Brueckner.
- add support for stata. Thanks to Jerónimo Carballo.
- applied a patch from ewfalor to fix an error in the help
  file with the NERDMapleader doc
- disable the insert mode ctrl-c mapping by default, see
  :help NERDComInsertComment if you wish to restore it
NERD_commenter.zip 2.1.16 2008-06-26 7.0 Marty Grenfell compatibility fix for vim7.2, cheers to Ben Schmidt, David Fishburn, and
Erik Falor for the emails, and to JaGoTerr for posting the issue.
NERD_commenter.zip 2.1.15 2008-06-21 7.0 Marty Grenfell - added pamconf support, thanks to Martin Kustermann
- added mason support, thanks to Indriði Einarsson
- added map support, thanks to Chris
- added bzr support, thanks to Stromnov
- added group support, thanks to Krzysztof A. Adamski
- change license to wtfpl
NERD_commenter.zip 2.1.14 2008-05-16 7.0 Marty Grenfell - added support for gitconfig, tar, nerdtree
- added support for dtrace, thanks to nicothakis for the post
NERD_commenter.zip 2.1.13 2008-05-03 7.0 Marty Grenfell - added support for rib, pyrex/cython, liquid, services, gitcommit,
  vimperator, and slice. Thanks to spookypeanut, Greg Jandl, Christophe
  Benz, A Pontus, and Stromnov for emailing me and/or posting issues.
- set the NERDRemoveExtraSpaces option to 1 by default as the doc states
- other fixes: (thanks to Zhang Shuhan for all his emails and testing)
    * made the sexy comment mapping fall back to normal commenting if sexy
      comments arent possible for the current filetype
    * fixed some bugs with sexy comments
    * made the uncommenting side of toggle comments slightly more robust
    * fixed a bug where some extra spaces werent being removed (although
      the currect options were set)
NERD_commenter.zip 2.1.12 2008-03-30 7.0 Marty Grenfell - added support for patran and dakota, thx to Jacobo Diaz for the email
- added support for gentoo-env-d, gentoo-init-d, gentoo-make-conf, grub, modconf and sudoers filetypes, thx to Li Jin for the patch.
- added support for SVNdiff, gitAnnotate, gitdiff. Thx to nicothakis for posting the issue
NERD_commenter.zip 2.1.11 2008-02-23 7.0 Marty Grenfell - fixed a bug with the selection option and visual commenting (again).  Thanks to Ingo Karkat (again).
NERD_commenter.zip 2.1.10 2008-02-22 7.0 Marty Grenfell - added support for Wikipedia (thanks to Chen Xing)
- added support for mplayerconf
- bugfixes (thanks to Ingo Karkat for the bug report/patch)
- added support for mkd (thanks to Stefano Zacchiroli)
NERD_commenter.zip 2.1.9 2008-01-18 7.0 Marty Grenfell - added support for mrxvtrc and aap, thx to Marco for the emails
- added dummy support for SVNAnnotate, SVKAnnotate and CVSAnnotate, thx to nicothakis for posting the issue
NERD_commenter.zip 2.1.8 2007-12-13 7.0 Marty Grenfell - fixed a couple of bugs with the NERDSpaceDelims option, thx to David Miani and Jeremy Hinegardner
- added dummy support for lhaskell, thx to pipp for posting the issue
- added an alternative set of delims for the plsql filetype, thx to Kuchma Michael
- added support for spectre, thx to Brett Warneke
- added support for scala, thx to Renald Buter
- added support for asymptote, thx to Vladimir Lomov
- made NERDDefaultNesting enabled by default as this seems more intuitive, thx to marco for the suggestion
NERD_commenter.vim 2.1.6 2007-10-25 7.0 Marty Grenfell - added support for gentoo-conf-d thanks to tinoucas for posting the issue and the patch
- added support for the D filetype. Thanks to Greg Weber for the email.
- added dummy support for cobol, cheers to timberke for posting the issue.
- added support for velocity. Thanks to Bruce Sherrod for the email.
NERD_commenter.vim 2.1.5 2007-10-12 7.0 Marty Grenfell - added support for lilypond, bbx and lytex. Thanks to Eyolf Østrem for the email.
- added an alterative set of delimiters for the dosbatch filetype, thanks to Ingo Karkat for the email.
- added support for the markdown filetype. Thanks to Nicolas Weber for posting the issue.
NERD_commenter.vim 2.1.4 2007-09-29 7.0 Marty Grenfell - added support for the ahk filetype. Cheers to Don Hatlestad for the email.
- added support for desktop and xsd filetypes. Thanks to Christophe Benz.
- added dummy support for Rails-log
- fixed a bunch of bugs in the comment delimiter setup process, thanks to Cheng Fang for the email :D
- hardcore refactoring and removal of seldomly used, overly-complex functionality
- the script now requires vim 7
NERD_commenter.vim 2.1.3 2007-08-27 6.0 Marty Grenfell - fixed numerous bugs that were causing tabs to permanently be converted to spaces, even if noexpandtab was set. Thanks to Heptite on #vim for working with me to track them down :)
- added dummy support for "lookupfile". Thanks to David Fishburn for the email.
- added support for "rst", thanks to Niels Aan de Brugh for the email.
NERD_commenter.vim 2.1.2 2007-08-22 6.0 Marty Grenfell Added support for the vera and ldif filetypes. Thanks to Normandie
Azucena and Florian Apolloner for the emails.
NERD_commenter.vim 2.1.1 2007-08-18 6.0 Marty Grenfell - added dummy support for SVNcommitlog and vcscommit. Thanks to John O'Shea for the email.
- added support for Groovy. Thanks to Jason Mills for the email.
NERD_commenter.vim 2.1.0 2007-08-08 6.0 Marty Grenfell - now the script resets the delimiters when the filetype of the buffer changes (thanks to James Hales for the patch)
- added formal support/doc for prepending a count to many of the commenting maps so you can go, eg, 5,cc to comment 5 lines from normal  mode. Thanks again to James Hales for the patch.
- added support for the "gams" filetype that Jorge Rodrigues created.
- added support for the "objc" filetype, thanks to Rainer Müller for the email.
- added support for the "sass" filetype that Dmitry Ilyashevich created.
NERD_commenter.vim 2.0.7 2007-07-22 6.0 Marty Grenfell Added support for eclass and ebuild filetypes. Thanks to Alex Tarkovsky
for the email.
NERD_commenter.vim 2.0.6 2007-06-29 6.0 Marty Grenfell - Changed the default setting of NERDMapleader to ",c", meaning all the maps now start with ,c instead of \c. This is to stop a major mapping clash with the vcscommand plugin. Anyone wanting to keep the \c map leader should read :help NERDMapleader.
- Added support for debcontrol and dummy support for debchangelog filetypes, thanks to Stefano Zacchiroli for the email.
- Made it so that the NERDShutUp option now only controls the "Pleeease email the delimiters..." requests. It no longer affects the general output of the script.
- Simplified the names of the help tags.
NERD_commenter.vim 2.0.5 2007-06-16 6.0 Marty Grenfell - Added support for autoit, autohotkey and docbk filetypes (thanks to  Michael Böhler)
- Added support for cmake (thanks to Aaron Small)
- Added support for htmldjango and django filetypes (thanks to Ramiro  Morales)
- Improved the delimiters for eruby again
- Applied a patch from Seth Mason to fix some pathing issues with the help  file installation.
NERD_commenter.vim 2.0.4 2007-05-11 6.0 Marty Grenfell - Added support for verilog_systemverilog and systemverilog filetypes
  (Thanks to Alexey for the email)
- Added support for fstab, thanks to Lizendir for the email.
- Added support for the smarty filetype.
- Improved the delimiters for eruby.
- Added dummy support for changelog filetype.
NERD_commenter.vim 2.0.3 2007-05-03 6.0 Marty Grenfell - Added dummy support for the csv filetype (thx to Mark Woodward for the
  email)
- Added dummy support for vo_base and otl filetypes (thanks to fREW for
  the email)
NERD_commenter.vim 2.0.2 2007-04-13 6.0 Marty Grenfell Minor bug fix that was stopping nested comments from working
NERD_commenter.vim 2.0.1 2007-04-12 6.0 Marty Grenfell - Fixed the visual bell for the |NERDComToEOLMap| map.
- Added another possible value to the NERDMenuMode option which causes the
  menu to be displayed under 'Plugin -> Comment'. See :h NERDMenuMode.
  This new menu mode is now the default.
- Added support for the occam filetype (thanks to Anders for emailing me)
- Made the main commenting function (NERDComment) available outside the
  script. See :h NERD_com_NERDComment
- bug fixes and refactoring
NERD_commenter.vim 2.0.0 2007-04-02 6.0 Marty Grenfell - NOTE: renamed the script to  NERD_commenter.vim. When you install this
  version you must delete the old files: NERD_comments.vim and
  NERD_comments.txt.
- Reworked the mappings and main entry point function for the script to
  avoid causing visual-bells and screen scrolling.
- Changes to the script options (see |NERD_com-Customisation| for
  details):
    - They are all camel case now instead of underscored.
    - Converted all of the regular expression options into simple boolean
      options for simplicity.
    - All the options are now stated positively, eg.
      NERD_dont_remove_spaces_regexp has become NERDRemoveExtraSpaces.
    - Some of the option names have been changed (other than in the above
      ways)
    - Some have been removed altogether, namely: NERD_create_h_filetype
      (why was a commenting script creating a filetype?!),
      NERD_left_align_regexp, NERD_right_align_regexp,

- Removed all the NERD_use_alt_style_XXX_coms options and replaced them
  with a better system. Now if a filetype has alternative delims, the
  script will check whether an option of the form
  "NERD_<&filetype>_alt_style" exists, and if it does then alt delims will
  be used. See |NERD_com-cust-delims| for details.
- The script no longer removes extra spaces for sexy comments for the
  NERDRemoveExtraSpaces option (it will still remove spaces if
  NERDSpaceDelims is set).
- Added dummy support for viminfo and rtf.
- Added support for the "gentoo-package-\(keywords\|mask\|use\)"
  filetypes.
- Added '#' comments as an alternative for the asm filetype

Thanks to Markus Klinik and Anders for bug reports, and again to Anders
for his patch. Thanks to John O'Shea and fREW for the filetype
information.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_snippetsEmu.vim.html0000644000000000000000000007271012204336073020775 0ustar snippetsEmu - An attempt to emulate TextMate's snippet expansion : vim online
    sponsor Vim development Vim logo Vim Book Ad

snippetsEmu : An attempt to emulate TextMate's snippet expansion

 script karma  Rating 1043/297, Downloaded by 8465

created by
Felix Ingram
 
script type
utility
 
description
***** IMPORTANT *****
The plugin has now been split into two separate vimballs. The plugin itself and the bundles. This was done because bundles were updated a lot more often than the plugin itself.

Previous users of the plugin should delete the old file when upgrading to 1.0. The name of the file changed in 0.6 and so you'll end up with two versions when unpacking the file. Remove the old version "snippetEmu.vim" from the plugin directory. The new version is called "snippetsEmu.vim". Note the extra 's'


Homepage: http://slipperysnippets.blogspot.com/
Issue tracker: http://code.google.com/p/snippetsemu/issues/list

Please email me bugs or create them in the issue tracker.

This file contains some simple functions that attempt to emulate some of the behaviour of 'Snippets' from the OS X editor TextMate, in particular the variable bouncing and replacement behaviour.

DIVING IN:

Install the plugin, start a new perl file (as an example) and type the following in insert mode:

for<tab><tab><tab><tab>

You'll see the text expand and the jumping in action. Try the same again but this time type a new value for 'var' once it is selected. I.e.

for<tab>test<tab><tab><tab>

Notice how all the 'var's are replaced with 'test'.

Check out the bundles and the docs for more examples of what can be done.

*IMPORTANT*

If you have any questions, suggestions, problems or criticisms about the plugin then please, please email me and I will do the best to help.
 
install details
Firstly create an 'after/ftplugin' directory in your vim home (e.g. ~/.vim/after/ftplugin under unix or vimfiles/after/ftplugin under Windows). This is required as Vimball sometimes does not create it for some reason.

Download the plugin vimball (and the bundle vimball if you would like the default snippets).

Now open the Vimball(s) with Vim and follow the instructions (source the vimball to install everything). Vimball should create the help tags. Do a :helptags on your doc directory if it hasn't.

Enjoy
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
snippy_plugin.vba 1.2.3 2008-03-13 7.0 Felix Ingram Fixed jumping bug which caused problems with tags between two named tags being missed out. (really, really uploaded new version)
snippy_bundles.vba 1.2 2008-03-13 7.0 Felix Ingram Small fix to php bundle. 'php' trigger is now 'phpp'. Previous version could too easily cause conflicts when using the 'incl' snippet.
snippy_bundles.vba 1.1 2008-03-03 7.0 Felix Ingram Updates to the C and HTML bundles
snippy_bundles.vba 1.0 2008-02-25 7.0 Felix Ingram Filetype plugins for snippetsEmu
snippy_plugin.vba 1.2.2 2008-02-25 7.0 Felix Ingram Bug fix to plugin. Annoying window jumping sorted out. Bundles are now in a separate vimball.
snippetsemu1.2.1.vba 1.2.1 2007-09-30 7.0 Felix Ingram VBA file now has unix fileformat, so things should be working better. Vimball has also added fold markers, which aren't backwards compatible, so I've removed them as well.
snippetsemu1.2.vba 1.2 2007-09-30 7.0 Felix Ingram Finally released new version. Big change: No more messing with iskeyword. Other stuff - Commands with autocomplete, new commands for creating snippets, updated bundles. Be sure to read the docs to see what's available.
snippetsemu1_1.vba 1.1 2007-04-05 7.0 Felix Ingram New version contains several bug fixes, reverts start and end tags to more 'friendly' settings and tries to address indenting issues. Snippets must now define their own 'local' indenting. Make sure you create the after/ftplugin directories as described in the installation instructions.
SnippetsEmu_1.0.1.vba 1.0.1 2006-12-29 7.0 Felix Ingram Even more super 1.0.1 version with Unix line endings on the Vimball so things install properly on *nix.
SnippetsEmu_1.0.vba 1.0 2006-12-28 7.0 Felix Ingram Super new 1.0 version with many new features and improvements. New bundles also included.
snippetsEmu0.6.1.vba 0.6.1 2006-11-28 7.0 Felix Ingram Quick fix changes the line endings for the VBA to UNIX which should hopefully stop some problems people are having
snippetsEmu0.6.vba 0.6 2006-11-25 7.0 Felix Ingram Bugs fixes as per usual but this new version includes a set of snippets bundles for use with various filetypes. Plugin is now a VimBall so everything is in one file.
snippetEmu0.5.6.vim 0.5.6 2006-08-29 7.0 Felix Ingram Fixed several bugs from the last version including random bug which prevented snippets from starting with 's'.
snippetEmu0.5.5.vim 0.5.5 2006-08-14 7.0 Felix Ingram Fixed various bugs: s:search_str not being defined or being buffer specific and command tag execution not working with two tags on the same line.
snippetEmu0.5.4.vim 0.5.4 2006-07-25 7.0 Felix Ingram TextMate compatibile mode now works under linux.
snippetEmu0.5.3.vim 0.5.3 2006-07-12 7.0 Felix Ingram Bug fixes. Things are a lot better behaved. Edge cases should (should) work a lot better now. Highly recommended upgrade.
snippetEmu0.5.2.vim 0.5.2 2006-07-04 7.0 Felix Ingram Minor bug fix. Textmate compatible mode did not allow quotes in expansions. Fixed
snippetEmu0.5.1.vim 0.5.1 2006-07-03 7.0 Felix Ingram This new version adds some bug fixes to the last release and adds the new functionality of being able to define multicharacter start and end tags. It is now easier to define tags which work across multiple languages.
snippetEmu0.5.0.vim 0.5.0 2006-07-01 7.0 Felix Ingram This new version adds TextMate style expansions: snippets are not expanded automatically. The user must press Tab for a snippet to be expanded. Tabbing will jump between tags or insert a <Tab> if no tags are active.

The tag syntax has changed. Default values are not supported anymore: use the tag's name instead. Commands can now be added in the first tag and unnamed tags can include commands.

This is a test release: please send bug reports.
snippetEmu.vim 0.3.6 2006-01-16 6.0 Felix Ingram Minor bug fix.  Replacement values modified by commands would be passed to future commands in their modified form, rather than with the original replacement value.
snippetEmu.vim 0.3.5 2006-01-14 6.0 Felix Ingram Fundamental change to the way the new commands feature works.  The command is now 'executed' and the result placed in the variable @z.  The intention is for the command to be a function call rather than a standard command.  I.e. using substitute() rather than :s///.  The value to be replaced is available to the function in @z (previous values of the variable are kept and restored once the command has been executed).  See the updated docs for examples.
snippetEmu.vim 0.3.1 2006-01-12 6.0 Felix Ingram Bug fix - Non-greedy matching is now done on the command searching.
snippetEmu.vim 0.3 2006-01-11 6.0 Felix Ingram New version allows commands to be included in named tags.  Experimental version - does not appear to break older functionality, however.
snippetEmu.vim 0.2.5 2006-01-05 6.0 Felix Ingram Tag delimiters can now be set with autocommands to allow for different filetypes.  I.e. '<' and '>' for programming and '@' for HTML.
snippetEmu.vim 0.2.4 2006-01-05 6.0 Felix Ingram Fixed a bug where certain tags were not recognised
snippetEmu.vim 0.2.3 2006-01-04 6.0 Felix Ingram Now works with autoindenting
snippetEmu.vim 0.2.2 2005-08-09 6.0 Felix Ingram Better behaved.  Couple of bug fixes.
snippetEmu.vim 0.2.1 2005-08-09 6.0 Felix Ingram Added check for the default key combo so that the user's settings aren't clobbered.
snippetEmu.vim 0.2 2005-08-08 6.0 Felix Ingram I've given this a full point release as it's a major rewrite.  Start and end tags can now be defined and default values can also be used.
snippetEmu.vim 0.1 2005-07-26 6.0 Felix Ingram Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/macros_closetag.vim.html0000644000000000000000000004241012204336073020242 0ustar closetag.vim - Functions and mappings to close open HTML/XML tags : vim online
    sponsor Vim development Vim logo Vim Book Ad

closetag.vim : Functions and mappings to close open HTML/XML tags

 script karma  Rating 582/215, Downloaded by 8824

created by
Steven Mueller
 
script type
utility
 
description
This script eases redundant typing when writing html or xml files (even if you're very good with ctrl-p and ctrl-n  :).  Hitting ctrl-_ will initiate a search for the most recent open tag above that is not closed in the intervening space and then insert the matching close tag at the cursor.  In normal mode, the close tag is inserted one character after cursor rather than at it, as if a<C-_> had been used.  This allows putting close tags at the ends of lines while in normal mode, but disallows inserting them in the first column.
                                                                              
For HTML, a configurable list of tags are ignored in the matching process.  By default, the following tags will not be matched and thus not closed automatically: Area, Base, Br, DD, DT, HR, Img, Input, LI, Link, Meta, P, and Param.
                                                                              
For XML, all tags must have a closing match or be terminated by />, as in <empty-element/>.  These empty element tags are ignored for matching.
                                                                              
Comments are not currently handled very well, so commenting out HTML in certain ways may cause a "tag mismatch" message and no completion.  ie, having '<!-- a href="blah">link!</a -->' between the cursor and the most recent open tag above doesn't work.  Well matched tags in comments don't cause a problem.
 
install details
To use, place this file in your standard vim scripts directory, and source it while editing the file you wish to close tags in.  If the filetype is not set or the file is some sort of template with embedded HTML, you may get HTML style tag matching by first setting the closetag_html_style global variable.  Otherwise, the default is XML style tag matching.
                                                                              
Example:
  :let g:closetag_html_style=1
  :source ~/.vim/scripts/closetag.vim
                                                                              
For greater convenience, load this script in an autocommand:
  :au Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
                                                                              
Also, set noignorecase for html files or edit b:unaryTagsStack to match your capitalization style.  You may set this variable before or after loading the script, or simply change the file itself.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
closetag.vim 0.9.1 2005-05-24 6.0 Steven Mueller Bugfix release: Changed function names to be script-local to avoid conflicts with other scripts' stack implementations.
closetag.vim 0.9 2001-06-08 5.7 Steven Mueller Added synID()-based comment awareness:
Comment checking is now handled by vim's internal syntax checking.  Closing tags outside comments only matches non-commented tags.  Closing tags in comments matches only tags within comments, skipping blocks of normal code (wee!).  Can be really slow if syn sync minlines is large.  Set the b:closetag_disable_synID variable to disable comment contexts if it's too slow.

Normal mode closetag now uses <C-R> in insert mode rather than p in normal mode:  Tag closing no longer clobbers the unnamed register, and (for vim 6.0) Doesn't modify the undo buffer when no change was made.  Made closetag_html_style variable buffer-local.  Improved documentation (hopefully).

Configuration Variables rundown:
- b:unaryTagsStack            Buffer local string containing a whitespace seperated list of element names that should be ignored while finding matching closetags.  Checking is done according to the current setting of the ignorecase option.
- b:closetag_html_style       Define this (as with let b:closetag_html_style=1) and source the script again to set the unaryTagsStack to its default value for html.
- b:closetag_disable_synID    Define this to disable comment checking if tag closing is too slow.
closetag.vim 0.8 2001-06-05 5.7 Steven Mueller Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_surround.vim.html0000644000000000000000000005076612204336073020351 0ustar surround.vim - Delete/change/add parentheses/quotes/XML-tags/much more with ease : vim online
    sponsor Vim development Vim logo Vim Book Ad

surround.vim : Delete/change/add parentheses/quotes/XML-tags/much more with ease

 script karma  Rating 2158/653, Downloaded by 38153    Comments, bugs, improvements  Vim wiki

created by
Tim Pope
 
script type
utility
 
description
Surround.vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more.  The plugin provides mappings to easily delete, change and add such surroundings in pairs.  While it works under Vim 6, much of the functionality requires Vim 7.

Examples follow.  It is difficult to provide good examples in the variable width font of this site; check the documentation for more.

Press cs"' (that's c, s, double quote, single quote) inside

"Hello world!"

to change it to

'Hello world!'

Now press cs' to change it to

Hello world!

To go full circle, press cst" to get

"Hello world!"

To remove the delimiters entirely, press ds" .

Hello world!

Now with the cursor on "Hello", press ysiw] (iw is a text object).

[Hello] world!

Let's make that braces and add some space (use "}" instead of "{" for no space): cs]{

{ Hello } world!

Now wrap the entire line in parentheses with yssb or yss) .

({ Hello } world!)

Revert to the original text: ds{ds)

Hello world!

Emphasize hello: ysiw

Hello world!

Finally, let's try out visual mode. Press a capital V (for linewise visual mode)
followed by S.


  Hello world!


This plugin is very powerful for HTML and XML editing, a niche which currently seems underfilled in Vim land.  (As opposed to HTML/XML *inserting*, for which many plugins are available).  Adding, changing, and removing pairs of tags simultaneously is a breeze.

The "." command will work with ds, cs, and yss if you install repeat.vim, vimscript #2136.

All feedback appreciated.

http://github.com/tpope/vim-surround
 
install details
Extract to ~/.vim, or ~\vimfiles (Windows).  You'll need to regenerate helptags (fill in the install path below)

:helptags ~/.vim/doc
 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
surround.zip 2.0 2013-01-01 7.0 Tim Pope Fix vs with selection=exclusive.
Remove `unnamedplus' from clipboard in addition to `unnamed'.
Kill vs.
Bump to Vim 7.
Add support for repeating ys commands.
Add support for repeating tags.
Don't save deleted surrounding in unnamed register.
Fix deletion of delimiters on their own lines.
surround.zip 1.90 2010-03-06 6.0 Tim Pope Completely eliminate wonky % mapping in prompts.
Workaround for user remapped d. [Christian Oudard]
Introduce vgS and begin phasing out vs.
surround.zip 1.34 2008-02-15 6.0 Tim Pope One more regression fix.
This is really really planned as the last release with partial Vim 6.0 compatibility  (third time's the charm).
surround.zip 1.33 2008-02-03 7.0 Tim Pope Fixed regressions from previous release.
This is really planned as the last release with partial Vim 6.0 compatibility.
surround.zip 1.30 2008-01-27 7.0 Tim Pope Fixed edge case where ds could move a multiline inner text down one line.
This is planned as the last release with partial Vim 6.0 compatibility.
surround.zip 1.27 2007-10-03 7.0 Tim Pope Fixed multiline surrounds in insert mode
surround.vim 1.26 2007-07-31 7.0 Tim Pope Added a /* C style comment */ target.
Insert mode indenting limited to multiline insertions.
surround.zip 1.24 2007-05-10 7.0 Tim Pope surround_indent now works in insert mode.
Added <C-]> to add braces on separate lines.
surround.zip 1.23 2007-02-16 7.0 Tim Pope xmap rather than vmap, to avoid interfering with select mode.
surround_insert_tail to specify a universal suffix for use in insert mode.
surround.zip 1.22 2007-02-11 7.0 Tim Pope Function properly when clipboard=unnamed
Very experimental custom prompting for substitution text
surround.zip 1.18 2006-11-13 7.0 Tim Pope Zip file instead of documentation extraction hack
surround.vim 1.17 2006-11-09 6.0 Tim Pope Insert mode mapping that doesn't conflict with flow control.
Fixed edge case with ys where one too many characters would be grabbed.
surround.vim 1.16 2006-11-05 7.0 Tim Pope S in blockwise visual mode strips trailing whitespace.
surround.vim 1.12 2006-10-31 7.0 Tim Pope Lots of tiny bug fixes and cleanup.
"S" mappings to force surroundings onto a separate line.
Support for blockwise visual mode.
surround.vim 1.6 2006-10-29 7.0 Tim Pope Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/index.html0000644000000000000000000000634712204336073015423 0ustar vim-scripts - scripts web pages index

vim-scripts - scripts web pages index:

Below you can find a list pointing to the web pages of the addons shipped in the vim-scripts package, as they appearead on the Vim Website when the package has been built (for the actual date see the bottom of this page).

Page generated on Wed, 14 Aug 2013 23:16:45 -0400 .

vim-scripts-20130814ubuntu1/html/plugin_minibufexpl.vim.html0000644000000000000000000007432512204336073021007 0ustar minibufexpl.vim - Elegant buffer explorer - takes very little screen space : vim online
    sponsor Vim development Vim logo Vim Book Ad

minibufexpl.vim : Elegant buffer explorer - takes very little screen space

 script karma  Rating 2286/698, Downloaded by 24435

created by
bindu wavell
 
script type
utility
 
description
Several modern GUI editors list your open buffers as tabs along the top or bottom of your screen (VisualStudio, DreamWeaver, EditPlus and UltraEdit come to mind), now we have this feature in VIM! You can checkout a screenshot here: http://www.wavell.net/vim/vim_screenshot.gif.

You can quickly switch buffers by double-clicking the appropriate "tab" (if you don't want to use the mouse just put the cursor on the "tab" and press enter). As you open and close buffers the tabs get updated. Buffers that are modified get visually marked and buffers that are open in a window get visually marked. The -MiniBufferExplorer- opens automatically when you open more than one eligible buffer (no need to open the explorer if you’re only editing one file.) -MiniBufExplorer- doesn't bother showing non-modifiable or hidden buffers. You can delete buffers by selecting them and pressing d on the keyboard.

When you are in the -MiniBufExplorer- window, Tab and Shift-Tab move forward and backward respectively through the buffer list.

There are a growing number of optional features in this script that are enabled by letting variables in your .vimrc:

  control + the vim direction keys [hjkl] can be made to move you between windows.
  control + arrow keys can be made to do the same thing
  control + tab & shift + control + tab can be setup to switch through your open windows (like in MS Windows)
  control + tab & shift + control + tab can alternatively be setup to cycle forwards and backwards through your modifiable buffers in the current window

NOTE: Some versions of vim don't support all of the key mappings that this script uses so you may experience degraded functionality. For example on Solaris SHIFT-TAB appears to fire the regular TAB mappings (same for console and gvim.) Also CONTROL+ARROWS appears to work in gvim on Solaris, but not in my xterm. All of the key bindings appear to work in Windows.

[Thanks to Jeff Lanzarotta for his BufExplorer plugin (http://vim.sourceforge.net/scripts/script.php?script_id=42) that got me started down this slippery slope.]
 
install details
Copy minibufexpl.vim into your plugin directory. Or :source minibufexpl.vim. That is all you need to get started.

If you want to enable extra functionality (documented in the source) you might want to add the following to your .vimrc:

  let g:miniBufExplMapWindowNavVim = 1
  let g:miniBufExplMapWindowNavArrows = 1
  let g:miniBufExplMapCTabSwitchBufs = 1
  let g:miniBufExplModSelTarget = 1

These are options that I expect most user will enjoy.

You can configure things like how tabs wrap, how big or small the explorer window is, if the explorer window is horizonal or vertical, the use of single or double click for buffer selection, what colors are used for the tabs in different states, how many buffers need to be open before the explorer window opens, etc. There are also some commands that you can use in your own key bindings for simple buffer manipulation. All of these options and more are documented at the top of the source file.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
minibufexpl.vim 6.3.2 2004-11-18 6.0 bindu wavell For some reason there was still a call to StopExplorer with 2 params. Many thanks to Jason Mills for reporting this!
minibufexpl.vim 6.3.1 2004-06-30 6.0 bindu wavell Added g:miniBufExplForceSyntaxEnable option for folks that are experiencing the vim bug where buffers show up without highlighting when another buffer has been closed, quit, wiped or deleted. This resolves all known issues with buffers loosing their highlighting. If you find a case that is not resolved, please report it :)

Folded source so that it's easier to navigate
minibufexpl.vim 6.3.0 2004-06-24 6.0 bindu wavell FEATURE RELEASE:
o Added optional single click to select buffers in the MBE window
o MBE is no longer included in :ls output
o Added the ability to have your tabs show up in a vertical window
o Autosize vertical explorer window

NOTE: Folks who use the single click feature in TagList should wait to use the MBE single click feature until the next release of TagList (~2 weeks) which includes a patch to allow both explorers to utilize single click.

CHANGE
o g:miniBufExplMaxHeight was renamed g:miniBufExplMaxSize
o g:miniBufExplMinHeight was renamed g:miniBufExplMinSize

The old settings are backwards compatible if you don't use the new settings. The old settings are depreciated.
minibufexpl.vim 6.2.8 2004-06-07 6.0 bindu wavell Added an option to stop MBE from targeting non-modifiable buffers when switching buffers. Those of you who use buffer explorers like taglist, project, etc and would like MBE to try not to place selected buffers into explorer windows will like this one :) To get this working download the latest version of minibufexpl.vim and put "let g:miniBufExplModSelTarget = 1" into your .vimrc. This is not a 100% guarantee, but it does a good job of trying to avoice explorer windows. Thanks to A.W. Law for the inspiration for this.
minibufexpl.vim 6.2.7 2004-05-24 6.0 bindu wavell Very minor bug fix for people who want to set loaded_minibufexplorer in their .vimrc in order to stop MBE from loading. 99.99% of users do not need this update. Thanks to bash for finding this.
minibufexpl.vim 6.2.6 2003-04-30 6.0 bindu wavell Very minor update: Moved history to end of source file. Updated highlighting documentation. Created global commands MBEbn and MBEbp that can be used in mappings if folks want to cycle buffers while skipping non-eligible buffers.
minibufexpl.vim 6.2.5 2003-04-13 6.0 bindu wavell Added a ToggleExplorer option and updated the documentation.
minibufexpl.vim 6.2.4 2003-03-30 6.0 bindu wavell MiniBufExplorer is now compatible with :set hidden.
minibufexpl.vim 6.2.3 2003-03-26 6.0 bindu wavell Added an optional feature to cause tabs to wrap. i.e. you should never get a tab name split across two lines (there is a potential issue if you have filenames with spaces, but otherwise this works.)
minibufexpl.vim 6.2.2 2003-03-25 6.0 bindu wavell Changed the way the g:miniBufExplorerMoreThanOne
global is handled. You can set this to the number
of eligible buffers you want to be loaded before
the MBE window is loaded. Setting it to 0 causes
the MBE window to be opened even if there are no
buffers. Setting it to 4 causes the window to stay
closed until the 4th eligible buffer is loaded.

Added a MinHeight option. This is nice if you want
the MBE window to always take the same amount of
space. For example set MaxHeight and MinHeight to 2
and set MoreThanOne to 0 and you will always have
a 2 row (plus the ruler :) MBE window.

I now setlocal foldcomun=0 and nonumber in the MBE
window. This is for those of you that like to have
these options turned on locally. I'm assuming noone
outthere wants foldcolumns and line numbers in the
MBE window? :)

Fixed a bug where an empty MBE window was taking half
of the screen (partly why the MinHeight option was
added.)
minibufexpl.vim 6.2.1 2003-03-21 6.0 bindu wavell If MBE is the only window (because of :bd for example) and there are still eligible buffers then one of them will be displayed.

The <Leader>mbe mapping now highlights the buffer from the current window.

The delete ('d') binding in the MBE window now restors the cursor position, which can help if you want to delete several buffers in a row that are not at the beginning of the buffer list.

Added a new key binding ('p') in the MBE window to switch to the previous window (last edit window)
minibufexpl.vim 6.2.0 2003-03-20 6.0 bindu wavell Major overhaul of autocommand and list updating code, we now have much better handling of :bd (which is the most requested feature.) As well as resolving other issues where the buffer list would not be updated automatically. The old version tried to trap specific events, this one just updates frequently, but it keeps track and only changes the screen if there has been a change.

Added g:miniBufExplMaxHeight variable so you can keep the -MiniBufExplorer- window small when you have lots of buffers (or buffers with long names :)

Improvement to internal syntax highlighting code I renamed the syntax group names. Anyone who has figured out how to use them already shouldn't have any trouble with the new Nameing :)

Added debug mode 3 which writes to a global variable this is fast and doesn't mess with the buffer/window lists.
minibufexpl.vim 6.1.0 2003-03-14 6.0 bindu wavell <Leader>mbc was failing because I was calling one of my own functions with the wrong number of args. Thanks to Gerry Patterson and others for finding this!
minibufexpl.vim 6.0.9 2002-09-17 6.0 bindu wavell Double clicking tabs was overwriting the clipboard register on MS Windows but not elsewhere... go figure :). This has now been fixed. Thanks to Shoeb Bhinderwala for reporting this one.
minibufexpl.vim 6.0.8 2002-08-06 6.0 bindu wavell Apparently some VIM builds are having a hard time with line continuation in scripts so the few that were here have been removed.


Updated debugging code so that debug output is put into a buffer which can then be written to disk or emailed to me when someone is having a major issue. Can also write directly to a file (VERY SLOWLY) on UNIX or Win32 (not 95 or 98 at the moment) or use VIM's echo function to display the output to the screen.

Several people have had issues when the hidden option is turned on. So I have put in several checks to make sure folks know this if they try to use MBE with the option set.
minibufexpl.vim 6.0.7 2002-02-04 6.0 bindu wavell Major update to how MBE handles buffer deletes. Now deletes are handled through an autocmd so you can now use :bd to delete buffers and the UI keeps in sync. Also made the MBE window go away when there is only one eligible buffer left to edit.
minibufexpl.vim 6.0.6 2002-01-28 6.0 bindu wavell Fixed register overwrite bug found by Sébastien Pierre. The @" register was being overwritten with the selected buffer name when switching buffers, the @" register is now preserved.
minibufexpl.vim 6.0.5 2002-01-22 6.0 bindu wavell Added more optional fancy window/buffer navigation:

You can turn on the ability to use control and the arrow keys to move between windows.
You can turn on the ability to use <C-TAB> and <C-S-TAB> to open the next and previous (respectively) buffer in the current window.
You can turn on the ability to use <C-TAB> and <C-S-TAB> to switch windows (forward and backwards respectively.)

Fixed an issue with window sizing when we run out of buffers.
minibufexpl.vim 6.0.4 2001-12-19 6.0 bindu wavell After reading 'Tip #173: Switch between splits very fast (for multi-file editing)' I decided to optionally add control+direction [hjkl] mappings to switch between windows. If you want to enable this feature just put 'let g:miniBufExplMapWindowNav=1" into your .vimrc.
minibufexpl.vim 6.0.3 2001-12-19 6.0 bindu wavell Our buffername [MiniBufExplorer] was being treated as a regular expression in some instances and matching several single character file names. Since escaping the '[' and ']' doesn't work on the windows version of vim 6.0 yet, I renamed the buffer -MiniBufExplorer-. This appears to have resolved the issue.
minibufexpl.vim 6.0.2 2001-12-04 6.0 bindu wavell 2 Changes requested by Suresh Govindachar
Added SplitToEdge option and set it on by default
Added tab and shift-tab mappings in [MBE] window
minibufexpl.vim 6.0.0 2001-12-01 6.0 bindu wavell Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_DoxygenToolkit.vim.html0000644000000000000000000010264212204336073021442 0ustar DoxygenToolkit.vim - Simplify Doxygen documentation in C, C++, Python. : vim online
    sponsor Vim development Vim logo Vim Book Ad

DoxygenToolkit.vim : Simplify Doxygen documentation in C, C++, Python.

 script karma  Rating 328/149, Downloaded by 9862  Comments, bugs, improvements  Vim wiki

created by
Mathias Lorente
 
script type
utility
 
description
Currently five purposes have been defined :

Generates a doxygen license comment.  The tag text is configurable.

Generates a doxygen author skeleton.  The tag text is configurable.

Generates a doxygen comment skeleton for a C, C++ or Python function or class,
including @brief, @param (for each named argument), and @return.  The tag
text as well as a comment block header and footer are configurable.
(Consequently, you can have \brief, etc. if you wish, with little effort.)

Ignore code fragment placed in a block defined by #ifdef ... #endif (C/C++).  The
block name must be given to the function.  All of the corresponding blocks
in all the file will be treated and placed in a new block DOX_SKIP_BLOCK (or
any other name that you have configured).  Then you have to update
PREDEFINED value in your doxygen configuration file with correct block name.
You also have to set ENABLE_PREPROCESSING to YES.

Generate a doxygen group (begining and ending). The tag text is
configurable.

Use:
- Type of comments (C/C++: /// or /** ... */, Python: ## and # ) :
  In vim, default C++ comments are : /** ... */. But if you prefer to use ///
  Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++"'
  (without quotes) in your .vimrc file

- License :
  In vim, place the cursor on the line that will follow doxygen license
  comment.  Then, execute the command :DoxLic.  This will generate license
  comment and leave the cursor on the line just after.

- Author :
  In vim, place the cursor on the line that will follow doxygen author
  comment.  Then, execute the command :DoxAuthor.  This will generate the
  skeleton and leave the cursor just after @author tag if no variable
  define it, or just after the skeleton.

- Function / class comment :
  In vim, place the cursor on the line of the function header (or returned
  value of the function) or the class.  Then execute the command :Dox.  This
  will generate the skeleton and leave the cursor after the @brief tag.

- Ignore code fragment (C/C++ only) :
  In vim, if you want to ignore all code fragment placed in a block such as :
    #ifdef DEBUG
    ...
    #endif
  You only have to execute the command :DoxUndoc(DEBUG) !
  
- Group :
  In vim, execute the command :DoxBlock to insert a doxygen block on the
  following line.

Limitations:
- Assumes that the function name (and the following opening parenthesis) is
  at least on the third line after current cursor position.
- Not able to update a comment block after it's been written.
- Blocks delimiters (header and footer) are only included for function
  comment.
- Assumes that cindent is used.
- Comments in function parameters (such as void foo(int bar /* ... */, baz))
  are not yet supported.


Example:
Given:
int
  foo(char mychar,
      int myint,
      double* myarray,
      int mask = DEFAULT)
{ //...
}

Issuing the :Dox command with the cursor on the function declaration would
generate

/**
* @brief
*
* @param mychar
* @param myint
* @param myarray
* @param mask
*
* @return
*/


To customize the output of the script, see the g:DoxygenToolkit_*
variables in the script's source.  These variables can be set in your
.vimrc.

For example, my .vimrc contains:
let g:DoxygenToolkit_briefTag_pre="@Synopsis  "
let g:DoxygenToolkit_paramTag_pre="@Param "
let g:DoxygenToolkit_returnTag="@Returns   "
let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
let g:DoxygenToolkit_authorName="Mathias Lorente"
let g:DoxygenToolkit_licenseTag="My own license"   <-- !!! Does not end with "\<enter>"
 
install details
Copy to your '~/.vim/plugin' directory
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
DoxygenToolkit.vim 0.2.13 2010-10-16 7.0 Mathias Lorente Correct insertion position and 'xxx_post' parameters.
   - Insert position is correct when g:DoxygenToolkit_compactOneLineDoc = "yes" and let g:DoxygenToolkit_commentType = "C++" are set.
   - When you define:
        g:DoxygenToolkit_briefTag_pre = "@brief "
        g:DoxygenToolkit_briefTag_post = "<++>"
        g:DoxygenToolkit_briefTag_funcName = "yes"
     Documentation generated with these parameters is something like:
        /// @brief foo <++>
     You can configure similarly parameters to get something like:
        /// @brief foo <++>
        /// @param bar <++>
        /// @param baz <++>
DoxygenToolkit.vim 0.2.12 2010-09-09 7.0 Mathias Lorente Position the cursor at the right position for one line documentation.
(thanks to brian kropf)
DoxygenToolkit.vim 0.2.11 2010-08-25 7.0 Mathias Lorente Remove trailing blank characters where they are not needed. (Thanks to Lukas Grässlin)
DoxygenToolkit.vim 0.2.10 2010-08-08 7.0 Mathias Lorente 'extern' keyword added in list of values to ignore for return type.
DoxygenToolkit.vim 0.2.9 2010-08-08 7.0 Mathias Lorente Correct bugs related to templates and add support for throw statement (many thanks to Dennis Lubert):
- Template parameter of different type from class and typename are recognized.
- Indentation mistake while detecting template.
- New options are available: g:DoxygenToolkit_throwTag_pre (default set to '@throw ', can be changed to '@exception ' and g:DoxygenToolkit_throwTag_post
DoxygenToolkit.vim 0.2.8 2010-08-06 7.0 Mathias Lorente Add support for documentation of template parameters.
(Thanks to Dennis)
DoxygenToolkit.vim 0.2.7 2009-12-06 7.0 Mathias Lorente Increase comparibility with c/c++ IDE
DoxygenToolkit.vim 0.2.6 2009-11-19 7.0 Mathias Lorente Bug correction (thanks to Jhon Do):
DoxygenToolkit_briefTag_funcName and other xxx_xxName parameters should work properly now.
DoxygenToolkit.vim 0.2.5 2009-08-21 7.0 Mathias Lorente DoxLic function is corrected (thanks to Roland Kammerer). Date and name are properly set.
DoxygenToolkit.vim 0.2.4 2009-05-11 7.0 Mathias Lorente Bug correction (thanks to Anders Bo Rasmussen)
   - C++: now functions like  void foo(type &bar); are correctly documented.
          The parameter's name is 'bar' (and no more '&bar').
DoxygenToolkit.vim 0.2.3 2009-03-26 7.0 Mathias Lorente Added @version tag into the DocBlock generated by DoxygenAuthorFunc() (thanks to Dave Walter).
DoxygenToolkit.vim 0.2.2 2009-01-20 7.0 Mathias Lorente Comments are now allowed in function declaration. Example:
- C/C++:   void func( int foo, // first param
                                   int bar  /* second param */);

- Python:  def func( foo,  # first param
                                 bar ) # second param
DoxygenToolkit.vim 0.2.1 2009-01-15 7.0 Mathias Lorente Bug correction (many thanks to Alexey Radkov)
- C/C++: following function/method are now correctly documented:
   - operator(),
   - constructor with initialization parameter(s),
   - pure virtual method,
   - const method.

- Python:
   - Single line function are now correctly documented.
DoxygenToolkit.vim 0.2.0 2009-01-13 7.0 Mathias Lorente The main function has been rewritten (I hope it is cleaner).
- There is now support for function pointer as parameter (C/C++).
- You can configure the script to get one line documentation (for
   attribute instance for example, you need to set
   g:DoxygenToolkit_compactOneLineDoc to "yes").

- NEW: Support Python scripts:
   - Function/method are not scanned, so by default they are considered
      as if they always return something (modify this behavior by defining
      g:DoxygenToolkit_python_autoFunctionReturn to "no")
   - self parameter is automatically ignored when scanning function
      parameters (you can change this behavior by defining
      g:DoxygenToolkit_python_autoRemoveSelfParam to "no")
DoxygenToolkit.vim 0.1.17 2007-04-15 6.0 Mathias Lorente Number of lines scanned is now configurable. Default value is still 10 lines. (Thanks to Spencer Collyer for this improvement).
DoxygenToolkit.vim 0.1.16 2007-02-27 6.0 Mathias Lorente Bug correction : now, function that returns null pointer are correctly documented (thanks to Ronald WAHL for his report and patch).
DoxygenToolkit.vim 0.1.15 2007-02-11 6.0 Mathias Lorente Generated documentation with block header/footer activated do not integrate header and footer anymore.
DoxygenToolkit.vim 0.1.14 2006-11-04 6.0 Mathias Lorente New option available for cinoptions : g:DoxygenToolkit_cinoptions (default value is still c1C1)
Thanks to Arnaud GODET for this. Now comment can have different indentation style.
DoxygenToolkit.vim 0.1.13 2005-04-17 6.0 Mathias Lorente Changes for linux kernel comment style
DoxygenToolkit.vim 0.1.12 2005-03-21 6.0 Mathias Lorente Fixed indentation in comments (suggested by Soh Kok Hong and required by other users)
DoxygenToolkit.vim 0.1.12 2005-01-27 6.0 Mathias Lorente Now you can use your own comment tag (not only C or C++). In this case, you have to define: 'g:DoxygenToolkit_startCommentTag', 'g:DoxygenToolkit_interCommentTag' and 'g:DoxygenToolkit_endCommentTag' in your .vimrc file.
DoxygenToolkit.vim 0.1.11 2004-11-22 6.0 Mathias Lorente The real 0.1.11 version...
Sorry for my mistake (thank to Jason Mills who pointed me out this error....)
DoxygenToolkit.vim 0.1.10 2004-06-01 6.0 Mathias Lorente Bug correction for constructors / destructor and functions preceded by spaces (or tabs).
DoxygenToolkit.vim 0.1.9 2004-05-25 6.0 Mathias Lorente Fixed filename bug when including doxygen author comment whereas file has not been open directly on commamd line.
Now /// or /** doxygen comments are correctly integrated (except for license).
DoxygenToolkit.vim 0.1.8 2004-05-24 6.0 Mathias Lorente Some changes and bug correction for some configuration (thanks to Jason Mills).
DoxygenToolkit.vim 0.1.7 2004-05-17 6.0 Mathias Lorente Bug correction in DoxygenUndocumentFunc.
DoxygenToolkit.vim 0.1.6 2004-05-14 6.0 Mathias Lorente Few code modification and new functionalities
DoxygenToolkit.vim 0.1.5 2004-05-14 6.0 Mathias Lorente Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/syntax_CVSAnnotate.vim.html0000644000000000000000000002427512204336073020641 0ustar CVSAnnotate.vim - Simple syntax file for use with the cvscommand.vim plugin. : vim online
    sponsor Vim development Vim logo Vim Book Ad

CVSAnnotate.vim : Simple syntax file for use with the cvscommand.vim plugin.

 script karma  Rating 0/2, Downloaded by 612

created by
Bob Hiestand
 
script type
syntax
 
description
This syntax file provides syntax definitions for buffers created by the cvscommand.vim plugin (version 1.10 and above).
 
install details
Just place in your syntax directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
CVSAnnotate.vim 1.3 2002-09-04 6.0 Bob Hiestand Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
    stats
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_vimplate.vim.html0000644000000000000000000010136312204336073020277 0ustar vimplate - template system for vim (example for C++, Perl, LaTeX and make) : vim online
    sponsor Vim development Vim logo Vim Book Ad

vimplate : template system for vim  (example for C++, Perl, LaTeX and make)

 script karma  Rating 143/44, Downloaded by 1258

created by
Urs Stotz
 
script type
utility
 
description
1. Description
2. Usage
3. Subroutines
4. Example
5. Documentation
6. Depends
7. Installation


1. Description                                        *vimplate-description*

Vimplate provides an extensible and powerful template processing system.
It is based on Perl and Template-Toolkit.
You can create templates for program code, makefiles, letters, html pages,
latex etc. As example vimplate contains templates for C++, LaTeX, Perl
and Makefile.
With vimplate you can write templates which interact with the user.
For themes are the functions choice() and input().
You can choose different locale for the function date() and locale().
You can write your own perl code directly in the templates.

In case you find my template useful,
or have suggestions for improvements, please let me know.

If you write a new template,
and  would like me to add it to the vimplate package
please send it to: stotz@gmx.ch


2. Usage                                                    *vimplate-usage*

Usage:
  :Vimplate <template> [options]
    choice <template> whit <TAB> (command line completion is supported).
    With <TAB> all templates are listed.
    [options]
      -user|u=<username>
        Use the information form user <username> while parsing templates.
      -dir|d=<templatedir>
        Search templatefiles in <templatedir>.


3. Subroutines                                         *vimplate-subroutines*

  locale()                  for locale please see: man locale
  [% loc=locale() %]        get the current locale
                              and write it to the variable loc
  [% locale('C') %]         set global the current locale to C
  [% locale('de_DE') %]     set global the current locale to de_DE
  date()                    for date please see: man date
  [% date('%c') %]          print the current date
                              with the current locale setting
  [% date('de_DE', '%c') %] print the current date with the locale de_DE
  input()
  [% var=input() %]         read input from user
                              and write it to the variable var
  choice()
  [% day=choice('day:', 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa') %]
                            let the user choice between different values
                            and write it to the variable day

  please try :Vimplate Test


4. Example                                                *vimplate-example*

a LaTeX Template:
  http://www.napali.ch/vimplate/example/LaTeX.tt.html
the generated LaTeX File:
  http://www.napali.ch/vimplate/example/Example.tex.html
a Makefile Template for LaTeX:
  http://www.napali.ch/vimplate/example/Makefile-LaTeX.tt.html
the generated Makefile:
  http://www.napali.ch/vimplate/example/Makefile.html
c++ Templates:
  http://www.napali.ch/vimplate/example/hpp-default.tt.html
  http://www.napali.ch/vimplate/example/cpp-default.tt.html
the generated class:
  http://www.napali.ch/vimplate/example/Example.hpp.html
  http://www.napali.ch/vimplate/example/Example.cpp.html
the generated class with doxygen:
  http://www.napali.ch/vimplate/example/ExampleDoxy.hpp.html
  http://www.napali.ch/vimplate/example/ExampleDoxy.cpp.html
a perl Template:
  http://www.napali.ch/vimplate/example/perl.tt.html
the genereated program:
  http://www.napali.ch/vimplate/example/Example.pl.html
the genereated program with Log4Perl:
  http://www.napali.ch/vimplate/example/ExampleLog.pl.html

Example:
  the template letter.tt:
    ________________________________________________________
    [%
       sex=choice('sex: ', 'female', 'male')
       name=input('name: ')
       location=input('your location: ')
    -%]
                       [% ucfirst(location) %], [% date('C', '%b %d, %Y') %]

    Dear [% IF sex=='female'; 'Ms'; ELSE; 'Mr'; END %] [% ucfirst(name) %]

    ...

    Sincerely

    [% user.firstname %] [% user.lastname %]
    ________________________________________________________

  run vim:
    :Vimplate letter
    sex:
      0) female
      1) male
    0
    name: Meier
    your location: Olten

  your input was:
    :Vimplate letter<CR>0<CR>Meier<CR>Olten<CR>

  this will produce this letter:
    ________________________________________________________
                                      Olten, Jul 11, 2005

    Dear Ms Meier

    ...

    Sincerely

    Urs Stotz
    ________________________________________________________

Example:
  the template hpp-default.tt:
    ________________________________________________________
    [% classname=input('Class name: ')
       doxygen=choice('with Doxygen comments: ', 'no', 'yes')
    -%]
    #ifndef [% uc(classname) %]_HPP
    #define [% uc(classname) %]_HPP

    [% IF doxygen=='yes' -%]
    /**
     * @brief [% classname %] ... short description ...
     * @author [% user.firstname %] [% user.lastname %] <[% user.mail %]>
     * @date [% date('%Y-%m-%d') %]
     * ... description ...
     */

    [% END -%]
    class [% classname %]
    {
      public:
    [% IF doxygen=='yes' -%]

        /**
         * Default constructor
         */
    [% END -%]
        [% classname %]();
    [% IF doxygen=='yes' -%]

        /**
         * Copy constructor
         * @param other reference on object to copy
         */
    [% END -%]
        [% classname %](const [% classname %]& other);
    [% IF doxygen=='yes' -%]

        /**
         * Assignment operator
         * @param other reference on object to copy
         * @return reference on initialisated object
         */
    [% END -%]
        [% classname %]& operator=(const [% classname %]& other);
    [% IF doxygen=='yes' -%]

        /**
         * Destructor
         */
    [% END -%]
        virtual ~[% classname %]();

      private:
    [% IF doxygen=='yes' -%]

        /**
         * Base initialisation should be called
         * at beginning of each constructor
         */
    [% END -%]
        void init();
    [% IF doxygen=='yes' -%]

    /**
     * Method to copy each member (deep copy)
     * @param other reference on object to copy
     */
    [% END -%]
        void init(const [% classname %]& other);
    };

    #endif /* #ifndef [% uc(classname) %]_HPP */
    ________________________________________________________

  run vim:
    :Vimplate hpp-default
    Class name: Parent
    with Doxygen comments:
      0) no
      1) yes
    1

  your input was:
    :Vimplate hpp-default<CR>Parent<CR>1<CR>

  this will produce this c++ include file:
    ________________________________________________________
    #ifndef PARENT_HPP
    #define PARENT_HPP

    /**
     * @brief Parent ... short description ...
     * @author Urs Stotz <stotz@gmx.ch>
     * @date 2005-07-18
     * ... description ...
     */

    class Parent
    {
      public:

        /**
         * Default constructor
         */
        Parent();

        /**
         * Copy constructor
         * @param other reference on object to copy
         */
        Parent(const Parent& other);

        /**
         * Assignment operator
         * @param other reference on object to copy
         * @return reference on initialisated object
         */
        Parent& operator=(const Parent& other);

        /**
         * Destructor
         */
        virtual ~Parent();

      private:

        /**
         * Base initialisation should be called
         * at beginning of each constructor
         */
        void init();

        /**
         * Method to copy each member (deep copy)
         * @param other reference on object to copy
         */
        void init(const Parent& other);
    };

    #endif /* #ifndef PARENT_HPP */
    ________________________________________________________


5. Documentation                                    *vimplate-documentation*

Documentation:
  - http://napali.ch/vimplate
  - http://www.template-toolkit.org/docs.html
  - http://perldoc.perl.org/perl.html

Todo:
  - better exception handling
  - write more templates

License:
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License, version 2, as published
  by the Free Software Foundation.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  for more details.

  A copy of the GNU GPL is available as /usr/share/common-licenses/GPL-2
  on Debian systems, or on the World Wide Web at
  http://www.gnu.org/copyleft/gpl.html
  You can also obtain it by writing to the Free Software Foundation, Inc.,
  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

Copyright:
  Copyright (c) 2005, Urs Stotz <stotz@gmx.ch>

Version:
  vimplate 0.2.3
 
install details
6. Depends:                                               *vimplate-depends*

Debian Users:
Vimplate is part of vim-scripts >= 7.0.5  thanks: Stefano Zacchiroli and Michael Piefel
  apt-get install vim-scripts

  Perl
    http://www.perl.org
    Windows users:
      http://www.activestate.com/Products/ActivePerl
  Template-Toolkit
    http://search.cpan.org/~abw/Template-Toolkit-2.14
    or apt-get install libtemplate-perl
    or perl -MCPAN -e"install Template"
    Windows users:
      ppm install
        http://openinteract.sourceforge.net/ppmpackages/AppConfig.ppd
      ppm install
        http://openinteract.sourceforge.net/ppmpackages/Template-Toolkit.ppd

Suggests:
  TT2 syntax:
    http://www.vim.org/scripts/script.php?script_id=830


7. Installation                                      *vimplate-installation*

Installation steps:
  1. change to your $HOME/.vim directory
       (on windows: set the variable HOME
         set HOME=c:\vim)
  2. untar vimplate.tar.gz: gzip -dc vimplate.tar.gz |tar xpvf -
  3. move the vimplate into your preferred directory
      for example in $HOME/bin or /usr/local/bin
  4. move the directory Template with the example templates
      to the place that you prefer
  5. edit your $HOME/.vimrc and set the variable Vimplate to
      to the place where vimplate is located
      for example let Vimplate = "$HOME/bin/vimplate"
        (on windows: let Vimplate = "%HOME%/bin/vimplate.cmd" )
  6. run vimplate to create your configuration file $HOME/.vimplaterc
      for example $HOME/bin/vimplate -createconfig
        (on windows: %HOME%/bin/vimplate.cmd -createconfig" )
  7. edit your $HOME/.vimplaterc
       (on windows: %HOME%/_vimplaterc)
  8. change to the $HOME/.vim/doc directory,
      start Vim and run the ":helptags ." command to process the
      taglist help file. (see: |helptags| )
  9. happy vimplating
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vimplate-0.2.3.tar.gz 0.2.3 2005-08-20 6.0 Urs Stotz The perl vimplate script is running now also on Windows.
A vim help added.
Dokumentation written for Windows ActiveState Perl User.
Templates for C++, Perl, LaTeX and make revised.
vimplate-0.2.2.tar.gz 0.2.2 2005-07-18 6.0 Urs Stotz Better templates for C++. Now with choose between Doxygen comments or non comments.
Vimplate should be running on Windows when there Template-Toolkit is installed.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_bufexplorer.vim.html0000644000000000000000000016462612204336073021026 0ustar bufexplorer.zip - Buffer Explorer / Browser : vim online
    sponsor Vim development Vim logo Vim Book Ad

bufexplorer.zip : Buffer Explorer / Browser

 script karma  Rating 3113/1026, Downloaded by 93700    Comments, bugs, improvements  Vim wiki

created by
jeff lanzarotta
 
script type
utility
 
description
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces:

  '\be' (normal open)  or
  '\bs' (force horizontal split open)  or
  '\bv' (force vertical split open)

Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help.

Bufexplorer also offers various options including:
- Display the list of buffers in various sort orders including:
    - Most Recently Used (MRU) which is the default
    - Buffer number
    - File name
    - File extension
    - Full file path name
- Delete buffer from list

For more about options, sort orders, configuration options, etc. please see the supplied VIM help.
 
install details
Simply unzip bufexplorer.zip into a directory in your 'runtimepath', usually ~/.vim or c:\vimfiles, and restart Vim. This zip file contains plugin\bufexplorer.vim, and doc\bufexplorer.txt.  See ':help add-local-help' on how to add bufexplorer.txt to vim's help system.

NOTE: Version 7.0.12 and above will ONLY work with 7.0 and above of Vim.
NOTE NOTE NOTE: If you have a version prior to 7.1.2 that contains an autoload\bufexplorer.vim file, please REMOVE the autoload\bufexlorer.vim AND the plugin\bufexplorer.vim files before installing a new version.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
bufexplorer-7.3.6.zip 7.3.6 2013-05-06 7.0 jeff lanzarotta Removed the 'drop' window command that was causing issue with the argument-list being modified after the BufExplorer windows was displayed.
bufexplorer-7.3.5.zip 7.3.5 2013-02-08 7.0 jeff lanzarotta Michael Henry added the ability to view "No Name" buffers.  This functionality was lost since version 7.3.0.  He also did some removal of "dead" code and cleaned up the code to handle filenames with embedded '"'.
bufexplorer-7.3.4.zip 7.3.4 2013-01-28 7.0 jeff lanzarotta Thanks go out to John Szakmeister for finding and fixing a bug in the RebuildBufferList method.  The keepjumps line that clears the list could potentially reference a backwards range.
bufexplorer-7.3.3.zip 7.3.3 2013-01-14 7.0 jeff lanzarotta * Major cleanup and reorganization of the change log.
* We welcome the return of g:bufExplorerSplitHorzSize and g:bufExplorerSplitVertSize.  When setting these values, anything less than or equal to 0 causes the split windows size to be determined by Vim.  If for example you want your new horizontal split window 10 rows high, set g:bufExplorerSplitHorzSize = 10 in your .vimrc.  Similar would be done if wanting a vertical split except you would use the g:bufExplorerSplitVertSize variable instead.
bufexplorer-7.3.2.zip 7.2.3 2012-12-24 7.0 jeff lanzarotta Thanks go out to Michael Henry for pointing out that I completely missed yet another function, ReverseSortSelect(), during the refactoring.  This function has now returned.
bufexplorer-7.3.1.zip 7.3.1 2012-12-06 7.0 jeff lanzarotta Thanks go out to Brett Rasmussen for pointing out that the feature added way back in version 7.2.3 by Yuriy Ershov to automatically reposition the cursor to the line containing the active buffer, was no longer in the plugin.  That bit of code has been re-added and all is well.
bufexplorer-7.3.0.zip 7.3.0 2012-10-09 7.0 jeff lanzarotta It has been quite a while since I published a new version and this is the first version since Vim 7.3 was released.
    * Thanks to Tim Johnson for testing out this new version.
    * I have put some time into reworking and cleaning up the code as
    * well as various bug fixes.
    * I have hopefully allowed for better mapping of the main public methods as is explained in the
      bufexplorer-  customization section of the documentation.
    * Add new 'B', 'o', and 'S' key mappings.
    * Overall, I am hopeful that I not forgotten or lost a feature :)
bufexplorer.zip 7.2.8 2010-11-08 7.0 jeff lanzarotta Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
(http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR)
* Fixed update date.
bufexplorer.zip 7.2.7 2010-04-26 7.0 jeff lanzarotta This is my first attempt to fix the "cache" issue where buffer information has changed but the cache/display does not reflect those changes. More work still needs to be done. More or less the cache has been disabled.
bufexplorer.zip 7.2.6 2010-02-12 7.0 jeff lanzarotta Thanks to Michael Henry for pointing out that I totally forgot to update the inline help to reflect the previous change to the 'd' and 'D' keys. Opps!
bufexplorer.zip 7.2.5 2010-02-10 6.0 jeff lanzarotta Philip Morant suggested switching the command (bwipe) associated with the 'd' key with the command (bdelete) associated with the 'D' key. This made sense since the 'd' key is more likely to be used compared to the 'D' key.
bufexplorer.zip 7.2.4 2010-01-14 7.0 jeff lanzarotta Fix: I did not implement the patch provided by Godefroid Chapelle correctly. I missed one line which happened to be the most important one :)
bufexplorer.zip 7.2.3 2009-12-15 7.0 jeff lanzarotta Hopefully I have not let anyone or anything out :)
- Enhancements:
    * Thanks to David Fishburn for helping me out with a much needed
       code overhaul as well as some awesome performance enhancements.
       He also reworked the handling of tabs.
    * Thanks to Vladimir Dobriakov for making the suggestions on
       enhancing the documentation to include a better explaination of
       what is contained in the main bufexplorer window.
    * Thanks to Yuriy Ershov for added code that when the bufexplorer
       window is opened, the cursor is now positioned at the line with the
       active buffer (useful in non-MRU sort modes).
    * Yuriy also added the abiltiy to cycle through the sort fields in
       reverse order.
- Fixes:
    * Thanks to Michael Henry for supplying a patch that allows
       bufexplorer to be opened even when there is one buffer or less.
    * Thanks to Godefroid Chapelle for supplying a patch that fixed
       MRU sort order after loading a session.
bufexplorer.zip 7.2.2 2008-11-19 7.0 jeff lanzarotta Thanks to David L. Dight for spotting and fixing an issue when using ctrl^. bufexplorer would incorrectly handle the previous buffer so that when ctrl^ was pressed the incorrect file was opened.
bufexplorer.zip 7.2.1 2008-09-03 7.0 jeff lanzarotta 7.2.1  - Fix: * Thanks to Dimitar for spotting and fixing a feature that was inadvertently left out of the previous version. The feature was when bufexplorer was used together with WinManager, you could use the tab key to open a buffer in a split window.
bufexplorer.zip 7.2.0 2008-08-15 6.0 jeff lanzarotta - Enhancements:
  * For all those missing the \bs and \bv commands, these have now returned. Thanks to Phil O'Connell for asking for the return of these missing features and helping test out this version.
- Fixes:
  * Fixed problem with the bufExplorerFindActive code not working correctly.
  * Fixed an incompatibility between bufexplorer and netrw that caused buffers to be incorrectly removed from the MRU list.
bufexplorer.zip 7.1.7 2007-12-21 6.0 jeff lanzarotta TaCahiroy fixed several issues related to opening a buffer in a tab.
bufexplorer.zip 7.1.6 2007-12-01 6.0 jeff lanzarotta Fixes:
  * Removed ff=unix from modeline in bufexplorer.txt. Found by Bill McCarthy.
bufexplorer.zip 7.1.5 2007-11-30 6.0 jeff lanzarotta Fixed: Could not open unnamed buffers. Fixed by TaCahiroy.
bufexplorer.zip 7.1.4 2007-11-16 6.0 jeff lanzarotta Fixes:
  * Sometimes when a file's path has 'white space' in it, extra buffers would be created containing each piece of the path. i.e: opening c:\document and settings\test.txt would create a buffer named "and" and a buffer named "Documents". This was reported and fixed by TaCa Yoss.
bufexplorer.zip 7.1.3 2007-11-15 6.0 jeff lanzarotta Added code to allow only one instance of the plugin to run at a time. Thanks Dennis Hostetler.
bufexplorer.zip 7.1.2 2007-11-07 6.0 jeff lanzarotta This is a MAJOR update.
* Added handling of tabs. (Dave Larson)
* Removed \bs and \bv commands because these are easier for the user to create horizontal and vertical windows. (Dave Larson)
* Fixed jumplist issue spotted by JiangJun.
* Went back to using just a plugin file, instead of both an autoload and plugin file. The splitting of the file caused issues with other plugins. So if you have a prior version of bufexplorer that has an autoload file, please remove autoload\bufexplorer and plugin\bufexplorer before installing this new version.
* Fixed E493 error spotted by Thomas Arendsen Hein.
* Minor cosmetic changes.
* Minor help file changes.
bufexplorer.zip 7.0.17 2007-07-24 7.0 jeff lanzarotta Fixed issue with 'drop' command. Various enhancements and improvements.
bufexplorer.zip 7.0.15 2007-04-27 7.0 jeff lanzarotta Thanks to Mark Smithfield for suggesting bufexplorer needed to handle the ':args' command.
Fixed issue reported by Liu Jiaping on non Windows systems, which was
  ...
Open file1, open file2, modify file1, open bufexplorer, you get the following error:
--------8<--------
Error detected while processing function
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
line    4:
E37: No write since last change (add ! to override)
--------8<--------

But the worse thing is, when I want to save the current buffer and type ':w', I get another error message:

--------8<--------
E382: Cannot write, 'buftype' option is set
--------8<--------
bufexplorer.zip 7.0.14 2007-03-23 7.0 jeff lanzarotta Thanks to Randall Hansen for removing the requirement of terminal versions to be recompiled with 'gui' support so the 'drop' command would work. The 'drop' command is really not needed in terminal versions.
bufexplorer.zip 7.0.13 2007-02-23 7.0 jeff lanzarotta Fixed Winmanager integration. Thanks to Dave Eggum for another major update. Most notable changes are, improved speed and code clean up. Please see the bufexplorer help for a full list of changes and updates.
bufexplorer.zip 7.0.12 2006-11-30 7.0 jeff lanzarotta MAJOR Update. Please Note that this version will ONLY run with Vim version 7.0 or greater.

Dave Eggum has made some 'significant' updates to this latest version:
  - Added BufExplorerGetAltBuf() global function to be used in the user’s rulerformat.
  - Added g:bufExplorerSplitRight option.
  - Added g:bufExplorerShowRelativePath option with mapping.
  - Added current line highlighting.
  - The split type can now be changed whether bufexplorer is opened in split mode or not.
  - Various major and minor bug fixes and speed improvements.
  - Sort by extension.
  Other improvements/changes:
  - Changed the help key from '?' to <F1> to be more 'standard'.
  - Fixed splitting of vertical bufexplorer window.
bufexplorer.zip 7.0.11 2006-03-10 6.0 jeff lanzarotta Fixed a couple of highlighting bugs, reported by David Eggum. He also changed passive voice to active on a couple of warning messages.
bufexplorer.zip 7.0.10 2006-03-02 6.0 jeff lanzarotta Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set, the slash character used when displaying the path was incorrect. Thanks Xiangjiang!
bufexplorer.zip 7.0.9 2006-02-28 6.0 jeff lanzarotta Martin Grenfell found and eliminated an annoying bug in the bufexplorer/winmanager integration. The bug was were an annoying message would be displayed when a window was split or a new file was opened in a new window. Thanks Martin!
bufexplorer.zip 7.0.8 2006-01-18 6.0 jeff lanzarotta Thanks to Mike Li for catching a bug in the WinManager integration. The bug was related to the incorrect displaying of the buffer explorer's window title.
bufexplorer.zip 7.0.7 2005-12-19 6.0 jeff lanzarotta Thanks to Jeremy Cowgar for adding a new enhancement. This enhancement allows the user to press 'S', that is capital S, which will open the buffer under the cursor in a newly created split window.
bufexplorer.zip 7.0.6 2005-11-18 6.0 jeff lanzarotta Thanks to Larry Zhang for finding a bug in the "split" buffer code. If you force set g:bufExplorerSplitType='v' in your vimrc, and if you tried to do a \bs to split the bufexplorer window, it would always split horizontal, not vertical. He also found that I had a typeo in that the variable g:bufExplorerSplitVertSize was all lower case in the documentation which was incorrect.
bufexplorer.zip 7.0.5 2005-10-18 6.0 jeff lanzarotta Thanks to Mun Johl for pointing out a bug that if a buffer was modified, the '+' was not showing up correctly.
bufexplorer.zip 7.0.4 2005-10-03 6.0 jeff lanzarotta Fixed a problem discovered first by Xiangjiang Ma. Well since I've been using vim 7.0 and not 6.3, I started using a function (getftype) that is not in 6.3. So for backward compatibility, I conditionaly use this function now.  Thus, the g:bufExplorerShowDirectories feature is only available when using vim 7.0 and above.
bufexplorer.zip 7.0.3 2005-09-30 6.0 jeff lanzarotta Thanks to Erwin Waterlander for finding a problem when the last buffer was deleted. This issue got me to rewrite the buffer display logic (which I've wanted to do for sometime now).
Also great thanks to Dave Eggum for coming up with idea for g:bufExplorerShowDirectories. Directories usually show up in the list from using a command like ":e .", this controls how those are displayed.
bufexplorer.zip 7.0.2 2005-03-25 6.0 jeff lanzarotta Thanks to Thomas Arendsen Hein for finding a problem when a user has the default help turned off and then brought up the explorer. An E493 would be displayed.
bufexplorer.zip 7.0.1 2005-03-10 6.0 jeff lanzarotta Thanks to Erwin Waterlander for finding a couple problems. The first problem allowed a modified buffer to be deleted.  Opps! The second problem occured when several files were opened, BufExplorer was started, the current buffer was deleted using the 'd' option, and then BufExplorer was exited. The deleted buffer was still visible while it is not in the buffers list. Opps again!
bufexplorer.zip 7.0.0 2005-02-28 6.0 jeff lanzarotta Thanks to Shankar R. for suggesting to add the ability to set the fixed width (g:bufExplorerSplitVertSize) of a new window when opening bufexplorer vertically and fixed height (g:bufExplorerSplitHorzSize) of a new window when opening bufexplorer horizontally. By default, the windows are normally split to use half the existing width or height.
bufexplorer.zip 6.3.0 2004-07-23 6.0 jeff lanzarotta Added keepjumps so that the jumps list would not get clutered with bufexplorer related stuff.
bufexplorer.zip 6.2.3 2004-04-15 6.0 jeff lanzarotta Thanks to Jay Logan for finding  a bug in the vertical split postion of the code. When selecting that the window was to be split vertically by doing a '\bv', from then on, all splits, i.e. '\bs', were split vertically, even though g:bufExplorerSplitType was not set to 'v'.
bufexplorer.zip 6.2.2 2004-01-09 6.0 jeff lanzarotta Thanks to Patrik Modesto for adding a small improvement. For some reason his bufexplorer window was always showing up folded. He added 'setlocal nofoldenable' and it was fixed. If you are having the same problem, this version is for you...
bufexplorer.zip 6.2.1 2003-10-09 6.0 jeff lanzarotta Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting logic and option.
bufexplorer.zip 6.2.0 2003-06-13 6.0 jeff lanzarotta Thanks goes out to Simon Johann-Günter for spotting and fixing a problem in that the last search pattern is overriden by the search pattern for blank lines.
bufexplorer.zip 6.1.6 2003-05-05 6.0 jeff lanzarotta Thanks to Artem Chuprina for finding a pesky bug that has been around for sometime now. The <esc> key mapping was causing the buffer explored to close prematurely when vim was run in an xterm. The <esc> key mapping is now removed.
bufexplorer.zip 6.1.5 2003-04-28 6.0 jeff lanzarotta Thanks to Khorev Sergey. Added option to show default help or not.
bufexplorer.zip 6.1.4 2003-03-18 6.0 jeff lanzarotta Thanks goes out to Valery Kondakoff for suggesting the addition of setlocal nonumber and foldcolumn=0. This allows for line numbering and folding to be turned off temporarily while in the explorer.
bufexplorer.zip 6.1.3 2003-03-11 6.0 jeff lanzarotta Added the ability to force the newly split window to be temporarily vertical, which was suggested by Thomas Glanzmann. Added folding. Did some code cleanup.
bufexplorer.zip 6.1.2 2002-11-05 6.0 jeff lanzarotta Now pressing the <esc> key will quit, just like 'q'. Added folds to hide winmanager configuration. If anyone had the 'C' option in their cpoptions they would receive a E10 error on startup of BufExplorer. cpo is now saved, updated and restored. Thanks to Charles E Campbell, Jr. Attempted to make sure there can only be one BufExplorer window open at a time.
bufexplorer.zip 6.1.1 2002-03-28 6.0 jeff lanzarotta Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This way buffers sorted by name will be in the correct order regardless of case.
bufexplorer.zip 6.0.16 2002-03-14 6.0 jeff lanzarotta Thanks to Andre Pang for the original patch/idea to get bufexplorer to work in insertmode/modeless mode (evim). Added Initialize and Cleanup autocommands to handle commands that need to be performed when starting or leaving bufexplorer.
bufexplorer.zip 6.0.15 2002-02-20 6.0 jeff lanzarotta Srinath Avadhanulax added a patch for winmanager.vim.
bufexplorer.zip 6.0.14 2002-02-19 6.0 jeff lanzarotta Fix a yew more bug that I thought I already had fixed. Thanks to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added vertical splitting.
bufexplorer.zip 6.0.13 2002-02-05 6.0 jeff lanzarotta Thanks to Charles E Campbell, Jr. for pointing out some embarrassing typos that I had in the documentation. I guess I need to run the spell checker more :o)
bufexplorer.zip 6.0.12 2002-02-04 6.0 jeff lanzarotta Thanks to Madoka Machitani, for the tip on adding the augroup command around the MRUList autocommands.
bufexplorer.zip 6.0.11 2002-01-26 6.0 jeff lanzarotta Fixed bug report by Xiangjiang Ma. '"=' was being added to the search history which messed up hlsearch.
bufexplorer.zip 6.0.10 2002-01-14 6.0 jeff lanzarotta Added the necessary hooks so that the winmanager.vim script could more easily integrate with this script. Now the winmanager.vim script should not have to have it's own version of bufexplorer.vim.
Tried to improve performance.
Remember to look at 'help: add-local-help' on how to add the help file into the vim help system.
bufexplorer.zip 6.0.9 2001-12-17 6.0 jeff lanzarotta Now you can sort the buffer list by most recently used (MRU). Please note that this is now a .zip file. Please unzip in your vimfiles, ~/.vim or whatever directory you store your vim stuff in. This file contains \plugin\bufexplorer.vim and \doc\bufexplorer.txt. To add the nifty help to vim look under ':help add-local-help' for more information.
bufexplorer.zip 6.0.8 2001-12-03 6.0 jeff lanzarotta Was not resetting the showcmd command correctly.
Added nifty help file.
bufexplorer.zip 6.0.7 2001-11-19 6.0 jeff lanzarotta Thanks to Brett Carlane for some great enhancements. Some are added, some are not, yet. Added highlighting of current and alternate filenames. Added spliting of path/filename toggle. Reworked ShowBuffers(). Changed my email address.
bufexplorer.zip 6.0.6 2001-09-05 6.0 jeff lanzarotta Fixed problem with the SortListing() function failing when there was only one buffer to display.
bufexplorer.zip 6.0.5 2001-08-10 6.0 jeff lanzarotta Fixed problems reported by David Pascoe, in that you where unable to hit 'd' on a buffer that belonged to a files that nolonger existed and that the 'yank' buffer was being overridden by the help text when the bufexplorer was opened.
bufexplorer.zip 6.0.4 2001-07-31 6.0 jeff lanzarotta Thanks to Charles Campbell for making this plugin more plugin *compliant*, adding default keymappings of <Leader>be and <Leader>bs as well as fixing the 'w:sortDirLabel not being defined' bug.
bufexplorer.zip 6.0.3 2001-07-30 6.0 jeff lanzarotta Added ability to sort buffers by 'buffer number' or 'name' in forward and reverse order.
bufexplorer.zip 6.0.2 2001-07-25 6.0 jeff lanzarotta Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/autoload_omni_cpp_complete.vim.html0000644000000000000000000004056412204336073022471 0ustar OmniCppComplete - C/C++ omni-completion with ctags database : vim online
    sponsor Vim development Vim logo Vim Book Ad

OmniCppComplete : C/C++ omni-completion with ctags database

 script karma  Rating 835/247, Downloaded by 6750

created by
Vissale NEANG
 
script type
ftplugin
 
description
This script is for vim 7.0 or higher it provides an omnifunc cppcomplete function.
You can use the omni completion (intellisense) in C and C++ files.
This is a full vim script and you only need a ctags database.

It's not finished yet but now you can :

    -   Complete namespaces, classes, structs and union members.
    -   Complete inherited members for classes and structs (single and multiple inheritance).
    -   Complete attribute members eg: myObject->_child->_child etc...
    -   Complete type returned by a function eg: myObject->get()->_child.
    -   Complete the "this" pointer.
    -   Complete a typedef.
    -   Complete the current scope (global and class scope).
    -   Complete an object after a cast (C and C++ cast).
    -   Complete anonymous types (eg: struct {int a; int b;}g_Var; g_Var.???). It also works for a typedef of an anonymous type.


Notes :
    -   The script manage cached datas for optimization.
    -   Ambiguous namespaces are detected and are not included in the context stack.
    -   The parsed code is tokenized so you can run a completion even if the current
        instruction has bad indentation, spaces, comments or carriage returns between words
        (even if it is not realistic).

ScreenShots :

    http://vissale.neang.free.fr/Vim/OmniCppComplete/ScreenShots/screenshots.htm


 
install details
1) Unzip the plugin to ~/.vim (unix) or %HOMEPATH%\vimfiles (windows)
2) Run Vim and type the following command :

:helptags $HOME/.vim/doc

or

:helptags $HOME/vimfiles/doc

3) Type :h omnicppcomplete and please read the installation paragraph.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
omnicppcomplete-0.41.zip 0.41 2007-09-27 7.0 Vissale NEANG -   It's recommended to update ctags to version 5.7 or higher
-   The plugin is now activated for C files
-   New value for OmniCpp_SelectFirstItem when the option is equal to
    2 the first item is selected without inserting it to
    the text (patch from Marek Olszewski)
-   Bug when completing union members fixed with ctags 5.7
    (reported by Willem-Jan de Hoog)
-   New option OmniCpp_LocalSearchDecl (patch from Roland Kuck)
-   Bug when tags=something,,somethingelse (reported by Tobias Pflug)
-   Bug with nested structure (reported by Mikhail Daen)
-   Bug where the script fails to detect the type of a variable when
    the ignorecase option is on (reported by Alexey Vakhov)
-   Error message when trying to use completion on a not yet saved
    Vim buffer (reported by Neil Bird)
-   Error message when trying to use completion on an file opened from
    a tselect command (reported by Henrique Andrade)

omnicppcomplete.zip 0.4 2006-06-25 7.0 Vissale NEANG WARNING1: Please uninstall the previous version (remove at least autoload/cppomnicomplete.vim)
WARNING2: Option names have changed, don't forget to update your .vimrc
WARNING3: It's recommended to update ctags to the latest version (5.6)
WARNING4: Default value for OmniCpp_NamespaceSearch option is now 1

-   The script is renamed to OmniCppComplete according to the library
    script directory structure.        
-   OmniCpp_ClassScopeCompletionMethod renamed to OmniCpp_DisplayMode
-   Fixed a bug where the quickfix list is modified after a completion.
-   OmniCpp_ShowPrototypeInAbbr option added. It allows to show the
    function signature in the abbreviation.
-   OmniCpp_ShowAccess option added. It allows to hide the access
    information in the popup menu.
-   The tags database format must be a ctags 5.6 database if you want to
    complete anonymous types.
-   Fixed current scope detection not working properly in destructors.
-   Don't show protected and private members according to the current scope.
-   Overloaded functions are now filtered properly.
-   New cache system using less memory.
-   The class scope of a method is now resolved properly with "using
    namespace" declarations.
-   OmniCpp_SelectFirstItem option added. It allows to not select the first
    item in the popup menu when 'completeopt' does not contain "longest".
-   Fixed the bug where a "random" item in the popup menu is selected
    by default when 'completeopt' does not contain "longest" option.
-   The script is now split in library scripts.
-   Cache added for 'using namespace' search in included files
-   Default value for OmniCpp_NamespaceSearch is now 1 (search only in the
    current buffer).
-   Namespace search automatically disabled for C files even if
    OmniCpp_NamespaceSearch != 0.
-   To avoid linear search in tags files, the ignorecase option is now
    disabled when getting tags datas (the user setting is restored after).
-   Fixed a bug where friend functions may crash the script and also crash vim.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/ftplugin_xml.vim.html0000644000000000000000000003210412204336073017604 0ustar xmledit - A filetype plugin to help edit XML, HTML, and SGML documents : vim online
    sponsor Vim development Vim logo Vim Book Ad

xmledit : A filetype plugin to help edit XML, HTML, and SGML documents

 script karma  Rating 1333/523, Downloaded by 31468  Comments, bugs, improvements  Vim wiki

created by
Devin Weaver
 
script type
ftplugin
 
description
This script provides some convenience when editing XML (and some SGML including
HTML) formated documents. It allows you to jump to the beginning or end of the
tag block your cursor is in. '%' will jump between '<' and '>' within the tag
your cursor is in. When in insert mode and you finish a tag (pressing '>') the
tag will be completed. If you press '>' twice it will complete the tag and
place the cursor in the middle of the tags on it's own line.

For the latest development snapshot visit
    http://github.com/sukima/xmledit/

Please fork this project. We need help making this better.
 
install details
This new version has the documentation coupled with the script. You only need one file xml.vim.

Place this file in your ftplugin directory (i.e. '~/.vim/ftplugin/xml.vim) Type :help ftplugins for more information on installation.

The documentation will install automatically the first time the plugin is ran. *NOTE* the first time the plugin is ran is NOT the first time VIM is ran. Because this is a file plugin you have to open an XML document to execute the script. So open a new test.xml file at first.

The html.vim script that came with the old tarball is now in the documentation as an example. to use it just copy/paste it into the file html.vim. See :help xml-plugin-html after the documentation installs.

ChangeLog and older versions availiable on request.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
xmledit-1.9.1.vba 1.9.1 2010-07-22 7.0 Devin Weaver Adds a global disable switch

Updated to vimball packaging (compatible with pathogeon)
xml.vim 1.84 2009-04-07 7.0 Devin Weaver Latest development build after move to Git repository. No new features.
xml.vim 1.29 2005-05-14 6.0 Devin Weaver Fixed some documentation. Added <a> tag to html example.
Added Visual select tag mapping. Cosmetics

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_debPlugin.vim.html0000644000000000000000000002767612204336073020405 0ustar deb.vim - browse debian package : vim online
    sponsor Vim development Vim logo Vim Book Ad

deb.vim : browse debian package

 script karma  Rating 7/4, Downloaded by 267

created by
arno.
 
script type
utility
 
description
Allows you to browse debian package in the same way you can browse .tar and .zip files.
With this script, after opening a debian package with vim, you get a list of files included in the archive. You can then open those files.
 
install details
unzip deb.zip in ~/.vim directorys.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
deb.zip v1.4 2008-04-02 7.0 arno. fixes: could not open files with # or % in file name

add support for data.tar.bz2, data.tar.lzma and data.tar
deb.zip 1.3 2007-12-21 7.0 arno. format man pages
deb.zip 1.2 2007-12-07 7.0 arno. License clarification
deb.zip 1.1 2007-12-06 7.0 arno. filetype for browsing debian changelog becomes debchangelog (instead of changelog). thanks to James Vega
deb.zip v1 2007-07-27 7.0 arno. Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_whatdomain.vim.html0000644000000000000000000002627012204336073020614 0ustar whatdomain.vim - Find out meaning of Top Level Domain : vim online
    sponsor Vim development Vim logo Vim Book Ad

whatdomain.vim : Find out meaning of Top Level Domain

 script karma  Rating 0/4, Downloaded by 387

created by
Michael Piefel
 
script type
utility
 
description
If you ever wondered what country the domain .tv belonged to, you had to look it up in some database - you had to leave Vim. No More!
This plugin offers you a simple function which will identify the domain and print it out. You can call the function WhatDomain directly (with one string argument, the TLD), ot even better, use the following command on the Vim command line:
    :WhatDomain
It will ask you for the domain you want to have identified and subsequently prints out which country or category this domain belongs to. You can also pass the domain you ask for as a parameter (:WhatDomain de) or use the function call syntax (:call WhatDomain).
 
install details
Just source this file at any point. To have it always available, simply put it in you .vim/plugin directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
whatdomain.vim 20010919 2001-09-19 6.0 Michael Piefel Thanks to a patch by Salman Halim you can now also call the routine with the domain as a parameter.
whatdomain.vim 20010820 2001-08-20 6.0 Michael Piefel Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_utl.vim.html0000644000000000000000000005773312204336073017275 0ustar utl.vim - Univeral Text Linking - Execute URLs in plain text, e.g. call browser, MS Word : vim online
    sponsor Vim development Vim logo Vim Book Ad

utl.vim : Univeral Text Linking - Execute URLs in plain text, e.g. call browser, MS Word

 script karma  Rating 2361/711, Downloaded by 3242

created by
Stefan Bittner
 
script type
utility
 
description
Utl.vim is the successor of the thlnk.vim plugin.

WHAT  IS  UTL.VIM ?

* It brings the benefits of URL-based hyperlinking to the realm of plain text,
  extending the URL syntax for plain text needs, in accordance with the RFC 2396
  URI specification.

* It's a handy utility for you right away. See examples below.

* It's fun :-)
  surfing text files, executing text ...


WHAT  IS  IT  GOOD  FOR ?

* Enables Vim to be your central desktop application, for instance:

  - Easily navigate in collections of related text files via hyperlinks
  - Call web browser and email client on URLs (configurable protocol handlers)
  - Call MS-Word on .doc files, Acrobat Reader on .pdf, Windows Explorer on
    directories, IrfanView on .jpg etc. (configurable media type handlers)
  - Maintain pictures from your digicam based on a text file
  - Maintain a personal info file containing hotlinks

* Use it for project management, software development, report preparation and
  technical writings. For instance:

  - Reference emails from text files
  - Reference bug tracker database from a text file

* Smart usages. For instance:

  - Embed vim commands in text files and source code.
  - Use it as light weight spell checker,
  - or for dictionary lookups.
  - Start programs using Utl.
  - Use it for relative editing and
  - for navigating HTML source code.

* Use it for quality commenting of source code. For instance:

  - Reference related code with hot links, e.g. reference the definition of a
    struct in C/C++
  - Reference design papers, UML diagrams, man pages etc from source code
  - Turn references like "see below" and "type zR to open the folds" into
    hotlinks


UTL.VIM  IS  EASY

* You only need to know one single command to get started: \gu = Go URL

  1. Type :help utl-start

  2. Hit \gu on the live examples given there

  As a reader of texts containing URLs that's all! As an author you have to
  know how to write URLs. But utl.vim gives you a training. And what you
  will learn is 90% general knowlegde about URLs that you can use elsewhere.

* Utl.vim is friendly:
  No side effects, fits seamlessly into your Vim Session, well documented.


EXAMPLES

Here are some simplistic examples. Assume you have the following stuff in a file and
execute the URL under the cursor with command \gu (all URLs can be with or without
<URL:...> embedding):

* Call your web browser (setup with a smart utility) and display www.vim.org

                    URL with embedding (and syntax highlighting)...
    <URL:http://www.vim.org>;
                    ...or without embedding...
    http://www.vim.org
                    ...or rudimentary URL
    www.vim.org

* Call your mailer

    mailto:stb@bf-consulting.de
    stb@bf-consulting.de
    stb@bf-consulting.de?Subject=UTL&Cc=bram@moolenaar.net

* Link to a local file to be displayed in a Vim window...
  (This is a bit like Vim's gf command, but portable and indepent of 'path' setting
  and cwd)

    ///file:/home/stb/.vimrc    or
    /home/stb/.vimrc

                    foo.txt in same directory as file containing this link
    foo.txt   or            
    ./foo.txt
                    bar.txt in sibbling directory of file containing this link
    ../sib/bar.txt  

* ...with fragment
  (This is a bit like tags, but theres is no tags file)

                    jump to specific position in target file foo.txt by searching
                    searchString (use this to turn phrases like "see in file foo.txt
                    and search for searchString" into hotlinks) ...
    foo.txt#searchString
                    ...or direct addressing of a line...
    foo.txt#line=123
                    ...or refer to the anchor `id=myIdentifier'
    foo.txt#r=myIdentifier  
                    ...or without a file, i.e. refers to current document (use this
                    to turn phrases like "see below" into hotlinks)
    #searchString        

* Link to a local file displayed by a handler application

                    hand over to MS Word (or Open Office, depending on the media type
                    handler you setup in UTL)
    foo.doc
                    typically call Acrobat Reader
    foo.pdf                
                    typically call IrfanView or XnView
    foo.jpg                

* Link to a directory

                    call Vim-Explorer or call Windows Explorer or DOS box or Unix shell
                    (with directory properly set)
    dir/  or                
    dir

* Embed Vim commands in text

                    switch colorscheme (perhaps maintain an annotated file with all Vim
                    schemes available?)
    <URL:vimscript:colors peachpuff>
                    open all folds (perhaps into your plugin for users who don't know
                    how to use folds)
    <URL:vimscript:normal zR>

                    reference the Vim help (perhaps into the source code of your own
                    plugins to explain certain constructs)...
    <URL:vimhelp:expr-==>  
                    ...again combined with a fragment to precisely address the exact
                    position
    <URL:vimhelp:expr-==#^since a string>

* Command line command :Gu to execute URLs:

                    same as first example ( or may I already speak UTL to you:
                    `same as #tp=browser ' :-)
    :Gu www.vim.org        
                    Open Windows Explorer (or whatever) displaying the directory where
                    the current file is in (on Windows very convenient in your daily
                    click click struggle)
    :Gu .                  

The UTL documentation contains lots of practical examples and usage patterns.

[keywords: hypertext, hyperlink]
 
install details
1.

Unzip to your plugin directory

2.

Start a new Vim

    Note: If you have installed UTLs predecessor "Thlnk" messages like "E227:
    mapping already exists for ..." will appear. Just ignore these.

3.

Execute the Vim command  :call Utl_finish_installation()

    This does the following:
    - If you have installed UTLs predecessor "Thlnk" it will carefully rename
      thlnk*.vim/doc files to files to .ori names. Thlnk and UTL cannot live
      together.
    - Generate the help tags file

4.

Restart Vim and execute:

    :help utl-start

and dive into the live examples...
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
utl-2_0_0.zip 2.0 2005-03-27 6.0 Stefan Bittner Successor of Thlnk.vim with many new features:
* Call web browser and email client on URLs (configurable scheme handlers),
* Call MS-Word on .doc files, Acrobat Reader on .pdf, IrfanView on .jpg etc.
  (configurable media type handlers)
* New vimscript: protocol for embedding vim commands into text files and source code.
* Syntax highlighting of URLs
* Support for URL heuristics, e.g. allow www.vim.org, not only http://www.vim.org
* Support exeuction of URLs without <URL:...> embedding, e.g. "see www.vim.org"
* Support multiline URLs, Smart setup and customization facility, bugs fixed.
thlnk-1.2.1.zip 1.2.1 2002-06-15 6.0 Stefan Bittner Please see release notes for version 1.2. The reason for this version 1.2.1 is, that I
packed the .vim files with the wrong 'fileformats' setting into the .zip file. Sorry!
thlnk-1.2.zip 1.2 2002-06-15 6.0 Stefan Bittner - New section "Tips and Common Pitfails" added to the docs. Enhanced Documentation.
- Enhanced warning and error messages.
- Bug fixes:
  * {Visual}\gu didn't work on Windows gVim without guioptions+=a set.
  * Klaus Horsten <horsten@gmx.at>: With 'wrapscan' unset, fragment addressing could fail.
  * Patrik Nyman <patrik.nyman@orient.su.se>: Non existing http: or rcp: URLs made thlnk
    list the current buffer.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_tetris.vim.html0000644000000000000000000003252712204336073017775 0ustar TeTrIs.vim - A tetris game in pure vim : vim online
    sponsor Vim development Vim logo Vim Book Ad

TeTrIs.vim : A tetris game in pure vim

 script karma  Rating 684/243, Downloaded by 12660

created by
Gergely Kontra
 
script type
game
 
description
A funny way to get used to VIM's h k l and <Space> key.
The first (I hope) interactive game inside pure VIM!
It's a work-in-progress version.

Todo:
- better random
- better timing
- shorter code

If you like games, also see Sokoban vimscript#211!
 
install details
Source it! Press :source TeTrIs.vim<Enter>

To start the game, press <Leader>te.
(If you don't know what is <Leader>, you should press \te, and type :help Leader<Enter> to learn about what the heck leader is)
Controls:
h: left
l: right
j: down
i,k: rotate
<Space>: drop
<Esc> or q: quit
(if you have more or other keys, which help you to learn VIM, please send me the mail)
p: pause game To restore, press <Leader>te in any window!

*** Save everything, before you begin to play ***
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tetris.vim 0.52fix 2002-02-27 6.0 Gergely Kontra norm -> norm! to protect from M$-win's remappings
tetris.vim 0.52 2002-02-20 6.0 Michael Geddes Fixed massive slowdown when key pressed.
Fix up window positioning when ending and showing highscore.
TeTrIs.vim 0.51 2002-02-19 6.0 Gergely Kontra New timing, bug fixes, Name is stored in script-variable.
TeTrIs.vim 0.5 2002-02-14 6.0 Gergely Kontra New mode, top10, better colors, improved rotation, new timing, speedup, animations
TeTrIs.vim 0.4 2002-02-04 6.0 Michael Geddes Colour, speeds, extra keys, the missing piece. Lotsa stuff.
TeTrIs.vim 0.1 2002-01-03 6.0 Gergely Kontra Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_lbdbq.vim.html0000644000000000000000000003153112204336073017541 0ustar lbdbq - query lbdb from Vim : vim online
    sponsor Vim development Vim logo Vim Book Ad

lbdbq : query lbdb from Vim

 script karma  Rating 12/3, Downloaded by 184

created by
Stefano Zacchiroli
 
script type
utility
 
description
Functions and various mode mappings for querying lbdb (http://www.spinnaker.de/lbdb/) when using Vim to edit mails and mail headers, for example from Mutt (http://www.mutt.org).

Using this utility lines like the following appearing in a Vim buffer:
    To: name surname, name2 surname2
can be automatically converted to lines like
    To: My Friend <foo@example.com>, My Other Friend <bar@example.com>
by querying lbdb.

When the expansion of a given contact is ambiguous (i.e. it corresponds to more than one contact) the user is interactively asked to choose among them.

The utility can be used in various ways:
- in normal mode typing <Leader>lb: the current recipient line will be expanded (i.e. all expandable short names will be expanded to full name/address pairs)
- in insert mode typing <Leader>lb: same as above but without leaving insert mode
- in line visual mode typing <Leader>lb: same as above but all the visually selected line will be subject to expansion
- in visual mode typing <Leader>lb: only the short names contained in the visually selected text will be subject to expansion

RELATED SCRIPTS

I'm (now) aware that vimscript #388 is older than this script of mine and provide similar features. But this script is strictly more powerful (YMMV of course). For example it works in various modes (visual/insert/normal/...), is able to substitute more contacts at once, and takes into account the semantics of recipient lines. E.g.: if you try to expand "name surname" (without double quotes) the plugin looks up for both of them, while vimscript #388 will look up only for the part under the courses, leading more likely to ambiguous answers.
 
install details
A matter of taste. Personally I drop lbdbq.vim in my ~/.vim/ directory and from  ~/.vim/after/ftplugin/mail.vim I do
    source ~/.vim/lbdbq.vim
If you don't mind having this plugin always loaded just drop it in ~/.vim/plugin/
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
lbdbq.vim 0.3 2007-07-22 7.0 Stefano Zacchiroli - quote the name part of returned addresses, so that names with (e.g.) commas does not break the headers
- change license to GPL v3 or above
lbdbq.vim 0.2 2007-01-08 7.0 Stefano Zacchiroli - bugfix for lines which are continuation of RFC822 fields
- added URL field in the plugin
- less stupid vmappings (i.e. more efficient)
- normalize spaces when expanding contacts
- silent mappings

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_detectindent.vim.html0000644000000000000000000002710312204336073021127 0ustar DetectIndent - Automatically detect indent (expandtab, shiftwidth, tabstop) settings : vim online
    sponsor Vim development Vim logo Vim Book Ad

DetectIndent : Automatically detect indent (expandtab, shiftwidth, tabstop) settings

 script karma  Rating 94/32, Downloaded by 1057  Comments, bugs, improvements  Vim wiki

created by
Ciaran McCreesh
 
script type
utility
 
description
This script provides a command which will attempt to guess the correct indent settings for an open file, for use when there is no modeline available. Note that this is a pure vim implementation, and doesn't require any external applications or interpreters.

Usage:

:DetectIndent

May also be used in an autocommand, for example:

:autocmd BufReadPost * :DetectIndent

Options:

To prefer 'expandtab' to 'noexpandtab' when no detection is possible:
:let g:detectindent_preferred_expandtab = 1

To specify a preferred indent level when no detection is possible:
:let g:detectindent_preferred_indent = 4

Notes:

Detection is by no means perfect. It won't work if files use especially perverse combinations of spaces and tabs, or weird tab widths. Bug reports and patches encouraged...

Keeping things up to date on vim.org is a nuisance. For the latest version, visit:

    http://github.com/ciaranm/detectindent
 
install details
Place in ~/.vim/plugin/ and ~/.vim/doc/
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
detectindent-1.0.tar.bz2 1.0 2005-01-03 6.0 Ciaran McCreesh Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_vcscommand.vim.html0000644000000000000000000013060212204336073020606 0ustar vcscommand.vim - CVS/SVN/SVK/git/hg/bzr integration plugin : vim online
    sponsor Vim development Vim logo Vim Book Ad

vcscommand.vim : CVS/SVN/SVK/git/hg/bzr integration plugin

 script karma  Rating 2335/783, Downloaded by 33038

created by
Bob Hiestand
 
script type
utility
 
description
VIM 7 plugin useful for manipulating files controlled by CVS, SVN, SVK, git, bzr, and hg within VIM, including committing changes and performing diffs using the vimdiff system.  Keywords:  bazaar bzr cvs CVS cvscommand git mercurial hg subversion SVN svk vcscommand

The source for this plugin is available in git at git://repo.or.cz/vcscommand .  A web front end is available at http://repo.or.cz/w/vcscommand.git .

Please submit any issues at http://code.google.com/p/vcscommand/
 
install details
If you are upgrading from the cvscommand.vim script, remove the cvscommand.vim plugin and the cvscommand.txt help file from your system before installing this version.  Also, read the CHANGES.txt file to learn about changes since cvscommand.vim.

For Vim 7:

  Unzip the installation file.
  Move the vcscommand.vim, vcscvs.vim, vcssvn.vim, vcssvk.vim, and vcsgit.vim scripts into your plugin directory.
  Move the vcscommand.txt file into your doc directory and use the ':helptags' command to add it to your help directory (:help add-local-help).

Optionally, you can move the syntax scripts into your syntax directory to get syntax highlighting of annotate result buffers.

For vim 6.x:

Use a previous version of the script (1.76 of cvscommand.zip).  This only supports CVS.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vcscommand-1.99.35.zip 1.99.35 2010-01-26 7.0 Bob Hiestand Fixed hang in MacVim on Snow Leopard (thanks to Adam Lickel).
vcscommand-1.99.34.zip 1.99.34 2010-01-11 7.0 Bob Hiestand vcshg:  Added annotate syntax.
vcscommand.zip 1.99.33 2010-01-08 7.0 Bob Hiestand HG improvements:

Fixed variable assignment bug in GetBufferInfo.
Add username to blame output.
Added split annotate view.
vcscommand.zip 1.99.32 2010-01-07 7.0 Bob Hiestand * Resolve ambiguous file/branch names.
* Work correctly with blanks in 'VCSCommandXXXExec' variable.

vcsbzr:  Add VCSCommandDisableAll kill switch.
vcsbzr:  use annotate split mode.
vcscvs:  Made GetRevision() script-local.
vcshg: Identify hg version control when not in the root of a repository.
gitAnnotate.vim:  match original commits in blame
vcscommand.zip 1.99.31 2009-07-21 7.0 Bob Hiestand Added VCSAnnotate! (and VCSBlame!) (default keybinding <leader>cN) to split the resulting buffer into separate header and content windows.

Included support for bzr and hg (as generously provided by others).

Added syntax file for git annotate buffers.
vcscommand.zip beta30 2009-07-20 7.0 Bob Hiestand vcscvs:  Removed useless (and bug-inspiring) aunmenu.

vcscvs:  Remove extraneous debug message issued by recent cvs.

Fixed typo in sample macro documentation.
vcscommand.zip beta29 2009-02-13 7.0 Bob Hiestand Added 'VCSCommandVCSTypeOverride' variable for explicitly overriding VCS type detection for specific directories.
vcscommand.zip beta28 2008-09-24 7.0 Bob Hiestand Add 'VCSCommandDisableAll' variable to prevent the plugin or any extensions from loading.

vcssvn:  prevent hangs caused by querying the user for input by specifying '--non-interactive' on the appropriate commands.

Use &diffopt to seed the default DiffSplit orientation. (James Vega)
vcscommand.zip beta28 2008-09-24 7.0 Bob Hiestand Add 'VCSCommandDisableAll' variable to prevent the plugin or any extensions from loading.

vcssvn:  prevent hangs caused by querying the user for input by specifying '--non-interactive' on the appropriate commands.

Use &diffopt to seed the default DiffSplit orientation. (James Vega)
vcscommand.zip beta27 2008-08-28 7.0 Bob Hiestand Shortcut / mapping configuration changes:

Do not fail out of plugin at first failed mapping.  Indicate mapping conflicts only if 'verbose' is set.
    
Add new option 'VCSCommandMapPrefix' for overriding the default prefix '<Leader>c' in mappings.
    
Add new option 'VCSCommandMappings' to completely override all default mappings.
vcscommand.zip beta 26 2008-06-19 7.0 Bob Hiestand vcsgit:  Set &ft correctly for VCSStatus buffers.

vcsgit:  Quote the blob name for VCSReview to handle paths with spaces.
vcscommand.zip beta25 2008-06-03 7.0 Bob Hiestand This fixes the  'cdpath' error in git VCSReview and (2 argument) VCSVimDiff.
vcscommand.zip beta24 2008-05-20 7.0 Bob Hiestand       Revert "Call subversion with the '--non-interactive' switch to avoid locking up when authentication can't be prompted."
      Use 'setlocal' instead of 'set' for all buffer option changes.
      Use 'enew' followed by 'file' instead of 'edit' when creating output buffers.
      Don't execute autocommands when naming VCS command output buffers.

This set of changes may avoid issues related to autocommands that execute when the command result buffer is opened.
vcscommand.zip beta22 2008-03-17 7.0 Bob Hiestand Added VCSCommandGitDescribeArgList option to control allowed modes of 'git describe' used in GetBufferInfo for git.  This is a comma-separated list of arguments to try against git-describe.  This is an attempt to have prioritized fallbacks of descriptions, and runs in order until it finds a valid description.  This value defaults to ',tags,all,always', and so first searches annotated tags, then tags, then all references, then a commit description.
vcscommand.zip beta21 2008-03-11 7.0 Bob Hiestand Tweaked buffer info for git buffers.

Don't clobber &cp when testing for a vcs command.

Added 'options' Dict to VCSCommandDoCommand for tweaking framework behavior.

Allow non-zero vcs command exit status when 'allowNonZeroExit' option is passed to VCSCommandDoCommand.

Implemented VCSStatus for git as (repository-wide) 'git status'.

Converted to leading tab style.

Distinguish between exact and inexact identifications by extensions.

Mark git identification as inexact, so that using another VCS to control directories somewhere under a git-controlled directory does not identify the files incorrectly as git.

Moved CHANGES.txt content into help file.
vcscommand.zip beta20 2008-02-01 7.0 Bob Hiestand Implemented (first pass of) git support.

Temporarily removed buffer status/command verification scheme.

Save and restore 'foldlevel' with VCSVimDiff.

Added VCSRemove as alias for VCSDelete.
Added VCSBlame as alias for VCSAnnotate.
vcscommand.zip beta19 2007-07-31 7.0 Bob Hiestand Load the plugin with nocompatible set, as it should have been done a few years ago.
vcscommand.zip beta18 2007-05-15 7.0 Bob Hiestand Added 'VCSCommandDisableMappings' and 'VCSCommandDisableExtensionMappings' options.  If set, these variables prevent creation of the default command key mappings.
vcscommand.zip beta17 2007-05-15 7.0 Bob Hiestand Use 'executable()' to test for VCS tools (to avoid potentially slow operation at plugin load time).

Always pass current revision to VCSAnnotate when using CVS with no arguments.
vcscommand.zip beta16 2007-04-30 7.0 Bob Hiestand VCSLog accepts passthrough options.
VCSDiff correctly checks whether second argument starts with hyphen when deciding whether to pass-through.
vcscommand.zip beta15 2007-04-24 7.0 Bob Hiestand Use 'haslocaldir()' if available to correctly handle windows that used :lcd.

Made VCSDiff pass-through.

Fixed SVK VCSDiff implementation.

Made VCSCommands work a bit better on directory buffers (netrw).

Replaced delayed extension registration to directly loading the main plugin from
extension plugins.  This allows base functions declared in the main plugin to
be used in the extensions.

Fixed SVN diff to actually use 'VCSCommandSVNDiffOpt' option.
vcscommand.zip beta14 2007-04-12 7.0 Bob Hiestand Reincarnated 'CVSAnnotateParent' option for CVS as 'VCSCommandCVSAnnotateParent'.

Close all vcscommand result buffers when vim exits to prevent them from being written to the viminfo file.
vcscommand.zip beta13 2007-03-12 7.0 Bob Hiestand Fixed following commands (broken in Beta 12):
  VCSLock
  VCSRevert
  VCSUnlock
  VCSUpdate
vcscommand.zip beta12 2007-02-28 7.0 Bob Hiestand Added SVK support.

Replaced SVN-specific command SVNInfo with VCSInfo, which is defined for SVK
and SVN.  This is mapped to '<leader>ci' by default; as a consequence, the
default mapping for the CVS-specific CVSEditors command was changed to
'<leader>cE'.

Made VCSAnnotate accept parameters to pass to the underlying VCS.

Made error messages for operations on non-versioned files more consistent.

Added check to disable individual VCS extension plugins.
vcscommand.zip beta11 2007-02-20 7.0 Bob Hiestand Added VCSCommandSVNDiffExt option to allow external diff applications.
Added VCSDelete command.
Added pass-through parameters to VCS Add, Delete, Log, Status, Lock, and Unlock commands (extra parameters to the command are given to the underlying VCS command).
vcscommand.zip Beta10 2006-11-02 7.0 Bob Hiestand Changed file type of commit log buffers to 'commitlog' (from 'commit log') to avoid FileType errors.

Added 'VCSCommandSVNDiffOpt' to pass options to the svn diff -x parameter.
vcscommand.zip Beta9 2006-09-11 7.0 Bob Hiestand Added 'VCSCommandResultBufferNameExtension' option for adding a custom extension to the VCS output buffer names.  This is intended to help users experiencing issues due to autocommands and other settings that depend on buffer name.

Added 'VCSCommandResultBufferNameFunction' option for completely over-riding the procedure for generating the result buffer names.
vcscommand.zip Beta8 2006-08-14 7.0 Bob Hiestand Changed behavior of plugin within Explorer/netrw -style directory buffers.  Commands within such a buffer now act as though invoked on that directory, and so affect all files (and subdirectories), regardless of where the cursor is within the directory buffer.
vcscommand.zip Beta5 2006-08-09 7.0 Bob Hiestand Corrected shortcut help text in commit message buffer.
vcscommand.zip Beta4 2006-08-09 7.0 Bob Hiestand Changed default mappings back to those from cvscommand (starting with
'<Leader>c' instead of '<Leader>v'.  This is to avoid conflict with existing plugins using the '<Leader>v' prefix.  Please note that the mappings can still be overridden by the user using <Plug> mappings.  Please consult the documentation for more information.

Removed special characters other than parentheses from output buffer names.  This is to address buffer name problems on Windows.
vcscommand.zip Beta3 2006-08-04 7.0 Bob Hiestand Initial public release of vcscommand (based on cvscommand) to integrate subversion (SVN) and utilize VIM 7.0 features.
cvscommand.zip 1.76 2006-02-22 6.0 Bob Hiestand Added optional direct specification of log message on :CVSCommit command (to avoid using the log message buffer).  Usage:

:CVSCommit <log message text here>
cvscommand.zip 1.75 2006-02-13 6.0 Bob Hiestand Forced file changed check whenever the original CVS file could have changed, even in split window environments (per Luca Gerli).
cvscommand.zip 1.74 2006-02-06 6.0 Bob Hiestand * Added ability to use CVSCommand functions / hotkeys on directory listing buffers, specifically the file explorer.
* CVSAnnotate:  Previously, if CVSAnnotate was invoked on a CVSAnnotate buffer, the new annotate buffer would go to the version just prior to the one on the current line.  Now, the new buffer uses the version on the current line.  To obtain the old behavior, set CVSCommandAnnotateParent to a non-zero value.  The header lines resulting from the cvs annotate command are now trimmed.  No attempt is made to jump to the 'correct' line in a CVSAnnotate buffer, as it is unlikely to be the correct line anyway.
cvscommand.zip 1.73 2006-01-23 6.0 Bob Hiestand Fixed typo in sample map in documentation per Luca Gerli.
cvscommand.zip 1.72 2006-01-17 6.0 Bob Hiestand Moved version check to after the loaded_cvscommand check.
cvscommand.zip 1.71 2005-11-22 6.0 Bob Hiestand Restored CVSVimDiffFinish user autocommand which executes after a CVSVimDiff
(in order to allow customization of window placement, etc).
cvscommand.zip 1.70 2005-11-10 6.0 Bob Hiestand Fixes bug that resulted in working directory change.

Displays warning to user and will not load if running on VIM earlier than 6.2.
cvscommand.zip 1.68 2005-06-30 6.0 Bob Hiestand Fixed bug with autochdir and CVSCommit.
(Repackaged from previous upload, which had new script in wrong place and old script in right place).du
cvscommand.zip 1.67 2004-09-27 6.0 Bob Hiestand Corrected b:CVSRepository variable for CVSAdd'd files.  This will fix status line display for these files, if the default (cvs) status line is used.
cvscommand.zip 1.66 2004-09-14 6.0 Bob Hiestand Changed maintainer email address.
cvscommand.zip 1.65 2004-08-02 6.0 Bob Hiestand Added instructions for integrating with SSH.

Added CVSCommandCVSExec option to specify cvs executable path.

Added CVSBufferSetup user event.
cvscommand.zip 1.64 2004-05-12 6.0 Bob Hiestand Delete folds created by vimdiff mode in CVSVimDiff if the original window used manual folds, when it is restored.

Always set scrollbind in the result window of a CVSVimDiff in order to combat the effects of splitting windows resetting scrollbind.  Please let me know if this causes anyone trouble.
cvscommand.zip 1.63 2003-07-03 6.0 Bob Hiestand Bugfix release.  Buffers start with 1, not 0.  Switch to the original buffer first before destorying CVS buffers in
CVSGotoOriginal! in order to preserve window layout.
cvscommand.zip 1.62 2003-07-02 6.0 Bob Hiestand Added b:CVSRepository as a standard variable if buffer setup is enabled.

Changed sample status line to display the repository version number if it differs from
the working version number.

Added recursive annotation functionality.

Silenced text puts to set up the CVSCommit buffer.

Added CVSVimDiffFinish event for window placement customization.

Implemented the remove-all-CVS-buffers aspect of CVSGotoOriginal! in a slightly
more sane way.

Added 'foldenable' to the list of restored options for
CVSVimDiff.
cvscommand.zip 1.54 2003-04-28 6.0 Bob Hiestand Added recognition of numerical tags for use as sticky tags.
cvscommand.zip 1.52 2003-04-18 6.0 Bob Hiestand Added the CVSGotoOriginal[!] command and mappings (<Leader>cg and <Leader> cG for with and without '!', respectively).  This command jumps to the source buffer if the current buffer is a CVS output buffer.  The '!' also closes all CVS output buffer for the given source buffer.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_a.vim.html0000644000000000000000000007475412204336073016713 0ustar a.vim - Alternate Files quickly (.c --> .h etc) : vim online
    sponsor Vim development Vim logo Vim Book Ad

a.vim : Alternate Files quickly (.c --> .h etc)

 script karma  Rating 1827/577, Downloaded by 15794

created by
Mike Sharpe
 
script type
utility
 
description
A few of quick commands to swtich between source files and header files quickly.

:A switches to the header file corresponding to the current file being edited (or vise versa)
:AS splits and switches
:AV vertical splits and switches
:AT new tab and switches
:AN cycles through matches
:IH switches to file under cursor
:IHS splits and switches
:IHV vertical splits and switches
:IHT new tab and switches
:IHN cycles through matches
<Leader>ih switches to file under cursor
<Leader>is switches to the alternate file of file under cursor (e.g. on  <foo.h> switches to foo.cpp)
<Leader>ihn cycles through matches

E.g. if you are editing foo.c and need to edit foo.h simply execute :A and you will be editting foo.h, to switch back to foo.c execute :A again.

Can be configured to support a variety of languages. Builtin support for C, C++ and ADA95
 
install details
Drop a.vim into your favorite plugin directory or source the script from your .vimrc file
Drop alternate.txt into you doc directory and run helptags
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
a.vim 2.18 2007-06-07 7.0 Mike Sharpe Recent versions since 2.16 broke user defined alternate specifications. This patch fixes that.
a.vim 2.17 2007-05-23 7.0 Mike Sharpe Fix a bug were spaces in filenames and/or directory names would prevent the alternate file being openned. Thanks to Nathan Stien (for the bug report and patch) and Soeren Sonnenburg (for the bug report).
a.vim 2.16 2007-03-16 7.0 Mike Sharpe Recent patches broke the script in some area, mainly in the area of file extensions which contain a dot...e.g. aspx.cs. Switched to using a dictionary instead of the curly brace variable things.
alternate.txt 2.15 doc 2006-10-27 7.0 Mike Sharpe Docs for 2.15
a.vim 2.15 2006-10-27 7.0 Mike Sharpe Initial support for jumping to files under the cursor. New commands IH, IHS, IHV, IHT and IHN. Added sample macros for jumping to the source file corresponding to the header file under the cursor (e.g. jumping on #include <myfile.h> will find myfile.cpp).

See documentation for more details.
a.vim 2.14 2006-05-14 7.0 Mike Sharpe Added new :AN command which cycles through all matches after switching to a new file. E.g. vi a.c, :A switches to a.h, :AN might switch to a.hpp if a.h and a.hpp exist. Will only likely be an issue in a big project with with same named source/header files around the place. Will likely only be an issue if you are using the search path and regex features of a.vim.
alternate.txt 2.14 doc 2006-05-14 7.0 Mike Sharpe Documentation for a.vim v2.14. Drop it in your doc directory and run helptags.
a.vim 2.13 2006-05-07 7.0 Mike Sharpe Added new "AT" command which finds the alternate file and opens in a new tab. Similarly to the "A" and "AS" commands, if the buffer is already open it simply switches to that buffer in the corresponding tab/window. This script will only work with VIM7 from this version forward.
a.vim 2.12 2005-04-12 6.0 Mike Sharpe Added alternate mappings for OCaml. Nothing more. No reason to upgrade...unless you use OCaml.
a.vim 2.11a 2004-10-19 6.0 Mike Sharpe Fix a minor bug when adding alternate extensions. Thanks ilya.
a.vim 2.11 2004-09-24 6.0 Mike Sharpe Fix some bugs which have recently crept in. I gave this some regression testing...so I hope all are fixed now. Mot notably, vim foo/a.c would not alternate to foo/a.h. Not sure how that broke...but it is fixed now. Other features still appear to work. Let me know if there are issues.
a.vim 2.10 2004-09-15 6.0 Mike Sharpe Added a new variable (g:alternateNoDefaultAlternate) which can be set in the .vimrc/_vimrc file to prevent a.vim from creating new files. This is useful when it is not desired to have a.vim to alternate to the default alternation for a particular extension. E.g. if a.c is being editted and a.h does not exist anywhere and :A is done then if g:alternateNoDefaultAlternate is non-zero a.h will not be created. By default the value of g:alternateNoDefaultAlternate is 0 to maintain existing behaviour.
a.vim 2.9 2004-09-10 6.0 Mike Sharpe Allow the extension of a file to be more than the text after the last dot. E.g. adding settings like

let g:alternateExtensions_{'aspx'} = "aspx.cs,aspx.CS"
let g:alternateExtensions_{'aspx.cs'} = "aspx,ASPX"

will allow a.vim to alternate between foo.aspx and foo.aspx.cs and vice versa. Previous versions would not accept .aspx.cs as an exstension. This version is ok with that.
a.vim 2.8 2004-07-01 6.0 Mike Sharpe [CORRECTION]More enhancements from Bindu Wavell. A new search path type
of "reg:" wasadded. This version allows alternation of files based on regxes. E.g.
"reg:/inc/src/g/" will replace every instance of 'inc' with 'src' in the source
file path. This is useful for alternating between /some/path/inc/project/foo.h
to /some/path/src/project/foo.c. Similarly "reg:/src/inc/g/" is the opposite
alternation. See the comments for ExpandAlternatePath() for more information.
Soon I will produce some formal documentation for this...until then the script
is reasonably well commented.
a.vim 2.7 2004-05-16 6.0 Mike Sharpe Reworked all the logic for finding alternate files. The files in memory are prefered to files on disk now too. When there are multiple matches for a file found the file in memory is favour, files in the current directory are favoured over files on the path. Hopefully this fixes the inconsistencies in previous versions. Hopefully everything still works too.
a.vim 2.6a 2004-03-14 6.0 Mike Sharpe Remove reference to Decho which was accidentally left in after previous debuging. Sorry all.
a.vim 2.6 2004-03-13 6.0 Mike Sharpe Implemented a fix from Matt Perry, vi test.cc junktest.h and the :A would alternate to junktest.h and not test.h. Also some minor clean up of the directory search code.
a.vim 2.5 2004-01-20 6.0 Mike Sharpe Fixed an inconsistency. In 2.4 :A would always switch to the alternate file, regardless of whether unsaved changes were in the current file. In some cases it was possible to lose changes. This update changes :A back to 2.3 behaviour, but with a nicer error message, and provides support for a :A! command which will force the switch. This seems more consistent with the builtin vim/vi commands. Please let me know if there are any problems.
a.vim 2.4 2003-05-21 6.0 Mike Sharpe Fix error which occured when alternating from a file which had not been saved.
a.vim 2.3 2002-09-24 6.0 Mike Sharpe Added support provided by Bindu Wavell to search for the alternate file across directories.
a.vim 2.2 2002-03-06 6.0 Mike Sharpe minor clean up. Remove repeated code used to
setup the default alternate file mappings. No changes in functionality. No reason to upgrade.
a.vim 2.1 2002-02-02 6.0 Mike Sharpe simplified the config using vim's curly brace variables. Should behave the same way version 2.0X behaves....no huge reason to upgrade.
a.vim 2.0.1 2002-01-29 6.0 Leif Wickland Adds support for vertically splitting via the command :AV
a.vim 2.0b 2001-11-29 6.0 Mike Sharpe Added support for Ada95 extensions
minor bug fixed too.
a.vim 2.0a 2001-11-27 6.0 Mike Sharpe bug fix. handle the cases were the is no alternate file.
a.vim 2.0 2001-11-27 6.0 Mike Sharpe Complete rewrite. Now the supported extensions are configurable instead of being part of the code.
Notes on how to configure are in the comments in the file. Expect bugs, please be brave. Will fix reported issue quickly.
a.vim 1.4 2001-11-27 6.0 Mike Sharpe Added support for .hpp/.HPP files.
a.vim 1.3 2001-11-10 6.0 Mike Sharpe Take care of some issues with case-sensitivity of the extension on windows platforms.
a.vim 1.2 2001-11-10 6.0 Mike Sharpe Minor changes to cater for "files" which are in vim buffers but not on disk (yet).
a.vim 1.1 2001-09-12 6.0 Leif Wickland This is a plugin-ized version of 1.1 for vim 5.7
a.vim 1.1 2001-08-22 5.7 Mike Sharpe Added copyright information.
Support .cc, .cxx, .C extensions for C++ too.
a.vim 1.0 2001-07-09 5.7 Mike Sharpe Corrected vim version. The script works with 5.7, but should work with 6.0 too.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/html/plugin_project.vim.html0000644000000000000000000004664112204336073020133 0ustar project.tar.gz - Organize/Navigate projects of files (like IDE/buffer explorer) : vim online
    sponsor Vim development Vim logo Vim Book Ad

project.tar.gz : Organize/Navigate projects of files (like IDE/buffer explorer)

 script karma  Rating 1731/500, Downloaded by 20265

created by
Aric Blumer
 
script type
utility
 
description
You can use this plugin's basic functionality to set up a list of
frequently-accessed files for easy navigation. The list of files
will be displayed in a window on the left side of the Vim
window, and you can press <Return> or double-click on
filenames in the list to open the files. This is similar to how
some IDEs I've used work. I find this easier to use than
having to navigate a directory hierarchy with the file-explorer.
It also obviates the need for a buffer explorer because you
have your list of files on the left of the Vim Window.


But there's much, much more . . . .

You can also instruct the Plugin to change to a directory and
to run scripts when you select a file. These scripts can, for
example, modify the environment to include compilers in
$PATH. This makes it very easy to use quickfix with multiple
projects that use different environments. I give examples in
the documentation.

Other features include:
o Loading/Unloading all the files in a Project (\l, \L, \w, and \W)
o Grepping all the files in a Project (\g and \G)
o Running a user-specified script on a file (can be used
  to launch an external program on the file) (\1 through \9)
o Running a user-specified script on all the files in a Project
  (\f1-\f9 and \F1-\F9)
o Also works with the netrw plugin using directory
  names like ftp://remotehost
             (Good for webpage maintenance.)
o Support for custom mappings for version control
  integration (example of perforce in the documentation).
o I also give an example in the documentation on how to
  set up a custom launcher based on extension. The
  example launches *.jpg files in a viewer. I have also set
  up viewers for PDF (acroread) and HTML files (mozilla)
  for my own use.

This plugin is known to work on Linux, Solaris, and Windows.
I cannot test it on Windows, though, so please let me know if
you run into any problems. If you use it on other platforms,
let me know.

(Let me know if you need a .zip file)
 
install details
Decompress and untar in your ~/.vim directory (or
equivalent).  Inside Vim, enter this:
   :helptags ~/.vim/doc
(or equivalent directory)
(Enter ":help add-global-plugin" to determine the directory to
untar it into.)

Then enter
  :help project
for information
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
project-1.4.1.tar.gz 1.4.1 2006-10-13 7.0 Aric Blumer - Bug fixes
- Optional use of vimgrep instead of grep
- Line numbers in the project window
- Window not bound to left side (experimental)
project-1.4.tar.gz 1.4 2006-04-24 7.0 Aric Blumer After about 2.5 years here is a slightly updated version.

-Updated to support 7.0.  The previous version works in 7.0, but there was an annoying redraw when you move into/out of the project window.
-Also, 7.0 treats modelines a little bit differently than 6.x. Version 7.0 re-evaluates window-local modelines if you hide and show the project window, and this messes up folds if you have a foldlevel in your project file's modelines.  Modelines are now turned off after the project file is first loaded.
-Added \S (Split-load all files at the cursor level) contributed by A. Harrison.
-Bug fix with misuse of winnr() when winbufnr() should have been used.
project-1.3.tar.gz 1.3 2002-10-25 6.0 Aric Blumer -Bug Fixes (thanks Xiangjiang Ma)
-Completed suite of % expansions in proj_run
-Added mapping to toggle Project Window open/closed.
-Added <F5> mapping equivalent to \R
project-1.2.1.tar.gz 1.2.1 2002-10-01 6.0 Aric Blumer --Identical to 1.2 but fixed functionality with netrw
project-1.2.tar.gz 1.2 2002-09-30 6.0 Aric Blumer -Environment variables now expanded in paths.
-Added 'b' flag to use the browse() function. (Off for Windows--it can't browse for directories.)
-Added keep pragma to keep lines when refreshing.
-Small tweaks.
-Doc: example of using perforce with the plugin.
-Doc: example of adding custom launchers.
-Can't test on Windows, please let me know of problems.
project-1.1.tar.gz 1.1 2002-04-01 6.0 Aric Blumer Now accepts spaces in directories. Some bug fixes, too. Added Project_GetFname() for user scripts.
project.tar.gz 1.0 2001-11-30 6.0 Aric Blumer Some Bugfixes, improvements in performance. Added recursive create, explore, filenames with spaces, etc.
project.tar.gz 1.0pre4 2001-10-18 6.0 Aric Blumer Last pre before 1.0, so please test!
- Added project grep, project load, project wipe
- Can run commands on all files in a project.
- Now supports netrw plugin
project.tar.gz 1.0pre3 2001-10-09 6.0 Aric Blumer Added flags for sorting of filenames.
Added mappings to run external program or Vim script on a file.
Fixed a small bug ("internal error").
project.tar.gz 1.0pre2 2001-10-05 6.0 Aric Blumer Fixed absolute path detection for Win32. (Thanks Lawrence!) Fixed small documentation error.
project.tar.gz 1.0pre1 2001-10-03 6.0 Aric Blumer Several new features, most notably: Paths can now be relative in subprojects. Subprojects inherit parameters from parent. New in= and out= directives to run Vim scripts to modify the environment. Added T flag. Added per-fold flags. CTRL-W_o keeps Project Window visible. etc.

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo
vim-scripts-20130814ubuntu1/doc/0000755000000000000000000000000012204336114013211 5ustar vim-scripts-20130814ubuntu1/doc/utl_ref.txt0000644000000000000000000003065712204336073015431 0ustar *utl_ref.txt* Plugin for executing URLs from text files (reference manual) For Vim version 6, Version: utl-2.0, $Revision: 1.11 $ Utl.vim Reference Manual By Stefan Bittner stb@bf-consulting.de Contents: 1. The utl.vim reference........|utl-reference-manual| 2. Brief refresher URL and URI..|utl-uriprim| NOTE: At the moment (utl.vim-2.0) the reference is not complete. References: - see |utlusr.txt| for the user manual ============================================================================== 1. The utl.vim reference *utl-reference-manual* 1.1 Fragment expression syntax *utl-fragexpr* Utl.vim supports the following fragment expressions: #tn=MySearchText "Text Next Search" *utl-#tn* #MySearchText Addresses that position in the target file, which is defined by searching the string "MySearchText" in forward direction. The search is done relative, i.e. beginning from the actual position. This typically is the start of the document. MySearchText can contain White Space. The searching is done in a fuzzy manner (see ). The basic idea of the fuzzy search is that the semantic sequence of words should be sufficient, in order to minimize broken fragments. #tp=MySearchText "Text Previous Search" *utl-#tp* like #tn but search backwards. #line=MyLineNumber e.g. line=23, line=-8. *utl-#line* References the given line number in the text. The search is done relative, like above. #r=MyIdentifier ID-Reference. *utl-#idref* References the defined `anchor' id=... in the target document. See also |utl-fragmedtyp|. MyIdRef should be an identifier (not a sequence of words). Note that #r=foo and #r=foobar are distinguished whereas #tn=foo will perhaps find the wrong position if there also is as string foobar in the target document. 1.2. Dependency of fragment interpretation from media type *utl-fragmedtyp* According to RFC2396, the interpretation of fragments determined by the type of the target document (see: #tn=is dependent on the media type ) For media types other than "text/*" fragments will be ignored (e.g. for "image/*") For "text/*" utl.vim makes a difference between "text/html" and all other "text/*" subtypes. But the interpretation of tn=, tp=, line= is the same for _all_ text/* subtypes. Just the IdRef interpretation is different: text/html IdRef interpreted as a HTML-reference (i.e. NAME="myRef") text/* IdRef interpreted as "txt-reference" (i.e. id=myRef) 1.3 Utl.vim internals *utl-internals* 1.3.1 Definition of LocalPath Utl.vim internally has a notion "LocalPath". LocalPath is an absolute path of the local file system. A real local file (or directory) with that name exists. A pure buffer is not possible (at the moment). Utl's is simpler due to this restriction. For localPath a resource mapping exists. 1.4. Mappings and Commands *utl-mappings* *utl-commands* Note: The mappings below depend on the |mapleader| variable. This means, instead of \gu it might be ,gu or whatever. 1.4.1 `Goto URL under cursor' mappings *utl-gourlundercurs* The following mappings are available to execute the URL under the cursor: \ge, \gE, \gS, \gu *utl-ge* *utl-gS* *utl-gu* Goto URL under cursor. Open the target read/write. \ge replaces the current window with the target (:edit) \gE opens the target in a split window (:split). \gS opens the target in a vertical split window (:vsplit) \gu is the same as \ge. It is provided for easy mnemonics: gu = Go Url It's the only command you really have to know in order to use utl.vim! \gv, \gV *utl-gv* Goto URL under cursor. Open the target read only \gv replaces the current window with the target (:view). \gV opens the target in a split window (:sview). \gr *utl-gr* Read the URL under cursor into the current buffer at the current position (:read) 1.4.2 `Goto visual URL' mappings *utl-gourlvis* Same as the above mappings, but the but the highlighted text is used as the name of the URL. The visual mappings are useful when you have a text where the URLs are not embedded. Example: "See http://vim.sf.net for useful Vim plugins" *utl-v_ge* *utl-v_gs* *utl-v_gu* {Visual}\ge, {Visual}\gE, {Visual}\gS {Visual}\gu {Visual}\gv, {Visual}\gV *utl-v_gv* {Visual}\gr *utl-v_gr* 1.4.3. `Goto URL by command' *utl-gourlcmd* Type in an URL manually. :Gu {URL} *utl-:gu* Goto the typed URL. The difference between \gu and :Gu is like in an web browser: typing an URL versus clicking an URL in the displayed text. But there is one important difference though. :Gu is executed in the context of the current buffer, i.e. :Gu myurl is the same as clicking \gu on in the text of the current buffer. That means that relative URLs are possible! So :Gu can be used for relative editing. See |utl-tipsguusage| or |utl-tuttypeurl| for examples of usage. 1.6.4. Other mappings and commands \gs *utl-gs* Show the base URL that is associated with the current buffer in the status line, if any. Else shows the text `no associated URL'. That means, that the current buffer was not invoked as a link target (i.e. was not invoked through a utl.vim `Goto URL' command like \gu, :Gu etc). \gs just does a lookup utl's cache (see |utl-gc|). Tip: If, in the `no associated URL' case, you like to know what the base URL is, you can first issue the command :exe ':Gu ' . expand('%') to "urlify" the current buffer (see |utl-tutfileisdef|); a subsequent \gs then shows the associated URL. This can be useful while learning utl.vim. The associated URL is always an absolute URL. And it is the base URL that would be taken when a link, containing a relative URL, would be executed out of the current buffer, e.g. a is executed. \gc *utl-gc* Shows utl.vim's internal cache map in a separate window. Useful mainly to see what's going on. See |utl-tutcachemap| for more information. ============================================================================== 2. Brief refresher on URL and URI *utl-uriprim* This chapter might be worth reading if you are thinking about designing your own protocols. If you are going to extend Utl, it's source code will be easier understandable if you know URLs better. But it is also intended for the interested user to acquire a more thorough understanding of URLs and Utl in general. Uniform Resource Identifiers are specified in RFC 2396, see . URI vs. URL *utl-uri-uriurl* ----------- #uu geht so nicht mehr! ( Reference: #tn=^1.2. ) URL - Uniform Resource Locators are a subset of URI: A URL is a URI. As the name says, a URL identifies a resource by its (network) location. Other ways to identify a resource are suggested with "Uniform Resource Names" (URN). URI = URL | URN. But for the purpose of utl.vim you can ignore the difference between URIs and URLs. The three letters U, R, I *utl-uri-3letters* ------------------------- ( Reference: #tn=^1.1 Overview The following material is directly taken from there ) URI are characterized by the following definitions: Uniform Uniformity provides several benefits: it allows different types of resource identifiers to be used in the same context, even when the mechanisms used to access those resources may differ; it allows uniform semantic interpretation of common syntactic conventions across different types of resource identifiers; it allows introduction of new types of resource identifiers without interfering with the way that existing identifiers are used; and, it allows the identifiers to be reused in many different contexts, thus permitting new applications or protocols to leverage a pre-existing, large, and widely-used set of resource identifiers. Resource A resource can be anything that has identity. Familiar examples include an electronic document, an image, a service (e.g., "today's weather report for Los Angeles"), and a collection of other resources. Not all resources are network "retrievable"; e.g., human beings, corporations, and bound books in a library can also be considered resources. The resource is the conceptual mapping to an entity or set of entities, not necessarily the entity which corresponds to that mapping at any particular instance in time. Thus, a resource can remain constant even when its content---the entities to which it currently corresponds---changes over time, provided that the conceptual mapping is not changed in the process. Identifier An identifier is an object that can act as a reference to something that has identity. In the case of URI, the object is a sequence of characters with a restricted syntax. Having identified a resource, a system may perform a variety of operations on the resource, as might be characterized by such words as `access', `update', `replace', or `find attributes'. URI Syntactic Components *utl-uri-syntcomp* ------------------------ ( Reference: #tn=^3. URI Syntactic ) An URI goes like this: : That means, that the thing behind the colon is specific to the scheme! The scheme-specific-part is also known as the `opaque' component. But many schemes have a hierarchical structure, which is also defined by RFC 2396. The syntax for hierarchical URI is: ://? The `authority' often is a host name (but can also be, say, a windows drive). An example for a non hierarchical URI is the vimhelp scheme, e.g. `vimhelp:help'. Another example is the mailto scheme: mailto:stb@bf-consulting.de Each of the above components may be missing, and it's still a valid URI. URI References *utl-uri-refs* -------------- ( Reference: #tn=^4. URI References ) URI reference = URI # fragment The fragment is not part of an URI! But it often appears in conjunction with it, so RFC2396 deals with the fragments also. Utl.vim doesn't care much making the correct distinction. Most often it is clear from the context. Fragment Identifiers *utl-uri-fragids* -------------------- ( References: #tn=^4.1. Fragment ) It is very important to realize, that fragment interpretation only depends on the media type of the "retrieved" document. Not from, say, the scheme, i.e. the protocol. This property is utilized by utl.vim since it defines fragment syntax for generic, unstructured text (i.e. tn= line=). Absolute and relative URI *utl-uri-relabs* ------------------------- ( Reference: #tn=Relative URI references are distinguished ) URI come in two forms: relative and absolute. The rule to distinguish between the two is very simple: Scheme component exists = It's an absolute URI Normally, a relative URI is transformed into an absolute URI by the application context in which the relative URI appears. Context = base URL Escaping forbidden characters *utl-uri-forbchars* ----------------------------- #uu stimmt nicht mehr so ( Reference: #tn=^2. URI Char ) Only a limited set of ascii characters are allowed in an URI. Some other characters, like < > ? / : for example, are reserved characters, in the sense that they have a special meaning for the URI itself. If you need to use a forbidden or reserved character, you have to escape it by its hex value. Examples: `>' -> `%3e' ` ' (blank) -> `%20' Hint: Just use Vim's :asc command to find out the hex value of a character! If in doubt if a character is forbidden you can also escape allowed characters. Example: ============================================================================== FOOTNOTES -----id=foot1 Thanks for trying out utl.vim :-) vim:tw=78:sw=4:sts=4:ts=8:ft=help:norl: vim-scripts-20130814ubuntu1/doc/NERD_commenter.txt0000644000000000000000000011416012204336073016562 0ustar *NERD_commenter.txt* Plugin for commenting code NERD COMMENTER REFERENCE MANUAL~ ============================================================================== CONTENTS *NERDCommenterContents* 1.Intro...................................|NERDCommenter| 2.Installation............................|NERDComInstallation| 3.Functionality provided..................|NERDComFunctionality| 3.1 Functionality Summary.............|NERDComFunctionalitySummary| 3.2 Functionality Details.............|NERDComFunctionalityDetails| 3.2.1 Comment map.................|NERDComComment| 3.2.2 Nested comment map..........|NERDComNestedComment| 3.2.3 Toggle comment map..........|NERDComToggleComment| 3.2.4 Minimal comment map.........|NERDComMinimalComment| 3.2.5 Invert comment map..........|NERDComInvertComment| 3.2.6 Sexy comment map............|NERDComSexyComment| 3.2.7 Yank comment map............|NERDComYankComment| 3.2.8 Comment to EOL map..........|NERDComEOLComment| 3.2.9 Append com to line map......|NERDComAppendComment| 3.2.10 Insert comment map.........|NERDComInsertComment| 3.2.11 Use alternate delims map...|NERDComAltDelim| 3.2.12 Comment aligned maps.......|NERDComAlignedComment| 3.2.13 Uncomment line map.........|NERDComUncommentLine| 3.4 Sexy Comments.....................|NERDComSexyComments| 3.5 The NERDComment function..........|NERDComNERDComment| 4.Options.................................|NERDComOptions| 4.1 Options summary...................|NERDComOptionsSummary| 4.2 Options details...................|NERDComOptionsDetails| 4.3 Default delimiter Options.........|NERDComDefaultDelims| 5. Customising key mappings...............|NERDComMappings| 6. Issues with the script.................|NERDComIssues| 6.1 Delimiter detection heuristics....|NERDComHeuristics| 6.2 Nesting issues....................|NERDComNesting| 7.About.. ............................|NERDComAbout| 8.Changelog...............................|NERDComChangelog| 9.Credits.................................|NERDComCredits| 10.License................................|NERDComLicense| ============================================================================== 1. Intro *NERDCommenter* The NERD commenter provides many different commenting operations and styles which are invoked via key mappings and a menu. These operations are available for most filetypes. There are also options that allow to tweak the commenting engine to your taste. ============================================================================== 2. Installation *NERDComInstallation* The NERD Commenter requires Vim 7 or higher. Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You should have 2 files: > plugin/NERD_commenter.vim doc/NERD_commenter.txt < Next, to finish installing the help file run: > :helptags ~/.vim/doc < See |add-local-help| for more details. Make sure that you have filetype plugins enabled, as the script makes use of |'commentstring'| where possible (which is usually set in a filetype plugin). See |filetype-plugin-on| for details, but basically, stick this in your vimrc > filetype plugin on < ============================================================================== 3. Functionality provided *NERDComFunctionality* ------------------------------------------------------------------------------ 3.1 Functionality summary *NERDComFunctionalitySummary* The following key mappings are provided by default (there is also a menu with items corresponding to all the mappings below): [count]cc |NERDComComment| Comment out the current line or text selected in visual mode. [count]cn |NERDComNestedComment| Same as cc but forces nesting. [count]c |NERDComToggleComment| Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa. [count]cm |NERDComMinimalComment| Comments the given lines using only one set of multipart delimiters. [count]ci |NERDComInvertComment| Toggles the comment state of the selected line(s) individually. [count]cs |NERDComSexyComment| Comments out the selected lines ``sexily'' [count]cy |NERDComYankComment| Same as cc except that the commented line(s) are yanked first. c$ |NERDComEOLComment| Comments the current line from the cursor to the end of line. cA |NERDComAppendComment| Adds comment delimiters to the end of line and goes into insert mode between them. |NERDComInsertComment| Adds comment delimiters at the current cursor position and inserts between. Disabled by default. ca |NERDComAltDelim| Switches to the alternative set of delimiters. [count]cl [count]cb |NERDComAlignedComment| Same as |NERDComComment| except that the delimiters are aligned down the left side (cl) or both sides (cb). [count]cu |NERDComUncommentLine| Uncomments the selected line(s). ------------------------------------------------------------------------------ 3.2 Functionality details *NERDComFunctionalityDetails* ------------------------------------------------------------------------------ 3.2.1 Comment map *NERDComComment* Default mapping: [count]cc Mapped to: NERDCommenterComment Applicable modes: normal visual visual-line visual-block. Comments out the current line. If multiple lines are selected in visual-line mode, they are all commented out. If some text is selected in visual or visual-block mode then the script will try to comment out the exact text that is selected using multi-part delimiters if they are available. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ 3.2.2 Nested comment map *NERDComNestedComment* Default mapping: [count]cn Mapped to: NERDCommenterNest Applicable modes: normal visual visual-line visual-block. Performs nested commenting. Works the same as cc except that if a line is already commented then it will be commented again. If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will be replaced by place-holder delimiters if needed. Otherwise the nested comment will only be added if the current commenting delimiters have no right delimiter (to avoid syntax errors) If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. Related options: |'NERDDefaultNesting'| ------------------------------------------------------------------------------ 3.2.3 Toggle comment map *NERDComToggleComment* Default mapping: [count]c Mapped to: NERDCommenterToggle Applicable modes: normal visual-line. Toggles commenting of the lines selected. The behaviour of this mapping depends on whether the first line selected is commented or not. If so, all selected lines are uncommented and vice versa. With this mapping, a line is only considered to be commented if it starts with a left delimiter. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ 3.2.4 Minimal comment map *NERDComMinimalComment* Default mapping: [count]cm Mapped to: NERDCommenterMinimal Applicable modes: normal visual-line. Comments the selected lines using one set of multipart delimiters if possible. For example: if you are programming in c and you select 5 lines and press cm then a '/*' will be placed at the start of the top line and a '*/' will be placed at the end of the last line. Sets of multipart comment delimiters that are between the top and bottom selected lines are replaced with place holders (see |'NERDLPlace'|) if |'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then the comment will be aborted if place holders are required to prevent illegal syntax. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ 3.2.5 Invert comment map *NERDComInvertComment* Default mapping: ci Mapped to: NERDCommenterInvert Applicable modes: normal visual-line. Inverts the commented state of each selected line. If the a selected line is commented then it is uncommented and vice versa. Each line is examined and commented/uncommented individually. With this mapping, a line is only considered to be commented if it starts with a left delimiter. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ 3.2.6 Sexy comment map *NERDComSexyComment* Default mapping: [count]cs Mapped to: NERDCommenterSexy Applicable modes: normal, visual-line. Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for a description of what sexy comments are. Can only be done on filetypes for which there is at least one set of multipart comment delimiters specified. Sexy comments cannot be nested and lines inside a sexy comment cannot be commented again. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. Related options: |'NERDCompactSexyComs'| ------------------------------------------------------------------------------ 3.2.7 Yank comment map *NERDComYankComment* Default mapping: [count]cy Mapped to: NERDCommenterYank Applicable modes: normal visual visual-line visual-block. Same as cc except that it yanks the line(s) that are commented first. ------------------------------------------------------------------------------ 3.2.8 Comment to EOL map *NERDComEOLComment* Default mapping: c$ Mapped to: NERDCommenterToEOL Applicable modes: normal. Comments the current line from the current cursor position up to the end of the line. ------------------------------------------------------------------------------ 3.2.9 Append com to line map *NERDComAppendComment* Default mapping: cA Mapped to: NERDCommenterAppend Applicable modes: normal. Appends comment delimiters to the end of the current line and goes to insert mode between the new delimiters. ------------------------------------------------------------------------------ 3.2.10 Insert comment map *NERDComInsertComment* Default mapping: disabled by default. Map it to: NERDCommenterInInsert Applicable modes: insert. Adds comment delimiters at the current cursor position and inserts between them. NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this mapping add > let NERDComInsertMap='' < to your vimrc. ------------------------------------------------------------------------------ 3.2.11 Use alternate delims map *NERDComAltDelim* Default mapping: ca Mapped to: NERDCommenterAltDelims Applicable modes: normal. Changes to the alternative commenting style if one is available. For example, if the user is editing a c++ file using // comments and they hit ca then they will be switched over to /**/ comments. See also |NERDComDefaultDelims| ------------------------------------------------------------------------------ 3.2.12 Comment aligned maps *NERDComAlignedComment* Default mappings: [count]cl [count]cb Mapped to: NERDCommenterAlignLeft NERDCommenterAlignBoth Applicable modes: normal visual-line. Same as cc except that the comment delimiters are aligned on the left side or both sides respectively. These comments are always nested if the line(s) are already commented. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ 3.2.13 Uncomment line map *NERDComUncommentLine* Default mapping: [count]cu Mapped to: NERDCommenterUncomment Applicable modes: normal visual visual-line visual-block. Uncomments the current line. If multiple lines are selected in visual mode then they are all uncommented. When uncommenting, if the line contains multiple sets of delimiters then the ``outtermost'' pair of delimiters will be removed. The script uses a set of heurisics to distinguish ``real'' delimiters from ``fake'' ones when uncommenting. See |NERDComIssues| for details. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. Related options: |'NERDRemoveAltComs'| |'NERDRemoveExtraSpaces'| ------------------------------------------------------------------------------ 3.3 Sexy Comments *NERDComSexyComments* These are comments that use one set of multipart comment delimiters as well as one other marker symbol. For example: > /* * This is a c style sexy comment * So there! */ /* This is a c style sexy comment * So there! * But this one is ``compact'' style */ < Here the multipart delimiters are /* and */ and the marker is *. ------------------------------------------------------------------------------ 3.4 The NERDComment function *NERDComNERDComment* All of the NERD commenter mappings and menu items invoke a single function which delegates the commenting work to other functions. This function is public and has the prototype: > function! NERDComment(isVisual, type) < The arguments to this function are simple: - isVisual: if you wish to do any kind of visual comment then set this to 1 and the function will use the '< and '> marks to find the comment boundries. If set to 0 then the function will operate on the current line. - type: is used to specify what type of commenting operation is to be performed, and it can be one of the following: "sexy", "invert", "minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested", "toEOL", "append", "insert", "uncomment", "yank" For example, if you typed > :call NERDComment(1, 'sexy') < then the script would do a sexy comment on the last visual selection. ============================================================================== 4. Options *NERDComOptions* ------------------------------------------------------------------------------ 4.1 Options summary *NERDComOptionsSummary* |'loaded_nerd_comments'| Turns off the script. |'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to be used when commenting in visual/visual-block mode. |'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when doing visual-block comments. |'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments. |'NERDCreateDefaultMappings'| Turn the default mappings on/off. |'NERDDefaultNesting'| Tells the script to use nested comments by default. |'NERDMenuMode'| Specifies how the NERD commenter menu will appear (if at all). |'NERDLPlace'| Specifies what to use as the left delimiter placeholder when nesting comments. |'NERDUsePlaceHolders'| Specifies which filetypes may use placeholders when nesting comments. |'NERDRemoveAltComs'| Tells the script whether to remove alternative comment delimiters when uncommenting. |'NERDRemoveExtraSpaces'| Tells the script to always remove the extra spaces when uncommenting (regardless of whether NERDSpaceDelims is set) |'NERDRPlace'| Specifies what to use as the right delimiter placeholder when nesting comments. |'NERDSpaceDelims'| Specifies whether to add extra spaces around delimiters when commenting, and whether to remove them when uncommenting. |'NERDCompactSexyComs'| Specifies whether to use the compact style sexy comments. ------------------------------------------------------------------------------ 4.3 Options details *NERDComOptionsDetails* To enable any of the below options you should put the given line in your ~/.vimrc *'loaded_nerd_comments'* If this script is driving you insane you can turn it off by setting this option > let loaded_nerd_comments=1 < ------------------------------------------------------------------------------ *'NERDAllowAnyVisualDelims'* Values: 0 or 1. Default: 1. If set to 1 then, when doing a visual or visual-block comment (but not a visual-line comment), the script will choose the right delimiters to use for the comment. This means either using the current delimiters if they are multipart or using the alternative delimiters if THEY are multipart. For example if we are editing the following java code: > float foo = 1221; float bar = 324; System.out.println(foo * bar); < If we are using // comments and select the "foo" and "bar" in visual-block mode, as shown left below (where '|'s are used to represent the visual-block boundary), and comment it then the script will use the alternative delims as shown on the right: > float |foo| = 1221; float /*foo*/ = 1221; float |bar| = 324; float /*bar*/ = 324; System.out.println(foo * bar); System.out.println(foo * bar); < ------------------------------------------------------------------------------ *'NERDBlockComIgnoreEmpty'* Values: 0 or 1. Default: 1. This option affects visual-block mode commenting. If this option is turned on, lines that begin outside the right boundary of the selection block will be ignored. For example, if you are commenting this chunk of c code in visual-block mode (where the '|'s are used to represent the visual-block boundary) > #include #include #include |int| main(){ | | printf("SUCK THIS\n"); | | while(1){ | | fork(); | | } |} | < If NERDBlockComIgnoreEmpty=0 then this code will become: > #include #include #include /*int*/ main(){ /* */ printf("SUCK THIS\n"); /* */ while(1){ /* */ fork(); /* */ } /*} */ < Otherwise, the code block would become: > #include #include #include /*int*/ main(){ printf("SUCK THIS\n"); while(1){ fork(); } /*} */ < ------------------------------------------------------------------------------ *'NERDCommentWholeLinesInVMode'* Values: 0, 1 or 2. Default: 0. By default the script tries to comment out exactly what is selected in visual mode (v). For example if you select and comment the following c code (using | to represent the visual boundary): > in|t foo = 3; int bar =| 9; int baz = foo + bar; < This will result in: > in/*t foo = 3;*/ /*int bar =*/ 9; int baz = foo + bar; < But some people prefer it if the whole lines are commented like: > /*int foo = 3;*/ /*int bar = 9;*/ int baz = foo + bar; < If you prefer the second option then stick this line in your vimrc: > let NERDCommentWholeLinesInVMode=1 < If the filetype you are editing only has no multipart delimiters (for example a shell script) and you hadnt set this option then the above would become > in#t foo = 3; #int bar = 9; < (where # is the comment delimiter) as this is the closest the script can come to commenting out exactly what was selected. If you prefer for whole lines to be commented out when there is no multipart delimiters but the EXACT text that was selected to be commented out if there IS multipart delimiters then stick the following line in your vimrc: > let NERDCommentWholeLinesInVMode=2 < Note that this option does not affect the behaviour of commenting in |visual-block| mode. ------------------------------------------------------------------------------ *'NERDCreateDefaultMappings'* Values: 0 or 1. Default: 1. If set to 0, none of the default mappings will be created. See also |NERDComMappings|. ------------------------------------------------------------------------------ *'NERDRemoveAltComs'* Values: 0 or 1. Default: 1. When uncommenting a line (for a filetype with an alternative commenting style) this option tells the script whether to look for, and remove, comment delimiters of the alternative style. For example, if you are editing a c++ file using // style comments and you go cu on this line: > /* This is a c++ comment baby! */ < It will not be uncommented if the NERDRemoveAltComs is set to 0. ------------------------------------------------------------------------------ *'NERDRemoveExtraSpaces'* Values: 0 or 1. Default: 1. By default, the NERD commenter will remove spaces around comment delimiters if either: 1. |'NERDSpaceDelims'| is set to 1. 2. NERDRemoveExtraSpaces is set to 1. This means that if we have the following lines in a c code file: > /* int foo = 5; */ /* int bar = 10; */ int baz = foo + bar < If either of the above conditions hold then if these lines are uncommented they will become: > int foo = 5; int bar = 10; int baz = foo + bar < Otherwise they would become: > int foo = 5; int bar = 10; int baz = foo + bar < If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then set NERDRemoveExtraSpaces to 0. ------------------------------------------------------------------------------ *'NERDLPlace'* *'NERDRPlace'* Values: arbitrary string. Default: NERDLPlace: "[>" NERDRPlace: "<]" These options are used to control the strings used as place-holder delimiters. Place holder delimiters are used when performing nested commenting when the filetype supports commenting styles with both left and right delimiters. To set these options use lines like: > let NERDLPlace="FOO" let NERDRPlace="BAR" < Following the above example, if we have line of c code: > /* int horse */ < and we comment it with cn it will be changed to: > /*FOO int horse BAR*/ < When we uncomment this line it will go back to what it was. ------------------------------------------------------------------------------ *'NERDMenuMode'* Values: 0, 1, 2, 3. Default: 3 This option can take 4 values: "0": Turns the menu off. "1": Turns the 'comment' menu on with no menu shortcut. "2": Turns the 'comment 'menu on with -c as the shortcut. "3": Turns the 'Plugin -> comment' menu on with -c as the shortcut. ------------------------------------------------------------------------------ *'NERDUsePlaceHolders'* Values: 0 or 1. Default 1. This option is used to specify whether place-holder delimiters should be used when creating a nested comment. ------------------------------------------------------------------------------ *'NERDSpaceDelims'* Values: 0 or 1. Default 0. Some people prefer a space after the left delimiter and before the right delimiter like this: > /* int foo=2; */ < as opposed to this: > /*int foo=2;*/ < If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc. See also |'NERDRemoveExtraSpaces'|. ------------------------------------------------------------------------------ *'NERDCompactSexyComs'* Values: 0 or 1. Default 0. Some people may want their sexy comments to be like this: > /* Hi There! * This is a sexy comment * in c */ < As opposed to like this: > /* * Hi There! * This is a sexy comment * in c */ < If this option is set to 1 then the top style will be used. ------------------------------------------------------------------------------ *'NERDDefaultNesting'* Values: 0 or 1. Default 1. When this option is set to 1, comments are nested automatically. That is, if you hit cc on a line that is already commented it will be commented again. ------------------------------------------------------------------------------ 3.3 Default delimiter customisation *NERDComDefaultDelims* If you want the NERD commenter to use the alternative delimiters for a specific filetype by default then put a line of this form into your vimrc: > let NERD__alt_style=1 < Example: java uses // style comments by default, but you want it to default to /* */ style comments instead. You would put this line in your vimrc: > let NERD_java_alt_style=1 < See |NERDComAltDelim| for switching commenting styles at runtime. ============================================================================== 5. Key mapping customisation *NERDComMappings* To change a mapping just map another key combo to the internal mapping. For example, to remap the |NERDComComment| mapping to ",omg" you would put this line in your vimrc: > map ,omg NERDCommenterComment < This will stop the corresponding default mappings from being created. See the help for the mapping in question to see which mapping to map to. See also |'NERDCreateDefaultMappings'|. ============================================================================== 6. Issues with the script *NERDComIssues* ------------------------------------------------------------------------------ 6.1 Delimiter detection heuristics *NERDComHeuristics* Heuristics are used to distinguish the real comment delimiters Because we have comment mappings that place delimiters in the middle of lines, removing comment delimiters is a bit tricky. This is because if comment delimiters appear in a line doesnt mean they really ARE delimiters. For example, Java uses // comments but the line > System.out.println("//"); < clearly contains no real comment delimiters. To distinguish between ``real'' comment delimiters and ``fake'' ones we use a set of heuristics. For example, one such heuristic states that any comment delimiter that has an odd number of non-escaped " characters both preceding and following it on the line is not a comment because it is probably part of a string. These heuristics, while usually pretty accurate, will not work for all cases. ------------------------------------------------------------------------------ 6.2 Nesting issues *NERDComNesting* If we have some line of code like this: > /*int foo */ = /*5 + 9;*/ < This will not be uncommented legally. The NERD commenter will remove the "outter most" delimiters so the line will become: > int foo */ = /*5 + 9; < which almost certainly will not be what you want. Nested sets of comments will uncomment fine though. Eg: > /*int/* foo =*/ 5 + 9;*/ < will become: > int/* foo =*/ 5 + 9; < (Note that in the above examples I have deliberately not used place holders for simplicity) ============================================================================== 7. About *NERDComAbout* The author of the NERD commenter is Martyzillatron --- the half robot, half dinosaur bastard son of Megatron and Godzilla. He enjoys destroying metropolises and eating tourist busses. Drop him a line at martin_grenfell at msn.com. He would love to hear from you. its a lonely life being the worlds premier terror machine. How would you feel if your face looked like a toaster and a t-rex put together? :( The latest stable versions can be found at http://www.vim.org/scripts/script.php?script_id=1218 The latest dev versions are on github http://github.com/scrooloose/nerdcommenter ============================================================================== 8. Changelog *NERDComChangelog* 2.3.0 - remove all filetypes which have a &commentstring in the standard vim runtime for vim > 7.0 unless the script stores an alternate set of delimiters - make the script complain if the user doesnt have filetype plugins enabled - use instead of comma to start the default mappings - fix a couple of bugs with sexy comments - thanks to Tim Smart - lots of refactoring 2.2.2 - remove the NERDShutup option and the message is suppresses, this makes the plugin silently rely on &commentstring for unknown filetypes. - add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and udevrules. Thanks to Thilo Six. - match filetypes case insensitively - add support for mp (metapost), thanks to Andrey Skvortsov. - add support for htmlcheetah, thanks to Simon Hengel. - add support for javacc, thanks to Matt Tolton. - make <%# %> the default delims for eruby, thanks to tpope. - add support for javascript.jquery, thanks to Ivan Devat. - add support for cucumber and pdf. Fix sass and railslog delims, thanks to tpope 2.2.1 - add support for newlisp and clojure, thanks to Matthew Lee Hinman. - fix automake comments, thanks to Elias Pipping - make haml comments default to -# with / as the alternative delimiter, thanks to tpope - add support for actionscript and processing thanks to Edwin Benavides - add support for ps1 (powershell), thanks to Jason Mills - add support for hostsaccess, thanks to Thomas Rowe - add support for CVScommit - add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich. - use # for gitcommit comments, thanks to Simon Ruderich. - add support for mako and genshi, thanks to Keitheis. - add support for conkyrc, thanks to David - add support for SVNannotate, thanks to Miguel Jaque Barbero. - add support for sieve, thanks to Stefan Walk - add support for objj, thanks to Adam Thorsen. 2.2.0 - rewrote the mappings system to be more "standard". - removed all the mapping options. Now, mappings to mappings are used - see :help NERDComMappings, and :help NERDCreateDefaultMappings for more info - remove "prepend comments" and "right aligned comments". - add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo. Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John O'Shea, François and Giacomo Mariani respectively. - bugfix for haskell delimiters. Thanks to mntnoe. 2.1.18 - add support for llvm. Thanks to nicothakis. - add support for xquery. Thanks to Phillip Kovalev. 2.1.17 - fixed haskell delimiters (hackily). Thanks to Elias Pipping. - add support for mailcap. Thanks to Pascal Brueckner. - add support for stata. Thanks to Jerónimo Carballo. - applied a patch from ewfalor to fix an error in the help file with the NERDMapleader doc - disable the insert mode ctrl-c mapping by default, see :help NERDComInsertComment if you wish to restore it ============================================================================== 9. Credits *NERDComCredits* Thanks to the follow people for suggestions and patches: Nick Brettell Matthew Hawkins Mathieu Clabaut Greg Searle Nguyen Litchi Jorge Scandaliaris Shufeng Zheng Martin Stubenschrott Markus Erlmann Brent Rice Richard Willis Igor Prischepoff Harry David Bourgeois Eike Von Seggern Torsten Blix Alexander Bosecke Stefano Zacchiroli Norick Chen Joseph Barker Gary Church Tim Carey-Smith Markus Klinik Anders Seth Mason James Hales Heptite Cheng Fang Yongwei Wu David Miani Jeremy Hinegardner Marco Ingo Karkat Zhang Shuhan tpope Ben Schmidt David Fishburn Erik Falor JaGoTerr Elias Pipping mntnoe Mark S. Thanks to the following people for sending me new filetypes to support: The hackers The filetypes~ Sam R verilog Jonathan Derque context, plaintext and mail Vigil fetchmail Michael Brunner kconfig Antono Vasiljev netdict Melissa Reid omlet Ilia N Ternovich quickfix John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit Anders occam Mark Woodward csv fREW gentoo-package-mask, gentoo-package-keywords, gentoo-package-use, and vo_base Alexey verilog_systemverilog, systemverilog Lizendir fstab Michael Böhler autoit, autohotkey and docbk Aaron Small cmake Ramiro htmldjango and django Stefano Zacchiroli debcontrol, debchangelog, mkd Alex Tarkovsky ebuild and eclass Jorge Rodrigues gams Rainer Müller Objective C Jason Mills Groovy, ps1 Normandie Azucena vera Florian Apolloner ldif David Fishburn lookupfile Niels Aan de Brugh rst Don Hatlestad ahk Christophe Benz Desktop and xsd Eyolf Østrem lilypond, bbx and lytex Ingo Karkat dosbatch Nicolas Weber markdown, objcpp tinoucas gentoo-conf-d Greg Weber D, haml Bruce Sherrod velocity timberke cobol, calibre Aaron Schaefer factor Mr X asterisk, mplayerconf Kuchma Michael plsql Brett Warneke spectre Pipp lhaskell Renald Buter scala Vladimir Lomov asymptote Marco mrxvtrc, aap nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate, SVNdiff, gitAnnotate, gitdiff, dtrace llvm, applescript Chen Xing Wikipedia Jacobo Diaz dakota, patran Li Jin gentoo-env-d, gentoo-init-d, gentoo-make-conf, grub, modconf, sudoers SpookeyPeanut rib Greg Jandl pyrex/cython Christophe Benz services, gitcommit A Pontus vimperator Stromnov slice, bzr Martin Kustermann pamconf Indriði Einarsson mason Chris map Krzysztof A. Adamski group Pascal Brueckner mailcap Jerónimo Carballo stata Phillip Kovalev xquery Bernhard Grotz potwiki sgronblo man François txt2tags Giacomo Mariani SVNinfo Matthew Lee Hinman newlisp, clojure Elias Pipping automake Edwin Benavides actionscript, processing Thomas Rowe hostsaccess Simon Ruderich asciidoc, git, gitcommit, gitrebase Keitheis mako, genshi David conkyrc Miguel Jaque Barbero SVNannotate Stefan Walk sieve Adam Thorsen objj Thilo Six dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf, udevrules Andrey Skvortsov mp Simon Hengel htmlcheetah Matt Tolton javacc Ivan Devat javascript.jquery tpope cucumber,pdf ============================================================================== 10. License *NERDComLicense* The NERD commenter is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. vim-scripts-20130814ubuntu1/doc/EnhancedCommentify.txt0000644000000000000000000004113512204336073017522 0ustar ENHANCED COMMENTIFY *EnhancedCommentify* This is the online help to EnhancedCommentify-script for Vim. It provides a convenient way to comment/decomment lines of code in source files. Currently several languages are supported (eg. Vim, C(++), Ada, Perl, Python and many more), but it is really easy to add other languages. (see 'Adding new languages') ============================================================================== CONTENTS 1. The main function |EnhComm-EnhCommentify| 2. Changing behaviour (options) |EnhComm-Options| 3. Adding new languages |EnhComm-NewLanguages| 4. Changing the keybindings |EnhComm-Keybindings| 5. Adding fallbacks |EnhComm-Fallbacks| 6. Support |EnhComm-Support| 7. Credits |EnhComm-Credits| 8. Known problems |EnhComm-Bugs| ============================================================================== 1. The main function *EnhComm-EnhCommentify* *EnhancedCommentify()* The function which does the main work is called EnhancedCommentify(). It may also be called from outside the script. It takes two to four arguments. EnhancedCommentify(overrideEL, mode [, startBlock, endBlock]) overrideEL -- may be 'yes', 'no' or ''. With UseSyntax option this value is guessed for every invocation of the function. However, if the passed value is not '', the given value will ocerride any checks. mode -- may be 'comment', 'decomment', 'guess' or 'first'. Specifies in what mode the script is run. comment => region gets commented decomment => region gets decommented guess => every line is checked wether it should be commented or decommented. This is the traditional mode. first => blocks is commented or decommented based on the very first line of the block. For single lines, this is identical to 'guess' startBlock -- number of line, where block starts (optional) endBlock -- number of line, where block ends (optional) If startBlock and endBlock are omitted, the function operates on the current line. Examples: > EnhancedCommentify('yes', 'guess') EnhancedCommentify('no', 'decomment', 55, 137) < The first call operates on the current line in the traditional way. Empty lines are also processed. The second call ignores empty lines and decomments all lines from line 55 up to line 137 inclusive. ============================================================================== 2. Changing behaviour (options) *EnhComm-Options* All options are boolean except those marked with a (*). Boolean variables may hold 'yes' or 'no' in any case or abbreviation. So in some sense the variables aren't really of boolean type: they are always strings. So don't forget the quotation marks! Examples: > let g:EnhCommentifyUseAltKeys = 'yes' let g:EnhCommentifyTraditionalMode = 'N' < 'g:EnhCommentifyAltOpen' string (default '|+') (*) Defines the alternative placeholder for the opening string of multipart comments. 'g:EnhCommentifyAltClose' string (default '+|') (*) Same for closing string. Example: > /* This is a problem in C. */ < If the above line would be commented again, it would produce this wrong code: > /*/* This is a problem in C. */*/ < The script recognises this problem and removes the inner comment strings replacing them with the given alternative "escape" strings. In the default configuration you get > /*|+ This is a problem in C. +|*/ < which is fine. When decommenting the line, the alternative strings are replaced with the original comment strings. These two options have no meaning for languages, which have only singlepart comment strings (like Perl or Scheme). 'g:EnhCommentifyIdentString' string (default '') (*) Add this identity string to every comment made by the script. This looks ugly and introduces non-standard comments, but solves several problems (see |EnhComm-Bugs|). Setting this option makes only sense in combination with 'g:EnhCommentifyTraditionalMode'. Examples: The default setting would comment lines like this one > /*foo();*/ < Setting g:EnhCommentifyIdentString to '+' would result in > /*+foo();+*/ < 'g:EnhCommentifyRespectIndent' string (default 'No') Respect the indent of a line. The comment leader is inserted correctly indented, not at the beginning of the line. Examples: g:EnhCommentifyRespectIndent = 'No' > if (bar) { /* foo();*/ } < g:EnhCommentifyRespectIndent = 'Yes' > if (bar) { /*foo();*/ } < 'g:EnhCommentifyIgnoreWS' string (default: 'Yes') Ignore whitespace at the beginning of the line. This decomments indented lines. This option has no effect when setting g:EnhCommentifyRespectIndent to 'Yes'. 'g:EnhCommentifyPretty' string (default: 'No') Add a whitespace between comment strings and code. Mainly for readability. Comments without this space may still be decommented. Examples: g:EnhCommentifyPretty = 'No' > /*foo();*/ < g:EnhCommentifyPretty = 'Yes' > /* foo(); */ < 'g:EnhCommentifyBindPerBuffer' string (default: 'No') Make keybindings local to buffer. 'g:EnhCommentifyBindUnknown' string (default: 'Yes') If the filetype is not known, don't add keybindings. This option has no meaning, when g:EnhCommentifyBindPerBuffer is set to 'No'. 'g:EnhCommentifyBindInNormal' string (default: 'Yes') 'g:EnhCommentifyBindInInsert' 'g:EnhCommentifyBindInVisual' Add keybindings in normal/insert/visual mode. 'g:EnhCommentifyUseAltKeys' string (default: 'No') Use alternative keybindings. instead of X. This may cause trouble on some terminals. Eg. aterm has to be used with 'meta8: true' in the Xresources. This option has no meaning, when g:EnhCommentifyUserBindings is set to 'Yes'. 'g:EnhCommentifyTraditionalMode' string (default: 'Yes') The traditional commentify mode. Check for every line what action should be performed. This option has no meaning, when g:EnhCommentifyUserBindings is set to 'Yes'. 'g:EnhCommentifyFirstLineMode' string (default: 'No') The decision, which action (commenting/decommenting) is performed for a visual block, is based on the first line of this block. This option has no meaning, when one of g:EnhCommentifyUserBindings or g:EnhCommentifyTraditionalMode is set to 'Yes'. 'g:EnhCommentifyUserMode' string (default: 'No') If this option is set to yes, the scripts lets you decide what to do. Then there are several two different keybindings active, one for commenting, one for decommenting. (see |EnhComm-Keybindings|) This option has no effect if any of these options is set to 'yes': - g:EnhCommentifyTraditionalMode - g:EnhCommentifyFirstLineMode - g:EnhCommentifyUserBindings 'g:EnhCommentifyUserBindings' string (default: 'No') This option allows you to choose your own keybindings, without much trouble. Please see below (|EnhComm-Keybindings|) for more details. 'g:EnhCommentifyUseBlockIndent' string (default: 'No') It's a bit difficult to explain, what this option does, so here are some examples (The numbers are just line numbers!): > 1if (foo) { 2 bar(); 3 baz(); 4} else { 5 bar(); 6 baz(); 7} < Commenting lines 1 to 7 in a visual block will give: > /*if (foo) {*/ /* bar();*/ /* baz();*/ /*} else {*/ /* bar();*/ /* baz();*/ /*}*/ < Or commenting lines 3 to 5 will give: > if (foo) { bar(); /* baz();*/ /*} else {*/ /* bar();*/ baz(); } < lines 2 to 3: > if (foo) { /*bar();*/ /*baz();*/ } else { bar(); baz(); } < However you should think about activating g:EnhCommentifyIgnoreWS, if you do not use g:EnhCommentifyRespectIndent or you won't be able to decomment lines, which are commented with this method, if they have leading whitespace! 'g:EnhCommentifyMultiPartBlocks'string (default: 'No') When using a language with multipart-comments commenting a visual block will result in the whole block commented in unit, not line by line. let g:EnhCommentifyMultiPartBlocks = 'yes' > /*if (foo) { frobnicate(baz); }*/ < 'g:EnhCommentifyCommentsOp' string (default: 'No') !!! EXPERIMENTAL !!! When set the comments option is parsed. This is currently only used for the above option in order to set the middle part of the comment. let g:EnhCommentifyCommentsOp = 'yes' > /*if (foo) { * frobnicate(baz); *}*/ < 'g:EnhCommentifyAlignRight' string (default: 'No') When commenting a visual block align the right hand side comment strings. Examples: let g:EnhCommentifyAlignRight = 'no' > /*if (foo) {*/ /* frobnicate(baz);*/ /*}*/ < let g:EnhCommentifyAlignRight = 'yes' > /*if (foo) { */ /* frobnicate(baz);*/ /*} */ < 'g:EnhCommentifyUseSyntax' string (default: 'No') With this option set, the script tries to figure out which filetype to use for every block by using the synID of the block. This improves handling of embedded languages eg. CSS in HTML, Perl in VimL... But be aware, that this feature currently relies on a special form of the names of the syntax items. So it might not work with every syntax file (see |EnhComm-Bugs|). It also calls synID only once for every block! So the first line is significant. Be aware, that "cross" commenting might cause problems. Examples: > 1

a header

2 7link < Commenting line 1 will give: > link < Commenting line 4 will give: >

a header

link < You don't have to change anything. The filetype is still 'html'. However marking the whole paragraph in one visual block and commenting it, will result in the following: > < BTW: Don't expect any sense or correctness of code in these examples. ============================================================================== 3. Adding new languages *EnhComm-NewLanguages* Since 2.3 there is the possibility to use some callback function to handle unrecognised filetypes. This is a substitute to steps a)-d) below. Just add a function called "EnhCommentifyCallback" and set "g:EnhCommentifyCallbackExists" to some value. > function EnhCommentifyCallback(ft) if a:ft == 'foo' let b:ECcommentOpen = 'bar' let b:ECcommentClose = 'baz' endif endfunction let g:EnhCommentifyCallbackExists = 'Yes' < Optionally the steps e) and f) still apply. Of course the old way still works: a) Open the script. b) Go to the GetFileTypeSettings() function. c) Now you should see the large "if"-tree. > if fileType =~ '^\(c\|css\|...' let b:ECcommentOpen = '/*' let b:ECcommentClose = '*/' elseif ... < d) There are two buffer-local variables, which hold the different comment strings. > if fileType =~ '^\(c\|css\|...' let b:ECcommentOpen = '/*' let b:ECcommentClose = '*/' elseif fileType == 'foo' let b:ECcommentOpen = 'bar' let b:ECcommentClose = 'baz' elseif ... < If the new language has only one comment string (like '#' in Perl), we simply leave the CommentClose variable empty (''). That's it! Optionally you can also take step e) and f) in order to complete the setup, but this is not necessary. e) Go to the CommentEmptyLines() function and add the new language to the apropriate "if"-clause. The first will cause empty lines to be processed also. The second make the script ignore empty lines for this filetype. (My rule of thumb: single part comment strings => "yes", multi part comment strings => "no") The default is to ignore empty lines. f) Some syntax-files are "broken". "Broken" in the sense, that the syntax items are not named with xxxFoo or xxxBar, where xxx is the filetype. This scheme seems to be used by ninety percent of all syntax files I saw. This is currently the only way to get the filetype from the synID. If your language may have other languages embedded, you should add the filetype to "if"-clause in CheckPossibleEmbedding(). ============================================================================== 4. Changing the keybindings *EnhComm-Keybindings* The script defines several 's, which can be used to bind the different actions to different keys: - Comment / DeComment - Traditional - FirstLine I don't think, that there's much, what needs to be explained. The 's names are descriptive enough. For every there is also its visual counterpart (eg. VisualComment), which may be used to bind the actions for visual mode. Here an example from the standard bindings: > imap Traditionalji < Clearly this definition binds in insert mode to the traditional Commentify-functionality. Step-by-Step: 1) : leave insert mode 2) Traditional: execute the Commentify-function for this line 3) j: go one line down 4) i: go back to insert mode Another example, which adds a binding for visual mode with the new first- line-mode: > vmap c VisualFirstLine < If you absolutely don't like the standards you can specify your own. Search for '***' in the script. Insert your bindings at this place and add > let g:EnhCommentifyUserBindings = 'yes' < to your .vimrc. That should do the trick. 4.1 Standard keybindings: Meta-Keys: Keys: Traditional-mode: Traditionial x Traditionial + one line down c FirstLine-mode: FirstLine x FirstLine + one line down c User-mode: Comment x Comment + one line down c DeComment X DeComment + one line down C ============================================================================== 5. Fallbacks *EnhComm-Fallbacks* Problems showed up with the php syntax file. In general it worked, but when there was simple text in a line it had an empty synID-name. Then the default kicked in using '&ft', which caused the php comments to be used, instead of the correct HTML comments. So it seemed necessary to provide a possibility to override the standard fallback. The solution looks like the following: 1st step: Create a .vim/ftplugin/foo_enhcomm.vim. 2nd step: Add the fallback-setting function call: call EnhCommentifyFallback4Embedded('synFiletype == "bar"', "baz") 3rd step: Have fun! :) So the general idea is: You specify a test and a fallback filetype. In the test 'synFiletype' can be used to reference the name tag of the current synID. For PHP this looks like: > call EnhCommentifyFallback4Embedded('synFiletype == ""', "html") < ============================================================================== 6. Support *EnhComm-Support* Suggestions, feature requests and bugreports are always welcome! You can contact me with . ============================================================================== 7. Credits *EnhComm-Credits* The following people contributed to EnhancedCommentify resp. reported bugs: (in temporal order) - Vincent Nijs (this script is based on his ToggleCommentify) - Mary Ellen Foster - Scott Stirling - Zak Beck - Xiangjiang Ma - Steve Butts - Preben Randhol - John Orr - Luc Hermite - Brett Calcott - Ben Kibbey - Brian Neu - Steve Hall - Zhang Le - Pieter Naaijkens - Thomas Link - Stefano Zacchiroli Thanks to John Orr and Xiangjiang Ma for their rich feedback and to Luc Hermite for some good improvement suggestions. ============================================================================== 8. Known Problems *EnhComm-Bugs* If g:EnhCommentifyFirstLineMode is used, the following block produces wrong code: > /* This is a comment and not programm code. */ foo = bar; baz(); < With indent string, the script recognises, that the comment is not created by the script and correctly comments the block. Lines like the following will not be correctly decommented. > /*|+ foo +| bar |+ baz +|*/ < The script currently relies on the assumption, that the names of syntax items are of the form '', eg. "phpXy" or "htmlFooBar". This seems to be true except for some rare, esoteric cases. ============================================================================== vim: ft=help:norl:ts=8:tw=78 vim-scripts-20130814ubuntu1/doc/vcscommand.txt0000644000000000000000000007407412204336073016124 0ustar *vcscommand.txt* vcscommand Copyright (c) 2007 Bob Hiestand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For instructions on installing this file, type :help add-local-help inside Vim. Author: Bob Hiestand Credits: Benji Fisher's excellent MatchIt documentation ============================================================================== 1. Contents *vcscommand-contents* Installation : |vcscommand-install| vcscommand Intro : |vcscommand| vcscommand Manual : |vcscommand-manual| Customization : |vcscommand-customize| SSH "integration" : |vcscommand-ssh| Changes from cvscommand : |cvscommand-changes| Bugs : |vcscommand-bugs| ============================================================================== 2. vcscommand Installation *vcscommand-install* The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim, vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim files into a plugin directory in your runtime path (please see |add-global-plugin| and |'runtimepath'|. This help file can be included in the VIM help system by copying it into a 'doc' directory in your runtime path and then executing the |:helptags| command, specifying the full path of the 'doc' directory. Please see |add-local-help| for more details. vcscommand may be customized by setting variables, creating maps, and specifying event handlers. Please see |vcscommand-customize| for more details. ============================================================================== 3. vcscommand Intro *vcscommand* *vcscommand-intro* The vcscommand plugin provides global ex commands for manipulating version-controlled source files, currently those controlled either by CVS or Subversion. In general, each command operates on the current buffer and accomplishes a separate source control function, such as update, commit, log, and others (please see |vcscommand-commands| for a list of all available commands). The results of each operation are displayed in a scratch buffer. Several buffer variables are defined for those scratch buffers (please see |vcscommand-buffer-variables|). The notion of "current file" means either the current buffer, or, in the case of a directory buffer (such as Explorer or netrw buffers), the directory (and all subdirectories) represented by the the buffer. For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as though it was invoked on the original file and splits the screen so that the output appears in a new window. Many of the commands accept revisions as arguments. By default, most operate on the most recent revision on the current branch if no revision is specified. Each vcscommand is mapped to a key sequence starting with the || keystroke. The default mappings may be overridden by supplying different mappings before the plugin is loaded, such as in the vimrc, in the standard fashion for plugin mappings. For examples, please see |vcscommand-mappings-override|. The vcscommand plugin may be configured in several ways. For more details, please see |vcscommand-customize|. ============================================================================== 4. vcscommand Manual *vcscommand-manual* 4.1 vcscommand commands *vcscommand-commands* vcscommand defines the following commands: |:VCSAdd| |:VCSAnnotate| |:VCSBlame| |:VCSCommit| |:VCSDelete| |:VCSDiff| |:VCSGotoOriginal| |:VCSLog| |:VCSRemove| |:VCSRevert| |:VCSReview| |:VCSStatus| |:VCSUpdate| |:VCSVimDiff| The following commands are specific to CVS files: |:CVSEdit| |:CVSEditors| |:CVSUnedit| |:CVSWatch| |:CVSWatchAdd| |:CVSWatchOn| |:CVSWatchOff| |:CVSWatchRemove| |:CVSWatchers| :VCSAdd *:VCSAdd* This command adds the current file to source control. Please note, this does not commit the newly-added file. All parameters to the command are passed to the underlying VCS. :VCSAnnotate[!] *:VCSAnnotate* This command displays the current file with each line annotated with the version in which it was most recently changed. If an argument is given, the argument is used as a revision number to display. If not given an argument, it uses the most recent version of the file (on the current branch, if under CVS control). Additionally, if the current buffer is a VCSAnnotate buffer already, the version number on the current line is used. If '!' is used, the view of the annotated buffer is split so that the annotation is in a separate window from the content, and each is highlighted separately. For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero, will cause the above behavior to change. Instead of annotating the version on the current line, the parent revision is used instead, crossing branches if necessary. The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate', 'SVNAnnotate', 'SVKAnnotate' or 'gitAnnotate' as appropriate, to take advantage of the bundled syntax files. :VCSBlame[!] *:VCSBlame* Alias for |:VCSAnnotate|. :VCSCommit[!] *:VCSCommit* This command commits changes to the current file to source control. If called with arguments, the arguments are the log message. If '!' is used, an empty log message is committed. If called with no arguments, this is a two-step command. The first step opens a buffer to accept a log message. When that buffer is written, it is automatically closed and the file is committed using the information from that log message. The commit can be abandoned if the log message buffer is deleted or wiped before being written. Alternatively, the mapping that is used to invoke :VCSCommit (by default ||cc, please see |vcscommand-mappings|) can be used in the log message buffer in Normal mode to immediately commit. This is useful if the |VCSCommandCommitOnWrite| variable is set to 0 to disable the normal commit-on-write behavior. :VCSDelete *:VCSDelete* Deletes the current file and removes it from source control. All parameters to the command are passed to the underlying VCS. :VCSDiff *:VCSDiff* With no arguments, this displays the differences between the current file and its parent version under source control in a new scratch buffer. With one argument, the diff is performed on the current file against the specified revision. With two arguments, the diff is performed between the specified revisions of the current file. For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff options. If that variable does not exist, a plugin-specific default is used. If you wish to have no options, then set it to the empty string. For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff options. If that variable does not exist, the SVN default is used. Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff application. :VCSGotoOriginal *:VCSGotoOriginal* This command jumps to the source buffer if the current buffer is a VCS scratch buffer. :VCSGotoOriginal! Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach buffers associated with the original file. :VCSInfo *:VCSInfo* This command displays extended information about the current file in a new scratch buffer. :VCSLock *:VCSLock* This command locks the current file in order to prevent other users from concurrently modifying it. The exact semantics of this command depend on the underlying VCS. This does nothing in CVS. All parameters are passed to the underlying VCS. :VCSLog *:VCSLog* Displays the version history of the current file in a new scratch buffer. If there is one parameter supplied, it is taken as as a revision parameters to be passed through to the underlying VCS. Otherwise, all parameters are passed to the underlying VCS. :VCSRemove *:VCSRemove* Alias for |:VCSDelete|. :VCSRevert *:VCSRevert* This command replaces the current file with the most recent version from the repository in order to wipe out any undesired changes. :VCSReview *:VCSReview* Displays a particular version of the current file in a new scratch buffer. If no argument is given, the most recent version of the file on the current branch is retrieved. :VCSStatus *:VCSStatus* Displays versioning information about the current file in a new scratch buffer. All parameters are passed to the underlying VCS. :VCSUnlock *:VCSUnlock* Unlocks the current file in order to allow other users from concurrently modifying it. The exact semantics of this command depend on the underlying VCS. All parameters are passed to the underlying VCS. :VCSUpdate *:VCSUpdate* Updates the current file with any relevant changes from the repository. This intentionally does not automatically reload the current buffer, though vim should prompt the user to do so if the underlying file is altered by this command. :VCSVimDiff *:VCSVimDiff* Uses vimdiff to display differences between versions of the current file. If no revision is specified, the most recent version of the file on the current branch is used. With one argument, that argument is used as the revision as above. With two arguments, the differences between the two revisions is displayed using vimdiff. With either zero or one argument, the original buffer is used to perform the vimdiff. When the scratch buffer is closed, the original buffer will be returned to normal mode. Once vimdiff mode is started using the above methods, additional vimdiff buffers may be added by passing a single version argument to the command. There may be up to 4 vimdiff buffers total. Using the 2-argument form of the command resets the vimdiff to only those 2 versions. Additionally, invoking the command on a different file will close the previous vimdiff buffers. :CVSEdit *:CVSEdit* This command performs "cvs edit" on the current file. Yes, the output buffer in this case is almost completely useless. :CVSEditors *:CVSEditors* This command performs "cvs edit" on the current file. :CVSUnedit *:CVSUnedit* Performs "cvs unedit" on the current file. Again, yes, the output buffer here is basically useless. :CVSWatch *:CVSWatch* This command takes an argument which must be one of [on|off|add|remove]. The command performs "cvs watch" with the given argument on the current file. :CVSWatchAdd *:CVSWatchAdd* This command is an alias for ":CVSWatch add" :CVSWatchOn *:CVSWatchOn* This command is an alias for ":CVSWatch on" :CVSWatchOff *:CVSWatchOff* This command is an alias for ":CVSWatch off" :CVSWatchRemove *:CVSWatchRemove* This command is an alias for ":CVSWatch remove" :CVSWatchers *:CVSWatchers* This command performs "cvs watchers" on the current file. 4.2 Mappings *vcscommand-mappings* By default, a mapping is defined for each command. These mappings execute the default (no-argument) form of each command. ||ca VCSAdd ||cn VCSAnnotate ||cN VCSAnnotate! ||cc VCSCommit ||cD VCSDelete ||cd VCSDiff ||cg VCSGotoOriginal ||cG VCSGotoOriginal! ||ci VCSInfo ||cl VCSLog ||cL VCSLock ||cr VCSReview ||cs VCSStatus ||cu VCSUpdate ||cU VCSUnlock ||cv VCSVimDiff Only for CVS buffers: ||ce CVSEdit ||cE CVSEditors ||ct CVSUnedit ||cwv CVSWatchers ||cwa CVSWatchAdd ||cwn CVSWatchOn ||cwf CVSWatchOff ||cwf CVSWatchRemove *vcscommand-mappings-override* The default mappings can be overridden by user-provided instead by mapping to CommandName. This is especially useful when these mappings collide with other existing mappings (vim will warn of this during plugin initialization, but will not clobber the existing mappings). There are three methods for controlling mapping: First, maps can be overriden for individual commands. For instance, to override the default mapping for :VCSAdd to set it to '\add', add the following to the vimrc: nmap \add VCSAdd Second, the default map prefix ('c') can be overridden by defining the |VCSCommandMapPrefix| variable. Third, the entire set of default maps can be overridden by defining the |VCSCommandMappings| variable. 4.3 Automatic buffer variables *vcscommand-buffer-variables* Several buffer variables are defined in each vcscommand result buffer. These may be useful for additional customization in callbacks defined in the event handlers (please see |vcscommand-events|). The following variables are automatically defined: b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer* This variable is set to the buffer number of the source file. b:VCSCommandCommand *b:VCSCommandCommand* This variable is set to the name of the vcscommand that created the result buffer. b:VCSCommandSourceFile *b:VCSCommandSourceFile* This variable is set to the name of the original file under source control. b:VCSCommandVCSType *b:VCSCommandVCSType* This variable is set to the type of the source control. This variable is also set on the original file itself. ============================================================================== 5. Configuration and customization *vcscommand-customize* *vcscommand-config* The vcscommand plugin can be configured in several ways: by setting configuration variables (see |vcscommand-options|) or by defining vcscommand event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin supports a customized status line (see |vcscommand-statusline| and |vcscommand-buffer-management|). 5.1 vcscommand configuration variables *vcscommand-options* Several variables affect the plugin's behavior. These variables are checked at time of execution, and may be defined at the window, buffer, or global level and are checked in that order of precedence. The following variables are available: |VCSCommandCommitOnWrite| |VCSCommandCVSDiffOpt| |VCSCommandCVSExec| |VCSCommandDeleteOnHide| |VCSCommandDiffSplit| |VCSCommandDisableAll| |VCSCommandDisableMappings| |VCSCommandDisableExtensionMappings| |VCSCommandEdit| |VCSCommandEnableBufferSetup| |VCSCommandMappings| |VCSCommandMapPrefix| |VCSCommandResultBufferNameExtension| |VCSCommandResultBufferNameFunction| |VCSCommandSplit| |VCSCommandSVKExec| |VCSCommandSVNDiffExt| |VCSCommandSVNDiffOpt| |VCSCommandSVNExec| |VCSCommandVCSTypeOverride| VCSCommandCommitOnWrite *VCSCommandCommitOnWrite* This variable, if set to a non-zero value, causes the pending commit to take place immediately as soon as the log message buffer is written. If set to zero, only the VCSCommit mapping will cause the pending commit to occur. If not set, it defaults to 1. VCSCommandCVSExec *VCSCommandCVSExec* This variable controls the executable used for all CVS commands If not set, it defaults to "cvs". VCSCommandDeleteOnHide *VCSCommandDeleteOnHide* This variable, if set to a non-zero value, causes the temporary result buffers to automatically delete themselves when hidden. VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt* This variable, if set, determines the options passed to the diff command of CVS. If not set, it defaults to 'u'. VCSCommandDiffSplit *VCSCommandDiffSplit* This variable overrides the |VCSCommandSplit| variable, but only for buffers created with |:VCSVimDiff|. VCSCommandDisableAll *VCSCommandDisableAll* This variable, if set, prevents the plugin or any extensions from loading at all. This is useful when a single runtime distribution is used on multiple systems with varying versions. VCSCommandDisableMappings *VCSCommandDisableMappings* This variable, if set to a non-zero value, prevents the default command mappings from being set. This supercedes |VCSCommandDisableExtensionMappings|. VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings* This variable, if set to a non-zero value, prevents the default command mappings from being set for commands specific to an individual VCS. VCSCommandEdit *VCSCommandEdit* This variable controls whether the original buffer is replaced ('edit') or split ('split'). If not set, it defaults to 'split'. VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup* This variable, if set to a non-zero value, activates VCS buffer management mode see (|vcscommand-buffer-management|). This mode means that the 'VCSCommandBufferInfo' variable is filled with version information if the file is VCS-controlled. This is useful for displaying version information in the status bar. VCSCommandMappings *VCSCommandMappings* This variable, if set, overrides the default mappings used for shortcuts. It should be a List of 2-element Lists, each containing a shortcut and function name pair. The value of the '|VCSCommandMapPrefix|' variable will be added to each shortcut. VCSCommandMapPrefix *VCSCommandMapPrefix* This variable, if set, overrides the default mapping prefix ('c'). This allows customization of the mapping space used by the vcscommand shortcuts. VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension* This variable, if set to a non-blank value, is appended to the name of the VCS command output buffers. For example, '.vcs'. Using this option may help avoid problems caused by autocommands dependent on file extension. VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction* This variable, if set, specifies a custom function for naming VCS command output buffers. This function is expected to return the new buffer name, and will be passed the following arguments: command - name of the VCS command being executed (such as 'Log' or 'Diff'). originalBuffer - buffer number of the source file. vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN'). statusText - extra text associated with the VCS action (such as version numbers). VCSCommandSplit *VCSCommandSplit* This variable controls the orientation of the various window splits that may occur. If set to 'horizontal', the resulting windows will be on stacked on top of one another. If set to 'vertical', the resulting windows will be side-by-side. If not set, it defaults to 'horizontal' for all but VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt' setting, if set, otherwise 'vertical'. VCSCommandSVKExec *VCSCommandSVKExec* This variable controls the executable used for all SVK commands If not set, it defaults to "svk". VCSCommandSVNDiffExt *VCSCommandSVNDiffExt* This variable, if set, is passed to SVN via the --diff-cmd command to select an external application for performing the diff. VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt* This variable, if set, determines the options passed with the '-x' parameter to the SVN diff command. If not set, no options are passed. VCSCommandSVNExec *VCSCommandSVNExec* This variable controls the executable used for all SVN commands If not set, it defaults to "svn". VCSCommandVCSTypeOverride *VCSCommandVCSTypeOverride* This variable allows the VCS type detection to be overridden on a path-by-path basis. The value of this variable is expected to be a List of Lists. Each item in the high-level List is a List containing two elements. The first element is a regular expression that will be matched against the full file name of a given buffer. If it matches, the second element will be used as the VCS type. 5.2 VCSCommand events *vcscommand-events* For additional customization, vcscommand can trigger user-defined events. Event handlers are provided by defining User event autocommands (see |autocommand|, |User|) in the vcscommand group with patterns matching the event name. For instance, the following could be added to the vimrc to provide a 'q' mapping to quit a vcscommand scratch buffer: augroup VCSCommand au User VCSBufferCreated silent! nmap q :bwipeout augroup END The following hooks are available: VCSBufferCreated This event is fired just after a vcscommand result buffer is created and populated. It is executed within the context of the vcscommand buffer. The vcscommand buffer variables may be useful for handlers of this event (please see |vcscommand-buffer-variables|). VCSBufferSetup This event is fired just after vcscommand buffer setup occurs, if enabled. VCSPluginInit This event is fired when the vcscommand plugin first loads. VCSPluginFinish This event is fired just after the vcscommand plugin loads. VCSVimDiffFinish This event is fired just after the VCSVimDiff command executes to allow customization of, for instance, window placement and focus. Additionally, there is another hook which is used internally to handle loading the multiple scripts in order. This hook should probably not be used by an end user without a good idea of how it works. Among other things, any events associated with this hook are cleared after they are executed (during vcscommand.vim script initialization). VCSLoadExtensions This event is fired just before the VCSPluginFinish. It is used internally to execute any commands from the VCS implementation plugins that needs to be deferred until the primary plugin is initialized. 5.3 vcscommand buffer naming *vcscommand-naming* vcscommand result buffers use the following naming convention: [{VCS type} {VCS command} {Source file name}] If additional buffers are created that would otherwise conflict, a distinguishing number is added: [{VCS type} {VCS command} {Source file name}] (1,2, etc) 5.4 vcscommand status line support *vcscommand-statusline* It is intended that the user will customize the |'statusline'| option to include vcscommand result buffer attributes. A sample function that may be used in the |'statusline'| option is provided by the plugin, VCSCommandGetStatusLine(). In order to use that function in the status line, do something like the following: set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P of which %{VCSCommandGetStatusLine()} is the relevant portion. The sample VCSCommandGetStatusLine() function handles both vcscommand result buffers and VCS-managed files if vcscommand buffer management is enabled (please see |vcscommand-buffer-management|). 5.5 vcscommand buffer management *vcscommand-buffer-management* The vcscommand plugin can operate in buffer management mode, which means that it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into a buffer. This is rather slow because it means that the VCS will be invoked at each entry into a buffer (during the |BufEnter| autocommand). This mode is disabled by default. In order to enable it, set the |VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling this mode simply provides the buffer variable mentioned above. The user must explicitly include information from the variable in the |'statusline'| option if they are to appear in the status line (but see |vcscommand-statusline| for a simple way to do that). The 'VCSCommandBufferInfo' variable is a list which contains, in order, the revision of the current file, the latest revision of the file in the repository, and (for CVS) the name of the branch. If those values cannot be determined, the list is a single element: 'Unknown'. ============================================================================== 6. SSH "integration" *vcscommand-ssh* The following instructions are intended for use in integrating the vcscommand.vim plugin with an SSH-based CVS environment. Familiarity with SSH and CVS are assumed. These instructions assume that the intent is to have a message box pop up in order to allow the user to enter a passphrase. If, instead, the user is comfortable using certificate-based authentication, then only instructions 6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then work transparently. 6.1 Environment settings *vcscommand-ssh-env* 6.1.1 CVSROOT should be set to something like: :ext:user@host:/path_to_repository 6.1.2 CVS_RSH should be set to: ssh Together, those settings tell CVS to use ssh as the transport when performing CVS calls. 6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case, running gnome, it's set to: /usr/libexec/openssh/gnome-ssh-askpass This tells SSH how to get passwords if no input is available. 6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs executable on the remote (server) machine. 6.2 CVS wrapper program *vcscommand-ssh-wrapper* Now you need to convince SSH to use the password-dialog program. This means you need to execute SSH (and therefore CVS) without standard input. The following script is a simple perl wrapper that dissasociates the CVS command from the current terminal. Specific steps to do this may vary from system to system; the following example works for me on linux. #!/usr/bin/perl -w use strict; use POSIX qw(setsid); open STDIN, '/dev/null'; fork and do {wait; exit;}; setsid; exec('cvs', @ARGV); 6.3 Configuring vcscommand.vim *vcscommand-ssh-config* At this point, you should be able to use your wrapper script to invoke CVS with various commands, and get the password dialog. All that's left is to make CVS use your newly-created wrapper script. 6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this is globally, by putting the following in your .vimrc: let VCSCommandCVSExec=/path/to/cvs/wrapper/script 6.4 Where to go from here *vcscommand-ssh-other* The script given above works even when non-SSH CVS connections are used, except possibly when interactively entering the message for CVS commit log (depending on the editor you use... VIM works fine). Since the vcscommand.vim plugin handles that message without a terminal, the wrapper script can be used all the time. This allows mixed-mode operation, where some work is done with SSH-based CVS repositories, and others with pserver or local access. It is possible, though beyond the scope of the plugin, to dynamically set the CVS executable based on the CVSROOT for the file being edited. The user events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable on a file-by-file basis. Alternatively, much the same can be done (less automatically) by the various project-oriented plugins out there. It is highly recommended for ease-of-use that certificates with no passphrase or ssh-agent are employed so that the user is not given the password prompt too often. ============================================================================== 7. Changes from cvscommand *cvscommand-changes* 1. Require Vim 7 in order to leverage several convenient features; also because I wanted to play with Vim 7. 2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS. 3. Renamed options, events to start with 'VCSCommand'. 4. Removed option to jump to the parent version of the current line in an annotated buffer, as opposed to the version on the current line. This made little sense in the branching scheme used by subversion, where jumping to a parent branch required finding a different location in the repository. It didn't work consistently in CVS anyway. 5. Removed option to have nameless scratch buffers. 6. Changed default behavior of scratch buffers to split the window instead of displaying in the current window. This may still be overridden using the 'VCSCommandEdit' option. 7. Split plugin into multiple plugins. 8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for subversion but not for CVS. These were not kept specific to subversion as they seemed more general in nature and more likely to be supported by any future VCS supported by this plugin. 9. Changed name of buffer variables set by commands. 'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer' 'b:cvscmd' became 'b:VCSCommandCommand' 10. Added new automatic variables to command result buffers. 'b:VCSCommandSourceFile' 'b:VCSCommandVCSType' ============================================================================== 8. Known bugs *vcscommand-bugs* Please let me know if you run across any. CVSUnedit may, if a file is changed from the repository, provide prompt text to determine whether the changes should be thrown away. Currently, that text shows up in the CVS result buffer as information; there is no way for the user to actually respond to the prompt and the CVS unedit command does nothing. If this really bothers anyone, please let me know. VCSVimDiff, when using the original (real) source buffer as one of the diff buffers, uses some hacks to try to restore the state of the original buffer when the scratch buffer containing the other version is destroyed. There may still be bugs in here, depending on many configuration details. vim:tw=78:ts=8:ft=help vim-scripts-20130814ubuntu1/doc/taglist.txt0000644000000000000000000021053312204336073015431 0ustar *taglist.txt* Plugin for browsing source code Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) For Vim version 6.0 and above Last change: 2013 Feburary 26 1. Overview |taglist-intro| 2. Taglist on the internet |taglist-internet| 3. Requirements |taglist-requirements| 4. Installation |taglist-install| 5. Usage |taglist-using| 6. Options |taglist-options| 7. Commands |taglist-commands| 8. Global functions |taglist-functions| 9. Extending |taglist-extend| 10. FAQ |taglist-faq| 11. License |taglist-license| 12. 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-internet* 2. Taglist on the internet~ The home page of the taglist plugin is at: > http://vim-taglist.sourceforge.net/ < You can subscribe to the taglist mailing list to post your questions or suggestions for improvement or to send bug reports. Visit the following page for subscribing to the mailing list: > http://groups.yahoo.com/group/taglist < ============================================================================== *taglist-requirements* 3. 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* 4. 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* 5. 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 key to toggle the taglist window. > nnoremap :TlistToggle < 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 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 key or by double clicking the file name using the mouse. In the taglist window, you can use the [[ or key to jump to the beginning of the previous file. You can use the ]] or 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 . 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 < To load a saved taglist session, use the ":TlistSessionLoad" command: > :TlistSessionLoad < 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~ 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. 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 Jump to the beginning of the previous file ]] Jump to the beginning of the next file Jump to the beginning of the next file q Close the taglist window 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-" command to get help on the various taglist topics. You can press the key in the taglist window to display the help information about using the taglist window. If you again press the 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* 6. 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_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' < On Microsoft Windows, if ctags.exe is installed in a directory with space characters in the name (e.g. C:\Program Files\ctags\ctags.exe), then you need to set the Tlist_Ctags_Cmd variable like this: > let Tlist_Ctags_Cmd = '"C:\Program Files\ctags\ctags.exe"' < *'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. If you are using GNU Screen, you may want to set this 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 < 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. ============================================================================== *taglist-commands* 7. 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* 8. 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_Get_Filenames()| Return filenames in the taglist |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_Get_Filenames()* Tlist_Get_Filenames() Returns a list of filenames in the taglist. Each filename is separated by a newline (\n) character. If the taglist is empty an empty string is returned. *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* 9. 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 ;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* 10. 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 < 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* 11. 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* 12. 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: vim-scripts-20130814ubuntu1/doc/utl_usr.txt0000644000000000000000000014531312204336073015462 0ustar *utl_usr.txt* Plugin for executing URLs in plain text files *utl* *utl-plugin* For Vim version 6, Version: utl-2.0, $Revision: 1.14 $ Utl.vim User Manual By Stefan Bittner stb@bf-consulting.de Contents: 1. Intro........................|utl-intro| 2. Getting started..............|utl-getstart| 3. Tutorial.....................|utl-tutorial| 4. Examples of use..............|utl-examples| 5. Tips, details, pittfalls.....|utl-tipsdetails| 7. Changes since Utl/Thlnk-1.2..|utl-changes| 8. Todo list....................|utl-todolist| 9. Credits......................|utl-credits| See |utl_ref.txt| for some reference material. See http://vim.sf.net/script.php?script_id=293 for installation instructions See |utl-changes| for things that have changed in this version. Any comments, bug reports, pachtes, fixes and suggestions are welcome, and sometimes needed for my motivation. See |utl-todolist| if you want to contribute to Utl. Happy linking, Stefan Bittner ============================================================================== 1. Intro *utl-intro* Welcome to utl.vim! What is Utl.vim --------------- * It brings the benefits of URL-based hyperlinking to the realm of plain text, extending the URL syntax for plain text needs, in accordance with the RFC 2396 URI specification. * It's a handy utility for you right away * It's fun :-) surfing text files, executing text ... What is it good for? -------------------- * Enables Vim to be your central desktop application, for instance: - Easily navigate in collections of related text files via hyperlinks - Call web browser and email client on URLs (configurable protocol handlers) - Call MS-Word on .doc files, Acrobat Reader on .pdf, Windows Explorer on directories, IrfanView on .jpg etc. (configurable media type handlers) - Maintain pictures from your digicam based on a text file - Maintain a personal info file containing hotlinks * Use it for project management, software development, report preparation and technical writings. For instance: - Reference emails from text files - Reference bug tracker database from a text file * Smart usages. For instance: - Embed vim commands in text files and source code. - Use it as light weight spell checker, - or for dictionary lookups. - Start programs using Utl. - Use it for relative editing and - for navigating HTML source code. * Use it for quality commenting of source code. For instance: - Reference related code with hot links, e.g. reference the definition of a struct in C/C++ - Reference design papers, UML diagrams, man pages etc from source code - Turn references like "see below" and "type zR to open the folds" into hotlinks Utl.vim is easy ----------------- * You only need to know one single command to get started: \gu = Go URL 1. Type :help utl-getstart 2. Hit \gu on the live examples given there As a reader of texts containing URLs that's all! As an author you have to know how to write URLs. But utl.vim gives you a training. And what you will learn is 90% general knowlegde about URLs that you can use elsewhere. * Utl.vim is friendly: No side effects, fits seamlessly into your Vim Session, well documented. Want to give Utl a try? Fine, so lets just dive into the live examples: ============================================================================== 2. Getting started *utl-start* Utl.vim's basic mapping is \gu which stands for "Go Url". That's all you need! Note: If you have changed the mapleader string your actual mapping might also be ,gu or _gu or whatever, see |mapleader|. Live Examples now!!! Position the cursor on the next line: Then hit `\gu'. This should take you ... id=here. You just executed your first link! `#r=abc' refers to a position in the document, that looks like `id=abc'. (If you know HTML: that's analogues to a which refers to ID="abc".) The `r' in the expression stands for `reference'. Hitting `\gu' on takes you to ... some text. The special syntax `tn=' just means that the target of the link is defined by searching the denoted string (some text) in forward direction (tn stands for Text Next). You can leave away the `tn=' prefix and just write because the tn= is the default prefix. Hitting `\gu' on takes you to the file utl_ref.txt. Please come back here again after having executed the link! Hitting `\gu' on takes you to a specific position in the file utl_ref.txt. This example can be seen as the combination of the two previous examples: URL + #xxx The #xxx suffix is called a fragment expression in URL lingo. Hitting `\gu' on will invoke your web browser with that URL. Just try it, Utl will assist you to set up your favorite browser. You can leave away the embedding. Try for example: http://www.vim.org or even +------- This is also a link which you should execute :-) | www.vim.org [#r=foot1] An advantage of embeddingless links is that normally you will find URLs in given documents in this form. Also, some people find the embedding too clunky. The disadvantage is that there is no safe parsing for "naked" URLs and as one consequence of this, no syntax highlighting. You can also type an URL in the command line: :Gu utl_ref.txt # Edit file in same directory as current file :Gu www.google.com # Start web browser from within vim. Sometimes # faster than from desktop :-) If you feel it's now time for a "hello world" test, just go ahead and write your own links. There is no meta data and no tags file needed. Its nothing but plain text. Before you seriously start using utl.vim it is recommended to continue with reading the next chapter, 3, Tutorial. If you are in doubt if Utl valuable for you, have a look at chapter 5, Examples of use, |utl-examples| first. ============================================================================== 3. Tutorial *utl-tutorial* 3.1 Forth and back *utl-tutforthback* From the previous chapter you already know how to follow links by hitting \gu when a link is under the cursor. The following link, as you know, takes you to another file: Try this now! ... No, Wait! To come back here again, just use the regular vim command CTRL-O. That's the BACK-Button in the "Vim browser" - and it might need to be typed more than once. Now do it! Hope you are back again. 3.2 Relative and absolute URLs *utl-tutrelabs* The following URLs are all equivalent: These are all _relative_ URLs. This means that the path given in the URL is relative to the path of the document containing the URL. Note that this is different to Vim's :e command where file names are relative to the current working directory (see |:pwd|). Whenever possible you should use relative URLs. But sometimes you need _absolute_ URLs, just as you sometimes need absolute path names with Vim's :e command. Here is an absolute URL[#r=foot3]: An absolute URL _always_ has a so called scheme (also called protocol) in front, e.g. file: , http:, mailto: . (And, if there is a protocol in front it always is an absolute URL.) What also makes sense is to write the above URL without the protocol: # equivalent to above This is a relative URL (because there is no protocol) ... containing an absolute path. The contrary does not make sense: An absolute URL with a relative path: # WRONG!!! Absolute URL with relative path # makes an invalid URL. Under Windows you can specify drive letters like this: or, which is the same, This is in conformance with URL specifications. Note that you always should use forward slashes, no matter on what OS you are; URLs are universal and are independent of the OS. 3.3 Fragments *utl-tutfrags* Now lets add fragments to the URL. The next link again references the same file as in the above examples, but is extended by a fragment expression. That way a specific position in the target file can be jumped to. Try to execute the link: and come back again with CTRL-O. The next link specifies the same file, but the fragment expression is different: Execute it and come back again! It took you to about the same position as the previous link, but by other means. The fragment `#r=foot1' means, that the file utl_ref.txt is searched for the ID reference `foot1'. What follows r= should be a simple string (an identifier to be exact). The #tn fragment has one big advantage over #r= fragments. It allows to refer to specific positions in the target document without the need to modify that target document, either because you don't want it or because you don't have write access. The advantage of the ID reference fragment is that the link is more robust. #tn= and #r= are the most important fragment specifiers in utl.vim. As already said, the #tn= prefix is the default prefix, i.e. you can leave it away. Thus the link above ( #tp=thanks ) will normally be written shorter: This is also called a naked fragment identifier because there is no `key=' prefix. Here is an overview of the available fragment expressions: #tn=text Same as #text #tp=text Stand for `t'ext `p'revious, i.e. define position by searching first occurance of `text' in backward direction. #line=123 Position defined by line number. Most useful for documents which won't change #r=identifier Position defined by the id `identifier' See |utl-fragexpr| for some explanation. 3.4 Other media types *utl-tutmtypes* URLs are not restricted to .txt files or web pages. You can, for instance, reference a MS-Word document: To make this work you have to define a handler for .doc type files. Utl tries to make this a painless as possible through a smart setup facility. Go and execute the above link to see how this works. In URL and Utl terms a .doc type file is said to be of media type "application/msword". You can define a handler for any media type you like. See the explanations under . Here is a list of other typical media types for which you might want to set up handlers: # PDF documents # Rich text format documents (emails) # Powerpoint documents # Excel sheets # All kinds of images # Call Vim explorer, Windows explorer, shell etc. on # directory 3.5 Typing an URL *utl-tuttypeurl* In a web browser there are two ways to go to a page: 1. You follow a hyperlink from the page you are in. 2. You type an URL yourself. Possibility 1 corresponds to \gu in utl.vim. Possibility 2 corresponds to an utl.vim command :Gu :Gu utl_ref.txt You can use the :Gu command for editing another file which is in the same directory as the current file. Example: gvim /really/an/annoying/long/path/to/src/main.c :Gu option.c I myself use :Gu for a lot for this purpose. 3.6 Other commands to execute a link *utl-tutothercmds* ----- Normal mode commands Until now we have used \gu to execute a link. That's the most important one. Utl.vim defines several other command. \gu corresponds to Vim's :edit. The other commands correspond to :view :sview etc. For example, the command \gE opens the URL under the cursor in a separate Vim window. Position the cursor on the following line and hit \gE to try this: See |utl-commands| for the list of mappings and commands. ----- Visual-commands There are also visual commands |utl-gourlvis|. But you will rarely need this. An example might be: `(see www.vim.org)', i.e. an URL without embedding which is surrounded by characters which confuse Utl's URL parsing (the ')' in this case. Highlight the URL (see |visual-use| if you don't know how) and execute \gu then. 3.6 Supported schemes *utl-tutsuppscms* Currently utl.vim supports the following protocols: file: # Protocol for accessing local files. # If machine is given works like `ftp:' ftp: # Delegates to http, assuming that the browser handles this. http: # Delegates call to your web browser https: # Delegates call to your web browser mailto: # Delegates call to your mail client man: # Unix Man Pages scheme (see |utl-usesourcecode| for usage) scp: # If you have a scp command vimscript: # Vim specific. A scheme for executing vim commands. See # |utl-exvs| for usage. vimhelp: # Vim specific. About the same as vimscript:help. See # |utl-exvimhelp| for usage. config: # Protocol for accessing Utl's setup file You can easily implement your own schemes or define new ones. You just define a Vim function somewhere. Utl.vim dynamically calls those functions. Have a look at . I recommend that you read chapter 5, Tips, details, pitfalls, before you write your own scheme handler. 3.7 Miscellaneous *utl-tutmisc* ----- Creating files using Utl If you execute an URL which points to a non existing file, this file (more exact: its Vim buffer) will be created. This is very useful when authoring: You write the URL in your document and then execute it. You can try this with the URL . People told me that this feature is useful for WIKI editing. ----- Multiline URLs You can spread URLs across several lines like this: . This is sometimes useful for long URL, see examples below at #r=lu. When typing an URL and Vim breaks it (beacuse it contains a space and Vim's 'tw' option set) you have to be careful: Utl eliminates all spaces around the line break. The above link is thus equivalent to . In order to preserve the space, you could escape it with %20 (see |utl-uri-forbchars| about escaping), e.g. . But you could also just split at another position: ----- Tilde support You can use the ~ (tilde) character in URLs. Example: . The ~ is replaced by the contents of the $HOME environment variable. On Unix system ~user also works. See |$HOME|. ============================================================================== 4. Examples of use *utl-examples* Here comes a rich collection of Utl examples, usage patterns and smart little examples. If you go another example it would be nice you mail it to me. 4.1 Use Vim as your central desktop application *utl-usedesktop* 4.1.1 Index File *utl-useindex* One usage is to maintain one or more text files which serve as an index or as a central point of references. Basically like this: ---index.txt-----------------------{ ---} Many people like to load such a file as buffer #1 when starting up Vim and then browse from there. Well, I do not use Utl for this, I rather work with a self written tags file for this purpose or with a session file (see vimhelp:mks) where a file always pertains to the same buffer number. 4.1.2 Project Management Here is a real example. The following is the root file for a software project where the task is technical subproject management. The # comments are only for explanation and not in the original file. It looks something like this: --- poland_project.txt ------------{ file: poland_project.txt - Poland Install project hist: 13.07.04/Stb References ---------- # Link to architecture working document # Link to installation instructions # Link to my change requests notes # Link to SCM related stuff # Link to test reports # ... direct link to current test there # Link to root in document management system (id=lu) Iinstall: # Link to a specific document there # Hot link to the current installation CD . . Correspondance # Threads of project specific correspondance -------------- . . # id=emailex # Reference to a RTF email # Reference to a .txt email # Reference to a HTML email . . -----------------------------------} The referenced files also contain links. I guess I do not have even one selfwritten file which does not contain URLs. 4.1.3 Personal Info File *utl-useinfofile* Quite many people maintain something like a personal info file (I also do). They note there for example: - Installation of tools they use on the job - Usage of tools they use, for instance CVS usage and commands - Links to network drives, resources and documentation - Web links (instead or additional to bookmarks/favorites in web browser) This file is much more useful if enriched with URLs! 4.1.5 Other usages ----- Address book *utl-useaddressbook* I maintain all my contacts in a Vim written XML file. A Perl program parses this file and generates a Vim tags file. This tag file serves as the database for quick lookup of phone numbers, emails and addresses (contact me if you would like to try this). I use URLs in this file: - to add references to contacts. Like order information, and emails - to execute email addresses (which normally are part of the contact information) - to execute web pages related to the contact - link between addresses - link to encrypted login and passwords - ... ----- Link Source Code Files *utl-usesourcecode* This is an Utl usage of big potential in my opinion. But as Utl is currently only implemented for the Vim Editor (not for Emacs etc) this usage might be of real benefit only for people who have an own interest in quality source code. You can use Utl to: - link between the source code files using fragment addressing. For instance point to a C/C++ header file where a structure/class is defined. - link from a source code file to Man pages using the man: scheme (Unix only). See #r=foot5 for an example - link from a source code file to design documents, illustration pictures etc The Utl source code uses URLs itself, see for instance: ). ----- Further usages - Is useful for technical writers. Compile changes and references for a (MS-Word) document in a text file containing URLs - Make a photo index file. Reference you photos from within text files which contain links to your pictures plus annotation text for the photos. - Bug Tracker database. Maintain a text file which has bug tracker IDs (or change requests more generally) as entries: CR001 Error 8 from replace_client_c.bat date: 27.02.2005 status: implemented text describing the problem... text analyzing the problem... ...including links to requirements documents, links to to emails concerning the problem, e.g. , cross references to other CR's CR002 ... I maintain such a file for Utl development for instance. The Change Request IDs I choose freely. On my job I also use such files, but the IDs are given by the Bug Tracker database which we use there. Normally everything should go into the bug tracker itself (says the upper management) but reality is different. The Bug Tracker IDs have the form `BT12345' and I can execute them as an UTL hotlink (see ). Very convenient. 4.2 Smart examples *utl-smartexamples* ----- Spell Checker *utl-spellchecker* You can use Utl's web browser integration for spell checking of words. With the following in your .vimrc file: nmap ,l :exe "Gu http://dict.leo.org/?search=" . expand("") you can lookup the word under the cursor in a web dictionary with the command ,l . I use this quite often and this is my lightweight spell checking tool (especially when I have to write english text). ----- Dictionary Lookup *utl-dictlookup* The above mapping above is also useful as dictionary lookup translation english into german or vice versa. You can also make a similar mapping: " Lookup of expression given on command line. " Of benefit because often faster than click click on desktop " Use %20 or \ or + to escape blanks, example: " for%20that%matter " for\ that\ matter " for+that+matter nmap ,m :Gu http://dict.leo.org/?search= In this form you type the word to lookup in the command line. ----- Gu with dot dir *utl-gudotdir* The following command is short but very useful: :Gu . invokes the file browser for the directory where the current file resides. The file browser will typically be either Vim's file browser or Windows Explorer (or Konqueror on Linux), depending on how you configured the directory handler, see Config:#r=mt_dir. Both handlers are of benefit, depending on what you want to do. If the Vim file explorer is configured, the following is especially useful: :Gu . c i.e. you execute the command 'c' in the Vim file explorer to change the current working directory ( see vimhelp:current-directory ) accordingly. This enables you to use file name completion to edit files which are in the same directory as the previously edited file. ----- Invoke Utl's media type handlers in file browser *utl-fbcallmt* If you are in Vim's file browser you can use \gu to invoke the files and directories presented there with the Utl-defined media type handlers! For example open a MS Word document with MS Word, open a picture with irfanview, open a directory with Windows Explorer (if directory handler configured to Windows Explorer) etc. That's very convenient. Seems like magic first, but isn't, is completely straight forward and no special treatment by the utl.vim plugin (utl.vim is just lucky on one point: concerning directories, that they are presented with forward slashes even under Windows). It might be worth to note that you do not execute self written URLs here. ----- Starting a program *utl-startprog* The following starts a vncviewer client for me: The question mark at the end denotes that the path in front of it should be interpreted as a program to be executed. This is straight forward URL techniques, Utl applies the general URL query concept to programs which are directly accessible by your file system. See |utl-filequery| for some specs. You can also supply the server IP address to connect to: Or you only link to the directory in order to start the program from there[#r=foot2]. Starting programs is especially useful in case of long, strange paths to the program which you either forget or which is simply to ennoying to type. This can be an alternative to one liner programs. A good place to keep such links might be your info file, see |utl-useinfofile|. Here is another example using a slightly different form of query: This link is contained in my address book. It looks up the PIN number of my cellphone which is GPG encrypted. My-decrypt is a small Perl program which asks for the password and then writes the PIN to standard output. The %3e at the end is the '>' character in escaped form (see |utl-uri-forbchars|). The '>' as the last character means the following to Utl: Execute the given program synchronously and write the output into a temporary file. The temporary file is then displayed in Vim. In the above vncviewer example the program is started asynchronously and no output is awaited. ----- The vimscript scheme *utl-exvs* The vimscript scheme is a nice example for a non standard protocol. Utl.vim introduces it in the hope it will be helpful and also as a demonstration for the URL concept. This URL definition is in full compliance to the URL/URI specification! Try the folowing examples: 1. 2. 3. Here is an example which is derived from the minibufexpl.vim ( see http://www.vim.org/scripts/script.php?script_id=159 ). This file contains folds and the following hint: Hint: Type zR if you don't know how to use folds Using UTL this could be turned into a hotlink: Hint: Execute if you don't know how to use folds Execute the above URL to see how this works...and to see another example :-) Yet another vimscript example {{{ This example is derived from the vimspell.vim, see . This file contains the following: " Section: Documentation "---------------------------- " " Documentation should be available by ":help vimspell" command, once the " script has been copied in your .vim/plugin directory. " " You still can read the documentation at the end of this file. Locate it by " searching the "vimspell-contents" string (and set ft=help to have " appropriate syntaxic coloration). Using UTL this can be turned into a hotlinked version: " Section: Documentation "---------------------------- " " Documentation should be available by command, once the " script has been copied in your .vim/plugin directory. " " You still can read the documentation at the end of this file, see " (and execute to have " appropriate syntaxic coloration). }}} Execute to close the fold again Regarding the above examples you might agree with me that the possibility to embed vim commands and hotlinks in a document is nice and smart. Obviously there is one issue: As long as plain text URLs are not standard, the standard user who reads the above given samples in minibufexpl.vim or vimspell.vim would not be able to actually execute the URLs. But the plugin authors could utilize the URL version anyway since their meaning is obvious to the user. The user can execute still manually. Potentially vimscript URLs could also be of benefit for a community, for instance in the vim@vim.org mailing list where often vim commands are exchanged. Can be used at hot links for those people who can directly switch to vim while reading mail. A historical note: The vimscript URL was inspired by the javascript scheme, which is supported by Mozilla/Firefox and MS Internet Explorer for example (try for a javascript example). Consider the current vimscript protocol support ( which is actually one line of code, see ../plugin/utl_scm.vim#r=vimscript ) as a demo. Much more sophisticated things could be achieved. ----- The vimhelp scheme *utl-exvimhelp* Linking to the Vim Help is especially useful. So Utl provides a a shorter form for that. Instead you can write: using the special non standard protocol vimhelp. Obviously this is the same as the Vim-help reference notation |design-documented|. But with the advantage that the URL version also works if the file containing the link is not part of the Vim help! Another advantage is that you can use fragments in conjunction with vimhelp: . That's 4 lines downwards from the position which the URL without the fragment yields. (Not 4 lines downwards from the top of the file which contains that help item.) This is useful for instance for documenting Vim scripts! See for an example. It could also be useful in the Vim mailing list when Utl.vim or plain text URLs become common enough. ----- Mailto URLs Utl supports the mailto: protocol. Try for example to execute the following Links with \gu : # with embedding mailto:stb@bf-consulting.de # without embedding stb@bf-consulting.de # without embedding and mailto: Especially the latter form is useful for directly using email addresses. I keep my email addresses in my text based address book and often start writing emails from there. I do not maintain the address book of my mail client program. If your mail client supports extended mailto syntax according to RFC2368 you can also execute URLs like You might want use something like: to directly mail to a group of people. ----- Using a hot key Most people prefer to have a hot key to execute \gu. For instance you could use the function key F4 to execute an URL with the mapping: :nmap gu Or do you prefer the "real link" feeling and execute a hyperlink with double click left mouse button? :nmap <2-LeftMouse> gu id=vsex Execute to try this mapping. Execute to unmap it again. 4.3 Referencing Emails Referencing emails from within a text file can be very useful (see for example #r=emailex above). There is not yet a proper Utl solution, but some people (including me) find already useful what is currently possible. ----- The desired solution? The desired solution, in my opinion, would be to have a specific scheme for referencing emails which reside in one of your mail folders, something like this: for instance: # Display the thread related to subject abc # Specify a mail by date+time # Specify a mail by its message ID The latter would probably be the most important case: to identify an email by its unique message ID (RFC 822 header field "Message-ID:"). Unfortunately not every mail system supports the message ID, most notably Outlook consortes. For Outlook, even worse, until now I did not find any possibility to savely identify an email in a way which can be used for automated lookup. I tried for example to write a Windows Scripting Host (WSH) script, but it seems you cannot even identify an email by date/time received because you can only define filters for time ranges. Who can help here??? Perhaps can be solved using VBS. ----- Experimental solution for mbox formatted mail boxes: For the mbox style mail box format with the Message-ID: header field present in the emails I work with the following experimental to handle my private emails. It uses a query URL like this: It searches some mail folders for the email with the given Message-Id, extracts it, and displays it in a Vim window. The program `search' is little self written perl script (the Vim plugin performs a similar task.) Using existing programming interfaces to access mail boxes would probably be a smarter approach. ----- Referring to copies Here comes what I am doing over and over with my Outlook emails on the job. I save important emails with "Save as" in a project specific "correspondance" folder. Mostly in .rtf or .txt format. For the file name I prefix the date of the email, for instance '20041204 RE MDAC 2.6 installation problem.txt'. The link containing this reference looks something like: The link appears for example in the bug tracker data base. Or in a text file which contains items for the next revision of a technical documentation. Compilation of requirements of a software engineering project is another example. Depite the annoying step of saving the email to a file (could probably be automated if I was a WSH or VBS programmer) this procedure proved to be very powerful during the last years. > ============================================================================== 5. Tips, details, pitfalls *utl-tipsdetails* 5.1 Associated Base URL and Cache Mapping *utl-tdassbcachem* ----- Associated Base URL *utl-tdassb* Execute the link: and when you ARE in the other file, utl_ref.txt, then type the utl.vim command: \gs that shows you the associated base URL in Vim's message line. It looks something like: URL=file:///path/to/.vim/doc/utl_ref.txt This is the base URL, denoting the context for resolving relative URLs. If \gs shows you a message which starts with `no associated URL', this means that the buffer was not invoked by utl.vim, e.g. was invoked by a user command like :e xyz. You normally do not need the \gs command. But it is sometimes useful to figure out what's going on. ----- The `file:' protocol is the default *utl-tdfileisdef* When \gs shows `URL= ' (empty value) you nevertheless can execute relative URLs. Given a relative URL, say utl_ref.txt, utl.vim just assumes the `file:' protocol, i.e. file:///path/to/currentBuffer. This behaviour normally gets the thing started: you are in a normal Vim session and encounter a link somewhere. Just type \gu to follow the link. This behaviour to "urlify" the current resource is usual for systems that support both, URL oriented and file system oriented resources. For example Linux/KDE's web and file browser konqueror. For the konqueror the http: protocol is the default. ----- Cache Mapping *utl-tdcachemap* Type now the utl.vim command: \gc Utl.vim shows you it's internal cache-mapping: The mapping between local files and their URL. That grows up more and more when you continue to follow links to different URLs. At the moment \gc, like the \gs command, is mainly useful to see whats going on when learning utl.vim. The cache map is always looked up first when utl.vim needs a base URL. URLs that are passed directly to the web browser or to the mail client are an exception. They are passed to these applications before lookup and will not be visible in the cache map. When working with local files, the URL may seem quite academic. But with remote resources this changes[#r=foot4]. 5.2 Writing correct URLs *utl-tdwriteurls* As already mentioned, understanding URLs is essential for using utl.vim as an _author_. Using utl.vim for the _reader_ who only executes URLs requires not much understanding; you just hit \gu when you encounter a link. That's a difference between authoring/editing/writing on one side and reading/browsing/viewing on the other side. Have you already read the URI primer |utl-uriprim|? Strongly recommended! OK, enough moralizing. Here are some rules and hints: - Always use forward slashes! *utl-usefwslashes* Even on MS Windows do not write: # bad!!! Instead write: # good! Note that the windows drive appears where you normally expect a machine name. That is according to URI specifications. Try it out from within your web browser if you do not believe it! *utl-userels* - Use relative URLs instead of absolute URLs whenever possible. For example, use: or # same as previous line instead of: Other example with file which is in a directory with is parallel to the directory where the current file is in: Normally there is no need for an explicit `file:' protocol! - How relative URLs are combined *utl-howrelscombine* Say you have a file foo.txt which lives in the directory /full/path/to . Thus the full pathname of foo.txt is: /full/path/to/foo.txt Further assume foo.txt contains an URL: [foo.txt] . . . . EOF When this URL is executed by utl.vim, the following happens: - The URL "sub_dir/bar.txt" is recognized as a relative URL (because it does not contain a protocol). - Every relative URL has to be transformed into an absolute URL. This is achieved by combining it with the base URL. The base URL is the URL of the containing document minus its file name. In our case: "file:///full/path/to/" (When foo.txt itself was retrieved through, say, the scp: protocol, then the base URL might read something like "scp://host.de/.../". Utl.vim's \gs command shows you the absolute URL of the current document. absolute URL of file containing the URL: file:///full/path/to/foo.txt - file component: foo.txt -------------------------------------------------------------------- = base URL: file:///full/path/to/ + relative URL: sub_dir/bar.txt -------------------------------------------------------------------- = absolute URL: file:///full/path/to/sub_dir/bar.txt It's always an absolute URL which is executed by utl.vim. Relative URLs are never executed directly! They are transformed into absolute URLs in order to get executed. 5.3 Common Pitfalls *utl-commonpitfalls* ----- Absolute URLs do not combine!!!!!! *utl-absdontcombine* The following makes no sense: # VERY BAD Here is the easy rule to keep in mind: When the protocol -- `file:' in our case -- is present, then it's an absolute URL! If it is absent, then it is a relative URL. Be aware of this rule... although bad URLs as the above one might seduce you :-) An absolute URL is taken as it is! The ../ in the example suggests a relative path. But since the URL is absolute, the path will _not_ be combined with the path of the document containing that URL. Executing this link is about the same as when you type the Vim command: :edit ../do/not/do/this That means: the result depends on the current directory, not on the directory of the file containing the URL. Not what you want! The moral of the story is: 1. When you use a protocol like file: or http: in your URL, then you have to give the complete path in the URL! 2. Use relative URLs whenever possible! ----- Protocol and file type are different things *utl-protvsftype* This is something which is important to understand, especially if you are going to extend Utl by your owne protocol and media type handlers. Linking to a HTML file does not mean that you necessarily need the http: protocol then! Protocol and file type (= media type) of the link target are completely independent. You can have http: to retrieve a txt file: Or you can have file: to retrieve a (normally, but not necessarily local) HTML file: This second example is more important for normal utl.vim usage: for example, when using utl.vim for editing your website. Utl.vim can directly execute links in HTML files and it normally does that by implicitly using the `file:' protocol. See also |utl-footnote-htmledit| and |utl-tutmeddep|. *utl-tdmeddep* 5.4 Embedding and fragment interpretation depend on the media-type As you already know, Utl introduces the embedding `' for plain text files. For HTML files (.html or .htm), it makes sense to support HTML's embedding, i.e. something like `'. This means that when you are editing a HTML file and execute \gu to follow a link, utl.vim expects the pattern `' under the cursor. The URL embedding syntax relates to the media type of the source of the link. The fragment expression syntax relates to the media type of the target of the link. The semantics of the fragment expression depends on the media-type. When the target is a HTML file, with an IdRef expression like `#myFrag' then Utl finds the position `' (it will not parse the HTML file though, merely search it; but in practice it functions as expected). When the target is any other file type (utl.vim only distinguishes HTML from all others) then Utl finds the position of `id=myFrag' (case never matters). So you can really use Utl as a HTML-Source-Browser! That's useful especially for editing and browsing your "under construction" web site. The other fragment expressions like line=, tn= do not depend on the file type (= media-type) in utl.vim. ============================================================================== 6. Setup and Customization *utl-customization* Setup of web browser, mail client, media type handlers etc is triggered dynamically by Utl.vim when first requested. All settings are in the file . Refer to the explanations in the header of this file. The design goal was to make getting started with Utl easy. Besides these setup items there is one pure customization item. You can switch off Utl's syntax highlighting of URL with the following setting in your vimrc file: let g:utl_config_highl = 'off' " values: 'on', 'off'. Variable undefined is the same as 'on' ============================================================================== 7. Changes from Utl-1.2 (Thlnk-1.2) *utl-changes* ----- Incompatible Changes *utl-chgincompat* - #tn= fragment is now default, i.e. #tn=foo is same as #foo Previously the ID-reference fragment #r=foo was the default. If you have used the naked fragment with the previous version you might want to convert your links. Use the search pattern /]*> to find the links which need to be converted (the pattern works within Vim as well as with the grep program) and change # --into--> #r= . If I receive more than five complains I will supply a converting utility :-) The reason for this change was that #tn= semantics is used more often by most users. ----- Changed *utl-chgchanged* - Create documents on non existent local URLs (Wiki support). No longer complain. Perhaps this should be customizable. For a set of read-only documents complaining mighgt be better. - On http URLs no longer use the wget utility for retrieving files on the web. Instead delegate to your web browser. ----- Added *utl-chgadded* - Call web browser on http URLs and email client on mailto URLs (configurable scheme handlers) - Call MS-Word on .doc files, Acrobat Reader on .pdf, IrfanView on .jpg etc. (configurable media type handlers) - Syntax highlighting for URLs (can be switched off) - Support URL heuristics, e.g. allow www.vim.org, not only http://www.vim.org - Support exeuction of URLs without embedding (e.g. execute URLs as they mostly appear in not specifically written text like "see www.vim.org for Vim plugin" - Support multiline URLs - Smart setup and customization facility - Tilde Support, e.g. allow and - Automatically open file in split window if current buffer cannot be abandonned (e.g. is not written) ----- Fixed *utl-fixed* - Yes, about 10 bugs... but probably more new bugs came in :-) ============================================================================== 8. Todo list *utl-todo* ----- Todo list Please let me know which feature you would like to see in the next release. - Support for URL creation (authoring support) See #foot6 for an approach. - Dynamic call of handlers. There should be a possibility to choose media type and scheme handlers dynamically. This is most useful perhaps for links to local directories, i.e. URLs like : one time you want to call Vim's own file explorer, one time the file explorer of the system (e.g. Windows Explorer), one time the shell (or DOS box on Windows) with proper cwd. Currently you have to always invoke the setup and change it. - Allow wget to retrieve http documents. There should be a possibility to handle http URLs in Vim (using the wget utility) as version 1.2 offered it. Currently http URLs are always delegated to an external program (normally your web browser). The issue probably depends on the previous one. - Make colors of URL syntax highlighting configurable. - Check for dangling links There should be a function to check whether all links points to existing targets. Actually I already have a hack solution. Please email if you think this would be a nice feature. - Follow links when searching. Add a function which searches the file tree which is defined by a file containing file URLs. ----- Known bugs *utl-knownbugs* - The mappings \gE, \gV which split the screen when executing an URL are not respected for a reference to the same document; e.g. executing \gV on doesn't split the screen. The same is true when the file is the current file: e.g. . - Highlighting Bug The syntax highlighting gets confused in case of a split window, both containing the same file with URLs. Perhaps a Vim bug. ============================================================================== 9. Credits *utl-credits* Wolfgang Fleig, my partner for his for his help, co-authoring, dialectical antithesis and sponsoring. Ines Paegert for her impulses. Bram Moolenaar for the Vim editor. Barrie Stott for helping a lot with the documentation REKellyIV Klaus Horsten . Patrik Nyman Engelhard Heß Grant Bowman Ward Fuller Mark S. Thomas William Natter Alex Jakushev Geoff Caplan Bruno Díaz Michael Lesniak Janek Kozicki ============================================================================== FOOTNOTES ----- id=foot1 An URL like www.vim.org or stb@bf-consulting.de works via a simple heuristic support of Utl which is similar to what you know from your web browser. Utl completes www.xxx.domain into http://www.xxx.domain or stb@bf-consulting.de into mailto:stb@bf-consulting.de. See for supported heuristics. You can extend the heuristics defined there. ----- id=foot2 This only works if you have configured Windows Explorer as text/directory handler, see ). ----- id=foot3 I try to use lower case notations for URLs that cannot be executed right away, whereas upper case samples should all be directly executable. Note that this is only a convention used in this document, the case does not matter. URL: url: Url: are all fine. ----- id=foot4 In the current version of Utl the cache actually is really somewhat academic. The previous version, which was Thlnk-1.2, handled web URLs (http://...) using a web file retriever ( wget, see http://www.gnu.org/software/wget/wget.html ). HTML files were downloaded using wget into a local cache file and displayed using Vim, i.e. were always displayed as text. This was very cool for text files on the web because #tn= fragment addressing could be used. Example: . Within html files, which were readable enough in the text-view (in Vim) relative HTML hyperlinks could be executed directly through the cache. Now web URLs are handled in the mainstream manner by calling the web browser. Also people had to download wget. But I would like to reactivate the wget possibilities in a next version. Dynamic handler selection capabilities need to be added to Utl then. ----- id=foot5 You can use the man: protocol to hotlink from a program source code file to the relevant man page. This makes use of the Man plugin, see |man-plugin|. Example: [myopen.c] . . . /* Opens file "filename". * See for possible values of the `flags' * argument. * The restrictions described under also * apply to this function. */ int myopen(char* filename, int flags) { // open(filename, flags, mode); // } . . . EOF ----- id=foot6 You might want to try the following code: :map ,m :call Mark() fu! Mark() let g:file = Utl_utilSlash_ExpandFullPath() "echo "DBG: g:ins= " . g:ins let g:text = getline(".") endfu :iab XF =g:file :imap XT #tn==g:text Position the cursor at the intended target of the link and then execute the command ,m . For inserting a link to this position type XF to insert the file name and perhaps also XT to insert a fragment. vim:tw=78:ts=8:ft=help:norl:fdm=marker:fen vim-scripts-20130814ubuntu1/doc/bufexplorer.txt0000644000000000000000000007761312204336073016331 0ustar *bufexplorer.txt* Buffer Explorer Last Change: 06 May 2013 Buffer Explorer *buffer-explorer* *bufexplorer* Version 7.3.6 Plugin for easily exploring (or browsing) Vim|:buffers|. |bufexplorer-installation| Installation |bufexplorer-usage| Usage |bufexplorer-windowlayout| Window Layout |bufexplorer-customization| Customization |bufexplorer-changelog| Change Log |bufexplorer-todo| Todo |bufexplorer-credits| Credits For Vim version 7.0 and above. This plugin is only available if 'compatible' is not set. {Vi does not have any of this} ============================================================================== INSTALLATION *bufexplorer-installation* To install: - Download the bufexplorer.zip from: http://www.vim.org/scripts/script.php?script_id=42 - Extract the zip archive into your runtime directory. The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt. - Start Vim or goto an existing instance of Vim. - Execute the following command: > :helptag /doc < This will generate all the help tags for any file located in the doc directory. ============================================================================== USAGE *bufexplorer-usage* To start exploring in the current window, use: > \be or :BufExplorer or Your custom key mapping To start exploring in a newly split horizontal window, use: > \bs or :BufExplorerHorizontalSplit or Your custom key mapping To start exploring in a newly split vertical window, use: > \bv or :BufExplorerVerticalSplit or Your custom key mapping If you would like to use something other than '\', you may simply change the leader (see |mapleader|). Note: If the current buffer is modified when bufexplorer started, the current window is always split and the new bufexplorer is displayed in that new window. Commands to use once exploring: Toggle help information. Opens the buffer that is under the cursor into the current window. Opens the buffer that is under the cursor into the current window. Opens the buffer that is under the cursor in another tab. B Works in association with the|ShowTabBuffer|option. If |ShowTabBuffer|is set to 1, this toggles if BufExplorer is to only store the most recent tab for this buffer or not. d |:delete|the buffer under the cursor from the list. The buffer's 'buflisted' is cleared. This allows for the buffer to be displayed again using the 'show unlisted' command. D |:wipeout|the buffer under the cursor from the list. When a buffers is wiped, it will not be shown when unlisted buffer are displayed. f Toggles whether you are taken to the active window when selecting a buffer or not. o Opens the buffer that is under the cursor into the current window. p Toggles the showing of a split filename/pathname. q Exit/Close bufexplorer. r Reverses the order the buffers are listed in. R Toggles relative path/absolute path. s Cycle thru how the buffers are listed. Either by buffer number, file name, file extension, most recently used (MRU), or full path. S Cycle thru how the buffers are listed, in reverse order. Either by buffer number, file name, file extension, most recently used (MRU), or full path. T Toggles to show only buffers for this tab or not. t Opens the buffer that is under the cursor in another tab. u Toggles the showing of "unlisted" buffers. Once invoked, Buffer Explorer displays a sorted list (MRU is the default sort method) of all the buffers that are currently opened. You are then able to move the cursor to the line containing the buffer's name you are wanting to act upon. Once you have selected the buffer you would like, you can then either open it, close it(delete), resort the list, reverse the sort, quit exploring and so on... =============================================================================== WINDOW LAYOUT *bufexplorer-windowlayout* ------------------------------------------------------------------------------- " Press for Help " Sorted by mru | Locate buffer | Absolute Split path "= 01 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87 02 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1 ------------------------------------------------------------------------------- | | | | | | | | | +-- Current Line #. | | | +-- Relative/Full Path | | +-- Buffer Name. | +-- Buffer Attributes. See|:buffers|for more information. +-- Buffer Number. See|:buffers|for more information. =============================================================================== CUSTOMIZATION *bufexplorer-customization* If you do not like the default key mappings of \be, \bs, and \bv, you can override bufexplorer's default mappings by setting up something like the following in your vimrc file: noremap :BufExplorer noremap :BufExplorerHorizontalSplit noremap :BufExplorerVerticalSplit *g:bufExplorerChgWin* If set, bufexplorer will bring up the selected buffer in the window specified by g:bufExplorerChgWin. *g:bufExplorerDefaultHelp* To control whether the default help is displayed or not, use: > let g:bufExplorerDefaultHelp=0 " Do not show default help. let g:bufExplorerDefaultHelp=1 " Show default help. The default is to show the default help. *g:bufExplorerDetailedHelp* To control whether detailed help is display by, use: > let g:bufExplorerDetailedHelp=0 " Do not show detailed help. let g:bufExplorerDetailedHelp=1 " Show detailed help. The default is NOT to show detailed help. *g:bufExplorerFindActive* To control whether you are taken to the active window when selecting a buffer, use: > let g:bufExplorerFindActive=0 " Do not go to active window. let g:bufExplorerFindActive=1 " Go to active window. The default is to be taken to the active window. *g:bufExplorerFuncRef* When a buffer is selected, the functions specified either singly or as a list will be called. *g:bufExplorerReverseSort* To control whether to sort the buffer in reverse order or not, use: > let g:bufExplorerReverseSort=0 " Do not sort in reverse order. let g:bufExplorerReverseSort=1 " Sort in reverse order. The default is NOT to sort in reverse order. *g:bufExplorerShowDirectories* Directories usually show up in the list from using a command like ":e .". To control whether to show directories in the buffer list or not, use: > let g:bufExplorerShowDirectories=0 " Do not show directories. let g:bufExplorerShowDirectories=1 " Show directories. The default is to show directories. *g:bufExplorerShowNoName* To control whether to show "No Name" buffers or not, use: > let g:bufExplorerShowNoName=0 " Do not "No Name" buffers. let g:bufExplorerShowNoName=1 " Show "No Name" buffers. The default is to NOT show "No Name buffers. *g:bufExplorerShowRelativePath* To control whether to show absolute paths or relative to the current directory, use: > let g:bufExplorerShowRelativePath=0 " Show absolute paths. let g:bufExplorerShowRelativePath=1 " Show relative paths. The default is to show absolute paths. *g:bufExplorerShowTabBuffer* To control weither or not to show buffers on for the specific tab or not, use: > let g:bufExplorerShowTabBuffer=0 " No. let g:bufExplorerShowTabBuffer=1 " Yes. The default is not to show. *g:bufExplorerShowUnlisted* To control whether to show unlisted buffer or not, use: > let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers. let g:bufExplorerShowUnlisted=1 " Show unlisted buffers. The default is to NOT show unlisted buffers. *g:bufExplorerSortBy* To control what field the buffers are sorted by, use: > let g:bufExplorerSortBy='extension' " Sort by file extension. let g:bufExplorerSortBy='fullpath' " Sort by full file path name. let g:bufExplorerSortBy='mru' " Sort by most recently used. let g:bufExplorerSortBy='name' " Sort by the buffer's name. let g:bufExplorerSortBy='number' " Sort by the buffer's number. The default is to sort by mru. *g:bufExplorerSplitBelow* To control where the new split window will be placed above or below the current window, use: > let g:bufExplorerSplitBelow=1 " Split new window below current. let g:bufExplorerSplitBelow=0 " Split new window above current. The default is to use whatever is set by the global &splitbelow variable. *g:bufExplorerSplitHorzSize* To control the size of the new horizontal split window. use: > let g:bufExplorerHorzSize=n " New split window is n rows high. let g:bufExplorerHorzSize=0 " New split window size set by Vim. The default is 0, so that the size is set by Vim. *g:bufExplorerSplitOutPathName* To control whether to split out the path and file name or not, use: > let g:bufExplorerSplitOutPathName=1 " Split the path and file name. let g:bufExplorerSplitOutPathName=0 " Don't split the path and file " name. The default is to split the path and file name. *g:bufExplorerSplitRight* To control where the new vsplit window will be placed to the left or right of current window, use: > let g:bufExplorerSplitRight=0 " Split left. let g:bufExplorerSplitRight=1 " Split right. The default is to use the global &splitright. *g:bufExplorerSplitVertSize* To control the size of the new vertical split window. use: > let g:bufExplorerVertSize=n " New split window is n columns wide. let g:bufExplorerVertSize=0 " New split windows size set by Vim. The default is 0, so that the size is set by Vim. =============================================================================== CHANGE LOG *bufexplorer-changelog* 7.3.6 May, 06, 2013 * Removed the 'drop' window command that was causing issue with the argument-list being modified after the BufExplorer windows was displayed. 7.3.5 February 08, 2013 * Michael Henry added the ability to view "No Name" buffers. This functionality was lost since version 7.3.0. He also did some removal of "dead" code and cleaned up the code to handle filenames with embedded '"'. 7.3.4 January 28, 2013 * Thanks go out to John Szakmeister for finding and fixing a bug in the RebuildBufferList method. The keepjumps line that clears the list could potentially reference a backwards range. 7.3.3 January 14, 2013 * Major cleanup and reorganization of the change log. * We welcome the return of g:bufExplorerSplitHorzSize and g:bufExplorerSplitVertSize. When setting these values, anything less than or equal to 0 causes the split windows size to be determined by Vim. If for example you want your new horizontal split window 10 rows high, set g:bufExplorerSplitHorzSize = 10 in your .vimrc. Similar would be done if wanting a vertical split except you would use the g:bufExplorerSplitVertSize variable instead. 7.3.2 December 24, 2012 * Thanks go out to Michael Henry for pointing out that I completely missed yet another function, ReverseSortSelect(), during the refactoring. This function has now returned. 7.3.1 December 06, 2012 * Thanks go out to Brett Rasmussen for pointing out that the feature added way back in version 7.2.3 by Yuriy Ershov to automatically reposition the cursor to the line containing the active buffer, was no longer in the plugin. That bit of code has been re-added and all is well. 7.3.0 October 09, 2012 * It has been quite a while since I published a new version and this is the first version since Vim 7.3 was released. I have put some time into reworking and cleaning up the code as well as various bug fixes. Overall, I am hopeful that I not forgotten or lost a feature. * Thanks to Tim Johnson for testing out this new version. * I have hopefully allowed for better mapping of the main public methods as is explained in the|bufexplorer-customization|section of the documentation. * Add new 'B', 'o', and 'S' key mappings. 7.2.8 November 08, 2010 * Thanks to Charles Campbell for integrating bufexplorer with GDBMGR. http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR 7.2.7 April 26, 2010 * My 1st attempt to fix the "cache" issue where buffers information has changed but the cache/display does not reflect those changes. More work still needs to be done. 7.2.6 February 12, 2010 * Thanks to Michael Henry for pointing out that I totally forgot to update the inline help to reflect the previous change to the 'd' and 'D' keys. Opps! 7.2.5 February 10, 2010 * Philip Morant suggested switching the command (bwipe) associated with the 'd' key with the command (bdelete) associated with the 'D' key. This made sense since the 'd' key is more likely to be used compared to the 'D' key. 7.2.4 January 14, 2010 * I did not implement the patch provided by Godefroid Chapelle correctly. I missed one line which happened to be the most important one :) 7.2.3 December 15, 2009 * Hopefully I have not left anyone or anything out :) * Thanks to David Fishburn for helping me out with a much needed code overhaul as well as some awesome performance enhancements. * David also reworked the handling of tabs. * Thanks to Vladimir Dobriakov for making the suggestions on enhancing the documentation to include a better explaination of what is contained in the main bufexplorer window. * Thanks to Yuriy Ershov for added code that when the bufexplorer window is opened, the cursor is now positioned at the line with the active buffer (useful in non-MRU sort modes). * Yuriy also added the abiltiy to cycle through the sort fields in reverse order. * Thanks to Michael Henry for supplying a patch that allows bufexplorer to be opened even when there is one buffer or less. * Thanks to Godefroid Chapelle for supplying a patch that fixed MRU sort order after loading a session. 7.2.2 November 19, 2008 * Thanks to David L. Dight for spotting and fixing an issue when using ctrl^. bufexplorer would incorrectly handle the previous buffer so that when ctrl^ was pressed the incorrect file was opened. 7.2.1 September 03, 2008 * Thanks to Dimitar for spotting and fixing a feature that was inadvertently left out of the previous version. The feature was when bufexplorer was used together with WinManager, you could use the tab key to open a buffer in a split window. 7.2.0 August 15, 2008 * For all those missing the \bs and \bv commands, these have now returned. Thanks to Phil O'Connell for asking for the return of these missing features and helping test out this version. * Fixed problem with the bufExplorerFindActive code not working correctly. * Fixed an incompatibility between bufexplorer and netrw that caused buffers to be incorrectly removed from the MRU list. 7.1.7 December 21, 2007 * TaCahiroy fixed several issues related to opening a buffer in a tab. 7.1.6 December 01, 2007 * Removed ff=unix from modeline in bufexplorer.txt. Found by Bill McCarthy. 7.1.5 November 30, 2007 * Could not open unnamed buffers. Fixed by TaCahiroy. 7.1.4 November 16, 2007 * Sometimes when a file's path has 'white space' in it, extra buffers would be created containing each piece of the path. i.e: opening c:\document and settings\test.txt would create a buffer named "and" and a buffer named "Documents". This was reported and fixed by TaCa Yoss. 7.1.3 November 15, 2007 * Added code to allow only one instance of the plugin to run at a time. Thanks Dennis Hostetler. 7.1.2 November 07, 2007 * Dave Larson added handling of tabs. * Dave Larson removed \bs and \bv commands because these are easier for the used to create horizontal and vertical windows. * Fixed a jumplist issue spotted by JiangJun. I overlooked the 'jumplist' and with a couple calls to 'keepjumps', everything is fine again. * Went back to using just a plugin file, instead of both an autoload and plugin file. The splitting of the file caused issues with other plugins. So if you have a prior version of bufexplorer that has an autoload file, please remove autoload\bufexplorer and plugin\bufexplorer before installing this new version. * Fixed E493 error spotted by Thomas Arendsen Hein. * Minor cosmetic changes. * Minor help file changes. 7.1.1 August 02, 2007 * A problem spotted by Thomas Arendsen Hein. When running Vim (7.1.94), error E493 was being thrown. * Added 'D' for 'delete' buffer as the 'd' command was a 'wipe' buffer. 7.1.0 August 01, 2007 * Another 'major' update, some by Dave Larson, some by me. * Making use of 'autoload' now to make the plugin load quicker. * Removed '\bs' and '\bv'. These are now controlled by the user. The user can issue a ':sp' or ':vs' to create a horizontal or vertical split window and then issue a '\be' * Added handling of tabs. 7.0.17 July 24, 2007 * Fixed issue with 'drop' command. * Various enhancements and improvements. 7.0.16 May 15, 2007 * Fixed issue reported by Liu Jiaping on non Windows systems, which was ... Open file1, open file2, modify file1, open bufexplorer, you get the following error: --------8<-------- Error detected while processing function 14_StartBufExplorer..14_SplitOpen: line 4: E37: No write since last change (add ! to override) But the worse thing is, when I want to save the current buffer and type ':w', I get another error message: E382: Cannot write, 'buftype' option is set --------8<-------- 7.0.15 April 27, 2007 * Thanks to Mark Smithfield for suggesting bufexplorer needed to handle the ':args' command. 7.0.14 March 23, 2007 * Thanks to Randall Hansen for removing the requirement of terminal versions to be recompiled with 'gui' support so the 'drop' command would work. The 'drop' command is really not needed in terminal versions. 7.0.13 February 23, 2007 * Fixed integration with WinManager. * Thanks to Dave Eggum for another update. - Fix: The detailed help didn't display the mapping for toggling the split type, even though the split type is displayed. - Fixed incorrect description in the detailed help for toggling relative or full paths. - Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same thing. - Created a s:Set() function that sets a variable only if it hasn't already been defined. It's useful for initializing all those default settings. - Removed checks for repetitive command definitions. They were unnecessary. - Made the help highlighting a little more fancy. - Minor reverse compatibility issue: Changed ambiguous setting names to be more descriptive of what they do (also makes the code easier to follow): Changed bufExplorerSortDirection to bufExplorerReverseSort Changed bufExplorerSplitType to bufExplorerSplitVertical Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow - When the BufExplorer window closes, all the file-local marks are now deleted. This may have the benefit of cleaning up some of the jumplist. - Changed the name of the parameter for StartBufExplorer from "split" to "open". The parameter is a string which specifies how the buffer will be open, not if it is split or not. - Deprecated DoAnyMoreBuffersExist() - it is a one line function only used in one spot. - Created four functions (SplitOpen(), RebuildBufferList(), UpdateHelpStatus() and ReSortListing()) all with one purpose - to reduce repeated code. - Changed the name of AddHeader() to CreateHelp() to be more descriptive of what it does. It now returns an array instead of updating the window directly. This has the benefit of making the code more efficient since the text the function returns is used a little differently in the two places the function is called. - Other minor simplifications. 7.0.12 November 30, 2006 * MAJOR Update. This version will ONLY run with Vim version 7.0 or greater. * Dave Eggum has made some 'significant' updates to this latest version: - Added BufExplorerGetAltBuf() global function to be used in the user’s rulerformat. - Added g:bufExplorerSplitRight option. - Added g:bufExplorerShowRelativePath option with mapping. - Added current line highlighting. - The split type can now be changed whether bufexplorer is opened in split mode or not. - Various major and minor bug fixes and speed improvements. - Sort by extension. * Other improvements/changes: - Changed the help key from '?' to to be more 'standard'. - Fixed splitting of vertical bufexplorer window. * Hopefully I have not forgot something :) 7.0.11 March 10, 2006 * Fixed a couple of highlighting bugs, reported by David Eggum. * Dave Eggum also changed passive voice to active on a couple of warning messages. 7.0.10 March 02, 2006 * Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set, the slash character used when displaying the path was incorrect. 7.0.9 February 28, 2006 * Martin Grenfell found and eliminated an annoying bug in the bufexplorer/winmanager integration. The bug was were an annoying message would be displayed when a window was split or a new file was opened in a new window. Thanks Martin! 7.0.8 January 18, 2006 * Thanks to Mike Li for catching a bug in the WinManager integration. The bug was related to the incorrect displaying of the buffer explorer's window title. 7.0.7 December 19, 2005 * Thanks to Jeremy Cowgar for adding a new enhancement. This enhancement allows the user to press 'S', that is capital S, which will open the buffer under the cursor in a newly created split window. 7.0.6 November 18, 2005 * Thanks to Larry Zhang for finding a bug in the "split" buffer code. If you force set g:bufExplorerSplitType='v' in your vimrc, and if you tried to do a \bs to split the bufexplorer window, it would always split horizontal, not vertical. * Larry Zhang also found that I had a typeo in that the variable g:bufExplorerSplitVertSize was all lower case in the documentation which was incorrect. 7.0.5 October 18, 2005 * Thanks to Mun Johl for pointing out a bug that if a buffer was modified, the '+' was not showing up correctly. 7.0.4 October 03, 2005 * Fixed a problem discovered first by Xiangjiang Ma. Well since I've been using vim 7.0 and not 6.3, I started using a function (getftype) that is not in 6.3. So for backward compatibility, I conditionaly use this function now. Thus, the g:bufExplorerShowDirectories feature is only available when using vim 7.0 and above. 7.0.3 September 30, 2005 * Thanks to Erwin Waterlander for finding a problem when the last buffer was deleted. This issue got me to rewrite the buffer display logic (which I've wanted to do for sometime now). * Also great thanks to Dave Eggum for coming up with idea for g:bufExplorerShowDirectories. Read the above information about this feature. 7.0.2 March 25, 2005 * Thanks to Thomas Arendsen Hein for finding a problem when a user has the default help turned off and then brought up the explorer. An E493 would be displayed. 7.0.1 March 10, 2005 * Thanks to Erwin Waterlander for finding a couple problems. The first problem allowed a modified buffer to be deleted. Opps! The second problem occurred when several files were opened, BufExplorer was started, the current buffer was deleted using the 'd' option, and then BufExplorer was exited. The deleted buffer was still visible while it is not in the buffers list. Opps again! 7.0.0 March 10, 205 * Thanks to Shankar R. for suggesting to add the ability to set the fixed width (g:bufExplorerSplitVertSize) of a new window when opening bufexplorer vertically and fixed height (g:bufExplorerSplitHorzSize) of a new window when opening bufexplorer horizontally. By default, the windows are normally split to use half the existing width or height. 6.3.0 July 23, 2004 * Added keepjumps so that the jumps list would not get cluttered with bufexplorer related stuff. 6.2.3 April 15, 2004 * Thanks to Jay Logan for finding a bug in the vertical split position of the code. When selecting that the window was to be split vertically by doing a '\bv', from then on, all splits, i.e. '\bs', were split vertically, even though g:bufExplorerSplitType was not set to 'v'. 6.2.2 January 09, 2004 * Thanks to Patrik Modesto for adding a small improvement. For some reason his bufexplorer window was always showing up folded. He added 'setlocal nofoldenable' and it was fixed. 6.2.1 October 09, 2003 * Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting logic and option. 6.2.0 June 13, 2003 * Thanks goes out to Simon Johann-Ganter for spotting and fixing a problem in that the last search pattern is overridden by the search pattern for blank lines. 6.1.6 May 05, 2003 * Thanks to Artem Chuprina for finding a pesky bug that has been around for sometime now. The key mapping was causing the buffer explored to close prematurely when vim was run in an xterm. The key mapping is now removed. 6.1.5 April 28, 2003 * Thanks to Khorev Sergey. Added option to show default help or not. 6.1.4 March 18, 2003 * Thanks goes out to Valery Kondakoff for suggesting the addition of setlocal nonumber and foldcolumn=0. This allows for line numbering and folding to be turned off temporarily while in the explorer. 6.1.3 March 11, 2003 * Added folding. * Did some code cleanup. * Added the ability to force the newly split window to be temporarily vertical, which was suggested by Thomas Glanzmann. 6.1.2 November 05, 2002 * Now pressing the key will quit, just like 'q'. * Added folds to hide winmanager configuration. * If anyone had the 'C' option in their cpoptions they would receive a E10 error on startup of BufExplorer. cpo is now saved, updated and restored. Thanks to Charles E Campbell, Jr. * Attempted to make sure there can only be one BufExplorer window open at a time. 6.1.1 March 28, 2002 * Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This way buffers sorted by name will be in the correct order regardless of case. 6.0.16 March 14, 2002 * Thanks to Andre Pang for the original patch/idea to get bufexplorer to work in insertmode/modeless mode (evim). * Added Initialize and Cleanup autocommands to handle commands that need to be performed when starting or leaving bufexplorer. 6.0.15 February 20, 2002 * Srinath Avadhanulax added a patch for winmanager.vim. 6.0.14 February 19, 2002 * Fix a few more bug that I thought I already had fixed. * Thanks to Eric Bloodworth for adding 'Open Mode/Edit in Place'. * Added vertical splitting. 6.0.13 February 05, 2002 * Thanks to Charles E Campbell, Jr. for pointing out some embarrassing typos that I had in the documentation. I guess I need to run the spell checker more :o) 6.0.12 February 04, 2002 * Thanks to Madoka Machitani, for the tip on adding the augroup command around the MRUList autocommands. 6.0.11 January 26, 2002 * Fixed bug report by Xiangjiang Ma. '"=' was being added to the search history which messed up hlsearch. 6.0.10 January 14, 2002 * Added the necessary hooks so that the Srinath Avadhanula's winmanager.vim script could more easily integrate with this script. * Tried to improve performance. 6.0.9 December 17, 2001 * Added MRU (Most Recently Used) sort ordering. 6.0.8 December 03, 2001 * Was not resetting the showcmd command correctly. * Added nifty help file. 6.0.7 November 19, 2001 * Thanks to Brett Carlane for some great enhancements. Some are added, some are not, yet. Added highlighting of current and alternate filenames. Added splitting of path/filename toggle. Reworked ShowBuffers(). * Changed my email address. 6.0.6 September 05, 2001 * Copyright notice added. Needed this so that it could be distributed with Debian Linux. Fixed problem with the SortListing() function failing when there was only one buffer to display. 6.0.5 August 10, 2001 * Fixed problems reported by David Pascoe, in that you where unable to hit 'd' on a buffer that belonged to a files that no longer existed and that the 'yank' buffer was being overridden by the help text when the bufexplorer was opened. 6.0.4 July, 31, 2001 * Thanks to Charles Campbell, Jr. for making this plugin more plugin *compliant*, adding default keymappings of be and bs as well as fixing the 'w:sortDirLabel not being defined' bug. 6.0.3 July 30, 2001 * Added sorting capabilities. Sort taken from explorer.vim. 6.0.2 July 25, 2001 * Can't remember. 6.0.1 Sometime before July 25, 2001 * Initial release. =============================================================================== TODO *bufexplorer-todo* - Nothing as of now, buf if you have any suggestions, drop me an email. =============================================================================== CREDITS *bufexplorer-credits* Author: Jeff Lanzarotta Credit must go out to Bram Moolenaar and all the Vim developers for making the world's best editor (IMHO). I also want to thank everyone who helped and gave me suggestions. I wouldn't want to leave anyone out so I won't list names. =============================================================================== vim:tw=78:noet:wrap:ts=4:ft=help:norl: vim-scripts-20130814ubuntu1/doc/supertab.txt0000644000000000000000000003632312204336073015612 0ustar *supertab.txt* Author: Eric Van Dewoestine Original concept and versions up to 0.32 written by Gergely Kontra This plugin is licensed under the terms of the BSD License. Please see supertab.vim for the license in its entirety. ============================================================================== Supertab *supertab* 1. Introduction |supertab-intro| 2. Supertab Usage |supertab-usage| 3. Supertab Options |supertab-options| Default completion type |supertab-defaultcompletion| Secondary default completion type |supertab-contextdefault| Completion contexts |supertab-completioncontexts| Context text |supertab-contexttext| Context Discover |supertab-contextdiscover| Example |supertab-contextexample| Completion Duration |supertab-duration| Preventing Completion After/Before... |supertab-preventcomplete| Changing default mapping |supertab-forwardbackward| Inserting true tabs |supertab-mappingtabliteral| Enhanced longest match support |supertab-longestenhanced| Preselecting the first entry |supertab-longesthighlight| Mapping to end completion |supertab-crmapping| Auto close the preview window |supertab-closepreviewonpopupclose| Completion Chaining |supertab-completionchaining| ============================================================================== 1. Introduction *supertab-intro* Supertab is a plugin which allows you to perform all your insert completion (|ins-completion|) using the tab key. Supertab requires Vim version 7.0 or above. ============================================================================== 2. Supertab usage *supertab-usage* Using Supertab is as easy as hitting or (shift+tab) while in insert mode, with at least one non whitespace character before the cursor, to start the completion and then or again to cycle forwards or backwards through the available completions. Example ('|' denotes the cursor location): bar baz b| Hitting here will start the completion, allowing you to then cycle through the suggested words ('bar' and 'baz'). ============================================================================== 3. Supertab Options *supertab-options* Supertab is configured via several global variables that you can set in your |vimrc| file according to your needs. Below is a comprehensive list of the variables available. Default Completion Type *supertab-defaultcompletion* *g:SuperTabDefaultCompletionType* g:SuperTabDefaultCompletionType (default value: "") Used to set the default completion type. There is no need to escape this value as that will be done for you when the type is set. Example: setting the default completion to 'user' completion: let g:SuperTabDefaultCompletionType = "" Note: a special value of 'context' is supported which will result in super tab attempting to use the text preceding the cursor to decide which type of completion to attempt. Currently super tab can recognize method calls or attribute references via '.', '::' or '->', and file path references containing '/'. let g:SuperTabDefaultCompletionType = "context" /usr/l # will use filename completion myvar.t # will use user completion if completefunc set, # or omni completion if omnifunc set. myvar-> # same as above When using context completion, super tab will fall back to a secondary default completion type set by |g:SuperTabContextDefaultCompletionType|. Note: once the buffer has been initialized, changing the value of this setting will not change the default complete type used. If you want to change the default completion type for the current buffer after it has been set, perhaps in an ftplugin, you'll need to call SuperTabSetDefaultCompletionType like so, supplying the completion type you wish to switch to: call SuperTabSetDefaultCompletionType("") Secondary default completion type *supertab-contextdefault* *g:SuperTabContextDefaultCompletionType* g:SuperTabContextDefaultCompletionType (default value: "") Sets the default completion type used when g:SuperTabDefaultCompletionType is set to 'context' and no completion type is returned by any of the configured contexts. Completion contexts *supertab-completioncontexts* *g:SuperTabCompletionContexts* g:SuperTabCompletionContexts (default value: ['s:ContextText']) Sets the list of contexts used for context completion. This value should be a list of function names which provide the context implementation. When supertab starts the default completion, each of these contexts will be consulted, in the order they were supplied, to determine the completion type to use. If a context returns a completion type, that type will be used, otherwise the next context in the list will be consulted. If after executing all the context functions, no completion type has been determined, then the value of g:SuperTabContextDefaultCompletionType will be used. Built in completion contexts: s:ContextText *supertab-contexttext* The text context will examine the text near the cursor to decide which type of completion to attempt. Currently the text context can recognize method calls or attribute references via '.', '::' or '->', and file path references containing '/'. /usr/l # will use filename completion myvar.t # will use user completion if completefunc set, or # omni completion if omnifunc set. myvar-> # same as above Supported configuration attributes: g:SuperTabContextTextFileTypeExclusions List of file types for which the text context will be skipped. g:SuperTabContextTextOmniPrecedence List of omni completion option names in the order of precedence that they should be used if available. By default, user completion will be given precedence over omni completion, but you can use this variable to give omni completion higher precedence by placing it first in the list. s:ContextDiscover *supertab-contextdiscover* This context will use the 'g:SuperTabContextDiscoverDiscovery' variable to determine the completion type to use. It will evaluate each value, in the order they were defined, until a variable evaluates to a non-zero or non-empty value, then the associated completion type is used. Supported configuration properties: g:SuperTabContextDiscoverDiscovery List of variable:completionType mappings. Example context configuration: *supertab-contextexample* let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover'] let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc'] let g:SuperTabContextDiscoverDiscovery = \ ["&completefunc:", "&omnifunc:"] In addition to the default completion contexts, you can plug in your own implementation by creating a globally accessible function that returns the completion type to use (eg. "\\"). function MyTagContext() if filereadable(expand('%:p:h') . '/tags') return "\\" endif " no return will result in the evaluation of the next " configured context endfunction let g:SuperTabCompletionContexts = \ ['MyTagContext', 's:ContextText', 's:ContextDiscover'] Note: supertab also supports the b:SuperTabCompletionContexts variable allowing you to set the list of contexts separately for the current buffer, like from an ftplugin for example. Completion Duration *supertab-duration* *g:SuperTabRetainCompletionDuration* g:SuperTabRetainCompletionDuration (default value: 'insert') Determines if, and for how long, the current completion type is retained. The possible values include: 'completion' - The current completion type is only retained for the current completion. Once you have chosen a completion result or exited the completion mode, the default completion type is restored. 'insert' - The current completion type is saved until you exit insert mode (via ESC). Once you exit insert mode the default completion type is restored. (supertab default) 'session' - The current completion type is saved for the duration of your vim session or until you enter a different completion mode. Preventing completion after... *supertab-preventcomplete* *g:SuperTabNoCompleteBefore* *g:SuperTabNoCompleteAfter* g:SuperTabNoCompleteBefore (default value: []) g:SuperTabNoCompleteAfter (default value: ['\s']) These two variables are used to control when supertab will attempt completion or instead fall back to inserting a literal , by specifying a list of patterns which are tested against the text before and after the current cursor position that when matched, prevent completion. So if you don't want supertab to start completion after a comma or space, you can set g:SuperTabNoCompleteAfter to [',', '\s']. Note: That a buffer local version of these variables (b:SuperTabNoCompleteBefore, b:SuperTabNoCompleteAfter) is also supported should you wish to have different values depending on the file type for instance. Changing the default mapping *supertab-forwardbackward* *g:SuperTabMappingForward* *g:SuperTabMappingBackward* g:SuperTabMappingForward (default value: '') g:SuperTabMappingBackward (default value: '') These two variables allow you to set the keys used to kick off the current completion. By default this is and . To change to something like and , you can add the following to your |vimrc|. let g:SuperTabMappingForward = '' let g:SuperTabMappingBackward = '' Note: if the above does not have the desired effect (which may happen in console version of vim), you can try the following mappings. Although the backwards mapping still doesn't seem to work in the console for me, your milage may vary. let g:SuperTabMappingForward = '' let g:SuperTabMappingBackward = '' Inserting true tabs *supertab-mappingtabliteral* *g:SuperTabMappingTabLiteral* g:SuperTabMappingTabLiteral (default value: '') Sets the key mapping used to insert a literal tab where supertab would otherwise attempt to kick off insert completion. The default is '' (ctrl-tab) which unfortunately might not work at the console. So if you are using a console vim and want this functionality, you may have to change it to something that is supported. Alternatively, you can escape the with (see |i_CTRL-V| for more infos). Enhanced longest match support *supertab-longestenhanced* *g:SuperTabLongestEnhanced* g:SuperTabLongestEnhanced (default value: 0) When enabled and 'longest' is in your |completeopt| setting, supertab will provide an enhanced longest match support where typing one or more letters and hitting tab again while in a completion mode will complete the longest common match using the new text in the buffer. For example, say you have a buffer with the following contents: FooBarFoo FooBar Foo FooBarBaz And you then type F. Vim's builtin longest support will complete the longest common text 'Foo' and offer 'FooBarFoo', 'FooBar', 'Foo', and 'FooBarBaz' as possible completions. With supertab's longest match enhancement disabled, typing B while still in the completion mode will end up completing 'FooBarBaz' or 'FooBarFoo' depending your settings, instead of the next longest common match of 'FooBar'. With supertab's enhanced longest match feature enabled, the typing of B will result in the next longest text being completed. Preselecting the first entry *supertab-longesthighlight* *g:SuperTabLongestHighlight* g:SuperTabLongestHighlight (default value: 0) Sets whether or not to pre-highlight the first match when completeopt has the popup menu enabled and the 'longest' option as well. When enabled, will kick off completion and pre-select the first entry in the popup menu, allowing you to simply hit to use it. Mapping to end completion *supertab-crmapping* *g:SuperTabCrMapping* g:SuperTabCrMapping (default value: 1) When enabled, will cancel completion mode preserving the current text. Compatibility with other plugins: - endwise: compatible - delimitMate: not compatible (disabled if the delimitMate mapping is detected.) Auto close the preview window *supertab-closepreviewonpopupclose* *g:SuperTabClosePreviewOnPopupClose* g:SuperTabClosePreviewOnPopupClose (default value: 0) When enabled, supertab will attempt to close vim's completion preview window when the completion popup closes (completion is finished or canceled). Completion Chaining *supertab-completionchaining* SuperTab provides the ability to chain one of the completion functions (|completefunc| or |omnifunc|) together with a one of the default vim completion key sequences (|ins-completion|), giving you the ability to attempt completion with the first, and upon no results, fall back to the second. To utilize this feature you need to call the SuperTabChain function where the first argument is the name of a vim compatible |complete-function| and the second is one of vim's insert completion (|ins-completion|) key bindings (, , , etc). Calling this function will set the current buffer's |completefunc| option to a supertab provided implementation which utilizes the supplied arguments to perform the completion. Since the |completefunc| option is being set, this feature works best when also setting |g:SuperTabDefaultCompletionType| to either "context" or "". Here is an example that can be added to your .vimrc which will setup the supertab chaining for any filetype that has a provided |omnifunc| to first try that, then fall back to supertab's default, , completion: autocmd FileType * \ if &omnifunc != '' | \ call SuperTabChain(&omnifunc, "") | \ call SuperTabSetDefaultCompletionType("") | \ endif Note: This feature does not support chaining any other combination of completions (2 or more completion functions, 2 or more key bindings, etc.). It can only support 1 completion function followed by 1 key binding. This is due to limitations imposed by vim's code completion implementation. vim:tw=78:ts=8:ft=help:norl: vim-scripts-20130814ubuntu1/doc/snippets_emu.txt0000644000000000000000000003360012204336073016473 0ustar *snippets_emu.txt* For Vim version 7.0. Last change: 2006 Dec 26 VIM REFERENCE MANUAL by Panos Laganakos and Felix Ingram 1. SnippetsEmu Features |snippets_emu-features| Basic Snippets |basic-snippet| Named Tags |named-tags| Tag Commands |snippet-commands| Buffer Specific Snippets |snip-buffer-specific| Filetype Specific Snippets |snip-ftplugin| Snippets menu |snip-menu| 2. SnippetsEmu Options |snippets_emu-options| Start and End Tags |snip-start-end-tags| Element Delimiter |snip-start-end-tags| Remapping the default jump key |snip-remap-key| 3. Detailed Explanations |snip-detailed-explanations| Valid Tag Names |snip-tag-name-syntax| Advanced Tag Command Examples |snip-advanced-tag-commands| 4. SnippetsEmu Contact Details |snip-contact-details| 5. Contributors |snip-contributors| 6. SnippetsEmu Known Bugs |snippets_emu-bugs| 7. Troubleshooting |snippets_emu-troubleshooting| {Vi does not have any of these features} ============================================================================== SNIPPETSEMU FEATURES *snippets_emu-features* SnippetsEmu attempts to emulate several of the snippets features of the OS X editor TextMate, in particular the variable bouncing and replacement behaviour. Simple usage is built up around the following functionality: Basic Snippet |basic-snippet| Named Tags |named-tags| Executable Snippet |snippet-commands| Buffer Specific Snippets |snip-buffer-specific| *basic-snippet* *:Snippet* Basic Snippet ~ A basic snippet can save you a lot of typing. Define a word trigger and on insertion it will be expanded to the full snippet. SnippetsEmu allows the user to define markers within the larger piece of text which will be used to place the cursor upon expansion. The command used to define a snippet is 'Snippet'. Basic Syntax: > :Snippet trigger_name The cursor will be placed here: <{}> Trailing text In insert mode typing 'trigger_name' will remove 'trigger_name' and replace it with the text: 'The cursor will be placed here: Trailing text'. The cursor will be placed between the two spaces before the word 'Trailing' NOTE: All text should be entered on the same command line. The formatting of this document may mean that examples are wrapped but they should all be entered on a single line. *named-tags* Named tags ~ Instead of the simple '<{}>' tags used for cursor placement a user can define named tags. When the value of a named tag is changed then all other tags with that name will be changed to the same value. E.g. > :Snippet trigger My name is <{forename}> <{surname}>. Call me <{forename}>. In insert mode typing 'trigger' will place the cursor inside the '<{forename}>' tag. Whatever is entered inside the tag will replace the other similarly named tag at the end of the line after the user presses 'Tab'. If no value is entered for a named tag then the tag's name will be used instead. This is one way of defining default values. Using the above example, entering 'trigger' and pressing 'Tab' twice will result in the following text: > My name is forename surname. Please call me forename. The rules for what constitutes a valid tag name are explained below. See |snip-tag-name-syntax|. *snippet-commands* Tag commands ~ Tags can contain commands. Commands can be any Vim function, including user defined functions. A common example is performing substitutions. E.g. > :Snippet trigger My name is <{name}>. I SAID: MY NAME IS <{name:substitute(@z,'.','\u&','g')}>! The value entered in the <{name}> tag will be passed to the command in the second <{name}> tag in the @z register (any value already in @z will be preserved and restored). The substitute command will change the entered value to be in upper case. I.e. Entering 'trigger' and typing 'Tycho' will result in the following text: > My name is Tycho. I SAID: MY NAME IS TYCHO! ~ *snip-special-vars* There is a set of special variables which can be included in snippets. These will be replaced before the snippet's text is inserted into the buffer. The list of available variables is detailed below: * SNIP_FILE_NAME - The current file name (from 'expand("%")') * SNIP_ISO_DATE - The current date in YYYY-MM-DD format. *snip-snippet-commands* In addition to tag commands it is also possible to define commands which will be executed before the snippet is inserted into the buffer. These are defined within double backticks. E.g. > :Snippet date The current date is ``strftime("%c")`` Commands are standard Vim commands and will be 'exec'uted and the command output substituted into the text. *snip-buffer-specific* Buffer Specific Snippets ~ The Snippet command defines buffer specific snippets. This is the recommended option when using filetype specific snippets. It is possible to define 'global' snippets which will act across all buffers. These can be defined using the legacy 'Iabbr' command (note the capital 'I'). E.g. > Iabbr for for <{var}> in <{list}>:<{}> ~ *snip-ftplugin* The preferred practice for defining filetype specific snippets is to include them in files named _snippets.vim and for these files to be placed in the ~/.vim/after/ftplugin directory (or vimfiles\after\ftplugin under Windows). When a file of a specific type is loaded so will all of the defined snippets. The 'after' directory is used to ensure that the plugin has been loaded. It is also recommended that the following is included at the top of the file: > if !exists('loaded_snippet') || &cp finish endif This will stop errors being generated if the plugin has not loaded for any reason. Users wishing to add their own filetype snippets should add them to a separate file to ensure they are not lost when upgrading the plugin. Naming the files _mysnippets.vim or similar is the preferred practice. *snip-menu* When loading the plugin will search for all files named '*_snippets.vim'. These will be added to the 'Snippets' menu which is available in Normal mode. Selecting options from the menu will source the file and hence load any snippets defined within it. *creating-snippets* *CreateSnippet* [range]CreateSnippet The CreateSnippet command allows the simple creation of snippets for use within your own file. Without a range the current line will be used. When passed a range then all the lines in the range will be converted for use in a command. Snippets created by the command will be added to a scratch buffer called 'Snippets'. The current value of an empty tag (snip_start_tag.snip_end_tag, '<{}>' by default) will be added to the unnamed register and so can be inserted with appropriate paste commands. *CreateBundleSnippet* [range]CreateBundleSnippet CreateBundleSnippet works exactly like CreateSnippet but the resulting text will be suitable for including in one of the included bundles. The unnamed register will include the text '"st.et."' so start and end tag agnostic empty tags can be included. =============================================================================== SNIPPETSEMU OPTIONS *snippets_emu-options* *snip-start-end-tags* Start and End Tags ~ By default the start and end tags are set to be '<{' and '}>'. These can be changed by setting the following variables in vimrc: > g:snip_start_tag g:snip_end_tag They can be also changed for a specific buffer by setting the following: > b:snip_start_tag b:snip_end_tag ~ *snip-elem-delimiter* Element Delimiter ~ The value of snip_elem_delim is used to separate a tag's name and its command. By default it is set to ':' but can be set as above either globally or for a specific buffer using the following variables: > g:snip_elem_delim b:snip_elem_delim ~ *snip-remap-key* Remapping the default jump key ~ The trigger key is mapped to Tab by default. Some people may wish to remap this if it causes conflicts with other plugins. The key can be set in your <.vimrc> by setting the 'g:snippetsEmu_key' variable. An example > let g:snippetsEmu_key = "" Snippets will now be triggered by Shift-Tab rather than just Tab. NB, this example may not work in all terminals as some trap Shift-Tab before it gets to Vim. ~ ============================================================================== DETAILED EXPLANATIONS *snip-detailed-explanations* *snip-tag-name-syntax* Valid Tag Names ~ Tag names cannot contain whitespace unless they are enclosed in quotes. Valid Examples: > <{validName}> <{"valid name"}> <{tagName:command}> <{"Tag Name":command}> Invalid Examples: > <{invalid name}> <{Tag Name:command}> <{:command}> ~ *snip-advanced-tag-commands* Advanced Tag Command Examples ~ Commands in tags can be as complex as desired. Readability is the main limitation as the command will be placed in the document before execution. The preferred method for defining complex commands is to hide the functionality in a user function. Example: > function! Count(haystack, needle) let counter = 0 let index = match(a:haystack, a:needle) while index > -1 let counter = counter + 1 let index = match(a:haystack, a:needle, index+1) endwhile return counter endfunction function! PyArgList(count) if a:count == 0 return "(,)" else return '('.repeat('<{}>, ', a:count).')' endif endfunction Snippet pf print "<{s}>" % <{s:PyArgList(Count(@z, '%[^%]'))}><{}> The above snippet will expand 'pf' to 'print "<{s}>" ...'. The user then enters a format string. Once the string is entered the Count and PyArgList functions are used to generate a number of empty tags. *snip-limitations* The above represents once of the limitations of the plugin. Due to the way tags are identified it is not possible to include empty tags in another tag's command. The only way to generate empty tags is to return them from a function as in the above example. For other examples see the included bundles. *snip-bundles* The included bundles are not defined in the 'preferred style'. In order to accommodate users who wish to redefine the default tags all snippet definitions are 'executed' with the 'exec' command. E.g. > exec "Snippet test This isn't the right way to ".st.et." define snippets" Executing the command allows 'st' and 'et' to be used in place of start and end tags. 'st' and 'et' are defined elsewhere in the bundle file. ============================================================================== SNIPPETSEMU CONTACT DETAILS *snip-contact-details* To contact the author please email: F Ingram lists gmail com The author welcomes corrections to this documentation, example snippets and bug reports. The plugin is also currently hosted at Google Code: http://code.google.com/p/snippetsemu Bug reports can also be posted on the hosting site: http://code.google.com/p/snippetsemu/issues/list *snip-contributors* Contributors to SnippetsEmu ~ Patches: Ori Avtalion - Improvements to Snippet command Freddy Vulto - Improved behaviour Andy Block - Bug with commands on same line. This is why I should do better test suites. bzklrm - Removal of some normal commands Priit Tamboom - Sorting out left and right mappings Documentation: Panos Laganakos - Greek translation (coming soon) Bundles: Panos Laganakos - Python snippets Alex Pounds - Django snippets Chris Lasher - Python snippets knipknap - Python snippets James Widman - C snippets ============================================================================== SNIPPETSEMU KNOWN BUGS *snippets_emu-bugs* Bugs are currently tracked on Google Code. Please post any you find on the issue tracker: http://code.google.com/p/snippetsemu/issues/list ============================================================================== SNIPPETSEMU TROUBLESHOOTING *snippets_emu-troubleshooting* Problem: Bundles are not loading. Answer: Ensure that you have filetype plugins turned on. Include the following in your vimrc: > filetype plugin on vim:tw=78:sw=4:ts=8:ft=help:norl: vim-scripts-20130814ubuntu1/doc/Align.txt0000644000000000000000000017546712204336073015034 0ustar *align.txt* The Alignment Tool Jan 07, 2013 Author: Charles E. Campbell (remove NOSPAM from Campbell's email first) Copyright: (c) 2004-2012 by Charles E. Campbell *Align-copyright* The VIM LICENSE applies to Align.vim, AlignMaps.vim, and Align.txt (see |copyright|) except use "Align and AlignMaps" instead of "Vim" NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. ============================================================================== 1. Contents *align* *align-contents* {{{1 1. Contents.................: |align-contents| 2. Alignment Manual.........: |align-manual| 3. Alignment Usage..........: |align-usage| Alignment Concepts.......: |align-concepts| Alignment Commands.......: |align-commands| Alignment Control........: |align-control| Separators.............: |alignctrl-separators| Initial Whitespace.....: |alignctrl-w| |alignctrl-W| |alignctrl-I| Justification..........: |alignctrl-l| |alignctrl-r| |alignctrl-c| Justification Control..: |alignctrl--| |alignctrl-+| |alignctrl-:| Cyclic/Sequential......: |alignctrl-=| |alignctrl-C| Separator Justification: |alignctrl-<| |alignctrl->| |alignctrl-|| Line (de)Selection.....: |alignctrl-g| |alignctrl-v| Temporary Settings.....: |alignctrl-m| Padding................: |alignctrl-p| |alignctrl-P| Current Options........: |alignctrl-settings| |alignctrl-| Alignment Control Init...: |alignctrl-init| Alignment................: |align-align| 4. Alignment Maps...........: |align-maps| \a,....................: |alignmap-a,| \a?....................: |alignmap-a?| \a<....................: |alignmap-a<| \abox..................: |alignmap-abox| \acom..................: |alignmap-acom| \anum..................: |alignmap-anum| \ascom.................: |alignmap-ascom| \adec..................: |alignmap-adec| \adef..................: |alignmap-adef| \afnc..................: |alignmap-afnc| \adcom.................: |alignmap-adcom| \aocom.................: |alignmap-aocom| \tsp...................: |alignmap-tsp| \tsq...................: |alignmap-tsq| \tt....................: |alignmap-tt| \t=....................: |alignmap-t=| \T=....................: |alignmap-T=| \Htd...................: |alignmap-Htd| 5. Alignment Tool History...: |align-history| ============================================================================== 2. Align Manual *alignman* *alignmanual* *align-manual* {{{1 Align comes as a vimball; simply typing > vim Align.vba.gz :so % < should put its components where they belong. The components are: > .vim/plugin/AlignPlugin.vim .vim/plugin/AlignMapsPlugin.vim .vim/plugin/cecutil.vim .vim/autoload/Align.vim .vim/autoload/AlignMaps.vim .vim/doc/Align.txt < To see a user's guide, see |align-userguide| To see examples, see |alignctrl| and |alignmaps| > /=============+=========+=====================================================\ || \ Default/ || || Commands \ Value/ Explanation || || | | || ++==============+====+=======================================================++ || AlignCtrl | | =Clrc-+:pPIWw [..list-of-separator-patterns..] || || | +-------------------------------------------------------+| || | | may be called as a command or as a function: || || | | :AlignCtrl =lp0P0W & \\ || || | | :call Align#AlignCtrl('=lp0P0W','&','\\') || || | | || || | +-------------------------------------------------------++ || 1st arg | = | = all separator patterns are equivalent and are || || | | simultaneously active. Patterns are |regexp|. || || | | C cycle through separator patterns. Patterns are || || | | |regexp| and are active sequentially. || || | | || || | < | < left justify separator Separators are justified, || || | | > right justify separator too. Separator styles || || | | | center separator are cyclic. || || | | || || | l | l left justify Justification styles are always || || | | r right justify cyclic (ie. lrc would mean left j., || || | | c center then right j., then center, repeat. || || | | - skip this separator || || | | + re-use last justification method || || | | : treat rest of text as a field || || | | * use AlignSkip() function (to skip or not) || || | | || || | p1 | p### pad separator on left by # blanks || || | P1 | P### pad separator on right by # blanks || || | | || || | I | I preserve and apply first line's leading white || || | | space to all lines || || | | W preserve leading white space on every line, even || || | | if it varies from line to line || || | | w don't preserve leading white space || || | | || || | | g second argument is a selection pattern -- only || || | | align on lines that have a match (inspired by || || | | :g/selection pattern/command) || || | | v second argument is a selection pattern -- only || || | | align on lines that _don't_ have a match (inspired || || | | by :v/selection pattern/command) || || | | || || | | m Map support: AlignCtrl will immediately do an || || | | AlignPush() and the next call to Align() will do || || | | an AlignPop at the end. This feature allows maps || || | | to preserve user settings. || || | | || || | | default || || | | AlignCtrl default || || | | will clear the AlignCtrl || || | | stack & set the default: AlignCtrl "Ilp1P1=" '=' || || | | || || +----+-------------------------------------------------------+| || More args | More arguments are interpreted as describing separators || || +------------------------------------------------------------+| || No args | AlignCtrl will display its current settings || ||==============+============================================================+| ||[range]Align | [..list-of-separators..] || ||[range]Align! | [AlignCtrl settings] [..list-of-separators..] || || +------------------------------------------------------------+| || | Aligns text over the given range. The range may be || || | selected via visual mode (v, V, or ctrl-v) or via || || | the command line. The Align operation may be invoked || || | as a command or as a function; as a function, the first || || | argument is 0=separators only, 1=AlignCtrl option string || || | followed by a list of separators. || || | :[range]Align || || | :[range]Align [list of separators] || || | :[range]call Align#Align(0) || || | :[range]call Align#Align(0,"list","of","separators",...) || \=============================================================================/ ============================================================================== 3. Alignment Usage *alignusage* *align-usage* *align-userguide* {{{1 ALIGNMENT CONCEPTS *align-concept* *align-concepts* *alignctrl* {{{1 The typical text to be aligned is considered to be: * composed of two or more fields * separated by one or more separator pattern(s): * two or more lines > ws field ws separator ws field ws separator ... ws field ws separator ws field ws separator ... < where "ws" stands for "white space" such as blanks and/or tabs, and "fields" are arbitrary text. For example, consider > x= y= z= 3; xx= yy= zz= 4; zzz= yyy= zzz= 5; a= b= c= 3; < Assume that it is desired to line up all the "=" signs; these, then, are the separators. The fields are composed of all the alphameric text. Assuming they lie on lines 1-4, one may align those "=" signs with: > :AlignCtrl l :1,4Align = < The result is: > x = y = z = 3; xx = yy = zz = 4; zzz = yyy = zzz = 5; a = b = c = 3; < Note how each "=" sign is surrounded by a single space; the default padding is p1P1 (p1 means one space before the separator, and P1 means one space after it). If you wish to change the padding, say, to no padding, use (see |alignctrl-p|) > :AlignCtrl lp0P0 < Next, note how each field is left justified; that's what the "l" in the AlignCtrl parameters (a small letter "ell") does. If right-justification of the fields had been desired, an "r" could've been used: > :AlignCtrl r < yielding > x = y = z = 3; xx = yy = zz = 4; zzz = yyy = zzz = 5; a = b = c = 3; < There are many more options available for field justification: see |alignctrl-c| and |alignctrl--|. Separators, although commonly only one character long, are actually specified by regular expressions (see |regexp|), and one may left justify, right justify, or center them, too (see |alignctrl-<|). Assume that for some reason a left-right-left-right-... justification sequence was desired. This wish is simply achieved with > :AlignCtrl lr :1,4Align = < because the justification commands are considered to be "cyclic"; ie. lr is the same as lrlrlrlrlrlrlr... There's a lot more discussed under |alignctrl|; hopefully the examples there will help, too. ALIGNMENT COMMANDS *align-command* *align-commands* {{{2 The script includes two primary commands and two minor commands: AlignCtrl : this command/function sets up alignment options which persist until changed for later Align calls. It controls such things as: how to specify field separators, initial white space, padding about separators, left/right/center justification, etc. > ex. AlignCtrl wp0P1 Interpretation: during subsequent alignment operations, preserve each line's initial whitespace. Use no padding before separators but provide one padding space after separators. < Align : this command/function operates on the range given it to align text based on one or more separator patterns. The patterns may be provided via AlignCtrl or via Align itself. > ex. :%Align , Interpretation: align all commas over the entire file. < The :Align! format permits alignment control commands to precede the alignment patterns. > ex. :%Align! p2P2 = < This will align all "=" in the file with two padding spaces on both sides of each "=" sign. NOTE ON USING PATTERNS WITH ALIGN:~ Align and AlignCtrl use || to obtain their input patterns and they use an internal function to split arguments at whitespace unless inside "..."s. One may escape characters inside a double-quote string by preceding such characters with a backslash. AlignPush : this command/function pushes the current AlignCtrl state onto an internal stack. > ex. :AlignPush Interpretation: save the current AlignCtrl settings, whatever they may be. They'll also remain as the current settings until AlignCtrl is used to change them. < AlignPop : this command/function pops the current AlignCtrl state from an internal stack. > ex. :AlignPop Interpretation: presumably AlignPush was used (at least once) previously; this command restores the AlignCtrl settings when AlignPush was last used. < Also see |alignctrl-m| for a way to automatically do an AlignPop after an Align (primarily this is for maps). ALIGNMENT OPTIONS *align-option* *align-options* *align-xstrlen* {{{2 *align-utf8* *align-utf* *align-codepoint* *align-strlen* *align-multibyte* For those of you who are using 2-byte (or more) characters such as are available with utf-8, Align now provides a special option which you may choose based upon your needs: Use Built-in strlen() ~ > let g:Align_xstrlen= 0 < This is the fastest method, but it doesn't handle multibyte characters well. It is the default for: enc=latin1 vim compiled without multi-byte support $LANG is en_US.UTF-8 (assuming USA english) Number of codepoints (Latin a + combining circumflex are two codepoints)~ > let g:Align_xstrlen= 1 (default) < Number of spacing codepoints (Latin a + combining circumflex is one~ spacing codepoint; a hard tab is one; wide and narrow CJK are one~ each; etc.)~ > let g:Align_xstrlen= 2 < Virtual length (counting, for instance, tabs as anything between 1 and~ 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when~ immediately preceded by lam, one otherwise, etc.)~ > let g:Align_xstrlen= 3 < User may specify a function to compute the string length~ > let g:Align_xstrlen= "strlen" < This method will cause Align to call upon the named function returning string length. it should resemble the |strlen()| function, taking one argument (the string) for input and returning the string length. By putting one of these settings into your <.vimrc>, Align will use an internal (interpreted) function to determine a string's length instead of Vim's built-in |strlen()| function. Since the function is interpreted, Align will run a bit slower but will handle such strings correctly. The last settings (g:Align_xstrlen= 3 and g:Align_xstrlen="userfuncname") probably will run the slowest but be the most accurate. (thanks to Tony Mechelynck for these) ALIGNMENT CONTROL *:AlignCtrl* *align-control* {{{2 This command doesn't do the alignment operation itself; instead, it controls subsequent alignment operation(s). The first argument to AlignCtrl is a string which may contain one or more alignment control settings. Most of the settings are specified by single letters; the exceptions are the p# and P# commands which interpret a digit following the p or P as specifying padding about the separator. The typical text line is considered to be composed of two or more fields separated by one or more separator pattern(s): > ws field ws separator ws field ws separator ... < where "ws" stands for "white space" such as blanks and/or tabs. SEPARATORS *alignctrl-separators* {{{3 As a result, separators may not have white space (tabs or blanks) on their outsides (ie. ": :" is fine as a separator, but " :: " is not). Usually such separators are not needed, although a map has been provided which works around this limitation and aligns on whitespace (see |alignmap-tsp|). However, if you really need to have separators with leading or trailing whitespace, consider handling them by performing a substitute first (ie. s/ :: /@/g), do the alignment on the temporary pattern (ie. @), and then perform a substitute to revert the separators back to their desired condition (ie. s/@/ :: /g). The Align#Align() function (which is invoked by the :Align command) will first convert tabs over the region into spaces and then apply alignment control. Except for initial white space, white space surrounding the fields is ignored. One has three options just for handling initial white space: --- *alignctrl-w* wWI INITIAL WHITE SPACE *alignctrl-W* {{{3 --- *alignctrl-I* w : ignore all selected lines' initial white space W : retain all selected lines' initial white space I : retain only the first line's initial white space and re-use it for subsequent lines Example: Leading white space options: > +---------------+-------------------+-----------------+ |AlignCtrl w= :=| AlignCtrl W= := | AlignCtrl I= := | +------------------+---------------+-------------------+-----------------+ | Original | w option | W option | I option | +------------------+---------------+-------------------+-----------------+ | a := baaa |a := baaa | a := baaa | a := baaa | | caaaa := deeee |caaaa := deeee | caaaa := deeee | caaaa := deeee| | ee := f |ee := f | ee := f | ee := f | +------------------+---------------+-------------------+-----------------+ < The original has at least one leading white space on every line. Using Align with w eliminated each line's leading white space. Using Align with W preserved each line's leading white space. Using Align with I applied the first line's leading white space (three spaces) to each line. ------ *alignctrl-l* lrc-+: FIELD JUSTIFICATION *alignctrl-r* {{{3 ------ *alignctrl-c* With "lrc", the fields will be left-justified, right-justified, or centered as indicated by the justification specifiers (lrc). The "lrc" options are re-used by cycling through them as needed: l means llllll.... r means rrrrrr.... lr means lrlrlr.... llr means llrllr.... Example: Justification options: Align = > +------------+-------------------+-------------------+-------------------+ | Original | AlignCtrl l | AlignCtrl r | AlignCtrl lr | +------------+-------------------+-------------------+-------------------+ | a=bb=ccc=1 |a = bb = ccc = 1| a = bb = ccc = 1|a = bb = ccc = 1| | ccc=a=bb=2 |ccc = a = bb = 2|ccc = a = bb = 2|ccc = a = bb = 2| | dd=eee=f=3 |dd = eee = f = 3| dd = eee = f = 3|dd = eee = f = 3| +------------+-------------------+-------------------+-------------------+ | Alignment |l l l l| r r r r|l r l r| +------------+-------------------+-------------------+-------------------+ < AlignCtrl l : The = separator is repeatedly re-used, as the cycle only consists of one character (the "l"). Every time left-justification is used for fields. AlignCtrl r : The = separator is repeatedly re-used, as the cycle only consists of one character (the "r"). Every time right-justification is used for fields AlignCtrl lr: Again, the "=" separator is repeatedly re-used, but the fields are justified alternately between left and right. Even more separator control is available! With "-+:": - : skip treating the separator as a separator. *alignctrl--* + : repeat use of the last "lrc" justification *alignctrl-+* : : treat the rest of the line as a single field *alignctrl-:* * : like -, but only if g:AlignSkip() returns true *alignctrl-star* (see |alignctrl-alignskip|) Example: More justification options: Align = > +------------+---------------+--------------------+---------------+ | Original | AlignCtrl -l | AlignCtrl rl+ | AlignCtrl l: | +------------+---------------+--------------------+---------------+ | a=bb=ccc=1 |a=bb = ccc=1 | a = bb = ccc = 1 |a = bb=ccc=1 | | ccc=a=bb=2 |ccc=a = bb=2 |ccc = a = bb = 2 |ccc = a=bb=2 | | dd=eee=f=3 |dd=eee = f=3 | dd = eee = f = 3 |dd = eee=f=3 | +------------+---------------+--------------------+---------------+ | Alignment |l l | r l l l |l l | +------------+---------------+--------------------+---------------+ < In the first example in "More justification options": The first "=" separator is skipped by the "-" specification, and so "a=bb", "ccc=a", and "dd=eee" are considered as single fields. The next "=" separator has its (left side) field left-justified. Due to the cyclic nature of separator patterns, the "-l" specification is equivalent to "-l-l-l ...". Hence the next specification is a "skip", so "ccc=1", etc are fields. In the second example in "More justification options": The first field is right-justified, the second field is left justified, and all remaining fields repeat the last justification command (ie. they are left justified, too). Hence rl+ is equivalent to rlllllllll ... (whereas plain rl is equivalent to rlrlrlrlrl ... ). In the third example in "More justification options": The text following the first separator is treated as a single field. Thus using the - and : operators one can apply justification to a single separator. ex. 1st separator only: AlignCtrl l: 2nd separator only: AlignCtrl -l: 3rd separator only: AlignCtrl --l: etc. *g:AlignSkip* Align Skip Control *alignctrl-alignskip* The separator control '*' permits a function to decide whether or not a character which matches the current separator pattern should instead be skipped. 1. Define a function; example: > fun! AlignSkipString(lineno,indx) let synid = synID(a:lineno,a:indx+1,1) let synname = synIDattr(synIDtrans(synid),"name") let ret= (synname == "String")? 1 : 0 return ret endfun < Input: lineno: current line number indx : index to character; leftmost character in the line has an indx of 0 (like |strpart()|) Output: 0 : if separator is ok 1 : skip separator like it was a '-' 2. Set up |g:AlignSkip| as a function reference (see |Funcref|): > let g:AlignSkip= function("AlignSkipString") < 3. Use * as a separator control where a separator potentially should be skipped over. --- *alignctrl-=* =C CYCLIC VS ALL-ACTIVE SEPARATORS *alignctrl-C* {{{3 --- The separators themselves may be considered as equivalent and simultaneously active ("=") or sequentially cycled through ("C"). Separators are regular expressions (|regexp|) and are specified as the second, third, etc arguments. When the separator patterns are equivalent and simultaneously active, there will be one pattern constructed: > AlignCtrl ... pat1 pat2 pat3 < becomes > \(pat1\|pat2\|pat3\) < (ie. pat1 -or- pat2 -or- pat3; see |/bar|) Each separator pattern is thus equivalent and simultaneously active. The cyclic separator AlignCtrl option stores a list of patterns, only one of which is active for each field at a time. Example: Equivalent/Simultaneously-Active vs Cyclic Separators > +-------------+------------------+---------------------+----------------------+ | Original | AlignCtrl = = + -| AlignCtrl = = | AlignCtrl C = + - | +-------------+------------------+---------------------+----------------------+ |a = b + c - d|a = b + c - d |a = b + c - d |a = b + c - d | |x = y = z + 2|x = y = z + 2 |x = y = z + 2|x = y = z + 2 | |w = s - t = 0|w = s - t = 0 |w = s - t = 0 |w = s - t = 0 | +-------------+------------------+---------------------+----------------------+ < The original is initially aligned with all operators (=+-) being considered as equivalent and simultaneously active field separators. Thus the "AlignCtrl = = + -" example shows no change. The second example only accepts the '=' as a field separator; consequently "b + c - d" is now a single field. The third example illustrates cyclic field separators and is analyzed in the following illustration: > field1 separator field2 separator field3 separator field4 a = b + c - d x = y = z + 2 w = s - t = 0 < The word "cyclic" is used because the patterns form a cycle of use; in the above case, its = + - = + - = + - = + -... Example: Cyclic separators > Label : this is some text discussing ":"s | ex. abc:def:ghi Label : this is some text with a ":" in it | ex. abc:def < apply AlignCtrl lWC : | | (select lines)Align > Label : this is some text discussing ":"s | ex. abc:def:ghi Label : this is some text with a ":" in it | ex. abcd:efg < In the current example, : is the first separator So the first ":"s are aligned | is the second separator but subsequent ":"s are not. | is the third separator The "|"s are aligned, too. : is the fourth separator Since there aren't two bars, | is the fifth separator the subsequent potential cycles | is the sixth separator don't appear. ... In this case it would probably have been a better idea to have used > AlignCtrl WCl: : | < as that alignment control would guarantee that no more cycling would be used after the vertical bar. Example: Cyclic separators Original: > a| b&c | (d|e) & f-g-h aa| bb&cc | (dd|ee) & ff-gg-hh aaa| bbb&ccc | (ddd|eee) & fff-ggg-hhh < AlignCtrl C | | & - > a | b&c | (d|e) & f - g-h aa | bb&cc | (dd|ee) & ff - gg-hh aaa | bbb&ccc | (ddd|eee) & fff - ggg-hhh < In this example, the first and second separators are "|", the third separator is "&", and the fourth separator is "-", (cycling) the fifth and sixth separators are "|", the seventh separator is "&", and the eighth separator is "-", etc. Thus the first "&"s are (not yet) separators, and hence are treated as part of the field. Ignoring white space for the moment, the AlignCtrl shown here means that Align will work with > field | field | field & field - field | field | field & field - ... < --- *alignctrl-<* <>| SEPARATOR JUSTIFICATION *alignctrl->* {{{3 --- *alignctrl-|* Separators may be of differing lengths as shown in the example below. Hence they too may be justified left, right, or centered. Furthermore, separator justification specifications are cyclic: < means <<<<<... justify separator(s) to the left > means >>>>>... justify separator(s) to the right | means |||||... center separator(s) Example: Separator Justification: Align -\+ > +-----------------+ | Original | +-----------------+ | a - bbb - c | | aa -- bb -- ccc | | aaa --- b --- cc| +---------------------+-+-----------------+-+---------------------+ | AlignCtrl < | AlignCtrl > | AlignCtrl | | +---------------------+---------------------+---------------------+ | a - bbb - c | a - bbb - c | a - bbb - c | | aa -- bb -- ccc | aa -- bb -- ccc | aa -- bb -- ccc | | aaa --- b --- cc | aaa --- b --- cc | aaa --- b --- cc | +---------------------+---------------------+---------------------+ < --- *alignctrl-g* gv SELECTIVE APPLICATION *alignctrl-v* {{{3 --- These two options provide a way to select (g) or to deselect (v) lines based on a pattern. Ideally :g/pat/Align would work; unfortunately it results in Align#Align() being called on each line satisfying the pattern separately. > AlignCtrl g pattern < Align will only consider those lines which have the given pattern. > AlignCtrl v pattern < Align will only consider those lines without the given pattern. As an example of use, consider the following example: > :AlignCtrl v ^\s*/\* Original :Align = :Align = +----------------+------------------+----------------+ |one= 2; |one = 2; |one = 2; | |three= 4; |three = 4; |three = 4; | |/* skip=this */ |/* skip = this */ |/* skip=this */ | |five= 6; |five = 6; |five = 6; | +----------------+------------------+----------------+ < The first "Align =" aligned with all "="s, including the one in the "/* skip=this */" comment. The second "Align =" had a AlignCtrl v-pattern which caused it to skip (ignore) the "/* skip=this */" line when aligning. To remove AlignCtrl's g and v patterns, use (as appropriate) > AlignCtrl g AlignCtrl v < To see what g/v patterns are currently active, just use the reporting capability of an unadorned call to AlignCtrl: > AlignCtrl < --- m MAP SUPPORT *alignctrl-m* {{{3 --- This option primarily supports the development of maps. The Align#AlignCtrl() call will first do an Align#AlignPush() (ie. retain current alignment control settings). The next Align#Align() will, in addition to its alignment job, finish up with an Align#AlignPop(). Thus the Align#AlignCtrl settings that follow the "m" are only temporarily in effect for just the next Align#Align(). --- p### *alignctrl-p* P### PADDING *alignctrl-P* {{{3 --- These two options control pre-padding and post-padding with blanks about the separator. One may pad separators with zero to nine spaces; the padding number(s) is/are treated as a cyclic parameter. Thus one may specify padding separately for each field or re-use a padding pattern. > Example: AlignCtrl p102P0 +---------+----------------------------------+ | Original| a=b=c=d=e=f=g=h=1 | | Align = | a =b=c =d =e=f =g =h=1 | +---------+----------------------------------+ | prepad | 1 0 2 1 0 2 1 0 | +---------+----------------------------------+ < This example will cause Align to: pre-pad the first "=" with a single blank, pre-pad the second "=" with no blanks, pre-pad the third "=" with two blanks, pre-pad the fourth "=" with a single blank, pre-pad the fifth "=" with no blanks, pre-pad the sixth "=" with two blanks, etc. --------------- *alignctrl-settings* No option given DISPLAY STATUS *alignctrl-* {{{3 --------------- *alignctrl-no-option* AlignCtrl, when called with no arguments, will display the current alignment control settings. A typical display is shown below: > AlignCtrl<=> qty=1 AlignStyle Padding<1|1> Pat1<\(=\)> < Interpreting, this means that the separator patterns are all equivalent; in this case, there's only one (qty=1). Fields will be padded on the right with spaces (left justification), and separators will be padded on each side with a single space. To change one of these items, see: AlignCtrl......|alignctrl| qty............|align-concept| AlignStyle.....|alignctrl--| |alignctrl-+| |alignctrl-:| |alignctrl-c| Padding........|alignctrl-p| |alignctrl-P| One may get a string which can be fed back into AlignCtrl: > :let alignctrl= Align#AlignCtrl() < This form will put a string describing the current AlignCtrl options, except for the "g" and "v" patterns, into a variable. The Align#AlignCtrl() function will still echo its settings, however. One can feed any non-supported "option" to AlignCtrl() to prevent this, however: > :let alignctrl= Align#AlignCtrl("d") ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{2 If you'd like to have your own default AlignCtrl, you'll be wanting to put it in a file such as: > $HOME/.vim/after/plugin/AlignPlugin.vim < Anything in that file would be sourced at startup, but after your .vimrc and after $HOME/.vim/plugin/AlignPlugin.vim; hence, :Align and :AlignCtrl will then be defined. ALIGNMENT *:Align* *align-align* {{{2 Once the alignment control has been determined, the user specifies a range of lines for the Align command/function to do its thing. Alignment is often done on a line-range basis, but one may also restrict alignment to a visual block using ctrl-v. For any visual mode, one types the colon (:) and then "Align". One may, of course, specify a range of lines: > :[range]Align [list-of-separators] < where the |:range| is the usual Vim-powered set of possibilities; the list of separators is the same as the AlignCtrl capability. There is only one list of separators, but either AlignCtrl or Align can be used to specify that list. An alternative form of the Align command can handle both alignment control and the separator list: > :[range]Align! [alignment-control-string] [list-of-separators] < The alignment control string will be applied only for this particular application of Align (it uses |alignctrl-m|). The "g pattern" and "v pattern" alignment controls (see |alignctrl-g| and |alignctrl-v|) are also available via this form of the Align command. Align makes two passes over the text to be aligned. The first pass determines how many fields there are and determines the maximum sizes of each field; these sizes are then stored in a vector. The second pass pads the field (left/right/centered as specified) to bring its length up to the maximum size of the field. Then the separator and its AlignCtrl-specified padding is appended. Pseudo-Code:~ During pass 1 | For all fields in the current line || Determine current separator || Examine field specified by current separator || Determine length of field and save if largest thus far Initialize newline based on initial whitespace option (wWI) During pass 2 | For all fields in current line || Determine current separator || Extract field specified by current separator || Prepend/append padding as specified by AlignCtrl || (right/left/center)-justify to fit field into max-size field || Append separator with AlignCtrl-specified separator padding || Delete current line, install newly aligned line The g and v AlignCtrl patterns cause the passes not to consider lines for alignment, either by requiring that the g-pattern be present or that the v-pattern not be present. The whitespace on either side of a separator is ignored. ============================================================================== 4. Alignment Maps *alignmaps* *align-maps* {{{1 There are a number of maps provided in the AlignMaps plugin which depend upon the Align plugin. The maps provided by AlignMaps typically start with a leading "t" (for the older "textab" program which Align supercedes) or with an "a" for the more complicated alignment maps. The AlignMaps plugin, although provided in the vimball containing Align.vim, is really a separate plugin (Align doesn't depend on AlignMaps). Consequently, if you'd rather not have AlignMaps's mappings, just use the *:AlignMapsClean* command to remove its components. The :AlignMapsClean command does not remove any maps generated by AlignMaps in the current instance of vim. The maps are shown below with a leading backslash (\). However, the actual maps use the construct (see |mapleader|), so the maps' leading kick-off character is easily customized. Furthermore, all the maps specified by the AlignMaps plugin use the construct (see ||and |usr_41.txt|). Hence, if one wishes to override the mapping(s) entirely, one may do that, too. As an example: > map ACOM AM_acom < would have \ACOM do what \acom previously did (assuming that the mapleader has been left at its default value of a backslash). \a, : useful for breaking up comma-separated declarations prior to \adec |alignmap-a,| \a( : aligns ( and , (useful for prototypes) *alignmap-a(* \a? : aligns (...)? ...:... expressions on ? and : |alignmap-a?| \a< : aligns << and >> for c++ |alignmap-a<| \a= : aligns := assignments |alignmap-a=| \abox : draw a C-style comment box around text lines |alignmap-abox| \acom : useful for aligning comments |alignmap-acom| \adcom: useful for aligning comments in declarations |alignmap-adcom| \anum : useful for aligning numbers |alignmap-anum| NOTE: For the visual-mode use of \anum, is needed! See http://www.drchip.org/astronaut/vim/index.html#VIS \aenum: align a European-style number |alignmap-anum| \aunum: align a USA-style number |alignmap-anum| \adec : useful for aligning declarations |alignmap-adec| \adef : useful for aligning definitions |alignmap-adef| \afnc : useful for aligning ansi-c style functions' argument lists |alignmap-afnc| \adcom: a variant of \acom, restricted to comment |alignmap-adcom| containing lines only, but also only for those which don't begin with a comment. Good for certain declaration styles. \aocom: a variant of \acom, restricted to comment |alignmap-aocom| containing lines only \tab : align a table based on tabs *alignmap-tab* (converts to spaces) \tml : useful for aligning the trailing backslashes |alignmap-tml| used to continue lines (shell programming, etc) \tsp : use Align to make a table separated by blanks |alignmap-tsp| (left justified) \ts, : like \t, but swaps whitespace on the right of *alignmap-ts,* the commas to their left \ts: : like \t: but swaps whitespace on the right of *alignmap-ts:* the colons to their left \ts< : like \t< but swaps whitespace on the right of *alignmap-ts<* the less-than signs to their left \ts= : like \t= but swaps whitespace on the right of *alignmap-ts=* the equals signs to their left \Tsp : use Align to make a table separated by blanks |alignmap-Tsp| (right justified) \tsq : use Align to make a table separated by blanks |alignmap-tsq| (left justified) -- "strings" are not split up \tt : useful for aligning LaTeX tabular tables |alignmap-tt| \Htd : tabularizes html tables: |alignmap-Htd| ...field... ...field... *alignmap-t|* *alignmap-t#* *alignmap-t,* *alignmap-t:* *alignmap-t;* *alignmap-t<* *alignmap-t?* *alignmap-t~* *alignmap-m=* \tx : make a left-justified alignment on character "x" where "x" is: ,:<=@|# |alignmap-t=| \Tx : make a right-justified alignment on character "x" where "x" is: ,:<=@# |alignmap-T=| \m= : like \t= but aligns with %... style comments The leading backslash is actually (see |mapleader| to learn how to customize the leader to be whatever you like). These maps use the package and are defined in the file. Although the maps use AlignCtrl options, they typically use the "m" option which pushes the options (AlignPush). The associated Align call which follows will then AlignPop the user's original options back. ALIGNMENT MAP USE WITH MARK AND MOVE~ In the examples below, one may select the text with a "ma" at the first line, move to the last line, then execute the map. ALIGNMENT MAP USE WITH VISUAL MODE~ Alternatively, one may select the text with the "V" visual mode command. If you want to use visual-block mode (ctrl-v), I suggest using an AlignMap with the vis.vim plugin, available at either stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195 devel : http://www.drchip.org/astronaut/vim/index.html#VIS Use it with commands such as > ctrl-v (move) :B norm \alignmap_sequence < ALIGNMENT MAP USE WITH MENUS~ One may use the mark-and-move style (ma, move, use the menu) or the visual mode style (use the V visual mode, move, then select the alignment map with menu selection). The alignment map menu items are under DrChip.AlignMaps . One may even change the top level menu name to whatever is wished; by default, its > let g:DrChipTopLvlMenu= "DrChip." < If you set the variable to the empty string (""), then no menu items will be produced. Of course, one must have a vim with +menu, the gui must be running, and |'go'| must have the menu bar suboption (ie. m must be included). COMPLEX ALIGNMENT MAP METHOD~ For those complex alignment maps which do alignment on constructs (e.g. \acom, \adec, etc), a series of substitutes is used to insert "@" symbols in appropriate locations. Align#Align() is then used to do alignment directly on "@"s; then it is followed by further substitutes to do clean-up. However, the maps \WS and \WE, used by every map supported by AlignMaps, protect any original embedded "@" symbols by first converting them to characters, doing the requested job, and then converting them back. > \WS calls AlignMaps#WrapperStart() \WE calls AlignMaps#WrapperEnd() < --------------------------- Alignment Map Examples: \a, *alignmap-a,* {{{3 --------------------------- Original: illustrates comma-separated declaration splitting: > int a,b,c; struct ABC_str abc,def; < Becomes: > int a; int b; int c; struct ABC_str abc; struct ABC_str def; < --------------------------- Alignment Map Examples: \a? *alignmap-a?* {{{3 --------------------------- Original: illustrates ()?: aligning > printf("<%s>\n", (x == ABC)? "abc" : (x == DEFG)? "defg" : (x == HIJKL)? "hijkl" : "???"); < Becomes: select "(x == ..." lines, then \a? > printf("<%s>\n", (x == ABC)? "abc" : (x == DEFG)? "defg" : (x == HIJKL)? "hijkl" : "???"); < --------------------------- Alignment Map Examples: \a< *alignmap-a<* {{{3 --------------------------- Original: illustrating aligning of << and >> > cin << x; cin << y; cout << "this is x=" << x; cout << "but y=" << y << "is not"; < Becomes: select "(x == ..." lines, then \a< > cin << x; cin << y; cout << "this is x=" << x; cout << "but y=" << y << "is not"; < --------------------------- Alignment Map Examples: \a= *alignmap-a=* {{{3 --------------------------- Original: illustrates how to align := assignments > aa:=bb:=cc:=1; a:=b:=c:=1; aaa:=bbb:=ccc:=1; < Bcomes: select the three assignment lines, then \a:= > aa := bb := cc := 1; a := b := c := 1; aaa := bbb := ccc := 1; < --------------------------- Alignment Map Examples: \abox *alignmap-abox* {{{3 --------------------------- Original: illustrates how to comment-box some text > This is some plain text which will soon be surrounded by a comment box. < Becomes: Select "This..box." with ctrl-v, press \abox > /*************************** * This is some plain text * * which will * * soon be surrounded by a * * comment box. * ***************************/ < --------------------------- Alignment Map Examples: \acom *alignmap-acom* {{{3 --------------------------- Original: illustrates aligning C-style comments (works for //, too) > if(itworks) { /* this */ then= dothis; /* is a */ } /* set of three comments */ < Becomes: Select the three lines, press \acom > if(itworks) { /* this */ then= dothis; /* is a */ } /* set of three comments */ < Also see |alignmap-aocom| --------------------------- Alignment Map Examples: \anum *alignmap-anum* {{{3 --------------------------- First, note that the behavior of the \anum map depends on the existence of either the vim variable > g:alignmaps_usanumber < or > g:alignmaps_euronumber < when AlignMaps is loaded. Essentially, "usa" numbers use "."s and "euro" numbers use ","s to separate the integer from the fractional portion of a number. "Usa" numbers are default. Original: illustrates how to get numbers lined up > -1.234 .5678 -.901e-4 1.234 5.678 9.01e-4 12.34 56.78 90.1e-4 123.4 567.8 901.e-4 < Becomes: Go to first line, ma. Go to last line, press \anum > -1.234 .5678 -.901e-4 1.234 5.678 9.01e-4 12.34 56.78 90.1e-4 123.4 567.8 901.e-4 < Original: > | -1.234 .5678 -.901e-4 | | 1.234 5.678 9.01e-4 | | 12.34 56.78 90.1e-4 | | 123.4 567.8 901.e-4 | < Becomes: Select the numbers with ctrl-v (visual-block mode), > press \anum | -1.234 .5678 -.901e-4 | | 1.234 5.678 9.01e-4 | | 12.34 56.78 90.1e-4 | | 123.4 567.8 901.e-4 | < Original: > -1,234 ,5678 -,901e-4 1,234 5,678 9,01e-4 12,34 56,78 90,1e-4 123,4 567,8 901,e-4 < Becomes: (assuming g:alignmaps_euronumber exists) Go to first line, ma. Go to last line, press \anum > -1,234 ,5678 -,901e-4 1,234 5,678 9,01e-4 12,34 56,78 90,1e-4 123,4 567,8 901,e-4 < In addition: \aenum is provided to support European-style numbers \aunum is provided to support USA-style numbers *g:alignmaps_usanumber* *g:alignmaps_euronumber* One may get \aenum behavior for \anum by putting > let g:alignmaps_euronumber= 1 < or \aunum behavior for \anum by putting > let g:alignmaps_usanumber= 1 < in one's <.vimrc>. --------------------------- Alignment Map Examples: \ascom *alignmap-ascom* {{{3 --------------------------- Original: > /* A Title */ int x; /* this is a comment */ int yzw; /* this is another comment*/ < Becomes: Select the three lines, press \ascom > /* A Title */ int x; /* this is a comment */ int yzw; /* this is another comment */ < --------------------------- Alignment Map Examples: \adec *alignmap-adec* {{{3 --------------------------- Original: illustrates how to clean up C/C++ declarations > int a; float b; double *c=NULL; char x[5]; struct abc_str abc; struct abc_str *pabc; int a; /* a */ float b; /* b */ double *c=NULL; /* b */ char x[5]; /* x[5] */ struct abc_str abc; /* abc */ struct abc_str *pabc; /* pabc */ static int a; /* a */ static float b; /* b */ static double *c=NULL; /* b */ static char x[5]; /* x[5] */ static struct abc_str abc; /* abc */ static struct abc_str *pabc; /* pabc */ < Becomes: Select the declarations text, then \adec > int a; float b; double *c = NULL; char x[5]; struct abc_str abc; struct abc_str *pabc; int a; /* a */ float b; /* b */ double *c = NULL; /* b */ char x[5]; /* x[5] */ struct abc_str abc; /* abc */ struct abc_str *pabc; /* pabc */ static int a; /* a */ static float b; /* b */ static double *c = NULL; /* b */ static char x[5]; /* x[5] */ static struct abc_str abc; /* abc */ static struct abc_str *pabc; /* pabc */ < --------------------------- Alignment Map Examples: \adef *alignmap-adef* {{{3 --------------------------- Original: illustrates how to line up #def'initions > #define ONE 1 #define TWO 22 #define THREE 333 #define FOUR 4444 < Becomes: Select four definition lines, apply \adef > # define ONE 1 # define TWO 22 # define THREE 333 # define FOUR 4444 < --------------------------- Alignment Map Examples: \afnc *alignmap-afnc* {{{3 --------------------------- This map is an exception to the usual selection rules. It uses "]]" to find the function body's leading "{". Just put the cursor anywhere in the function arguments and the entire function declaration should be processed. Because "]]" looks for that "{" in the first column, the "original" and "becomes" examples are in the first column, too. Original: illustrates lining up ansi-c style function definitions > int f( struct abc_str ***a, /* one */ long *b, /* two */ int c) /* three */ { } < Becomes: put cursor anywhere before the '{', press \afnc > int f( struct abc_str ***a, /* one */ long *b, /* two */ int c) /* three */ { } < --------------------------- Alignment Map Examples: \adcom *alignmap-adcom* {{{3 --------------------------- Original: illustrates aligning comments that don't begin lines (optionally after some whitespace). > struct { /* this is a test */ int x; /* of how */ double y; /* to use adcom */ }; < Becomes: Select the inside lines of the structure, then press \adcom. The comment-only line is ignored but the other two comments get aligned. > struct { /* this is a test */ int x; /* of how */ double y; /* to use adcom */ }; < --------------------------- Alignment Map Examples: \aocom *alignmap-aocom* {{{3 --------------------------- Original: illustrates how to align C-style comments (works for //, too) but restricted only to aligning with those lines containing comments. See the difference from \acom (|alignmap-acom|). > if(itworks) { /* this comment */ then= dothis; } /* only appears on two lines */ < Becomes: Select the three lines, press \aocom > if(itworks) { /* this comment */ then= dothis; } /* only appears on two lines */ < Also see |alignmap-acom| --------------------------- *alignmap-Tsp* Alignment Map Examples: \tsp *alignmap-tsp* {{{3 --------------------------- Normally Align can't use white spaces for field separators as such characters are ignored surrounding field separators. The \tsp and \Tsp maps get around this limitation. Original: > one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen < Becomes: Select the lines, \tsp > one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen < Becomes: Select the lines, \Tsp > one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen < --------------------------- Alignment Map Examples: \tsq *alignmap-tsq* {{{3 --------------------------- The \tsp map is useful for aligning tables based on white space, but sometimes one wants double-quoted strings to act as a single object in spite of embedded spaces. The \tsq map was invented to support this. (thanks to Leif Wickland) Original: > "one two" three four "five six" < Becomes: Select the lines, \tsq > "one two" three four "five six" < --------------------------- Alignment Map Examples: \tt *alignmap-tt* {{{3 --------------------------- Original: illustrates aligning a LaTex Table > \begin{tabular}{||c|l|r||} \hline\hline one&two&three\\ \hline four&five&six\\ seven&eight&nine\\ \hline\hline \end{tabular} < Becomes: Select the three lines inside the table > (ie. one..,four..,seven..) and press \tt \begin{tabular}{||c|l|r||} \hline\hline one & two & three \\ \hline four & five & six \\ seven & eight & nine \\ \hline\hline \end{tabular} < ---------------------------- Alignment Map Examples: \tml *alignmap-tml* {{{3 ---------------------------- Original: illustrates aligning multi-line continuation marks > one \ two three \ four five six \ seven \\ \ eight \nine \ ten \ < Becomes: > one \ two three \ four five six \ seven \\ \ eight \nine \ ten \ < --------------------------- Alignment Map Examples: \t= *alignmap-t=* {{{3 --------------------------- Original: illustrates left-justified aligning of = > aa=bb=cc=1;/*one*/ a=b=c=1;/*two*/ aaa=bbb=ccc=1;/*three*/ < Becomes: Select the three equations, press \t= > aa = bb = cc = 1; /* one */ a = b = c = 1; /* two */ aaa = bbb = ccc = 1; /* three */ < --------------------------- Alignment Map Examples: \T= *alignmap-T=* {{{3 --------------------------- Original: illustrates right-justified aligning of = > aa=bb=cc=1; /* one */ a=b=c=1; /* two */ aaa=bbb=ccc=1; /* three */ < Becomes: Select the three equations, press \T= > aa = bb = cc = 1; /* one */ a = b = c = 1; /* two */ aaa = bbb = ccc = 1; /* three */ < --------------------------- Alignment Map Examples: \Htd *alignmap-Htd* {{{3 --------------------------- Original: for aligning tables with html > ...field one......field two... ...field three......field four... < Becomes: Select ... lines, press \Htd > ...field one... ...field two... ...field three... ...field four... < ============================================================================== 4. Alignment Tools' History *align-history* {{{1 ALIGN HISTORY {{{2 v37 Nov 29, 2012 * (Kim Jang-hwan) reported that with g:Align_xstrlen set to 3 that the cursor was moved (linewise) after invocation. Fixed. Jan 07, 2013 * now has visual mode mappings to accompany all normal mode mappings (use |V| to invoke) v36 May 20, 2009 * Previously, the "W" AlignCtrl setting, intended to retain initial white space, did so by convert- ing any leading tabs into an equivalent quantity of blanks (using the current tabstop setting). Align will now retain leading tabs. Nov 24, 2009 * QArgSplitter() used split(), intending to split on white space only. However, the \tab map uses ctrl-o as a separator instead of tabs; the split() function treated the ctrl-o as a whitespace character, too. Solution: give split() an explicit pattern matching blanks and tabs, only. \tab now works again! Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support May 10, 2011 * if the range is only one line, then Align will automatically grow the range to accommodate all lines containing the first separator pattern surrounding the current line. Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to specify a function by name which computes string length. Oct 27, 2011 * (reported by Fco Javier) reported a problem with the default s:Strlen() result; there was a missing "let". Fixed. Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when it should've been doing "setlocal noet". Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when g:Align_xstrlen is zero. v35 Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading installed Nov 19, 2008 * new sanity check for an AlignStyle of just ":" Jan 08, 2009 * save&restore of |'mod'| now done with local variant v34 Jul 08, 2008 * using :AlignCtrl before entering any alignment control commands was causing an error. v33 Sep 20, 2007 * s:Strlen() introduced to support various ways used to represent characters and their effects on string lengths. See |align-strlen|. * Align now accepts "..." -- so it can accept whitespace as separators. v32 Aug 18, 2007 * uses || instead of || plus a custom argument splitter to allow patterns with backslashes to slide in unaltered. v31 Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s) implemented. v30 Feb 12, 2007 * now uses |setline()| v29 Jan 18, 2006 * cecutil updated to use keepjumps Feb 23, 2006 * Align now converted to vim 7.0 style using auto-loading functions. v28 Aug 17, 2005 * report option workaround Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed v27 Apr 15, 2005 * cpo workaround ignorecase workaround v26 Aug 20, 2004 * loaded_align now also indicates version number GetLatestVimScripts :AutoInstall: now supported v25 Jul 27, 2004 * For debugging, uses Dfunc(), Dret(), and Decho() v24 Mar 03, 2004 * (should've done this earlier!) visualmode(1) not supported until v6.2, now Align will avoid calling it for earlier versions. Visualmode clearing won't take place then, of course. v23 Oct 07, 2003 * Included Leif Wickland's ReplaceQuotedSpaces() function which supports \tsq v22 Jan 29, 2003 * Now requires 6.1.308 or later to clear visualmode() v21 Jan 10, 2003 * BugFix: similar problem to #19; new code bypasses "norm! v\" until initialization is over. v20 Dec 30, 2002 * BugFix: more on "unable to highlight" fixed v19 Nov 21, 2002 * BugFix: some terminals gave an "unable to highlight" message at startup; Hari Krishna Dara tracked it down; a silent! now included to prevent noise. v18 Nov 04, 2002 * BugFix: re-enabled anti-repeated-loading v17 Nov 04, 2002 * BugFix: forgot to have AlignPush() push s:AlignSep AlignCtrl now clears visual-block mode when used so that Align won't try to use old visual-block selection marks '< '> v16 Sep 18, 2002 * AlignCtrl <>| options implemented (separator justification) v15 Aug 22, 2002 * bug fix: AlignCtrl's ":" now acts as a modifier of the preceding alignment operator (lrc) v14 Aug 20, 2002 * bug fix: AlignCtrl default now keeps &ic unchanged bug fix: Align, on end-field, wasn't using correct alignop bug fix: Align, on end-field, was appending padding v13 Aug 19, 2002 * bug fix: zero-length g/v patterns are accepted bug fix: always skip blank lines bug fix: AlignCtrl default now also clears g and v patterns v12 Aug 16, 2002 * moved keep_ic above zero-length pattern checks added "AlignCtrl default" fixed bug with last field getting separator spaces at end line v11 Jul 08, 2002 * prevent separator patterns which match zero length -+: included as additional alignment/justification styles v10 Jun 26, 2002 * =~# used instead of =~ (for matching case) ignorecase option handled v09 Jun 25, 2002 * implemented cyclic padding ALIGNMENT MAP HISTORY *alignmap-history* {{{2 v43 Nov 28, 2012 * changed a lot of maps to use nnoremap (instead of map) Jan 07, 2013 * v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum Feb 16, 2010 * map for \t=, \T= now handles x++ = something; for c, c++ correctly. Oct 29, 2010 * added a note on having one's own default AlignCtrl (see |alignctrl-init|) Feb 22, 2011 * for menus, &go =~# used to insure correct case Jun 10, 2011 * |:AlignMapsClean| command provided to make it easy for those who would prefer not to have AlignMaps' maps not to have them. v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent re-loading installed * AlignMaps now use 0x0f (ctrl-p) for special character substitutions (instead of 0xff). Seems to avoid some problems with having to use Strlen(). * bug fixed with \ts, * new maps: \ts; \ts, \ts: \ts< \ts= \a( v40 Oct 21, 2008 * Modified AlignMaps so that its maps use s and ".st.et exec "Snippet html lang=\"".st."en".et."\">".st.et."" exec "Snippet h3

".st.et."

".st.et exec "Snippet h4

".st.et."

".st.et exec "Snippet h5
".st.et."
".st.et exec "Snippet h6
".st.et."
".st.et exec "Snippet fieldset
".st.et."
".st.et exec "Snippet noscript ".st.et exec "Snippet ul
    ".st.et."
".st.et exec "Snippet xml ".st.et exec "Snippet body ".st.et."".st.et exec "Snippet legend ".st.et."".st.et exec "Snippet title ".st."PageTitle".et."".st.et exec "Snippet scriptsrc ".st.et exec "Snippet img \"".st.et."\"".st.et exec "Snippet option ".st.et exec "Snippet optgroup ".st.et."".st.et exec "Snippet meta ".st.et exec "Snippet td ".st.et."".st.et exec "Snippet dt
".st.et."
".st.et."
".st.et exec "Snippet tfoot ".st.et."".st.et exec "Snippet div
".st.et."
".st.et exec "Snippet ol
    ".st.et."
".st.et exec "Snippet txtarea ".st.et exec "Snippet mailto
".st.et."".st.et exec "Snippet table ".st.et."
".st.et exec "Snippet hint ".st.et."".st.et exec "Snippet link ".st.et exec "Snippet form
".st.et."".st.et exec "Snippet tr ".st.et."".st.et exec "Snippet label ".st.et exec "Snippet image \"".st.et."\"".st.et exec "Snippet input ".st.et exec "Snippet select ".st.et exec "Snippet style ".st.et exec "Snippet divheader

".st."CompanyName".et."

".st.et exec "Snippet base ".st.et vim-scripts-20130814ubuntu1/after/ftplugin/phpdoc_snippets.vim0000644000000000000000000000364212204336073021325 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet doc_d /*** ".st."undocumentedConstant".et."**/define(".st.et.", ".st.et.");".st.et."".st.et exec "Snippet doc_vp /*** ".st."undocumentedClassVariable".et."** @var ".st."string".et.st.et."**/".st.et."" exec "Snippet doc_f /*** ".st."undocumentedFunction".et."** @return ".st."void".et."* @author ".st.et."**/".st.et."function ".st.et."(".st.et."){".st.et."}".st.et exec "Snippet doc_s /*** ".st."undocumentedFunction".et."** @return ".st."void".et."* @author ".st.et."**/".st.et."function ".st.et."(".st.et.");".st.et exec "Snippet doc_h /*** ".st.et."** @author ".st.et."* @version $Id$* @copyright ".st.et.", ".st.et."* @package ".st."default".et."**//*** Define DocBlock**/".st.et exec "Snippet doc_fp /*** ".st."undocumentedFunction".et."** @return ".st."void".et."* @author ".st.et."**/".st.et."" exec "Snippet doc_i /*** ".st."undocumentedClass".et."** @package ".st."default".et."* @author ".st.et."**/interface ".st.et."{".st.et."} // END interface ".st.et."".st.et exec "Snippet doc_fp /*** ".st."undocumentedConstant".et.st.et."**/".st.et."".st.et exec "Snippet doc_v /*** ".st."undocumentedClassVariable".et."** @var ".st."string".et."**/ $".st.et.";".st.et."".st.et exec "Snippet doc_cp /*** ".st."undocumentedClass".et."** @package ".st."default".et."* @author ".st.et."**/".st.et exec "Snippet doc_c /*** ".st."undocumentedClass".et."** @package ".st."default".et."* @author ".st.et."**/".st."class".et."class ".st."a".et."{".st.et."} // END ".st."class".et."class ".st."a".et."".st.et vim-scripts-20130814ubuntu1/after/ftplugin/template_toolkit_snippets.vim0000644000000000000000000000111212204336073023416 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet wrap [% WRAPPER ".st."template".et." %]".st.et."[% END %]".st.et exec "Snippet if [% IF ".st."condition".et." %]".st.et."[% ELSE %]".st.et."[% END %]".st.et exec "Snippet unl [% UNLESS ".st."condition".et." %]".st.et."[% END %]".st.et exec "Snippet inc [% INCLUDE ".st."template".et." %]".st.et exec "Snippet for [% FOR ".st."var".et." IN ".st."set".et." %]".st.et."[% END %]".st.et vim-scripts-20130814ubuntu1/after/ftplugin/javascript_snippets.vim0000644000000000000000000000056312204336073022215 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet proto ".st."className".et.".prototype.".st."methodName".et." = function(".st.et."){".st.et."};".st.et exec "Snippet fun function ".st."functionName".et." (".st.et."){".st.et."}".st.et vim-scripts-20130814ubuntu1/after/ftplugin/smarty_snippets.vim0000644000000000000000000000470412204336073021367 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet {cycle {cycle values=\"#SELSTART#".st."foo".et.",".st."bar".et."#SELEND#\" name=\"default\" print=true advance=true delimiter=\",\" assign=varname }".st.et exec "Snippet |regex_replace |regex_replace:\"".st."regex".et."\":\"".st.et."\"".st.et exec "Snippet {counter {counter name=\"#INSERTION#\" start=1 skip=1 direction=\"up\" print=trueassign=\"foo\" }{counter}".st.et exec "Snippet {eval {eval var=\"#SELSTART#{template_format}#SELEND#\" assign=varname} ".st.et "Snippet |date_format |date_format:"${1:strftime() formatting}" <{}> exec "Snippet |truncate |truncate:".st.et.":".st.et.":".st."false".et."" exec "Snippet {if {if ".st."varname".et.st.et."\"".st."foo".et."\"}{* $varname can also be a php call *}".st.et."{/if}".st.et "Snippet |string_format |string_format:"${1:sprintf formatting}" <{}> exec "Snippet {assign {assign var=".st.et." value=\"".st.et."\"}".st.et exec "Snippet {foreach {foreach from=".st."varname".et." item=i [key=k name=\"\"] }".st.et."{/foreach}".st.et exec "Snippet {capture {capture name=#INSERTION#}#SELECT#{/capture}".st.et exec "Snippet |wordwrap |wordwrap:".st.et.":\"".st.et."\":".st.et exec "Snippet |spacify |spacify:\"".st.et."\"".st.et." " exec "Snippet |default |default:\"".st.et."\"".st.et exec "Snippet {debug {debug output=\"#SELSTART#".st.et."#SELEND#\" }".st.et exec "Snippet |replace |replace:\"".st."needle".et."\":\"".st.et."\"".st.et exec "Snippet {include {include file=\"".st.et."\" [assign=varname foo=\"bar\"] }".st.et exec "Snippet |escape |escape:\"".st.et."\"".st.et exec "Snippet {strip {strip}".st.et."{/strip}".st.et exec "Snippet {math {math equation=\"".st.et."\" assign=".st.et." ".st.et."}".st.et exec "Snippet {config_load {config_load file=\"#INSERTION#\" [section=\"\" scope=\"local|parent|global\"] }".st.et exec "Snippet |cat |cat:\"".st.et."\"".st.et exec "Snippet {insert {insert name=\"insert_".st.et."\" [assign=varname script=\"foo.php\" foo=\"bar\"] }".st.et exec "Snippet {fetch {fetch file=\"#SELSTART#http:// or file#SELEND#\" assign=varname}".st.et exec "Snippet {literal {literal}".st.et."{/literal}".st.et exec "Snippet {include_php {include_php file=\"".st.et."\" [once=true]}".st.et exec "Snippet |strip |strip:[\"".st.et."\"]".st.et vim-scripts-20130814ubuntu1/after/ftplugin/python_snippets.vim0000644000000000000000000001523712204336073021374 0ustar if !exists('loaded_snippet') || &cp finish endif " Given a string containing a list of arguments (e.g. "one, two = 'test'"), " this function cleans it up by removing useless whitespace and commas. function! PyCleanupArgs(text) if a:text == 'args' return '' endif let text = substitute(a:text, '\(\w\)\s\(\w\)', '\1,\2', 'g') return join(split(text, '\s*,\s*'), ', ') endfunction " Given a string containing a list of arguments (e.g. "one = 'test', *args, " **kwargs"), this function returns a string containing only the variable " names, separated by spaces, e.g. "one two". function! PyGetVarnamesFromArgs(text) let text = substitute(a:text, 'self,*\s*', '', '') let text = substitute(text, '\*\*\?\k\+', '', 'g') let text = substitute(text, '=.\{-},', '', 'g') let text = substitute(text, '=.\{-}$', '', 'g') let text = substitute(text, '\s*,\s*', ' ', 'g') if text == ' ' return '' endif return text endfunction " Returns the current indent as a string. function! PyGetIndentString() if &expandtab let tabs = indent('.') / &shiftwidth let tabstr = repeat(' ', &shiftwidth) else let tabs = indent('.') / &tabstop let tabstr = '\t' endif return repeat(tabstr, tabs) endfunction " Given a string containing a list of arguments (e.g. "one = 'test', *args, " **kwargs"), this function returns them formatted correctly for the " docstring. function! PyGetDocstringFromArgs(text) let text = PyGetVarnamesFromArgs(a:text) if a:text == 'args' || text == '' return '' endif let indent = PyGetIndentString() let st = g:snip_start_tag let et = g:snip_end_tag let docvars = map(split(text), 'v:val." -- ".st.et') return '\n'.indent.join(docvars, '\n'.indent).'\n'.indent endfunction " Given a string containing a list of arguments (e.g. "one = 'test', *args, " **kwargs"), this function returns them formatted as a variable assignment in " the form "self._ONE = ONE", as used in class constructors. function! PyGetVariableInitializationFromVars(text) let text = PyGetVarnamesFromArgs(a:text) if a:text == 'args' || text == '' return '' endif let indent = PyGetIndentString() let st = g:snip_start_tag let et = g:snip_end_tag let assert_vars = map(split(text), '"assert ".v:val." ".st.et') let assign_vars = map(split(text), '"self._".v:val." = ".v:val') let assertions = join(assert_vars, '\n'.indent) let assignments = join(assign_vars, '\n'.indent) return assertions.'\n'.indent.assignments.'\n'.indent endfunction " Given a string containing a list of arguments (e.g. "one = 'test', *args, " **kwargs"), this function returns them with the default arguments removed. function! PyStripDefaultValue(text) return substitute(a:text, '=.*', '', 'g') endfunction " Returns the number of occurences of needle in haystack. function! Count(haystack, needle) let counter = 0 let index = match(a:haystack, a:needle) while index > -1 let counter = counter + 1 let index = match(a:haystack, a:needle, index+1) endwhile return counter endfunction " Returns replacement if the given subject matches the given match. " Returns the subject otherwise. function! PyReplace(subject, match, replacement) if a:subject == a:match return a:replacement endif return a:subject endfunction " Returns the % operator with a tuple containing n elements appended, where n " is the given number. function! PyHashArgList(count) if a:count == 0 return '' endif let st = g:snip_start_tag let et = g:snip_end_tag return ' % ('.st.et.repeat(', '.st.et, a:count - 1).')' endfunction let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim " Note to users: The following method of defininf snippets is to allow for " changes to the default tags. " Feel free to define your own as so: " Snippet mysnip This is the expansion text.<{}> " There is no need to use exec if you are happy to hardcode your own start and " end tags " Properties, setters and getters. exec "Snippet prop ".st."attribute".et." = property(get_".st."attribute".et.", set_".st."attribute".et.st.et.")".st.et exec "Snippet get def get_".st."name".et."(self):return self._".st."name".et."".st.et exec "Snippet set def set_".st."name".et."(self, ".st."value".et."): \self._".st."name".et." = ".st."value:PyStripDefaultValue(@z)".et." \".st.et " Functions and methods. exec "Snippet def def ".st."fname".et."(".st."args:PyCleanupArgs(@z)".et."): \\"\"\" \".st.et." \".st."args:PyGetDocstringFromArgs(@z)".et."\"\"\" \".st."pass".et." \".st.et exec "Snippet cm ".st."class".et." = classmethod(".st."class".et.")".st.et " Class definition. exec "Snippet cl class ".st."ClassName".et."(".st."object".et."): \\"\"\" \This class represents ".st.et." \\"\"\" \ \def __init__(self, ".st."args:PyCleanupArgs(@z)".et."): \\"\"\" \Constructor. \".st."args:PyGetDocstringFromArgs(@z)".et."\"\"\" \".st."args:PyGetVariableInitializationFromVars(@z)".et.st.et " Keywords exec "Snippet for for ".st."variable".et." in ".st."ensemble".et.":".st."pass".et."".st.et exec "Snippet pf print '".st."s".et."'".st."s:PyHashArgList(Count(@z, '%[^%]'))".et."".st.et exec "Snippet im import ".st."module".et."".st.et exec "Snippet from from ".st."module".et." import ".st.'name:PyReplace(@z, "name", "*")'.et."".st.et exec "Snippet % '".st."s".et."'".st."s:PyHashArgList(Count(@z, '%[^%]'))".et.st.et exec "Snippet ass assert ".st."expression".et.st.et " From Kib2 exec "Snippet bc \"\"\"".st.et."\"\"\"".st.et " Try, except, finally. exec "Snippet trye try: \".st.et." \except Exception, e: \".st.et." \".st.et exec "Snippet tryf try: \".st.et." \finally: \".st.et." \".st.et exec "Snippet tryef try: \".st.et." \except Exception, e: \".st.et." \finally: \".st.et." \".st.et " Other multi statement templates " From Panos exec "Snippet ifn if __name__ == '".st."main".et."':".st.et exec "Snippet ifmain if __name__ == '__main__':".st.et " Shebang exec "Snippet sb #!/usr/bin/env python# -*- coding: ".st."encoding".et." -*-".st.et exec "Snippet sbu #!/usr/bin/env python# -*- coding: UTF-8 -*-".st.et " From Kib2 exec "Snippet sbl1 #!/usr/bin/env python# -*- coding: Latin-1 -*-".st.et " Unit tests. exec "Snippet unittest if __name__ == '__main__': \import unittest \ \class ".st."ClassName".et."Test(unittest.TestCase): \def setUp(self): \".st."pass".et." \ \def runTest(self): \".st.et vim-scripts-20130814ubuntu1/after/ftplugin/c_snippets.vim0000644000000000000000000000577712204336073020305 0ustar if !exists('loaded_snippet') || &cp finish endif function! Count(haystack, needle) let counter = 0 let index = match(a:haystack, a:needle) while index > -1 let counter = counter + 1 let index = match(a:haystack, a:needle, index+1) endwhile return counter endfunction function! CArgList(count) " This returns a list of empty tags to be used as " argument list placeholders for the call to printf let st = g:snip_start_tag let et = g:snip_end_tag if a:count == 0 return "" else return repeat(', '.st.et, a:count) endif endfunction function! CMacroName(filename) let name = a:filename let name = substitute(name, '\.','_','g') let name = substitute(name, '\(.\)','\u\1','g') return name endfunction let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet do do{".st.et."} while (".st.et.");".st.et exec "Snippet readfile std::vector v;if(FILE* fp = fopen(\"".st."filename".et."\", \"r\")){uint8_t buf[1024];while(size_t len = fread(buf, 1, sizeof(buf), fp))v.insert(v.end(), buf, buf + len);fclose(fp);}".st.et exec "Snippet beginend ".st."v".et.".begin(), ".st."v".et.".end()".st.et exec "Snippet once #ifndef ``CMacroName(expand('%'))``_#define ``CMacroName(expand('%'))``_".st.et."#endif /* ``CMacroName(expand('%'))``_ */" "exec "Snippet once #ifndef _".st."file:substitute(expand('%'),'\\(.\\)','\\u\\1','g')".et."_#define _".st."file".et."_".st.et."#endif /* _".st."file".et."_ */".st.et exec "Snippet class class ".st."name".et."{public:".st."name".et." (".st."arguments".et.");virtual ~".st."name".et."();private:".st.et."};".st.et " TODO This is a good one but I can't quite work out the syntax yet exec "Snippet printf printf(\"".st."\"%s\"".et."\\n\"".st."\"%s\":CArgList(Count(@z, '%[^%]'))".et.");".st.et exec "Snippet vector std::vector<".st."char".et."> v".st.et.";" exec "Snippet struct struct ".st."name".et."{".st.et."};".st.et exec "Snippet template template ".st.et " TODO this one as well. Wish I knew more C " Snippet namespace namespace ${1:${TM_FILENAME/(.*?)\\..*/\\L$1/}}\n{\n\t$0\n};.st.et exec "Snippet namespace namespace ".st.":substitute(expand('%'),'.','\\l&', 'g')".et."{".st.et."};".st.et exec "Snippet map std::map<".st."key".et.", ".st."value".et."> map".st.et.";".st.et exec "Snippet mark #if 0".st.et."#endif".st.et exec "Snippet if if(".st.et."){".st.et."}".st.et exec "Snippet main int main (int argc, char const* argv[]){".st.et."return 0;}".st.et exec "Snippet Inc #include <".st.et.">".st.et exec "Snippet inc #include \"".st.et.".h\"".st.et exec "Snippet for for( ".st.et." ".st."i".et." = ".st.et."; ".st."i".et." < ".st."count".et."; ".st."i".et." += ".st.et."){".st.et."}".st.et vim-scripts-20130814ubuntu1/after/ftplugin/c.vim0000644000000000000000000000007712204336073016344 0ustar " OmniCppComplete initialization call omni#cpp#complete#Init() vim-scripts-20130814ubuntu1/after/ftplugin/haskell_snippets.vim0000644000000000000000000000027612204336073021473 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet mod module: ".st.et." where".st.et vim-scripts-20130814ubuntu1/after/ftplugin/perl_snippets.vim0000644000000000000000000000324112204336073021005 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet sub sub ".st."FunctionName".et." {".st.et."}".st.et exec "Snippet class package ".st."ClassName".et.";".st.et.st."ParentClass".et.st.et.";sub new {my \$class = shift;\$class = ref \$class if ref \$class;my $self = bless {}, \$class;\$self;}1;".st.et exec "Snippet xfore ".st."expression".et." foreach @".st."array".et.";".st.et exec "Snippet xwhile ".st."expression".et." while ".st."condition".et.";".st.et exec "Snippet xunless ".st."expression".et." unless ".st."condition".et.";".st.et exec "Snippet slurp my $".st."var".et.";{ local $/ = undef; local *FILE; open FILE, \"<".st."file".et.">\"; $".st."var".et." = ; close FILE }".st.et exec "Snippet if if (".st.et.") {".st.et."}".st.et exec "Snippet unless unless (".st.et.") {".st.et."}".st.et exec "Snippet ifee if (".st.et.") {".st.et."} elsif (".st.et.") {".st.et."} else {".st.et."}".st.et exec "Snippet ife if (".st.et.") {".st.et."} else {".st.et."}".st.et exec "Snippet for for (my \$".st."var".et." = 0; \$".st."var".et." < ".st."expression".et."; \$".st."var".et."++) {".st.et."}".st.et exec "Snippet fore foreach my \$".st."var".et." (@".st."array".et.") {".st.et."}".st.et exec "Snippet eval eval {".st.et."};if ($@) {".st.et."}".st.et exec "Snippet while while (".st.et.") {".st.et."}".st.et exec "Snippet xif ".st."expression".et." if ".st."condition".et.";".st.et vim-scripts-20130814ubuntu1/after/ftplugin/actionscript_snippets.vim0000644000000000000000000000034612204336073022550 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet dm duplicateMovieClip(".st."target".et.", ".st."newName".et.", ".st."depth".et.");" vim-scripts-20130814ubuntu1/after/ftplugin/rails_snippets.vim0000644000000000000000000001023712204336073021160 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet mrnt rename_table \"".st."oldTableName".et."\", \"".st."newTableName".et."\"".st.et exec "Snippet rfu render :file => \"".st."filepath".et."\", :use_full_path => ".st."false".et.st.et exec "Snippet rns render :nothing => ".st."true".et.", :status => ".st.et.st.et exec "Snippet ri render :inline => \"".st.et."\")>\"".st.et exec "Snippet rt render :text => \"".st.et."\"".st.et exec "Snippet mcc t.column \"".st."title".et."\", :".st."string".et.st.et exec "Snippet rpl render :partial => \"".st."item".et."\", :locals => { :".st."name".et." => \"".st."value".et."\"".st.et." }".st.et exec "Snippet rea redirect_to :action => \"".st."index".et."\"".st.et exec "Snippet rtlt render :text => \"".st.et."\", :layout => ".st."true".et.st.et exec "Snippet ft <%= form_tag :action => \"".st."update".et."\" %>".st.et exec "Snippet forin <% for ".st."item".et." in ".st.et." %><%= ".st."item".et.".".st."name".et." %><% end %>".st.et exec "Snippet lia <%= link_to \"".st.et."\", :action => \"".st."index".et."\" %>".st.et exec "Snippet rl render :layout => \"".st."layoutname".et."\"".st.et exec "Snippet ra render :action => \"".st."action".et."\"".st.et exec "Snippet mrnc rename_column \"".st."table".et."\", \"".st."oldColumnName".et."\", \"".st."newColumnName".et."\"".st.et exec "Snippet mac add_column \"".st."table".et."\", \"".st."column".et."\", :".st."string".et.st.et exec "Snippet rpc render :partial => \"".st."item".et."\", :collection => ".st."items".et.st.et exec "Snippet rec redirect_to :controller => \"".st."items".et."\"".st.et exec "Snippet rn render :nothing => ".st."true".et.st.et exec "Snippet lic <%= link_to \"".st.et."\", :controller => \"".st.et."\" %>".st.et exec "Snippet rpo render :partial => \"".st."item".et."\", :object => ".st."object".et.st.et exec "Snippet rts render :text => \"".st.et."\", :status => ".st.et exec "Snippet rcea render_component :action => \"".st."index".et."\"".st.et exec "Snippet recai redirect_to :controller => \"".st."items".et."\", :action => \"".st."show".et."\", :id => ".st.et exec "Snippet mcdt create_table \"".st."table".et."\" do |t|".st.et."end".st.et exec "Snippet ral render :action => \"".st."action".et."\", :layout => \"".st."layoutname".et."\"".st.et exec "Snippet rit render :inline => \"".st.et."\", :type => ".st.et exec "Snippet rceca render_component :controller => \"".st."items".et."\", :action => \"".st."index".et."\"".st.et exec "Snippet licai <%= link_to \"".st.et."\", :controller => \"".st."items".et."\", :action => \"".st."edit".et."\", :id => ".st.et." %>".st.et exec "Snippet verify verify :only => [:".st.et."], :method => :post, :render => {:status => 500, :text => \"use HTTP-POST\"}".st.et exec "Snippet mdt drop_table \"".st."table".et."\"".st.et exec "Snippet rp render :partial => \"".st."item".et."\"".st.et exec "Snippet rcec render_component :controller => \"".st."items".et."\"".st.et exec "Snippet mrc remove_column \"".st."table".et."\", \"".st."column".et."\"".st.et exec "Snippet mct create_table \"".st."table".et."\" do |t|".st.et."end".st.et exec "Snippet flash flash[:".st."notice".et."] = \"".st.et."\"".st.et exec "Snippet rf render :file => \"".st."filepath".et."\"".st.et exec "Snippet lica <%= link_to \"".st.et."\", :controller => \"".st."items".et."\", :action => \"".st."index".et."\" %>".st.et exec "Snippet liai <%= link_to \"".st.et."\", :action => \"".st."edit".et."\", :id => ".st.et." %>".st.et exec "Snippet reai redirect_to :action => \"".st."show".et."\", :id => ".st.et exec "Snippet logi logger.info \"".st.et."\"".st.et exec "Snippet marc add_column \"".st."table".et."\", \"".st."column".et."\", :".st."string".et."".st.et."".st.et exec "Snippet rps render :partial => \"".st."item".et."\", :status => ".st.et exec "Snippet ril render :inline => \"".st.et."\", :locals => { ".st.et." => \"".st."value".et."\"".st.et." }".st.et exec "Snippet rtl render :text => \"".st.et."\", :layout => \"".st.et."\"".st.et exec "Snippet reca redirect_to :controller => \"".st."items".et."\", :action => \"".st."list".et."\"".st.et vim-scripts-20130814ubuntu1/after/ftplugin/propel_snippets.vim0000644000000000000000000000157612204336073021355 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet ".st.et exec "Snippet ".st.et."".st.et exec "Snippet
".st.et exec "Snippet ".st.et exec "Snippet

".st.et exec "Snippet \"/>".st.et vim-scripts-20130814ubuntu1/after/ftplugin/markdown_snippets.vim0000644000000000000000000000040412204336073021663 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet img ![".st."altText".et."](".st."SRC".et.")".st.et exec "Snippet link [".st."desc".et."](".st."HREF".et.")".st.et vim-scripts-20130814ubuntu1/after/ftplugin/tex_snippets.vim0000644000000000000000000000112112204336073020636 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet sub \\subsection{".st."name".et."}\\label{sub:".st."name:substitute(@z,'.','\\l&','g')".et."}".st.et exec "Snippet $$ \\[".st.et."\\]".st.et exec "Snippet ssub \\subsubsection{".st."name".et."}\\label{ssub:".st."name:substitute(@z,'.','\\l&','g')".et."}".st.et exec "Snippet itd \\item[".st."desc".et."] ".st.et exec "Snippet sec \\section{".st."name".et."}\\label{sec:".st."name:substitute(@z,'.','\\l&','g')".et."".st.et vim-scripts-20130814ubuntu1/after/ftplugin/css_snippets.vim0000644000000000000000000000277412204336073020645 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet visibility ".st.et.";".st.et exec "Snippet list list-style-image: url(".st.et.");".st.et exec "Snippet text text-shadow: rgb(".st.et.", ".st.et.", ".st.et.", ".st.et." ".st.et." ".st.et.";".st.et exec "Snippet overflow overflow: ".st.et.";".st.et exec "Snippet white white-space: ".st.et.";".st.et exec "Snippet clear cursor: url(".st.et.");".st.et exec "Snippet margin padding-top: ".st.et.";".st.et exec "Snippet background background #".st.et." url(".st.et.") ".st.et." ".st.et." top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x% y%/x-pos y-pos')".et.";".st.et exec "Snippet word word-spaceing: ".st.et.";".st.et exec "Snippet z z-index: ".st.et.";".st.et exec "Snippet vertical vertical-align: ".st.et.";".st.et exec "Snippet marker marker-offset: ".st.et.";".st.et exec "Snippet cursor cursor: ".st.et.";".st.et exec "Snippet border border-right: ".st.et."px ".st.et." #".st.et.";".st.et exec "Snippet display display: block;".st.et exec "Snippet padding padding: ".st.et." ".st.et.";".st.et exec "Snippet letter letter-spacing: ".st.et."em;".st.et exec "Snippet color color: rgb(".st.et.", ".st.et.", ".st.et.");".st.et exec "Snippet font font-weight: ".st.et.";".st.et exec "Snippet position position: ".st.et.";".st.et exec "Snippet direction direction: ".st.et.";".st.et exec "Snippet float float: ".st.et.";".st.et vim-scripts-20130814ubuntu1/after/ftplugin/symfony_snippets.vim0000644000000000000000000000305112204336073021546 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet image_tag image_tag('".st."imageName".et."'".st.et.")".st.et exec "Snippet get public function get".st.et." (){return $this->".st.et.";}".st.et exec "Snippet link_to link_to('".st."linkName".et."', '".st."moduleName".et."/".st."actionName".et.st.et."')".st.et exec "Snippet sexecute public function execute(){".st.et."}".st.et exec "Snippet set public function set".st.et." ($".st.et."){$this->".st.et." = ".st.et.";}".st.et exec "Snippet execute /*** ".st."className".et."**/public function execute(){".st.et."}".st.et exec "Snippet tforeach ".st.et."".st.et exec "Snippet getparam $this->getRequestParameter('".st."id".et."')".st.et exec "Snippet div ".st.et."".st.et exec "Snippet tif ".st.et."".st.et exec "Snippet setget public function set".st."var".et." (".st."arg".et."){$this->".st."arg".et." = ".st."arg".et.";}public function get".st."var".et." (){return $this->".st."var".et.";}".st.et exec "Snippet echo ".st.et exec "Snippet tfor ".st.et."".st.et vim-scripts-20130814ubuntu1/after/ftplugin/logo_snippets.vim0000644000000000000000000000033512204336073021004 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet to to ".st."name".et." ".st."argument".et."".st.et."end".st.et vim-scripts-20130814ubuntu1/after/ftplugin/slate_snippets.vim0000644000000000000000000000207212204336073021154 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet do do: [| :".st."each".et."| ".st.et."]".st.et exec "Snippet proto define: #".st."NewName".et." &parents: {".st."parents".et."} &slots: {".st."slotSpecs".et."}.".st.et exec "Snippet ifte ".st."condition".et." ifTrue: [".st.et.":then] ifFalse: [".st.et.":else]".st.et exec "Snippet collect collect: [| :".st."each".et."| ".st.et."]".st.et exec "Snippet if ".st."condition".et." ifTrue: [".st.et.":then]".st.et exec "Snippet until [".st."condition".et."] whileFalse: [".st.et.":body]".st.et exec "Snippet reject reject: [| :".st."each".et."| ".st.et."]".st.et exec "Snippet dowith doWithIndex: [| :".st."each".et." :".st."index".et." | ".st.et."]".st.et exec "Snippet select select: [| :".st."each".et."| ".st.et."]".st.et exec "Snippet while [".st."condition".et."] whileTrue: [".st.et.":body]".st.et exec "Snippet inject inject: ".st."object".et." [| :".st."injection".et.", :".st."each".et."| ".st.et."]".st.et vim-scripts-20130814ubuntu1/after/ftplugin/ocaml_snippets.vim0000644000000000000000000000252512204336073021142 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet Queue Queue.fold ".st.et." ".st."base".et." ".st."q".et."".st.et exec "Snippet Nativeint Nativeint.abs ".st."ni".et.st.et exec "Snippet Printexc Printexc.print ".st."fn".et." ".st."x".et.st.et exec "Snippet Sys Sys.Signal_ignore".st.et exec "Snippet Hashtbl Hashtbl.iter ".st.et." ".st."h".et.st.et exec "Snippet Array Array.map ".st.et." ".st."arr".et.st.et exec "Snippet Printf Printf.fprintf ".st."buf".et." \"".st."format".et."\" ".st."args".et.st.et exec "Snippet Stream Stream.iter ".st.et." ".st."stream".et.st.et exec "Snippet Buffer Buffer.add_channel ".st."buf".et." ".st."ic".et." ".st."len".et.st.et exec "Snippet Int32 Int32.abs ".st."i32".et.st.et exec "Snippet List List.rev_map ".st.et." ".st."lst".et.st.et exec "Snippet Scanf Scanf.bscaf ".st."sbuf".et." \"".st."format".et."\" ".st."f".et.st.et exec "Snippet Int64 Int64.abs ".st."i64".et.st.et exec "Snippet Map Map.Make ".st.et exec "Snippet String String.iter ".st.et." ".st."str".et.st.et exec "Snippet Genlex Genlex.make_lexer ".st."\"tok_lst\"".et." ".st."\"char_stream\"".et.st.et exec "Snippet for for ".st."i}".et." = ".st.et." to ".st.et." do".st.et."done".st.et exec "Snippet Stack Stack.iter ".st.et." ".st."stk".et.st.et vim-scripts-20130814ubuntu1/after/ftplugin/sh_snippets.vim0000644000000000000000000000075012204336073020457 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim "Snippet !env #!/usr/bin/env ${1:${TM_SCOPE/(?:source|.*)\\.(\\w+).*/$1/}} exec "Snippet if if [[ ".st."condition".et." ]]; then".st.et."fi".st.et exec "Snippet elif elif [[ ".st."condition".et." ]]; then".st.et exec "Snippet for for (( ".st."i".et." = ".st.et."; ".st."i".et." ".st.et."; ".st."i".et.st.et." )); do".st.et."done".st.et vim-scripts-20130814ubuntu1/after/ftplugin/java_snippets.vim0000644000000000000000000001026312204336073020766 0ustar if !exists('loaded_snippet') || &cp finish endif function! UpFirst() return substitute(@z,'.','\u&','') endfunction function! JavaTestFileName(type) let filepath = expand('%:p') let filepath = substitute(filepath, '/','.','g') let filepath = substitute(filepath, '^.\(:\\\)\?','','') let filepath = substitute(filepath, '\','.','g') let filepath = substitute(filepath, ' ','','g') let filepath = substitute(filepath, '.*test.','','') if a:type == 1 let filepath = substitute(filepath, '.[A-Za-z]*.java','','g') elseif a:type == 2 let filepath = substitute(filepath, 'Tests.java','','') elseif a:type == 3 let filepath = substitute(filepath, '.*\.\([A-Za-z]*\).java','\1','g') elseif a:type == 4 let filepath = substitute(filepath, 'Tests.java','','') let filepath = substitute(filepath, '.*\.\([A-Za-z]*\).java','\1','g') elseif a:type == 5 let filepath = substitute(filepath, 'Tests.java','','') let filepath = substitute(filepath, '.*\.\([A-Za-z]*\).java','\1','g') let filepath = substitute(filepath, '.','\l&','') endif return filepath endfunction let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet method // {{{ ".st."method".et."/** * ".st.et." */public ".st."return".et." ".st."method".et."() {".st.et."}// }}}".st.et exec "Snippet jps private static final ".st."string".et." ".st.et." = \"".st.et."\";".st.et exec "Snippet jtc try {".st.et."} catch (".st.et." e) {".st.et."} finally {".st.et."}".st.et exec "Snippet jlog /** Logger for this class and subclasses. */protected final Log log = LogFactory.getLog(getClass());".st.et exec "Snippet jpv private ".st."string".et." ".st.et.";".st.et exec "Snippet bean // {{{ set".st."fieldName:UpFirst()".et."/** * Setter for ".st."fieldName".et.". * @param new".st."fieldName:UpFirst()".et." new value for ".st."fieldName".et." */public void set".st."fieldName:UpFirst()".et."(".st."String".et." new".st."fieldName:UpFirst()".et.") {".st."fieldName".et." = new".st."fieldName:UpFirst()".et.";}// }}}// {{{ get".st."fieldName:UpFirst()".et."/** * Getter for ".st."fieldName".et.". * @return ".st."fieldName".et." */public ".st."String".et." get".st."fieldName:UpFirst()".et."() {return ".st."fieldName".et.";}// }}}".st.et exec "Snippet jwh while (".st.et.") { // ".st.et."".st.et."}".st.et exec "Snippet sout System.out.println(\"".st.et."\");".st.et exec "Snippet jtest package ".st."j:JavaTestFileName(1)".et."import junit.framework.TestCase;import ".st."j:JavaTestFileName(2)".et.";/** * ".st."j:JavaTestFileName(3)".et." * * @author ".st.et." * @since ".st.et." */public class ".st."j:JavaTestFileName(3)".et." extends TestCase {private ".st."j:JavaTestFileName(4)".et." ".st."j:JavaTestFileName(5)".et.";public ".st."j:JavaTestFileName(4)".et." get".st."j:JavaTestFileName(4)".et."() { return this.".st."j:JavaTestFileName(5)".et."; }public void set".st."j:JavaTestFileName(4)".et."(".st."j:JavaTestFileName(4)".et." ".st."j:JavaTestFileName(5)".et.") { this.".st."j:JavaTestFileName(5)".et." = ".st."j:JavaTestFileName(5)".et."; }public void test".st.et."() {".st.et."}}".st.et exec "Snippet jif if (".st.et.") { // ".st.et."".st.et."}".st.et exec "Snippet jelse if (".st.et.") { // ".st.et."".st.et."} else { // ".st.et."".st.et."}".st.et exec "Snippet jpm /** * ".st.et." * * @param ".st.et." ".st.et." * ".st.et." ".st.et." */private ".st."void".et." ".st.et."(".st."String".et." ".st.et.") {".st.et."}".st.et exec "Snippet main public main static void main(String[] ars) {".st."\"System.exit(0)\"".et.";}".st.et exec "Snippet jpum /** * ".st.et." * * @param ".st.et." ".st.et." *".st.et." ".st.et." */public ".st."void".et." ".st.et."(".st."String".et." ".st.et.") {".st.et."}".st.et exec "Snippet jcout ".st.et vim-scripts-20130814ubuntu1/after/ftplugin/tcl_snippets.vim0000644000000000000000000000131112204336073020621 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet switch switch ".st.et." -- $".st."var".et." {".st."match".et." {".st.et."}default{".st.et."}}".st.et exec "Snippet foreach foreach ".st."var".et." $".st."list".et." {".st.et."}".st.et exec "Snippet proc proc ".st."name".et." {".st."args".et."} {".st.et."}".st.et exec "Snippet if if {".st."condition".et."} {".st.et."}".st.et exec "Snippet for for {".st."i".et." {".st.et."} {".st.et."} {".st.et."}".st.et exec "Snippet while while {".st."condition".et."} {".st.et."}".st.et vim-scripts-20130814ubuntu1/after/ftplugin/html_snippets.vim0000644000000000000000000001175312204336073021016 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim function! SelectDoctype() let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim let dt = inputlist(['Select doctype:', \ '1. HTML 4.01', \ '2. HTML 4.01 Transitional', \ '3. HTML 4.01 Frameset', \ '4. XHTML 1.0 Frameset', \ '5. XHTML Strict', \ '6. XHTML Transitional', \ '7. XHTML Frameset']) let dts = {1: "\n".st.et, \ 2: "\n".st.et, \ 3: "\n".st.et, \ 4: "\n".st.et, \ 5: "\n".st.et, \ 6: "\n".st.et, \ 7: "\n".st.et} return dts[dt] endfunction exec "Snippet doct ``SelectDoctype()``" exec "Snippet doctype \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">".st.et exec "Snippet doc4s \"http://www.w3.org/TR/html4/strict.dtd\">".st.et exec "Snippet doc4t \"http://www.w3.org/TR/html4/loose.dtd\">".st.et exec "Snippet doc4f \"http://www.w3.org/TR/html4/frameset.dtd\">".st.et exec "Snippet docxs \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">".st.et exec "Snippet docxt \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">".st.et exec "Snippet docxf \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">".st.et exec "Snippet head ".st.et."".st.et."".st.et exec "Snippet script ".st.et exec "Snippet title ".st.et."" exec "Snippet body ".st.et."".st.et exec "Snippet scriptsrc ".st.et exec "Snippet textarea ".st.et exec "Snippet meta ".st.et exec "Snippet movie classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">value=\"".st.et."\" />width=\"".st.et."\" height=\"".st.et."\"controller=\"".st.et."\" autoplay=\"".st.et."\"scale=\"tofit\" cache=\"true\"pluginspage=\"http://www.apple.com/quicktime/download/\"/>".st.et exec "Snippet div

".st.et."
".st.et exec "Snippet mailto ".st.et."".st.et exec "Snippet table
".st.et."
".st.et."
" exec "Snippet link " exec "Snippet form
".st.et."

".st.et exec "Snippet ref ".st.et."".st.et exec "Snippet h1

".st.et."

".st.et exec "Snippet input ".st.et exec "Snippet style ".st.et exec "Snippet base ".st.et vim-scripts-20130814ubuntu1/after/ftplugin/movable_type_snippets.vim0000644000000000000000000000076412204336073022540 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet cat <$MTCategoryDescription$>".st.et exec "Snippet blog <$MTBlogName$>".st.et exec "Snippet archive <$MTArchiveFile$>".st.et exec "Snippet cal ".st.et."".st.et exec "Snippet entry <$MTEntryMore$>".st.et exec "Snippet entries ".st.et."".st.et vim-scripts-20130814ubuntu1/after/ftplugin/latex_snippets.vim0000644000000000000000000000112212204336073021154 0ustar if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet sub \\subsection{".st."name".et."}\\label{sub:".st."name:substitute(@z,'.','\\l&','g')".et."}".st.et exec "Snippet $$ \\[".st.et."\\]".st.et exec "Snippet ssub \\subsubsection{".st."name".et."}\\label{ssub:".st."name:substitute(@z,'.','\\l&','g')".et."}".st.et exec "Snippet itd \\item[".st."desc".et."] ".st.et exec "Snippet sec \\section{".st."name".et."}\\label{sec:".st."name:substitute(@z,'.','\\l&','g')".et."}".st.et vim-scripts-20130814ubuntu1/bin/0000755000000000000000000000000012204336114013214 5ustar vim-scripts-20130814ubuntu1/bin/vimplate0000755000000000000000000001740412204336073014775 0ustar #!/usr/bin/perl -w use strict; use warnings; =head1 NAME vimplate - the vim template system. =cut use constant VERSION => '0.2.3'; use POSIX qw(strftime cuserid setlocale LC_ALL); use English qw(-no_match_vars); use Getopt::Long qw(:config no_ignore_case ); use Pod::Usage; my $vimplaterc=''; =head1 DEPENDS on PACKAGES B http://search.cpan.org/~abw/Template-Toolkit-2.14 please install Template-Toolkit on your system. =cut BEGIN { eval { require Template; }; if ($EVAL_ERROR=~/Can't locate Template.pm/) { print STDERR "$EVAL_ERROR"; print STDERR '-' x 60, "\n"; print STDERR "please install Template-Toolkit!\n"; print STDERR "example with $^X -MCPAN -e\"install Template\"\n"; print STDERR '-' x 60, "\n"; exit 1; } } =head1 DEPENDS on SETTINGS B on unix/bsd/linux the variable home is set. On Windows please set the variable home to the value where _vimplaterc should be locatet. =cut unless ( $ENV{'HOME'} ) { print STDERR "Variable HOME isn't set!\n"; print STDERR "Please read the documentation.\n"; exit 1; } else { if ( $^O =~ /Win/ ) { $vimplaterc = $ENV{'HOME'} . '/_vimplaterc'; unless ( $ENV{'USER'} ) { $ENV{'USER'}=$ENV{'USERNAME'}; } else { print STDERR "Variable USER isn't set!\n"; print STDERR "Please set this variable.\n"; } } else { $vimplaterc = $ENV{'HOME'} . '/.vimplaterc'; } } =head1 SYNOPSIS =over 4 =item vimplate <-template=