1
0
Fork 0
mirror of synced 2024-11-16 14:05:34 -05:00

Revert "Merge pull request #1 from 201341/swj/dev"

This reverts commit f93aa0fb39, reversing
changes made to e13b2a10a7.
This commit is contained in:
201341 2021-10-27 11:36:39 +08:00
parent f93aa0fb39
commit cc444efe2c
261 changed files with 11578 additions and 629027 deletions

2
.gitignore vendored
View file

@ -4,5 +4,7 @@ temp_dirs/yankring_history_v2.txt
sources_forked/yankring/doc/tags
sources_non_forked/tlib/doc/tags
sources_non_forked/ctrlp.vim/doc/tags*
my_plugins/
my_configs.vim
tags
.DS_Store

View file

@ -1,2 +0,0 @@
" OmniCppComplete initialization
call omni#cpp#complete#Init()

View file

@ -1,2 +0,0 @@
" OmniCppComplete initialization
call omni#cpp#complete#Init()

View file

@ -1,32 +0,0 @@
" 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

View file

@ -1,67 +0,0 @@
" 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

View file

@ -1,569 +0,0 @@
" 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 <expr> <C-X><C-O> omni#cpp#maycomplete#Complete()
inoremap <expr> . omni#cpp#maycomplete#Dot()
inoremap <expr> > omni#cpp#maycomplete#Arrow()
inoremap <expr> : 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

View file

@ -1,126 +0,0 @@
" 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

View file

@ -1,660 +0,0 @@
" 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<MyClass*>(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

View file

@ -1,82 +0,0 @@
" 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 = "\<C-X>\<C-O>"
" 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 .= "\<C-P>"
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 .= "\<C-P>"
let szOmniMapping .= "\<C-R>=pumvisible() ? \"\\<down>\" : \"\"\<cr>"
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

View file

@ -1,838 +0,0 @@
" 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

View file

@ -1,96 +0,0 @@
" 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

View file

@ -1,93 +0,0 @@
" 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

View file

@ -1,587 +0,0 @@
" 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 && startCmt<endCmt
if startCmt>0
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\<cComment\|\<cCppString\|\<cIncluded')>=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

File diff suppressed because it is too large Load diff

View file

@ -1,934 +0,0 @@
# THE TEXT BELOW IS HAND WRITTEN AND FOUND IN THE FILE "keywords_base.txt"
# IN THE PROCESSING-DOCS REPO. DON'T EDITS THE keywords.txt FILE DIRECTLY.
# For an explanation of these tags, see Token.java
# trunk/processing/app/src/processing/app/syntax/Token.java
ADD LITERAL2 blend_
ALIGN_CENTER LITERAL2
ALIGN_LEFT LITERAL2
ALIGN_RIGHT LITERAL2
ALPHA LITERAL2
ALPHA_MASK LITERAL2
ALT LITERAL2
AMBIENT LITERAL2
ARC LITERAL2 createShape_
ARROW LITERAL2 cursor_
ARGB LITERAL2
BACKSPACE LITERAL2 keyCode
BASELINE LITERAL2 textAlign_
BEVEL LITERAL2 strokeJoin_
BLEND LITERAL2 blend_
BLUE_MASK LITERAL2
BLUR LITERAL2 filter_
BOTTOM LITERAL2 textAlign_
BOX LITERAL2 createShape_
BURN LITERAL2 blend_
CENTER LITERAL2
CHATTER LITERAL2
CHORD LITERAL2 arc_
CLAMP LITERAL2
CLICK LITERAL2
CLOSE LITERAL2
CMYK LITERAL2
CODED LITERAL2 key
COMPLAINT LITERAL2
COMPOSITE LITERAL2
COMPONENT LITERAL2
CONCAVE_POLYGON LITERAL2
CONTROL LITERAL2
CONVEX_POLYGON LITERAL2
CORNER LITERAL2 textAlign_
CORNERS LITERAL2
CROSS LITERAL2 cursor_
CUSTOM LITERAL2
DARKEST LITERAL2 blend_
DEGREES LITERAL2
DEG_TO_RAD LITERAL2
DELETE LITERAL2
DIAMETER LITERAL2
DIFFERENCE LITERAL2 blend_
DIFFUSE LITERAL2
DILATE LITERAL2 filter_
DIRECTIONAL LITERAL2
DISABLE_ACCURATE_2D LITERAL2
DISABLE_DEPTH_MASK LITERAL2
DISABLE_DEPTH_SORT LITERAL2
DISABLE_DEPTH_TEST LITERAL2
DISABLE_NATIVE_FONTS LITERAL2
DISABLE_OPENGL_ERRORS LITERAL2
DISABLE_PURE_STROKE LITERAL2
DISABLE_TEXTURE_MIPMAPS LITERAL2
DISABLE_TRANSFORM_CACHE LITERAL2
DISABLE_STROKE_PERSPECTIVE LITERAL2
DISABLED LITERAL2
DODGE LITERAL2 blend_
DOWN LITERAL2 keyCode
DRAG LITERAL2
DXF LITERAL2 size_
ELLIPSE LITERAL2 createShape_
ENABLE_ACCURATE_2D LITERAL2
ENABLE_DEPTH_MASK LITERAL2
ENABLE_DEPTH_SORT LITERAL2
ENABLE_DEPTH_TEST LITERAL2
ENABLE_NATIVE_FONTS LITERAL2
ENABLE_OPENGL_ERRORS LITERAL2
ENABLE_PURE_STROKE LITERAL2
ENABLE_TEXTURE_MIPMAPS LITERAL2
ENABLE_TRANSFORM_CACHE LITERAL2
ENABLE_STROKE_PERSPECTIVE LITERAL2
ENTER LITERAL2 keyCode
EPSILON LITERAL2
ERODE LITERAL2 filter_
ESC LITERAL2 keyCode
EXCLUSION LITERAL2 blend_
EXIT LITERAL2
FX2D LITERAL2 size_
GIF LITERAL2
GRAY LITERAL2 filter_
GREEN_MASK LITERAL2
GROUP LITERAL2
HALF LITERAL2
HALF_PI LITERAL2 HALF_PI
HAND LITERAL2 cursor_
HARD_LIGHT LITERAL2 blend_
HINT_COUNT LITERAL2
HSB LITERAL2 colorMode_
IMAGE LITERAL2 textureMode_
INVERT LITERAL2 filter_
JAVA2D LITERAL2 size_
JPEG LITERAL2
LEFT LITERAL2 keyCode
LIGHTEST LITERAL2 blend_
LINE LITERAL2 createShape_
LINES LITERAL2 beginShape_
LINUX LITERAL2
MACOSX LITERAL2
MAX_FLOAT LITERAL2
MAX_INT LITERAL2
MIN_FLOAT LITERAL2
MIN_INT LITERAL2
MITER LITERAL2 stokeJoin_
MODEL LITERAL2 textMode_
MOVE LITERAL2 cursor_
MULTIPLY LITERAL2 blend_
NORMAL LITERAL2
NORMALIZED LITERAL2 textureMode_
NO_DEPTH_TEST LITERAL2
NTSC LITERAL2
ONE LITERAL2
OPAQUE LITERAL2 filter_
OPEN LITERAL2
ORTHOGRAPHIC LITERAL2
OVERLAY LITERAL2 blend_
PAL LITERAL2
PDF LITERAL2 size_
P2D LITERAL2 size_
P3D LITERAL2 size_
PERSPECTIVE LITERAL2
PI LITERAL2 PI
PIE LITERAL2
PIXEL_CENTER LITERAL2
POINT LITERAL2
POINTS LITERAL2
POSTERIZE LITERAL2 filter_
PRESS LITERAL2
PROBLEM LITERAL2
PROJECT LITERAL2 strokeCap_
QUAD LITERAL2 createShape_
QUAD_STRIP LITERAL2 beginShape_
QUADS LITERAL2 beginShape_
QUARTER_PI LITERAL2 QUARTER_PI
RAD_TO_DEG LITERAL2
RADIUS LITERAL2
RADIANS LITERAL2
RECT LITERAL2
RED_MASK LITERAL2
RELEASE LITERAL2
REPEAT LITERAL2
REPLACE LITERAL2
RETURN LITERAL2
RGB LITERAL2 colorMode_
RIGHT LITERAL2 keyCode
ROUND LITERAL2 strokeCap_
SCREEN LITERAL2 blend_
SECAM LITERAL2
SHAPE LITERAL2 textMode_
SHIFT LITERAL2
SPAN LITERAL2 fullScreen_
SPECULAR LITERAL2
SPHERE LITERAL2 createShape_
SOFT_LIGHT LITERAL2 blend_
SQUARE LITERAL2 strokeCap_
SUBTRACT LITERAL2 blend_
SVG LITERAL2
SVIDEO LITERAL2
TAB LITERAL2 keyCode
TARGA LITERAL2
TAU LITERAL2 TAU
TEXT LITERAL2 cursor_
TFF LITERAL2
THIRD_PI LITERAL2
THRESHOLD LITERAL2 filter_
TIFF LITERAL2
TOP LITERAL2 textAlign_
TRIANGLE LITERAL2 createShape_
TRIANGLE_FAN LITERAL2 beginShape_
TRIANGLES LITERAL2 beginShape_
TRIANGLE_STRIP LITERAL2 beginShape_
TUNER LITERAL2
TWO LITERAL2
TWO_PI LITERAL2 TWO_PI
UP LITERAL2 keyCode
WAIT LITERAL2 cursor_
WHITESPACE LITERAL2
# Java keywords (void, import, , etc.)
abstract KEYWORD1
break KEYWORD1 break
class KEYWORD1 class
continue KEYWORD1 continue
default KEYWORD1 default
enum KEYWORD1
extends KEYWORD1 extends
false KEYWORD1 false
final KEYWORD1 final
finally KEYWORD1
implements KEYWORD1 implements
import KEYWORD1 import
instanceof KEYWORD1
interface KEYWORD1
native KEYWORD1
new KEYWORD1 new
null KEYWORD1 null
package KEYWORD1
private KEYWORD1 private
protected KEYWORD1
public KEYWORD1 public
static KEYWORD1 static
strictfp KEYWORD1
throws KEYWORD1
transient KEYWORD1
true KEYWORD1 true
void KEYWORD1 void
volatile KEYWORD1
# Java keywords which can be followed by a parenthesis
assert KEYWORD6
case KEYWORD6 case
return KEYWORD6 return
super KEYWORD6 super
this KEYWORD6 this
throw KEYWORD6
# Datatypes
Array KEYWORD5 Array
ArrayList KEYWORD5 ArrayList
Boolean KEYWORD5
Byte KEYWORD5
BufferedReader KEYWORD5 BufferedReader
Character KEYWORD5
Class KEYWORD5 class
Double KEYWORD5
Float KEYWORD5
Integer KEYWORD5
HashMap KEYWORD5 HashMap
PrintWriter KEYWORD5 PrintWriter
String KEYWORD5 String
StringBuffer KEYWORD5
StringBuilder KEYWORD5
Thread KEYWORD5
boolean KEYWORD5 boolean
byte KEYWORD5 byte
char KEYWORD5 char
color KEYWORD5 color_datatype
double KEYWORD5 double
float KEYWORD5 float
int KEYWORD5 int
long KEYWORD5 long
short KEYWORD5
# Flow structures
catch KEYWORD3 catch
do KEYWORD3
for KEYWORD3 for
if KEYWORD3 if
else KEYWORD3 else
switch KEYWORD3 switch
synchronized KEYWORD3
while KEYWORD3 while
try KEYWORD3 try
catch FUNCTION3 catch
do FUNCTION3
for FUNCTION3 for
if FUNCTION3 if
#else FUNCTION3 else
switch FUNCTION3 switch
synchronized FUNCTION3
while FUNCTION3 while
#try FUNCTION3 try
# These items are a part of Processing but, but pages don't generate
boolean FUNCTION1 booleanconvert_
byte FUNCTION1 byteconvert_
cache FUNCTION2
char FUNCTION1 charconvert_
start FUNCTION1
stop FUNCTION1
breakShape FUNCTION1
createPath FUNCTION1
float FUNCTION1 floatconvert_
int FUNCTION1 intconvert_
str FUNCTION1 strconvert_
loadMatrix FUNCTION1
parseBoolean FUNCTION1
parseByte FUNCTION1
parseChar FUNCTION1
parseFloat FUNCTION1
parseInt FUNCTION1
saveFile FUNCTION1
savePath FUNCTION1
sketchFile FUNCTION1
sketchPath FUNCTION1
readLine FUNCTION2 BufferedReader_readLine_
close FUNCTION2 PrintWriter_close_
flush FUNCTION2 PrintWriter_flush_
print FUNCTION2 PrintWriter_print_
println FUNCTION2 PrintWriter_println_
charAt FUNCTION2 String_charAt_
equals FUNCTION2 String_equals_
indexOf FUNCTION2 String_indexOf_
length FUNCTION2 String_length_
substring FUNCTION2 String_substring_
toLowerCase FUNCTION2 String_toLowerCase_
toUpperCase FUNCTION2 String_toUpperCase_
getDouble FUNCTION2
getLong FUNCTION2
getColumnTitles FUNCTION2
getColumnTypes FUNCTION2
getColumnType FUNCTION2
setDouble FUNCTION2
setLong FUNCTION2
length KEYWORD2 String
# Temporary additions 3 September 2012 as the reference is getting updated
#end FUNCTION1
#addChild FUNCTION1
# Operators are without KEYWORDS
+= addassign
+ addition
[] arrayaccess
= assign
& bitwiseAND
| bitwiseOR
, comma
// comment
? conditional
{} curlybraces
-- decrement
/ divide
/= divideassign
/** doccomment
. dot
== equality
> greaterthan
>= greaterthanorequalto
++ increment
!= inequality
<< leftshift
< lessthan
<= lessthanorequalto
&& logicalAND
! logicalNOT
|| logicalOR
- minus
% modulo
/* multilinecomment
* multiply
*= multiplyassign
() parentheses
>> rightshift
; semicolon
-= subtractassign
# Suppressed from Generate to avoid conflicts with variables inside methods
width KEYWORD4 width_
height KEYWORD4 height_
PVector FUNCTION1 PVector
ArrayList FUNCTION1 ArrayList
HashMap FUNCTION1 HashMap
# pixelHeight is not generating correctly: https://github.com/processing/processing-docs/issues/260
pixelHeight KEYWORD4 pixelHeight
# THE TEXT ABOVE IS HAND-WRITTEN AND FOUND IN THE FILE "keywords_base.txt" in processing/processing-docs/generate
#
# THE TEXT BELOW IS AUTO-GENERATED
#
# SO
# DON'T
# TOUCH
# IT
abs FUNCTION1 abs_
acos FUNCTION1 acos_
alpha FUNCTION1 alpha_
ambient FUNCTION1 ambient_
ambientLight FUNCTION1 ambientLight_
append FUNCTION1 append_
applyMatrix FUNCTION1 applyMatrix_
arc FUNCTION1 arc_
arrayCopy FUNCTION1 arrayCopy_
asin FUNCTION1 asin_
atan FUNCTION1 atan_
atan2 FUNCTION1 atan2_
background FUNCTION1 background_
beginCamera FUNCTION1 beginCamera_
beginContour FUNCTION1 beginContour_
beginRaw FUNCTION1 beginRaw_
beginRecord FUNCTION1 beginRecord_
beginShape FUNCTION1 beginShape_
bezier FUNCTION1 bezier_
bezierDetail FUNCTION1 bezierDetail_
bezierPoint FUNCTION1 bezierPoint_
bezierTangent FUNCTION1 bezierTangent_
bezierVertex FUNCTION1 bezierVertex_
binary FUNCTION1 binary_
blend FUNCTION1 blend_
blendColor FUNCTION1 blendColor_
blendMode FUNCTION1 blendMode_
blue FUNCTION1 blue_
box FUNCTION1 box_
brightness FUNCTION1 brightness_
camera FUNCTION1 camera_
ceil FUNCTION1 ceil_
clear FUNCTION1 clear_
clip FUNCTION1 clip_
color FUNCTION1 color_
colorMode FUNCTION1 colorMode_
concat FUNCTION1 concat_
constrain FUNCTION1 constrain_
copy FUNCTION1 copy_
cos FUNCTION1 cos_
createFont FUNCTION1 createFont_
createGraphics FUNCTION1 createGraphics_
createImage FUNCTION1 createImage_
createInput FUNCTION1 createInput_
createOutput FUNCTION1 createOutput_
createReader FUNCTION1 createReader_
createShape FUNCTION1 createShape_
createWriter FUNCTION1 createWriter_
cursor FUNCTION1 cursor_
curve FUNCTION1 curve_
curveDetail FUNCTION1 curveDetail_
curvePoint FUNCTION1 curvePoint_
curveTangent FUNCTION1 curveTangent_
curveTightness FUNCTION1 curveTightness_
curveVertex FUNCTION1 curveVertex_
day FUNCTION1 day_
degrees FUNCTION1 degrees_
delay FUNCTION1 delay_
directionalLight FUNCTION1 directionalLight_
displayDensity FUNCTION1 displayDensity_
displayHeight KEYWORD4 displayHeight
displayWidth KEYWORD4 displayWidth
dist FUNCTION1 dist_
draw FUNCTION4 draw
ellipse FUNCTION1 ellipse_
ellipseMode FUNCTION1 ellipseMode_
emissive FUNCTION1 emissive_
endCamera FUNCTION1 endCamera_
endContour FUNCTION1 endContour_
endRaw FUNCTION1 endRaw_
endRecord FUNCTION1 endRecord_
endShape FUNCTION1 endShape_
exit FUNCTION1 exit_
exp FUNCTION1 exp_
expand FUNCTION1 expand_
fill FUNCTION1 fill_
filter FUNCTION1 filter_
FloatDict KEYWORD5 FloatDict
add FUNCTION2 FloatDict_add_
clear FUNCTION2 FloatDict_clear_
div FUNCTION2 FloatDict_div_
get FUNCTION2 FloatDict_get_
hasKey FUNCTION2 FloatDict_hasKey_
keyArray FUNCTION2 FloatDict_keyArray_
keys FUNCTION2 FloatDict_keys_
mult FUNCTION2 FloatDict_mult_
remove FUNCTION2 FloatDict_remove_
set FUNCTION2 FloatDict_set_
size FUNCTION2 FloatDict_size_
sortKeys FUNCTION2 FloatDict_sortKeys_
sortKeysReverse FUNCTION2 FloatDict_sortKeysReverse_
sortValues FUNCTION2 FloatDict_sortValues_
sortValuesReverse FUNCTION2 FloatDict_sortValuesReverse_
sub FUNCTION2 FloatDict_sub_
valueArray FUNCTION2 FloatDict_valueArray_
values FUNCTION2 FloatDict_values_
FloatList KEYWORD5 FloatList
add FUNCTION2 FloatList_add_
append FUNCTION2 FloatList_append_
array FUNCTION2 FloatList_array_
clear FUNCTION2 FloatList_clear_
div FUNCTION2 FloatList_div_
get FUNCTION2 FloatList_get_
hasValue FUNCTION2 FloatList_hasValue_
max FUNCTION2 FloatList_max_
min FUNCTION2 FloatList_min_
mult FUNCTION2 FloatList_mult_
remove FUNCTION2 FloatList_remove_
reverse FUNCTION2 FloatList_reverse_
set FUNCTION2 FloatList_set_
shuffle FUNCTION2 FloatList_shuffle_
size FUNCTION2 FloatList_size_
sort FUNCTION2 FloatList_sort_
sortReverse FUNCTION2 FloatList_sortReverse_
sub FUNCTION2 FloatList_sub_
floor FUNCTION1 floor_
focused KEYWORD4 focused
frameCount KEYWORD4 frameCount
frameRate KEYWORD4 frameRate
frameRate FUNCTION1 frameRate_
frustum FUNCTION1 frustum_
fullScreen FUNCTION1 fullScreen_
get FUNCTION1 get_
green FUNCTION1 green_
HALF_PI LITERAL2 HALF_PI
hex FUNCTION1 hex_
hint FUNCTION1 hint_
hour FUNCTION1 hour_
hue FUNCTION1 hue_
image FUNCTION1 image_
imageMode FUNCTION1 imageMode_
IntDict KEYWORD5 IntDict
add FUNCTION2 IntDict_add_
clear FUNCTION2 IntDict_clear_
div FUNCTION2 IntDict_div_
get FUNCTION2 IntDict_get_
hasKey FUNCTION2 IntDict_hasKey_
increment FUNCTION2 IntDict_increment_
keyArray FUNCTION2 IntDict_keyArray_
keys FUNCTION2 IntDict_keys_
mult FUNCTION2 IntDict_mult_
remove FUNCTION2 IntDict_remove_
set FUNCTION2 IntDict_set_
size FUNCTION2 IntDict_size_
sortKeys FUNCTION2 IntDict_sortKeys_
sortKeysReverse FUNCTION2 IntDict_sortKeysReverse_
sortValues FUNCTION2 IntDict_sortValues_
sortValuesReverse FUNCTION2 IntDict_sortValuesReverse_
sub FUNCTION2 IntDict_sub_
valueArray FUNCTION2 IntDict_valueArray_
values FUNCTION2 IntDict_values_
IntList KEYWORD5 IntList
add FUNCTION2 IntList_add_
append FUNCTION2 IntList_append_
array FUNCTION2 IntList_array_
clear FUNCTION2 IntList_clear_
div FUNCTION2 IntList_div_
get FUNCTION2 IntList_get_
hasValue FUNCTION2 IntList_hasValue_
increment FUNCTION2 IntList_increment_
max FUNCTION2 IntList_max_
min FUNCTION2 IntList_min_
mult FUNCTION2 IntList_mult_
remove FUNCTION2 IntList_remove_
reverse FUNCTION2 IntList_reverse_
set FUNCTION2 IntList_set_
shuffle FUNCTION2 IntList_shuffle_
size FUNCTION2 IntList_size_
sort FUNCTION2 IntList_sort_
sortReverse FUNCTION2 IntList_sortReverse_
sub FUNCTION2 IntList_sub_
join FUNCTION1 join_
JSONArray KEYWORD5 JSONArray
append FUNCTION2 JSONArray_append_
getBoolean FUNCTION2 JSONArray_getBoolean_
getFloat FUNCTION2 JSONArray_getFloat_
getInt FUNCTION2 JSONArray_getInt_
getIntArray FUNCTION2 JSONArray_getIntArray_
getJSONArray FUNCTION2 JSONArray_getJSONArray_
getJSONObject FUNCTION2 JSONArray_getJSONObject_
getString FUNCTION2 JSONArray_getString_
getStringArray FUNCTION2 JSONArray_getStringArray_
isNull FUNCTION2 JSONArray_isNull_
remove FUNCTION2 JSONArray_remove_
setBoolean FUNCTION2 JSONArray_setBoolean_
setFloat FUNCTION2 JSONArray_setFloat_
setInt FUNCTION2 JSONArray_setInt_
setJSONArray FUNCTION2 JSONArray_setJSONArray_
setJSONObject FUNCTION2 JSONArray_setJSONObject_
setString FUNCTION2 JSONArray_setString_
size FUNCTION2 JSONArray_size_
JSONObject KEYWORD5 JSONObject
getBoolean FUNCTION2 JSONObject_getBoolean_
getFloat FUNCTION2 JSONObject_getFloat_
getInt FUNCTION2 JSONObject_getInt_
getJSONArray FUNCTION2 JSONObject_getJSONArray_
getJSONObject FUNCTION2 JSONObject_getJSONObject_
getString FUNCTION2 JSONObject_getString_
isNull FUNCTION2 JSONObject_isNull_
setBoolean FUNCTION2 JSONObject_setBoolean_
setFloat FUNCTION2 JSONObject_setFloat_
setInt FUNCTION2 JSONObject_setInt_
setJSONArray FUNCTION2 JSONObject_setJSONArray_
setJSONObject FUNCTION2 JSONObject_setJSONObject_
setString FUNCTION2 JSONObject_setString_
key KEYWORD4 key
keyCode KEYWORD4 keyCode
keyPressed FUNCTION4 keyPressed
keyPressed KEYWORD4 keyPressed
keyReleased FUNCTION4 keyReleased
keyTyped FUNCTION4 keyTyped
launch FUNCTION1 launch_
lerp FUNCTION1 lerp_
lerpColor FUNCTION1 lerpColor_
lightFalloff FUNCTION1 lightFalloff_
lights FUNCTION1 lights_
lightSpecular FUNCTION1 lightSpecular_
line FUNCTION1 line_
loadBytes FUNCTION1 loadBytes_
loadFont FUNCTION1 loadFont_
loadImage FUNCTION1 loadImage_
loadJSONArray FUNCTION1 loadJSONArray_
loadJSONObject FUNCTION1 loadJSONObject_
loadPixels FUNCTION1 loadPixels_
loadShader FUNCTION1 loadShader_
loadShape FUNCTION1 loadShape_
loadStrings FUNCTION1 loadStrings_
loadTable FUNCTION1 loadTable_
loadXML FUNCTION1 loadXML_
log FUNCTION1 log_
loop FUNCTION1 loop_
mag FUNCTION1 mag_
map FUNCTION1 map_
match FUNCTION1 match_
matchAll FUNCTION1 matchAll_
max FUNCTION1 max_
millis FUNCTION1 millis_
min FUNCTION1 min_
minute FUNCTION1 minute_
modelX FUNCTION1 modelX_
modelY FUNCTION1 modelY_
modelZ FUNCTION1 modelZ_
month FUNCTION1 month_
mouseButton KEYWORD4 mouseButton
mouseClicked FUNCTION4 mouseClicked
mouseDragged FUNCTION4 mouseDragged
mouseMoved FUNCTION4 mouseMoved
mousePressed FUNCTION4 mousePressed
mousePressed KEYWORD4 mousePressed
mouseReleased FUNCTION4 mouseReleased
mouseWheel FUNCTION4 mouseWheel
mouseX KEYWORD4 mouseX
mouseY KEYWORD4 mouseY
nf FUNCTION1 nf_
nfc FUNCTION1 nfc_
nfp FUNCTION1 nfp_
nfs FUNCTION1 nfs_
noClip FUNCTION1 noClip_
noCursor FUNCTION1 noCursor_
noFill FUNCTION1 noFill_
noise FUNCTION1 noise_
noiseDetail FUNCTION1 noiseDetail_
noiseSeed FUNCTION1 noiseSeed_
noLights FUNCTION1 noLights_
noLoop FUNCTION1 noLoop_
norm FUNCTION1 norm_
normal FUNCTION1 normal_
noSmooth FUNCTION1 noSmooth_
noStroke FUNCTION1 noStroke_
noTint FUNCTION1 noTint_
ortho FUNCTION1 ortho_
parseJSONArray FUNCTION1 parseJSONArray_
parseJSONObject FUNCTION1 parseJSONObject_
parseXML FUNCTION1 parseXML_
perspective FUNCTION1 perspective_
PFont KEYWORD5 PFont
list FUNCTION1 PFont_list_
PGraphics KEYWORD5 PGraphics
beginDraw FUNCTION2 PGraphics_beginDraw_
endDraw FUNCTION2 PGraphics_endDraw_
PI LITERAL2 PI
PImage KEYWORD5 PImage
blend FUNCTION2 PImage_blend_
copy FUNCTION2 PImage_copy_
filter FUNCTION2 PImage_filter_
get FUNCTION2 PImage_get_
loadPixels FUNCTION2 PImage_loadPixels_
mask FUNCTION2 PImage_mask_
pixels KEYWORD2 PImage_pixels
resize FUNCTION2 PImage_resize_
save FUNCTION2 PImage_save_
set FUNCTION2 PImage_set_
updatePixels FUNCTION2 PImage_updatePixels_
pixelDensity FUNCTION1 pixelDensity_
pixelHeight FUNCTION1 pixelHeight_
pixels KEYWORD4 pixels
pixelWidth KEYWORD4 pixelWidth
pmouseX KEYWORD4 pmouseX
pmouseY KEYWORD4 pmouseY
point FUNCTION1 point_
pointLight FUNCTION1 pointLight_
popMatrix FUNCTION1 popMatrix_
popStyle FUNCTION1 popStyle_
pow FUNCTION1 pow_
print FUNCTION1 print_
printArray FUNCTION1 printArray_
printCamera FUNCTION1 printCamera_
println FUNCTION1 println_
printMatrix FUNCTION1 printMatrix_
printProjection FUNCTION1 printProjection_
PShader KEYWORD5 PShader
PShader FUNCTION2 PShader_set_
PShape KEYWORD5 PShape
addChild FUNCTION2 PShape_addChild_
beginContour FUNCTION2 PShape_beginContour_
beginShape FUNCTION2 PShape_beginShape_
disableStyle FUNCTION2 PShape_disableStyle_
enableStyle FUNCTION2 PShape_enableStyle_
endContour FUNCTION2 PShape_endContour_
endShape FUNCTION2 PShape_endShape_
getChild FUNCTION2 PShape_getChild_
getChildCount FUNCTION2 PShape_getChildCount_
getVertex FUNCTION2 PShape_getVertex_
getVertexCount FUNCTION2 PShape_getVertexCount_
isVisible FUNCTION2 PShape_isVisible_
resetMatrix FUNCTION2 PShape_resetMatrix_
rotate FUNCTION2 PShape_rotate_
rotateX FUNCTION2 PShape_rotateX_
rotateY FUNCTION2 PShape_rotateY_
rotateZ FUNCTION2 PShape_rotateZ_
scale FUNCTION2 PShape_scale_
setFill FUNCTION2 PShape_setFill_
setStroke FUNCTION2 PShape_setStroke_
setVertex FUNCTION2 PShape_setVertex_
setVisible FUNCTION2 PShape_setVisible_
translate FUNCTION2 PShape_translate_
pushMatrix FUNCTION1 pushMatrix_
pushStyle FUNCTION1 pushStyle_
PVector KEYWORD5 PVector
add FUNCTION2 PVector_add_
angleBetween FUNCTION2 PVector_angleBetween_
array FUNCTION2 PVector_array_
copy FUNCTION2 PVector_copy_
cross FUNCTION2 PVector_cross_
dist FUNCTION2 PVector_dist_
div FUNCTION2 PVector_div_
dot FUNCTION2 PVector_dot_
fromAngle FUNCTION2 PVector_fromAngle_
get FUNCTION2 PVector_get_
heading FUNCTION2 PVector_heading_
lerp FUNCTION2 PVector_lerp_
limit FUNCTION2 PVector_limit_
mag FUNCTION2 PVector_mag_
magSq FUNCTION2 PVector_magSq_
mult FUNCTION2 PVector_mult_
normalize FUNCTION2 PVector_normalize_
random2D FUNCTION2 PVector_random2D_
random3D FUNCTION2 PVector_random3D_
rotate FUNCTION2 PVector_rotate_
set FUNCTION2 PVector_set_
setMag FUNCTION2 PVector_setMag_
sub FUNCTION2 PVector_sub_
quad FUNCTION1 quad_
quadraticVertex FUNCTION1 quadraticVertex_
QUARTER_PI LITERAL2 QUARTER_PI
radians FUNCTION1 radians_
random FUNCTION1 random_
randomGaussian FUNCTION1 randomGaussian_
randomSeed FUNCTION1 randomSeed_
rect FUNCTION1 rect_
rectMode FUNCTION1 rectMode_
red FUNCTION1 red_
redraw FUNCTION1 redraw_
requestImage FUNCTION1 requestImage_
resetMatrix FUNCTION1 resetMatrix_
resetShader FUNCTION1 resetShader_
reverse FUNCTION1 reverse_
rotate FUNCTION1 rotate_
rotateX FUNCTION1 rotateX_
rotateY FUNCTION1 rotateY_
rotateZ FUNCTION1 rotateZ_
round FUNCTION1 round_
saturation FUNCTION1 saturation_
save FUNCTION1 save_
saveBytes FUNCTION1 saveBytes_
saveFrame FUNCTION1 saveFrame_
saveJSONArray FUNCTION1 saveJSONArray_
saveJSONObject FUNCTION1 saveJSONObject_
saveStream FUNCTION1 saveStream_
saveStrings FUNCTION1 saveStrings_
saveTable FUNCTION1 saveTable_
saveXML FUNCTION1 saveXML_
scale FUNCTION1 scale_
screenX FUNCTION1 screenX_
screenY FUNCTION1 screenY_
screenZ FUNCTION1 screenZ_
second FUNCTION1 second_
selectFolder FUNCTION1 selectFolder_
selectInput FUNCTION1 selectInput_
selectOutput FUNCTION1 selectOutput_
set FUNCTION1 set_
settings FUNCTION4 settings
setup FUNCTION4 setup
shader FUNCTION1 shader_
shape FUNCTION1 shape_
shapeMode FUNCTION1 shapeMode_
shearX FUNCTION1 shearX_
shearY FUNCTION1 shearY_
shininess FUNCTION1 shininess_
shorten FUNCTION1 shorten_
sin FUNCTION1 sin_
size FUNCTION1 size_
smooth FUNCTION1 smooth_
sort FUNCTION1 sort_
specular FUNCTION1 specular_
sphere FUNCTION1 sphere_
sphereDetail FUNCTION1 sphereDetail_
splice FUNCTION1 splice_
split FUNCTION1 split_
splitTokens FUNCTION1 splitTokens_
spotLight FUNCTION1 spotLight_
sq FUNCTION1 sq_
sqrt FUNCTION1 sqrt_
StringDict KEYWORD5 StringDict
clear FUNCTION2 StringDict_clear_
get FUNCTION2 StringDict_get_
hasKey FUNCTION2 StringDict_hasKey_
keyArray FUNCTION2 StringDict_keyArray_
keys FUNCTION2 StringDict_keys_
remove FUNCTION2 StringDict_remove_
set FUNCTION2 StringDict_set_
size FUNCTION2 StringDict_size_
sortKeys FUNCTION2 StringDict_sortKeys_
sortKeysReverse FUNCTION2 StringDict_sortKeysReverse_
sortValues FUNCTION2 StringDict_sortValues_
sortValuesReverse FUNCTION2 StringDict_sortValuesReverse_
valueArray FUNCTION2 StringDict_valueArray_
values FUNCTION2 StringDict_values_
StringList KEYWORD5 StringList
append FUNCTION2 StringList_append_
array FUNCTION2 StringList_array_
clear FUNCTION2 StringList_clear_
get FUNCTION2 StringList_get_
hasValue FUNCTION2 StringList_hasValue_
lower FUNCTION2 StringList_lower_
remove FUNCTION2 StringList_remove_
reverse FUNCTION2 StringList_reverse_
set FUNCTION2 StringList_set_
shuffle FUNCTION2 StringList_shuffle_
size FUNCTION2 StringList_size_
sort FUNCTION2 StringList_sort_
sortReverse FUNCTION2 StringList_sortReverse_
upper FUNCTION2 StringList_upper_
stroke FUNCTION1 stroke_
strokeCap FUNCTION1 strokeCap_
strokeJoin FUNCTION1 strokeJoin_
strokeWeight FUNCTION1 strokeWeight_
subset FUNCTION1 subset_
Table KEYWORD5 Table
addColumn FUNCTION2 Table_addColumn_
addRow FUNCTION2 Table_addRow_
clearRows FUNCTION2 Table_clearRows_
findRow FUNCTION2 Table_findRow_
findRows FUNCTION2 Table_findRows_
getColumnCount FUNCTION2 Table_getColumnCount_
getFloat FUNCTION2 Table_getFloat_
getInt FUNCTION2 Table_getInt_
getRow FUNCTION2 Table_getRow_
getRowCount FUNCTION2 Table_getRowCount_
getString FUNCTION2 Table_getString_
getStringColumn FUNCTION2 Table_getStringColumn_
matchRow FUNCTION2 Table_matchRow_
matchRows FUNCTION2 Table_matchRows_
removeColumn FUNCTION2 Table_removeColumn_
removeRow FUNCTION2 Table_removeRow_
removeTokens FUNCTION2 Table_removeTokens_
rows FUNCTION2 Table_rows_
setFloat FUNCTION2 Table_setFloat_
setInt FUNCTION2 Table_setInt_
setString FUNCTION2 Table_setString_
trim FUNCTION2 Table_trim_
TableRow KEYWORD5 TableRow
getColumnCount FUNCTION2 TableRow_getColumnCount_
getColumnTitle FUNCTION2 TableRow_getColumnTitle_
getFloat FUNCTION2 TableRow_getFloat_
getInt FUNCTION2 TableRow_getInt_
getString FUNCTION2 TableRow_getString_
setFloat FUNCTION2 TableRow_setFloat_
setInt FUNCTION2 TableRow_setInt_
setString FUNCTION2 TableRow_setString_
tan FUNCTION1 tan_
TAU LITERAL2 TAU
text FUNCTION1 text_
textAlign FUNCTION1 textAlign_
textAscent FUNCTION1 textAscent_
textDescent FUNCTION1 textDescent_
textFont FUNCTION1 textFont_
textLeading FUNCTION1 textLeading_
textMode FUNCTION1 textMode_
textSize FUNCTION1 textSize_
texture FUNCTION1 texture_
textureMode FUNCTION1 textureMode_
textureWrap FUNCTION1 textureWrap_
textWidth FUNCTION1 textWidth_
thread FUNCTION1 thread_
tint FUNCTION1 tint_
translate FUNCTION1 translate_
triangle FUNCTION1 triangle_
trim FUNCTION1 trim_
TWO_PI LITERAL2 TWO_PI
unbinary FUNCTION1 unbinary_
unhex FUNCTION1 unhex_
updatePixels FUNCTION1 updatePixels_
vertex FUNCTION1 vertex_
XML KEYWORD5 XML
addChild FUNCTION2 XML_addChild_
format FUNCTION2 XML_format_
getAttributeCount FUNCTION2 XML_getAttributeCount_
getChild FUNCTION2 XML_getChild_
getChildren FUNCTION2 XML_getChildren_
getContent FUNCTION2 XML_getContent_
getFloat FUNCTION2 XML_getFloat_
getContent FUNCTION2 XML_getFloatContent_
getInt FUNCTION2 XML_getInt_
getContent FUNCTION2 XML_getIntContent_
getName FUNCTION2 XML_getName_
getParent FUNCTION2 XML_getParent_
getString FUNCTION2 XML_getString_
hasAttribute FUNCTION2 XML_hasAttribute_
hasChildren FUNCTION2 XML_hasChildren_
listAttributes FUNCTION2 XML_listAttributes_
listChildren FUNCTION2 XML_listChildren_
removeChild FUNCTION2 XML_removeChild_
setContent FUNCTION2 XML_setContent_
setFloat FUNCTION2 XML_setFloat_
setInt FUNCTION2 XML_setInt_
setName FUNCTION2 XML_setName_
setString FUNCTION2 XML_setString_
toString FUNCTION2 XML_toString_
year FUNCTION1 year_

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,298 +0,0 @@
*acp.txt* 補完メニューの自動ポップアップ
Copyright (c) 2007-2009 Takeshi NISHIDA
AutoComplPop *autocomplpop* *acp*
概要 |acp-introduction|
インストール |acp-installation|
使い方 |acp-usage|
コマンド |acp-commands|
オプション |acp-options|
SPECIAL THANKS |acp-thanks|
CHANGELOG |acp-changelog|
あばうと |acp-about|
==============================================================================
概要 *acp-introduction*
このプラグインは、インサートモードで文字を入力したりカーソルを動かしたときに補
完メニューを自動的に開くようにします。しかし、続けて文字を入力するのを妨げたり
はしません。
==============================================================================
インストール *acp-installation*
ZIPファイルをランタイムディレクトリに展開します。
以下のようにファイルが配置されるはずです。
>
<your runtime directory>/plugin/acp.vim
<your runtime directory>/doc/acp.txt
...
<
もしランタイムディレクトリが他のプラグインとごた混ぜになるのが嫌なら、ファイル
を新規ディレクトリに配置し、そのディレクトリのパスを 'runtimepath' に追加して
ください。アンインストールも楽になります。
その後 FuzzyFinder のヘルプを有効にするためにタグファイルを更新してください。
詳しくは|add-local-help|を参照してください。
==============================================================================
使い方 *acp-usage*
このプラグインがインストールされていれば、自動ポップアップは vim の開始時から
有効になります。
カーソル直前のテキストに応じて、利用する補完の種類を切り替えます。デフォルトの
補完動作は次の通りです:
補完モード filetype カーソル直前のテキスト ~
キーワード補完 * 2文字のキーワード文字
ファイル名補完 * ファイル名文字 + パスセパレータ
+ 0文字以上のファイル名文字
オムニ補完 ruby ".", "::" or 単語を構成する文字以外 + ":"
オムニ補完 python "."
オムニ補完 xml "<", "</" or ("<" + ">"以外の文字列 + " ")
オムニ補完 html/xhtml "<", "</" or ("<" + ">"以外の文字列 + " ")
オムニ補完 css (":", ";", "{", "^", "@", or "!")
+ 0個または1個のスペース
さらに、設定を行うことで、ユーザー定義補完と snipMate トリガー補完
(|acp-snipMate|) を自動ポップアップさせることができます。
これらの補完動作はカスタマイズ可能です。
*acp-snipMate*
snipMate トリガー補完 ~
snipMate トリガー補完では、snipMate プラグイン
(http://www.vim.org/scripts/script.php?script_id=2540) が提供するスニペットの
トリガーを補完してそれを展開することができます。
この自動ポップアップを有効にするには、次の関数を plugin/snipMate.vim に追加す
る必要があります:
>
fun! GetSnipsInCurrentScope()
let snips = {}
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
call extend(snips, get(s:snippets, scope, {}), 'keep')
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
endfor
return snips
endf
<
そして|g:acp_behaviorSnipmateLength|オプションを 1 にしてください。
この自動ポップアップには制限があり、カーソル直前の単語は大文字英字だけで構成さ
れていなければなりません。
*acp-perl-omni*
Perl オムニ補完 ~
AutoComplPop は perl-completion.vim
(http://www.vim.org/scripts/script.php?script_id=2852) をサポートしています。
この自動ポップアップを有効にするには、|g:acp_behaviorPerlOmniLength|オプション
を 0 以上にしてください。
==============================================================================
コマンド *acp-commands*
*:AcpEnable*
:AcpEnable
自動ポップアップを有効にします。
*:AcpDisable*
:AcpDisable
自動ポップアップを無効にします。
*:AcpLock*
:AcpLock
自動ポップアップを一時的に停止します。
別のスクリプトへの干渉を回避する目的なら、このコマンドと|:AcpUnlock|
を利用することを、|:AcpDisable|と|:AcpEnable| を利用するよりも推奨しま
す。
*:AcpUnlock*
:AcpUnlock
|:AcpLock| で停止された自動ポップアップを再開します。
==============================================================================
オプション *acp-options*
*g:acp_enableAtStartup* >
let g:acp_enableAtStartup = 1
<
真なら vim 開始時から自動ポップアップが有効になります。
*g:acp_mappingDriven* >
let g:acp_mappingDriven = 0
<
真なら|CursorMovedI|イベントではなくキーマッピングで自動ポップアップを
行うようにします。カーソルを移動するたびに補完が行われることで重いなど
の不都合がある場合に利用してください。ただし他のプラグインとの相性問題
や日本語入力での不具合が発生する可能性があります。(逆も然り。)
*g:acp_ignorecaseOption* >
let g:acp_ignorecaseOption = 1
<
自動ポップアップ時に、'ignorecase' に一時的に設定する値
*g:acp_completeOption* >
let g:acp_completeOption = '.,w,b,k'
<
自動ポップアップ時に、'complete' に一時的に設定する値
*g:acp_completeoptPreview* >
let g:acp_completeoptPreview = 0
<
真なら自動ポップアップ時に、 'completeopt' へ "preview" を追加します。
*g:acp_behaviorUserDefinedFunction* >
let g:acp_behaviorUserDefinedFunction = ''
<
ユーザー定義補完の|g:acp_behavior-completefunc|。空ならこの補完は行わ
れません。。
*g:acp_behaviorUserDefinedMeets* >
let g:acp_behaviorUserDefinedMeets = ''
<
ユーザー定義補完の|g:acp_behavior-meets|。空ならこの補完は行われません
*g:acp_behaviorSnipmateLength* >
let g:acp_behaviorSnipmateLength = -1
<
snipMate トリガー補完の自動ポップアップを行うのに必要なカーソルの直前
のパターン。
*g:acp_behaviorKeywordCommand* >
let g:acp_behaviorKeywordCommand = "\<C-n>"
<
キーワード補完のコマンド。このオプションには普通 "\<C-n>" か "\<C-p>"
を設定します。
*g:acp_behaviorKeywordLength* >
let g:acp_behaviorKeywordLength = 2
<
キーワード補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
ード文字数。負数ならこの補完は行われません。
*g:acp_behaviorKeywordIgnores* >
let g:acp_behaviorKeywordIgnores = []
<
文字列のリスト。カーソル直前の単語がこれらの内いずれかの先頭部分にマッ
チする場合、この補完は行われません。
例えば、 "get" で始まる補完キーワードが多過ぎて、"g", "ge", "get" を入
力したときの自動ポップアップがレスポンスの低下を引き起こしている場合、
このオプションに ["get"] を設定することでそれを回避することができます。
*g:acp_behaviorFileLength* >
let g:acp_behaviorFileLength = 0
<
ファイル名補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
ード文字数。負数ならこの補完は行われません。
*g:acp_behaviorRubyOmniMethodLength* >
let g:acp_behaviorRubyOmniMethodLength = 0
<
メソッド補完のための、Ruby オムニ補完の自動ポップアップを行うのに必要
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
*g:acp_behaviorRubyOmniSymbolLength* >
let g:acp_behaviorRubyOmniSymbolLength = 1
<
シンボル補完のための、Ruby オムニ補完の自動ポップアップを行うのに必要
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
*g:acp_behaviorPythonOmniLength* >
let g:acp_behaviorPythonOmniLength = 0
<
Python オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキ
ーワード文字数。負数ならこの補完は行われません。
*g:acp_behaviorPerlOmniLength* >
let g:acp_behaviorPerlOmniLength = -1
<
Perl オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキー
ワード文字数。負数ならこの補完は行われません。
See also: |acp-perl-omni|
*g:acp_behaviorXmlOmniLength* >
let g:acp_behaviorXmlOmniLength = 0
<
XML オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
ード文字数。負数ならこの補完は行われません。
*g:acp_behaviorHtmlOmniLength* >
let g:acp_behaviorHtmlOmniLength = 0
<
HTML オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキー
ワード文字数。負数ならこの補完は行われません。
*g:acp_behaviorCssOmniPropertyLength* >
let g:acp_behaviorCssOmniPropertyLength = 1
<
プロパティ補完のための、CSS オムニ補完の自動ポップアップを行うのに必要
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
*g:acp_behaviorCssOmniValueLength* >
let g:acp_behaviorCssOmniValueLength = 0
<
値補完のための、CSS オムニ補完の自動ポップアップを行うのに必要なカーソ
ルの直前のキーワード文字数。負数ならこの補完は行われません。
*g:acp_behavior* >
let g:acp_behavior = {}
<
これは内部仕様がわかっている人向けのオプションで、他のオプションでの設
定より優先されます。
|Dictionary|型で、キーはファイルタイプに対応します。 '*' はデフォルト
を表します。値はリスト型です。補完候補が得られるまでリストの先頭アイテ
ムから順に評価します。各要素は|Dictionary|で詳細は次の通り:
"command": *g:acp_behavior-command*
補完メニューをポップアップするためのコマンド。
"completefunc": *g:acp_behavior-completefunc*
'completefunc' に設定する関数。 "command" が "<C-x><C-u>" のときだけ
意味があります。
"meets": *g:acp_behavior-meets*
この補完を行うかどうかを判断する関数の名前。この関数はカーソル直前の
テキストを引数に取り、補完を行うなら非 0 の値を返します。
"onPopupClose": *g:acp_behavior-onPopupClose*
この補完のポップアップメニューが閉じられたときに呼ばれる関数の名前。
この関数が 0 を返した場合、続いて行われる予定の補完は抑制されます。
"repeat": *g:acp_behavior-repeat*
真なら最後の補完が自動的に繰り返されます。
==============================================================================
あばうと *acp-about* *acp-contact* *acp-author*
作者: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
ライセンス: MIT Licence
URL: http://www.vim.org/scripts/script.php?script_id=1879
http://bitbucket.org/ns9tks/vim-autocomplpop/
バグや要望など ~
こちらへどうぞ: http://bitbucket.org/ns9tks/vim-autocomplpop/issues/
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,512 +0,0 @@
*acp.txt* Automatically opens popup menu for completions.
Copyright (c) 2007-2009 Takeshi NISHIDA
AutoComplPop *autocomplpop* *acp*
INTRODUCTION |acp-introduction|
INSTALLATION |acp-installation|
USAGE |acp-usage|
COMMANDS |acp-commands|
OPTIONS |acp-options|
SPECIAL THANKS |acp-thanks|
CHANGELOG |acp-changelog|
ABOUT |acp-about|
==============================================================================
INTRODUCTION *acp-introduction*
With this plugin, your vim comes to automatically opens popup menu for
completions when you enter characters or move the cursor in Insert mode. It
won't prevent you continuing entering characters.
==============================================================================
INSTALLATION *acp-installation*
Put all files into your runtime directory. If you have the zip file, extract
it to your runtime directory.
You should place the files as follows:
>
<your runtime directory>/plugin/acp.vim
<your runtime directory>/doc/acp.txt
...
<
If you disgust to jumble up this plugin and other plugins in your runtime
directory, put the files into new directory and just add the directory path to
'runtimepath'. It's easy to uninstall the plugin.
And then update your help tags files to enable fuzzyfinder help. See
|add-local-help| for details.
==============================================================================
USAGE *acp-usage*
Once this plugin is installed, auto-popup is enabled at startup by default.
Which completion method is used depends on the text before the cursor. The
default behavior is as follows:
kind filetype text before the cursor ~
Keyword * two keyword characters
Filename * a filename character + a path separator
+ 0 or more filename character
Omni ruby ".", "::" or non-word character + ":"
(|+ruby| required.)
Omni python "." (|+python| required.)
Omni xml "<", "</" or ("<" + non-">" characters + " ")
Omni html/xhtml "<", "</" or ("<" + non-">" characters + " ")
Omni css (":", ";", "{", "^", "@", or "!")
+ 0 or 1 space
Also, you can make user-defined completion and snipMate's trigger completion
(|acp-snipMate|) auto-popup if the options are set.
These behavior are customizable.
*acp-snipMate*
snipMate's Trigger Completion ~
snipMate's trigger completion enables you to complete a snippet trigger
provided by snipMate plugin
(http://www.vim.org/scripts/script.php?script_id=2540) and expand it.
To enable auto-popup for this completion, add following function to
plugin/snipMate.vim:
>
fun! GetSnipsInCurrentScope()
let snips = {}
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
call extend(snips, get(s:snippets, scope, {}), 'keep')
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
endfor
return snips
endf
<
And set |g:acp_behaviorSnipmateLength| option to 1.
There is the restriction on this auto-popup, that the word before cursor must
consist only of uppercase characters.
*acp-perl-omni*
Perl Omni-Completion ~
AutoComplPop supports perl-completion.vim
(http://www.vim.org/scripts/script.php?script_id=2852).
To enable auto-popup for this completion, set |g:acp_behaviorPerlOmniLength|
option to 0 or more.
==============================================================================
COMMANDS *acp-commands*
*:AcpEnable*
:AcpEnable
enables auto-popup.
*:AcpDisable*
:AcpDisable
disables auto-popup.
*:AcpLock*
:AcpLock
suspends auto-popup temporarily.
For the purpose of avoiding interruption to another script, it is
recommended to insert this command and |:AcpUnlock| than |:AcpDisable|
and |:AcpEnable| .
*:AcpUnlock*
:AcpUnlock
resumes auto-popup suspended by |:AcpLock| .
==============================================================================
OPTIONS *acp-options*
*g:acp_enableAtStartup* >
let g:acp_enableAtStartup = 1
<
If non-zero, auto-popup is enabled at startup.
*g:acp_mappingDriven* >
let g:acp_mappingDriven = 0
<
If non-zero, auto-popup is triggered by key mappings instead of
|CursorMovedI| event. This is useful to avoid auto-popup by moving
cursor in Insert mode.
*g:acp_ignorecaseOption* >
let g:acp_ignorecaseOption = 1
<
Value set to 'ignorecase' temporarily when auto-popup.
*g:acp_completeOption* >
let g:acp_completeOption = '.,w,b,k'
<
Value set to 'complete' temporarily when auto-popup.
*g:acp_completeoptPreview* >
let g:acp_completeoptPreview = 0
<
If non-zero, "preview" is added to 'completeopt' when auto-popup.
*g:acp_behaviorUserDefinedFunction* >
let g:acp_behaviorUserDefinedFunction = ''
<
|g:acp_behavior-completefunc| for user-defined completion. If empty,
this completion will be never attempted.
*g:acp_behaviorUserDefinedMeets* >
let g:acp_behaviorUserDefinedMeets = ''
<
|g:acp_behavior-meets| for user-defined completion. If empty, this
completion will be never attempted.
*g:acp_behaviorSnipmateLength* >
let g:acp_behaviorSnipmateLength = -1
<
Pattern before the cursor, which are needed to attempt
snipMate-trigger completion.
*g:acp_behaviorKeywordCommand* >
let g:acp_behaviorKeywordCommand = "\<C-n>"
<
Command for keyword completion. This option is usually set "\<C-n>" or
"\<C-p>".
*g:acp_behaviorKeywordLength* >
let g:acp_behaviorKeywordLength = 2
<
Length of keyword characters before the cursor, which are needed to
attempt keyword completion. If negative value, this completion will be
never attempted.
*g:acp_behaviorKeywordIgnores* >
let g:acp_behaviorKeywordIgnores = []
<
List of string. If a word before the cursor matches to the front part
of one of them, keyword completion won't be attempted.
E.g., when there are too many keywords beginning with "get" for the
completion and auto-popup by entering "g", "ge", or "get" causes
response degradation, set ["get"] to this option and avoid it.
*g:acp_behaviorFileLength* >
let g:acp_behaviorFileLength = 0
<
Length of filename characters before the cursor, which are needed to
attempt filename completion. If negative value, this completion will
be never attempted.
*g:acp_behaviorRubyOmniMethodLength* >
let g:acp_behaviorRubyOmniMethodLength = 0
<
Length of keyword characters before the cursor, which are needed to
attempt ruby omni-completion for methods. If negative value, this
completion will be never attempted.
*g:acp_behaviorRubyOmniSymbolLength* >
let g:acp_behaviorRubyOmniSymbolLength = 1
<
Length of keyword characters before the cursor, which are needed to
attempt ruby omni-completion for symbols. If negative value, this
completion will be never attempted.
*g:acp_behaviorPythonOmniLength* >
let g:acp_behaviorPythonOmniLength = 0
<
Length of keyword characters before the cursor, which are needed to
attempt python omni-completion. If negative value, this completion
will be never attempted.
*g:acp_behaviorPerlOmniLength* >
let g:acp_behaviorPerlOmniLength = -1
<
Length of keyword characters before the cursor, which are needed to
attempt perl omni-completion. If negative value, this completion will
be never attempted.
See also: |acp-perl-omni|
*g:acp_behaviorXmlOmniLength* >
let g:acp_behaviorXmlOmniLength = 0
<
Length of keyword characters before the cursor, which are needed to
attempt XML omni-completion. If negative value, this completion will
be never attempted.
*g:acp_behaviorHtmlOmniLength* >
let g:acp_behaviorHtmlOmniLength = 0
<
Length of keyword characters before the cursor, which are needed to
attempt HTML omni-completion. If negative value, this completion will
be never attempted.
*g:acp_behaviorCssOmniPropertyLength* >
let g:acp_behaviorCssOmniPropertyLength = 1
<
Length of keyword characters before the cursor, which are needed to
attempt CSS omni-completion for properties. If negative value, this
completion will be never attempted.
*g:acp_behaviorCssOmniValueLength* >
let g:acp_behaviorCssOmniValueLength = 0
<
Length of keyword characters before the cursor, which are needed to
attempt CSS omni-completion for values. If negative value, this
completion will be never attempted.
*g:acp_behavior* >
let g:acp_behavior = {}
<
This option is for advanced users. This setting overrides other
behavior options. This is a |Dictionary|. Each key corresponds to a
filetype. '*' is default. Each value is a list. These are attempted in
sequence until completion item is found. Each element is a
|Dictionary| which has following items:
"command": *g:acp_behavior-command*
Command to be fed to open popup menu for completions.
"completefunc": *g:acp_behavior-completefunc*
'completefunc' will be set to this user-provided function during the
completion. Only makes sense when "command" is "<C-x><C-u>".
"meets": *g:acp_behavior-meets*
Name of the function which dicides whether or not to attempt this
completion. It will be attempted if this function returns non-zero.
This function takes a text before the cursor.
"onPopupClose": *g:acp_behavior-onPopupClose*
Name of the function which is called when popup menu for this
completion is closed. Following completions will be suppressed if
this function returns zero.
"repeat": *g:acp_behavior-repeat*
If non-zero, the last completion is automatically repeated.
==============================================================================
SPECIAL THANKS *acp-thanks*
- Daniel Schierbeck
- Ingo Karkat
==============================================================================
CHANGELOG *acp-changelog*
2.14.1
- Changed the way of auto-popup for avoiding an issue about filename
completion.
- Fixed a bug that popup menu was opened twice when auto-popup was done.
2.14
- Added the support for perl-completion.vim.
2.13
- Changed to sort snipMate's triggers.
- Fixed a bug that a wasted character was inserted after snipMate's trigger
completion.
2.12.1
- Changed to avoid a strange behavior with Microsoft IME.
2.12
- Added g:acp_behaviorKeywordIgnores option.
- Added g:acp_behaviorUserDefinedMeets option and removed
g:acp_behaviorUserDefinedPattern.
- Changed to do auto-popup only when a buffer is modified.
- Changed the structure of g:acp_behavior option.
- Changed to reflect a change of behavior options (named g:acp_behavior*)
any time it is done.
- Fixed a bug that completions after omni completions or snipMate's trigger
completion were never attempted when no candidate for the former
completions was found.
2.11.1
- Fixed a bug that a snipMate's trigger could not be expanded when it was
completed.
2.11
- Implemented experimental feature which is snipMate's trigger completion.
2.10
- Improved the response by changing not to attempt any completion when
keyword characters are entered after a word which has been found that it
has no completion candidate at the last attempt of completions.
- Improved the response by changing to close popup menu when <BS> was
pressed and the text before the cursor would not match with the pattern of
current behavior.
2.9
- Changed default behavior to support XML omni completion.
- Changed default value of g:acp_behaviorKeywordCommand option.
The option with "\<C-p>" cause a problem which inserts a match without
<CR> when 'dictionary' has been set and keyword completion is done.
- Changed to show error message when incompatible with a installed vim.
2.8.1
- Fixed a bug which inserted a selected match to the next line when
auto-wrapping (enabled with 'formatoptions') was performed.
2.8
- Added g:acp_behaviorUserDefinedFunction option and
g:acp_behaviorUserDefinedPattern option for users who want to make custom
completion auto-popup.
- Fixed a bug that setting 'spell' on a new buffer made typing go crazy.
2.7
- Changed naming conventions for filenames, functions, commands, and options
and thus renamed them.
- Added g:acp_behaviorKeywordCommand option. If you prefer the previous
behavior for keyword completion, set this option "\<C-n>".
- Changed default value of g:acp_ignorecaseOption option.
The following were done by Ingo Karkat:
- ENH: Added support for setting a user-provided 'completefunc' during the
completion, configurable via g:acp_behavior.
- BUG: When the configured completion is <C-p> or <C-x><C-p>, the command to
restore the original text (in on_popup_post()) must be reverted, too.
- BUG: When using a custom completion function (<C-x><C-u>) that also uses
an s:...() function name, the s:GetSidPrefix() function dynamically
determines the wrong SID. Now calling s:DetermineSidPrefix() once during
sourcing and caching the value in s:SID.
- BUG: Should not use custom defined <C-X><C-...> completion mappings. Now
consistently using unmapped completion commands everywhere. (Beforehand,
s:PopupFeeder.feed() used mappings via feedkeys(..., 'm'), but
s:PopupFeeder.on_popup_post() did not due to its invocation via
:map-expr.)
2.6:
- Improved the behavior of omni completion for HTML/XHTML.
2.5:
- Added some options to customize behavior easily:
g:AutoComplPop_BehaviorKeywordLength
g:AutoComplPop_BehaviorFileLength
g:AutoComplPop_BehaviorRubyOmniMethodLength
g:AutoComplPop_BehaviorRubyOmniSymbolLength
g:AutoComplPop_BehaviorPythonOmniLength
g:AutoComplPop_BehaviorHtmlOmniLength
g:AutoComplPop_BehaviorCssOmniPropertyLength
g:AutoComplPop_BehaviorCssOmniValueLength
2.4:
- Added g:AutoComplPop_MappingDriven option.
2.3.1:
- Changed to set 'lazyredraw' while a popup menu is visible to avoid
flickering.
- Changed a behavior for CSS.
- Added support for GetLatestVimScripts.
2.3:
- Added a behavior for Python to support omni completion.
- Added a behavior for CSS to support omni completion.
2.2:
- Changed not to work when 'paste' option is set.
- Fixed AutoComplPopEnable command and AutoComplPopDisable command to
map/unmap "i" and "R".
2.1:
- Fixed the problem caused by "." command in Normal mode.
- Changed to map "i" and "R" to feed completion command after starting
Insert mode.
- Avoided the problem caused by Windows IME.
2.0:
- Changed to use CursorMovedI event to feed a completion command instead of
key mapping. Now the auto-popup is triggered by moving the cursor.
- Changed to feed completion command after starting Insert mode.
- Removed g:AutoComplPop_MapList option.
1.7:
- Added behaviors for HTML/XHTML. Now supports the omni completion for
HTML/XHTML.
- Changed not to show expressions for CTRL-R =.
- Changed not to set 'nolazyredraw' while a popup menu is visible.
1.6.1:
- Changed not to trigger the filename completion by a text which has
multi-byte characters.
1.6:
- Redesigned g:AutoComplPop_Behavior option.
- Changed default value of g:AutoComplPop_CompleteOption option.
- Changed default value of g:AutoComplPop_MapList option.
1.5:
- Implemented continuous-completion for the filename completion. And added
new option to g:AutoComplPop_Behavior.
1.4:
- Fixed the bug that the auto-popup was not suspended in fuzzyfinder.
- Fixed the bug that an error has occurred with Ruby-omni-completion unless
Ruby interface.
1.3:
- Supported Ruby-omni-completion by default.
- Supported filename completion by default.
- Added g:AutoComplPop_Behavior option.
- Added g:AutoComplPop_CompleteoptPreview option.
- Removed g:AutoComplPop_MinLength option.
- Removed g:AutoComplPop_MaxLength option.
- Removed g:AutoComplPop_PopupCmd option.
1.2:
- Fixed bugs related to 'completeopt'.
1.1:
- Added g:AutoComplPop_IgnoreCaseOption option.
- Added g:AutoComplPop_NotEnableAtStartup option.
- Removed g:AutoComplPop_LoadAndEnable option.
1.0:
- g:AutoComplPop_LoadAndEnable option for a startup activation is added.
- AutoComplPopLock command and AutoComplPopUnlock command are added to
suspend and resume.
- 'completeopt' and 'complete' options are changed temporarily while
completing by this script.
0.4:
- The first match are selected when the popup menu is Opened. You can insert
the first match with CTRL-Y.
0.3:
- Fixed the problem that the original text is not restored if 'longest' is
not set in 'completeopt'. Now the plugin works whether or not 'longest' is
set in 'completeopt', and also 'menuone'.
0.2:
- When completion matches are not found, insert CTRL-E to stop completion.
- Clear the echo area.
- Fixed the problem in case of dividing words by symbols, popup menu is
not opened.
0.1:
- First release.
==============================================================================
ABOUT *acp-about* *acp-contact* *acp-author*
Author: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
Licence: MIT Licence
URL: http://www.vim.org/scripts/script.php?script_id=1879
http://bitbucket.org/ns9tks/vim-autocomplpop/
Bugs/Issues/Suggestions/Improvements ~
Please submit to http://bitbucket.org/ns9tks/vim-autocomplpop/issues/ .
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,177 +0,0 @@
*alternate.txt* Alternate Plugin Sat May 13 15:35:38 CDT 2006
Author: Michael Sharpe <feline@irendi.com>
Copyright: (c) 2000-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.
==============================================================================
1. Contents *AS* *AV* *AT* *AN* *IH* *IHS* *IHV* *IHT* *IHN* *alternate*
1. Contents...........................: |alternate|
2. Purpose............................: |alternate-purpose|
3. Commands...........................: |alternate-commands|
4. Configuration......................: |alternate-config|
5. Installation.......................: |alternate-installation|
6. Bugs/Enhancements..................: |alternate-support|
7. Acknowledgments....................: |alternate-acknowledgments|
==============================================================================
2. Purpose *alternate-purpose*
The purpose of a.vim is to allow quick and easy switching between source files
and corresponding header files. Many languages (C, C++, ada, ocaml, lex/yacc)
have the concept of source/header files or the like. It is quite common during
development or review to need to edit both files together. This plugin attempts
to simplify that process. There are commands which while editing a source
file allow for the quick switching to the corresponding header and vice versa.
The only difference between the commands is how the switch occurs. More recent
functionality allow the switching to a file under the cursor too. In the
following sections the commands, configuration and installation procedures are
described.
==============================================================================
3. Commands *alternate-commands*
There are 4 commands provided by this plugin. They are
:A switches to the header file corresponding to the source file in the current
buffer (or vice versa).
:AS similar to :A except the current buffer is split horizontally such that the
source file is on one split and the header is in the other.
:AV similar to :AS except that the split is vertical
:AT similar to :AS and :AV except a new tab is opened instead of a split
:IH switches to the file under cursor (or the file specified with the
command). This command uses the builtin a.vim search path support and the
&path variable in conjunction.
:IHS similar to :IH execpt the current buffer is split horizontally first
:IHS similar to :IH execpt the current buffer is split vertically first
:IHS similar to :IH execpt a new tab is created for the file being switched to
:IHN switches to the next matching file for the original selection
In all cases if the corresponding alternate file is already loaded that buffer
is preferred. That is this plugin will never load the same file twice.
Some maps are also provided for the IH command (mainly for example purposes)
<Leader>ih - switches to the file under the cursor using the :IHS command
<Leader>is - switches to the source file of the header file under the cursor
using the :IHS command and the :A command
<leader>ihn - switches to the next match in the sequence.
==============================================================================
4. Configuration *alternate-config*
It is possible to configure three separate pieces of behaviour of this plugin.
a) Extensions: Each language has different extensions for identifying the
source and header files. Many languages support multiple different but related
extensions. As such this plugin allow for the complete specification of how
source and header files correspond to each other via extension maps. There are
a number of maps built in. For example, the following variable setting
g:alternateExtensions_CPP = "inc,h,H,HPP,hpp"
indicates that any file with a .CPP exetension can have a corresponding file
with any of the .inc, .h, .H, .HPP, .hpp extension. The inverse is not
specified by this map though. Typically each extension will have a mapping. So
there would exist maps for .h, .inc, .H, .HPP, .hpp too. Extension maps should
be specified before loading this plugin. Some of the builtin extension maps are
as follows,
C and C++
g:alternateExtensions_h = "c,cpp,cxx,cc,CC"
g:alternateExtensions_H' = "C,CPP,CXX,CC"
g:alternateExtensions_cpp' = "h,hpp"
g:alternateExtensions_CPP' = "H,HPP"
g:alternateExtensions_c' = "h"
g:alternateExtensions_C' = "H"
g:alternateExtensions_cxx' = "h"
Ada
g:alternateExtensions_adb' = "ads"
g:alternateExtensions_ads' = "adb"
Lex/Yacc
g:alternateExtensions_l' = "y,yacc,ypp"
g:alternateExtensions_lex' = "yacc,y,ypp"
g:alternateExtensions_lpp' = "ypp,y,yacc"
g:alternateExtensions_y' = "l,lex,lpp"
g:alternateExtensions_yacc' = "lex,l,lpp"
g:alternateExtensions_ypp' = "lpp,l,lex"
b) Search Paths: In many projects the location of the source files and the
corresponding header files is not always the same directory. This plugin allows
the search path it uses to locate source and header files to be configured.
The search path is specified by setting the g:alternateSearchPath variable. The
default setting is as follows,
g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc'
This indicates that the corresponding file will be searched for in ../source,
../src. ../include and ../inc all relative to the current file being switched
from. The value of the g:alternateSearchPath variable is simply a comma
separated list of prefixes and directories. The "sfr:" prefix indicates that
the path is relative to the file. Other prefixes are "wdr:" which indicates
that the directory is relative to the current working directory and "abs:"
which indicates the path is absolute. If no prefix is specified "sfr:" is
assumed.
c) Regex Paths: Another type of prefix which can appear in the
g:alternateSearchPath variable is that of "reg:". It is used to apply a regex
to the path of the file in the buffer being switched from to locate the
alternate file. E.g. '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 |substitute|,
|help pattern| and |sub-replace-special| for more details. The exact syntax of
a "reg:" specification is
reg:<sep><pattern><sep><subst><sep><flag><sep>
<sep> seperator character, we often use one of [/|%#]
<pattern> is what you are looking for
<subst> is the output pattern
<flag> can be g for global replace or empty
d) No Alternate Behaviour: When attempting to alternate/switch from a
source/header to its corresponding file it is possible that the corresponding
file does not exist. In this case this plugin will create the missing alternate
file in the same directory as the current file. Some users find this behaviour
irritating. This behaviour can be disabled by setting
g:alternateNoDefaultAlternate to 1. When this variable is not 0 a message will
be displayed indicating that no alternate file exists.
==============================================================================
5. Installation *alternate-installation*
To install this plugin simply drop the a.vim file in to $VIMRUNTIME/plugin
(global or local) or simply source the file from the vimrc file. Ensure that
any configuration occurs before the plugin is loaded/sourced.
==============================================================================
6. Bugs/Enhancements *alternate-support*
Whilst no formal support is provided for this plugin the author is always happy
to receive bug reports and enhancement requests. Please email all such
reports/requests to feline@irendi.com.
==============================================================================
7. Acknowledgments *alternate-acknowledgments*
The author would like to thank everyone who has submitted bug reports and
feature enhancement requests in the past. In particular Bindu Wavell provided
much of the original code implementing the search path and regex functionality.
vim:tw=78:ts=8:ft=help

View file

@ -1,322 +0,0 @@
*arabic.txt* For Vim version 7.4. Last change: 2010 Nov 13
VIM REFERENCE MANUAL by Nadim Shaikli
Arabic Language support (options & mappings) for Vim *Arabic*
{Vi does not have any of these commands}
*E800*
In order to use right-to-left and Arabic mapping support, it is
necessary to compile VIM with the |+arabic| feature.
These functions have been created by Nadim Shaikli <nadim-at-arabeyes.org>
It is best to view this file with these settings within VIM's GUI: >
:set encoding=utf-8
:set arabicshape
Introduction
------------
Arabic is a rather demanding language in which a number of special
features are required. Characters are right-to-left oriented and
ought to appear as such on the screen (i.e. from right to left).
Arabic also requires shaping of its characters, meaning the same
character has a different visual form based on its relative location
within a word (initial, medial, final or stand-alone). Arabic also
requires two different forms of combining and the ability, in
certain instances, to either superimpose up to two characters on top
of another (composing) or the actual substitution of two characters
into one (combining). Lastly, to display Arabic properly one will
require not only ISO-8859-6 (U+0600-U+06FF) fonts, but will also
require Presentation Form-B (U+FE70-U+FEFF) fonts both of which are
subsets within a so-called ISO-10646-1 font.
The commands, prompts and help files are not in Arabic, therefore
the user interface remains the standard Vi interface.
Highlights
----------
o Editing left-to-right files as in the original VIM hasn't changed.
o Viewing and editing files in right-to-left windows. File
orientation is per window, so it is possible to view the same
file in right-to-left and left-to-right modes, simultaneously.
o No special terminal with right-to-left capabilities is required.
The right-to-left changes are completely hardware independent.
Only Arabic fonts are necessary.
o Compatible with the original VIM. Almost all features work in
right-to-left mode (there are liable to be bugs).
o Changing keyboard mapping and reverse insert modes using a single
command.
o Toggling complete Arabic support via a single command.
o While in Arabic mode, numbers are entered from left to right. Upon
entering a none number character, that character will be inserted
just into the left of the last number.
o Arabic keymapping on the command line in reverse insert mode.
o Proper Bidirectional functionality is possible given VIM is
started within a Bidi capable terminal emulator.
Arabic Fonts *arabicfonts*
------------
VIM requires monospaced fonts of which there are many out there.
Arabic requires ISO-8859-6 as well as Presentation Form-B fonts
(without Form-B, Arabic will _NOT_ be usable). It is highly
recommended that users search for so-called 'ISO-10646-1' fonts.
Do an Internet search or check www.arabeyes.org for further
info on where to attain the necessary Arabic fonts.
Font Installation
-----------------
o Installation of fonts for X Window systems (Unix/Linux)
Depending on your system, copy your_ARABIC_FONT file into a
directory of your choice. Change to the directory containing
the Arabic fonts and execute the following commands:
% mkfontdir
% xset +fp path_name_of_arabic_fonts_directory
Usage
-----
Prior to the actual usage of Arabic within VIM, a number of settings
need to be accounted for and invoked.
o Setting the Arabic fonts
+ For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done
by entering the following command in the VIM window.
>
:set guifont=your_ARABIC_FONT
<
NOTE: the string 'your_ARABIC_FONT' is used to denote a complete
font name akin to that used in Linux/Unix systems.
(e.g. -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1)
You can append the 'guifont' set command to your .vimrc file
in order to get the same above noted results. In other words,
you can include ':set guifont=your_ARABIC_FONT' to your .vimrc
file.
+ Under the X Window environment, you can also start VIM with
'-fn your_ARABIC_FONT' option.
o Setting the appropriate character Encoding
To enable the correct Arabic encoding the following command needs
to be appended,
>
:set encoding=utf-8
<
to your .vimrc file (entering the command manually into you VIM
window is highly discouraged). In short, include ':set
encoding=utf-8' to your .vimrc file.
Attempts to use Arabic without UTF-8 will result the following
warning message,
*W17* >
Arabic requires UTF-8, do ':set encoding=utf-8'
o Enable Arabic settings [short-cut]
In order to simplify and streamline things, you can either invoke
VIM with the command-line option,
% vim -A my_utf8_arabic_file ...
or enable 'arabic' via the following command within VIM
>
:set arabic
<
The two above noted possible invocations are the preferred manner
in which users are instructed to proceed. Barring an enabled 'termbidi'
setting, both command options:
1. set the appropriate keymap
2. enable the deletion of a single combined pair character
3. enable rightleft mode
4. enable rightleftcmd mode (affecting the command-line)
5. enable arabicshape mode (do visual character alterations)
You may also append the command to your .vimrc file and simply
include ':set arabic' to it.
You are also capable of disabling Arabic support via
>
:set noarabic
<
which resets everything that the command had enabled without touching
the global settings as they could affect other possible open buffers.
In short the 'noarabic' command,
1. resets to the alternate keymap
2. disables the deletion of a single combined pair character
3. disables rightleft mode
NOTE: the 'arabic' command takes into consideration 'termbidi' for
possible external bi-directional (bidi) support from the
terminal ("mlterm" for instance offers such support).
'termbidi', if available, is superior to rightleft support
and its support is preferred due to its level of offerings.
'arabic' when 'termbidi' is enabled only sets the keymap.
If, on the other hand, you'd like to be verbose and explicit and
are opting not to use the 'arabic' short-cut command, here's what
is needed (i.e. if you use ':set arabic' you can skip this section) -
+ Arabic Keymapping Activation
To activate the Arabic keymap (i.e. to remap your English/Latin
keyboard to look-n-feel like a standard Arabic one), set the
'keymap' command to "arabic". This is done by entering
>
:set keymap=arabic
<
in your VIM window. You can also append the 'keymap' set command to
your .vimrc file. In other words, you can include ':set keymap=arabic'
to your .vimrc file.
To turn toggle (or switch) your keymapping between Arabic and the
default mapping (English), it is advised that users use the 'CTRL-^'
key press while in insert (or add/replace) mode. The command-line
will display your current mapping by displaying an "Arabic" string
next to your insertion mode (e.g. -- INSERT Arabic --) indicating
your current keymap.
+ Arabic deletion of a combined pair character
By default VIM has the 'delcombine' option disabled. This option
allows the deletion of ALEF in a LAM_ALEF (LAA) combined character
and still retain the LAM (i.e. it reverts to treating the combined
character as its natural two characters form -- this also pertains
to harakat and their combined forms). You can enable this option
by entering
>
:set delcombine
<
in our VIM window. You can also append the 'delcombine' set command
to your .vimrc file. In other words, you can include ':set delcombine'
to your .vimrc file.
+ Arabic right-to-left Mode
By default VIM starts in Left-to-right mode. 'rightleft' is the
command that allows one to alter a window's orientation - that can
be accomplished via,
- Toggling between left-to-right and right-to-left modes is
accomplished through ':set rightleft' and ':set norightleft'.
- While in Left-to-right mode, enter ':set rl' in the command line
('rl' is the abbreviation for rightleft).
- Put the ':set rl' line in your '.vimrc' file to start Vim in
right-to-left mode permanently.
+ Arabic right-to-left command-line Mode
For certain commands the editing can be done in right-to-left mode.
Currently this is only applicable to search commands.
This is controlled with the 'rightleftcmd' option. The default is
"search", which means that windows in which 'rightleft' is set will
edit search commands in right-left mode. To disable this behavior,
>
:set rightleftcmd=
<
To enable right-left editing of search commands again,
>
:set rightleftcmd&
<
+ Arabic Shaping Mode
To activate the required visual characters alterations (shaping,
composing, combining) which the Arabic language requires, enable
the 'arabicshape' command. This is done by entering
>
:set arabicshape
<
in our VIM window. You can also append the 'arabicshape' set
command to your .vimrc file. In other words, you can include
':set arabicshape' to your .vimrc file.
Keymap/Keyboard *arabickeymap*
---------------
The character/letter encoding used in VIM is the standard UTF-8.
It is widely discouraged that any other encoding be used or even
attempted.
Note: UTF-8 is an all encompassing encoding and as such is
the only supported (and encouraged) encoding with
regard to Arabic (all other proprietary encodings
should be discouraged and frowned upon).
o Keyboard
+ CTRL-^ in insert/replace mode toggles between Arabic/Latin mode
+ Keyboard mapping is based on the Microsoft's Arabic keymap (the
de facto standard in the Arab world):
+---------------------------------------------------------------------+
|! |@ |# |$ |% |^ |& |* |( |) |_ |+ || |~ ّ |
|1 ١ |2 ٢ |3 ٣ |4 ٤ |5 ٥ |6 ٦ |7 ٧ |8 ٨ |9 ٩ |0 ٠ |- |= |\ |` ذ |
+---------------------------------------------------------------------+
|Q َ |W ً |E ُ |R ٌ |T لإ |Y إ |U ` |I ÷ |O x |P ؛ |{ < |} > |
|q ض |w ص |e ث |r ق |t ف |y غ |u ع |i ه |o خ |p ح |[ ج |] د |
+-----------------------------------------------------------+
|A ِ |S ٍ |D [ |F ] |G لأ |H أ |J ـ |K ، |L / |: |" |
|a ش |s س |d ي |f ب |g ل |h ا |j ت |k ن |l م |; ك |' ط |
+------------------------------------------------------+
|Z ~ |X ْ |C { |V } |B لآ |N آ |M ' |< , |> . |? ؟ |
|z ئ |x ء |c ؤ |v ر |b لا |n ى |m ة |, و |. ز |/ ظ |
+-------------------------------------------------+
Restrictions
------------
o VIM in its GUI form does not currently support Bi-directionality
(i.e. the ability to see both Arabic and Latin intermixed within
the same line).
Known Bugs
----------
There is one known minor bug,
1. If you insert a haraka (e.g. Fatha (U+064E)) after a LAM (U+0644)
and then insert an ALEF (U+0627), the appropriate combining will
not happen due to the sandwiched haraka resulting in something
that will NOT be displayed correctly.
WORK-AROUND: Don't include harakats between LAM and ALEF combos.
In general, don't anticipate to see correct visual
representation with regard to harakats and LAM+ALEF
combined characters (even those entered after both
characters). The problem noted is strictly a visual
one, meaning saving such a file will contain all the
appropriate info/encodings - nothing is lost.
No other bugs are known to exist.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,175 +0,0 @@
*debug.txt* For Vim version 7.4. Last change: 2012 Feb 11
VIM REFERENCE MANUAL by Bram Moolenaar
Debugging Vim *debug-vim*
This is for debugging Vim itself, when it doesn't work properly.
For debugging Vim scripts, functions, etc. see |debug-scripts|
1. Location of a crash, using gcc and gdb |debug-gcc|
2. Locating memory leaks |debug-leaks|
3. Windows Bug Reporting |debug-win32|
==============================================================================
1. Location of a crash, using gcc and gdb *debug-gcc* *gdb*
When Vim crashes in one of the test files, and you are using gcc for
compilation, here is what you can do to find out exactly where Vim crashes.
This also applies when using the MingW tools.
1. Compile Vim with the "-g" option (there is a line in the src/Makefile for
this, which you can uncomment). Also make sure "strip" is disabled (do not
install it, or use the line "STRIP = /bin/true").
2. Execute these commands (replace "11" with the test that fails): >
cd testdir
gdb ../vim
run -u unix.vim -U NONE -s dotest.in test11.in
3. Check where Vim crashes, gdb should give a message for this.
4. Get a stack trace from gdb with this command: >
where
< You can check out different places in the stack trace with: >
frame 3
< Replace "3" with one of the numbers in the stack trace.
==============================================================================
2. Locating memory leaks *debug-leaks* *valgrind*
If you suspect Vim is leaking memory and you are using Linux, the valgrind
tool is very useful to pinpoint memory leaks.
First of all, build Vim with EXITFREE defined. Search for this in MAKEFILE
and uncomment the line.
Use this command to start Vim:
>
valgrind --log-file=valgrind.log --leak-check=full ./vim
Note: Vim will run much slower. If your .vimrc is big or you have several
plugins you need to be patient for startup, or run with the "-u NONE"
argument.
There are often a few leaks from libraries, such as getpwuid() and
XtVaAppCreateShell(). Those are unavoidable. The number of bytes should be
very small a Kbyte or less.
==============================================================================
3. Windows Bug Reporting *debug-win32*
If the Windows version of Vim crashes in a reproducible manner, you can take
some steps to provide a useful bug report.
3.1 GENERIC ~
You must obtain the debugger symbols (PDB) file for your executable: gvim.pdb
for gvim.exe, or vim.pdb for vim.exe. The PDB should be available from the
same place that you obtained the executable. Be sure to use the PDB that
matches the EXE (same date).
If you built the executable yourself with the Microsoft Visual C++ compiler,
then the PDB was built with the EXE.
Alternatively, if you have the source files, you can import Make_ivc.mak into
Visual Studio as a workspace. Then select a debug configuration, build and
you can do all kinds of debugging (set breakpoints, watch variables, etc.).
If you have Visual Studio, use that instead of the VC Toolkit and WinDbg.
For other compilers, you should always use the corresponding debugger: TD for
a Vim executable compiled with the Borland compiler; gdb (see above
|debug-gcc|) for the Cygwin and MinGW compilers.
*debug-vs2005*
3.2 Debugging Vim crashes with Visual Studio 2005/Visual C++ 2005 Express ~
First launch vim.exe or gvim.exe and then launch Visual Studio. (If you don't
have Visual Studio, follow the instructions at |get-ms-debuggers| to obtain a
free copy of Visual C++ 2005 Express Edition.)
On the Tools menu, click Attach to Process. Choose the Vim process.
In Vim, reproduce the crash. A dialog will appear in Visual Studio, telling
you about the unhandled exception in the Vim process. Click Break to break
into the process.
Visual Studio will pop up another dialog, telling you that no symbols are
loaded and that the source code cannot be displayed. Click OK.
Several windows will open. Right-click in the Call Stack window. Choose Load
Symbols. The Find Symbols dialog will open, looking for (g)vim.pdb. Navigate
to the directory where you have the PDB file and click Open.
At this point, you should have a full call stack with vim function names and
line numbers. Double-click one of the lines and the Find Source dialog will
appear. Navigate to the directory where the Vim source is (if you have it.)
If you don't know how to debug this any further, follow the instructions
at ":help bug-reports". Paste the call stack into the bug report.
If you have a non-free version of Visual Studio, you can save a minidump via
the Debug menu and send it with the bug report. A minidump is a small file
(<100KB), which contains information about the state of your process.
Visual C++ 2005 Express Edition cannot save minidumps and it cannot be
installed as a just-in-time debugger. Use WinDbg, |debug-windbg|, if you
need to save minidumps or you want a just-in-time (postmortem) debugger.
*debug-windbg*
3.3 Debugging Vim crashes with WinDbg ~
See |get-ms-debuggers| to obtain a copy of WinDbg.
As with the Visual Studio IDE, you can attach WinDbg to a running Vim process.
You can also have your system automatically invoke WinDbg as a postmortem
debugger. To set WinDbg as your postmortem debugger, run "windbg -I".
To attach WinDbg to a running Vim process, launch WinDbg. On the File menu,
choose Attach to a Process. Select the Vim process and click OK.
At this point, choose Symbol File Path on the File menu, and add the folder
containing your Vim PDB to the sympath. If you have Vim source available,
use Source File Path on the File menu. You can now open source files in WinDbg
and set breakpoints, if you like. Reproduce your crash. WinDbg should open the
source file at the point of the crash. Using the View menu, you can examine
the call stack, local variables, watch windows, and so on.
If WinDbg is your postmortem debugger, you do not need to attach WinDbg to
your Vim process. Simply reproduce the crash and WinDbg will launch
automatically. As above, set the Symbol File Path and the Source File Path.
To save a minidump, type the following at the WinDbg command line: >
.dump vim.dmp
<
*debug-minidump*
3.4 Opening a Minidump ~
If you have a minidump file, you can open it in Visual Studio or in WinDbg.
In Visual Studio 2005: on the File menu, choose Open, then Project/Solution.
Navigate to the .dmp file and open it. Now press F5 to invoke the debugger.
Follow the instructions in |debug-vs2005| to set the Symbol File Path.
In WinDbg: choose Open Crash Dump on the File menu. Follow the instructions in
|debug-windbg| to set the Symbol File Path.
*get-ms-debuggers*
3.5 Obtaining Microsoft Debugging Tools ~
The Debugging Tools for Windows (including WinDbg) can be downloaded from
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
This includes the WinDbg debugger.
Visual C++ 2005 Express Edition can be downloaded for free from:
http://msdn.microsoft.com/vstudio/express/visualC/default.aspx
=========================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,140 +0,0 @@
*debugger.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Gordon Prieur
Debugger Support Features *debugger-support*
1. Debugger Features |debugger-features|
2. Vim Compile Options |debugger-compilation|
3. Integrated Debuggers |debugger-integration|
{Vi does not have any of these features}
==============================================================================
1. Debugger Features *debugger-features*
The following features are available for an integration with a debugger or
an Integrated Programming Environment (IPE) or Integrated Development
Environment (IDE):
Alternate Command Input |alt-input|
Debug Signs |debug-signs|
Debug Source Highlight |debug-highlight|
Message Footer |gui-footer|
Balloon Evaluation |balloon-eval|
These features were added specifically for use in the Motif version of gvim.
However, the |alt-input| and |debug-highlight| were written to be usable in
both vim and gvim. Some of the other features could be used in the non-GUI
vim with slight modifications. However, I did not do this nor did I test the
reliability of building for vim or non Motif GUI versions.
1.1 Alternate Command Input *alt-input*
For Vim to work with a debugger there must be at least an input connection
with a debugger or external tool. In many cases there will also be an output
connection but this isn't absolutely necessary.
The purpose of the input connection is to let the external debugger send
commands to Vim. The commands sent by the debugger should give the debugger
enough control to display the current debug environment and state.
The current implementation is based on the X Toolkit dispatch loop and the
XtAddInput() function call.
1.2 Debug Signs *debug-signs*
Many debuggers mark specific lines by placing a small sign or color highlight
on the line. The |:sign| command lets the debugger set this graphic mark. Some
examples where this feature would be used would be a debugger showing an arrow
representing the Program Counter (PC) of the program being debugged. Another
example would be a small stop sign for a line with a breakpoint. These visible
highlights let the user keep track of certain parts of the state of the
debugger.
This feature can be used with more than debuggers, too. An IPE can use a sign
to highlight build errors, searched text, or other things. The sign feature
can also work together with the |debug-highlight| to ensure the mark is
highly visible.
Debug signs are defined and placed using the |:sign| command.
1.3 Debug Source Highlight *debug-highlight*
This feature allows a line to have a predominant highlight. The highlight is
intended to make a specific line stand out. The highlight could be made to
work for both vim and gvim, whereas the debug sign is, in most cases, limited
to gvim. The one exception to this is Sun Microsystem's dtterm. The dtterm
from Sun has a "sign gutter" for showing signs.
1.4 Message Footer *gui-footer*
The message footer can be used to display messages from a debugger or IPE. It
can also be used to display menu and toolbar tips. The footer area is at the
bottom of the GUI window, below the line used to display colon commands.
The display of the footer is controlled by the 'guioptions' letter 'F'.
1.5 Balloon Evaluation *balloon-eval*
This feature allows a debugger, or other external tool, to display dynamic
information based on where the mouse is pointing. The purpose of this feature
was to allow Sun's Visual WorkShop debugger to display expression evaluations.
However, the feature was implemented in as general a manner as possible and
could be used for displaying other information as well.
The Balloon Evaluation has some settable parameters too. For Motif the font
list and colors can be set via X resources (XmNballoonEvalFontList,
XmNballoonEvalBackground, and XmNballoonEvalForeground).
The 'balloondelay' option sets the delay before an attempt is made to show a
balloon.
The 'ballooneval' option needs to be set to switch it on.
Balloon evaluation is only available when compiled with the |+balloon_eval|
feature.
The Balloon evaluation functions are also used to show a tooltip for the
toolbar. The 'ballooneval' option does not need to be set for this. But the
other settings apply.
Another way to use the balloon is with the 'balloonexpr' option. This is
completely user definable.
==============================================================================
2. Vim Compile Options *debugger-compilation*
The debugger features were added explicitly for use with Sun's Visual
WorkShop Integrated Programming Environment (ipe). However, they were done
in as generic a manner as possible so that integration with other debuggers
could also use some or all of the tools used with Sun's ipe.
The following compile time preprocessor variables control the features:
Alternate Command Input ALT_X_INPUT
Debug Glyphs FEAT_SIGNS
Debug Highlights FEAT_SIGNS
Message Footer FEAT_FOOTER
Balloon Evaluation FEAT_BEVAL
The first integration with a full IPE/IDE was with Sun Visual WorkShop. To
compile a gvim which interfaces with VWS set the following flag, which sets
all the above flags:
Sun Visual WorkShop FEAT_SUN_WORKSHOP
==============================================================================
3. Integrated Debuggers *debugger-integration*
One fully integrated debugger/IPE/IDE is Sun's Visual WorkShop Integrated
Programming Environment.
For Sun NetBeans support see |netbeans|.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View file

@ -1,502 +0,0 @@
*develop.txt* For Vim version 7.4. Last change: 2013 Apr 27
VIM REFERENCE MANUAL by Bram Moolenaar
Development of Vim. *development*
This text is important for those who want to be involved in further developing
Vim.
1. Design goals |design-goals|
2. Coding style |coding-style|
3. Design decisions |design-decisions|
4. Assumptions |design-assumptions|
See the file README.txt in the "src" directory for an overview of the source
code.
Vim is open source software. Everybody is encouraged to contribute to help
improving Vim. For sending patches a context diff "diff -c" is preferred.
Also see http://www.vim.org/tips/tip.php?tip_id=618.
Also see http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch.
==============================================================================
1. Design goals *design-goals*
Most important things come first (roughly).
Note that quite a few items are contradicting. This is intentional. A
balance must be found between them.
VIM IS... VI COMPATIBLE *design-compatible*
First of all, it should be possible to use Vim as a drop-in replacement for
Vi. When the user wants to, he can use Vim in compatible mode and hardly
notice any difference with the original Vi.
Exceptions:
- We don't reproduce obvious Vi bugs in Vim.
- There are different versions of Vi. I am using Version 3.7 (6/7/85) as a
reference. But support for other versions is also included when possible.
The Vi part of POSIX is not considered a definitive source.
- Vim adds new commands, you cannot rely on some command to fail because it
didn't exist in Vi.
- Vim will have a lot of features that Vi doesn't have. Going back from Vim
to Vi will be a problem, this cannot be avoided.
- Some things are hardly ever used (open mode, sending an e-mail when
crashing, etc.). Those will only be included when someone has a good reason
why it should be included and it's not too much work.
- For some items it is debatable whether Vi compatibility should be
maintained. There will be an option flag for these.
VIM IS... IMPROVED *design-improved*
The IMproved bits of Vim should make it a better Vi, without becoming a
completely different editor. Extensions are done with a "Vi spirit".
- Use the keyboard as much as feasible. The mouse requires a third hand,
which we don't have. Many terminals don't have a mouse.
- When the mouse is used anyway, avoid the need to switch back to the
keyboard. Avoid mixing mouse and keyboard handling.
- Add commands and options in a consistent way. Otherwise people will have a
hard time finding and remembering them. Keep in mind that more commands and
options will be added later.
- A feature that people do not know about is a useless feature. Don't add
obscure features, or at least add hints in documentation that they exist.
- Minimize using CTRL and other modifiers, they are more difficult to type.
- There are many first-time and inexperienced Vim users. Make it easy for
them to start using Vim and learn more over time.
- There is no limit to the features that can be added. Selecting new features
is one based on (1) what users ask for, (2) how much effort it takes to
implement and (3) someone actually implementing it.
VIM IS... MULTI PLATFORM *design-multi-platform*
Vim tries to help as many users on as many platforms as possible.
- Support many kinds of terminals. The minimal demands are cursor positioning
and clear-screen. Commands should only use key strokes that most keyboards
have. Support all the keys on the keyboard for mapping.
- Support many platforms. A condition is that there is someone willing to do
Vim development on that platform, and it doesn't mean messing up the code.
- Support many compilers and libraries. Not everybody is able or allowed to
install another compiler or GUI library.
- People switch from one platform to another, and from GUI to terminal
version. Features should be present in all versions, or at least in as many
as possible with a reasonable effort. Try to avoid that users must switch
between platforms to accomplish their work efficiently.
- That a feature is not possible on some platforms, or only possible on one
platform, does not mean it cannot be implemented. [This intentionally
contradicts the previous item, these two must be balanced.]
VIM IS... WELL DOCUMENTED *design-documented*
- A feature that isn't documented is a useless feature. A patch for a new
feature must include the documentation.
- Documentation should be comprehensive and understandable. Using examples is
recommended.
- Don't make the text unnecessarily long. Less documentation means that an
item is easier to find.
VIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size*
Using Vim must not be a big attack on system resources. Keep it small and
fast.
- Computers are becoming faster and bigger each year. Vim can grow too, but
no faster than computers are growing. Keep Vim usable on older systems.
- Many users start Vim from a shell very often. Startup time must be short.
- Commands must work efficiently. The time they consume must be as small as
possible. Useful commands may take longer.
- Don't forget that some people use Vim over a slow connection. Minimize the
communication overhead.
- Items that add considerably to the size and are not used by many people
should be a feature that can be disabled.
- Vim is a component among other components. Don't turn it into a massive
application, but have it work well together with other programs.
VIM IS... MAINTAINABLE *design-maintain*
- The source code should not become a mess. It should be reliable code.
- Use the same layout in all files to make it easy to read |coding-style|.
- Use comments in a useful way! Quoting the function name and argument names
is NOT useful. Do explain what they are for.
- Porting to another platform should be made easy, without having to change
too much platform-independent code.
- Use the object-oriented spirit: Put data and code together. Minimize the
knowledge spread to other parts of the code.
VIM IS... FLEXIBLE *design-flexible*
Vim should make it easy for users to work in their preferred styles rather
than coercing its users into particular patterns of work. This can be for
items with a large impact (e.g., the 'compatible' option) or for details. The
defaults are carefully chosen such that most users will enjoy using Vim as it
is. Commands and options can be used to adjust Vim to the desire of the user
and its environment.
VIM IS... NOT *design-not*
- Vim is not a shell or an Operating System. You will not be able to run a
shell inside Vim or use it to control a debugger. This should work the
other way around: Use Vim as a component from a shell or in an IDE.
A satirical way to say this: "Unlike Emacs, Vim does not attempt to include
everything but the kitchen sink, but some people say that you can clean one
with it. ;-)"
To use Vim with gdb see: http://www.agide.org and http://clewn.sf.net.
- Vim is not a fancy GUI editor that tries to look nice at the cost of
being less consistent over all platforms. But functional GUI features are
welcomed.
==============================================================================
2. Coding style *coding-style*
These are the rules to use when making changes to the Vim source code. Please
stick to these rules, to keep the sources readable and maintainable.
This list is not complete. Look in the source code for more examples.
MAKING CHANGES *style-changes*
The basic steps to make changes to the code:
1. Adjust the documentation. Doing this first gives you an impression of how
your changes affect the user.
2. Make the source code changes.
3. Check ../doc/todo.txt if the change affects any listed item.
4. Make a patch with "diff -c" against the unmodified code and docs.
5. Make a note about what changed and include it with the patch.
USE OF COMMON FUNCTIONS *style-functions*
Some functions that are common to use, have a special Vim version. Always
consider using the Vim version, because they were introduced with a reason.
NORMAL NAME VIM NAME DIFFERENCE OF VIM VERSION
free() vim_free() Checks for freeing NULL
malloc() alloc() Checks for out of memory situation
malloc() lalloc() Like alloc(), but has long argument
strcpy() STRCPY() Includes cast to (char *), for char_u * args
strchr() vim_strchr() Accepts special characters
strrchr() vim_strrchr() Accepts special characters
isspace() vim_isspace() Can handle characters > 128
iswhite() vim_iswhite() Only TRUE for tab and space
memcpy() mch_memmove() Handles overlapped copies
bcopy() mch_memmove() Handles overlapped copies
memset() vim_memset() Uniform for all systems
NAMES *style-names*
Function names can not be more than 31 characters long (because of VMS).
Don't use "delete" as a variable name, C++ doesn't like it.
Because of the requirement that Vim runs on as many systems as possible, we
need to avoid using names that are already defined by the system. This is a
list of names that are known to cause trouble. The name is given as a regexp
pattern.
is.*() POSIX, ctype.h
to.*() POSIX, ctype.h
d_.* POSIX, dirent.h
l_.* POSIX, fcntl.h
gr_.* POSIX, grp.h
pw_.* POSIX, pwd.h
sa_.* POSIX, signal.h
mem.* POSIX, string.h
str.* POSIX, string.h
wcs.* POSIX, string.h
st_.* POSIX, stat.h
tms_.* POSIX, times.h
tm_.* POSIX, time.h
c_.* POSIX, termios.h
MAX.* POSIX, limits.h
__.* POSIX, system
_[A-Z].* POSIX, system
E[A-Z0-9]* POSIX, errno.h
.*_t POSIX, for typedefs. Use .*_T instead.
wait don't use as argument to a function, conflicts with types.h
index shadows global declaration
time shadows global declaration
new C++ reserved keyword
try Borland C++ doesn't like it to be used as a variable.
clear Mac curses.h
echo Mac curses.h
instr Mac curses.h
meta Mac curses.h
newwin Mac curses.h
nl Mac curses.h
overwrite Mac curses.h
refresh Mac curses.h
scroll Mac curses.h
typeahead Mac curses.h
basename() GNU string function
dirname() GNU string function
get_env_value() Linux system function
VARIOUS *style-various*
Typedef'ed names should end in "_T": >
typedef int some_T;
Define'ed names should be uppercase: >
#define SOME_THING
Features always start with "FEAT_": >
#define FEAT_FOO
Don't use '\"', some compilers can't handle it. '"' works fine.
Don't use:
#if HAVE_SOME
Some compilers can't handle that and complain that "HAVE_SOME" is not defined.
Use
#ifdef HAVE_SOME
or
#if defined(HAVE_SOME)
STYLE *style-examples*
General rule: One statement per line.
Wrong: if (cond) a = 1;
OK: if (cond)
a = 1;
Wrong: while (cond);
OK: while (cond)
;
Wrong: do a = 1; while (cond);
OK: do
a = 1;
while (cond);
Functions start with:
Wrong: int function_name(int arg1, int arg2)
OK: /*
* Explanation of what this function is used for.
*
* Return value explanation.
*/
int
function_name(arg1, arg2)
int arg1; /* short comment about arg1 */
int arg2; /* short comment about arg2 */
{
int local; /* comment about local */
local = arg1 * arg2;
NOTE: Don't use ANSI style function declarations. A few people still have to
use a compiler that doesn't support it.
SPACES AND PUNCTUATION *style-spaces*
No space between a function name and the bracket:
Wrong: func (arg);
OK: func(arg);
Do use a space after if, while, switch, etc.
Wrong: if(arg) for(;;)
OK: if (arg) for (;;)
Use a space after a comma and semicolon:
Wrong: func(arg1,arg2); for (i = 0;i < 2;++i)
OK: func(arg1, arg2); for (i = 0; i < 2; ++i)
Use a space before and after '=', '+', '/', etc.
Wrong: var=a*5;
OK: var = a * 5;
In general: Use empty lines to group lines of code together. Put a comment
just above the group of lines. This makes it easier to quickly see what is
being done.
OK: /* Prepare for building the table. */
get_first_item();
table_idx = 0;
/* Build the table */
while (has_item())
table[table_idx++] = next_item();
/* Finish up. */
cleanup_items();
generate_hash(table);
==============================================================================
3. Design decisions *design-decisions*
Folding
Several forms of folding should be possible for the same buffer. For example,
have one window that shows the text with function bodies folded, another
window that shows a function body.
Folding is a way to display the text. It should not change the text itself.
Therefore the folding has been implemented as a filter between the text stored
in a buffer (buffer lines) and the text displayed in a window (logical lines).
Naming the window
The word "window" is commonly used for several things: A window on the screen,
the xterm window, a window inside Vim to view a buffer.
To avoid confusion, other items that are sometimes called window have been
given another name. Here is an overview of the related items:
screen The whole display. For the GUI it's something like 1024x768
pixels. The Vim shell can use the whole screen or part of it.
shell The Vim application. This can cover the whole screen (e.g.,
when running in a console) or part of it (xterm or GUI).
window View on a buffer. There can be several windows in Vim,
together with the command line, menubar, toolbar, etc. they
fit in the shell.
Spell checking *develop-spell*
When spell checking was going to be added to Vim a survey was done over the
available spell checking libraries and programs. Unfortunately, the result
was that none of them provided sufficient capabilities to be used as the spell
checking engine in Vim, for various reasons:
- Missing support for multi-byte encodings. At least UTF-8 must be supported,
so that more than one language can be used in the same file.
Doing on-the-fly conversion is not always possible (would require iconv
support).
- For the programs and libraries: Using them as-is would require installing
them separately from Vim. That's mostly not impossible, but a drawback.
- Performance: A few tests showed that it's possible to check spelling on the
fly (while redrawing), just like syntax highlighting. But the mechanisms
used by other code are much slower. Myspell uses a hashtable, for example.
The affix compression that most spell checkers use makes it slower too.
- For using an external program like aspell a communication mechanism would
have to be setup. That's complicated to do in a portable way (Unix-only
would be relatively simple, but that's not good enough). And performance
will become a problem (lots of process switching involved).
- Missing support for words with non-word characters, such as "Etten-Leur" and
"et al.", would require marking the pieces of them OK, lowering the
reliability.
- Missing support for regions or dialects. Makes it difficult to accept
all English words and highlight non-Canadian words differently.
- Missing support for rare words. Many words are correct but hardly ever used
and could be a misspelled often-used word.
- For making suggestions the speed is less important and requiring to install
another program or library would be acceptable. But the word lists probably
differ, the suggestions may be wrong words.
Spelling suggestions *develop-spell-suggestions*
For making suggestions there are two basic mechanisms:
1. Try changing the bad word a little bit and check for a match with a good
word. Or go through the list of good words, change them a little bit and
check for a match with the bad word. The changes are deleting a character,
inserting a character, swapping two characters, etc.
2. Perform soundfolding on both the bad word and the good words and then find
matches, possibly with a few changes like with the first mechanism.
The first is good for finding typing mistakes. After experimenting with
hashtables and looking at solutions from other spell checkers the conclusion
was that a trie (a kind of tree structure) is ideal for this. Both for
reducing memory use and being able to try sensible changes. For example, when
inserting a character only characters that lead to good words need to be
tried. Other mechanisms (with hashtables) need to try all possible letters at
every position in the word. Also, a hashtable has the requirement that word
boundaries are identified separately, while a trie does not require this.
That makes the mechanism a lot simpler.
Soundfolding is useful when someone knows how the words sounds but doesn't
know how it is spelled. For example, the word "dictionary" might be written
as "daktonerie". The number of changes that the first method would need to
try is very big, it's hard to find the good word that way. After soundfolding
the words become "tktnr" and "tkxnry", these differ by only two letters.
To find words by their soundfolded equivalent (soundalike word) we need a list
of all soundfolded words. A few experiments have been done to find out what
the best method is. Alternatives:
1. Do the sound folding on the fly when looking for suggestions. This means
walking through the trie of good words, soundfolding each word and
checking how different it is from the bad word. This is very efficient for
memory use, but takes a long time. On a fast PC it takes a couple of
seconds for English, which can be acceptable for interactive use. But for
some languages it takes more than ten seconds (e.g., German, Catalan),
which is unacceptable slow. For batch processing (automatic corrections)
it's too slow for all languages.
2. Use a trie for the soundfolded words, so that searching can be done just
like how it works without soundfolding. This requires remembering a list
of good words for each soundfolded word. This makes finding matches very
fast but requires quite a lot of memory, in the order of 1 to 10 Mbyte.
For some languages more than the original word list.
3. Like the second alternative, but reduce the amount of memory by using affix
compression and store only the soundfolded basic word. This is what Aspell
does. Disadvantage is that affixes need to be stripped from the bad word
before soundfolding it, which means that mistakes at the start and/or end
of the word will cause the mechanism to fail. Also, this becomes slow when
the bad word is quite different from the good word.
The choice made is to use the second mechanism and use a separate file. This
way a user with sufficient memory can get very good suggestions while a user
who is short of memory or just wants the spell checking and no suggestions
doesn't use so much memory.
Word frequency
For sorting suggestions it helps to know which words are common. In theory we
could store a word frequency with the word in the dictionary. However, this
requires storing a count per word. That degrades word tree compression a lot.
And maintaining the word frequency for all languages will be a heavy task.
Also, it would be nice to prefer words that are already in the text. This way
the words that appear in the specific text are preferred for suggestions.
What has been implemented is to count words that have been seen during
displaying. A hashtable is used to quickly find the word count. The count is
initialized from words listed in COMMON items in the affix file, so that it
also works when starting a new file.
This isn't ideal, because the longer Vim is running the higher the counts
become. But in practice it is a noticeable improvement over not using the word
count.
==============================================================================
4. Assumptions *design-assumptions*
Size of variables:
char 8 bit signed
char_u 8 bit unsigned
int 32 or 64 bit signed (16 might be possible with limited features)
unsigned 32 or 64 bit unsigned (16 as with ints)
long 32 or 64 bit signed, can hold a pointer
Note that some compilers cannot handle long lines or strings. The C89
standard specifies a limit of 509 characters.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,419 +0,0 @@
*diff.txt* For Vim version 7.4. Last change: 2013 Jul 07
VIM REFERENCE MANUAL by Bram Moolenaar
*diff* *vimdiff* *gvimdiff* *diff-mode*
This file describes the |+diff| feature: Showing differences between two,
three or four versions of the same file.
The basics are explained in section |08.7| of the user manual.
1. Starting diff mode |vimdiff|
2. Viewing diffs |view-diffs|
3. Jumping to diffs |jumpto-diffs|
4. Copying diffs |copy-diffs|
5. Diff options |diff-options|
{not in Vi}
==============================================================================
1. Starting diff mode
The easiest way to start editing in diff mode is with the "vimdiff" command.
This starts Vim as usual, and additionally sets up for viewing the differences
between the arguments. >
vimdiff file1 file2 [file3 [file4]]
This is equivalent to: >
vim -d file1 file2 [file3 [file4]]
You may also use "gvimdiff" or "vim -d -g". The GUI is started then.
You may also use "viewdiff" or "gviewdiff". Vim starts in readonly mode then.
"r" may be prepended for restricted mode (see |-Z|).
The second and following arguments may also be a directory name. Vim will
then append the file name of the first argument to the directory name to find
the file.
This only works when a standard "diff" command is available. See 'diffexpr'.
Diffs are local to the current tab page |tab-page|. You can't see diffs with
a window in another tab page. This does make it possible to have several
diffs at the same time, each in their own tab page.
What happens is that Vim opens a window for each of the files. This is like
using the |-O| argument. This uses vertical splits. If you prefer horizontal
splits add the |-o| argument: >
vimdiff -o file1 file2 [file3 [file4]]
If you always prefer horizontal splits include "horizontal" in 'diffopt'.
In each of the edited files these options are set:
'diff' on
'scrollbind' on
'cursorbind' on
'scrollopt' includes "hor"
'wrap' off
'foldmethod' "diff"
'foldcolumn' value from 'diffopt', default is 2
These options are set local to the window. When editing another file they are
reset to the global value.
The options can still be overruled from a modeline when re-editing the file.
However, 'foldmethod' and 'wrap' won't be set from a modeline when 'diff' is
set.
The differences shown are actually the differences in the buffer. Thus if you
make changes after loading a file, these will be included in the displayed
diffs. You might have to do ":diffupdate" now and then, not all changes are
immediately taken into account.
In your .vimrc file you could do something special when Vim was started in
diff mode. You could use a construct like this: >
if &diff
setup for diff mode
else
setup for non-diff mode
endif
While already in Vim you can start diff mode in three ways.
*E98*
:diffs[plit] {filename} *:diffs* *:diffsplit*
Open a new window on the file {filename}. The options are set
as for "vimdiff" for the current and the newly opened window.
Also see 'diffexpr'.
*:difft* *:diffthis*
:difft[his] Make the current window part of the diff windows. This sets
the options like for "vimdiff".
:diffp[atch] {patchfile} *E816* *:diffp* *:diffpatch*
Use the current buffer, patch it with the diff found in
{patchfile} and open a buffer on the result. The options are
set as for "vimdiff".
{patchfile} can be in any format that the "patch" program
understands or 'patchexpr' can handle.
Note that {patchfile} should only contain a diff for one file,
the current file. If {patchfile} contains diffs for other
files as well, the results are unpredictable. Vim changes
directory to /tmp to avoid files in the current directory
accidentally being patched. But it may still result in
various ".rej" files to be created. And when absolute path
names are present these files may get patched anyway.
To make these commands use a vertical split, prepend |:vertical|. Examples: >
:vert diffsplit main.c~
:vert diffpatch /tmp/diff
If you always prefer a vertical split include "vertical" in 'diffopt'.
*E96*
There can be up to four buffers with 'diff' set.
Since the option values are remembered with the buffer, you can edit another
file for a moment and come back to the same file and be in diff mode again.
*:diffo* *:diffoff*
:diffo[ff] Switch off diff mode for the current window.
:diffo[ff]! Switch off diff mode for the current window and in all windows
in the current tab page where 'diff' is set.
The ":diffoff" command resets the relevant options to the values they had when
using |:diffsplit|, |:diffpatch| , |:diffthis|. or starting Vim in diff mode.
Otherwise they are set to their default value:
'diff' off
'scrollbind' off
'cursorbind' off
'scrollopt' without "hor"
'wrap' on
'foldmethod' "manual"
'foldcolumn' 0
==============================================================================
2. Viewing diffs *view-diffs*
The effect is that the diff windows show the same text, with the differences
highlighted. When scrolling the text, the 'scrollbind' option will make the
text in other windows to be scrolled as well. With vertical splits the text
should be aligned properly.
The alignment of text will go wrong when:
- 'wrap' is on, some lines will be wrapped and occupy two or more screen
lines
- folds are open in one window but not another
- 'scrollbind' is off
- changes have been made to the text
- "filler" is not present in 'diffopt', deleted/inserted lines makes the
alignment go wrong
All the buffers edited in a window where the 'diff' option is set will join in
the diff. This is also possible for hidden buffers. They must have been
edited in a window first for this to be possible.
*:DiffOrig* *diff-original-file*
Since 'diff' is a window-local option, it's possible to view the same buffer
in diff mode in one window and "normal" in another window. It is also
possible to view the changes you have made to a buffer since the file was
loaded. Since Vim doesn't allow having two buffers for the same file, you
need another buffer. This command is useful: >
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_
\ | diffthis | wincmd p | diffthis
(this is in |vimrc_example.vim|). Use ":DiffOrig" to see the differences
between the current buffer and the file it was loaded from.
A buffer that is unloaded cannot be used for the diff. But it does work for
hidden buffers. You can use ":hide" to close a window without unloading the
buffer. If you don't want a buffer to remain used for the diff do ":set
nodiff" before hiding it.
*:diffu* *:diffupdate*
:diffu[pdate][!] Update the diff highlighting and folds.
Vim attempts to keep the differences updated when you make changes to the
text. This mostly takes care of inserted and deleted lines. Changes within a
line and more complicated changes do not cause the differences to be updated.
To force the differences to be updated use: >
:diffupdate
If the ! is included Vim will check if the file was changed externally and
needs to be reloaded. It will prompt for each changed file, like `:checktime`
was used.
Vim will show filler lines for lines that are missing in one window but are
present in another. These lines were inserted in another file or deleted in
this file. Removing "filler" from the 'diffopt' option will make Vim not
display these filler lines.
Folds are used to hide the text that wasn't changed. See |folding| for all
the commands that can be used with folds.
The context of lines above a difference that are not included in the fold can
be set with the 'diffopt' option. For example, to set the context to three
lines: >
:set diffopt=filler,context:3
The diffs are highlighted with these groups:
|hl-DiffAdd| DiffAdd Added (inserted) lines. These lines exist in
this buffer but not in another.
|hl-DiffChange| DiffChange Changed lines.
|hl-DiffText| DiffText Changed text inside a Changed line. Vim
finds the first character that is different,
and the last character that is different
(searching from the end of the line). The
text in between is highlighted. This means
that parts in the middle that are still the
same are highlighted anyway. Only "iwhite" of
'diffopt' is used here.
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
because they don't really exist in this
buffer.
==============================================================================
3. Jumping to diffs *jumpto-diffs*
Two commands can be used to jump to diffs:
*[c*
[c Jump backwards to the previous start of a change.
When a count is used, do it that many times.
*]c*
]c Jump forwards to the next start of a change.
When a count is used, do it that many times.
It is an error if there is no change for the cursor to move to.
==============================================================================
4. Diff copying *copy-diffs* *E99* *E100* *E101* *E102* *E103*
*merge*
There are two commands to copy text from one buffer to another. The result is
that the buffers will be equal within the specified range.
*:diffg* *:diffget*
:[range]diffg[et] [bufspec]
Modify the current buffer to undo difference with another
buffer. If [bufspec] is given, that buffer is used. If
[bufspec] refers to the current buffer then nothing happens.
Otherwise this only works if there is one other buffer in diff
mode.
See below for [range].
*:diffpu* *:diffput* *E793*
:[range]diffpu[t] [bufspec]
Modify another buffer to undo difference with the current
buffer. Just like ":diffget" but the other buffer is modified
instead of the current one.
When [bufspec] is omitted and there is more than one other
buffer in diff mode where 'modifiable' is set this fails.
See below for [range].
*do*
do Same as ":diffget" without argument or range. The "o" stands
for "obtain" ("dg" can't be used, it could be the start of
"dgg"!). Note: this doesn't work in Visual mode.
*dp*
dp Same as ":diffput" without argument or range.
Note: this doesn't work in Visual mode.
When no [range] is given, the diff at the cursor position or just above it is
affected. When [range] is used, Vim tries to only put or get the specified
lines. When there are deleted lines, this may not always be possible.
There can be deleted lines below the last line of the buffer. When the cursor
is on the last line in the buffer and there is no diff above this line, the
":diffget" and "do" commands will obtain lines from the other buffer.
To be able to get those lines from another buffer in a [range] it's allowed to
use the last line number plus one. This command gets all diffs from the other
buffer: >
:1,$+1diffget
Note that deleted lines are displayed, but not counted as text lines. You
can't move the cursor into them. To fill the deleted lines with the lines
from another buffer use ":diffget" on the line below them.
*E787*
When the buffer that is about to be modified is read-only and the autocommand
that is triggered by |FileChangedRO| changes buffers the command will fail.
The autocommand must not change buffers.
The [bufspec] argument above can be a buffer number, a pattern for a buffer
name or a part of a buffer name. Examples:
:diffget Use the other buffer which is in diff mode
:diffget 3 Use buffer 3
:diffget v2 Use the buffer which matches "v2" and is in
diff mode (e.g., "file.c.v2")
==============================================================================
5. Diff options *diff-options*
Also see |'diffopt'| and the "diff" item of |'fillchars'|.
FINDING THE DIFFERENCES *diff-diffexpr*
The 'diffexpr' option can be set to use something else than the standard
"diff" program to compare two files and find the differences.
When 'diffexpr' is empty, Vim uses this command to find the differences
between file1 and file2: >
diff file1 file2 > outfile
The ">" is replaced with the value of 'shellredir'.
The output of "diff" must be a normal "ed" style diff. Do NOT use a context
diff. This example explains the format that Vim expects: >
1a2
> bbb
4d4
< 111
7c7
< GGG
---
> ggg
The "1a2" item appends the line "bbb".
The "4d4" item deletes the line "111".
The "7c7" item replaces the line "GGG" with "ggg".
When 'diffexpr' is not empty, Vim evaluates it to obtain a diff file in the
format mentioned. These variables are set to the file names used:
v:fname_in original file
v:fname_new new version of the same file
v:fname_out resulting diff file
Additionally, 'diffexpr' should take care of "icase" and "iwhite" in the
'diffopt' option. 'diffexpr' cannot change the value of 'lines' and
'columns'.
Example (this does almost the same as 'diffexpr' being empty): >
set diffexpr=MyDiff()
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-b "
endif
silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
endfunction
The "-a" argument is used to force comparing the files as text, comparing as
binaries isn't useful. The "--binary" argument makes the files read in binary
mode, so that a CTRL-Z doesn't end the text on DOS.
*E810* *E97*
Vim will do a test if the diff output looks alright. If it doesn't, you will
get an error message. Possible causes:
- The "diff" program cannot be executed.
- The "diff" program doesn't produce normal "ed" style diffs (see above).
- The 'shell' and associated options are not set correctly. Try if filtering
works with a command like ":!sort".
- You are using 'diffexpr' and it doesn't work.
If it's not clear what the problem is set the 'verbose' option to one or more
to see more messages.
The self-installing Vim for MS-Windows includes a diff program. If you don't
have it you might want to download a diff.exe. For example from
http://gnuwin32.sourceforge.net/packages/diffutils.htm.
USING PATCHES *diff-patchexpr*
The 'patchexpr' option can be set to use something else than the standard
"patch" program.
When 'patchexpr' is empty, Vim will call the "patch" program like this: >
patch -o outfile origfile < patchfile
This should work fine with most versions of the "patch" program. Note that a
CR in the middle of a line may cause problems, it is seen as a line break.
If the default doesn't work for you, set the 'patchexpr' to an expression that
will have the same effect. These variables are set to the file names used:
v:fname_in original file
v:fname_diff patch file
v:fname_out resulting patched file
Example (this does the same as 'patchexpr' being empty): >
set patchexpr=MyPatch()
function MyPatch()
:call system("patch -o " . v:fname_out . " " . v:fname_in .
\ " < " . v:fname_diff)
endfunction
Make sure that using the "patch" program doesn't have unwanted side effects.
For example, watch out for additionally generated files, which should be
deleted. It should just patch the file and nothing else.
Vim will change directory to "/tmp" or another temp directory before
evaluating 'patchexpr'. This hopefully avoids that files in the current
directory are accidentally patched. Vim will also delete files starting with
v:fname_in and ending in ".rej" and ".orig".
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,269 +0,0 @@
*farsi.txt* For Vim version 7.4. Last change: 2010 Aug 07
VIM REFERENCE MANUAL by Mortaza Ghassab Shiran
Right to Left and Farsi Mapping for Vim *farsi* *Farsi*
{Vi does not have any of these commands}
*E27*
In order to use right-to-left and Farsi mapping support, it is necessary to
compile Vim with the |+farsi| feature.
These functions have been made by Mortaza G. Shiran <shiran@jps.net>
Introduction
------------
In right-to-left oriented files the characters appear on the screen from right
to left. This kind of file is most useful when writing Farsi documents,
composing faxes or writing Farsi memos.
The commands, prompts and help files are not in Farsi, therefore the user
interface remains the standard Vi interface.
Highlights
----------
o Editing left-to-right files as in the original Vim, no change.
o Viewing and editing files in right-to-left windows. File orientation is
per window, so it is possible to view the same file in right-to-left and
left-to-right modes, simultaneously.
o Compatibility to the original Vim. Almost all features work in
right-to-left mode (see bugs below).
o Changing keyboard mapping and reverse insert modes using a single
command.
o Backing from reverse insert mode to the correct place in the file
(if possible).
o While in Farsi mode, numbers are entered from left to right. Upon entering
a none number character, that character will be inserted just into the
left of the last number.
o No special terminal with right-to-left capabilities is required. The
right-to-left changes are completely hardware independent. Only
Farsi font is necessary.
o Farsi keymapping on the command line in reverse insert mode.
o Toggling between left-to-right and right-to-left via F8 function key.
o Toggling between Farsi ISIR-3342 standard encoding and Vim Farsi via F9
function key. Since this makes sense only for the text written in
right-to-left mode, this function is also supported only in right-to-left
mode.
Farsi Fonts *farsi fonts*
-----------
The following files are found in the subdirectories of the '$VIM/farsi/fonts'
directory:
+ far-a01.pcf X Windows fonts for Unix including Linux systems
+ far-a01.bf X Windows fonts for SunOS
+ far-a01.f16 a screen fonts for Unix including Linux systems
+ far-a01.fon a monospaced fonts for Windows NT/95/98
+ far-a01.com a screen fonts for DOS
Font Installation
-----------------
o Installation of fonts for MS Window systems (NT/95/98)
From 'Control Panel' folder, start the 'Fonts' program. Then from 'file'
menu item select 'Install New Fonts ...'. Browse and select the
'far-a01.fon', then follow the installation guide.
NOTE: several people have reported that this does not work. The solution
is unknown.
o Installation of fonts for X Window systems (Unix/Linux)
Depending on your system, copy far-a01.pcf.Z or far-a01.pcf.gz into a
directory of your choice. Change to the directory containing the Farsi
fonts and execute the following commands:
> mkfontdir
> xset +fp path_name_of_farsi_fonts_directory
o Installation of fonts for X Window systems (SunOS)
Copy far-a01.bf font into a directory of your choice.
Change to the directory containing the far-a01.fb fonts and
execute the following commands:
> fldfamily
> xset +fp path_name_of_fonts_directory
o Installation of ASCII screen fonts (Unix/Linux)
For Linux system, copy the far-a01.f16 fonts into /usr/lib/kbd/consolefonts
directory and execute the setfont program as "setfont far-a01.f16". For
other systems (e.g. SCO Unix), please refer to the fonts installation
section of your system administration manuals.
o Installation of ASCII screen fonts (DOS)
After system power on, prior to the first use of Vim, upload the Farsi
fonts by executing the far-a01.com font uploading program.
Usage
-----
Prior to starting Vim, the environment in which Vim can run in Farsi mode,
must be set. In addition to installation of Farsi fonts, following points
refer to some of the system environments, which you may need to set:
Key code mapping, loading graphic card in ASCII screen mode, setting the IO
driver in 8 bit clean mode ... .
o Setting the Farsi fonts
+ For Vim GUI set the 'guifont' to far-a01. This is done by entering
':set guifont=far-a01' in the Vim window.
You can have 'guifont' set to far-a01 by Vim during the Vim startup
by appending the ':set guifont=far-a01' into your .vimrc file
(in case of NT/95/98 platforms _vimrc).
Under the X Window environment, you can also start Vim with the
'-fn far-a01' option.
+ For Vim within a xterm, start a xterm with the Farsi fonts (e.g.
kterm -fn far-a01). Then start Vim inside the kterm.
+ For Vim under DOS, prior to the first usage of Vim, upload the Farsi
fonts by executing the far-a01.com fonts uploading program.
o Farsi Keymapping Activation
To activate the Farsi keymapping, set either 'altkeymap' or 'fkmap'.
This is done by entering ':set akm' or ':set fk' in the Vim window.
You can have 'altkeymap' or 'fkmap' set as default by appending ':set akm'
or ':set fk' in your .vimrc file or _vimrc in case of NT/95/98 platforms.
To turn off the Farsi keymapping as a default second language keymapping,
reset the 'altkeymap' by entering ':set noakm'.
o right-to-left Farsi Mode
By default Vim starts in Left-to-right mode. Following are ways to change
the window orientation:
+ Start Vim with the -F option (e.g. vim -F ...).
+ Use the F8 function key to toggle between left-to-right and right-to-left.
+ While in Left-to-right mode, enter 'set rl' in the command line ('rl' is
the abbreviation for rightleft).
+ Put the 'set rl' line in your '.vimrc' file to start Vim in
right-to-left mode permanently.
Encoding
--------
The letter encoding used is the Vim extended ISIR-3342 standard with a built
in function to convert between Vim extended ISIR-3342 and ISIR-3342 standard.
For document portability reasons, the letter encoding is kept the same across
different platforms (i.e. UNIX's, NT/95/98, MS DOS, ...).
o Keyboard
+ CTRL-_ in insert/replace modes toggles between Farsi(akm)/Latin
mode as follows:
+ CTRL-_ moves the cursor to the end of the typed text in edit mode.
+ CTRL-_ in command mode only toggles keyboard mapping between Farsi(akm)/
Latin. The Farsi text is then entered in reverse insert mode.
+ F8 - Toggles between left-to-right and right-to-left.
+ F9 - Toggles the encoding between ISIR-3342 standard and Vim extended
ISIR-3342 (supported only in right-to-left mode).
+ Keyboard mapping is based on the Iranian ISIRI-2901 standard.
Following table shows the keyboard mapping while Farsi(akm) mode set:
-------------------------------------
` 1 2 3 4 5 6 7 8 9 0 - =
¢ ± ² ³ ´ µ ¶ · ¸ ¹ ° ­ ½
-------------------------------------
~ ! @ # $ % ^ & * ( ) _ +
~ £ § ® ¤ ¥ ª ¬ è ¨ © é «
-------------------------------------
q w e r t z u i o p [ ]
Ó Ò Æ Ù Ø Õ Ö à Ê É Ç ˆ
-------------------------------------
Q W E R T Z U I O P { }
÷ õ ô ó ò ý ð ö [ ] { }
-------------------------------------
a s d f g h j k l ; ' \
Ñ Ð á Ã Ü Á Å Þ Ý Ú Û ë
-------------------------------------
A S D F G H J K L : " |
ù û  þ ú ø À ü æ ç º » ê
-------------------------------------
< y x c v b n m , . /
¾ × Ô Î Í Ì Ë Ä ß ¦ ¯
-------------------------------------
> Y X C V B N M < > ?
¼ ñ Ô Ï Í ¡ Ë Â ¾ ¼ ¿
-------------------------------------
Note:
¡ stands for Farsi PSP (break without space)
¢ stands for Farsi PCN (for HAMZE attribute )
Restrictions
------------
o In insert/replace mode and fkmap (Farsi mode) set, CTRL-B is not
supported.
o If you change the character mapping between Latin/Farsi, the redo buffer
will be reset (emptied). That is, redo is valid and will function (using
'.') only within the mode you are in.
o While numbers are entered in Farsi mode, the redo buffer will be reset
(emptied). That is, you cannot redo the last changes (using '.') after
entering numbers.
o While in left-to-right mode and Farsi mode set, CTRL-R is not supported.
o While in right-to-left mode, the search on 'Latin' pattern does not work,
except if you enter the Latin search pattern in reverse.
o In command mode there is no support for entering numbers from left
to right and also for the sake of flexibility the keymapping logic is
restricted.
o Under the X Window environment, if you want to run Vim within a xterm
terminal emulator and Farsi mode set, you need to have an ANSI compatible
xterm terminal emulator. This is because the letter codes above 128 decimal
have certain meanings in the standard xterm terminal emulator.
Note: Under X Window environment, Vim GUI works fine in Farsi mode.
This eliminates the need of any xterm terminal emulator.
Bugs
----
While in insert/replace and Farsi mode set, if you repeatedly change the
cursor position (via cursor movement) and enter new text and then try to undo
the last change, the undo will lag one change behind. But as you continue to
undo, you will reach the original line of text. You can also use U to undo all
changes made in the current line.
For more information about the bugs refer to rileft.txt.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,621 +0,0 @@
*filetype.txt* For Vim version 7.4. Last change: 2013 May 25
VIM REFERENCE MANUAL by Bram Moolenaar
Filetypes *filetype* *file-type*
1. Filetypes |filetypes|
2. Filetype plugin |filetype-plugins|
3. Docs for the default filetype plugins. |ftplugin-docs|
Also see |autocmd.txt|.
{Vi does not have any of these commands}
==============================================================================
1. Filetypes *filetypes* *file-types*
Vim can detect the type of file that is edited. This is done by checking the
file name and sometimes by inspecting the contents of the file for specific
text.
*:filetype* *:filet*
To enable file type detection, use this command in your vimrc: >
:filetype on
Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc.
NOTE: Filetypes and 'compatible' don't work together well, since being Vi
compatible means options are global. Resetting 'compatible' is recommended,
if you didn't do that already.
Detail: The ":filetype on" command will load one of these files:
Amiga $VIMRUNTIME/filetype.vim
Mac $VIMRUNTIME:filetype.vim
MS-DOS $VIMRUNTIME\filetype.vim
RiscOS Vim:Filetype
Unix $VIMRUNTIME/filetype.vim
VMS $VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file.
When the GUI is running or will start soon, the menu.vim script is
also sourced. See |'go-M'| about avoiding that.
To add your own file types, see |new-filetype| below. To search for help on a
filetype prepend "ft-" and optionally append "-syntax", "-indent" or
"-plugin". For example: >
:help ft-vim-indent
:help ft-vim-syntax
:help ft-man-plugin
If the file type is not detected automatically, or it finds the wrong type,
you can either set the 'filetype' option manually, or add a modeline to your
file. Example, for an IDL file use the command: >
:set filetype=idl
or add this |modeline| to the file:
/* vim: set filetype=idl : */ ~
*:filetype-plugin-on*
You can enable loading the plugin files for specific file types with: >
:filetype plugin on
If filetype detection was not switched on yet, it will be as well.
This actually loads the file "ftplugin.vim" in 'runtimepath'.
The result is that when a file is edited its plugin file is loaded (if there
is one for the detected filetype). |filetype-plugin|
*:filetype-plugin-off*
You can disable it again with: >
:filetype plugin off
The filetype detection is not switched off then. But if you do switch off
filetype detection, the plugins will not be loaded either.
This actually loads the file "ftplugof.vim" in 'runtimepath'.
*:filetype-indent-on*
You can enable loading the indent file for specific file types with: >
:filetype indent on
If filetype detection was not switched on yet, it will be as well.
This actually loads the file "indent.vim" in 'runtimepath'.
The result is that when a file is edited its indent file is loaded (if there
is one for the detected filetype). |indent-expression|
*:filetype-indent-off*
You can disable it again with: >
:filetype indent off
The filetype detection is not switched off then. But if you do switch off
filetype detection, the indent files will not be loaded either.
This actually loads the file "indoff.vim" in 'runtimepath'.
This disables auto-indenting for files you will open. It will keep working in
already opened files. Reset 'autoindent', 'cindent', 'smartindent' and/or
'indentexpr' to disable indenting in an opened file.
*:filetype-off*
To disable file type detection, use this command: >
:filetype off
This will keep the flags for "plugin" and "indent", but since no file types
are being detected, they won't work until the next ":filetype on".
Overview: *:filetype-overview*
command detection plugin indent ~
:filetype on on unchanged unchanged
:filetype off off unchanged unchanged
:filetype plugin on on on unchanged
:filetype plugin off unchanged off unchanged
:filetype indent on on unchanged on
:filetype indent off unchanged unchanged off
:filetype plugin indent on on on on
:filetype plugin indent off unchanged off off
To see the current status, type: >
:filetype
The output looks something like this: >
filetype detection:ON plugin:ON indent:OFF
The file types are also used for syntax highlighting. If the ":syntax on"
command is used, the file type detection is installed too. There is no need
to do ":filetype on" after ":syntax on".
To disable one of the file types, add a line in your filetype file, see
|remove-filetype|.
*filetype-detect*
To detect the file type again: >
:filetype detect
Use this if you started with an empty file and typed text that makes it
possible to detect the file type. For example, when you entered this in a
shell script: "#!/bin/csh".
When filetype detection was off, it will be enabled first, like the "on"
argument was used.
*filetype-overrule*
When the same extension is used for two filetypes, Vim tries to guess what
kind of file it is. This doesn't always work. A number of global variables
can be used to overrule the filetype used for certain extensions:
file name variable ~
*.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asm g:asmsyntax |ft-asm-syntax|
*.prg g:filetype_prg
*.pl g:filetype_pl
*.inc g:filetype_inc
*.w g:filetype_w |ft-cweb-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.p g:filetype_p |ft-pascal-syntax|
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|
*filetype-ignore*
To avoid that certain files are being inspected, the g:ft_ignore_pat variable
is used. The default value is set like this: >
:let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
This means that the contents of compressed files are not inspected.
*new-filetype*
If a file type that you want to use is not detected yet, there are four ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.vim
file. It will be overwritten when installing a new version of Vim.
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
means there can be many files. The advantage is that you can simply drop
this file in the right directory to make it work.
*ftdetect*
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Then create the directory "ftdetect"
inside it. Example for Unix: >
:!mkdir ~/.vim
:!mkdir ~/.vim/ftdetect
<
2. Create a file that contains an autocommand to detect the file type.
Example: >
au BufRead,BufNewFile *.mine set filetype=mine
< Note that there is no "augroup" command, this has already been done
when sourcing your file. You could also use the pattern "*" and then
check the contents of the file to recognize it.
Write this file as "mine.vim" in the "ftdetect" directory in your user
runtime directory. For example, for Unix: >
:w ~/.vim/ftdetect/mine.vim
< 3. To use the new filetype detection you must restart Vim.
The files in the "ftdetect" directory are used after all the default
checks, thus they can overrule a previously detected file type. But you
can also use |:setfiletype| to keep a previously detected filetype.
B. If you want to detect your file after the default file type checks.
This works like A above, but instead of setting 'filetype' unconditionally
use ":setfiletype". This will only set 'filetype' if no file type was
detected yet. Example: >
au BufRead,BufNewFile *.txt setfiletype text
<
You can also use the already detected file type in your command. For
example, to use the file type "mypascal" when "pascal" has been detected: >
au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal
| endif
C. If your file type can be detected by the file name.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
:!mkdir ~/.vim
<
2. Create a file that contains autocommands to detect the file type.
Example: >
" my filetype file
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.mine setfiletype mine
au! BufRead,BufNewFile *.xyz setfiletype drawing
augroup END
< Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.vim/filetype.vim
< 3. To use the new filetype detection you must restart Vim.
Your filetype.vim will be sourced before the default FileType autocommands
have been installed. Your autocommands will match first, and the
":setfiletype" command will make sure that no other autocommands will set
'filetype' after this.
*new-filetype-scripts*
D. If your filetype can only be detected by inspecting the contents of the
file.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
:!mkdir ~/.vim
<
2. Create a vim script file for doing this. Example: >
if did_filetype() " filetype already set..
finish " ..don't do these checks
endif
if getline(1) =~ '^#!.*\<mine\>'
setfiletype mine
elseif getline(1) =~? '\<drawing\>'
setfiletype drawing
endif
< See $VIMRUNTIME/scripts.vim for more examples.
Write this file as "scripts.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.vim/scripts.vim
<
3. The detection will work right away, no need to restart Vim.
Your scripts.vim is loaded before the default checks for file types, which
means that your rules override the default rules in
$VIMRUNTIME/scripts.vim.
*remove-filetype*
If a file type is detected that is wrong for you, install a filetype.vim or
scripts.vim to catch it (see above). You can set 'filetype' to a non-existing
name to avoid that it will be set later anyway: >
:set filetype=ignored
If you are setting up a system with many users, and you don't want each user
to add/remove the same filetypes, consider writing the filetype.vim and
scripts.vim files in a runtime directory that is used for everybody. Check
the 'runtimepath' for a directory to use. If there isn't one, set
'runtimepath' in the |system-vimrc|. Be careful to keep the default
directories!
*autocmd-osfiletypes*
NOTE: this code is currently disabled, as the RISC OS implementation was
removed. In the future this will use the 'filetype' option.
On operating systems which support storing a file type with the file, you can
specify that an autocommand should only be executed if the file is of a
certain type.
The actual type checking depends on which platform you are running Vim
on; see your system's documentation for details.
To use osfiletype checking in an autocommand you should put a list of types to
match in angle brackets in place of a pattern, like this: >
:au BufRead *.html,<&faf;HTML> runtime! syntax/html.vim
This will match:
- Any file whose name ends in ".html"
- Any file whose type is "&faf" or "HTML", where the meaning of these types
depends on which version of Vim you are using.
Unknown types are considered NOT to match.
You can also specify a type and a pattern at the same time (in which case they
must both match): >
:au BufRead <&fff>diff*
This will match files of type "&fff" whose names start with "diff".
*plugin-details*
The "plugin" directory can be in any of the directories in the 'runtimepath'
option. All of these directories will be searched for plugins and they are
all loaded. For example, if this command: >
set runtimepath
produces this output:
runtimepath=/etc/vim,~/.vim,/usr/local/share/vim/vim60 ~
then Vim will load all plugins in these directories and below:
/etc/vim/plugin/ ~
~/.vim/plugin/ ~
/usr/local/share/vim/vim60/plugin/ ~
Note that the last one is the value of $VIMRUNTIME which has been expanded.
What if it looks like your plugin is not being loaded? You can find out what
happens when Vim starts up by using the |-V| argument: >
vim -V2
You will see a lot of messages, in between them is a remark about loading the
plugins. It starts with:
Searching for "plugin/**/*.vim" in ~
There you can see where Vim looks for your plugin scripts.
==============================================================================
2. Filetype plugin *filetype-plugins*
When loading filetype plugins has been enabled |:filetype-plugin-on|, options
will be set and mappings defined. These are all local to the buffer, they
will not be used for other files.
Defining mappings for a filetype may get in the way of the mappings you
define yourself. There are a few ways to avoid this:
1. Set the "maplocalleader" variable to the key sequence you want the mappings
to start with. Example: >
:let maplocalleader = ","
< All mappings will then start with a comma instead of the default, which
is a backslash. Also see |<LocalLeader>|.
2. Define your own mapping. Example: >
:map ,p <Plug>MailQuote
< You need to check the description of the plugin file below for the
functionality it offers and the string to map to.
You need to define your own mapping before the plugin is loaded (before
editing a file of that type). The plugin will then skip installing the
default mapping.
3. Disable defining mappings for a specific filetype by setting a variable,
which contains the name of the filetype. For the "mail" filetype this
would be: >
:let no_mail_maps = 1
4. Disable defining mappings for all filetypes by setting a variable: >
:let no_plugin_maps = 1
<
*ftplugin-overrule*
If a global filetype plugin does not do exactly what you want, there are three
ways to change this:
1. Add a few settings.
You must create a new filetype plugin in a directory early in
'runtimepath'. For Unix, for example you could use this file: >
vim ~/.vim/ftplugin/fortran.vim
< You can set those settings and mappings that you would like to add. Note
that the global plugin will be loaded after this, it may overrule the
settings that you do here. If this is the case, you need to use one of the
following two methods.
2. Make a copy of the plugin and change it.
You must put the copy in a directory early in 'runtimepath'. For Unix, for
example, you could do this: >
cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim
< Then you can edit the copied file to your liking. Since the b:did_ftplugin
variable will be set, the global plugin will not be loaded.
A disadvantage of this method is that when the distributed plugin gets
improved, you will have to copy and modify it again.
3. Overrule the settings after loading the global plugin.
You must create a new filetype plugin in a directory from the end of
'runtimepath'. For Unix, for example, you could use this file: >
vim ~/.vim/after/ftplugin/fortran.vim
< In this file you can change just those settings that you want to change.
==============================================================================
3. Docs for the default filetype plugins. *ftplugin-docs*
CHANGELOG *ft-changelog-plugin*
Allows for easy entrance of Changelog entries in Changelog files. There are
some commands, mappings, and variables worth exploring:
Options:
'comments' is made empty to not mess up formatting.
'textwidth' is set to 78, which is standard.
'formatoptions' the 't' flag is added to wrap when inserting text.
Commands:
NewChangelogEntry Adds a new Changelog entry in an intelligent fashion
(see below).
Local mappings:
<Leader>o Starts a new Changelog entry in an equally intelligent
fashion (see below).
Global mappings:
NOTE: The global mappings are accessed by sourcing the
ftplugin/changelog.vim file first, e.g. with >
runtime ftplugin/changelog.vim
< in your |.vimrc|.
<Leader>o Switches to the ChangeLog buffer opened for the
current directory, or opens it in a new buffer if it
exists in the current directory. Then it does the
same as the local <Leader>o described above.
Variables:
g:changelog_timeformat Deprecated; use g:changelog_dateformat instead.
g:changelog_dateformat The date (and time) format used in ChangeLog entries.
The format accepted is the same as for the
|strftime()| function.
The default is "%Y-%m-%d" which is the standard format
for many ChangeLog layouts.
g:changelog_username The name and email address of the user.
The default is deduced from environment variables and
system files. It searches /etc/passwd for the comment
part of the current user, which informally contains
the real name of the user up to the first separating
comma. then it checks the $NAME environment variable
and finally runs `whoami` and `hostname` to build an
email address. The final form is >
Full Name <user@host>
<
g:changelog_new_date_format
The format to use when creating a new date-entry.
The following table describes special tokens in the
string:
%% insert a single '%' character
%d insert the date from above
%u insert the user from above
%c where to position cursor when done
The default is "%d %u\n\n\t* %c\n\n", which produces
something like (| is where cursor will be, unless at
the start of the line where it denotes the beginning
of the line) >
|2003-01-14 Full Name <user@host>
|
| * |
<
g:changelog_new_entry_format
The format used when creating a new entry.
The following table describes special tokens in the
string:
%c where to position cursor when done
The default is "\t*%c", which produces something
similar to >
| * |
<
g:changelog_date_entry_search
The search pattern to use when searching for a
date-entry.
The same tokens that can be used for
g:changelog_new_date_format can be used here as well.
The default is '^\s*%d\_s*%u' which finds lines
matching the form >
|2003-01-14 Full Name <user@host>
< and some similar formats.
g:changelog_date_end_entry_search
The search pattern to use when searching for the end
of a date-entry.
The same tokens that can be used for
g:changelog_new_date_format can be used here as well.
The default is '^\s*$' which finds lines that contain
only whitespace or are completely empty.
b:changelog_name *b:changelog_name*
Name of the ChangeLog file to look for.
The default is 'ChangeLog'.
b:changelog_path
Path of the ChangeLog to use for the current buffer.
The default is empty, thus looking for a file named
|b:changelog_name| in the same directory as the
current buffer. If not found, the parent directory of
the current buffer is searched. This continues
recursively until a file is found or there are no more
parent directories to search.
b:changelog_entry_prefix
Name of a function to call to generate a prefix to a
new entry. This function takes no arguments and
should return a string containing the prefix.
Returning an empty prefix is fine.
The default generates the shortest path between the
ChangeLog's pathname and the current buffers pathname.
In the future, it will also be possible to use other
variable contexts for this variable, for example, g:.
The Changelog entries are inserted where they add the least amount of text.
After figuring out the current date and user, the file is searched for an
entry beginning with the current date and user and if found adds another item
under it. If not found, a new entry and item is prepended to the beginning of
the Changelog.
FORTRAN *ft-fortran-plugin*
Options:
'expandtab' is switched on to avoid tabs as required by the Fortran
standards unless the user has set fortran_have_tabs in .vimrc.
'textwidth' is set to 72 for fixed source format as required by the
Fortran standards and to 80 for free source format.
'formatoptions' is set to break code and comment lines and to preserve long
lines. You can format comments with |gq|.
For further discussion of fortran_have_tabs and the method used for the
detection of source format see |ft-fortran-syntax|.
GIT COMMIT *ft-gitcommit-plugin*
One command, :DiffGitCached, is provided to show a diff of the current commit
in the preview window. It is equivalent to calling "git diff --cached" plus
any arguments given to the command.
MAIL *ft-mail-plugin*
Options:
'modeline' is switched off to avoid the danger of trojan horses, and to
avoid that a Subject line with "Vim:" in it will cause an
error message.
'textwidth' is set to 72. This is often recommended for e-mail.
'formatoptions' is set to break text lines and to repeat the comment leader
in new lines, so that a leading ">" for quotes is repeated.
You can also format quoted text with |gq|.
Local mappings:
<LocalLeader>q or \\MailQuote
Quotes the text selected in Visual mode, or from the cursor position
to the end of the file in Normal mode. This means "> " is inserted in
each line.
MAN *ft-man-plugin* *:Man*
Displays a manual page in a nice way. Also see the user manual
|find-manpage|.
To start using the ":Man" command before any manual page was loaded, source
this script from your startup vimrc file: >
runtime ftplugin/man.vim
Options:
'iskeyword' the '.' character is added to be able to use CTRL-] on the
manual page name.
Commands:
Man {name} Display the manual page for {name} in a window.
Man {number} {name}
Display the manual page for {name} in a section {number}.
Global mapping:
<Leader>K Displays the manual page for the word under the cursor.
Local mappings:
CTRL-] Jump to the manual page for the word under the cursor.
CTRL-T Jump back to the previous manual page.
PDF *ft-pdf-plugin*
Two maps, <C-]> and <C-T>, are provided to simulate a tag stack for navigating
the PDF. The following are treated as tags:
- The byte offset after "startxref" to the xref table
- The byte offset after the /Prev key in the trailer to an earlier xref table
- A line of the form "0123456789 00000 n" in the xref table
- An object reference like "1 0 R" anywhere in the PDF
These maps can be disabled with >
:let g:no_pdf_maps = 1
<
RPM SPEC *ft-spec-plugin*
Since the text for this plugin is rather long it has been put in a separate
file: |pi_spec.txt|.
SQL *ft-sql*
Since the text for this plugin is rather long it has been put in a separate
file: |ft_sql.txt|.
TEX *ft-tex-plugin* *g:tex_flavor*
If the first line of a *.tex file has the form >
%&<format>
then this determined the file type: plaintex (for plain TeX), context (for
ConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords to
choose context or tex. If no keywords are found, it defaults to plaintex.
You can change the default by defining the variable g:tex_flavor to the format
(not the file type) you use most. Use one of these: >
let g:tex_flavor = "plain"
let g:tex_flavor = "context"
let g:tex_flavor = "latex"
Currently no other formats are recognized.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,590 +0,0 @@
*fold.txt* For Vim version 7.4. Last change: 2010 May 13
VIM REFERENCE MANUAL by Bram Moolenaar
Folding *Folding* *folding* *folds*
You can find an introduction on folding in chapter 28 of the user manual.
|usr_28.txt|
1. Fold methods |fold-methods|
2. Fold commands |fold-commands|
3. Fold options |fold-options|
4. Behavior of folds |fold-behavior|
{Vi has no Folding}
{not available when compiled without the |+folding| feature}
==============================================================================
1. Fold methods *fold-methods*
The folding method can be set with the 'foldmethod' option.
When setting 'foldmethod' to a value other than "manual", all folds are
deleted and new ones created. Switching to the "manual" method doesn't remove
the existing folds. This can be used to first define the folds automatically
and then change them manually.
There are six methods to select folds:
manual manually define folds
indent more indent means a higher fold level
expr specify an expression to define folds
syntax folds defined by syntax highlighting
diff folds for unchanged text
marker folds defined by markers in the text
MANUAL *fold-manual*
Use commands to manually define the fold regions. This can also be used by a
script that parses text to find folds.
The level of a fold is only defined by its nesting. To increase the fold
level of a fold for a range of lines, define a fold inside it that has the
same lines.
The manual folds are lost when you abandon the file. To save the folds use
the |:mkview| command. The view can be restored later with |:loadview|.
INDENT *fold-indent*
The folds are automatically defined by the indent of the lines.
The foldlevel is computed from the indent of the line, divided by the
'shiftwidth' (rounded down). A sequence of lines with the same or higher fold
level form a fold, with the lines with a higher level forming a nested fold.
The nesting of folds is limited with 'foldnestmax'.
Some lines are ignored and get the fold level of the line above or below it,
whichever is lower. These are empty or white lines and lines starting
with a character in 'foldignore'. White space is skipped before checking for
characters in 'foldignore'. For C use "#" to ignore preprocessor lines.
When you want to ignore lines in another way, use the 'expr' method. The
|indent()| function can be used in 'foldexpr' to get the indent of a line.
EXPR *fold-expr*
The folds are automatically defined by their foldlevel, like with the "indent"
method. The value of the 'foldexpr' option is evaluated to get the foldlevel
of a line. Examples:
This will create a fold for all consecutive lines that start with a tab: >
:set foldexpr=getline(v:lnum)[0]==\"\\t\"
This will call a function to compute the fold level: >
:set foldexpr=MyFoldLevel(v:lnum)
This will make a fold out of paragraphs separated by blank lines: >
:set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
this does the same: >
:set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1
Note that backslashes must be used to escape characters that ":set" handles
differently (space, backslash, double quote, etc., see |option-backslash|).
These are the conditions with which the expression is evaluated:
- The current buffer and window are set for the line.
- The variable "v:lnum" is set to the line number.
- The result is used for the fold level in this way:
value meaning ~
0 the line is not in a fold
1, 2, .. the line is in a fold with this level
-1 the fold level is undefined, use the fold level of a
line before or after this line, whichever is the
lowest.
"=" use fold level from the previous line
"a1", "a2", .. add one, two, .. to the fold level of the previous
line
"s1", "s2", .. subtract one, two, .. from the fold level of the
previous line
"<1", "<2", .. a fold with this level ends at this line
">1", ">2", .. a fold with this level starts at this line
It is not required to mark the start (end) of a fold with ">1" ("<1"), a fold
will also start (end) when the fold level is higher (lower) than the fold
level of the previous line.
There must be no side effects from the expression. The text in the buffer,
cursor position, the search patterns, options etc. must not be changed.
You can change and restore them if you are careful.
If there is some error in the expression, or the resulting value isn't
recognized, there is no error message and the fold level will be zero.
For debugging the 'debug' option can be set to "msg", the error messages will
be visible then.
Note: Since the expression has to be evaluated for every line, this fold
method can be very slow!
Try to avoid the "=", "a" and "s" return values, since Vim often has to search
backwards for a line for which the fold level is defined. This can be slow.
|foldlevel()| can be useful to compute a fold level relative to a previous
fold level. But note that foldlevel() may return -1 if the level is not known
yet. And it returns the level at the start of the line, while a fold might
end in that line.
It may happened that folds are not updated properly. You can use |zx| or |zX|
to force updating folds.
SYNTAX *fold-syntax*
A fold is defined by syntax items that have the "fold" argument. |:syn-fold|
The fold level is defined by nesting folds. The nesting of folds is limited
with 'foldnestmax'.
Be careful to specify proper syntax syncing. If this is not done right, folds
may differ from the displayed highlighting. This is especially relevant when
using patterns that match more than one line. In case of doubt, try using
brute-force syncing: >
:syn sync fromstart
DIFF *fold-diff*
The folds are automatically defined for text that is not part of a change or
close to a change.
This method only works properly when the 'diff' option is set for the current
window and changes are being displayed. Otherwise the whole buffer will be
one big fold.
The 'diffopt' option can be used to specify the context. That is, the number
of lines between the fold and a change that are not included in the fold. For
example, to use a context of 8 lines: >
:set diffopt=filler,context:8
The default context is six lines.
When 'scrollbind' is also set, Vim will attempt to keep the same folds open in
other diff windows, so that the same text is visible.
MARKER *fold-marker*
Markers in the text tell where folds start and end. This allows you to
precisely specify the folds. This will allow deleting and putting a fold,
without the risk of including the wrong lines. The 'foldtext' option is
normally set such that the text before the marker shows up in the folded line.
This makes it possible to give a name to the fold.
Markers can have a level included, or can use matching pairs. Including a
level is easier, you don't have to add end markers and avoid problems with
non-matching marker pairs. Example: >
/* global variables {{{1 */
int varA, varB;
/* functions {{{1 */
/* funcA() {{{2 */
void funcA() {}
/* funcB() {{{2 */
void funcB() {}
A fold starts at a "{{{" marker. The following number specifies the fold
level. What happens depends on the difference between the current fold level
and the level given by the marker:
1. If a marker with the same fold level is encountered, the previous fold
ends and another fold with the same level starts.
2. If a marker with a higher fold level is found, a nested fold is started.
3. if a marker with a lower fold level is found, all folds up to and including
this level end and a fold with the specified level starts.
The number indicates the fold level. A zero cannot be used (a marker with
level zero is ignored). You can use "}}}" with a digit to indicate the level
of the fold that ends. The fold level of the following line will be one less
than the indicated level. Note that Vim doesn't look back to the level of the
matching marker (that would take too much time). Example: >
{{{1
fold level here is 1
{{{3
fold level here is 3
}}}3
fold level here is 2
You can also use matching pairs of "{{{" and "}}}" markers to define folds.
Each "{{{" increases the fold level by one, each "}}}" decreases the fold
level by one. Be careful to keep the markers matching! Example: >
{{{
fold level here is 1
{{{
fold level here is 2
}}}
fold level here is 1
You can mix using markers with a number and without a number. A useful way of
doing this is to use numbered markers for large folds, and unnumbered markers
locally in a function. For example use level one folds for the sections of
your file like "structure definitions", "local variables" and "functions".
Use level 2 markers for each definition and function, Use unnumbered markers
inside functions. When you make changes in a function to split up folds, you
don't have to renumber the markers.
The markers can be set with the 'foldmarker' option. It is recommended to
keep this at the default value of "{{{,}}}", so that files can be exchanged
between Vim users. Only change it when it is required for the file (e.g., it
contains markers from another folding editor, or the default markers cause
trouble for the language of the file).
*fold-create-marker*
"zf" can be used to create a fold defined by markers. Vim will insert the
markers for you. Vim will append the start and end marker, as specified with
'foldmarker'. The markers are appended to the end of the line.
'commentstring' is used if it isn't empty.
This does not work properly when:
- The line already contains a marker with a level number. Vim then doesn't
know what to do.
- Folds nearby use a level number in their marker which gets in the way.
- The line is inside a comment, 'commentstring' isn't empty and nested
comments don't work. For example with C: adding /* {{{ */ inside a comment
will truncate the existing comment. Either put the marker before or after
the comment, or add the marker manually.
Generally it's not a good idea to let Vim create markers when you already have
markers with a level number.
*fold-delete-marker*
"zd" can be used to delete a fold defined by markers. Vim will delete the
markers for you. Vim will search for the start and end markers, as specified
with 'foldmarker', at the start and end of the fold. When the text around the
marker matches with 'commentstring', that text is deleted as well.
This does not work properly when:
- A line contains more than one marker and one of them specifies a level.
Only the first one is removed, without checking if this will have the
desired effect of deleting the fold.
- The marker contains a level number and is used to start or end several folds
at the same time.
==============================================================================
2. Fold commands *fold-commands* *E490*
All folding commands start with "z". Hint: the "z" looks like a folded piece
of paper, if you look at it from the side.
CREATING AND DELETING FOLDS ~
*zf* *E350*
zf{motion} or
{Visual}zf Operator to create a fold.
This only works when 'foldmethod' is "manual" or "marker".
The new fold will be closed for the "manual" method.
'foldenable' will be set.
Also see |fold-create-marker|.
*zF*
zF Create a fold for [count] lines. Works like "zf".
:{range}fo[ld] *:fold* *:fo*
Create a fold for the lines in {range}. Works like "zf".
*zd* *E351*
zd Delete one fold at the cursor. When the cursor is on a folded
line, that fold is deleted. Nested folds are moved one level
up. In Visual mode all folds (partially) in the selected area
are deleted. Careful: This easily deletes more folds than you
expect and there is no undo.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zD*
zD Delete folds recursively at the cursor. In Visual mode all
folds (partially) in the selected area and all nested folds in
them are deleted.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zE* *E352*
zE Eliminate all folds in the window.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
OPENING AND CLOSING FOLDS ~
A fold smaller than 'foldminlines' will always be displayed like it was open.
Therefore the commands below may work differently on small folds.
*zo*
zo Open one fold under the cursor. When a count is given, that
many folds deep will be opened. In Visual mode one level of
folds is opened for all lines in the selected area.
*zO*
zO Open all folds under the cursor recursively. Folds that don't
contain the cursor line are unchanged.
In Visual mode it opens all folds that are in the selected
area, also those that are only partly selected.
*zc*
zc Close one fold under the cursor. When a count is given, that
many folds deep are closed. In Visual mode one level of folds
is closed for all lines in the selected area.
'foldenable' will be set.
*zC*
zC Close all folds under the cursor recursively. Folds that
don't contain the cursor line are unchanged.
In Visual mode it closes all folds that are in the selected
area, also those that are only partly selected.
'foldenable' will be set.
*za*
za When on a closed fold: open it. When folds are nested, you
may have to use "za" several times. When a count is given,
that many closed folds are opened.
When on an open fold: close it and set 'foldenable'. This
will only close one level, since using "za" again will open
the fold. When a count is given that many folds will be
closed (that's not the same as repeating "za" that many
times).
*zA*
zA When on a closed fold: open it recursively.
When on an open fold: close it recursively and set
'foldenable'.
*zv*
zv View cursor line: Open just enough folds to make the line in
which the cursor is located not folded.
*zx*
zx Update folds: Undo manually opened and closed folds: re-apply
'foldlevel', then do "zv": View cursor line.
Also forces recomputing folds. This is useful when using
'foldexpr' and the buffer is changed in a way that results in
folds not to be updated properly.
*zX*
zX Undo manually opened and closed folds: re-apply 'foldlevel'.
Also forces recomputing folds, like |zx|.
*zm*
zm Fold more: Subtract one from 'foldlevel'. If 'foldlevel' was
already zero nothing happens.
'foldenable' will be set.
*zM*
zM Close all folds: set 'foldlevel' to 0.
'foldenable' will be set.
*zr*
zr Reduce folding: Add one to 'foldlevel'.
*zR*
zR Open all folds. This sets 'foldlevel' to highest fold level.
*:foldo* *:foldopen*
:{range}foldo[pen][!]
Open folds in {range}. When [!] is added all folds are
opened. Useful to see all the text in {range}. Without [!]
one level of folds is opened.
*:foldc* *:foldclose*
:{range}foldc[lose][!]
Close folds in {range}. When [!] is added all folds are
closed. Useful to hide all the text in {range}. Without [!]
one level of folds is closed.
*zn*
zn Fold none: reset 'foldenable'. All folds will be open.
*zN*
zN Fold normal: set 'foldenable'. All folds will be as they
were before.
*zi*
zi Invert 'foldenable'.
MOVING OVER FOLDS ~
*[z*
[z Move to the start of the current open fold. If already at the
start, move to the start of the fold that contains it. If
there is no containing fold, the command fails.
When a count is used, repeats the command [count] times.
*]z*
]z Move to the end of the current open fold. If already at the
end, move to the end of the fold that contains it. If there
is no containing fold, the command fails.
When a count is used, repeats the command [count] times.
*zj*
zj Move downwards to the start of the next fold. A closed fold
is counted as one fold.
When a count is used, repeats the command [count] times.
This command can be used after an |operator|.
*zk*
zk Move upwards to the end of the previous fold. A closed fold
is counted as one fold.
When a count is used, repeats the command [count] times.
This command can be used after an |operator|.
EXECUTING COMMANDS ON FOLDS ~
:[range]foldd[oopen] {cmd} *:foldd* *:folddoopen*
Execute {cmd} on all lines that are not in a closed fold.
When [range] is given, only these lines are used.
Each time {cmd} is executed the cursor is positioned on the
line it is executed for.
This works like the ":global" command: First all lines that
are not in a closed fold are marked. Then the {cmd} is
executed for all marked lines. Thus when {cmd} changes the
folds, this has no influence on where it is executed (except
when lines are deleted, of course).
Example: >
:folddoopen s/end/loop_end/ge
< Note the use of the "e" flag to avoid getting an error message
where "end" doesn't match.
:[range]folddoc[losed] {cmd} *:folddoc* *:folddoclosed*
Execute {cmd} on all lines that are in a closed fold.
Otherwise like ":folddoopen".
==============================================================================
3. Fold options *fold-options*
COLORS *fold-colors*
The colors of a closed fold are set with the Folded group |hl-Folded|. The
colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
Example to set the colors: >
:highlight Folded guibg=grey guifg=blue
:highlight FoldColumn guibg=darkgrey guifg=white
FOLDLEVEL *fold-foldlevel*
'foldlevel' is a number option: The higher the more folded regions are open.
When 'foldlevel' is 0, all folds are closed.
When 'foldlevel' is positive, some folds are closed.
When 'foldlevel' is very high, all folds are open.
'foldlevel' is applied when it is changed. After that manually folds can be
opened and closed.
When increased, folds above the new level are opened. No manually opened
folds will be closed.
When decreased, folds above the new level are closed. No manually closed
folds will be opened.
FOLDTEXT *fold-foldtext*
'foldtext' is a string option that specifies an expression. This expression
is evaluated to obtain the text displayed for a closed fold. Example: >
:set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
This shows the first line of the fold, with "/*", "*/" and "{{{" removed.
Note the use of backslashes to avoid some characters to be interpreted by the
":set" command. It's simpler to define a function and call that: >
:set foldtext=MyFoldText()
:function MyFoldText()
: let line = getline(v:foldstart)
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
: return v:folddashes . sub
:endfunction
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
the window that displays the line. Errors are ignored.
The default value is |foldtext()|. This returns a reasonable text for most
types of folding. If you don't like it, you can specify your own 'foldtext'
expression. It can use these special Vim variables:
v:foldstart line number of first line in the fold
v:foldend line number of last line in the fold
v:folddashes a string that contains dashes to represent the
foldlevel.
v:foldlevel the foldlevel of the fold
In the result a TAB is replaced with a space and unprintable characters are
made into printable characters.
The resulting line is truncated to fit in the window, it never wraps.
When there is room after the text, it is filled with the character specified
by 'fillchars'.
Note that backslashes need to be used for characters that the ":set" command
handles differently: Space, backslash and double-quote. |option-backslash|
FOLDCOLUMN *fold-foldcolumn*
'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds. When it is zero, there is no foldcolumn. A normal
value is 4 or 5. The minimal useful value is 2, although 1 still provides
some information. The maximum is 12.
An open fold is indicated with a column that has a '-' at the top and '|'
characters below it. This column stops where the open fold stops. When folds
nest, the nested fold is one character right of the fold it's contained in.
A closed fold is indicated with a '+'.
Where the fold column is too narrow to display all nested folds, digits are
shown to indicate the nesting level.
The mouse can also be used to open and close folds by clicking in the
fold column:
- Click on a '+' to open the closed fold at this row.
- Click on any other non-blank character to close the open fold at this row.
OTHER OPTIONS
'foldenable' 'fen': Open all folds while not set.
'foldexpr' 'fde': Expression used for "expr" folding.
'foldignore' 'fdi': Characters used for "indent" folding.
'foldmarker' 'fmr': Defined markers used for "marker" folding.
'foldmethod' 'fdm': Name of the current folding method.
'foldminlines' 'fml': Minimum number of screen lines for a fold to be
displayed closed.
'foldnestmax' 'fdn': Maximum nesting for "indent" and "syntax" folding.
'foldopen' 'fdo': Which kinds of commands open closed folds.
'foldclose' 'fcl': When the folds not under the cursor are closed.
==============================================================================
4. Behavior of folds *fold-behavior*
When moving the cursor upwards or downwards and when scrolling, the cursor
will move to the first line of a sequence of folded lines. When the cursor is
already on a folded line, it moves to the next unfolded line or the next
closed fold.
While the cursor is on folded lines, the cursor is always displayed in the
first column. The ruler does show the actual cursor position, but since the
line is folded, it cannot be displayed there.
Many movement commands handle a sequence of folded lines like an empty line.
For example, the "w" command stops once in the first column.
When in Insert mode, the cursor line is never folded. That allows you to see
what you type!
When using an operator, a closed fold is included as a whole. Thus "dl"
deletes the whole closed fold under the cursor.
For Ex commands the range is adjusted to always start at the first line of a
closed fold and end at the last line of a closed fold. Thus this command: >
:s/foo/bar/g
when used with the cursor on a closed fold, will replace "foo" with "bar" in
all lines of the fold.
This does not happen for |:folddoopen| and |:folddoclosed|.
When editing a buffer that has been edited before, the last used folding
settings are used again. For manual folding the defined folds are restored.
For all folding methods the manually opened and closed folds are restored.
If this buffer has been edited in this window, the values from back then are
used. Otherwise the values from the window where the buffer was edited last
are used.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,515 +0,0 @@
*ft_ada.txt* For Vim version 7.4. Last change: 2010 Jul 20
ADA FILE TYPE PLUG-INS REFERENCE MANUAL~
ADA *ada.vim*
1. Syntax Highlighting |ft-ada-syntax|
2. File type Plug-in |ft-ada-plugin|
3. Omni Completion |ft-ada-omni|
3.1 Omni Completion with "gnat xref" |gnat-xref|
3.2 Omni Completion with "ctags" |ada-ctags|
4. Compiler Support |ada-compiler|
4.1 GNAT |compiler-gnat|
4.2 Dec Ada |compiler-decada|
5. References |ada-reference|
5.1 Options |ft-ada-options|
5.2 Commands |ft-ada-commands|
5.3 Variables |ft-ada-variables|
5.4 Constants |ft-ada-constants|
5.5 Functions |ft-ada-functions|
6. Extra Plug-ins |ada-extra-plugins|
==============================================================================
1. Syntax Highlighting ~
*ft-ada-syntax*
This mode is designed for the 2005 edition of Ada ("Ada 2005"), which includes
support for objected-programming, protected types, and so on. It handles code
written for the original Ada language ("Ada83", "Ada87", "Ada95") as well,
though code which uses Ada 2005-only keywords will be wrongly colored (such
code should be fixed anyway). For more information about Ada, see
http://www.adapower.com.
The Ada mode handles a number of situations cleanly.
For example, it knows that the "-" in "-5" is a number, but the same character
in "A-5" is an operator. Normally, a "with" or "use" clause referencing
another compilation unit is coloured the same way as C's "#include" is coloured.
If you have "Conditional" or "Repeat" groups coloured differently, then "end
if" and "end loop" will be coloured as part of those respective groups.
You can set these to different colours using vim's "highlight" command (e.g.,
to change how loops are displayed, enter the command ":hi Repeat" followed by
the colour specification; on simple terminals the colour specification
ctermfg=White often shows well).
There are several options you can select in this Ada mode. See |ft-ada-options|
for a complete list.
To enable them, assign a value to the option. For example, to turn one on:
>
> let g:ada_standard_types = 1
>
To disable them use ":unlet". Example:
>
> unlet g:ada_standard_types
You can just use ":" and type these into the command line to set these
temporarily before loading an Ada file. You can make these option settings
permanent by adding the "let" command(s), without a colon, to your "~/.vimrc"
file.
Even on a slow (90Mhz) PC this mode works quickly, but if you find the
performance unacceptable, turn on |g:ada_withuse_ordinary|.
Syntax folding instructions (|fold-syntax|) are added when |g:ada_folding| is
set.
==============================================================================
2. File type Plug-in ~
*ft-ada-indent* *ft-ada-plugin*
The Ada plug-in provides support for:
- auto indenting (|indent.txt|)
- insert completion (|i_CTRL-N|)
- user completion (|i_CTRL-X_CTRL-U|)
- tag searches (|tagsrch.txt|)
- Quick Fix (|quickfix.txt|)
- backspace handling (|'backspace'|)
- comment handling (|'comments'|, |'commentstring'|)
The plug-in only activates the features of the Ada mode whenever an Ada
file is opened and adds Ada related entries to the main and pop-up menu.
==============================================================================
3. Omni Completion ~
*ft-ada-omni*
The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either
by "gnat xref -v" or the "exuberant Ctags (http://ctags.sourceforge.net). The
complete function will automatically detect which tool was used to create the
tags file.
------------------------------------------------------------------------------
3.1 Omni Completion with "gnat xref" ~
*gnat-xref*
GNAT XREF uses the compiler internal information (ali-files) to produce the
tags file. This has the advantage to be 100% correct and the option of deep
nested analysis. However the code must compile, the generator is quite
slow and the created tags file contains only the basic Ctags information for
each entry - not enough for some of the more advanced Vim code browser
plug-ins.
NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
output - If nothing is printed then usually the parameters are wrong.
Here some important tips:
1) You need to compile your code first and use the "-aO" option to point to
your .ali files.
2) "gnat xref -v ../Include/adacl.ads" won't work - use the "gnat xref -v
-aI../Include adacl.ads" instead.
3) "gnat xref -v -aI../Include *.ad?" won't work - use "cd ../Include" and
then "gnat xref -v *.ad?"
4) Project manager support is completely broken - don't even try "gnat xref
-Padacl.gpr".
5) VIM is faster when the tags file is sorted - use "sort --unique
--ignore-case --output=tags tags" .
6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
the file assorted.
------------------------------------------------------------------------------
3.2 Omni Completion with "ctags"~
*ada-ctags*
Exuberant Ctags uses its own multi-language code parser. The parser is quite
fast, produces a lot of extra information (hence the name "Exuberant Ctags")
and can run on files which currently do not compile.
There are also lots of other Vim-tools which use exuberant Ctags.
You will need to install a version of the Exuberant Ctags which has Ada
support patched in. Such a version is available from the GNU Ada Project
(http://gnuada.sourceforge.net).
The Ada parser for Exuberant Ctags is fairly new - don't expect complete
support yet.
==============================================================================
4. Compiler Support ~
*ada-compiler*
The Ada mode supports more than one Ada compiler and will automatically load the
compiler set in |g:ada_default_compiler| whenever an Ada source is opened. The
provided compiler plug-ins are split into the actual compiler plug-in and a
collection of support functions and variables. This allows the easy
development of specialized compiler plug-ins fine tuned to your development
environment.
------------------------------------------------------------------------------
4.1 GNAT ~
*compiler-gnat*
GNAT is the only free (beer and speech) Ada compiler available. There are
several versions available which differ in the licence terms used.
The GNAT compiler plug-in will perform a compile on pressing <F7> and then
immediately shows the result. You can set the project file to be used by
setting:
>
> call g:gnat.Set_Project_File ('my_project.gpr')
Setting a project file will also create a Vim session (|views-sessions|) so -
like with the GPS - opened files, window positions etc. will be remembered
separately for all projects.
*gnat_members*
GNAT OBJECT ~
*g:gnat.Make()*
g:gnat.Make()
Calls |g:gnat.Make_Command| and displays the result inside a
|quickfix| window.
*g:gnat.Pretty()*
g:gnat.Pretty()
Calls |g:gnat.Pretty_Program|
*g:gnat.Find()*
g:gnat.Find()
Calls |g:gnat.Find_Program|
*g:gnat.Tags()*
g:gnat.Tags()
Calls |g:gnat.Tags_Command|
*g:gnat.Set_Project_File()*
g:gnat.Set_Project_File([{file}])
Set gnat project file and load associated session. An open
project will be closed and the session written. If called
without file name the file selector opens for selection of a
project file. If called with an empty string then the project
and associated session are closed.
*g:gnat.Project_File*
g:gnat.Project_File string
Current project file.
*g:gnat.Make_Command*
g:gnat.Make_Command string
External command used for |g:gnat.Make()| (|'makeprg'|).
*g:gnat.Pretty_Program*
g:gnat.Pretty_Program string
External command used for |g:gnat.Pretty()|
*g:gnat.Find_Program*
g:gnat.Find_Program string
External command used for |g:gnat.Find()|
*g:gnat.Tags_Command*
g:gnat.Tags_Command string
External command used for |g:gnat.Tags()|
*g:gnat.Error_Format*
g:gnat.Error_Format string
Error format (|'errorformat'|)
------------------------------------------------------------------------------
4.2 Dec Ada ~
*compiler-hpada* *compiler-decada*
*compiler-vaxada* *compiler-compaqada*
Dec Ada (also known by - in chronological order - VAX Ada, Dec Ada, Compaq Ada
and HP Ada) is a fairly dated Ada 83 compiler. Support is basic: <F7> will
compile the current unit.
The Dec Ada compiler expects the package name and not the file name to be
passed as a parameter. The compiler plug-in supports the usual file name
convention to convert the file into a unit name. Both '-' and '__' are allowed
as separators.
*decada_members*
DEC ADA OBJECT ~
*g:decada.Make()*
g:decada.Make() function
Calls |g:decada.Make_Command| and displays the result inside a
|quickfix| window.
*g:decada.Unit_Name()*
g:decada.Unit_Name() function
Get the Unit name for the current file.
*g:decada.Make_Command*
g:decada.Make_Command string
External command used for |g:decada.Make()| (|'makeprg'|).
*g:decada.Error_Format*
g:decada.Error_Format| string
Error format (|'errorformat'|).
==============================================================================
5. References ~
*ada-reference*
------------------------------------------------------------------------------
5.1 Options ~
*ft-ada-options*
*g:ada_standard_types*
g:ada_standard_types bool (true when exists)
Highlight types in package Standard (e.g., "Float").
*g:ada_space_errors*
*g:ada_no_trail_space_error*
*g:ada_no_tab_space_error*
*g:ada_all_tab_usage*
g:ada_space_errors bool (true when exists)
Highlight extraneous errors in spaces ...
g:ada_no_trail_space_error
- but ignore trailing spaces at the end of a line
g:ada_no_tab_space_error
- but ignore tabs after spaces
g:ada_all_tab_usage
- highlight all tab use
*g:ada_line_errors*
g:ada_line_errors bool (true when exists)
Highlight lines which are too long. Note: This highlighting
option is quite CPU intensive.
*g:ada_rainbow_color*
g:ada_rainbow_color bool (true when exists)
Use rainbow colours for '(' and ')'. You need the
rainbow_parenthesis for this to work.
*g:ada_folding*
g:ada_folding set ('sigpft')
Use folding for Ada sources.
's': activate syntax folding on load
'p': fold packages
'f': fold functions and procedures
't': fold types
'c': fold conditionals
'g': activate gnat pretty print folding on load
'i': lone 'is' folded with line above
'b': lone 'begin' folded with line above
'p': lone 'private' folded with line above
'x': lone 'exception' folded with line above
'i': activate indent folding on load
Note: Syntax folding is in an early (unusable) stage and
indent or gnat pretty folding is suggested.
For gnat pretty folding to work the following settings are
suggested: -cl3 -M79 -c2 -c3 -c4 -A1 -A2 -A3 -A4 -A5
For indent folding to work the following settings are
suggested: shiftwidth=3 softtabstop=3
*g:ada_abbrev*
g:ada_abbrev bool (true when exists)
Add some abbreviations. This feature is more or less superseded
by the various completion methods.
*g:ada_withuse_ordinary*
g:ada_withuse_ordinary bool (true when exists)
Show "with" and "use" as ordinary keywords (when used to
reference other compilation units they're normally highlighted
specially).
*g:ada_begin_preproc*
g:ada_begin_preproc bool (true when exists)
Show all begin-like keywords using the colouring of C
preprocessor commands.
*g:ada_omni_with_keywords*
g:ada_omni_with_keywords
Add Keywords, Pragmas, Attributes to omni-completions
(|compl-omni|). Note: You can always complete then with user
completion (|i_CTRL-X_CTRL-U|).
*g:ada_extended_tagging*
g:ada_extended_tagging enum ('jump', 'list')
use extended tagging, two options are available
'jump': use tjump to jump.
'list': add tags quick fix list.
Normal tagging does not support function or operator
overloading as these features are not available in C and
tagging was originally developed for C.
*g:ada_extended_completion*
g:ada_extended_completion
Uses extended completion for <C-N> and <C-R> completions
(|i_CTRL-N|). In this mode the '.' is used as part of the
identifier so that 'Object.Method' or 'Package.Procedure' are
completed together.
*g:ada_gnat_extensions*
g:ada_gnat_extensions bool (true when exists)
Support GNAT extensions.
*g:ada_with_gnat_project_files*
g:ada_with_gnat_project_files bool (true when exists)
Add gnat project file keywords and Attributes.
*g:ada_default_compiler*
g:ada_default_compiler string
set default compiler. Currently supported are 'gnat' and
'decada'.
An "exists" type is a boolean considered true when the variable is defined and
false when the variable is undefined. The value to which the variable is set
makes no difference.
------------------------------------------------------------------------------
5.2 Commands ~
*ft-ada-commands*
:AdaRainbow *:AdaRainbow*
Toggles rainbow colour (|g:ada_rainbow_color|) mode for
'(' and ')'.
:AdaLines *:AdaLines*
Toggles line error (|g:ada_line_errors|) display.
:AdaSpaces *:AdaSpaces*
Toggles space error (|g:ada_space_errors|) display.
:AdaTagDir *:AdaTagDir*
Creates tags file for the directory of the current file.
:AdaTagFile *:AdaTagFile*
Creates tags file for the current file.
:AdaTypes *:AdaTypes*
Toggles standard types (|g:ada_standard_types|) colour.
:GnatFind *:GnatFind*
Calls |g:gnat.Find()|
:GnatPretty *:GnatPretty*
Calls |g:gnat.Pretty()|
:GnatTags *:GnatTags*
Calls |g:gnat.Tags()|
------------------------------------------------------------------------------
5.3 Variables ~
*ft-ada-variables*
*g:gnat*
g:gnat object
Control object which manages GNAT compiles. The object
is created when the first Ada source code is loaded provided
that |g:ada_default_compiler| is set to 'gnat'. See
|gnat_members| for details.
*g:decada*
g:decada object
Control object which manages Dec Ada compiles. The object
is created when the first Ada source code is loaded provided
that |g:ada_default_compiler| is set to 'decada'. See
|decada_members| for details.
------------------------------------------------------------------------------
5.4 Constants ~
*ft-ada-constants*
All constants are locked. See |:lockvar| for details.
*g:ada#WordRegex*
g:ada#WordRegex string
Regular expression to search for Ada words.
*g:ada#DotWordRegex*
g:ada#DotWordRegex string
Regular expression to search for Ada words separated by dots.
*g:ada#Comment*
g:ada#Comment string
Regular expression to search for Ada comments.
*g:ada#Keywords*
g:ada#Keywords list of dictionaries
List of keywords, attributes etc. pp. in the format used by
omni completion. See |complete-items| for details.
*g:ada#Ctags_Kinds*
g:ada#Ctags_Kinds dictionary of lists
Dictionary of the various kinds of items which the Ada support
for Ctags generates.
------------------------------------------------------------------------------
5.5 Functions ~
*ft-ada-functions*
ada#Word([{line}, {col}]) *ada#Word()*
Return full name of Ada entity under the cursor (or at given
line/column), stripping white space/newlines as necessary.
ada#List_Tag([{line}, {col}]) *ada#Listtags()*
List all occurrences of the Ada entity under the cursor (or at
given line/column) inside the quick-fix window.
ada#Jump_Tag ({ident}, {mode}) *ada#Jump_Tag()*
List all occurrences of the Ada entity under the cursor (or at
given line/column) in the tag jump list. Mode can either be
'tjump' or 'stjump'.
ada#Create_Tags ({option}) *ada#Create_Tags()*
Creates tag file using Ctags. The option can either be 'file'
for the current file, 'dir' for the directory of the current
file or a file name.
gnat#Insert_Tags_Header() *gnat#Insert_Tags_Header()*
Adds the tag file header (!_TAG_) information to the current
file which are missing from the GNAT XREF output.
ada#Switch_Syntax_Option ({option}) *ada#Switch_Syntax_Option()*
Toggles highlighting options on or off. Used for the Ada menu.
*gnat#New()*
gnat#New ()
Create a new gnat object. See |g:gnat| for details.
==============================================================================
6. Extra Plugins ~
*ada-extra-plugins*
You can optionally install the following extra plug-ins. They work well with
Ada and enhance the ability of the Ada mode:
backup.vim
http://www.vim.org/scripts/script.php?script_id=1537
Keeps as many backups as you like so you don't have to.
rainbow_parenthsis.vim
http://www.vim.org/scripts/script.php?script_id=1561
Very helpful since Ada uses only '(' and ')'.
nerd_comments.vim
http://www.vim.org/scripts/script.php?script_id=1218
Excellent commenting and uncommenting support for almost any
programming language.
matchit.vim
http://www.vim.org/scripts/script.php?script_id=39
'%' jumping for any language. The normal '%' jump only works for '{}'
style languages. The Ada mode will set the needed search patterns.
taglist.vim
http://www.vim.org/scripts/script.php?script_id=273
Source code explorer sidebar. There is a patch for Ada available.
The GNU Ada Project distribution (http://gnuada.sourceforge.net) of Vim
contains all of the above.
==============================================================================
vim: textwidth=78 nowrap tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab
vim: filetype=help

View file

@ -1,780 +0,0 @@
*ft_sql.txt* For Vim version 7.4. Last change: 2013 May 15
by David Fishburn
This is a filetype plugin to work with SQL files.
The Structured Query Language (SQL) is a standard which specifies statements
that allow a user to interact with a relational database. Vim includes
features for navigation, indentation and syntax highlighting.
1. Navigation |sql-navigation|
1.1 Matchit |sql-matchit|
1.2 Text Object Motions |sql-object-motions|
1.3 Predefined Object Motions |sql-predefined-objects|
1.4 Macros |sql-macros|
2. SQL Dialects |sql-dialects|
2.1 SQLSetType |SQLSetType|
2.2 SQLGetType |SQLGetType|
2.3 SQL Dialect Default |sql-type-default|
3. Adding new SQL Dialects |sql-adding-dialects|
4. OMNI SQL Completion |sql-completion|
4.1 Static mode |sql-completion-static|
4.2 Dynamic mode |sql-completion-dynamic|
4.3 Tutorial |sql-completion-tutorial|
4.3.1 Complete Tables |sql-completion-tables|
4.3.2 Complete Columns |sql-completion-columns|
4.3.3 Complete Procedures |sql-completion-procedures|
4.3.4 Complete Views |sql-completion-views|
4.4 Completion Customization |sql-completion-customization|
4.5 SQL Maps |sql-completion-maps|
4.6 Using with other filetypes |sql-completion-filetypes|
==============================================================================
1. Navigation *sql-navigation*
The SQL ftplugin provides a number of options to assist with file
navigation.
1.1 Matchit *sql-matchit*
-----------
The matchit plugin (http://www.vim.org/scripts/script.php?script_id=39)
provides many additional features and can be customized for different
languages. The matchit plugin is configured by defining a local
buffer variable, b:match_words. Pressing the % key while on various
keywords will move the cursor to its match. For example, if the cursor
is on an "if", pressing % will cycle between the "else", "elseif" and
"end if" keywords.
The following keywords are supported: >
if
elseif | elsif
else [if]
end if
[while condition] loop
leave
break
continue
exit
end loop
for
leave
break
continue
exit
end loop
do
statements
doend
case
when
when
default
end case
merge
when not matched
when matched
create[ or replace] procedure|function|event
returns
1.2 Text Object Motions *sql-object-motions*
-----------------------
Vim has a number of predefined keys for working with text |object-motions|.
This filetype plugin attempts to translate these keys to maps which make sense
for the SQL language.
The following |Normal| mode and |Visual| mode maps exist (when you edit a SQL
file): >
]] move forward to the next 'begin'
[[ move backwards to the previous 'begin'
][ move forward to the next 'end'
[] move backwards to the previous 'end'
1.3 Predefined Object Motions *sql-predefined-objects*
-----------------------------
Most relational databases support various standard features, tables, indices,
triggers and stored procedures. Each vendor also has a variety of proprietary
objects. The next set of maps have been created to help move between these
objects. Depends on which database vendor you are using, the list of objects
must be configurable. The filetype plugin attempts to define many of the
standard objects, plus many additional ones. In order to make this as
flexible as possible, you can override the list of objects from within your
|vimrc| with the following: >
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' .
\ ',schema,service,publication,database,datatype,domain' .
\ ',index,subscription,synchronization,view,variable'
The following |Normal| mode and |Visual| mode maps have been created which use
the above list: >
]} move forward to the next 'create <object name>'
[{ move backward to the previous 'create <object name>'
Repeatedly pressing ]} will cycle through each of these create statements: >
create table t1 (
...
);
create procedure p1
begin
...
end;
create index i1 on t1 (c1);
The default setting for g:ftplugin_sql_objects is: >
let g:ftplugin_sql_objects = 'function,procedure,event,' .
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .
\ 'table,trigger' .
\ ',schema,service,publication,database,datatype,domain' .
\ ',index,subscription,synchronization,view,variable'
The above will also handle these cases: >
create table t1 (
...
);
create existing table t2 (
...
);
create global temporary table t3 (
...
);
By default, the ftplugin only searches for CREATE statements. You can also
override this via your |vimrc| with the following: >
let g:ftplugin_sql_statements = 'create,alter'
The filetype plugin defines three types of comments: >
1. --
2. //
3. /*
*
*/
The following |Normal| mode and |Visual| mode maps have been created to work
with comments: >
]" move forward to the beginning of a comment
[" move forward to the end of a comment
1.4 Macros *sql-macros*
----------
Vim's feature to find macro definitions, |'define'|, is supported using this
regular expression: >
\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>
This addresses the following code: >
CREATE VARIABLE myVar1 INTEGER;
CREATE PROCEDURE sp_test(
IN myVar2 INTEGER,
OUT myVar3 CHAR(30),
INOUT myVar4 NUMERIC(20,0)
)
BEGIN
DECLARE myVar5 INTEGER;
SELECT c1, c2, c3
INTO myVar2, myVar3, myVar4
FROM T1
WHERE c4 = myVar1;
END;
Place your cursor on "myVar1" on this line: >
WHERE c4 = myVar1;
^
Press any of the following keys: >
[d
[D
[CTRL-D
==============================================================================
2. SQL Dialects *sql-dialects* *sql-types*
*sybase* *TSQL* *Transact-SQL*
*sqlanywhere*
*oracle* *plsql* *sqlj*
*sqlserver*
*mysql* *postgresql* *psql*
*informix*
All relational databases support SQL. There is a portion of SQL that is
portable across vendors (ex. CREATE TABLE, CREATE INDEX), but there is a
great deal of vendor specific extensions to SQL. Oracle supports the
"CREATE OR REPLACE" syntax, column defaults specified in the CREATE TABLE
statement and the procedural language (for stored procedures and triggers).
The default Vim distribution ships with syntax highlighting based on Oracle's
PL/SQL. The default SQL indent script works for Oracle and SQL Anywhere.
The default filetype plugin works for all vendors and should remain vendor
neutral, but extendable.
Vim currently has support for a variety of different vendors, currently this
is via syntax scripts. Unfortunately, to flip between different syntax rules
you must either create:
1. New filetypes
2. Custom autocmds
3. Manual steps / commands
The majority of people work with only one vendor's database product, it would
be nice to specify a default in your |vimrc|.
2.1 SQLSetType *sqlsettype* *SQLSetType*
--------------
For the people that work with many different databases, it is nice to be
able to flip between the various vendors rules (indent, syntax) on a per
buffer basis, at any time. The ftplugin/sql.vim file defines this function: >
SQLSetType
Executing this function without any parameters will set the indent and syntax
scripts back to their defaults, see |sql-type-default|. If you have turned
off Vi's compatibility mode, |'compatible'|, you can use the <Tab> key to
complete the optional parameter.
After typing the function name and a space, you can use the completion to
supply a parameter. The function takes the name of the Vim script you want to
source. Using the |cmdline-completion| feature, the SQLSetType function will
search the |'runtimepath'| for all Vim scripts with a name containing 'sql'.
This takes the guess work out of the spelling of the names. The following are
examples: >
:SQLSetType
:SQLSetType sqloracle
:SQLSetType sqlanywhere
:SQLSetType sqlinformix
:SQLSetType mysql
The easiest approach is to the use <Tab> character which will first complete
the command name (SQLSetType), after a space and another <Tab>, display a list
of available Vim script names: >
:SQL<Tab><space><Tab>
2.2 SQLGetType *sqlgettype* *SQLGetType*
--------------
At anytime you can determine which SQL dialect you are using by calling the
SQLGetType command. The ftplugin/sql.vim file defines this function: >
SQLGetType
This will echo: >
Current SQL dialect in use:sqlanywhere
2.3 SQL Dialect Default *sql-type-default*
-----------------------
As mentioned earlier, the default syntax rules for Vim is based on Oracle
(PL/SQL). You can override this default by placing one of the following in
your |vimrc|: >
let g:sql_type_default = 'sqlanywhere'
let g:sql_type_default = 'sqlinformix'
let g:sql_type_default = 'mysql'
If you added the following to your |vimrc|: >
let g:sql_type_default = 'sqlinformix'
The next time edit a SQL file the following scripts will be automatically
loaded by Vim: >
ftplugin/sql.vim
syntax/sqlinformix.vim
indent/sql.vim
>
Notice indent/sqlinformix.sql was not loaded. There is no indent file
for Informix, Vim loads the default files if the specified files does not
exist.
==============================================================================
3. Adding new SQL Dialects *sql-adding-dialects*
If you begin working with a SQL dialect which does not have any customizations
available with the default Vim distribution you can check http://www.vim.org
to see if any customization currently exist. If not, you can begin by cloning
an existing script. Read |filetype-plugins| for more details.
To help identify these scripts, try to create the files with a "sql" prefix.
If you decide you wish to create customizations for the SQLite database, you
can create any of the following: >
Unix
~/.vim/syntax/sqlite.vim
~/.vim/indent/sqlite.vim
Windows
$VIM/vimfiles/syntax/sqlite.vim
$VIM/vimfiles/indent/sqlite.vim
No changes are necessary to the SQLSetType function. It will automatically
pickup the new SQL files and load them when you issue the SQLSetType command.
==============================================================================
4. OMNI SQL Completion *sql-completion*
*omni-sql-completion*
Vim 7 includes a code completion interface and functions which allows plugin
developers to build in code completion for any language. Vim 7 includes
code completion for the SQL language.
There are two modes to the SQL completion plugin, static and dynamic. The
static mode populates the popups with the data generated from current syntax
highlight rules. The dynamic mode populates the popups with data retrieved
directly from a database. This includes, table lists, column lists,
procedures names and more.
4.1 Static Mode *sql-completion-static*
---------------
The static popups created contain items defined by the active syntax rules
while editing a file with a filetype of SQL. The plugin defines (by default)
various maps to help the user refine the list of items to be displayed.
The defaults static maps are: >
imap <buffer> <C-C>a <C-\><C-O>:call sqlcomplete#Map('syntax')<CR><C-X><C-O>
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
imap <buffer> <C-C>f <C-\><C-O>:call sqlcomplete#Map('sqlFunction')<CR><C-X><C-O>
imap <buffer> <C-C>o <C-\><C-O>:call sqlcomplete#Map('sqlOption')<CR><C-X><C-O>
imap <buffer> <C-C>T <C-\><C-O>:call sqlcomplete#Map('sqlType')<CR><C-X><C-O>
imap <buffer> <C-C>s <C-\><C-O>:call sqlcomplete#Map('sqlStatement')<CR><C-X><C-O>
The use of "<C-C>" can be user chosen by using the following in your |.vimrc| as it
may not work properly on all platforms: >
let g:ftplugin_sql_omni_key = '<C-C>'
>
The static maps (which are based on the syntax highlight groups) follow this
format: >
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword\w*')<CR><C-X><C-O>
This command breaks down as: >
imap - Create an insert map
<buffer> - Only for this buffer
<C-C>k - Your choice of key map
<C-\><C-O> - Execute one command, return to Insert mode
:call sqlcomplete#Map( - Allows the SQL completion plugin to perform some
housekeeping functions to allow it to be used in
conjunction with other completion plugins.
Indicate which item you want the SQL completion
plugin to complete.
In this case we are asking the plugin to display
items from the syntax highlight group
'sqlKeyword'.
You can view a list of highlight group names to
choose from by executing the
:syntax list
command while editing a SQL file.
'sqlKeyword' - Display the items for the sqlKeyword highlight
group
'sqlKeyword\w*' - A second option available with Vim 7.4 which
uses a regular expression to determine which
syntax groups to use
)<CR> - Execute the :let command
<C-X><C-O> - Trigger the standard omni completion key stroke.
Passing in 'sqlKeyword' instructs the SQL
completion plugin to populate the popup with
items from the sqlKeyword highlight group. The
plugin will also cache this result until Vim is
restarted. The syntax list is retrieved using
the syntaxcomplete plugin.
Using the 'syntax' keyword is a special case. This instructs the
syntaxcomplete plugin to retrieve all syntax items. So this will effectively
work for any of Vim's SQL syntax files. At the time of writing this includes
10 different syntax files for the different dialects of SQL (see section 3
above, |sql-dialects|).
Here are some examples of the entries which are pulled from the syntax files: >
All
- Contains the contents of all syntax highlight groups
Statements
- Select, Insert, Update, Delete, Create, Alter, ...
Functions
- Min, Max, Trim, Round, Date, ...
Keywords
- Index, Database, Having, Group, With
Options
- Isolation_level, On_error, Qualify_owners, Fire_triggers, ...
Types
- Integer, Char, Varchar, Date, DateTime, Timestamp, ...
4.2 Dynamic Mode *sql-completion-dynamic*
----------------
Dynamic mode populates the popups with data directly from a database. In
order for the dynamic feature to be enabled you must have the dbext.vim
plugin installed, (http://vim.sourceforge.net/script.php?script_id=356).
Dynamic mode is used by several features of the SQL completion plugin.
After installing the dbext plugin see the dbext-tutorial for additional
configuration and usage. The dbext plugin allows the SQL completion plugin
to display a list of tables, procedures, views and columns. >
Table List
- All tables for all schema owners
Procedure List
- All stored procedures for all schema owners
View List
- All stored procedures for all schema owners
Column List
- For the selected table, the columns that are part of the table
To enable the popup, while in INSERT mode, use the following key combinations
for each group (where <C-C> means hold the CTRL key down while pressing
the space bar):
Table List - <C-C>t
- <C-X><C-O> (the default map assumes tables)
Stored Procedure List - <C-C>p
View List - <C-C>v
Column List - <C-C>c
Drilling In / Out - When viewing a popup window displaying the list
of tables, you can press <Right>, this will
replace the table currently highlighted with
the column list for that table.
- When viewing a popup window displaying the list
of columns, you can press <Left>, this will
replace the column list with the list of tables.
- This allows you to quickly drill down into a
table to view its columns and back again.
- <Right> and <Left> can be also be chosen via
your |.vimrc| >
let g:ftplugin_sql_omni_key_right = '<Right>'
let g:ftplugin_sql_omni_key_left = '<Left>'
The SQL completion plugin caches various lists that are displayed in
the popup window. This makes the re-displaying of these lists very
fast. If new tables or columns are added to the database it may become
necessary to clear the plugins cache. The default map for this is: >
imap <buffer> <C-C>R <C-\><C-O>:call sqlcomplete#Map('ResetCache')<CR><C-X><C-O>
4.3 SQL Tutorial *sql-completion-tutorial*
----------------
This tutorial is designed to take you through the common features of the SQL
completion plugin so that: >
a) You gain familiarity with the plugin
b) You are introduced to some of the more common features
c) Show how to customize it to your preferences
d) Demonstrate "Best of Use" of the plugin (easiest way to configure).
First, create a new buffer: >
:e tutorial.sql
Static features
---------------
To take you through the various lists, simply enter insert mode, hit:
<C-C>s (show SQL statements)
At this point, you can page down through the list until you find "select".
If you are familiar with the item you are looking for, for example you know
the statement begins with the letter "s". You can type ahead (without the
quotes) "se" then press:
<C-Space>t
Assuming "select" is highlighted in the popup list press <Enter> to choose
the entry. Now type:
* fr<C-C>a (show all syntax items)
choose "from" from the popup list.
When writing stored procedures using the "type" list is useful. It contains
a list of all the database supported types. This may or may not be true
depending on the syntax file you are using. The SQL Anywhere syntax file
(sqlanywhere.vim) has support for this: >
BEGIN
DECLARE customer_id <C-C>T <-- Choose a type from the list
Dynamic features
----------------
To take advantage of the dynamic features you must first install the
dbext.vim plugin (http://vim.sourceforge.net/script.php?script_id=356). It
also comes with a tutorial. From the SQL completion plugin's perspective,
the main feature dbext provides is a connection to a database. dbext
connection profiles are the most efficient mechanism to define connection
information. Once connections have been setup, the SQL completion plugin
uses the features of dbext in the background to populate the popups.
What follows assumes dbext.vim has been correctly configured, a simple test
is to run the command, :DBListTable. If a list of tables is shown, you know
dbext.vim is working as expected. If not, please consult the dbext.txt
documentation.
Assuming you have followed the dbext-tutorial you can press <C-C>t to
display a list of tables. There is a delay while dbext is creating the table
list. After the list is displayed press <C-W>. This will remove both the
popup window and the table name already chosen when the list became active. >
4.3.1 Table Completion: *sql-completion-tables*
Press <C-C>t to display a list of tables from within the database you
have connected via the dbext plugin.
NOTE: All of the SQL completion popups support typing a prefix before pressing
the key map. This will limit the contents of the popup window to just items
beginning with those characters. >
4.3.2 Column Completion: *sql-completion-columns*
The SQL completion plugin can also display a list of columns for particular
tables. The column completion is trigger via <C-C>c.
NOTE: The following example uses <Right> to trigger a column list while
the popup window is active.
Example of using column completion:
- Press <C-C>t again to display the list of tables.
- When the list is displayed in the completion window, press <Right>,
this will replace the list of tables, with a list of columns for the
table highlighted (after the same short delay).
- If you press <Left>, this will again replace the column list with the
list of tables. This allows you to drill into tables and column lists
very quickly.
- Press <Right> again while the same table is highlighted. You will
notice there is no delay since the column list has been cached. If you
change the schema of a cached table you can press <C-C>R, which
clears the SQL completion cache.
- NOTE: <Right> and <Left> have been designed to work while the
completion window is active. If the completion popup window is
not active, a normal <Right> or <Left> will be executed.
Let's look at how we can build a SQL statement dynamically. A select statement
requires a list of columns. There are two ways to build a column list using
the SQL completion plugin. >
One column at a time:
< 1. After typing SELECT press <C-C>t to display a list of tables.
2. Choose a table from the list.
3. Press <Right> to display a list of columns.
4. Choose the column from the list and press enter.
5. Enter a "," and press <C-C>c. Generating a column list
generally requires having the cursor on a table name. The plugin
uses this name to determine what table to retrieve the column list.
In this step, since we are pressing <C-C>c without the cursor
on a table name the column list displayed will be for the previous
table. Choose a different column and move on.
6. Repeat step 5 as often as necessary. >
All columns for a table:
< 1. After typing SELECT press <C-C>t to display a list of tables.
2. Highlight the table you need the column list for.
3. Press <Enter> to choose the table from the list.
4. Press <C-C>l to request a comma separated list of all columns
for this table.
5. Based on the table name chosen in step 3, the plugin attempts to
decide on a reasonable table alias. You are then prompted to
either accept of change the alias. Press OK.
6. The table name is replaced with the column list of the table is
replaced with the comma separate list of columns with the alias
prepended to each of the columns.
7. Step 3 and 4 can be replaced by pressing <C-C>L, which has
a <C-Y> embedded in the map to choose the currently highlighted
table in the list.
There is a special provision when writing select statements. Consider the
following statement: >
select *
from customer c,
contact cn,
department as dp,
employee e,
site_options so
where c.
In INSERT mode after typing the final "c." which is an alias for the
"customer" table, you can press either <C-C>c or <C-X><C-O>. This will
popup a list of columns for the customer table. It does this by looking back
to the beginning of the select statement and finding a list of the tables
specified in the FROM clause. In this case it notes that in the string
"customer c", "c" is an alias for the customer table. The optional "AS"
keyword is also supported, "customer AS c". >
4.3.3 Procedure Completion: *sql-completion-procedures*
Similar to the table list, <C-C>p, will display a list of stored
procedures stored within the database. >
4.3.4 View Completion: *sql-completion-views*
Similar to the table list, <C-C>v, will display a list of views in the
database.
4.4 Completion Customization *sql-completion-customization*
----------------------------
The SQL completion plugin can be customized through various options set in
your |vimrc|: >
omni_sql_no_default_maps
< - Default: This variable is not defined
- If this variable is defined, no maps are created for OMNI
completion. See |sql-completion-maps| for further discussion.
>
omni_sql_use_tbl_alias
< - Default: a
- This setting is only used when generating a comma separated
column list. By default the map is <C-C>l. When generating
a column list, an alias can be prepended to the beginning of each
column, for example: e.emp_id, e.emp_name. This option has three
settings: >
n - do not use an alias
d - use the default (calculated) alias
a - ask to confirm the alias name
<
An alias is determined following a few rules:
1. If the table name has an '_', then use it as a separator: >
MY_TABLE_NAME --> MTN
my_table_name --> mtn
My_table_NAME --> MtN
< 2. If the table name does NOT contain an '_', but DOES use
mixed case then the case is used as a separator: >
MyTableName --> MTN
< 3. If the table name does NOT contain an '_', and does NOT
use mixed case then the first letter of the table is used: >
mytablename --> m
MYTABLENAME --> M
omni_sql_ignorecase
< - Default: Current setting for 'ignorecase'
- Valid settings are 0 or 1.
- When entering a few letters before initiating completion, the list
will be filtered to display only the entries which begin with the
list of characters. When this option is set to 0, the list will be
filtered using case sensitivity. >
omni_sql_include_owner
< - Default: 0, unless dbext.vim 3.00 has been installed
- Valid settings are 0 or 1.
- When completing tables, procedure or views and using dbext.vim 3.00
or higher the list of objects will also include the owner name.
When completing these objects and omni_sql_include_owner is enabled
the owner name will be replaced. >
omni_sql_precache_syntax_groups
< - Default:
['syntax','sqlKeyword','sqlFunction','sqlOption','sqlType','sqlStatement']
- sqlcomplete can be used in conjunction with other completion
plugins. This is outlined at |sql-completion-filetypes|. When the
filetype is changed temporarily to SQL, the sqlcompletion plugin
will cache the syntax groups listed in the List specified in this
option.
>
4.5 SQL Maps *sql-completion-maps*
------------
The default SQL maps have been described in other sections of this document in
greater detail. Here is a list of the maps with a brief description of each.
Static Maps
-----------
These are maps which use populate the completion list using Vim's syntax
highlighting rules. >
<C-C>a
< - Displays all SQL syntax items. >
<C-C>k
< - Displays all SQL syntax items defined as 'sqlKeyword'. >
<C-C>f
< - Displays all SQL syntax items defined as 'sqlFunction. >
<C-C>o
< - Displays all SQL syntax items defined as 'sqlOption'. >
<C-C>T
< - Displays all SQL syntax items defined as 'sqlType'. >
<C-C>s
< - Displays all SQL syntax items defined as 'sqlStatement'. >
Dynamic Maps
------------
These are maps which use populate the completion list using the dbext.vim
plugin. >
<C-C>t
< - Displays a list of tables. >
<C-C>p
< - Displays a list of procedures. >
<C-C>v
< - Displays a list of views. >
<C-C>c
< - Displays a list of columns for a specific table. >
<C-C>l
< - Displays a comma separated list of columns for a specific table. >
<C-C>L
< - Displays a comma separated list of columns for a specific table.
This should only be used when the completion window is active. >
<Right>
< - Displays a list of columns for the table currently highlighted in
the completion window. <Right> is not recognized on most Unix
systems, so this maps is only created on the Windows platform.
If you would like the same feature on Unix, choose a different key
and make the same map in your vimrc. >
<Left>
< - Displays the list of tables.
<Left> is not recognized on most Unix systems, so this maps is
only created on the Windows platform. If you would like the same
feature on Unix, choose a different key and make the same map in
your vimrc. >
<C-C>R
< - This maps removes all cached items and forces the SQL completion
to regenerate the list of items.
Customizing Maps
----------------
You can create as many additional key maps as you like. Generally, the maps
will be specifying different syntax highlight groups.
If you do not wish the default maps created or the key choices do not work on
your platform (often a case on *nix) you define the following variable in
your |vimrc|: >
let g:omni_sql_no_default_maps = 1
Do no edit ftplugin/sql.vim directly! If you change this file your changes
will be over written on future updates. Vim has a special directory structure
which allows you to make customizations without changing the files that are
included with the Vim distribution. If you wish to customize the maps
create an after/ftplugin/sql.vim (see |after-directory|) and place the same
maps from the ftplugin/sql.vim in it using your own key strokes. <C-C> was
chosen since it will work on both Windows and *nix platforms. On the windows
platform you can also use <C-Space> or ALT keys.
4.6 Using with other filetypes *sql-completion-filetypes*
------------------------------
Many times SQL can be used with different filetypes. For example Perl, Java,
PHP, Javascript can all interact with a database. Often you need both the SQL
completion and the completion capabilities for the current language you are
editing.
This can be enabled easily with the following steps (assuming a Perl file): >
1. :e test.pl
2. :set filetype=sql
3. :set ft=perl
Step 1
------
Begins by editing a Perl file. Vim automatically sets the filetype to
"perl". By default, Vim runs the appropriate filetype file
ftplugin/perl.vim. If you are using the syntax completion plugin by following
the directions at |ft-syntax-omni| then the |'omnifunc'| option has been set to
"syntax#Complete". Pressing <C-X><C-O> will display the omni popup containing
the syntax items for Perl.
Step 2
------
Manually setting the filetype to 'sql' will also fire the appropriate filetype
files ftplugin/sql.vim. This file will define a number of buffer specific
maps for SQL completion, see |sql-completion-maps|. Now these maps have
been created and the SQL completion plugin has been initialized. All SQL
syntax items have been cached in preparation. The SQL filetype script detects
we are attempting to use two different completion plugins. Since the SQL maps
begin with <C-C>, the maps will toggle the |'omnifunc'| when in use. So you
can use <C-X><C-O> to continue using the completion for Perl (using the syntax
completion plugin) and <C-C> to use the SQL completion features.
Step 3
------
Setting the filetype back to Perl sets all the usual "perl" related items back
as they were.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

View file

@ -1,186 +0,0 @@
*gui_w16.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Graphical User Interface *gui-w16* *win16-gui*
1. Starting the GUI |win16-start|
2. Vim as default editor |win16-default-editor|
3. Using the clipboard |win16-clipboard|
4. Shell Commands |win16-shell|
5. Special colors |win16-colors|
6. Windows dialogs & browsers |win16-dialogs|
7. Various |win16-various|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
|os_msdos.txt| For items common to DOS and Windows.
|gui_w32.txt| Some items here are also applicable to the Win16 version.
{Vi does not have a Windows GUI}
The Win16 version of Vim will run on Windows 3.1 or later. It has not been
tested on 3.0, it probably won't work without being recompiled and
modified. (But you really should upgrade to 3.11 anyway. :)
In most respects it behaves identically to the Win32 GUI version, including
having a flat-style toolbar(!). The chief differences:
1) Bold/Italic text is not available, to speed up repaint/reduce resource
usage. (You can re-instate this by undefining MSWIN16_FASTTEXT.)
2) No tearoff menu emulation.
3) No OLE interface.
4) No long filename support (of course).
5) No tooltips on toolbar buttons - instead they produce command-line tips
like menu items do.
6) Line length limited to 32767 characters (like 16-bit DOS version).
==============================================================================
1. Starting the GUI *win16-start*
The Win16 GUI version of Vim will always start the GUI, no matter how you
start it or what it's called. There is no 'console' version as such, but you
can use one of the DOS versions in a DOS box.
The Win16 GUI has an extra menu item: "Window/Select Font". It brings up the
standard Windows font selector. Note that bold and italic fonts are not
supported in an attempt to maximize GDI drawing speed.
Setting the menu height doesn't work for the Win16 GUI.
*win16-maximized*
If you want Vim to start with a maximized window, add this command to your
vimrc or gvimrc file: >
au GUIEnter * simalt ~x
<
There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|.
==============================================================================
2. Vim as default editor *win16-default-editor*
To set Vim as the default editor for a file type you can use File Manager's
"Associate" feature.
When you open a file in Vim by double clicking it, Vim changes to that
file's directory.
See also |notepad|.
==============================================================================
3. Using the clipboard *win16-clipboard*
Windows has a clipboard, where you can copy text to, and paste text from. Vim
supports this in several ways.
The clipboard works in the same way as the Win32 version: see |gui-clipboard|.
==============================================================================
4. Shell Commands *win16-shell*
Vim spawns a DOS window for external commands, to make it possible to run any
DOS command. The window uses the _default.pif settings.
*win16-!start*
Normally, Vim waits for a command to complete before continuing (this makes
sense for most shell commands which produce output for Vim to use). If you
want Vim to start a program and return immediately, you can use the following
syntax:
:!start {command}
This may only work for a Windows program though.
Don't forget that you must tell Windows 3.1x to keep executing a DOS command
in the background while you switch back to Vim.
==============================================================================
5. Special colors *win16-colors*
On Win16, the normal DOS colors can be used. See |dos-colors|.
Additionally the system configured colors can also be used. These are known
by the names Sys_XXX, where XXX is the appropriate system color name, from the
following list (see the Win32 documentation for full descriptions). Case is
ignored.
Sys_BTNFace Sys_BTNShadow Sys_ActiveBorder
Sys_ActiveCaption Sys_AppWorkspace Sys_Background
Sys_BTNText Sys_CaptionText Sys_GrayText
Sys_Highlight Sys_HighlightText Sys_InactiveBorder
Sys_InactiveCaption Sys_InactiveCaptionText Sys_Menu
Sys_MenuText Sys_ScrollBar Sys_Window
Sys_WindowFrame Sys_WindowText
Probably the most useful values are
Sys_Window Normal window background
Sys_WindowText Normal window text
Sys_Highlight Highlighted background
Sys_HighlightText Highlighted text
These extra colors are also available:
Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
See also |rgb.txt|.
==============================================================================
*win16-dialogs*
6. Windows dialogs & browsers
The Win16 GUI can use familiar Windows components for some operations, as well
as the traditional interface shared with the console version.
6.1 Dialogs
The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
|:confirm| command and |confirm()| function) are GUI-based rather than the
console-based ones used by other versions. There is no option to change this.
6.2 File Browsers
When prepending ":browse" before file editing commands, a file requester is
used to allow you to select an existing file. See |:browse|.
==============================================================================
7. Various *win16-various*
*win16-printing*
The "File/Print" menu uses Notepad to print the current buffer. This is a bit
clumsy, but it's portable. If you want something else, you can define your
own print command. For example, you could look for the 16-bit version of
PrintFile. See $VIMRUNTIME/menu.vim for how it works by default.
Using this should also work: >
:w >>prn
Vim supports a number of standard MS Windows features. Some of these are
detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
Also see |:simalt|
*win16-drag-n-drop*
You can drag and drop one or more files into the vim window, where they will
be opened as normal. If you hold down Shift while doing this, Vim changes to
the (first) dropped file's directory. If you hold Ctrl, Vim will always split
a new window for the file. Otherwise it's only done if the current buffer has
been changed.
You can also drop a directory's icon, but rather than open all files in the
directory (which wouldn't usually be what you want) Vim instead changes to
that directory and begins a new file.
If Vim happens to be editing a command line, the names of the dropped files
and directories will be inserted at the cursor. This allows you to use these
names with any Ex command.
*win16-truetype*
It is recommended that you use a raster font and not a TrueType
fixed-pitch font. E.g. use Courier, not Courier New. This is not just
to use less resources but because there are subtle bugs in the
handling of fixed-pitch TrueType in Win3.1x. In particular, when you move
a block cursor over a pipe character '|', the cursor is drawn in the wrong
size and bits get left behind. This is a bug in the Win3.1x GDI, it doesn't
happen if you run the exe under 95/NT.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View file

@ -1,504 +0,0 @@
*gui_w32.txt* For Vim version 7.4. Last change: 2012 Aug 04
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Win32 Graphical User Interface *gui-w32* *win32-gui*
1. Starting the GUI |gui-w32-start|
2. Vim as default editor |vim-default-editor|
3. Using the clipboard |gui-clipboard|
4. Shell Commands |gui-shell-win32|
5. Special colors |win32-colors|
6. Windows dialogs & browsers |gui-w32-dialogs|
7. Command line arguments |gui-w32-cmdargs|
8. Various |gui-w32-various|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
|os_win32.txt| For Win32 specific items.
{Vi does not have a Windows GUI}
==============================================================================
1. Starting the GUI *gui-w32-start*
The Win32 GUI version of Vim will always start the GUI, no matter how you
start it or what it's called.
The GUI will always run in the Windows subsystem. Mostly shells automatically
return with a command prompt after starting gvim. If not, you should use the
"start" command: >
start gvim [options] file ..
Note: All fonts (bold, italic) must be of the same size!!! If you don't do
this, text will disappear or mess up the display. Vim does not check the font
sizes. It's the size in screen pixels that must be the same. Note that some
fonts that have the same point size don't have the same pixel size!
Additionally, the positioning of the fonts must be the same (ascent and
descent).
The Win32 GUI has an extra menu item: "Edit/Select Font". It brings up the
standard Windows font selector.
Setting the menu height doesn't work for the Win32 GUI.
*gui-win32-maximized*
If you want Vim to start with a maximized window, add this command to your
vimrc or gvimrc file: >
au GUIEnter * simalt ~x
<
*gui-w32s*
There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|.
Using Vim as a plugin *gui-w32-windowid*
When gvim starts up normally, it creates its own top level window. If you
pass Vim the command-line option |--windowid| with a decimal or hexadecimal
value, Vim will create a window that is a child of the window with the given
ID. This enables Vim to act as a plugin in another application. This really
is a programmer's interface, and is of no use without a supporting application
to spawn Vim correctly.
==============================================================================
2. Vim as default editor *vim-default-editor*
To set Vim as the default editor for a file type:
1. Start a Windows Explorer
2. Choose View/Options -> File Types
3. Select the path to gvim for every file type that you want to use it for.
(you can also use three spaces in the file type field, for files without an
extension).
In the "open" action, use: >
gvim "%1"
< The quotes are required for using file names with embedded spaces.
You can also use this: >
gvim "%L"
< This should avoid short (8.3 character) file names in some situations. But
I'm not sure if this works everywhere.
When you open a file in Vim by double clicking it, Vim changes to that
file's directory.
If you want Vim to start full-screen, use this for the Open action: >
gvim -c "simalt ~x" "%1"
Another method, which also works when you put Vim in another directory (e.g.,
when you have got a new version):
1. select a file you want to use Vim with
2. <Shift-F10>
3. select "Open With..." menu entry
4. click "Other..."
5. browse to the (new) location of Vim and click "Open"
6. make "Always Use this program..." checked
7. <OK>
*send-to-menu* *sendto*
You can also install Vim in the "Send To" menu:
1. Start a Windows Explorer
2. Navigate to your sendto directory:
Windows 95: %windir%\sendto (e.g. "c:\windows\sendto")
Windows NT: %windir%\profiles\%user%\sendto (e.g.
"c:\winnt\profiles\mattha\sendto").
3. Right-click in the file pane and select New->Shortcut
4. Follow the shortcut wizard, using the full path to VIM/GVIM.
When you 'send a file to Vim', Vim changes to that file's directory. Note,
however, that any long directory names will appear in their short (MS-DOS)
form. This is a limitation of the Windows "Send To" mechanism.
*notepad*
You could replace notepad.exe with gvim.exe, but that has a few side effects.
Some programs rely on notepad arguments, which are not recognized by Vim. For
example "notepad -p" is used by some applications to print a file. It's
better to leave notepad where it is and use another way to start Vim.
*win32-popup-menu*
A more drastic approach is to install an "Edit with Vim" entry in the popup
menu for the right mouse button. With this you can edit any file with Vim.
This can co-exist with the file associations mentioned above. The difference
is that the file associations will make starting Vim the default action. With
the "Edit with Vim" menu entry you can keep the existing file association for
double clicking on the file, and edit the file with Vim when you want. For
example, you can associate "*.mak" with your make program. You can execute
the makefile by double clicking it and use the "Edit with Vim" entry to edit
the makefile.
You can select any files and right-click to see a menu option called "Edit
with gvim". Choosing this menu option will invoke gvim with the file you have
selected. If you select multiple files, you will find two gvim-related menu
options:
"Edit with multiple gvims" -- one gvim for each file in the selection
"Edit with single gvim" -- one gvim for all the files in the selection
And if there already is a gvim running:
"Edit with existing gvim" -- edit the file with the running gvim
The "edit with existing Vim" entries can be disabled by adding an entry in the
registry under HKLM\Software\Vim\Gvim, named DisableEditWithExisting, and with
any value.
*install-registry*
You can add the "Edit with Vim" menu entry in an easy way by using the
"install.exe" program. It will add several registry entries for you.
You can also do this by hand. This is complicated! Use the install.exe if
you can.
1. Start the registry editor with "regedit".
2. Add these keys:
key value name value ~
HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}
{default} Vim Shell Extension
HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32
{default} {path}\gvimext.dll
ThreadingModel Apartment
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim
{default} {51EEE242-AD87-11d3-9C1E-0090278BBD99}
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved
{51EEE242-AD87-11d3-9C1E-0090278BBD99}
Vim Shell Extension
HKEY_LOCAL_MACHINE\Software\Vim\Gvim
path {path}\gvim.exe
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6
DisplayName Vim 5.6: Edit with Vim popup menu entry
UninstallString {path}\uninstal.exe
Replace {path} with the path that leads to the executable.
Don't type {default}, this is the value for the key itself.
To remove "Edit with Vim" from the popup menu, just remove the registry
entries mentioned above. The "uninstal.exe" program can do this for you. You
can also use the entry in the Windows standard "Add/Remove Programs" list.
If you notice that this entry overrules other file type associations, set
those associations again by hand (using Windows Explorer, see above). This
only seems to happen on some Windows NT versions (Windows bug?). Procedure:
1. Find the name of the file type. This can be done by starting the registry
editor, and searching for the extension in \\HKEY_CLASSES_ROOT
2. In a Windows Explorer, use View/Options/File Types. Search for the file
type in the list and click "Edit". In the actions list, you can select on
to be used as the default (normally the "open" action) and click on the
"Set Default" button.
Vim in the "Open With..." context menu *win32-open-with-menu*
If you use the Vim install program you have the choice to add Vim to the "Open
With..." menu. This means you can use Vim to edit many files. Not every file
(for unclear reasons...), thus the "Edit with Vim" menu entry is still useful.
One reason to add this is to be able to edit HTML files directly from Internet
Explorer. To enable this use the "Tools" menu, "Internet Options..." entry.
In the dialog select the "Programs" tab and select Vim in the "HTML editor"
choice. If it's not there than installing didn't work properly.
Doing this manually can be done with this script:
----------------------------------------------------------
REGEDIT4
[HKEY_CLASSES_ROOT\Applications\gvim.exe]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command]
@="c:\\vim\\vim62\\gvim.exe \"%1\""
[HKEY_CLASSES_ROOT\.htm\OpenWithList\gvim.exe]
[HKEY_CLASSES_ROOT\*\OpenWithList\gvim.exe]
----------------------------------------------------------
Change the "c:\\vim\\vim62" bit to where gvim.exe is actually located.
To uninstall this run the Vim uninstall program or manually delete the
registry entries with "regedit".
==============================================================================
3. Using the clipboard *gui-clipboard*
Windows has a clipboard, where you can copy text to, and paste text from. Vim
supports this in several ways. For other systems see |gui-selections|.
The "* register reflects the contents of the clipboard. |quotestar|
When the "unnamed" string is included in the 'clipboard' option, the unnamed
register is the same. Thus you can yank to and paste from the clipboard
without prepending "* to commands.
The 'a' flag in 'guioptions' is not included by default. This means that text
is only put on the clipboard when an operation is performed on it. Just
Visually selecting text doesn't put it on the clipboard. When the 'a' flag is
included, the text is copied to the clipboard even when it is not operated
upon.
*mswin.vim*
To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the
$VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file: >
source $VIMRUNTIME/mswin.vim
Since CTRL-C is used to copy the text to the clipboard, it can't be used to
cancel an operation. Use CTRL-Break for that.
CTRL-Z is used for undo. This means you can't suspend Vim with this key, use
|:suspend| instead (if it's supported at all).
*CTRL-V-alternative* *CTRL-Q*
Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
selection. You can use CTRL-Q instead. You can also use CTRL-Q in Insert
mode and Command-line mode to get the old meaning of CTRL-V. But CTRL-Q
doesn't work for terminals when it's used for control flow.
NOTE: The clipboard support still has a number of bugs. See |todo|.
==============================================================================
4. Shell Commands *gui-shell-win32*
Vim uses another window for external commands, to make it possible to run any
command. The external command gets its own environment for running, just like
it was started from a DOS prompt.
*win32-vimrun*
Executing an external command is done indirectly by the "vimrun" command. The
"vimrun.exe" must be in the path for this to work. Or it must be in the same
directory as the Vim executable. If "vimrun" cannot be found, the command is
executed directly, but then the DOS window closes immediately after the
external command has finished.
WARNING: If you close this window with the "X" button, and confirm the
question if you really want to kill the application, Vim may be killed too!
(This does not apply to commands run asynchronously with ":!start".)
In Windows 95, the window in which the commands are executed is always 25x80
characters, to be as DOS compatible as possible (this matters!). The default
system font is used. On NT, the window will be the default you have set up for
"Console" in Control Panel. On Win32s, the properties of the DOS box are
determined by _default.pif in the windows directory.
*msdos-mode*
If you get a dialog that says "This program is set to run in MS-DOS mode..."
when you run an external program, you can solve this by changing the
properties of the associated shortcut:
- Use a Windows Explorer to find the command.com that is used. It can be
c:\command.com, c:\dos\command.com, c:\windows\command.com, etc.
- With the right mouse button, select properties of this command.com.
- In the Program tab select "Advanced".
- Unselect "MS-DOS mode".
- Click "OK" twice.
*win32-!start*
Normally, Vim waits for a command to complete before continuing (this makes
sense for most shell commands which produce output for Vim to use). If you
want Vim to start a program and return immediately, you can use the following
syntax on W95 & NT: >
:!start [/min] {command}
The optional "/min" causes the window to be minimized.
On Win32s, you will have to go to another window instead. Don't forget that
you must tell Windows 3.1x to keep executing a DOS command in the background
while you switch back to Vim.
==============================================================================
5. Special colors *win32-colors*
On Win32, the normal DOS colors can be used. See |dos-colors|.
Additionally the system configured colors can also be used. These are known
by the names Sys_XXX, where XXX is the appropriate system color name, from the
following list (see the Win32 documentation for full descriptions). Case is
ignored. Note: On Win32s not all of these colors are supported.
Sys_3DDKShadow Sys_3DFace Sys_BTNFace
Sys_3DHilight Sys_3DHighlight Sys_BTNHilight
Sys_BTNHighlight Sys_3DLight Sys_3DShadow
Sys_BTNShadow Sys_ActiveBorder Sys_ActiveCaption
Sys_AppWorkspace Sys_Background Sys_Desktop
Sys_BTNText Sys_CaptionText Sys_GrayText
Sys_Highlight Sys_HighlightText Sys_InactiveBorder
Sys_InactiveCaption Sys_InactiveCaptionText Sys_InfoBK
Sys_InfoText Sys_Menu Sys_MenuText
Sys_ScrollBar Sys_Window Sys_WindowFrame
Sys_WindowText
Probably the most useful values are
Sys_Window Normal window background
Sys_WindowText Normal window text
Sys_Highlight Highlighted background
Sys_HighlightText Highlighted text
These extra colors are also available:
Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
*rgb.txt*
Additionally, colors defined by a "rgb.txt" file can be used. This file is
well known from X11. A few lines from it: >
255 218 185 peach puff
205 133 63 peru
255 181 197 pink
This shows the layout of the file: First the R, G and B value as a decimal
number, followed by the name of the color. The four fields are separated by
spaces.
You can get an rgb.txt file from any X11 distribution. It is located in a
directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the
$VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt".
==============================================================================
*gui-w32-dialogs* *dialog*
6. Windows dialogs & browsers
The Win32 GUI can use familiar Windows components for some operations, as well
as the traditional interface shared with the console version.
6.1 Dialogs
The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
|:confirm| command and |confirm()| function) are GUI-based rather than the
console-based ones used by other versions. The 'c' flag in 'guioptions'
changes this.
6.2 File Browsers
When prepending ":browse" before file editing commands, a file requester is
used to allow you to select an existing file. See |:browse|.
6.3 Tearoff Menus
The Win32 GUI emulates Motif's tear-off menus. At the top of each menu you
will see a small graphic "rip here" sign. Selecting it will cause a floating
window to be created with the same menu entries on it. The floating menu can
then be accessed just as if it was the original (including sub-menus), but
without having to go to the menu bar each time.
This is most useful if you find yourself using a command buried in a sub-menu
over and over again.
The tearoff menus can be positioned where you like, and always stay just above
the Main Vim window. You can get rid of them by closing them as usual; they
also of course close when you exit Vim.
*:tearoff* *:te*
:te[aroff] {name} Tear-off the menu {name}. The menu named must have at
least one subentry, but need not appear on the
menu-bar (see |win32-hidden-menus|).
Example: >
:tearoff File
will make the "File" menu (if there is one) appear as a tearoff menu. >
:amenu ]Toolbar.Make :make<CR>
:tearoff ]Toolbar
This creates a floating menu that doesn't exist on the main menu-bar.
Note that a menu that starts with ']' will not be displayed.
==============================================================================
7. Command line arguments *gui-w32-cmdargs*
Analysis of a command line into parameters is not standardised in MS Windows.
Gvim has to provide logic to analyse a command line. This logic is likely to
be different from the default logic provided by a compilation system used to
build vim. The differences relate to unusual double quote (") usage.
The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the
same way. The argument "+/Sch""iller" may be handled different by gvim and
vim, depending what it was compiled with.
The rules are:
a) A parameter is a sequence of graphic characters.
b) Parameters are separated by white space.
c) A parameter can be enclosed in double quotes to include white space.
d) A sequence of zero or more backslashes (\) and a double quote (")
is special. The effective number of backslashes is halved, rounded
down. An even number of backslashes reverses the acceptability of
spaces and tabs, an odd number of backslashes produces a literal
double quote.
So:
" is a special double quote
\" is a literal double quote
\\" is a literal backslash and a special double quote
\\\" is a literal backslash and a literal double quote
\\\\" is 2 literal backslashes and a special double quote
\\\\\" is 2 literal backslashes and a literal double quote
etc.
Example: >
gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\"
opens "C:\My Music\freude" and executes the line mode commands: >
set ignorecase; /"foo\ and /bar\"
==============================================================================
8. Various *gui-w32-various*
*gui-w32-printing*
The "File/Print" menu prints the text with syntax highlighting, see
|:hardcopy|. If you just want to print the raw text and have a default
printer installed this should also work: >
:w >>prn
Vim supports a number of standard MS Windows features. Some of these are
detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
*drag-n-drop-win32*
You can drag and drop one or more files into the Vim window, where they will
be opened as normal. See |drag-n-drop|.
*:simalt* *:si*
:sim[alt] {key} simulate pressing {key} while holding Alt pressed.
{not in Vi} {only for Win32 versions}
Normally, Vim takes control of all Alt-<Key> combinations, to increase the
number of possible mappings. This clashes with the standard use of Alt as the
key for accessing menus.
The quick way of getting standard behavior is to set the 'winaltkeys' option
to "yes". This however prevents you from mapping Alt keys at all.
Another way is to set 'winaltkeys' to "menu". Menu shortcut keys are then
handled by windows, other ALT keys can be mapped. This doesn't allow a
dependency on the current state though.
To get round this, the :simalt command allows Vim (when 'winaltkeys' is not
"yes") to fake a Windows-style Alt keypress. You can use this to map Alt key
combinations (or anything else for that matter) to produce standard Windows
actions. Here are some examples: >
:map <M-f> :simalt f<CR>
This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by
simulating the keystrokes Alt, F. >
:map <M-Space> :simalt ~<CR>
This maps Alt-Space to pop down the system menu for the Vim window. Note that
~ is used by simalt to represent the <Space> character. >
:map <C-n> :simalt ~n<CR>
Maps Control-N to produce the keys Alt-Space followed by N. This minimizes the
Vim window via the system menu.
Note that the key changes depending on the language you are using.
*intellimouse-wheel-problems*
When using the Intellimouse mouse wheel causes Vim to stop accepting input, go
to:
ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions
And add gvim to the list of applications. This problem only appears to happen
with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on.
XPM support *w32-xpm-support*
Gvim can be build on MS-Windows with support for XPM files. |+xpm_w32|
See the Make_mvc.mak file for instructions, search for XPM.
To try out if XPM support works do this: >
:help
:exe 'sign define vimxpm icon=' . $VIMRUNTIME . '\\vim16x16.xpm'
:exe 'sign place 1 line=1 name=vimxpm file=' . expand('%:p')
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

View file

@ -1,585 +0,0 @@
*gui_x11.txt* For Vim version 7.4. Last change: 2011 Sep 14
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Graphical User Interface *gui-x11* *GUI-X11*
*Athena* *Motif*
1. Starting the X11 GUI |gui-x11-start|
2. GUI Resources |gui-resources|
3. Shell Commands |gui-pty|
4. Various |gui-x11-various|
5. GTK version |gui-gtk|
6. GNOME version |gui-gnome|
7. KDE version |gui-kde|
8. Compiling |gui-x11-compiling|
9. X11 selection mechanism |x11-selection|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
{Vi does not have any of these commands}
==============================================================================
1. Starting the X11 GUI *gui-x11-start* *E665*
Then you can run the GUI version of Vim in either of these ways:
gvim [options] [files...]
vim -g [options] [files...]
So if you call the executable "gvim", or make "gvim" a link to the executable,
then the GUI version will automatically be used. Additional characters may be
added after "gvim", for example "gvim-5".
You may also start up the GUI from within the terminal version by using one of
these commands:
:gui [++opt] [+cmd] [-f|-b] [files...] *:gu* *:gui*
:gvim [++opt] [+cmd] [-f|-b] [files...] *:gv* *:gvim*
The "-f" option runs Vim in the foreground.
The "-b" option runs Vim in the background (this is the default).
Also see |++opt| and |+cmd|.
*gui-fork*
When the GUI is started, it does a fork() and exits the current process.
When gvim was started from a shell this makes the shell accept further
commands. If you don't want this (e.g. when using gvim for a mail program
that waits for gvim to exit), start gvim with "gvim -f", "vim -gf" or use
":gui -f". Don't use "vim -fg", because "-fg" specifies the foreground
color.
When using "gvim -f" and then ":gui", Vim will run in the foreground. The
"-f" argument will be remembered. To force running Vim in the background use
":gui -b".
"gvim --nofork" does the same as "gvim -f".
*E851* *E852*
When starting the GUI fails Vim will try to continue running in the terminal.
If you want the GUI to run in the foreground always, include the 'f'
flag in 'guioptions'. |-f|.
==============================================================================
2. GUI Resources *gui-resources* *.Xdefaults*
If using the Motif or Athena version of the GUI (not for the KDE, GTK+ or Win32
version), a number of X resources are available. You should use Vim's class
"Vim" when setting these. They are as follows:
Resource name Meaning ~
reverseVideo Boolean: should reverse video be used?
background Color of background.
foreground Color of normal text.
scrollBackground Color of trough portion of scrollbars.
scrollForeground Color of slider and arrow portions of scrollbars.
menuBackground Color of menu backgrounds.
menuForeground Color of menu foregrounds.
tooltipForeground Color of tooltip and balloon foreground.
tooltipBackground Color of tooltip and balloon background.
font Name of font used for normal text.
boldFont Name of font used for bold text.
italicFont Name of font used for italic text.
boldItalicFont Name of font used for bold, italic text.
menuFont Name of font used for the menus, used when compiled
without the |+xfontset| feature
menuFontSet Name of fontset used for the menus, used when compiled
with the |+xfontset| feature
tooltipFont Name of the font used for the tooltip and balloons.
When compiled with the |+xfontset| feature this is a
fontset name.
geometry Initial geometry to use for gvim's window (default
is same size as terminal that started it).
scrollbarWidth Thickness of scrollbars.
borderWidth Thickness of border around text area.
menuHeight Height of the menu bar (only for Athena).
A special font for italic, bold, and italic-bold text will only be used if
the user has specified one via a resource. No attempt is made to guess what
fonts should be used for these based on the normal text font.
Note that the colors can also be set with the ":highlight" command, using the
"Normal", "Menu", "Tooltip", and "Scrollbar" groups. Example: >
:highlight Menu guibg=lightblue
:highlight Tooltip guibg=yellow
:highlight Scrollbar guibg=lightblue guifg=blue
:highlight Normal guibg=grey90
<
*font-sizes*
Note: All fonts (except for the menu and tooltip) must be of the same size!!!
If you don't do this, text will disappear or mess up the display. Vim does
not check the font sizes. It's the size in screen pixels that must be the
same. Note that some fonts that have the same point size don't have the same
pixel size! Additionally, the positioning of the fonts must be the same
(ascent and descent). You can check this with "xlsfonts -l {fontname}".
If any of these things are also set with Vim commands, e.g. with
":set guifont=Screen15", then this will override the X resources (currently
'guifont' is the only option that is supported).
Here is an example of what you might put in your ~/.Xdefaults file: >
Vim*useSchemes: all
Vim*sgiMode: true
Vim*useEnhancedFSB: true
Vim.foreground: Black
Vim.background: Wheat
Vim*fontList: 7x13
The first three of these are standard resources on Silicon Graphics machines
which make Motif applications look even better, highly recommended!
The "Vim*fontList" is to set the menu font for Motif. Example: >
Vim*menuBar*fontList: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
With Athena: >
Vim*menuBar*SmeBSB*font: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Vim*menuBar*MenuButton*font: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
NOTE: A more portable, and indeed more correct, way to specify the menu font
in either Motif or Athena is through the resource: >
Vim.menuFont: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Or, when compiled with the |+xfontset| feature: >
Vim.menuFontSet: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Don't use "Vim*geometry" in the defaults. This will break the menus. Use
"Vim.geometry" instead.
If you get an error message "Cannot allocate colormap entry for "gray60",
try adding this to your Vim resources (change the colors to your liking): >
Vim*scrollBackground: Black
Vim*scrollForeground: Blue
The resources can also be set with arguments to Vim:
argument meaning ~
*-gui*
-display {display} Run vim on {display} *-display*
-iconic Start vim iconified *-iconic*
-background {color} Use {color} for the background *-background*
-bg {color} idem *-bg*
-foreground {color} Use {color} for normal text *-foreground*
-fg {color} idem *-fg*
-ul {color} idem *-ul*
-font {font} Use {font} for normal text *-font*
-fn {font} idem *-fn*
-boldfont {font} Use {font} for bold text *-boldfont*
-italicfont {font} Use {font} for italic text *-italicfont*
-menufont {font} Use {font} for menu items *-menufont*
-menufontset {fontset} Use {fontset} for menu items *-menufontset*
-mf {font} idem *-mf*
-geometry {geom} Use {geom} for initial geometry *-geometry*
-geom {geom} idem, see |-geometry-example| *-geom*
-borderwidth {width} Use a border width of {width} *-borderwidth*
-bw {width} idem *-bw*
*-scrollbarwidth*
-scrollbarwidth {width} Use a scrollbar width of {width}
-sw {width} idem *-sw*
-menuheight {height} Use a menu bar height of {height} *-menuheight*
-mh {height} idem *-mh*
NOTE: On Motif the value is ignored, the menu height
is computed to fit the menus.
-reverse Use reverse video *-reverse*
-rv idem *-rv*
+reverse Don't use reverse video *-+reverse*
+rv idem *-+rv*
-xrm {resource} Set the specified resource *-xrm*
Note about reverse video: Vim checks that the result is actually a light text
on a dark background. The reason is that some X11 versions swap the colors,
and some don't. These two examples will both give yellow text on a blue
background:
gvim -fg Yellow -bg Blue -reverse
gvim -bg Yellow -fg Blue -reverse
*-geometry-example*
An example for the geometry argument: >
gvim -geometry 80x63+8+100
This creates a window with 80 columns and 63 lines at position 8 pixels from
the left and 100 pixels from the top of the screen.
==============================================================================
3. Shell Commands *gui-pty*
WARNING: Executing an external command from the GUI will not always work.
"normal" commands like "ls", "grep" and "make" mostly work fine. Commands
that require an intelligent terminal like "less" and "ispell" won't work.
Some may even hang and need to be killed from another terminal. So be
careful!
There are two ways to do the I/O with a shell command: Pipes and a pseudo-tty.
The default is to use a pseudo-tty. This should work best on most systems.
Unfortunately, the implementation of the pseudo-tty is different on every Unix
system. And some systems require root permission. To avoid running into
problems with a pseudo-tty when you least expect it, test it when not editing
a file. Be prepared to "kill" the started command or Vim. Commands like
":r !cat" may hang!
If using a pseudo-tty does not work for you, reset the 'guipty' option: >
:set noguipty
Using a pipe should work on any Unix system, but there are disadvantages:
- Some shell commands will notice that a pipe is being used and behave
differently. E.g., ":!ls" will list the files in one column.
- The ":sh" command won't show a prompt, although it will sort of work.
- When using ":make" it's not possible to interrupt with a CTRL-C.
Typeahead while the external command is running is often lost. This happens
both with a pipe and a pseudo-tty. This is a known problem, but it seems it
can't be fixed (or at least, it's very difficult).
*gui-pty-erase*
When your erase character is wrong for an external command, you should fix
this in your "~/.cshrc" file, or whatever file your shell uses for
initializations. For example, when you want to use backspace to delete
characters, but hitting backspaces produces "^H" instead, try adding this to
your "~/.cshrc": >
stty erase ^H
The ^H is a real CTRL-H, type it as CTRL-V CTRL-H.
==============================================================================
4. Various *gui-x11-various*
*gui-x11-printing*
The "File/Print" menu simply sends the current buffer to "lpr". No options or
whatever. If you want something else, you can define your own print command.
For example: >
:10amenu File.Print :w !lpr -Php3
:10vmenu File.Print :w !lpr -Php3
<
*X11-icon*
Vim uses a black&white icon by default when compiled with Motif or Athena. A
colored Vim icon is included as $VIMRUNTIME/vim32x32.xpm. For GTK+, this is
the builtin icon used. Unfortunately, how you should install it depends on
your window manager. When you use this, remove the 'i' flag from
'guioptions', to remove the black&white icon: >
:set guioptions-=i
If you use one of the fvwm* family of window managers simply add this line to
your .fvwm2rc configuration file: >
Style "vim" Icon vim32x32.xpm
Make sure the icon file's location is consistent with the window manager's
ImagePath statement. Either modify the ImagePath from within your .fvwm2rc or
drop the icon into one the pre-defined directories: >
ImagePath /usr/X11R6/include/X11/pixmaps:/usr/X11R6/include/X11/bitmaps
Note: older versions of fvwm use "IconPath" instead of "ImagePath".
For CDE "dtwm" (a derivative of Motif) add this line in the .Xdefaults: >
Dtwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
For "mwm" (Motif window manager) the line would be: >
Mwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
Mouse Pointers Available in X11 *X11_mouse_shapes*
By using the |'mouseshape'| option, the mouse pointer can be automatically
changed whenever Vim enters one of its various modes (e.g., Insert or
Command). Currently, the available pointers are:
arrow an arrow pointing northwest
beam a I-like vertical bar
size an arrow pointing up and down
busy a wristwatch
blank an invisible pointer
crosshair a thin "+" sign
hand1 a dark hand pointing northeast
hand2 a light hand pointing northwest
pencil a pencil pointing southeast
question question_arrow
right_arrow an arrow pointing northeast
up_arrow an arrow pointing upwards
Additionally, any of the mouse pointers that are built into X11 may be
used by specifying an integer from the X11/cursorfont.h include file.
If a name is used that exists on other systems, but not in X11, the default
"arrow" pointer is used.
==============================================================================
5. GTK version *gui-gtk* *GTK+* *GTK*
The GTK version of the GUI works a little bit different.
GTK does _not_ use the traditional X resource settings. Thus items in your
~/.Xdefaults or app-defaults files are not used.
Many of the traditional X command line arguments are not supported. (e.g.,
stuff like -bg, -fg, etc). The ones that are supported are:
command line argument resource name meaning ~
-fn or -font .font font name for the text
-geom or -geometry .geometry size of the gvim window
-rv or -reverse *reverseVideo white text on black background
-display display to be used
-fg -foreground {color} foreground color
-bg -background {color} background color
To set the font, see |'guifont'|. For GTK, there's also a menu option that
does this.
Additionally, there are these command line arguments, which are handled by GTK
internally. Look in the GTK documentation for how they are used:
--sync
--gdk-debug
--gdk-no-debug
--no-xshm (not in GTK+ 2)
--xim-preedit (not in GTK+ 2)
--xim-status (not in GTK+ 2)
--gtk-debug
--gtk-no-debug
--g-fatal-warnings
--gtk-module
--display (GTK+ counterpart of -display; works the same way.)
--screen (The screen number; for GTK+ 2.2 multihead support.)
These arguments are ignored when the |+netbeans_intg| feature is used:
-xrm
-mf
As for colors, Vim's color settings (for syntax highlighting) is still
done the traditional Vim way. See |:highlight| for more help.
If you want to set the colors of remaining gui components (e.g., the
menubar, scrollbar, whatever), those are GTK specific settings and you
need to set those up in some sort of gtkrc file. You'll have to refer
to the GTK documentation, however little there is, on how to do this.
See http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html
for more information.
*gtk-tooltip-colors*
Example, which sets the tooltip colors to black on light-yellow: >
style "tooltips"
{
bg[NORMAL] = "#ffffcc"
fg[NORMAL] = "#000000"
}
widget "gtk-tooltips*" style "tooltips"
Write this in the file ~/.gtkrc and it will be used by GTK+. For GTK+ 2
you might have to use the file ~/.gtkrc-2.0 instead, depending on your
distribution.
Using Vim as a GTK+ plugin *gui-gtk-socketid*
When the GTK+ version of Vim starts up normally, it creates its own top level
window (technically, a 'GtkWindow'). GTK+ provides an embedding facility with
its GtkSocket and GtkPlug widgets. If one GTK+ application creates a
GtkSocket widget in one of its windows, an entirely different GTK+ application
may embed itself into the first application by creating a top-level GtkPlug
widget using the socket's ID.
If you pass Vim the command-line option '--socketid' with a decimal or
hexadecimal value, Vim will create a GtkPlug widget using that value instead
of the normal GtkWindow. This enables Vim to act as a GTK+ plugin.
This really is a programmer's interface, and is of no use without a supporting
application to spawn the Vim correctly. For more details on GTK+ sockets, see
http://www.gtk.org/api/
Note that this feature requires the latest GTK version. GTK 1.2.10 still has
a small problem. The socket feature has not yet been tested with GTK+ 2 --
feel free to volunteer.
==============================================================================
6. GNOME version *gui-gnome* *Gnome* *GNOME*
The GNOME GUI works just like the GTK+ version. See |GTK+| above for how it
works. It looks a bit different though, and implements one important feature
that's not available in the plain GTK+ GUI: Interaction with the session
manager. |gui-gnome-session|
These are the different looks:
- Uses GNOME dialogs (GNOME 1 only). The GNOME 2 GUI uses the same nice
dialogs as the GTK+ 2 version.
- Uses the GNOME dock, so that the toolbar and menubar can be moved to
different locations other than the top (e.g., the toolbar can be placed on
the left, right, top, or bottom). The placement of the menubar and
toolbar is only saved in the GNOME 2 version.
- That means the menubar and toolbar handles are back! Yeah! And the
resizing grid still works too.
GNOME is compiled with if it was found by configure and the
--enable-gnome-check argument was used.
GNOME session support *gui-gnome-session* *gnome-session*
On logout, Vim shows the well-known exit confirmation dialog if any buffers
are modified. Clicking [Cancel] will stop the logout process. Otherwise the
current session is stored to disk by using the |:mksession| command, and
restored the next time you log in.
The GNOME session support should also work with the KDE session manager.
If you are experiencing any problems please report them as bugs.
Note: The automatic session save works entirely transparent, in order to
avoid conflicts with your own session files, scripts and autocommands. That
means in detail:
- The session file is stored to a separate directory (usually $HOME/.gnome2).
- 'sessionoptions' is ignored, and a hardcoded set of appropriate flags is
used instead: >
blank,curdir,folds,globals,help,options,tabpages,winsize
- The internal variable |v:this_session| is not changed when storing the
session. Also, it is restored to its old value when logging in again.
The position and size of the GUI window is not saved by Vim since doing so
is the window manager's job. But if compiled with GTK+ 2 support, Vim helps
the WM to identify the window by restoring the window role (using the |--role|
command line argument).
==============================================================================
7. KDE version *gui-kde* *kde* *KDE* *KVim*
*gui-x11-kde*
There is no KDE version of Vim. There has been some work on a port using the
Qt toolkit, but it never worked properly and it has been abandoned. Work
continues on Yzis: www.yzis.org.
==============================================================================
8. Compiling *gui-x11-compiling*
If using X11, Vim's Makefile will by default first try to find the necessary
GTK+ files on your system. If the GTK+ files cannot be found, then the Motif
files will be searched for. Finally, if this fails, the Athena files will be
searched for. If all three fail, the GUI will be disabled.
For GTK+, Vim's configuration process requires that GTK+ be properly
installed. That is, the shell script 'gtk-config' must be in your PATH, and
you can already successful compile, build, and execute a GTK+ program. The
reason for this is that the compiler flags (CFLAGS) and link flags (LDFLAGS)
are obtained through the 'gtk-config' shell script.
If you want to build with GTK+ 2 support pass the --enable-gtk2-check argument
to ./configure. Optionally, support for GNOME 2 will be compiled if the
--enable-gnome-check option is also given.
Otherwise, if you are using Motif or Athena, when you have the Motif or Athena
files in a directory where configure doesn't look, edit the Makefile to enter
the names of the directories. Search for "GUI_INC_LOC" for an example to set
the Motif directories, "CONF_OPT_X" for Athena.
*gui-x11-gtk*
At the time of this writing, GTK+ version 1.0.6 and 1.2 are outdated. It
is suggested that you use GTK 2. The GTK 1 support will most likely be
dropped soon.
For the GTK+ 2 GUI, using the latest release of the GTK+ 2.0 or GTK+ 2.2
series is recommended.
Lastly, although GTK+ has supposedly been ported to the Win32 platform, this
has not been tested with Vim and is also unsupported. Also, it's unlikely to
even compile since GTK+ GUI uses parts of the generic X11 code. This might
change in distant future; particularly because getting rid of the X11 centric
code parts is also required for GTK+ framebuffer support.
*gui-x11-motif*
For Motif, you need at least Motif version 1.2 and/or X11R5. Motif 2.0 and
X11R6 are OK. Motif 1.1 and X11R4 might work, no guarantee (there may be a
few problems, but you might make it compile and run with a bit of work, please
send me the patches if you do). The newest releases of LessTif have been
reported to work fine too.
*gui-x11-athena*
The Athena version uses the Xaw widget set by default. If you have the 3D
version, you might want to link with Xaw3d instead. This will make the
menus look a bit better. Edit the Makefile and look for "XAW_LIB". The
scrollbars will remain the same, because Vim has its own, which are already
3D (in fact, they look more like Motif).
*gui-x11-neXtaw*
The neXtaw version is mostly like Athena, but uses different widgets.
*gui-x11-misc*
In general, do not try to mix files from different GTK+, Motif, Athena and X11
versions. This will cause problems. For example, using header files for
X11R5 with a library for X11R6 probably doesn't work (although the linking
won't give an error message, Vim will crash later).
==============================================================================
9. X11 selection mechanism *x11-selection*
If using X11, in either the GUI or an xterm with an X11-aware Vim, then Vim
provides varied access to the X11 selection and clipboard. These are accessed
by using the two selection registers "* and "+.
X11 provides two basic types of global store, selections and cut-buffers,
which differ in one important aspect: selections are "owned" by an
application, and disappear when that application (e.g., Vim) exits, thus
losing the data, whereas cut-buffers, are stored within the X-server itself
and remain until written over or the X-server exits (e.g., upon logging out).
The contents of selections are held by the originating application (e.g., upon
a copy), and only passed on to another application when that other application
asks for them (e.g., upon a paste).
The contents of cut-buffers are immediately written to, and are then
accessible directly from the X-server, without contacting the originating
application.
*quoteplus* *quote+*
There are three documented X selections: PRIMARY (which is expected to
represent the current visual selection - as in Vim's Visual mode), SECONDARY
(which is ill-defined) and CLIPBOARD (which is expected to be used for
cut, copy and paste operations).
Of these three, Vim uses PRIMARY when reading and writing the "* register
(hence when the X11 selections are available, Vim sets a default value for
|'clipboard'| of "autoselect"), and CLIPBOARD when reading and writing the "+
register. Vim does not access the SECONDARY selection.
Examples: (assuming the default option values)
- Select an URL in Visual mode in Vim. Go to your browser and click the
middle mouse button in the URL text field. The selected text will be
inserted (hopefully!). Note: in Firefox you can set the
middlemouse.contentLoadURL preference to true in about:config, then the
selected URL will be used when pressing middle mouse button in most places
in the window.
- Select some text in your browser by dragging with the mouse. Go to Vim and
press the middle mouse button: The selected text is inserted.
- Select some text in Vim and do "+y. Go to your browser, select some text in
a textfield by dragging with the mouse. Now use the right mouse button and
select "Paste" from the popup menu. The selected text is overwritten by the
text from Vim.
Note that the text in the "+ register remains available when making a Visual
selection, which makes other text available in the "* register. That allows
overwriting selected text.
*x11-cut-buffer*
There are, by default, 8 cut-buffers: CUT_BUFFER0 to CUT_BUFFER7. Vim only
uses CUT_BUFFER0, which is the one that xterm uses by default.
Whenever Vim is about to become unavailable (either via exiting or becoming
suspended), and thus unable to respond to another application's selection
request, it writes the contents of any owned selection to CUT_BUFFER0. If the
"+ CLIPBOARD selection is owned by Vim, then this is written in preference,
otherwise if the "* PRIMARY selection is owned by Vim, then that is written.
Similarly, when Vim tries to paste from "* or "+ (either explicitly, or, in
the case of the "* register, when the middle mouse button is clicked), if the
requested X selection is empty or unavailable, Vim reverts to reading the
current value of the CUT_BUFFER0.
Note that when text is copied to CUT_BUFFER0 in this way, the type of
selection (character, line or block) is always lost, even if it is a Vim which
later pastes it.
Xterm, by default, always writes visible selections to both PRIMARY and
CUT_BUFFER0. When it pastes, it uses PRIMARY if this is available, or else
falls back upon CUT_BUFFER0. For this reason, when cutting and pasting
between Vim and an xterm, you should use the "* register. Xterm doesn't use
CLIPBOARD, thus the "+ doesn't work with xterm.
Most newer applications will provide their current selection via PRIMARY ("*)
and use CLIPBOARD ("+) for cut/copy/paste operations. You thus have access to
both by choosing to use either of the "* or "+ registers.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View file

@ -1,105 +0,0 @@
*hangulin.txt* For Vim version 7.4. Last change: 2009 Jun 24
VIM REFERENCE MANUAL by Chi-Deok Hwang and Sung-Hyun Nam
NOTE: The |+hangul_input| feature is scheduled to be removed. If you want to
keep it, please send a message to the Vim user maillist.
Introduction *hangul*
------------
It is to input hangul, the Korean language, with VIM GUI version.
If you have a XIM program, you can use another |+xim| feature.
Basically, it is for anybody who has no XIM program.
Compile
-------
Next is a basic option. You can add any other configure option. >
./configure --with-x --enable-multibyte --enable-fontset --enable-hangulinput
And you should check feature.h. If |+hangul_input| feature is enabled
by configure, you can select more options such as keyboard type, 2 bulsik
or 3 bulsik. You can find keywords like next in there. >
#define HANGUL_DEFAULT_KEYBOARD 2
#define ESC_CHG_TO_ENG_MODE
/* #define X_LOCALE */
/* #define SLOW_XSERVER */
Environment variables
---------------------
You should set LANG variable to Korean locale such as ko or ko_KR.euc.
If you set LC_ALL variable, it should be set to Korean locale also.
VIM resource
------------
You should add nexts to your global vimrc ($HOME/.vimrc). >
:set fileencoding=korea
Keyboard
--------
You can change keyboard type (2 bulsik or 3 bulsik) using VIM_KEYBOARD
or HANGUL_KEYBOARD_TYPE environment variables. For sh, just do (2 bulsik): >
export VIM_KEYBOARD="2"
or >
export HANGUL_KEYBOARD_TYPE="2"
If both are set, VIM_KEYBOARD has higher priority.
Hangul Fonts
------------
You can set text font using $HOME/.Xdefaults or in your gvimrc file.
But to use Hangul, you should set 'guifontset' in your vimrc.
$HOME/.Xdefaults: >
Vim.font: english_font
! Nexts are for hangul menu with Athena
*international: True
Vim*fontSet: english_font,hangul_font
! Nexts are for hangul menu with Motif
*international: True
Vim*fontList: english_font;hangul_font:
$HOME/.gvimrc: >
set guifontset=english_font,hangul_font
attention! the , (comma) or ; (semicolon)
And there should be no ':set guifont'. If it exists, then Gvim ignores
':set guifontset'. It means VIM runs without fontset supporting.
So, you can see only English. Hangul does not be correctly displayed.
After 'fontset' feature is enabled, VIM does not allow using 'font'.
For example, if you use >
:set guifontset=eng_font,your_font
in your .gvimrc, then you should do for syntax >
:hi Comment guifg=Cyan font=another_eng_font,another_your_font
If you just do >
:hi Comment font=another_eng_font
then you can see a GOOD error message. Be careful!
hangul_font width should be twice than english_font width.
Unsupported Feature
-------------------
Johab font not yet supported. And I don't have any plan.
If you really want to use johab font, you can use the
hanguldraw.c in gau package.
Hanja input not yet supported. And I don't have any plan.
If you really want to input hanja, just use VIM with hanterm.
Bug or Comment
--------------
Send comments, patches and suggestions to:
Chi-Deok Hwang <hwang@mizi.co.kr>
SungHyun Nam <goweol@gmail.com>
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,142 +0,0 @@
*hebrew.txt* For Vim version 7.4. Last change: 2007 Jun 14
VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem)
Hebrew Language support (options & mapping) for Vim *hebrew*
The supporting 'rightleft' functionality was originally created by Avner
Lottem. <alottem at gmail dot com> Ron Aaron <ron at ronware dot org> is
currently helping support these features.
{Vi does not have any of these commands}
All this is only available when the |+rightleft| feature was enabled at
compile time.
Introduction
------------
Hebrew-specific options are 'hkmap', 'hkmapp' 'keymap'=hebrew and 'aleph'.
Hebrew-useful options are 'delcombine', 'allowrevins', 'revins', 'rightleft'
and 'rightleftcmd'.
The 'rightleft' mode reverses the display order, so characters are displayed
from right to left instead of the usual left to right. This is useful
primarily when editing Hebrew or other Middle-Eastern languages.
See |rileft.txt| for further details.
Details
--------------
+ Options:
+ 'rightleft' ('rl') sets window orientation to right-to-left. This means
that the logical text 'ABC' will be displayed as 'CBA', and will start
drawing at the right edge of the window, not the left edge.
+ 'hkmap' ('hk') sets keyboard mapping to Hebrew, in insert/replace modes.
+ 'aleph' ('al'), numeric, holds the decimal code of Aleph, for keyboard
mapping.
+ 'hkmapp' ('hkp') sets keyboard mapping to 'phonetic hebrew'
NOTE: these three ('hkmap', 'hkmapp' and 'aleph') are obsolete. You should
use ":set keymap=hebrewp" instead.
+ 'delcombine' ('deco'), boolean, if editing UTF-8 encoded Hebrew, allows
one to remove the niqud or te`amim by pressing 'x' on a character (with
associated niqud).
+ 'rightleftcmd' ('rlc') makes the command-prompt for searches show up on
the right side. It only takes effect if the window is 'rightleft'.
+ Encoding:
+ Under Unix, ISO 8859-8 encoding (Hebrew letters codes: 224-250).
+ Under MS DOS, PC encoding (Hebrew letters codes: 128-154).
These are defaults, that can be overridden using the 'aleph' option.
+ You should prefer using UTF8, as it supports the combining-characters
('deco' does nothing if UTF8 encoding is not active).
+ Vim arguments:
+ 'vim -H file' starts editing a Hebrew file, i.e. 'rightleft' and 'hkmap'
are set.
+ Keyboard:
+ The 'allowrevins' option enables the CTRL-_ command in Insert mode and
in Command-line mode.
+ CTRL-_ in insert/replace modes toggles 'revins' and 'hkmap' as follows:
When in rightleft window, 'revins' and 'nohkmap' are toggled, since
English will likely be inserted in this case.
When in norightleft window, 'revins' 'hkmap' are toggled, since Hebrew
will likely be inserted in this case.
CTRL-_ moves the cursor to the end of the typed text.
+ CTRL-_ in command mode only toggles keyboard mapping (see Bugs below).
This setting is independent of 'hkmap' option, which only applies to
insert/replace mode.
Note: On some keyboards, CTRL-_ is mapped to CTRL-?.
+ Keyboard mapping while 'hkmap' is set (standard Israeli keyboard):
q w e r t y u i o p
/ ' ק ר א ט ו ן ם פ
a s d f g h j k l ; '
ש ד ג כ ע י ח ל ך ף ,
z x c v b n m , . /
ז ס ב ה נ מ צ ת ץ .
This is also the keymap when 'keymap=hebrew' is set. The advantage of
'keymap' is that it works properly when using UTF8, e.g. it inserts the
correct characters; 'hkmap' does not. The 'keymap' keyboard can also
insert niqud and te`amim. To see what those mappings are, look at the
keymap file 'hebrew.vim' etc.
Typing backwards
If the 'revins' (reverse insert) option is set, inserting happens backwards.
This can be used to type Hebrew. When inserting characters the cursor is not
moved and the text moves rightwards. A <BS> deletes the character under the
cursor. CTRL-W and CTRL-U also work in the opposite direction. <BS>, CTRL-W
and CTRL-U do not stop at the start of insert or end of line, no matter how
the 'backspace' option is set.
There is no reverse replace mode (yet).
If the 'showmode' option is set, "-- REVERSE INSERT --" will be shown in the
status line when reverse Insert mode is active.
When the 'allowrevins' option is set, reverse Insert mode can be also entered
via CTRL-_, which has some extra functionality: First, keyboard mapping is
changed according to the window orientation -- if in a left-to-right window,
'revins' is used to enter Hebrew text, so the keyboard changes to Hebrew
('hkmap' is set); if in a right-to-left window, 'revins' is used to enter
English text, so the keyboard changes to English ('hkmap' is reset). Second,
when exiting 'revins' via CTRL-_, the cursor moves to the end of the typed
text (if possible).
Pasting when in a rightleft window
----------------------------------
When cutting text with the mouse and pasting it in a rightleft window
the text will be reversed, because the characters come from the cut buffer
from the left to the right, while inserted in the file from the right to
the left. In order to avoid it, toggle 'revins' (by typing CTRL-? or CTRL-_)
before pasting.
Hebrew characters and the 'isprint' variable
--------------------------------------------
Sometimes Hebrew character codes are in the non-printable range defined by
the 'isprint' variable. For example in the Linux console, the Hebrew font
encoding starts from 128, while the default 'isprint' variable is @,161-255.
The result is that all Hebrew characters are displayed as ~x. To solve this
problem, set isprint=@,128-255.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,221 +0,0 @@
*help.txt* For Vim version 7.4. Last change: 2012 Dec 06
VIM - main help file
k
Move around: Use the cursor keys, or "h" to go left, h l
"j" to go down, "k" to go up, "l" to go right. j
Close this window: Use ":q<Enter>".
Get out of Vim: Use ":qa!<Enter>" (careful, all changes are lost!).
Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-].
With the mouse: ":set mouse=a" to enable the mouse (in xterm or GUI).
Double-click the left mouse button on a tag, e.g. |bars|.
Jump back: Type CTRL-T or CTRL-O (repeat to go further back).
Get specific help: It is possible to go directly to whatever you want help
on, by giving an argument to the |:help| command.
It is possible to further specify the context:
*help-context*
WHAT PREPEND EXAMPLE ~
Normal mode command (nothing) :help x
Visual mode command v_ :help v_u
Insert mode command i_ :help i_<Esc>
Command-line command : :help :quit
Command-line editing c_ :help c_<Del>
Vim command argument - :help -r
Option ' :help 'textwidth'
Search for help: Type ":help word", then hit CTRL-D to see matching
help entries for "word".
Or use ":helpgrep word". |:helpgrep|
VIM stands for Vi IMproved. Most of VIM was made by Bram Moolenaar, but only
through the help of many others. See |credits|.
------------------------------------------------------------------------------
*doc-file-list* *Q_ct*
BASIC:
|quickref| Overview of the most common commands you will use
|tutor| 30 minutes training course for beginners
|copying| About copyrights
|iccf| Helping poor children in Uganda
|sponsor| Sponsor Vim development, become a registered Vim user
|www| Vim on the World Wide Web
|bugs| Where to send bug reports
USER MANUAL: These files explain how to accomplish an editing task.
|usr_toc.txt| Table Of Contents
Getting Started ~
|usr_01.txt| About the manuals
|usr_02.txt| The first steps in Vim
|usr_03.txt| Moving around
|usr_04.txt| Making small changes
|usr_05.txt| Set your settings
|usr_06.txt| Using syntax highlighting
|usr_07.txt| Editing more than one file
|usr_08.txt| Splitting windows
|usr_09.txt| Using the GUI
|usr_10.txt| Making big changes
|usr_11.txt| Recovering from a crash
|usr_12.txt| Clever tricks
Editing Effectively ~
|usr_20.txt| Typing command-line commands quickly
|usr_21.txt| Go away and come back
|usr_22.txt| Finding the file to edit
|usr_23.txt| Editing other files
|usr_24.txt| Inserting quickly
|usr_25.txt| Editing formatted text
|usr_26.txt| Repeating
|usr_27.txt| Search commands and patterns
|usr_28.txt| Folding
|usr_29.txt| Moving through programs
|usr_30.txt| Editing programs
|usr_31.txt| Exploiting the GUI
|usr_32.txt| The undo tree
Tuning Vim ~
|usr_40.txt| Make new commands
|usr_41.txt| Write a Vim script
|usr_42.txt| Add new menus
|usr_43.txt| Using filetypes
|usr_44.txt| Your own syntax highlighted
|usr_45.txt| Select your language
Making Vim Run ~
|usr_90.txt| Installing Vim
REFERENCE MANUAL: These files explain every detail of Vim. *reference_toc*
General subjects ~
|intro.txt| general introduction to Vim; notation used in help files
|help.txt| overview and quick reference (this file)
|helphelp.txt| about using the help files
|index.txt| alphabetical index of all commands
|help-tags| all the tags you can jump to (index of tags)
|howto.txt| how to do the most common editing tasks
|tips.txt| various tips on using Vim
|message.txt| (error) messages and explanations
|quotes.txt| remarks from users of Vim
|todo.txt| known problems and desired extensions
|develop.txt| development of Vim
|debug.txt| debugging Vim itself
|uganda.txt| Vim distribution conditions and what to do with your money
Basic editing ~
|starting.txt| starting Vim, Vim command arguments, initialisation
|editing.txt| editing and writing files
|motion.txt| commands for moving around
|scroll.txt| scrolling the text in the window
|insert.txt| Insert and Replace mode
|change.txt| deleting and replacing text
|indent.txt| automatic indenting for C and other languages
|undo.txt| Undo and Redo
|repeat.txt| repeating commands, Vim scripts and debugging
|visual.txt| using the Visual mode (selecting a text area)
|various.txt| various remaining commands
|recover.txt| recovering from a crash
Advanced editing ~
|cmdline.txt| Command-line editing
|options.txt| description of all options
|pattern.txt| regexp patterns and search commands
|map.txt| key mapping and abbreviations
|tagsrch.txt| tags and special searches
|quickfix.txt| commands for a quick edit-compile-fix cycle
|windows.txt| commands for using multiple windows and buffers
|tabpage.txt| commands for using multiple tab pages
|syntax.txt| syntax highlighting
|spell.txt| spell checking
|diff.txt| working with two to four versions of the same file
|autocmd.txt| automatically executing commands on an event
|filetype.txt| settings done specifically for a type of file
|eval.txt| expression evaluation, conditional commands
|fold.txt| hide (fold) ranges of lines
Special issues ~
|print.txt| printing
|remote.txt| using Vim as a server or client
|term.txt| using different terminals and mice
|digraph.txt| list of available digraphs
|mbyte.txt| multi-byte text support
|mlang.txt| non-English language support
|arabic.txt| Arabic language support and editing
|farsi.txt| Farsi (Persian) editing
|hebrew.txt| Hebrew language support and editing
|russian.txt| Russian language support and editing
|ft_ada.txt| Ada (the programming language) support
|ft_sql.txt| about the SQL filetype plugin
|hangulin.txt| Hangul (Korean) input mode
|rileft.txt| right-to-left editing mode
GUI ~
|gui.txt| Graphical User Interface (GUI)
|gui_w16.txt| Windows 3.1 GUI
|gui_w32.txt| Win32 GUI
|gui_x11.txt| X11 GUI
Interfaces ~
|if_cscop.txt| using Cscope with Vim
|if_lua.txt| Lua interface
|if_mzsch.txt| MzScheme interface
|if_perl.txt| Perl interface
|if_pyth.txt| Python interface
|if_sniff.txt| SNiFF+ interface
|if_tcl.txt| Tcl interface
|if_ole.txt| OLE automation interface for Win32
|if_ruby.txt| Ruby interface
|debugger.txt| Interface with a debugger
|workshop.txt| Sun Visual Workshop interface
|netbeans.txt| NetBeans External Editor interface
|sign.txt| debugging signs
Versions ~
|vi_diff.txt| Main differences between Vim and Vi
|version4.txt| Differences between Vim version 3.0 and 4.x
|version5.txt| Differences between Vim version 4.6 and 5.x
|version6.txt| Differences between Vim version 5.7 and 6.x
|version7.txt| Differences between Vim version 6.4 and 7.x
*sys-file-list*
Remarks about specific systems ~
|os_390.txt| OS/390 Unix
|os_amiga.txt| Amiga
|os_beos.txt| BeOS and BeBox
|os_dos.txt| MS-DOS and MS-Windows NT/95 common items
|os_mac.txt| Macintosh
|os_mint.txt| Atari MiNT
|os_msdos.txt| MS-DOS (plain DOS and DOS box under Windows)
|os_os2.txt| OS/2
|os_qnx.txt| QNX
|os_risc.txt| RISC-OS
|os_unix.txt| Unix
|os_vms.txt| VMS
|os_win32.txt| MS-Windows 95/98/NT
*standard-plugin-list*
Standard plugins ~
|pi_getscript.txt| Downloading latest version of Vim scripts
|pi_gzip.txt| Reading and writing compressed files
|pi_netrw.txt| Reading and writing files over a network
|pi_paren.txt| Highlight matching parens
|pi_tar.txt| Tar file explorer
|pi_vimball.txt| Create a self-installing Vim script
|pi_zip.txt| Zip archive explorer
LOCAL ADDITIONS: *local-additions*
------------------------------------------------------------------------------
*bars* Bars example
Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.
Note that tags are within | characters, but when highlighting is enabled these
characters are hidden. That makes it easier to read a command.
Anyway, you can use CTRL-] on any word, also when it is not within |, and Vim
will try to find help for it. Especially for options in single quotes, e.g.
'compatible'.
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:

View file

@ -1,351 +0,0 @@
*helphelp.txt* For Vim version 7.4. Last change: 2012 Nov 28
VIM REFERENCE MANUAL by Bram Moolenaar
Help on help files *helphelp*
1. Help commands |online-help|
2. Translated help files |help-translated|
3. Writing help files |help-writing|
==============================================================================
1. Help commands *online-help*
*help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
<Help> or
:h[elp] Open a window and display the help file in read-only
mode. If there is a help window open already, use
that one. Otherwise, if the current window uses the
full width of the screen or is at least 80 characters
wide, the help window will appear just above the
current window. Otherwise the new window is put at
the very top.
The 'helplang' option is used to select a language, if
the main help file is available in several languages.
{not in Vi}
*{subject}* *E149* *E661*
:h[elp] {subject} Like ":help", additionally jump to the tag {subject}.
{subject} can include wildcards like "*", "?" and
"[a-z]":
:help z? jump to help for any "z" command
:help z. jump to the help for "z."
If there is no full match for the pattern, or there
are several matches, the "best" match will be used.
A sophisticated algorithm is used to decide which
match is better than another one. These items are
considered in the computation:
- A match with same case is much better than a match
with different case.
- A match that starts after a non-alphanumeric
character is better than a match in the middle of a
word.
- A match at or near the beginning of the tag is
better than a match further on.
- The more alphanumeric characters match, the better.
- The shorter the length of the match, the better.
The 'helplang' option is used to select a language, if
the {subject} is available in several languages.
To find a tag in a specific language, append "@ab",
where "ab" is the two-letter language code. See
|help-translated|.
Note that the longer the {subject} you give, the less
matches will be found. You can get an idea how this
all works by using commandline completion (type CTRL-D
after ":help subject" |c_CTRL-D|).
If there are several matches, you can have them listed
by hitting CTRL-D. Example: >
:help cont<Ctrl-D>
< Instead of typing ":help CTRL-V" to search for help
for CTRL-V you can type: >
:help ^V
< This also works together with other characters, for
example to find help for CTRL-V in Insert mode: >
:help i^V
<
To use a regexp |pattern|, first do ":help" and then
use ":tag {pattern}" in the help window. The
":tnext" command can then be used to jump to other
matches, "tselect" to list matches and choose one. >
:help index| :tse z.
< When there is no argument you will see matches for
"help", to avoid listing all possible matches (that
would be very slow).
The number of matches displayed is limited to 300.
This command can be followed by '|' and another
command, but you don't need to escape the '|' inside a
help command. So these both work: >
:help |
:help k| only
< Note that a space before the '|' is seen as part of
the ":help" argument.
You can also use <LF> or <CR> to separate the help
command from a following command. You need to type
CTRL-V first to insert the <LF> or <CR>. Example: >
:help so<C-V><CR>only
< {not in Vi}
:h[elp]! [subject] Like ":help", but in non-English help files prefer to
find a tag in a file with the same language as the
current file. See |help-translated|.
*:helpg* *:helpgrep*
:helpg[rep] {pattern}[@xx]
Search all help text files and make a list of lines
in which {pattern} matches. Jumps to the first match.
The optional [@xx] specifies that only matches in the
"xx" language are to be found.
You can navigate through the matches with the
|quickfix| commands, e.g., |:cnext| to jump to the
next one. Or use |:cwindow| to get the list of
matches in the quickfix window.
{pattern} is used as a Vim regexp |pattern|.
'ignorecase' is not used, add "\c" to ignore case.
Example for case sensitive search: >
:helpgrep Uganda
< Example for case ignoring search: >
:helpgrep uganda\c
< Example for searching in French help: >
:helpgrep backspace@fr
< The pattern does not support line breaks, it must
match within one line. You can use |:grep| instead,
but then you need to get the list of help files in a
complicated way.
Cannot be followed by another command, everything is
used as part of the pattern. But you can use
|:execute| when needed.
Compressed help files will not be searched (Fedora
compresses the help files).
{not in Vi}
*:lh* *:lhelpgrep*
:lh[elpgrep] {pattern}[@xx]
Same as ":helpgrep", except the location list is used
instead of the quickfix list. If the help window is
already opened, then the location list for that window
is used. Otherwise, a new help window is opened and
the location list for that window is set. The
location list for the current window is not changed.
*:exu* *:exusage*
:exu[sage] Show help on Ex commands. Added to simulate the Nvi
command. {not in Vi}
*:viu* *:viusage*
:viu[sage] Show help on Normal mode commands. Added to simulate
the Nvi command. {not in Vi}
When no argument is given to |:help| the file given with the 'helpfile' option
will be opened. Otherwise the specified tag is searched for in all "doc/tags"
files in the directories specified in the 'runtimepath' option.
The initial height of the help window can be set with the 'helpheight' option
(default 20).
Jump to specific subjects by using tags. This can be done in two ways:
- Use the "CTRL-]" command while standing on the name of a command or option.
This only works when the tag is a keyword. "<C-Leftmouse>" and
"g<LeftMouse>" work just like "CTRL-]".
- use the ":ta {subject}" command. This also works with non-keyword
characters.
Use CTRL-T or CTRL-O to jump back.
Use ":q" to close the help window.
If there are several matches for an item you are looking for, this is how you
can jump to each one of them:
1. Open a help window
2. Use the ":tag" command with a slash prepended to the tag. E.g.: >
:tag /min
3. Use ":tnext" to jump to the next matching tag.
It is possible to add help files for plugins and other items. You don't need
to change the distributed help files for that. See |add-local-help|.
To write a local help file, see |write-local-help|.
Note that the title lines from the local help files are automagically added to
the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
This is done when viewing the file in Vim, the file itself is not changed. It
is done by going through all help files and obtaining the first line of each
file. The files in $VIMRUNTIME/doc are skipped.
*help-xterm-window*
If you want to have the help in another xterm window, you could use this
command: >
:!xterm -e vim +help &
<
*:helpfind* *:helpf*
:helpf[ind] Like |:help|, but use a dialog to enter the argument.
Only for backwards compatibility. It now executes the
ToolBar.FindHelp menu entry instead of using a builtin
dialog. {only when compiled with |+GUI_GTK|}
{not in Vi}
*:helpt* *:helptags*
*E154* *E150* *E151* *E152* *E153* *E670*
:helpt[ags] [++t] {dir}
Generate the help tags file(s) for directory {dir}.
All "*.txt" and "*.??x" files in the directory and
sub-directories are scanned for a help tag definition
in between stars. The "*.??x" files are for
translated docs, they generate the "tags-??" file, see
|help-translated|. The generated tags files are
sorted.
When there are duplicates an error message is given.
An existing tags file is silently overwritten.
The optional "++t" argument forces adding the
"help-tags" tag. This is also done when the {dir} is
equal to $VIMRUNTIME/doc.
To rebuild the help tags in the runtime directory
(requires write permission there): >
:helptags $VIMRUNTIME/doc
< {not in Vi}
==============================================================================
2. Translated help files *help-translated*
It is possible to add translated help files, next to the original English help
files. Vim will search for all help in "doc" directories in 'runtimepath'.
This is only available when compiled with the |+multi_lang| feature.
At this moment translations are available for:
Chinese - multiple authors
French - translated by David Blanchet
Italian - translated by Antonio Colombo
Japanese - multiple authors
Polish - translated by Mikolaj Machowski
Russian - translated by Vassily Ragosin
See the Vim website to find them: http://www.vim.org/translations.php
A set of translated help files consists of these files:
help.abx
howto.abx
...
tags-ab
"ab" is the two-letter language code. Thus for Italian the names are:
help.itx
howto.itx
...
tags-it
The 'helplang' option can be set to the preferred language(s). The default is
set according to the environment. Vim will first try to find a matching tag
in the preferred language(s). English is used when it cannot be found.
To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
two-letter language code. Example: >
:he user-manual@it
:he user-manual@en
The first one finds the Italian user manual, even when 'helplang' is empty.
The second one finds the English user manual, even when 'helplang' is set to
"it".
When using command-line completion for the ":help" command, the "@en"
extension is only shown when a tag exists for multiple languages. When the
tag only exists for English "@en" is omitted.
When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
find the tag in the same language. If not found then 'helplang' will be used
to select a language.
Help files must use latin1 or utf-8 encoding. Vim assumes the encoding is
utf-8 when finding non-ASCII characters in the first line. Thus you must
translate the header with "For Vim version".
The same encoding must be used for the help files of one language in one
directory. You can use a different encoding for different languages and use
a different encoding for help files of the same language but in a different
directory.
Hints for translators:
- Do not translate the tags. This makes it possible to use 'helplang' to
specify the preferred language. You may add new tags in your language.
- When you do not translate a part of a file, add tags to the English version,
using the "tag@en" notation.
- Make a package with all the files and the tags file available for download.
Users can drop it in one of the "doc" directories and start use it.
Report this to Bram, so that he can add a link on www.vim.org.
- Use the |:helptags| command to generate the tags files. It will find all
languages in the specified directory.
==============================================================================
3. Writing help files *help-writing*
For ease of use, a Vim help file for a plugin should follow the format of the
standard Vim help files. If you are writing a new help file it's best to copy
one of the existing files and use it as a template.
The first line in a help file should have the following format:
*helpfile_name.txt* For Vim version 7.3 Last change: 2010 June 4
The first field is a link to the help file name. The second field describes
the applicable Vim version. The last field specifies the last modification
date of the file. Each field is separated by a tab.
At the bottom of the help file, place a Vim modeline to set the 'textwidth'
and 'tabstop' options and the 'filetype' to 'help'. Never set a global option
in such a modeline, that can have consequences undesired by whoever reads that
help.
TAGS
To define a help tag, place the name between asterisks (*tag-name*). The
tag-name should be different from all the Vim help tag names and ideally
should begin with the name of the Vim plugin. The tag name is usually right
aligned on a line.
When referring to an existing help tag and to create a hot-link, place the
name between two bars (|) eg. |help-writing|.
When referring to a Vim option in the help file, place the option name between
two single quotes, eg. 'statusline'
HIGHLIGHTING
To define a column heading, use a tilde character at the end of the line.
This will highlight the column heading in a different color. E.g.
Column heading~
To separate sections in a help file, place a series of '=' characters in a
line starting from the first column. The section separator line is highlighted
differently.
To quote a block of ex-commands verbatim, place a greater than (>) character
at the end of the line before the block and a less than (<) character as the
first non-blank on a line following the block. Any line starting in column 1
also implicitly stops the block of ex-commands before it. E.g. >
function Example_Func()
echo "Example"
endfunction
<
The following are highlighted differently in a Vim help file:
- a special key name expressed either in <> notation as in <PageDown>, or
as a Ctrl character as in CTRL-X
- anything between {braces}, e.g. {lhs} and {rhs}
The word "Note", "Notes" and similar automagically receive distinctive
highlighting. So do these:
*Todo something to do
*Error something wrong
You can find the details in $VIMRUNTIME/syntax/help.vim
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,96 +0,0 @@
*howto.txt* For Vim version 7.4. Last change: 2006 Apr 02
VIM REFERENCE MANUAL by Bram Moolenaar
How to ... *howdoi* *how-do-i* *howto* *how-to*
|tutor| get started
|:quit| exit? I'm trapped, help me!
|initialization| initialize Vim
|vimrc-intro| write a Vim script file (vimrc)
|suspend| suspend Vim
|usr_11.txt| recover after a crash
|07.4| keep a backup of my file when writing over it
|usr_07.txt| edit files
|23.4| edit binary files
|usr_24.txt| insert text
|deleting| delete text
|usr_04.txt| change text
|04.5| copy and move text
|usr_25.txt| format text
|30.6| format comments
|30.2| indent C programs
|25.3| automatically set indent
|usr_26.txt| repeat commands
|02.5| undo and redo
|usr_03.txt| move around
|word-motions| word motions
|left-right-motions| left-right motions
|up-down-motions| up-down motions
|object-motions| text-object motions
|various-motions| various motions
|object-select| text-object selection
|'whichwrap'| move over line breaks
|'virtualedit'| move to where there is no text
|usr_27.txt| specify pattern for searches
|tags-and-searches| do tags and special searches
|29.4| search in include'd files used to find
variables, functions, or macros
|K| look up manual for the keyword under cursor
|03.7| scroll
|'sidescroll'| scroll horizontally/sideways
|'scrolloff'| set visible context lines
|mode-switching| change modes
|04.4| use Visual mode
|'insertmode'| start Vim in Insert mode
|40.1| map keys
|24.7| create abbreviations
|ins-expandtab| expand a tab to spaces in Insert mode
|i_CTRL-R| insert contents of a register in Insert mode
|24.3| complete words in Insert mode
|25.1| break a line before it gets too long
|20.1| do command-line editing
|20.3| do command-line completion
|'cmdheight'| increase the height of command-line
|10.3| specify command-line ranges
|40.3| specify commands to be executed automatically
before/after reading/writing entering/leaving a
buffer/window
|'autowrite'| write automatically
|30.1| speedup edit-compile-edit cycle or compile and fix
errors within Vim
|options| set options
|auto-setting| set options automatically
|term-dependent-settings| set options depending on terminal name
|save-settings| save settings
|:quote| comment my .vim files
|'helpheight'| change the default help height
|'highlight'| set various highlighting modes
|'title'| set the window title
|'icon'| set window icon title
|'report'| avoid seeing the change messages on every line
|'shortmess'| avoid |hit-enter| prompts
|mouse-using| use mouse with Vim
|usr_08.txt| manage multiple windows and buffers
|gui.txt| use the gui
|You can't! (yet)| do dishes using Vim
|usr_06.txt| switch on syntax highlighting
|2html.vim| convert a colored file to HTML
|less| use Vim like less or more with syntax highlighting
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,499 +0,0 @@
*if_cscop.txt* For Vim version 7.4. Last change: 2011 Jun 12
VIM REFERENCE MANUAL by Andy Kahn
*cscope* *Cscope*
This document explains how to use Vim's cscope interface.
Cscope is a tool like ctags, but think of it as ctags on steroids since it
does a lot more than what ctags provides. In Vim, jumping to a result from
a cscope query is just like jumping to any tag; it is saved on the tag stack
so that with the right keyboard mappings, you can jump back and forth between
functions as you normally would with |tags|.
1. Cscope introduction |cscope-intro|
2. Cscope related commands |cscope-commands|
3. Cscope options |cscope-options|
4. How to use cscope in Vim |cscope-howtouse|
5. Limitations |cscope-limitations|
6. Suggested usage |cscope-suggestions|
7. Availability & Information |cscope-info|
This is currently for Unix and Win32 only.
{Vi does not have any of these commands}
==============================================================================
1. Cscope introduction *cscope-intro*
The following text is taken from a version of the cscope man page:
-----
Cscope is an interactive screen-oriented tool that helps you:
Learn how a C program works without endless flipping through a thick
listing.
Locate the section of code to change to fix a bug without having to
learn the entire program.
Examine the effect of a proposed change such as adding a value to an
enum variable.
Verify that a change has been made in all source files such as adding
an argument to an existing function.
Rename a global variable in all source files.
Change a constant to a preprocessor symbol in selected lines of files.
It is designed to answer questions like:
Where is this symbol used?
Where is it defined?
Where did this variable get its value?
What is this global symbol's definition?
Where is this function in the source files?
What functions call this function?
What functions are called by this function?
Where does the message "out of space" come from?
Where is this source file in the directory structure?
What files include this header file?
Cscope answers these questions from a symbol database that it builds the
first time it is used on the source files. On a subsequent call, cscope
rebuilds the database only if a source file has changed or the list of
source files is different. When the database is rebuilt the data for the
unchanged files is copied from the old database, which makes rebuilding
much faster than the initial build.
-----
When cscope is normally invoked, you will get a full-screen selection
screen allowing you to make a query for one of the above questions.
However, once a match is found to your query and you have entered your
text editor to edit the source file containing match, you cannot simply
jump from tag to tag as you normally would with vi's Ctrl-] or :tag
command.
Vim's cscope interface is done by invoking cscope with its line-oriented
interface, and then parsing the output returned from a query. The end
result is that cscope query results become just like regular tags, so
you can jump to them just like you do with normal tags (Ctrl-] or :tag)
and then go back by popping off the tagstack with Ctrl-T. (Please note
however, that you don't actually jump to a cscope tag simply by doing
Ctrl-] or :tag without remapping these commands or setting an option.
See the remaining sections on how the cscope interface works and for
suggested use.)
==============================================================================
2. Cscope related commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
All cscope commands are accessed through suboptions to the main cscope
command ":cscope". The shortest abbreviation is ":cs". The ":scscope"
command does the same and also splits the window (short: "scs").
The available subcommands are:
*E563* *E564* *E566* *E568* *E569* *E622* *E623*
*E625* *E626* *E609*
add : Add a new cscope database/connection.
USAGE :cs add {file|dir} [pre-path] [flags]
[pre-path] is the pathname used with the -P command to cscope.
[flags] are any additional flags you want to pass to cscope.
EXAMPLES >
:cscope add /usr/local/cdb/cscope.out
:cscope add /projects/vim/cscope.out /usr/local/vim
:cscope add cscope.out /usr/local/vim -C
<
*cscope-find* *cs-find* *E567*
find : Query cscope. All cscope query options are available
except option #5 ("Change this grep pattern").
USAGE :cs find {querytype} {name}
{querytype} corresponds to the actual cscope line
interface numbers as well as default nvi commands:
0 or s: Find this C symbol
1 or g: Find this definition
2 or d: Find functions called by this function
3 or c: Find functions calling this function
4 or t: Find this text string
6 or e: Find this egrep pattern
7 or f: Find this file
8 or i: Find files #including this file
For all types, except 4 and 6, leading white space for {name} is
removed. For 4 and 6 there is exactly one space between {querytype}
and {name}. Further white space is included in {name}.
EXAMPLES >
:cscope find c vim_free
:cscope find 3 vim_free
<
These two examples perform the same query: functions calling
"vim_free". >
:cscope find t initOnce
:cscope find t initOnce
<
The first one searches for the text "initOnce", the second one for
" initOnce". >
:cscope find 0 DEFAULT_TERM
<
Executing this example on the source code for Vim 5.1 produces the
following output:
Cscope tag: DEFAULT_TERM
# line filename / context / line
1 1009 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"amiga"
2 1013 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"win32"
3 1017 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"pcterm"
4 1021 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
5 1025 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"vt52"
6 1029 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"os2ansi"
7 1033 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
8 1037 vim-5.1-gtk/src/term.c <<GLOBAL>>
# undef DEFAULT_TERM
9 1038 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"beos-ansi"
10 1042 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"mac-ansi"
11 1335 vim-5.1-gtk/src/term.c <<set_termname>>
term = DEFAULT_TERM;
12 1459 vim-5.1-gtk/src/term.c <<set_termname>>
if (STRCMP(term, DEFAULT_TERM))
13 1826 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
14 1833 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
15 3635 vim-5.1-gtk/src/term.c <<update_tcap>>
p = find_builtin_term(DEFAULT_TERM);
Enter nr of choice (<CR> to abort):
The output shows several pieces of information:
1. The tag number (there are 15 in this example).
2. The line number where the tag occurs.
3. The filename where the tag occurs.
4. The context of the tag (e.g., global, or the function name).
5. The line from the file itself.
help : Show a brief synopsis.
USAGE :cs help
*E261*
kill : Kill a cscope connection (or kill all cscope connections).
USAGE :cs kill {num|partial_name}
To kill a cscope connection, the connection number or a partial
name must be specified. The partial name is simply any part of
the pathname of the cscope database. Kill a cscope connection
using the partial name with caution!
If the specified connection number is -1, then _ALL_ cscope
connections will be killed.
reset : Reinit all cscope connections.
USAGE :cs reset
show : Show cscope connections.
USAGE :cs show
*:lcscope* *:lcs*
This command is same as the ":cscope" command, except when the
'cscopequickfix' option is set, the location list for the current window is
used instead of the quickfix list to show the cscope results.
*:cstag* *E257* *E562*
If you use cscope as well as ctags, |:cstag| allows you to search one or
the other before making a jump. For example, you can choose to first
search your cscope database(s) for a match, and if one is not found, then
your tags file(s) will be searched. The order in which this happens
is determined by the value of |csto|. See |cscope-options| for more
details.
|:cstag| performs the equivalent of ":cs find g" on the identifier when
searching through the cscope database(s).
|:cstag| performs the equivalent of |:tjump| on the identifier when searching
through your tags file(s).
==============================================================================
3. Cscope options *cscope-options*
Use the |:set| command to set all cscope options. Ideally, you would do
this in one of your startup files (e.g., .vimrc). Some cscope related
variables are only valid within |.vimrc|. Setting them after vim has
started will have no effect!
*cscopeprg* *csprg*
'cscopeprg' specifies the command to execute cscope. The default is
"cscope". For example: >
:set csprg=/usr/local/bin/cscope
<
*cscopequickfix* *csqf* *E469*
{not available when compiled without the |+quickfix| feature}
'cscopequickfix' specifies whether to use quickfix window to show cscope
results. This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0).
'+' indicates that results must be appended to quickfix window,
'-' implies previous results clearance, '0' or command absence - don't use
quickfix. Search is performed from start until first command occurrence.
The default value is "" (don't use quickfix anyway). The following value
seems to be useful: >
:set cscopequickfix=s-,c-,d-,i-,t-,e-
<
*cscopetag* *cst*
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t"
will always use |:cstag| instead of the default :tag behavior. Effectively,
by setting 'cst', you will always search your cscope databases as well as
your tag files. The default is off. Examples: >
:set cst
:set nocst
<
*cscoperelative* *csre*
If 'cscoperelative' is set, then in absence of a prefix given to cscope
(prefix is the argument of -P option of cscope), basename of cscope.out
location (usually the project root directory) will be used as the prefix
to construct an absolute path. The default is off. Note: This option is
only effective when cscope (cscopeprg) is initialized without a prefix
path (-P). Examples: >
:set csre
:set nocsre
<
*cscopetagorder* *csto*
The value of 'csto' determines the order in which |:cstag| performs a search.
If 'csto' is set to zero, cscope database(s) are searched first, followed
by tag file(s) if cscope did not return any matches. If 'csto' is set to
one, tag file(s) are searched before cscope database(s). The default is zero.
Examples: >
:set csto=0
:set csto=1
<
*cscopeverbose* *csverb*
If 'cscopeverbose' is not set (the default), messages will not be printed
indicating success or failure when adding a cscope database. Ideally, you
should reset this option in your |.vimrc| before adding any cscope databases,
and after adding them, set it. From then on, when you add more databases
within Vim, you will get a (hopefully) useful message should the database fail
to be added. Examples: >
:set csverb
:set nocsverb
<
*cscopepathcomp* *cspc*
The value of 'cspc' determines how many components of a file's path to
display. With the default value of zero the entire path will be displayed.
The value one will display only the filename with no path. Other values
display that many components. For example: >
:set cspc=3
will display the last 3 components of the file's path, including the file
name itself.
==============================================================================
4. How to use cscope in Vim *cscope-howtouse*
The first thing you need to do is to build a cscope database for your
source files. For the most basic case, simply do "cscope -b". Please
refer to the cscope man page for more details.
Assuming you have a cscope database, you need to "add" the database to Vim.
This establishes a cscope "connection" and makes it available for Vim to use.
You can do this in your .vimrc file, or you can do it manually after starting
vim. For example, to add the cscope database "cscope.out", you would do:
:cs add cscope.out
You can double-check the result of this by executing ":cs show". This will
produce output which looks like this:
# pid database name prepend path
0 28806 cscope.out <none>
Note:
Because of the Microsoft RTL limitations, Win32 version shows 0 instead
of the real pid.
Once a cscope connection is established, you can make queries to cscope and
the results will be printed to you. Queries are made using the command
":cs find". For example:
:cs find g ALIGN_SIZE
This can get a little cumbersome since one ends up doing a significant
amount of typing. Fortunately, there are ways around this by mapping
shortcut keys. See |cscope-suggestions| for suggested usage.
If the results return only one match, you will automatically be taken to it.
If there is more than one match, you will be given a selection screen to pick
the match you want to go to. After you have jumped to the new location,
simply hit Ctrl-T to get back to the previous one.
==============================================================================
5. Limitations *cscope-limitations*
Cscope support for Vim is only available on systems that support these four
system calls: fork(), pipe(), execl(), waitpid(). This means it is mostly
limited to Unix systems.
Additionally Cscope support works for Win32. For more information and a
cscope version for Win32 see:
http://iamphet.nm.ru/cscope/index.html
The DJGPP-built version from http://cscope.sourceforge.net is known to not
work with Vim.
Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files
is not configurable (e.g., you can't do a tselect instead).
==============================================================================
6. Suggested usage *cscope-suggestions*
Put these entries in your .vimrc (adjust the pathname accordingly to your
setup): >
if has("cscope")
set csprg=/usr/local/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
By setting 'cscopetag', we have effectively replaced all instances of the :tag
command with :cstag. This includes :tag, Ctrl-], and "vim -t". In doing
this, the regular tag command not only searches your ctags generated tag
files, but your cscope databases as well.
Some users may want to keep the regular tag behavior and have a different
shortcut to access :cstag. For example, one could map Ctrl-_ (underscore)
to :cstag with the following command: >
map <C-_> :cstag <C-R>=expand("<cword>")<CR><CR>
A couple of very commonly used cscope queries (using ":cs find") is to
find all functions calling a certain function and to find all occurrences
of a particular C symbol. To do this, you can use these mappings as an
example: >
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
These mappings for Ctrl-] (right bracket) and Ctrl-\ (backslash) allow you to
place your cursor over the function name or C symbol and quickly query cscope
for any matches.
Or you may use the following scheme, inspired by Vim/Cscope tutorial from
Cscope Home Page (http://cscope.sourceforge.net/): >
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.
nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
nmap <C-Space><C-Space>s
\:vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>g
\:vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>c
\:vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>t
\:vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>e
\:vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>i
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
==============================================================================
7. Cscope availability and information *cscope-info*
If you do not already have cscope (it did not come with your compiler
license or OS distribution), then you can download it for free from:
http://cscope.sourceforge.net/
This is released by SCO under the BSD license.
If you want a newer version of cscope, you will probably have to buy it.
According to the (old) nvi documentation:
You can buy version 13.3 source with an unrestricted license
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope
which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL)
from World-Wide Exptools Open Source packages page:
http://www.bell-labs.com/project/wwexptools/packages.html
In Solaris 2.x, if you have the C compiler license, you will also have
cscope. Both are usually located under /opt/SUNWspro/bin
SGI developers can also get it. Search for Cscope on this page:
http://freeware.sgi.com/index-by-alpha.html
https://toolbox.sgi.com/toolbox/utilities/cscope/
The second one is for those who have a password for the SGI toolbox.
There is source to an older version of a cscope clone (called "cs") available
on the net. Due to various reasons, this is not supported with Vim.
The cscope interface/support for Vim was originally written by
Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny
bit of code) was adapted from the cscope interface in nvi. Please report
any problems, suggestions, patches, et al., you have for the usage of
cscope within Vim to him.
*cscope-win32*
For a cscope version for Win32 see:
http://code.google.com/p/cscope-win32/
Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact
him if you have Win32-specific issues.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,403 +0,0 @@
*if_lua.txt* For Vim version 7.4. Last change: 2012 Jun 29
VIM REFERENCE MANUAL by Luis Carvalho
The Lua Interface to Vim *lua* *Lua*
1. Commands |lua-commands|
2. The vim module |lua-vim|
3. List userdata |lua-list|
4. Dict userdata |lua-dict|
5. Funcref userdata |lua-funcref|
6. Buffer userdata |lua-buffer|
7. Window userdata |lua-window|
8. The luaeval function |lua-luaeval|
{Vi does not have any of these commands}
The Lua interface is available only when Vim was compiled with the
|+lua| feature.
==============================================================================
1. Commands *lua-commands*
*:lua*
:[range]lua {chunk}
Execute Lua chunk {chunk}. {not in Vi}
Examples:
>
:lua print("Hello, Vim!")
:lua local curbuf = vim.buffer() curbuf[7] = "line #7"
<
:[range]lua << {endmarker}
{script}
{endmarker}
Execute Lua script {script}. {not in Vi}
Note: This command doesn't work when the Lua
feature wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like
for the |:append| and |:insert| commands.
This form of the |:lua| command is mainly useful for including Lua code
in Vim scripts.
Example:
>
function! CurrentLineInfo()
lua << EOF
local linenr = vim.window().line
local curline = vim.buffer()[linenr]
print(string.format("Current line [%d] has %d chars",
linenr, #curline))
EOF
endfunction
<
*:luado*
:[range]luado {body} Execute Lua function "function (line, linenr) {body}
end" for each line in the [range], with the function
argument being set to the text of each line in turn,
without a trailing <EOL>, and the current line number.
If the value returned by the function is a string it
becomes the text of the line in the current turn. The
default for [range] is the whole file: "1,$".
{not in Vi}
Examples:
>
:luado return string.format("%s\t%d", line:reverse(), #line)
:lua require"lpeg"
:lua -- balanced parenthesis grammar:
:lua bp = lpeg.P{ "(" * ((1 - lpeg.S"()") + lpeg.V(1))^0 * ")" }
:luado if bp:match(line) then return "-->\t" .. line end
<
*:luafile*
:[range]luafile {file}
Execute Lua script in {file}. {not in Vi}
The whole argument is used as a single file name.
Examples:
>
:luafile script.lua
:luafile %
<
All these commands execute a Lua chunk from either the command line (:lua and
:luado) or a file (:luafile) with the given line [range]. Similarly to the Lua
interpreter, each chunk has its own scope and so only global variables are
shared between command calls. All Lua default libraries are available. In
addition, Lua "print" function has its output redirected to the Vim message
area, with arguments separated by a white space instead of a tab.
Lua uses the "vim" module (see |lua-vim|) to issue commands to Vim
and manage buffers (|lua-buffer|) and windows (|lua-window|). However,
procedures that alter buffer content, open new buffers, and change cursor
position are restricted when the command is executed in the |sandbox|.
==============================================================================
2. The vim module *lua-vim*
Lua interfaces Vim through the "vim" module. The first and last line of the
input range are stored in "vim.firstline" and "vim.lastline" respectively. The
module also includes routines for buffer, window, and current line queries,
Vim evaluation and command execution, and others.
vim.list([arg]) Returns an empty list or, if "arg" is a Lua
table with numeric keys 1, ..., n (a
"sequence"), returns a list l such that l[i] =
arg[i] for i = 1, ..., n (see |List|).
Non-numeric keys are not used to initialize
the list. See also |lua-eval| for conversion
rules. Example: >
:lua t = {math.pi, false, say = 'hi'}
:echo luaeval('vim.list(t)')
:" [3.141593, 0], 'say' is ignored
<
vim.dict([arg]) Returns an empty dictionary or, if "arg" is a
Lua table, returns a dict d such that d[k] =
arg[k] for all string keys k in "arg" (see
|Dictionary|). Number keys are converted to
strings. Keys that are not strings are not
used to initialize the dictionary. See also
|lua-eval| for conversion rules. Example: >
:lua t = {math.pi, false, say = 'hi'}
:echo luaeval('vim.dict(t)')
:" {'say': 'hi'}, numeric keys ignored
<
vim.funcref({name}) Returns a Funcref to function {name} (see
|Funcref|). It is equivalent to Vim's
"function".
vim.buffer([arg]) If "arg" is a number, returns buffer with
number "arg" in the buffer list or, if "arg"
is a string, returns buffer whose full or short
name is "arg". In both cases, returns 'nil'
(nil value, not string) if the buffer is not
found. Otherwise, if "toboolean(arg)" is
'true' returns the first buffer in the buffer
list or else the current buffer.
vim.window([arg]) If "arg" is a number, returns window with
number "arg" or 'nil' (nil value, not string)
if not found. Otherwise, if "toboolean(arg)"
is 'true' returns the first window or else the
current window.
vim.type({arg}) Returns the type of {arg}. It is equivalent to
Lua's "type" function, but returns "list",
"dict", "funcref", "buffer", or "window" if
{arg} is a list, dictionary, funcref, buffer,
or window, respectively. Examples: >
:lua l = vim.list()
:lua print(type(l), vim.type(l))
:" userdata list
<
vim.command({cmd}) Executes the vim (ex-mode) command {cmd}.
Examples: >
:lua vim.command"set tw=60"
:lua vim.command"normal ddp"
<
vim.eval({expr}) Evaluates expression {expr} (see |expression|),
converts the result to Lua, and returns it.
Vim strings and numbers are directly converted
to Lua strings and numbers respectively. Vim
lists and dictionaries are converted to Lua
userdata (see |lua-list| and |lua-dict|).
Examples: >
:lua tw = vim.eval"&tw"
:lua print(vim.eval"{'a': 'one'}".a)
<
vim.line() Returns the current line (without the trailing
<EOL>), a Lua string.
vim.beep() Beeps.
vim.open({fname}) Opens a new buffer for file {fname} and
returns it. Note that the buffer is not set as
current.
==============================================================================
3. List userdata *lua-list*
List userdata represent vim lists, and the interface tries to follow closely
Vim's syntax for lists. Since lists are objects, changes in list references in
Lua are reflected in Vim and vice-versa. A list "l" has the following
properties and methods:
Properties
----------
o "#l" is the number of items in list "l", equivalent to "len(l)"
in Vim.
o "l[k]" returns the k-th item in "l"; "l" is zero-indexed, as in Vim.
To modify the k-th item, simply do "l[k] = newitem"; in
particular, "l[k] = nil" removes the k-th item from "l".
o "l()" returns an iterator for "l".
Methods
-------
o "l:add(item)" appends "item" to the end of "l".
o "l:insert(item[, pos])" inserts "item" at (optional)
position "pos" in the list. The default value for "pos" is 0.
Examples:
>
:let l = [1, 'item']
:lua l = vim.eval('l') -- same 'l'
:lua l:add(vim.list())
:lua l[0] = math.pi
:echo l[0] " 3.141593
:lua l[0] = nil -- remove first item
:lua l:insert(true, 1)
:lua print(l, #l, l[0], l[1], l[-1])
:lua for item in l() do print(item) end
<
==============================================================================
4. Dict userdata *lua-dict*
Similarly to list userdata, dict userdata represent vim dictionaries; since
dictionaries are also objects, references are kept between Lua and Vim. A dict
"d" has the following properties:
Properties
----------
o "#d" is the number of items in dict "d", equivalent to "len(d)"
in Vim.
o "d.key" or "d['key']" returns the value at entry "key" in "d".
To modify the entry at this key, simply do "d.key = newvalue"; in
particular, "d.key = nil" removes the entry from "d".
o "d()" returns an iterator for "d" and is equivalent to "items(d)" in
Vim.
Examples:
>
:let d = {'n':10}
:lua d = vim.eval('d') -- same 'd'
:lua print(d, d.n, #d)
:let d.self = d
:lua for k, v in d() do print(d, k, v) end
:lua d.x = math.pi
:lua d.self = nil -- remove entry
:echo d
<
==============================================================================
5. Funcref userdata *lua-funcref*
Funcref userdata represent funcref variables in Vim. Funcrefs that were
defined with a "dict" attribute need to be obtained as a dictionary key
in order to have "self" properly assigned to the dictionary (see examples
below.) A funcref "f" has the following properties:
Properties
----------
o "#f" is the name of the function referenced by "f"
o "f(...)" calls the function referenced by "f" (with arguments)
Examples:
>
:function I(x)
: return a:x
: endfunction
:let R = function('I')
:lua i1 = vim.funcref('I')
:lua i2 = vim.eval('R')
:lua print(#i1, #i2) -- both 'I'
:lua print(i1, i2, #i2(i1) == #i1(i2))
:function Mylen() dict
: return len(self.data)
: endfunction
:let mydict = {'data': [0, 1, 2, 3]}
:lua d = vim.eval('mydict'); d.len = vim.funcref('Mylen')
:echo mydict.len()
:lua l = d.len -- assign d as 'self'
:lua print(l())
<
==============================================================================
6. Buffer userdata *lua-buffer*
Buffer userdata represent vim buffers. A buffer userdata "b" has the following
properties and methods:
Properties
----------
o "b()" sets "b" as the current buffer.
o "#b" is the number of lines in buffer "b".
o "b[k]" represents line number k: "b[k] = newline" replaces line k
with string "newline" and "b[k] = nil" deletes line k.
o "b.name" contains the short name of buffer "b" (read-only).
o "b.fname" contains the full name of buffer "b" (read-only).
o "b.number" contains the position of buffer "b" in the buffer list
(read-only).
Methods
-------
o "b:insert(newline[, pos])" inserts string "newline" at (optional)
position "pos" in the buffer. The default value for "pos" is
"#b + 1". If "pos == 0" then "newline" becomes the first line in
the buffer.
o "b:next()" returns the buffer next to "b" in the buffer list.
o "b:previous()" returns the buffer previous to "b" in the buffer
list.
o "b:isvalid()" returns 'true' (boolean) if buffer "b" corresponds to
a "real" (not freed from memory) Vim buffer.
Examples:
>
:lua b = vim.buffer() -- current buffer
:lua print(b.name, b.number)
:lua b[1] = "first line"
:lua b:insert("FIRST!", 0)
:lua b[1] = nil -- delete top line
:lua for i=1,3 do b:insert(math.random()) end
:3,4lua for i=vim.lastline,vim.firstline,-1 do b[i] = nil end
:lua vim.open"myfile"() -- open buffer and set it as current
function! ListBuffers()
lua << EOF
local b = vim.buffer(true) -- first buffer in list
while b ~= nil do
print(b.number, b.name, #b)
b = b:next()
end
vim.beep()
EOF
endfunction
<
==============================================================================
7. Window userdata *lua-window*
Window objects represent vim windows. A window userdata "w" has the following
properties and methods:
Properties
----------
o "w()" sets "w" as the current window.
o "w.buffer" contains the buffer of window "w" (read-only).
o "w.line" represents the cursor line position in window "w".
o "w.col" represents the cursor column position in window "w".
o "w.width" represents the width of window "w".
o "w.height" represents the height of window "w".
Methods
-------
o "w:next()" returns the window next to "w".
o "w:previous()" returns the window previous to "w".
o "w:isvalid()" returns 'true' (boolean) if window "w" corresponds to
a "real" (not freed from memory) Vim window.
Examples:
>
:lua w = vim.window() -- current window
:lua print(w.buffer.name, w.line, w.col)
:lua w.width = w.width + math.random(10)
:lua w.height = 2 * math.random() * w.height
:lua n,w = 0,vim.window(true) while w~=nil do n,w = n + 1,w:next() end
:lua print("There are " .. n .. " windows")
<
==============================================================================
8. The luaeval function *lua-luaeval* *lua-eval*
The (dual) equivalent of "vim.eval" for passing Lua values to Vim is
"luaeval". "luaeval" takes an expression string and an optional argument and
returns the result of the expression. It is semantically equivalent in Lua to:
>
local chunkheader = "local _A = select(1, ...) return "
function luaeval (expstr, arg)
local chunk = assert(loadstring(chunkheader .. expstr, "luaeval"))
return chunk(arg) -- return typval
end
<
Note that "_A" receives the argument to "luaeval". Lua numbers, strings, and
list, dict, and funcref userdata are converted to their Vim respective types,
while Lua booleans are converted to numbers. An error is thrown if conversion
of any of the remaining Lua types, including userdata other than lists, dicts,
and funcrefs, is attempted.
Examples: >
:echo luaeval('math.pi')
:lua a = vim.list():add('newlist')
:let a = luaeval('a')
:echo a[0] " 'newlist'
:function Rand(x,y) " random uniform between x and y
: return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y})
: endfunction
:echo Rand(1,10)
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View file

@ -1,286 +0,0 @@
*if_mzsch.txt* For Vim version 7.4. Last change: 2012 Dec 17
VIM REFERENCE MANUAL by Sergey Khorev
The MzScheme Interface to Vim *mzscheme* *MzScheme*
1. Commands |mzscheme-commands|
2. Examples |mzscheme-examples|
3. Threads |mzscheme-threads|
4. Vim access from MzScheme |mzscheme-vim|
5. mzeval() Vim function |mzscheme-mzeval|
6. Using Function references |mzscheme-funcref|
7. Dynamic loading |mzscheme-dynamic|
{Vi does not have any of these commands}
The MzScheme interface is available only if Vim was compiled with the
|+mzscheme| feature.
Based on the work of Brent Fulgham.
Dynamic loading added by Sergey Khorev
MzScheme and PLT Scheme names have been rebranded as Racket. For more
information please check http://racket-lang.org
Futures and places of Racket version 5.x up to and including 5.3.1 do not
work correctly with processes created by Vim.
The simplest solution is to build Racket on your own with these features
disabled: >
./configure --disable-futures --disable-places --prefix=your-install-prefix
To speed up the process, you might also want to use --disable-gracket and
--disable-docs
==============================================================================
1. Commands *mzscheme-commands*
*:mzscheme* *:mz*
:[range]mz[scheme] {stmt}
Execute MzScheme statement {stmt}. {not in Vi}
:[range]mz[scheme] << {endmarker}
{script}
{endmarker}
Execute inlined MzScheme script {script}.
Note: This command doesn't work if the MzScheme
feature wasn't compiled in. To avoid errors, see
|script-here|.
*:mzfile* *:mzf*
:[range]mzf[ile] {file} Execute the MzScheme script in {file}. {not in Vi}
All of these commands do essentially the same thing - they execute a piece of
MzScheme code, with the "current range" set to the given line
range.
In the case of :mzscheme, the code to execute is in the command-line.
In the case of :mzfile, the code to execute is the contents of the given file.
MzScheme interface defines exception exn:vim, derived from exn.
It is raised for various Vim errors.
During compilation, the MzScheme interface will remember the current MzScheme
collection path. If you want to specify additional paths use the
'current-library-collection-paths' parameter. E.g., to cons the user-local
MzScheme collection path: >
:mz << EOF
(current-library-collection-paths
(cons
(build-path (find-system-path 'addon-dir) (version) "collects")
(current-library-collection-paths)))
EOF
<
All functionality is provided through module vimext.
The exn:vim is available without explicit import.
To avoid clashes with MzScheme, consider using prefix when requiring module,
e.g.: >
:mzscheme (require (prefix vim- vimext))
<
All the examples below assume this naming scheme.
*mzscheme-sandbox*
When executed in the |sandbox|, access to some filesystem and Vim interface
procedures is restricted.
==============================================================================
2. Examples *mzscheme-examples*
>
:mzscheme (display "Hello")
:mz (display (string-append "Using MzScheme version " (version)))
:mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x
:mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x
:mzscheme (vim-set-buff-line 10 "This is line #10")
<
Inline script usage: >
function! <SID>SetFirstLine()
:mz << EOF
(display "!!!")
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(vim-set-buff-line 1 "This is line #1")
(vim-beep)
EOF
endfunction
nmap <F9> :call <SID>SetFirstLine() <CR>
<
File execution: >
:mzfile supascript.scm
<
Vim exception handling: >
:mz << EOF
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(with-handlers
([exn:vim? (lambda (e) (display (exn-message e)))])
(vim-eval "nonsense-string"))
EOF
<
Auto-instantiation of vimext module (can be placed in your |vimrc|): >
function! MzRequire()
:redir => l:mzversion
:mz (version)
:redir END
if strpart(l:mzversion, 1, 1) < "4"
" MzScheme versions < 4.x:
:mz (require (prefix vim- vimext))
else
" newer versions:
:mz (require (prefix-in vim- 'vimext))
endif
endfunction
if has("mzscheme")
silent call MzRequire()
endif
<
==============================================================================
3. Threads *mzscheme-threads*
The MzScheme interface supports threads. They are independent from OS threads,
thus scheduling is required. The option 'mzquantum' determines how often
Vim should poll for available MzScheme threads.
NOTE
Thread scheduling in the console version of Vim is less reliable than in the
GUI version.
==============================================================================
4. Vim access from MzScheme *mzscheme-vim*
*mzscheme-vimext*
The 'vimext' module provides access to procedures defined in the MzScheme
interface.
Common
------
(command {command-string}) Perform the vim ":Ex" style command.
(eval {expr-string}) Evaluate the vim expression into
respective MzScheme object: |Lists| are
represented as Scheme lists,
|Dictionaries| as hash tables,
|Funcref|s as functions (see also
|mzscheme-funcref|)
NOTE the name clashes with MzScheme eval,
use module qualifiers to overcome this.
(range-start) Start/End of the range passed with
(range-end) the Scheme command.
(beep) beep
(get-option {option-name} [buffer-or-window]) Get Vim option value (either
local or global, see set-option).
(set-option {string} [buffer-or-window])
Set a Vim option. String must have option
setting form (like optname=optval, or
optname+=optval, etc.) When called with
{buffer} or {window} the local option will
be set. The symbol 'global can be passed
as {buffer-or-window}. Then |:setglobal|
will be used.
Buffers *mzscheme-buffer*
-------
(buff? {object}) Is object a buffer?
(buff-valid? {object}) Is object a valid buffer? (i.e.
corresponds to the real Vim buffer)
(get-buff-line {linenr} [buffer])
Get line from a buffer.
(set-buff-line {linenr} {string} [buffer])
Set a line in a buffer. If {string} is #f,
the line gets deleted. The [buffer]
argument is optional. If omitted, the
current buffer will be used.
(get-buff-line-list {start} {end} [buffer])
Get a list of lines in a buffer. {Start}
and {end} are 1-based and inclusive.
(set-buff-line-list {start} {end} {string-list} [buffer])
Set a list of lines in a buffer. If
string-list is #f or null, the lines get
deleted. If a list is shorter than
{end}-{start} the remaining lines will
be deleted.
(get-buff-name [buffer]) Get a buffer's text name.
(get-buff-num [buffer]) Get a buffer's number.
(get-buff-size [buffer]) Get buffer line count.
(insert-buff-line-list {linenr} {string/string-list} [buffer])
Insert a list of lines into a buffer after
{linenr}. If {linenr} is 0, lines will be
inserted at start.
(curr-buff) Get the current buffer. Use other MzScheme
interface procedures to change it.
(buff-count) Get count of total buffers in the editor.
(get-next-buff [buffer]) Get next buffer.
(get-prev-buff [buffer]) Get previous buffer. Return #f when there
are no more buffers.
(open-buff {filename}) Open a new buffer (for file "name")
(get-buff-by-name {buffername}) Get a buffer by its filename or #f
if there is no such buffer.
(get-buff-by-num {buffernum}) Get a buffer by its number (return #f if
there is no buffer with this number).
Windows *mzscheme-window*
------
(win? {object}) Is object a window?
(win-valid? {object}) Is object a valid window (i.e. corresponds
to the real Vim window)?
(curr-win) Get the current window.
(win-count) Get count of windows.
(get-win-num [window]) Get window number.
(get-win-by-num {windownum}) Get window by its number.
(get-win-buffer [window]) Get the buffer for a given window.
(get-win-height [window])
(set-win-height {height} [window]) Get/Set height of window.
(get-win-width [window])
(set-win-width {width} [window])Get/Set width of window.
(get-win-list [buffer]) Get list of windows for a buffer.
(get-cursor [window]) Get cursor position in a window as
a pair (linenr . column).
(set-cursor (line . col) [window]) Set cursor position.
==============================================================================
5. mzeval() Vim function *mzscheme-mzeval*
To facilitate bi-directional interface, you can use |mzeval()| function to
evaluate MzScheme expressions and pass their values to VimL.
==============================================================================
6. Using Function references *mzscheme-funcref*
MzScheme interface allows use of |Funcref|s so you can call Vim functions
directly from Scheme. For instance: >
function! MyAdd2(arg)
return a:arg + 2
endfunction
mz (define f2 (vim-eval "function(\"MyAdd2\")"))
mz (f2 7)
< or : >
:mz (define indent (vim-eval "function('indent')"))
" return Vim indent for line 12
:mz (indent 12)
<
==============================================================================
7. Dynamic loading *mzscheme-dynamic* *E815*
On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
This means that Vim will search for the MzScheme DLL files only when needed.
When you don't use the MzScheme interface you don't need them, thus you can
use Vim without these DLL files.
To use the MzScheme interface the MzScheme DLLs must be in your search path.
In a console window type "path" to see what directories are used.
The names of the DLLs must match the MzScheme version Vim was compiled with.
For MzScheme version 209 they will be "libmzsch209_000.dll" and
"libmzgc209_000.dll". To know for sure look at the output of the ":version"
command, look for -DDYNAMIC_MZSCH_DLL="something" and
-DDYNAMIC_MZGC_DLL="something" in the "Compilation" info.
======================================================================
vim:tw=78:ts=8:sts=4:ft=help:norl:

View file

@ -1,205 +0,0 @@
*if_ole.txt* For Vim version 7.4. Last change: 2008 Aug 16
VIM REFERENCE MANUAL by Paul Moore
The OLE Interface to Vim *ole-interface*
1. Activation |ole-activation|
2. Methods |ole-methods|
3. The "normal" command |ole-normal|
4. Registration |ole-registration|
5. MS Visual Studio integration |MSVisualStudio|
{Vi does not have any of these commands}
OLE is only available when compiled with the |+ole| feature. See
src/if_ole.INSTALL.
An alternative is using the client-server communication |clientserver|.
==============================================================================
1. Activation *ole-activation*
Vim acts as an OLE automation server, accessible from any automation client,
for example, Visual Basic, Python, or Perl. The Vim application "name" (its
"ProgID", in OLE terminology) is "Vim.Application".
Hence, in order to start a Vim instance (or connect to an already running
instance), code similar to the following should be used:
[Visual Basic] >
Dim Vim As Object
Set Vim = CreateObject("Vim.Application")
[Python] >
from win32com.client.dynamic import Dispatch
vim = Dispatch('Vim.Application')
[Perl] >
use Win32::OLE;
$vim = new Win32::OLE 'Vim.Application';
[C#] >
// Add a reference to VIM in your project.
// Choose the COM tab.
// Select "VIM Ole Interface 1.1 Type Library"
Vim.Vim vimobj = new Vim.Vim();
Vim does not support acting as a "hidden" OLE server, like some other OLE
Automation servers. When a client starts up an instance of Vim, that instance
is immediately visible. Simply closing the OLE connection to the Vim instance
is not enough to shut down the Vim instance - it is necessary to explicitly
execute a quit command (for example, :qa!, :wqa).
==============================================================================
2. Methods *ole-methods*
Vim exposes four methods for use by clients.
*ole-sendkeys*
SendKeys(keys) Execute a series of keys.
This method takes a single parameter, which is a string of keystrokes. These
keystrokes are executed exactly as if they had been types in at the keyboard.
Special keys can be given using their <..> names, as for the right hand side
of a mapping. Note: Execution of the Ex "normal" command is not supported -
see below |ole-normal|.
Examples (Visual Basic syntax) >
Vim.SendKeys "ihello<Esc>"
Vim.SendKeys "ma1GV4jy`a"
These examples assume that Vim starts in Normal mode. To force Normal mode,
start the key sequence with CTRL-\ CTRL-N as in >
Vim.SendKeys "<C-\><C-N>ihello<Esc>"
CTRL-\ CTRL-N returns Vim to Normal mode, when in Insert or Command-line mode.
Note that this doesn't work halfway a Vim command
*ole-eval*
Eval(expr) Evaluate an expression.
This method takes a single parameter, which is an expression in Vim's normal
format (see |expression|). It returns a string, which is the result of
evaluating the expression. A |List| is turned into a string by joining the
items and inserting line breaks.
Examples (Visual Basic syntax) >
Line20 = Vim.Eval("getline(20)")
Twelve = Vim.Eval("6 + 6") ' Note this is a STRING
Font = Vim.Eval("&guifont")
<
*ole-setforeground*
SetForeground() Make the Vim window come to the foreground
This method takes no arguments. No value is returned.
Example (Visual Basic syntax) >
Vim.SetForeground
<
*ole-gethwnd*
GetHwnd() Return the handle of the Vim window.
This method takes no arguments. It returns the hwnd of the main Vimwindow.
You can use this if you are writing something which needs to manipulate the
Vim window, or to track it in the z-order, etc.
Example (Visual Basic syntax) >
Vim_Hwnd = Vim.GetHwnd
<
==============================================================================
3. The "normal" command *ole-normal*
Due to the way Vim processes OLE Automation commands, combined with the method
of implementation of the Ex command :normal, it is not possible to execute the
:normal command via OLE automation. Any attempt to do so will fail, probably
harmlessly, although possibly in unpredictable ways.
There is currently no practical way to trap this situation, and users must
simply be aware of the limitation.
==============================================================================
4. Registration *ole-registration* *E243*
Before Vim will act as an OLE server, it must be registered in the system
registry. In order to do this, Vim should be run with a single parameter of
"-register".
*-register* >
gvim -register
If gvim with OLE support is run and notices that no Vim OLE server has been
registered, it will present a dialog and offers you the choice to register by
clicking "Yes".
In some situations registering is not possible. This happens when the
registry is not writable. If you run into this problem you need to run gvim
as "Administrator".
Once vim is registered, the application path is stored in the registry.
Before moving, deleting, or upgrading Vim, the registry entries should be
removed using the "-unregister" switch.
*-unregister* >
gvim -unregister
The OLE mechanism will use the first registered Vim it finds. If a Vim is
already running, this one will be used. If you want to have (several) Vim
sessions open that should not react to OLE commands, use the non-OLE version,
and put it in a different directory. The OLE version should then be put in a
directory that is not in your normal path, so that typing "gvim" will start
the non-OLE version.
*-silent*
To avoid the message box that pops up to report the result, prepend "-silent":
>
gvim -silent -register
gvim -silent -unregister
==============================================================================
5. MS Visual Studio integration *MSVisualStudio* *VisVim*
The OLE version can be used to run Vim as the editor in Microsoft Visual
Studio. This is called "VisVim". It is included in the archive that contains
the OLE version. The documentation can be found in the runtime directory, the
README_VisVim.txt file.
Using Vim with Visual Studio .Net~
With .Net you no longer really need VisVim, since .Net studio has support for
external editors. Follow these directions:
In .Net Studio choose from the menu Tools->External Tools...
Add
Title - Vim
Command - c:\vim\vim63\gvim.exe
Arguments - --servername VS_NET --remote-silent "+call cursor($(CurLine), $(CurCol))" $(ItemPath)
Init Dir - Empty
Now, when you open a file in .Net, you can choose from the .Net menu:
Tools->Vim
That will open the file in Vim.
You can then add this external command as an icon and place it anywhere you
like. You might also be able to set this as your default editor.
If you refine this further, please post back to the Vim maillist so we have a
record of it.
--servername VS_NET
This will create a new instance of vim called VS_NET. So if you open multiple
files from VS, they will use the same instance of Vim. This allows you to
have multiple copies of Vim running, but you can control which one has VS
files in it.
--remote-silent "+call cursor(10, 27)"
- Places the cursor on line 10 column 27
In Vim >
:h --remote-silent for mor details
[.Net remarks provided by Dave Fishburn and Brian Sturk]
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,294 +0,0 @@
*if_perl.txt* For Vim version 7.4. Last change: 2012 Oct 25
VIM REFERENCE MANUAL by Sven Verdoolaege
and Matt Gerassimof
Perl and Vim *perl* *Perl*
1. Editing Perl files |perl-editing|
2. Compiling VIM with Perl interface |perl-compiling|
3. Using the Perl interface |perl-using|
4. Dynamic loading |perl-dynamic|
{Vi does not have any of these commands}
The Perl interface only works when Vim was compiled with the |+perl| feature.
==============================================================================
1. Editing Perl files *perl-editing*
Vim syntax highlighting supports Perl and POD files. Vim assumes a file is
Perl code if the filename has a .pl or .pm suffix. Vim also examines the first
line of a file, regardless of the filename suffix, to check if a file is a
Perl script (see scripts.vim in Vim's syntax directory). Vim assumes a file
is POD text if the filename has a .POD suffix.
To use tags with Perl, you need a recent version of Exuberant ctags. Look
here:
http://ctags.sourceforge.net
Alternatively, you can use the Perl script pltags.pl, which is shipped with
Vim in the $VIMRUNTIME/tools directory. This script has currently more
features than Exuberant ctags' Perl support.
==============================================================================
2. Compiling VIM with Perl interface *perl-compiling*
To compile Vim with Perl interface, you need Perl 5.004 (or later). Perl must
be installed before you compile Vim. Vim's Perl interface does NOT work with
the 5.003 version that has been officially released! It will probably work
with Perl 5.003_05 and later.
The Perl patches for Vim were made by:
Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
Matt Gerassimof
Perl for MS-Windows can be found at: http://www.perl.com/
The ActiveState one should work.
==============================================================================
3. Using the Perl interface *perl-using*
*:perl* *:pe*
:pe[rl] {cmd} Execute Perl command {cmd}. The current package
is "main". Simple example to test if `:perl` is
working: >
:perl VIM::Msg("Hello")
:pe[rl] << {endpattern}
{script}
{endpattern}
Execute Perl script {script}.
{endpattern} must NOT be preceded by any white space.
If {endpattern} is omitted, it defaults to a dot '.'
like for the |:append| and |:insert| commands. Using
'.' helps when inside a function, because "$i;" looks
like the start of an |:insert| command to Vim.
This form of the |:perl| command is mainly useful for
including perl code in vim scripts.
Note: This command doesn't work when the Perl feature
wasn't compiled in. To avoid errors, see
|script-here|.
Example vim script: >
function! WhitePearl()
perl << EOF
VIM::Msg("pearls are nice for necklaces");
VIM::Msg("rubys for rings");
VIM::Msg("pythons for bags");
VIM::Msg("tcls????");
EOF
endfunction
<
*:perldo* *:perld*
:[range]perld[o] {cmd} Execute Perl command {cmd} for each line in the
[range], with $_ being set to the text of each line in
turn, without a trailing <EOL>. Setting $_ will change
the text, but note that it is not possible to add or
delete lines using this command.
The default for [range] is the whole file: "1,$".
Here are some things you can try: >
:perl $a=1
:perldo $_ = reverse($_);1
:perl VIM::Msg("hello")
:perl $line = $curbuf->Get(42)
<
*E299*
Executing Perl commands in the |sandbox| is limited. ":perldo" will not be
possible at all. ":perl" will be evaluated in the Safe environment, if
possible.
*perl-overview*
Here is an overview of the functions that are available to Perl: >
:perl VIM::Msg("Text") # displays a message
:perl VIM::Msg("Error", "ErrorMsg") # displays an error message
:perl VIM::Msg("remark", "Comment") # displays a highlighted message
:perl VIM::SetOption("ai") # sets a vim option
:perl $nbuf = VIM::Buffers() # returns the number of buffers
:perl @buflist = VIM::Buffers() # returns array of all buffers
:perl $mybuf = (VIM::Buffers('qq.c'))[0] # returns buffer object for 'qq.c'
:perl @winlist = VIM::Windows() # returns array of all windows
:perl $nwin = VIM::Windows() # returns the number of windows
:perl ($success, $v) = VIM::Eval('&path') # $v: option 'path', $success: 1
:perl ($success, $v) = VIM::Eval('&xyz') # $v: '' and $success: 0
:perl $v = VIM::Eval('expand("<cfile>")') # expands <cfile>
:perl $curwin->SetHeight(10) # sets the window height
:perl @pos = $curwin->Cursor() # returns (row, col) array
:perl @pos = (10, 10)
:perl $curwin->Cursor(@pos) # sets cursor to @pos
:perl $curwin->Cursor(10,10) # sets cursor to row 10 col 10
:perl $mybuf = $curwin->Buffer() # returns the buffer object for window
:perl $curbuf->Name() # returns buffer name
:perl $curbuf->Number() # returns buffer number
:perl $curbuf->Count() # returns the number of lines
:perl $l = $curbuf->Get(10) # returns line 10
:perl @l = $curbuf->Get(1 .. 5) # returns lines 1 through 5
:perl $curbuf->Delete(10) # deletes line 10
:perl $curbuf->Delete(10, 20) # delete lines 10 through 20
:perl $curbuf->Append(10, "Line") # appends a line
:perl $curbuf->Append(10, "Line1", "Line2", "Line3") # appends 3 lines
:perl @l = ("L1", "L2", "L3")
:perl $curbuf->Append(10, @l) # appends L1, L2 and L3
:perl $curbuf->Set(10, "Line") # replaces line 10
:perl $curbuf->Set(10, "Line1", "Line2") # replaces lines 10 and 11
:perl $curbuf->Set(10, @l) # replaces 3 lines
<
*perl-Msg*
VIM::Msg({msg}, {group}?)
Displays the message {msg}. The optional {group}
argument specifies a highlight group for Vim to use
for the message.
*perl-SetOption*
VIM::SetOption({arg}) Sets a vim option. {arg} can be any argument that the
":set" command accepts. Note that this means that no
spaces are allowed in the argument! See |:set|.
*perl-Buffers*
VIM::Buffers([{bn}...]) With no arguments, returns a list of all the buffers
in an array context or returns the number of buffers
in a scalar context. For a list of buffer names or
numbers {bn}, returns a list of the buffers matching
{bn}, using the same rules as Vim's internal
|bufname()| function.
WARNING: the list becomes invalid when |:bwipe| is
used. Using it anyway may crash Vim.
*perl-Windows*
VIM::Windows([{wn}...]) With no arguments, returns a list of all the windows
in an array context or returns the number of windows
in a scalar context. For a list of window numbers
{wn}, returns a list of the windows with those
numbers.
WARNING: the list becomes invalid when a window is
closed. Using it anyway may crash Vim.
*perl-DoCommand*
VIM::DoCommand({cmd}) Executes Ex command {cmd}.
*perl-Eval*
VIM::Eval({expr}) Evaluates {expr} and returns (success, value) in list
context or just value in scalar context.
success=1 indicates that val contains the value of
{expr}; success=0 indicates a failure to evaluate
the expression. '@x' returns the contents of register
x, '&x' returns the value of option x, 'x' returns the
value of internal |variables| x, and '$x' is equivalent
to perl's $ENV{x}. All |functions| accessible from
the command-line are valid for {expr}.
A |List| is turned into a string by joining the items
and inserting line breaks.
*perl-SetHeight*
Window->SetHeight({height})
Sets the Window height to {height}, within screen
limits.
*perl-GetCursor*
Window->Cursor({row}?, {col}?)
With no arguments, returns a (row, col) array for the
current cursor position in the Window. With {row} and
{col} arguments, sets the Window's cursor position to
{row} and {col}. Note that {col} is numbered from 0,
Perl-fashion, and thus is one less than the value in
Vim's ruler.
Window->Buffer() *perl-Buffer*
Returns the Buffer object corresponding to the given
Window.
*perl-Name*
Buffer->Name() Returns the filename for the Buffer.
*perl-Number*
Buffer->Number() Returns the number of the Buffer.
*perl-Count*
Buffer->Count() Returns the number of lines in the Buffer.
*perl-Get*
Buffer->Get({lnum}, {lnum}?, ...)
Returns a text string of line {lnum} in the Buffer
for each {lnum} specified. An array can be passed
with a list of {lnum}'s specified.
*perl-Delete*
Buffer->Delete({lnum}, {lnum}?)
Deletes line {lnum} in the Buffer. With the second
{lnum}, deletes the range of lines from the first
{lnum} to the second {lnum}.
*perl-Append*
Buffer->Append({lnum}, {line}, {line}?, ...)
Appends each {line} string after Buffer line {lnum}.
The list of {line}s can be an array.
*perl-Set*
Buffer->Set({lnum}, {line}, {line}?, ...)
Replaces one or more Buffer lines with specified
{lines}s, starting at Buffer line {lnum}. The list of
{line}s can be an array. If the arguments are
invalid, replacement does not occur.
$main::curwin
The current window object.
$main::curbuf
The current buffer object.
*script-here*
When using a script language in-line, you might want to skip this when the
language isn't supported. But this mechanism doesn't work: >
if has('perl')
perl << EOF
this will NOT work!
EOF
endif
Instead, put the Perl/Python/Ruby/etc. command in a function and call that
function: >
if has('perl')
function DefPerl()
perl << EOF
this works
EOF
endfunction
call DefPerl()
endif
Note that "EOF" must be at the start of the line.
==============================================================================
4. Dynamic loading *perl-dynamic*
On MS-Windows and Unix the Perl library can be loaded dynamically. The
|:version| output then includes |+perl/dyn|.
This means that Vim will search for the Perl DLL or shared library file only
when needed. When you don't use the Perl interface you don't need it, thus
you can use Vim without this file.
MS-Windows ~
You can download Perl from http://www.perl.org. The one from ActiveState was
used for building Vim.
To use the Perl interface the Perl DLL must be in your search path.
If Vim reports it cannot find the perl512.dll, make sure your $PATH includes
the directory where it is located. The Perl installer normally does that.
In a console window type "path" to see what directories are used.
The name of the DLL must match the Perl version Vim was compiled with.
Currently the name is "perl512.dll". That is for Perl 5.12. To know for
sure edit "gvim.exe" and search for "perl\d*.dll\c".
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,763 +0,0 @@
*if_pyth.txt* For Vim version 7.4. Last change: 2013 Jul 10
VIM REFERENCE MANUAL by Paul Moore
The Python Interface to Vim *python* *Python*
1. Commands |python-commands|
2. The vim module |python-vim|
3. Buffer objects |python-buffer|
4. Range objects |python-range|
5. Window objects |python-window|
6. Tab page objects |python-tabpage|
7. vim.bindeval objects |python-bindeval-objects|
8. pyeval(), py3eval() Vim functions |python-pyeval|
9. Dynamic loading |python-dynamic|
10. Python 3 |python3|
{Vi does not have any of these commands}
The Python 2.x interface is available only when Vim was compiled with the
|+python| feature.
The Python 3 interface is available only when Vim was compiled with the
|+python3| feature.
Both can be available at the same time, but read |python-2-and-3|.
==============================================================================
1. Commands *python-commands*
*:python* *:py* *E205* *E263* *E264*
:[range]py[thon] {stmt}
Execute Python statement {stmt}. A simple check if
the `:python` command is working: >
:python print "Hello"
:[range]py[thon] << {endmarker}
{script}
{endmarker}
Execute Python script {script}.
Note: This command doesn't work when the Python
feature wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like
for the |:append| and |:insert| commands.
This form of the |:python| command is mainly useful for including python code
in Vim scripts.
Example: >
function! IcecreamInitialize()
python << EOF
class StrawberryIcecream:
def __call__(self):
print 'EAT ME'
EOF
endfunction
<
Note: Python is very sensitive to the indenting. Make sure the "class" line
and "EOF" do not have any indent.
*:pydo*
:[range]pydo {body} Execute Python function "def _vim_pydo(line, linenr):
{body}" for each line in the [range], with the
function arguments being set to the text of each line
in turn, without a trailing <EOL>, and the current
line number. The function should return a string or
None. If a string is returned, it becomes the text of
the line in the current turn. The default for [range]
is the whole file: "1,$".
{not in Vi}
Examples:
>
:pydo return "%s\t%d" % (line[::-1], len(line))
:pydo if line: return "%4d: %s" % (linenr, line)
<
*:pyfile* *:pyf*
:[range]pyf[ile] {file}
Execute the Python script in {file}. The whole
argument is used as a single file name. {not in Vi}
Both of these commands do essentially the same thing - they execute a piece of
Python code, with the "current range" |python-range| set to the given line
range.
In the case of :python, the code to execute is in the command-line.
In the case of :pyfile, the code to execute is the contents of the given file.
Python commands cannot be used in the |sandbox|.
To pass arguments you need to set sys.argv[] explicitly. Example: >
:python import sys
:python sys.argv = ["foo", "bar"]
:pyfile myscript.py
Here are some examples *python-examples* >
:python from vim import *
:python from string import upper
:python current.line = upper(current.line)
:python print "Hello"
:python str = current.buffer[42]
(Note that changes - like the imports - persist from one command to the next,
just like in the Python interpreter.)
==============================================================================
2. The vim module *python-vim*
Python code gets all of its access to vim (with one exception - see
|python-output| below) via the "vim" module. The vim module implements two
methods, three constants, and one error object. You need to import the vim
module before using it: >
:python import vim
Overview >
:py print "Hello" # displays a message
:py vim.command(cmd) # execute an Ex command
:py w = vim.windows[n] # gets window "n"
:py cw = vim.current.window # gets the current window
:py b = vim.buffers[n] # gets buffer "n"
:py cb = vim.current.buffer # gets the current buffer
:py w.height = lines # sets the window height
:py w.cursor = (row, col) # sets the window cursor position
:py pos = w.cursor # gets a tuple (row, col)
:py name = b.name # gets the buffer file name
:py line = b[n] # gets a line from the buffer
:py lines = b[n:m] # gets a list of lines
:py num = len(b) # gets the number of lines
:py b[n] = str # sets a line in the buffer
:py b[n:m] = [str1, str2, str3] # sets a number of lines at once
:py del b[n] # deletes a line
:py del b[n:m] # deletes a number of lines
Methods of the "vim" module
vim.command(str) *python-command*
Executes the vim (ex-mode) command str. Returns None.
Examples: >
:py vim.command("set tw=72")
:py vim.command("%s/aaa/bbb/g")
< The following definition executes Normal mode commands: >
def normal(str):
vim.command("normal "+str)
# Note the use of single quotes to delimit a string containing
# double quotes
normal('"a2dd"aP')
< *E659*
The ":python" command cannot be used recursively with Python 2.2 and
older. This only works with Python 2.3 and later: >
:py vim.command("python print 'Hello again Python'")
vim.eval(str) *python-eval*
Evaluates the expression str using the vim internal expression
evaluator (see |expression|). Returns the expression result as:
- a string if the Vim expression evaluates to a string or number
- a list if the Vim expression evaluates to a Vim list
- a dictionary if the Vim expression evaluates to a Vim dictionary
Dictionaries and lists are recursively expanded.
Examples: >
:py text_width = vim.eval("&tw")
:py str = vim.eval("12+12") # NB result is a string! Use
# string.atoi() to convert to
# a number.
:py tagList = vim.eval('taglist("eval_expr")')
< The latter will return a python list of python dicts, for instance:
[{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name':
'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}]
vim.bindeval(str) *python-bindeval*
Like |python-eval|, but returns special objects described in
|python-bindeval-objects|. These python objects let you modify (|List|
or |Dictionary|) or call (|Funcref|) vim objects.
vim.strwidth(str) *python-strwidth*
Like |strwidth()|: returns number of display cells str occupies, tab
is counted as one cell.
vim.foreach_rtp(callable) *python-foreach_rtp*
Call the given callable for each path in 'runtimepath' until either
callable returns something but None, the exception is raised or there
are no longer paths. If stopped in case callable returned non-None,
vim.foreach_rtp function returns the value returned by callable.
vim.chdir(*args, **kwargs) *python-chdir*
vim.fchdir(*args, **kwargs) *python-fchdir*
Run os.chdir or os.fchdir, then all appropriate vim stuff.
Note: you should not use these functions directly, use os.chdir and
os.fchdir instead. Behavior of vim.fchdir is undefined in case
os.fchdir does not exist.
Error object of the "vim" module
vim.error *python-error*
Upon encountering a Vim error, Python raises an exception of type
vim.error.
Example: >
try:
vim.command("put a")
except vim.error:
# nothing in register a
Constants of the "vim" module
Note that these are not actually constants - you could reassign them.
But this is silly, as you would then lose access to the vim objects
to which the variables referred.
vim.buffers *python-buffers*
A mapping object providing access to the list of vim buffers. The
object supports the following operations: >
:py b = vim.buffers[i] # Indexing (read-only)
:py b in vim.buffers # Membership test
:py n = len(vim.buffers) # Number of elements
:py for b in vim.buffers: # Iterating over buffer list
<
vim.windows *python-windows*
A sequence object providing access to the list of vim windows. The
object supports the following operations: >
:py w = vim.windows[i] # Indexing (read-only)
:py w in vim.windows # Membership test
:py n = len(vim.windows) # Number of elements
:py for w in vim.windows: # Sequential access
< Note: vim.windows object always accesses current tab page.
|python-tabpage|.windows objects are bound to parent |python-tabpage|
object and always use windows from that tab page (or throw vim.error
in case tab page was deleted). You can keep a reference to both
without keeping a reference to vim module object or |python-tabpage|,
they will not lose their properties in this case.
vim.tabpages *python-tabpages*
A sequence object providing access to the list of vim tab pages. The
object supports the following operations: >
:py t = vim.tabpages[i] # Indexing (read-only)
:py t in vim.tabpages # Membership test
:py n = len(vim.tabpages) # Number of elements
:py for t in vim.tabpages: # Sequential access
<
vim.current *python-current*
An object providing access (via specific attributes) to various
"current" objects available in vim:
vim.current.line The current line (RW) String
vim.current.buffer The current buffer (RW) Buffer
vim.current.window The current window (RW) Window
vim.current.tabpage The current tab page (RW) TabPage
vim.current.range The current line range (RO) Range
The last case deserves a little explanation. When the :python or
:pyfile command specifies a range, this range of lines becomes the
"current range". A range is a bit like a buffer, but with all access
restricted to a subset of lines. See |python-range| for more details.
Note: When assigning to vim.current.{buffer,window,tabpage} it expects
valid |python-buffer|, |python-window| or |python-tabpage| objects
respectively. Assigning triggers normal (with |autocommand|s)
switching to given buffer, window or tab page. It is the only way to
switch UI objects in python: you can't assign to
|python-tabpage|.window attribute. To switch without triggering
autocommands use >
py << EOF
saved_eventignore = vim.options['eventignore']
vim.options['eventignore'] = 'all'
try:
vim.current.buffer = vim.buffers[2] # Switch to buffer 2
finally:
vim.options['eventignore'] = saved_eventignore
EOF
<
vim.vars *python-vars*
vim.vvars *python-vvars*
Dictionary-like objects holding dictionaries with global (|g:|) and
vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`,
but faster.
vim.options *python-options*
Object partly supporting mapping protocol (supports setting and
getting items) providing a read-write access to global options.
Note: unlike |:set| this provides access only to global options. You
cannot use this object to obtain or set local options' values or
access local-only options in any fashion. Raises KeyError if no global
option with such name exists (i.e. does not raise KeyError for
|global-local| options and global only options, but does for window-
and buffer-local ones). Use |python-buffer| objects to access to
buffer-local options and |python-window| objects to access to
window-local options.
Type of this object is available via "Options" attribute of vim
module.
Output from Python *python-output*
Vim displays all Python code output in the Vim message area. Normal
output appears as information messages, and error output appears as
error messages.
In implementation terms, this means that all output to sys.stdout
(including the output from print statements) appears as information
messages, and all output to sys.stderr (including error tracebacks)
appears as error messages.
*python-input*
Input (via sys.stdin, including input() and raw_input()) is not
supported, and may cause the program to crash. This should probably be
fixed.
*python2-directory* *python3-directory* *pythonx-directory*
Python 'runtimepath' handling *python-special-path*
In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for
the list of paths found in 'runtimepath': with this directory in sys.path and
vim.path_hooks in sys.path_hooks python will try to load module from
{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
each {rtp} found in 'runtimepath'.
Implementation is similar to the following, but written in C: >
from imp import find_module, load_module
import vim
import sys
class VimModuleLoader(object):
def __init__(self, module):
self.module = module
def load_module(self, fullname, path=None):
return self.module
def _find_module(fullname, oldtail, path):
idx = oldtail.find('.')
if idx > 0:
name = oldtail[:idx]
tail = oldtail[idx+1:]
fmr = find_module(name, path)
module = load_module(fullname[:-len(oldtail)] + name, *fmr)
return _find_module(fullname, tail, module.__path__)
else:
fmr = find_module(fullname, path)
return load_module(fullname, *fmr)
# It uses vim module itself in place of VimPathFinder class: it does not
# matter for python which object has find_module function attached to as
# an attribute.
class VimPathFinder(object):
@classmethod
def find_module(cls, fullname, path=None):
try:
return VimModuleLoader(_find_module(fullname, fullname, path or vim._get_paths()))
except ImportError:
return None
@classmethod
def load_module(cls, fullname, path=None):
return _find_module(fullname, fullname, path or vim._get_paths())
def hook(path):
if path == vim.VIM_SPECIAL_PATH:
return VimPathFinder
else:
raise ImportError
sys.path_hooks.append(hook)
vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
String constant used in conjunction with vim path hook. If path hook
installed by vim is requested to handle anything but path equal to
vim.VIM_SPECIAL_PATH constant it raises ImportError. In the only other
case it uses special loader.
Note: you must not use value of this constant directly, always use
vim.VIM_SPECIAL_PATH object.
vim.find_module(...) *python-find_module*
vim.path_hook(path) *python-path_hook*
Methods or objects used to implement path loading as described above.
You should not be using any of these directly except for vim.path_hook
in case you need to do something with sys.meta_path. It is not
guaranteed that any of the objects will exist in the future vim
versions.
vim._get_paths *python-_get_paths*
Methods returning a list of paths which will be searched for by path
hook. You should not rely on this method being present in future
versions, but can use it for debugging.
It returns a list of {rtp}/python2 (or {rtp}/python3) and
{rtp}/pythonx directories for each {rtp} in 'runtimepath'.
==============================================================================
3. Buffer objects *python-buffer*
Buffer objects represent vim buffers. You can obtain them in a number of ways:
- via vim.current.buffer (|python-current|)
- from indexing vim.buffers (|python-buffers|)
- from the "buffer" attribute of a window (|python-window|)
Buffer objects have two read-only attributes - name - the full file name for
the buffer, and number - the buffer number. They also have three methods
(append, mark, and range; see below).
You can also treat buffer objects as sequence objects. In this context, they
act as if they were lists (yes, they are mutable) of strings, with each
element being a line of the buffer. All of the usual sequence operations,
including indexing, index assignment, slicing and slice assignment, work as
you would expect. Note that the result of indexing (slicing) a buffer is a
string (list of strings). This has one unusual consequence - b[:] is different
from b. In particular, "b[:] = None" deletes the whole of the buffer, whereas
"b = None" merely updates the variable b, with no effect on the buffer.
Buffer indexes start at zero, as is normal in Python. This differs from vim
line numbers, which start from 1. This is particularly relevant when dealing
with marks (see below) which use vim line numbers.
The buffer object attributes are:
b.vars Dictionary-like object used to access
|buffer-variable|s.
b.options Mapping object (supports item getting, setting and
deleting) that provides access to buffer-local options
and buffer-local values of |global-local| options. Use
|python-window|.options if option is window-local,
this object will raise KeyError. If option is
|global-local| and local value is missing getting it
will return None.
b.name String, RW. Contains buffer name (full path).
Note: when assigning to b.name |BufFilePre| and
|BufFilePost| autocommands are launched.
b.number Buffer number. Can be used as |python-buffers| key.
Read-only.
b.valid True or False. Buffer object becomes invalid when
corresponding buffer is wiped out.
The buffer object methods are:
b.append(str) Append a line to the buffer
b.append(str, nr) Idem, below line "nr"
b.append(list) Append a list of lines to the buffer
Note that the option of supplying a list of strings to
the append method differs from the equivalent method
for Python's built-in list objects.
b.append(list, nr) Idem, below line "nr"
b.mark(name) Return a tuple (row,col) representing the position
of the named mark (can also get the []"<> marks)
b.range(s,e) Return a range object (see |python-range|) which
represents the part of the given buffer between line
numbers s and e |inclusive|.
Note that when adding a line it must not contain a line break character '\n'.
A trailing '\n' is allowed and ignored, so that you can do: >
:py b.append(f.readlines())
Buffer object type is available using "Buffer" attribute of vim module.
Examples (assume b is the current buffer) >
:py print b.name # write the buffer file name
:py b[0] = "hello!!!" # replace the top line
:py b[:] = None # delete the whole buffer
:py del b[:] # delete the whole buffer
:py b[0:0] = [ "a line" ] # add a line at the top
:py del b[2] # delete a line (the third)
:py b.append("bottom") # add a line at the bottom
:py n = len(b) # number of lines
:py (row,col) = b.mark('a') # named mark
:py r = b.range(1,5) # a sub-range of the buffer
:py b.vars["foo"] = "bar" # assign b:foo variable
:py b.options["ff"] = "dos" # set fileformat
:py del b.options["ar"] # same as :set autoread<
==============================================================================
4. Range objects *python-range*
Range objects represent a part of a vim buffer. You can obtain them in a
number of ways:
- via vim.current.range (|python-current|)
- from a buffer's range() method (|python-buffer|)
A range object is almost identical in operation to a buffer object. However,
all operations are restricted to the lines within the range (this line range
can, of course, change as a result of slice assignments, line deletions, or
the range.append() method).
The range object attributes are:
r.start Index of first line into the buffer
r.end Index of last line into the buffer
The range object methods are:
r.append(str) Append a line to the range
r.append(str, nr) Idem, after line "nr"
r.append(list) Append a list of lines to the range
Note that the option of supplying a list of strings to
the append method differs from the equivalent method
for Python's built-in list objects.
r.append(list, nr) Idem, after line "nr"
Range object type is available using "Range" attribute of vim module.
Example (assume r is the current range):
# Send all lines in a range to the default printer
vim.command("%d,%dhardcopy!" % (r.start+1,r.end+1))
==============================================================================
5. Window objects *python-window*
Window objects represent vim windows. You can obtain them in a number of ways:
- via vim.current.window (|python-current|)
- from indexing vim.windows (|python-windows|)
- from indexing "windows" attribute of a tab page (|python-tabpage|)
- from the "window" attribute of a tab page (|python-tabpage|)
You can manipulate window objects only through their attributes. They have no
methods, and no sequence or other interface.
Window attributes are:
buffer (read-only) The buffer displayed in this window
cursor (read-write) The current cursor position in the window
This is a tuple, (row,col).
height (read-write) The window height, in rows
width (read-write) The window width, in columns
vars (read-only) The window |w:| variables. Attribute is
unassignable, but you can change window
variables this way
options (read-only) The window-local options. Attribute is
unassignable, but you can change window
options this way. Provides access only to
window-local options, for buffer-local use
|python-buffer| and for global ones use
|python-options|. If option is |global-local|
and local value is missing getting it will
return None.
number (read-only) Window number. The first window has number 1.
This is zero in case it cannot be determined
(e.g. when the window object belongs to other
tab page).
row, col (read-only) On-screen window position in display cells.
First position is zero.
tabpage (read-only) Window tab page.
valid (read-write) True or False. Window object becomes invalid
when corresponding window is closed.
The height attribute is writable only if the screen is split horizontally.
The width attribute is writable only if the screen is split vertically.
Window object type is available using "Window" attribute of vim module.
==============================================================================
6. Tab page objects *python-tabpage*
Tab page objects represent vim tab pages. You can obtain them in a number of
ways:
- via vim.current.tabpage (|python-current|)
- from indexing vim.tabpages (|python-tabpages|)
You can use this object to access tab page windows. They have no methods and
no sequence or other interfaces.
Tab page attributes are:
number The tab page number like the one returned by
|tabpagenr()|.
windows Like |python-windows|, but for current tab page.
vars The tab page |t:| variables.
window Current tabpage window.
valid True or False. Tab page object becomes invalid when
corresponding tab page is closed.
TabPage object type is available using "TabPage" attribute of vim module.
==============================================================================
7. vim.bindeval objects *python-bindeval-objects*
vim.Dictionary object *python-Dictionary*
Dictionary-like object providing access to vim |Dictionary| type.
Attributes:
Attribute Description ~
locked One of *python-.locked*
Value Description ~
zero Variable is not locked
vim.VAR_LOCKED Variable is locked, but can be unlocked
vim.VAR_FIXED Variable is locked and can't be unlocked
Read-write. You can unlock locked variable by assigning
`True` or `False` to this attribute. No recursive locking
is supported.
scope One of
Value Description ~
zero Dictionary is not a scope one
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
Methods (note: methods do not support keyword arguments):
Method Description ~
keys() Returns a list with dictionary keys.
values() Returns a list with dictionary values.
items() Returns a list of 2-tuples with dictionary contents.
update(iterable), update(dictionary), update(**kwargs)
Adds keys to dictionary.
get(key[, default=None])
Obtain key from dictionary, returning the default if it is
not present.
pop(key[, default])
Remove specified key from dictionary and return
corresponding value. If key is not found and default is
given returns the default, otherwise raises KeyError.
popitem()
Remove random key from dictionary and return (key, value)
pair.
has_key(key)
Check whether dictionary contains specified key, similar
to `key in dict`.
__new__(), __new__(iterable), __new__(dictionary), __new__(update)
You can use `vim.Dictionary()` to create new vim
dictionaries. `d=vim.Dictionary(arg)` is the same as
`d=vim.bindeval('{}');d.update(arg)`. Without arguments
constructs empty dictionary.
Examples: >
d = vim.Dictionary(food="bar") # Constructor
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
d.update(e='f') # .update(**kwargs)
d.update((('g', 'h'), ('i', 'j'))) # .update(iterable)
for key in d.keys(): # .keys()
for val in d.values(): # .values()
for key, val in d.items(): # .items()
print isinstance(d, vim.Dictionary) # True
for key in d: # Iteration over keys
class Dict(vim.Dictionary): # Subclassing
<
Note: when iterating over keys you should not modify dictionary.
vim.List object *python-List*
Sequence-like object providing access to vim |List| type.
Supports `.locked` attribute, see |python-.locked|. Also supports the
following methods:
Method Description ~
extend(item) Add items to the list.
__new__(), __new__(iterable)
You can use `vim.List()` to create new vim lists.
`l=vim.List(iterable)` is the same as
`l=vim.bindeval('[]');l.extend(iterable)`. Without
arguments constructs empty list.
Examples: >
l = vim.List("abc") # Constructor, result: ['a', 'b', 'c']
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
print l[0] # getting item
l[0] = 'mno' # assignment
for i in l: # iteration
print isinstance(l, vim.List) # True
class List(vim.List): # Subclassing
vim.Function object *python-Function*
Function-like object, acting like vim |Funcref| object. Supports `.name`
attribute and is callable. Accepts special keyword argument `self`, see
|Dictionary-function|. You can also use `vim.Function(name)` constructor,
it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
Examples: >
f = vim.Function('tr') # Constructor
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict
return self
endfunction
''')
f = vim.bindeval('function("DictFun")')
print f(self={}) # Like call('DictFun', [], {})
print isinstance(f, vim.Function) # True
==============================================================================
8. pyeval() and py3eval() Vim functions *python-pyeval*
To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
functions to evaluate Python expressions and pass their values to VimL.
==============================================================================
9. Dynamic loading *python-dynamic*
On MS-Windows the Python library can be loaded dynamically. The |:version|
output then includes |+python/dyn|.
This means that Vim will search for the Python DLL file only when needed.
When you don't use the Python interface you don't need it, thus you can use
Vim without this DLL file.
To use the Python interface the Python DLL must be in your search path. In a
console window type "path" to see what directories are used.
The name of the DLL must match the Python version Vim was compiled with.
Currently the name is "python24.dll". That is for Python 2.4. To know for
sure edit "gvim.exe" and search for "python\d*.dll\c".
==============================================================================
10. Python 3 *python3*
*:py3* *:python3*
The `:py3` and `:python3` commands work similar to `:python`. A simple check
if the `:py3` command is working: >
:py3 print("Hello")
< *:py3file*
The `:py3file` command works similar to `:pyfile`.
*:py3do* *E863*
The `:py3do` command works similar to `:pydo`.
Vim can be built in four ways (:version output):
1. No Python support (-python, -python3)
2. Python 2 support only (+python or +python/dyn, -python3)
3. Python 3 support only (-python, +python3 or +python3/dyn)
4. Python 2 and 3 support (+python/dyn, +python3/dyn)
Some more details on the special case 4: *python-2-and-3*
When Python 2 and Python 3 are both supported they must be loaded dynamically.
When doing this on Linux/Unix systems and importing global symbols, this leads
to a crash when the second Python version is used. So either global symbols
are loaded but only one Python version is activated, or no global symbols are
loaded. The latter makes Python's "import" fail on libraries that expect the
symbols to be provided by Vim.
*E836* *E837*
Vim's configuration script makes a guess for all libraries based on one
standard Python library (termios). If importing this library succeeds for
both Python versions, then both will be made available in Vim at the same
time. If not, only the version first used in a session will be enabled.
When trying to use the other one you will get the E836 or E837 error message.
Here Vim's behavior depends on the system in which it was configured. In a
system where both versions of Python were configured with --enable-shared,
both versions of Python will be activated at the same time. There will still
be problems with other third party libraries that were not linked to
libPython.
To work around such problems there are these options:
1. The problematic library is recompiled to link to the according
libpython.so.
2. Vim is recompiled for only one Python version.
3. You undefine PY_NO_RTLD_GLOBAL in auto/config.h after configuration. This
may crash Vim though.
*E880*
Raising SystemExit exception in python isn't endorsed way to quit vim, use: >
:py vim.command("qall!")
<
*has-python*
You can test what Python version is available with: >
if has('python')
echo 'there is Python 2.x'
elseif has('python3')
echo 'there is Python 3.x'
endif
Note however, that when Python 2 and 3 are both available and loaded
dynamically, these has() calls will try to load them. If only one can be
loaded at a time, just checking if Python 2 or 3 are available will prevent
the other one from being available.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,216 +0,0 @@
*if_ruby.txt* For Vim version 7.4. Last change: 2012 Aug 02
VIM REFERENCE MANUAL by Shugo Maeda
The Ruby Interface to Vim *ruby* *Ruby*
1. Commands |ruby-commands|
2. The VIM module |ruby-vim|
3. VIM::Buffer objects |ruby-buffer|
4. VIM::Window objects |ruby-window|
5. Global variables |ruby-globals|
6. Dynamic loading |ruby-dynamic|
{Vi does not have any of these commands}
*E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273*
The Ruby interface only works when Vim was compiled with the |+ruby| feature.
The home page for ruby is http://www.ruby-lang.org/. You can find links for
downloading Ruby there.
==============================================================================
1. Commands *ruby-commands*
*:ruby* *:rub*
:rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: >
:ruby print "Hello"
:rub[y] << {endpattern}
{script}
{endpattern}
Execute Ruby script {script}.
{endpattern} must NOT be preceded by any white space.
If {endpattern} is omitted, it defaults to a dot '.'
like for the |:append| and |:insert| commands. This
form of the |:ruby| command is mainly useful for
including ruby code in vim scripts.
Note: This command doesn't work when the Ruby feature
wasn't compiled in. To avoid errors, see
|script-here|.
Example Vim script: >
function! RedGem()
ruby << EOF
class Garnet
def initialize(s)
@buffer = VIM::Buffer.current
vimputs(s)
end
def vimputs(s)
@buffer.append(@buffer.count,s)
end
end
gem = Garnet.new("pretty")
EOF
endfunction
<
*:rubydo* *:rubyd* *E265*
:[range]rubyd[o] {cmd} Evaluate Ruby command {cmd} for each line in the
[range], with $_ being set to the text of each line in
turn, without a trailing <EOL>. Setting $_ will change
the text, but note that it is not possible to add or
delete lines using this command.
The default for [range] is the whole file: "1,$".
*:rubyfile* *:rubyf*
:rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as
":ruby load 'file'", but allows file name completion.
Executing Ruby commands is not possible in the |sandbox|.
==============================================================================
2. The VIM module *ruby-vim*
Ruby code gets all of its access to vim via the "VIM" module.
Overview >
print "Hello" # displays a message
VIM.command(cmd) # execute an Ex command
num = VIM::Window.count # gets the number of windows
w = VIM::Window[n] # gets window "n"
cw = VIM::Window.current # gets the current window
num = VIM::Buffer.count # gets the number of buffers
b = VIM::Buffer[n] # gets buffer "n"
cb = VIM::Buffer.current # gets the current buffer
w.height = lines # sets the window height
w.cursor = [row, col] # sets the window cursor position
pos = w.cursor # gets an array [row, col]
name = b.name # gets the buffer file name
line = b[n] # gets a line from the buffer
num = b.count # gets the number of lines
b[n] = str # sets a line in the buffer
b.delete(n) # deletes a line
b.append(n, str) # appends a line after n
line = VIM::Buffer.current.line # gets the current line
num = VIM::Buffer.current.line_number # gets the current line number
VIM::Buffer.current.line = "test" # sets the current line number
<
Module Functions:
*ruby-message*
VIM::message({msg})
Displays the message {msg}.
*ruby-set_option*
VIM::set_option({arg})
Sets a vim option. {arg} can be any argument that the ":set" command
accepts. Note that this means that no spaces are allowed in the
argument! See |:set|.
*ruby-command*
VIM::command({cmd})
Executes Ex command {cmd}.
*ruby-evaluate*
VIM::evaluate({expr})
Evaluates {expr} using the vim internal expression evaluator (see
|expression|). Returns the expression result as a string.
A |List| is turned into a string by joining the items and inserting
line breaks.
==============================================================================
3. VIM::Buffer objects *ruby-buffer*
VIM::Buffer objects represent vim buffers.
Class Methods:
current Returns the current buffer object.
count Returns the number of buffers.
self[{n}] Returns the buffer object for the number {n}. The first number
is 0.
Methods:
name Returns the name of the buffer.
number Returns the number of the buffer.
count Returns the number of lines.
length Returns the number of lines.
self[{n}] Returns a line from the buffer. {n} is the line number.
self[{n}] = {str}
Sets a line in the buffer. {n} is the line number.
delete({n}) Deletes a line from the buffer. {n} is the line number.
append({n}, {str})
Appends a line after the line {n}.
line Returns the current line of the buffer if the buffer is
active.
line = {str} Sets the current line of the buffer if the buffer is active.
line_number Returns the number of the current line if the buffer is
active.
==============================================================================
4. VIM::Window objects *ruby-window*
VIM::Window objects represent vim windows.
Class Methods:
current Returns the current window object.
count Returns the number of windows.
self[{n}] Returns the window object for the number {n}. The first number
is 0.
Methods:
buffer Returns the buffer displayed in the window.
height Returns the height of the window.
height = {n} Sets the window height to {n}.
width Returns the width of the window.
width = {n} Sets the window width to {n}.
cursor Returns a [row, col] array for the cursor position.
cursor = [{row}, {col}]
Sets the cursor position to {row} and {col}.
==============================================================================
5. Global variables *ruby-globals*
There are two global variables.
$curwin The current window object.
$curbuf The current buffer object.
==============================================================================
6. Dynamic loading *ruby-dynamic*
On MS-Windows and Unix the Ruby library can be loaded dynamically. The
|:version| output then includes |+ruby/dyn|.
This means that Vim will search for the Ruby DLL file or shared library only
when needed. When you don't use the Ruby interface you don't need it, thus
you can use Vim even though this library file is not on your system.
You need to install the right version of Ruby for this to work. You can find
the package to download from:
http://www.garbagecollect.jp/ruby/mswin32/en/download/release.html
Currently that is ruby-1.9.1-p429-i386-mswin32.zip
To use the Ruby interface the Ruby DLL must be in your search path. In a
console window type "path" to see what directories are used.
The name of the DLL must match the Ruby version Vim was compiled with.
Currently the name is "msvcrt-ruby191.dll". That is for Ruby 1.9.1. To know
for sure edit "gvim.exe" and search for "ruby\d*.dll\c".
If you want to build Vim with Ruby 1.9.1, you need to edit the config.h file
and comment-out the check for _MSC_VER.
You may also need to rename the include directory name to match the version,
strangely for Ruby 1.9.3 the directory is called 1.9.1.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,95 +0,0 @@
*if_sniff.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL
by Anton Leherbauer (toni@takefive.co.at)
SNiFF+ and Vim *sniff*
1. Introduction |sniff-intro|
2. Commands |sniff-commands|
3. Compiling Vim with SNiFF+ interface |sniff-compiling|
{Vi does not have any of these commands} *E275* *E274* *E276* *E278* *E279*
The SNiFF+ interface only works, when Vim was compiled with the |+sniff|
feature.
==============================================================================
1. Introduction *sniff-intro*
The following features for the use with SNiFF+ are available:
* Vim can be used for all editing requests
* SNiFF+ recognizes and updates all browsers when a file is saved in Vim
* SNiFF+ commands can be issued directly from Vim
How to use Vim with SNiFF+
1. Make sure SNiFF+ is running.
2. In the Editor view of the Preferences dialog set the Field named
'External Editor' to 'Emacs/Vim'.
4. Start Vim
5. Connect to SNiFF+ (:sniff connect)
Once a connection is established, SNiFF+ uses Vim for all requests to show or
edit source code. On the other hand, you can send queries to SNiFF+ with the
:sniff command.
==============================================================================
2. Commands *sniff-commands*
*:sniff* *:sni*
:sni[ff] request [symbol] Send request to sniff with optional symbol.
{not in Vi}
:sni[ff] Display all possible requests and the connection
status
Most requests require a symbol (identifier) as parameter. If it is omitted,
Vim will use the current word under the cursor.
The available requests are listed below:
request mapping description
-------------------------------------------------------------------------------
connect sc Establish connection with SNiFF+.
Make sure SNiFF+ is prepared for this in the
Preferences
disconnect sq Disconnect from SNiFF+. You can reconnect any
time with :sniff connect (or 'sc')
toggle st Toggle between implementation
and definition file
find-symbol sf Load the symbol into a Symbol Browser
browse-class sb Loads the class into a Class Browser
superclass ss Edit superclass of symbol
overridden so Edit overridden method of symbol
retrieve-file srf Retrieve symbol in current file
retrieve-project srp Retrieve symbol in current project
retrieve-all-projects srP Retrieve symbol in all projects
retrieve-next sR Retrieve symbol using current Retriever
settings
goto-symbol sg Goto definition or implementation of symbol
hierarchy sh Load symbol into the Hierarchy Browser
restr-hier sH same as above but show only related classes
xref-to sxt Start a refers-to query on symbol and
load the results into the Cross Referencer
xref-by sxb Start a referred-by query on symbol
xref-has sxh Start a refers-to components query on symbol
xref-used-by sxu Start a referred-by as component query on
symbol
show-docu sd Show documentation of symbol
gen-docu sD Generate documentation of symbol
The mappings are defined in a file 'sniff.vim', which is part of every SNiFF+
product ($SNIFF_DIR/config/sniff.vim). This file is sourced whenever Vim
connects to SNiFF+.
==============================================================================
3. Compiling Vim with SNiFF+ interface *sniff-compiling*
To compile Vim with SNiFF+ support, you need two source files of the extra
archive: if_sniff.c and if_sniff.h.
On Unix: Edit the Makefile and uncomment the line "--enable-sniff". Or run
configure manually with this argument.
On NT: Specify SNIFF=yes with your make command.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,533 +0,0 @@
*if_tcl.txt* For Vim version 7.4. Last change: 2012 Aug 02
VIM REFERENCE MANUAL by Ingo Wilken
The Tcl Interface to Vim *tcl* *Tcl* *TCL*
1. Commands |tcl-ex-commands|
2. Tcl commands |tcl-commands|
3. Tcl variables |tcl-variables|
4. Tcl window commands |tcl-window-cmds|
5. Tcl buffer commands |tcl-buffer-cmds|
6. Miscellaneous; Output from Tcl |tcl-misc| |tcl-output|
7. Known bugs & problems |tcl-bugs|
8. Examples |tcl-examples|
9. Dynamic loading |tcl-dynamic|
{Vi does not have any of these commands} *E280* *E281*
The Tcl interface only works when Vim was compiled with the |+tcl| feature.
WARNING: There are probably still some bugs. Please send bug reports,
comments, ideas etc to <Ingo.Wilken@informatik.uni-oldenburg.de>
==============================================================================
1. Commands *tcl-ex-commands* *E571* *E572*
*:tcl* *:tc*
:tc[l] {cmd} Execute Tcl command {cmd}. A simple check if `:tcl`
is working: >
:tcl puts "Hello"
:[range]tc[l] << {endmarker}
{script}
{endmarker}
Execute Tcl script {script}.
Note: This command doesn't work when the Tcl feature
wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like for
the |:append| and |:insert| commands.
This form of the |:tcl| command is mainly useful for including tcl code in Vim
scripts.
Example: >
function! DefineDate()
tcl << EOF
proc date {} {
return [clock format [clock seconds]]
}
EOF
endfunction
<
*:tcldo* *:tcld*
:[range]tcld[o] {cmd} Execute Tcl command {cmd} for each line in [range]
with the variable "line" being set to the text of each
line in turn, and "lnum" to the line number. Setting
"line" will change the text, but note that it is not
possible to add or delete lines using this command.
If {cmd} returns an error, the command is interrupted.
The default for [range] is the whole file: "1,$".
See |tcl-var-line| and |tcl-var-lnum|. {not in Vi}
*:tclfile* *:tclf*
:tclf[ile] {file} Execute the Tcl script in {file}. This is the same as
":tcl source {file}", but allows file name completion.
{not in Vi}
Note that Tcl objects (like variables) persist from one command to the next,
just as in the Tcl shell.
Executing Tcl commands is not possible in the |sandbox|.
==============================================================================
2. Tcl commands *tcl-commands*
Tcl code gets all of its access to vim via commands in the "::vim" namespace.
The following commands are implemented: >
::vim::beep # Guess.
::vim::buffer {n} # Create Tcl command for one buffer.
::vim::buffer list # Create Tcl commands for all buffers.
::vim::command [-quiet] {cmd} # Execute an Ex command.
::vim::expr {expr} # Use Vim's expression evaluator.
::vim::option {opt} # Get vim option.
::vim::option {opt} {val} # Set vim option.
::vim::window list # Create Tcl commands for all windows.
Commands:
::vim::beep *tcl-beep*
Honk. Does not return a result.
::vim::buffer {n} *tcl-buffer*
::vim::buffer exists {n}
::vim::buffer list
Provides access to vim buffers. With an integer argument, creates a
buffer command (see |tcl-buffer-cmds|) for the buffer with that
number, and returns its name as the result. Invalid buffer numbers
result in a standard Tcl error. To test for valid buffer numbers,
vim's internal functions can be used: >
set nbufs [::vim::expr bufnr("$")]
set isvalid [::vim::expr "bufexists($n)"]
< The "list" option creates a buffer command for each valid buffer, and
returns a list of the command names as the result.
Example: >
set bufs [::vim::buffer list]
foreach b $bufs { $b append end "The End!" }
< The "exists" option checks if a buffer with the given number exists.
Example: >
if { [::vim::buffer exists $n] } { ::vim::command ":e #$n" }
< This command might be replaced by a variable in future versions.
See also |tcl-var-current| for the current buffer.
::vim::command {cmd} *tcl-command*
::vim::command -quiet {cmd}
Execute the vim (ex-mode) command {cmd}. Any Ex command that affects
a buffer or window uses the current buffer/current window. Does not
return a result other than a standard Tcl error code. After this
command is completed, the "::vim::current" variable is updated.
The "-quiet" flag suppresses any error messages from vim.
Examples: >
::vim::command "set ts=8"
::vim::command "%s/foo/bar/g"
< To execute normal-mode commands, use "normal" (see |:normal|): >
set cmd "jj"
::vim::command "normal $cmd"
< See also |tcl-window-command| and |tcl-buffer-command|.
::vim::expr {expr} *tcl-expr*
Evaluates the expression {expr} using vim's internal expression
evaluator (see |expression|). Any expression that queries a buffer
or window property uses the current buffer/current window. Returns
the result as a string. A |List| is turned into a string by joining
the items and inserting line breaks.
Examples: >
set perl_available [::vim::expr has("perl")]
< See also |tcl-window-expr| and |tcl-buffer-expr|.
::vim::option {opt} *tcl-option*
::vim::option {opt} {value}
Without second argument, queries the value of a vim option. With this
argument, sets the vim option to {value}, and returns the previous
value as the result. Any options that are marked as 'local to buffer'
or 'local to window' affect the current buffer/current window. The
global value is not changed, use the ":set" command for that. For
boolean options, {value} should be "0" or "1", or any of the keywords
"on", "off" or "toggle". See |option-summary| for a list of options.
Example: >
::vim::option ts 8
< See also |tcl-window-option| and |tcl-buffer-option|.
::vim::window {option} *tcl-window*
Provides access to vim windows. Currently only the "list" option is
implemented. This creates a window command (see |tcl-window-cmds|) for
each window, and returns a list of the command names as the result.
Example: >
set wins [::vim::window list]
foreach w $wins { $w height 4 }
< This command might be replaced by a variable in future versions.
See also |tcl-var-current| for the current window.
==============================================================================
3. Tcl variables *tcl-variables*
The ::vim namespace contains a few variables. These are created when the Tcl
interpreter is called from vim and set to current values. >
::vim::current # array containing "current" objects
::vim::lbase # number of first line
::vim::range # array containing current range numbers
line # current line as a string (:tcldo only)
lnum # current line number (:tcldo only)
Variables:
::vim::current *tcl-var-current*
This is an array providing access to various "current" objects
available in vim. The contents of this array are updated after
"::vim::command" is called, as this might change vim's current
settings (e.g., by deleting the current buffer).
The "buffer" element contains the name of the buffer command for the
current buffer. This can be used directly to invoke buffer commands
(see |tcl-buffer-cmds|). This element is read-only.
Example: >
$::vim::current(buffer) insert begin "Hello world"
< The "window" element contains the name of the window command for the
current window. This can be used directly to invoke window commands
(see |tcl-window-cmds|). This element is read-only.
Example: >
$::vim::current(window) height 10
<
::vim::lbase *tcl-var-lbase*
This variable controls how Tcl treats line numbers. If it is set to
'1', then lines and columns start at 1. This way, line numbers from
Tcl commands and vim expressions are compatible. If this variable is
set to '0', then line numbers and columns start at 0 in Tcl. This is
useful if you want to treat a buffer as a Tcl list or a line as a Tcl
string and use standard Tcl commands that return an index ("lsort" or
"string first", for example). The default value is '1'. Currently,
any non-zero values is treated as '1', but your scripts should not
rely on this. See also |tcl-linenumbers|.
::vim::range *tcl-var-range*
This is an array with three elements, "start", "begin" and "end". It
contains the line numbers of the start and end row of the current
range. "begin" is the same as "start". This variable is read-only.
See |tcl-examples|.
line *tcl-var-line*
lnum *tcl-var-lnum*
These global variables are only available if the ":tcldo" Ex command
is being executed. They contain the text and line number of the
current line. When the Tcl command invoked by ":tcldo" is completed,
the current line is set to the contents of the "line" variable, unless
the variable was unset by the Tcl command. The "lnum" variable is
read-only. These variables are not in the "::vim" namespace so they
can be used in ":tcldo" without much typing (this might be changed in
future versions). See also |tcl-linenumbers|.
==============================================================================
4. Tcl window commands *tcl-window-cmds*
Window commands represent vim windows. They are created by several commands:
::vim::window list |tcl-window|
"windows" option of a buffer command |tcl-buffer-windows|
The ::vim::current(window) variable contains the name of the window command
for the current window. A window command is automatically deleted when the
corresponding vim window is closed.
Let's assume the name of the window command is stored in the Tcl variable "win",
i.e. "$win" calls the command. The following options are available: >
$win buffer # Create Tcl command for window's buffer.
$win command {cmd} # Execute Ex command in windows context.
$win cursor # Get current cursor position.
$win cursor {var} # Set cursor position from array variable.
$win cursor {row} {col} # Set cursor position.
$win delcmd {cmd} # Call Tcl command when window is closed.
$win expr {expr} # Evaluate vim expression in windows context.
$win height # Report the window's height.
$win height {n} # Set the window's height.
$win option {opt} [val] # Get/Set vim option in windows context.
Options:
$win buffer *tcl-window-buffer*
Creates a Tcl command for the window's buffer, and returns its name as
the result. The name should be stored in a variable: >
set buf [$win buffer]
< $buf is now a valid Tcl command. See |tcl-buffer-cmds| for the
available options.
$win cursor *tcl-window-cursor*
$win cursor {var}
$win cursor {row} {col}
Without argument, reports the current cursor position as a string.
This can be converted to a Tcl array variable: >
array set here [$win cursor]
< "here(row)" and "here(column)" now contain the cursor position.
With a single argument, the argument is interpreted as the name of a
Tcl array variable, which must contain two elements "row" and "column".
These are used to set the cursor to the new position: >
$win cursor here ;# not $here !
< With two arguments, sets the cursor to the specified row and column: >
$win cursor $here(row) $here(column)
< Invalid positions result in a standard Tcl error, which can be caught
with "catch". The row and column values depend on the "::vim::lbase"
variable. See |tcl-var-lbase|.
$win delcmd {cmd} *tcl-window-delcmd*
Registers the Tcl command {cmd} as a deletion callback for the window.
This command is executed (in the global scope) just before the window
is closed. Complex commands should be build with "list": >
$win delcmd [list puts vimerr "window deleted"]
< See also |tcl-buffer-delcmd|.
$win height *tcl-window-height*
$win height {n}
Without argument, reports the window's current height. With an
argument, tries to set the window's height to {n}, then reports the
new height (which might be different from {n}).
$win command [-quiet] {cmd} *tcl-window-command*
$win expr {expr} *tcl-window-expr*
$win option {opt} [val] *tcl-window-option*
These are similar to "::vim::command" etc., except that everything is
done in the context of the window represented by $win, instead of the
current window. For example, setting an option that is marked 'local
to window' affects the window $win. Anything that affects or queries
a buffer uses the buffer displayed in this window (i.e. the buffer
that is represented by "$win buffer"). See |tcl-command|, |tcl-expr|
and |tcl-option| for more information.
Example: >
$win option number on
==============================================================================
5. Tcl buffer commands *tcl-buffer-cmds*
Buffer commands represent vim buffers. They are created by several commands:
::vim::buffer {N} |tcl-buffer|
::vim::buffer list |tcl-buffer|
"buffer" option of a window command |tcl-window-buffer|
The ::vim::current(buffer) variable contains the name of the buffer command
for the current buffer. A buffer command is automatically deleted when the
corresponding vim buffer is destroyed. Whenever the buffer's contents are
changed, all marks in the buffer are automatically adjusted. Any changes to
the buffer's contents made by Tcl commands can be undone with the "undo" vim
command (see |undo|).
Let's assume the name of the buffer command is stored in the Tcl variable "buf",
i.e. "$buf" calls the command. The following options are available: >
$buf append {n} {str} # Append a line to buffer, after line {n}.
$buf command {cmd} # Execute Ex command in buffers context.
$buf count # Report number of lines in buffer.
$buf delcmd {cmd} # Call Tcl command when buffer is deleted.
$buf delete {n} # Delete a single line.
$buf delete {n} {m} # Delete several lines.
$buf expr {expr} # Evaluate vim expression in buffers context.
$buf get {n} # Get a single line as a string.
$buf get {n} {m} # Get several lines as a list.
$buf insert {n} {str} # Insert a line in buffer, as line {n}.
$buf last # Report line number of last line in buffer.
$buf mark {mark} # Report position of buffer mark.
$buf name # Report name of file in buffer.
$buf number # Report number of this buffer.
$buf option {opt} [val] # Get/Set vim option in buffers context.
$buf set {n} {text} # Replace a single line.
$buf set {n} {m} {list} # Replace several lines.
$buf windows # Create Tcl commands for buffer's windows.
<
*tcl-linenumbers*
Most buffer commands take line numbers as arguments. How Tcl treats these
numbers depends on the "::vim::lbase" variable (see |tcl-var-lbase|). Instead
of line numbers, several keywords can be also used: "top", "start", "begin",
"first", "bottom", "end" and "last".
Options:
$buf append {n} {str} *tcl-buffer-append*
$buf insert {n} {str} *tcl-buffer-insert*
Add a line to the buffer. With the "insert" option, the string
becomes the new line {n}, with "append" it is inserted after line {n}.
Example: >
$buf insert top "This is the beginning."
$buf append end "This is the end."
< To add a list of lines to the buffer, use a loop: >
foreach line $list { $buf append $num $line ; incr num }
<
$buf count *tcl-buffer-count*
Reports the total number of lines in the buffer.
$buf delcmd {cmd} *tcl-buffer-delcmd*
Registers the Tcl command {cmd} as a deletion callback for the buffer.
This command is executed (in the global scope) just before the buffer
is deleted. Complex commands should be build with "list": >
$buf delcmd [list puts vimerr "buffer [$buf number] gone"]
< See also |tcl-window-delcmd|.
$buf delete {n} *tcl-buffer-delete*
$buf delete {n} {m}
Deletes line {n} or lines {n} through {m} from the buffer.
This example deletes everything except the last line: >
$buf delete first [expr [$buf last] - 1]
<
$buf get {n} *tcl-buffer-get*
$buf get {n} {m}
Gets one or more lines from the buffer. For a single line, the result
is a string; for several lines, a list of strings.
Example: >
set topline [$buf get top]
<
$buf last *tcl-buffer-last*
Reports the line number of the last line. This value depends on the
"::vim::lbase" variable. See |tcl-var-lbase|.
$buf mark {mark} *tcl-buffer-mark*
Reports the position of the named mark as a string, similar to the
cursor position of the "cursor" option of a window command (see
|tcl-window-cursor|). This can be converted to a Tcl array variable: >
array set mpos [$buf mark "a"]
< "mpos(column)" and "mpos(row)" now contain the position of the mark.
If the mark is not set, a standard Tcl error results.
$buf name
Reports the name of the file in the buffer. For a buffer without a
file, this is an empty string.
$buf number
Reports the number of this buffer. See |:buffers|.
This example deletes a buffer from vim: >
::vim::command "bdelete [$buf number]"
<
$buf set {n} {string} *tcl-buffer-set*
$buf set {n} {m} {list}
Replace one or several lines in the buffer. If the list contains more
elements than there are lines to replace, they are inserted into the
buffer. If the list contains fewer elements, any unreplaced line is
deleted from the buffer.
$buf windows *tcl-buffer-windows*
Creates a window command for each window that displays this buffer, and
returns a list of the command names as the result.
Example: >
set winlist [$buf windows]
foreach win $winlist { $win height 4 }
< See |tcl-window-cmds| for the available options.
$buf command [-quiet] {cmd} *tcl-buffer-command*
$buf expr {expr} *tcl-buffer-expr*
$buf option {opt} [val] *tcl-buffer-option*
These are similar to "::vim::command" etc., except that everything is
done in the context of the buffer represented by $buf, instead of the
current buffer. For example, setting an option that is marked 'local
to buffer' affects the buffer $buf. Anything that affects or queries
a window uses the first window in vim's window list that displays this
buffer (i.e. the first entry in the list returned by "$buf windows").
See |tcl-command|, |tcl-expr| and |tcl-option| for more information.
Example: >
if { [$buf option modified] } { $buf command "w" }
==============================================================================
6. Miscellaneous; Output from Tcl *tcl-misc* *tcl-output*
The standard Tcl commands "exit" and "catch" are replaced by custom versions.
"exit" terminates the current Tcl script and returns to vim, which deletes the
Tcl interpreter. Another call to ":tcl" then creates a new Tcl interpreter.
"exit" does NOT terminate vim! "catch" works as before, except that it does
not prevent script termination from "exit". An exit code != 0 causes the ex
command that invoked the Tcl script to return an error.
Two new I/O streams are available in Tcl, "vimout" and "vimerr". All output
directed to them is displayed in the vim message area, as information messages
and error messages, respectively. The standard Tcl output streams stdout and
stderr are mapped to vimout and vimerr, so that a normal "puts" command can be
used to display messages in vim.
==============================================================================
7. Known bugs & problems *tcl-bugs*
Calling one of the Tcl Ex commands from inside Tcl (via "::vim::command") may
have unexpected side effects. The command creates a new interpreter, which
has the same abilities as the standard interpreter - making "::vim::command"
available in a safe child interpreter therefore makes the child unsafe. (It
would be trivial to block nested :tcl* calls or ensure that such calls from a
safe interpreter create only new safe interpreters, but quite pointless -
depending on vim's configuration, "::vim::command" may execute arbitrary code
in any number of other scripting languages.) A call to "exit" within this new
interpreter does not affect the old interpreter; it only terminates the new
interpreter, then script processing continues normally in the old interpreter.
Input from stdin is currently not supported.
==============================================================================
8. Examples: *tcl-examples*
Here are a few small (and maybe useful) Tcl scripts.
This script sorts the lines of the entire buffer (assume it contains a list
of names or something similar):
set buf $::vim::current(buffer)
set lines [$buf get top bottom]
set lines [lsort -dictionary $lines]
$buf set top bottom $lines
This script reverses the lines in the buffer. Note the use of "::vim::lbase"
and "$buf last" to work with any line number setting.
set buf $::vim::current(buffer)
set t $::vim::lbase
set b [$buf last]
while { $t < $b } {
set tl [$buf get $t]
set bl [$buf get $b]
$buf set $t $bl
$buf set $b $tl
incr t
incr b -1
}
This script adds a consecutive number to each line in the current range:
set buf $::vim::current(buffer)
set i $::vim::range(start)
set n 1
while { $i <= $::vim::range(end) } {
set line [$buf get $i]
$buf set $i "$n\t$line"
incr i ; incr n
}
The same can also be done quickly with two Ex commands, using ":tcldo":
:tcl set n 1
:[range]tcldo set line "$n\t$line" ; incr n
This procedure runs an Ex command on each buffer (idea stolen from Ron Aaron):
proc eachbuf { cmd } {
foreach b [::vim::buffer list] {
$b command $cmd
}
}
Use it like this:
:tcl eachbuf %s/foo/bar/g
Be careful with Tcl's string and backslash substitution, tough. If in doubt,
surround the Ex command with curly braces.
If you want to add some Tcl procedures permanently to vim, just place them in
a file (e.g. "~/.vimrc.tcl" on Unix machines), and add these lines to your
startup file (usually "~/.vimrc" on Unix):
if has("tcl")
tclfile ~/.vimrc.tcl
endif
==============================================================================
9. Dynamic loading *tcl-dynamic*
On MS-Windows the Tcl library can be loaded dynamically. The |:version|
output then includes |+tcl/dyn|.
This means that Vim will search for the Tcl DLL file only when needed. When
you don't use the Tcl interface you don't need it, thus you can use Vim
without this DLL file.
To use the Tcl interface the Tcl DLL must be in your search path. In a
console window type "path" to see what directories are used.
The name of the DLL must match the Tcl version Vim was compiled with.
Currently the name is "tcl83.dll". That is for Tcl 8.3. To know for sure
edit "gvim.exe" and search for "tcl\d*.dll\c".
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,885 +0,0 @@
*intro.txt* For Vim version 7.4. Last change: 2013 Jun 17
VIM REFERENCE MANUAL by Bram Moolenaar
Introduction to Vim *ref* *reference*
1. Introduction |intro|
2. Vim on the internet |internet|
3. Credits |credits|
4. Notation |notation|
5. Modes, introduction |vim-modes-intro|
6. Switching from mode to mode |mode-switching|
7. The window contents |window-contents|
8. Definitions |definitions|
==============================================================================
1. Introduction *intro*
Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many
improvements that a name change was appropriate. Vim is a text editor which
includes almost all the commands from the Unix program "Vi" and a lot of new
ones. It is very useful for editing programs and other plain text.
All commands are given with the keyboard. This has the advantage that you
can keep your fingers on the keyboard and your eyes on the screen. For those
who want it, there is mouse support and a GUI version with scrollbars and
menus (see |gui.txt|).
An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
|:help| command (just type ":help", without the bars or quotes).
The 'helpfile' option can be set to the name of the help file, in case it
is not located in the default place. You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
Throughout this manual the differences between Vi and Vim are mentioned in
curly braces, like this: {Vi does not have on-line help}. See |vi_diff.txt|
for a summary of the differences between Vim and Vi.
This manual refers to Vim on various machines. There may be small differences
between different computers and terminals. Besides the remarks given in this
document, there is a separate document for each supported system, see
|sys-file-list|.
*pronounce*
Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a
capital, since it's a name, again like Jim.
This manual is a reference for all the Vim commands and options. This is not
an introduction to the use of Vi or Vim, it gets a bit complicated here and
there. For beginners, there is a hands-on |tutor|. To learn using Vim, read
the user manual |usr_toc.txt|.
*book*
There are many books on Vi that contain a section for beginners. There are
two books I can recommend:
"Vim - Vi Improved" by Steve Oualline
This is the very first book completely dedicated to Vim. It is very good for
beginners. The most often used commands are explained with pictures and
examples. The less often used commands are also explained, the more advanced
features are summarized. There is a comprehensive index and a quick
reference. Parts of this book have been included in the user manual
|frombook|.
Published by New Riders Publishing. ISBN: 0735710015
For more information try one of these:
http://iccf-holland.org/click5.html
http://www.vim.org/iccf/click5.html
"Learning the Vi editor" by Linda Lamb and Arnold Robbins
This is a book about Vi that includes a chapter on Vim (in the sixth edition).
The first steps in Vi are explained very well. The commands that Vim adds are
only briefly mentioned. There is also a German translation.
Published by O'Reilly. ISBN: 1-56592-426-6.
==============================================================================
2. Vim on the internet *internet*
*www* *WWW* *faq* *FAQ* *distribution* *download*
The Vim pages contain the most recent information about Vim. They also
contain links to the most recent version of Vim. The FAQ is a list of
Frequently Asked Questions. Read this if you have problems.
VIM home page: http://www.vim.org/
VIM FAQ: http://vimdoc.sf.net/
Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS
Usenet News group where Vim is discussed: *news* *usenet*
comp.editors
This group is also for other editors. If you write about Vim, don't forget to
mention that.
*mail-list* *maillist*
There are several mailing lists for Vim:
<vim@vim.org>
For discussions about using existing versions of Vim: Useful mappings,
questions, answers, where to get a specific version, etc. There are
quite a few people watching this list and answering questions, also
for beginners. Don't hesitate to ask your question here.
<vim-dev@vim.org> *vim-dev* *vimdev*
For discussions about changing Vim: New features, porting, patches,
beta-test versions, etc.
<vim-announce@vim.org> *vim-announce*
Announcements about new versions of Vim; also for beta-test versions
and ports to different systems. This is a read-only list.
<vim-multibyte@vim.org> *vim-multibyte*
For discussions about using and improving the multi-byte aspects of
Vim.
<vim-mac@vim.org> *vim-mac*
For discussions about using and improving the Macintosh version of
Vim.
See http://www.vim.org/maillist.php for the latest information.
NOTE:
- You can only send messages to these lists if you have subscribed!
- You need to send the messages from the same location as where you subscribed
from (to avoid spam mail).
- Maximum message size is 40000 characters.
*subscribe-maillist*
If you want to join, send a message to
<vim-subscribe@vim.org>
Make sure that your "From:" address is correct. Then the list server will
give you help on how to subscribe.
*maillist-archive*
For more information and archives look on the Vim maillist page:
http://www.vim.org/maillist.php
Bug reports: *bugs* *bug-reports* *bugreport.vim*
Send bug reports to: Vim Developers <vim_dev@vim.org>
This is a maillist, many people will see the message. If you don't want that,
e.g. because it is a security issue, send it to <bugs@vim.org>, this only goes
to the Vim maintainer (that's Bram).
Please be brief; all the time that is spent on answering mail is subtracted
from the time that is spent on improving Vim! Always give a reproducible
example and try to find out which settings or other things influence the
appearance of the bug. Try different machines, if possible. Send me patches
if you can!
It will help to include information about the version of Vim you are using and
your setup. You can get the information with this command: >
:so $VIMRUNTIME/bugreport.vim
This will create a file "bugreport.txt" in the current directory, with a lot
of information of your environment. Before sending this out, check if it
doesn't contain any confidential information!
If Vim crashes, please try to find out where. You can find help on this here:
|debug.txt|.
In case of doubt or when you wonder if the problem has already been fixed but
you can't find a fix for it, become a member of the vim-dev maillist and ask
your question there. |maillist|
*year-2000* *Y2K*
Since Vim internally doesn't use dates for editing, there is no year 2000
problem to worry about. Vim does use the time in the form of seconds since
January 1st 1970. It is used for a time-stamp check of the edited file and
the swap file, which is not critical and should only cause warning messages.
There might be a year 2038 problem, when the seconds don't fit in a 32 bit int
anymore. This depends on the compiler, libraries and operating system.
Specifically, time_t and the ctime() function are used. And the time_t is
stored in four bytes in the swap file. But that's only used for printing a
file date/time for recovery, it will never affect normal editing.
The Vim strftime() function directly uses the strftime() system function.
localtime() uses the time() system function. getftime() uses the time
returned by the stat() system function. If your system libraries are year
2000 compliant, Vim is too.
The user may create scripts for Vim that use external commands. These might
introduce Y2K problems, but those are not really part of Vim itself.
==============================================================================
3. Credits *credits* *author* *Bram* *Moolenaar*
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
Parts of the documentation come from several Vi manuals, written by:
W.N. Joy
Alan P.W. Hewett
Mark Horton
The Vim editor is based on Stevie and includes (ideas from) other software,
worked on by the people mentioned here. Other people helped by sending me
patches, suggestions and giving feedback about what is good and bad in Vim.
Vim would never have become what it is now, without the help of these people!
Ron Aaron Win32 GUI changes
Mohsin Ahmed encryption
Zoltan Arpadffy work on VMS port
Tony Andrews Stevie
Gert van Antwerpen changes for DJGPP on MS-DOS
Berkeley DB(3) ideas for swap file implementation
Keith Bostic Nvi
Walter Briscoe Makefile updates, various patches
Ralf Brown SPAWNO library for MS-DOS
Robert Colon many useful remarks
Marcin Dalecki GTK+ GUI port, toolbar icons, gettext()
Kayhan Demirel sent me news in Uganda
Chris & John Downey xvi (ideas for multi-windows version)
Henk Elbers first VMS port
Daniel Elstner GTK+ 2 port
Eric Fischer Mac port, 'cindent', and other improvements
Benji Fisher Answering lots of user questions
Bill Foster Athena GUI port
Google Lets me work on Vim one day a week
Loic Grenie xvim (ideas for multi windows version)
Sven Guckes Vim promoter and previous WWW page maintainer
Darren Hiebert Exuberant ctags
Jason Hildebrand GTK+ 2 port
Bruce Hunsaker improvements for VMS port
Andy Kahn Cscope support, GTK+ GUI port
Oezguer Kesim Maintainer of Vim Mailing Lists
Axel Kielhorn work on the Macintosh port
Steve Kirkendall Elvis
Roger Knobbe original port to Windows NT
Sergey Laskavy Vim's help from Moscow
Felix von Leitner Previous maintainer of Vim Mailing Lists
David Leonard Port of Python extensions to Unix
Avner Lottem Edit in right-to-left windows
Flemming Madsen X11 client-server, various features and patches
Tony Mechelynck answers many user questions
Paul Moore Python interface extensions, many patches
Katsuhito Nagano Work on multi-byte versions
Sung-Hyun Nam Work on multi-byte versions
Vince Negri Win32 GUI and generic console enhancements
Steve Oualline Author of the first Vim book |frombook|
Dominique Pelle valgrind reports and many fixes
A.Politz Many bug reports and some fixes
George V. Reilly Win32 port, Win32 GUI start-off
Stephen Riehm bug collector
Stefan Roemer various patches and help to users
Ralf Schandl IBM OS/390 port
Olaf Seibert DICE and BeBox version, regexp improvements
Mortaza Shiran Farsi patches
Peter da Silva termlib
Paul Slootman OS/2 port
Henry Spencer regular expressions
Dany St-Amant Macintosh port
Tim Thompson Stevie
G. R. (Fred) Walter Stevie
Sven Verdoolaege Perl interface
Robert Webb Command-line completion, GUI versions, and
lots of patches
Ingo Wilken Tcl interface
Mike Williams PostScript printing
Juergen Weigert Lattice version, AUX improvements, UNIX and
MS-DOS ports, autoconf
Stefan 'Sec' Zehl Maintainer of vim.org
I wish to thank all the people that sent me bug reports and suggestions. The
list is too long to mention them all here. Vim would not be the same without
the ideas from all these people: They keep Vim alive!
*love* *peace* *friendship* *gross-national-happiness*
In this documentation there are several references to other versions of Vi:
*Vi* *vi*
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Sometimes other versions are referred
to. Only runs under Unix. Source code only available with a
license. More information on Vi can be found through:
http://vi-editor.org [doesn't currently work...]
*Posix*
Posix From the IEEE standard 1003.2, Part 2: Shell and utilities.
Generally known as "Posix". This is a textual description of
how Vi is supposed to work.
See |posix-compliance|.
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
(10/23/96)". There has been no release the last few years, although
there is a development version 1.81.
Source code is freely available.
*Elvis*
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
as flexible as Vim.
The version used is 2.1. It is still being developed. Source code is
freely available.
==============================================================================
4. Notation *notation*
When syntax highlighting is used to read this, text that is not typed
literally is often highlighted with the Special group. These are items in [],
{} and <>, and CTRL-X.
Note that Vim uses all possible characters in commands. Sometimes the [], {}
and <> are part of what you type, the context should make this clear.
[] Characters in square brackets are optional.
*count* *[count]*
[count] An optional number that may precede the command to multiply
or iterate the command. If no number is given, a count of one
is used, unless otherwise noted. Note that in this manual the
[count] is not mentioned in the description of the command,
but only in the explanation. This was done to make the
commands easier to look up. If the 'showcmd' option is on,
the (partially) entered count is shown at the bottom of the
window. You can use <Del> to erase the last digit (|N<Del>|).
*[quotex]*
["x] An optional register designation where text can be stored.
See |registers|. The x is a single character between 'a' and
'z' or 'A' and 'Z' or '"', and in some cases (with the put
command) between '0' and '9', '%', '#', or others. The
uppercase and lowercase letter designate the same register,
but the lowercase letter is used to overwrite the previous
register contents, while the uppercase letter is used to
append to the previous register contents. Without the ""x" or
with """" the stored text is put into the unnamed register.
*{}*
{} Curly braces denote parts of the command which must appear,
but which can take a number of different values. The
differences between Vim and Vi are also given in curly braces
(this will be clear from the context).
*{char1-char2}*
{char1-char2} A single character from the range char1 to char2. For
example: {a-z} is a lowercase letter. Multiple ranges may be
concatenated. For example, {a-zA-Z0-9} is any alphanumeric
character.
*{motion}* *movement*
{motion} A command that moves the cursor. These are explained in
|motion.txt|. Examples:
w to start of next word
b to begin of current word
4j four lines down
/The<CR> to next occurrence of "The"
This is used after an |operator| command to move over the text
that is to be operated upon.
- If the motion includes a count and the operator also has a
count, the two counts are multiplied. For example: "2d3w"
deletes six words.
- The motion can be backwards, e.g. "db" to delete to the
start of the word.
- The motion can also be a mouse click. The mouse is not
supported in every terminal though.
- The ":omap" command can be used to map characters while an
operator is pending.
- Ex commands can be used to move the cursor. This can be
used to call a function that does some complicated motion.
The motion is always characterwise exclusive, no matter
what ":" command is used. This means it's impossible to
include the last character of a line without the line break
(unless 'virtualedit' is set).
If the Ex command changes the text before where the operator
starts or jumps to another buffer the result is
unpredictable. It is possible to change the text further
down. Jumping to another buffer is possible if the current
buffer is not unloaded.
*{Visual}*
{Visual} A selected text area. It is started with the "v", "V", or
CTRL-V command, then any cursor movement command can be used
to change the end of the selected text.
This is used before an |operator| command to highlight the
text that is to be operated upon.
See |Visual-mode|.
*<character>*
<character> A special character from the table below, optionally with
modifiers, or a single ASCII character with modifiers.
*'character'*
'c' A single ASCII character.
*CTRL-{char}*
CTRL-{char} {char} typed as a control character; that is, typing {char}
while holding the CTRL key down. The case of {char} does not
matter; thus CTRL-A and CTRL-a are equivalent. But on some
terminals, using the SHIFT key will produce another code,
don't use it then.
*'option'*
'option' An option, or parameter, that can be set to a value, is
enclosed in single quotes. See |options|.
*quotecommandquote*
"command" A reference to a command that you can type is enclosed in
double quotes.
`command` New style command, this distinguishes it from other quoted
text and strings.
*key-notation* *key-codes* *keycodes*
These names for keys are used in the documentation. They can also be used
with the ":map" command (insert the key name by pressing CTRL-K and then the
key you want the name for).
notation meaning equivalent decimal value(s) ~
-----------------------------------------------------------------------
<Nul> zero CTRL-@ 0 (stored as 10) *<Nul>*
<BS> backspace CTRL-H 8 *backspace*
<Tab> tab CTRL-I 9 *tab* *Tab*
*linefeed*
<NL> linefeed CTRL-J 10 (used for <Nul>)
<FF> formfeed CTRL-L 12 *formfeed*
<CR> carriage return CTRL-M 13 *carriage-return*
<Return> same as <CR> *<Return>*
<Enter> same as <CR> *<Enter>*
<Esc> escape CTRL-[ 27 *escape* *<Esc>*
<Space> space 32 *space*
<lt> less-than < 60 *<lt>*
<Bslash> backslash \ 92 *backslash* *<Bslash>*
<Bar> vertical bar | 124 *<Bar>*
<Del> delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
<xCSI> CSI when typed in the GUI *<xCSI>*
<EOL> end-of-line (can be <CR>, <LF> or <CR><LF>,
depends on system and 'fileformat') *<EOL>*
<Up> cursor-up *cursor-up* *cursor_up*
<Down> cursor-down *cursor-down* *cursor_down*
<Left> cursor-left *cursor-left* *cursor_left*
<Right> cursor-right *cursor-right* *cursor_right*
<S-Up> shift-cursor-up
<S-Down> shift-cursor-down
<S-Left> shift-cursor-left
<S-Right> shift-cursor-right
<C-Left> control-cursor-left
<C-Right> control-cursor-right
<F1> - <F12> function keys 1 to 12 *function_key* *function-key*
<S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>*
<Help> help key
<Undo> undo key
<Insert> insert key
<Home> home *home*
<End> end *end*
<PageUp> page-up *page_up* *page-up*
<PageDown> page-down *page_down* *page-down*
<kHome> keypad home (upper left) *keypad-home*
<kEnd> keypad end (lower left) *keypad-end*
<kPageUp> keypad page-up (upper right) *keypad-page-up*
<kPageDown> keypad page-down (lower right) *keypad-page-down*
<kPlus> keypad + *keypad-plus*
<kMinus> keypad - *keypad-minus*
<kMultiply> keypad * *keypad-multiply*
<kDivide> keypad / *keypad-divide*
<kEnter> keypad Enter *keypad-enter*
<kPoint> keypad Decimal point *keypad-point*
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
<S-...> shift-key *shift* *<S-*
<C-...> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *meta* *alt* *<M-*
<A-...> same as <M-...> *<A-*
<D-...> command-key (Macintosh only) *<D-*
<t_xx> key with "xx" entry in termcap
-----------------------------------------------------------------------
Note: The shifted cursor keys, the help key, and the undo key are only
available on a few terminals. On the Amiga, shifted function key 10 produces
a code (CSI) that is also used by key sequences. It will be recognized only
after typing another key.
Note: There are two codes for the delete key. 127 is the decimal ASCII value
for the delete key, which is always recognized. Some delete keys send another
value, in which case this value is obtained from the termcap entry "kD". Both
values have the same effect. Also see |:fixdel|.
Note: The keypad keys are used in the same way as the corresponding "normal"
keys. For example, <kHome> has the same effect as <Home>. If a keypad key
sends the same raw key code as its non-keypad equivalent, it will be
recognized as the non-keypad code. For example, when <kHome> sends the same
code as <Home>, when pressing <kHome> Vim will think <Home> was pressed.
Mapping <kHome> will not work then.
*<>*
Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with
the ":map" command. The rules are:
1. Any printable characters are typed directly, except backslash and '<'
2. A backslash is represented with "\\", double backslash, or "<Bslash>".
3. A real '<' is represented with "\<" or "<lt>". When there is no
confusion possible, a '<' can be used directly.
4. "<key>" means the special key typed. This is the notation explained in
the table above. A few examples:
<Esc> Escape key
<C-G> CTRL-G
<Up> cursor up key
<C-LeftMouse> Control- left mouse click
<S-F11> Shifted function key 11
<M-a> Meta- a ('a' with bit 8 set)
<M-A> Meta- A ('A' with bit 8 set)
<t_kd> "kd" termcap entry (cursor down key)
If you want to use the full <> notation in Vim, you have to make sure the '<'
flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is
by default). >
:set cpo-=<
The <> notation uses <lt> to escape the special meaning of key names. Using a
backslash also works, but only when 'cpoptions' does not include the 'B' flag.
Examples for mapping CTRL-H to the six characters "<Home>": >
:imap <C-H> \<Home>
:imap <C-H> <lt>Home>
The first one only works when the 'B' flag is not in 'cpoptions'. The second
one always works.
To get a literal "<lt>" in a mapping: >
:map <C-L> <lt>lt>
For mapping, abbreviation and menu commands you can then copy-paste the
examples and use them directly. Or type them literally, including the '<' and
'>' characters. This does NOT work for other commands, like ":set" and
":autocmd"!
==============================================================================
5. Modes, introduction *vim-modes-intro* *vim-modes*
Vim has six BASIC modes:
*Normal* *Normal-mode* *command-mode*
Normal mode In Normal mode you can enter all the normal editor
commands. If you start the editor you are in this
mode (unless you have set the 'insertmode' option,
see below). This is also known as command mode.
Visual mode This is like Normal mode, but the movement commands
extend a highlighted area. When a non-movement
command is used, it is executed for the highlighted
area. See |Visual-mode|.
If the 'showmode' option is on "-- VISUAL --" is shown
at the bottom of the window.
Select mode This looks most like the MS-Windows selection mode.
Typing a printable character deletes the selection
and starts Insert mode. See |Select-mode|.
If the 'showmode' option is on "-- SELECT --" is shown
at the bottom of the window.
Insert mode In Insert mode the text you type is inserted into the
buffer. See |Insert-mode|.
If the 'showmode' option is on "-- INSERT --" is shown
at the bottom of the window.
Command-line mode In Command-line mode (also called Cmdline mode) you
Cmdline mode can enter one line of text at the bottom of the
window. This is for the Ex commands, ":", the pattern
search commands, "?" and "/", and the filter command,
"!". |Cmdline-mode|
Ex mode Like Command-line mode, but after entering a command
you remain in Ex mode. Very limited editing of the
command line. |Ex-mode|
There are six ADDITIONAL modes. These are variants of the BASIC modes:
*Operator-pending* *Operator-pending-mode*
Operator-pending mode This is like Normal mode, but after an operator
command has started, and Vim is waiting for a {motion}
to specify the text that the operator will work on.
Replace mode Replace mode is a special case of Insert mode. You
can do the same things as in Insert mode, but for
each character you enter, one character of the existing
text is deleted. See |Replace-mode|.
If the 'showmode' option is on "-- REPLACE --" is
shown at the bottom of the window.
Virtual Replace mode Virtual Replace mode is similar to Replace mode, but
instead of file characters you are replacing screen
real estate. See |Virtual-Replace-mode|.
If the 'showmode' option is on "-- VREPLACE --" is
shown at the bottom of the window.
Insert Normal mode Entered when CTRL-O given in Insert mode. This is
like Normal mode, but after executing one command Vim
returns to Insert mode.
If the 'showmode' option is on "-- (insert) --" is
shown at the bottom of the window.
Insert Visual mode Entered when starting a Visual selection from Insert
mode, e.g., by using CTRL-O and then "v", "V" or
CTRL-V. When the Visual selection ends, Vim returns
to Insert mode.
If the 'showmode' option is on "-- (insert) VISUAL --"
is shown at the bottom of the window.
Insert Select mode Entered when starting Select mode from Insert mode.
E.g., by dragging the mouse or <S-Right>.
When the Select mode ends, Vim returns to Insert mode.
If the 'showmode' option is on "-- (insert) SELECT --"
is shown at the bottom of the window.
==============================================================================
6. Switching from mode to mode *mode-switching*
If for any reason you do not know which mode you are in, you can always get
back to Normal mode by typing <Esc> twice. This doesn't work for Ex mode
though, use ":visual".
You will know you are back in Normal mode when you see the screen flash or
hear the bell after you type <Esc>. However, when pressing <Esc> after using
CTRL-O in Insert mode you get a beep but you are still in Insert mode, type
<Esc> again.
*i_esc*
TO mode ~
Normal Visual Select Insert Replace Cmd-line Ex ~
FROM mode ~
Normal v V ^V *4 *1 R gR : / ? ! Q
Visual *2 ^G c C -- : --
Select *5 ^O ^G *6 -- -- --
Insert <Esc> -- -- <Insert> -- --
Replace <Esc> -- -- <Insert> -- --
Command-line *3 -- -- :start -- --
Ex :vi -- -- -- -- --
-- not possible
*1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
"A", "o", "O", "c", "C", "s" or S".
*2 Go from Visual mode to Normal mode by giving a non-movement command, which
causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
(see |v_v|), which just stops Visual mode without side effects.
*3 Go from Command-line mode to Normal mode by:
- Hitting <CR> or <NL>, which causes the entered command to be executed.
- Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
- Hitting CTRL-C or <Esc>, which quits the command-line without executing
the command.
In the last case <Esc> may be the character defined with the 'wildchar'
option, in which case it will start command-line completion. You can
ignore that and type <Esc> again. {Vi: when hitting <Esc> the command-line
is executed. This is unexpected for most people; therefore it was changed
in Vim. But when the <Esc> is part of a mapping, the command-line is
executed. If you want the Vi behaviour also when typing <Esc>, use ":cmap
^V<Esc> ^V^M"}
*4 Go from Normal to Select mode by:
- use the mouse to select text while 'selectmode' contains "mouse"
- use a non-printable command to move the cursor while keeping the Shift
key pressed, and the 'selectmode' option contains "key"
- use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd"
- use "gh", "gH" or "g CTRL-H" |g_CTRL-H|
*5 Go from Select mode to Normal mode by using a non-printable command to move
the cursor, without keeping the Shift key pressed.
*6 Go from Select mode to Insert mode by typing a printable character. The
selection is deleted and the character is inserted.
If the 'insertmode' option is on, editing a file will start in Insert mode.
*CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
Normal mode from any other mode. This can be used to make sure Vim is in
Normal mode, without causing a beep like <Esc> would. However, this does not
work in Ex mode. When used after a command that takes an argument, such as
|f| or |m|, the timeout set with 'ttimeoutlen' applies.
*CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G*
The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
'insertmode' is set. Otherwise it goes to Normal mode. This can be used to
make sure Vim is in the mode indicated by 'insertmode', without knowing in
what mode Vim currently is.
*Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
Q Switch to "Ex" mode. This is a bit like typing ":"
commands one after another, except:
- You don't have to keep pressing ":".
- The screen doesn't get updated after each command.
- There is no normal command-line editing.
- Mappings and abbreviations are not used.
In fact, you are editing the lines with the "standard"
line-input editing commands (<Del> or <BS> to erase,
CTRL-U to kill the whole line).
Vim will enter this mode by default if it's invoked as
"ex" on the command-line.
Use the ":vi" command |:visual| to exit "Ex" mode.
Note: In older versions of Vim "Q" formatted text,
that is now done with |gq|. But if you use the
|vimrc_example.vim| script "Q" works like "gq".
*gQ*
gQ Switch to "Ex" mode like with "Q", but really behave
like typing ":" commands after another. All command
line editing, completion etc. is available.
Use the ":vi" command |:visual| to exit "Ex" mode.
{not in Vi}
==============================================================================
7. The window contents *window-contents*
In Normal mode and Insert/Replace mode the screen window will show the current
contents of the buffer: What You See Is What You Get. There are two
exceptions:
- When the 'cpoptions' option contains '$', and the change is within one line,
the text is not directly deleted, but a '$' is put at the last deleted
character.
- When inserting text in one window, other windows on the same text are not
updated until the insert is finished.
{Vi: The screen is not always updated on slow terminals}
Lines longer than the window width will wrap, unless the 'wrap' option is off
(see below). The 'linebreak' option can be set to wrap at a blank character.
If the window has room after the last line of the buffer, Vim will show '~' in
the first column of the last lines in the window, like this:
+-----------------------+
|some line |
|last line |
|~ |
|~ |
+-----------------------+
Thus the '~' lines indicate that the end of the buffer was reached.
If the last line in a window doesn't fit, Vim will indicate this with a '@' in
the first column of the last lines in the window, like this:
+-----------------------+
|first line |
|second line |
|@ |
|@ |
+-----------------------+
Thus the '@' lines indicate that there is a line that doesn't fit in the
window.
When the "lastline" flag is present in the 'display' option, you will not see
'@' characters at the left side of window. If the last line doesn't fit
completely, only the part that fits is shown, and the last three characters of
the last line are replaced with "@@@", like this:
+-----------------------+
|first line |
|second line |
|a very long line that d|
|oesn't fit in the wi@@@|
+-----------------------+
If there is a single line that is too long to fit in the window, this is a
special situation. Vim will show only part of the line, around where the
cursor is. There are no special characters shown, so that you can edit all
parts of this line.
{Vi: gives an "internal error" on lines that do not fit in the window}
The '@' occasion in the 'highlight' option can be used to set special
highlighting for the '@' and '~' characters. This makes it possible to
distinguish them from real characters in the buffer.
The 'showbreak' option contains the string to put in front of wrapped lines.
*wrap-off*
If the 'wrap' option is off, long lines will not wrap. Only the part that
fits on the screen is shown. If the cursor is moved to a part of the line
that is not shown, the screen is scrolled horizontally. The advantage of
this method is that columns are shown as they are and lines that cannot fit
on the screen can be edited. The disadvantage is that you cannot see all the
characters of a line at once. The 'sidescroll' option can be set to the
minimal number of columns to scroll. {Vi: has no 'wrap' option}
All normal ASCII characters are displayed directly on the screen. The <Tab>
is replaced with the number of spaces that it represents. Other non-printing
characters are replaced with "^{char}", where {char} is the non-printing
character with 64 added. Thus character 7 (bell) will be shown as "^G".
Characters between 127 and 160 are replaced with "~{char}", where {char} is
the character with 64 subtracted. These characters occupy more than one
position on the screen. The cursor can only be positioned on the first one.
If you set the 'number' option, all lines will be preceded with their
number. Tip: If you don't like wrapping lines to mix with the line numbers,
set the 'showbreak' option to eight spaces:
":set showbreak=\ \ \ \ \ \ \ \ "
If you set the 'list' option, <Tab> characters will not be shown as several
spaces, but as "^I". A '$' will be placed at the end of the line, so you can
find trailing blanks.
In Command-line mode only the command-line itself is shown correctly. The
display of the buffer contents is updated as soon as you go back to Command
mode.
The last line of the window is used for status and other messages. The
status messages will only be used if an option is on:
status message option default Unix default ~
current mode 'showmode' on on
command characters 'showcmd' on off
cursor position 'ruler' off off
The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The
command characters are those that you typed but were not used yet. {Vi: does
not show the characters you typed or the cursor position}
If you have a slow terminal you can switch off the status messages to speed
up editing:
:set nosc noru nosm
If there is an error, an error message will be shown for at least one second
(in reverse video). {Vi: error messages may be overwritten with other
messages before you have a chance to read them}
Some commands show how many lines were affected. Above which threshold this
happens can be controlled with the 'report' option (default 2).
On the Amiga Vim will run in a CLI window. The name Vim and the full name of
the current file name will be shown in the title bar. When the window is
resized, Vim will automatically redraw the window. You may make the window as
small as you like, but if it gets too small not a single line will fit in it.
Make it at least 40 characters wide to be able to read most messages on the
last line.
On most Unix systems, resizing the window is recognized and handled correctly
by Vim. {Vi: not ok}
==============================================================================
8. Definitions *definitions*
screen The whole area that Vim uses to work in. This can be
a terminal emulator window. Also called "the Vim
window".
window A view on a buffer.
A screen contains one or more windows, separated by status lines and with the
command line at the bottom.
+-------------------------------+
screen | window 1 | window 2 |
| | |
| | |
|= status line =|= status line =|
| window 3 |
| |
| |
|==== status line ==============|
|command line |
+-------------------------------+
The command line is also used for messages. It scrolls up the screen when
there is not enough room in the command line.
A difference is made between four types of lines:
buffer lines The lines in the buffer. This is the same as the
lines as they are read from/written to a file. They
can be thousands of characters long.
logical lines The buffer lines with folding applied. Buffer lines
in a closed fold are changed to a single logical line:
"+-- 99 lines folded". They can be thousands of
characters long.
window lines The lines displayed in a window: A range of logical
lines with wrapping, line breaks, etc. applied. They
can only be as long as the width of the window allows,
longer lines are wrapped or truncated.
screen lines The lines of the screen that Vim uses. Consists of
the window lines of all windows, with status lines
and the command line added. They can only be as long
as the width of the screen allows. When the command
line gets longer it wraps and lines are scrolled to
make room.
buffer lines logical lines window lines screen lines ~
1. one 1. one 1. +-- folded 1. +-- folded
2. two 2. +-- folded 2. five 2. five
3. three 3. five 3. six 3. six
4. four 4. six 4. seven 4. seven
5. five 5. seven 5. === status line ===
6. six 6. aaa
7. seven 7. bbb
8. ccc ccc c
1. aaa 1. aaa 1. aaa 9. cc
2. bbb 2. bbb 2. bbb 10. ddd
3. ccc ccc ccc 3. ccc ccc ccc 3. ccc ccc c 11. ~
4. ddd 4. ddd 4. cc 12. === status line ===
5. ddd 13. (command line)
6. ~
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,848 +0,0 @@
*message.txt* For Vim version 7.4. Last change: 2013 Feb 23
VIM REFERENCE MANUAL by Bram Moolenaar
This file contains an alphabetical list of messages and error messages that
Vim produces. You can use this if you don't understand what the message
means. It is not complete though.
1. Old messages |:messages|
2. Error messages |error-messages|
3. Messages |messages|
==============================================================================
1. Old messages *:messages* *:mes* *message-history*
The ":messages" command can be used to view previously given messages. This
is especially useful when messages have been overwritten or truncated. This
depends on the 'shortmess' option.
The number of remembered messages is fixed at 20 for the tiny version and 200
for other versions.
*g<*
The "g<" command can be used to see the last page of previous command output.
This is especially useful if you accidentally typed <Space> at the hit-enter
prompt. You are then back at the hit-enter prompt and can then scroll further
back.
Note: If the output has been stopped with "q" at the more prompt, it will only
be displayed up to this point.
The previous command output is cleared when another command produces output.
If you are using translated messages, the first printed line tells who
maintains the messages or the translations. You can use this to contact the
maintainer when you spot a mistake.
If you want to find help on a specific (error) message, use the ID at the
start of the message. For example, to get help on the message: >
E72: Close error on swap file
or (translated): >
E72: Errore durante chiusura swap file
Use: >
:help E72
If you are lazy, it also works without the shift key: >
:help e72
==============================================================================
2. Error messages *error-messages* *errors*
When an error message is displayed, but it is removed before you could read
it, you can see it again with: >
:echo errmsg
or view a list of recent messages with: >
:messages
LIST OF MESSAGES
*E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
*E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322*
*E323* *E341* *E473* *E570* *E685* >
Add to read buffer
makemap: Illegal mode
Cannot create BalloonEval with both message and callback
Hangul automata ERROR
block was not locked
Didn't get block nr {N}?
ml_upd_block0(): Didn't get block 0??
pointer block id wrong {N}
Updated too many blocks?
get_varp ERROR
u_undo: line numbers wrong
undo list corrupt
undo line missing
ml_get: cannot find line {N}
cannot find line {N}
line number out of range: {N} past the end
line count wrong in block {N}
Internal error
Internal error: {function}
fatal error in cs_manage_matches
This is an internal error. If you can reproduce it, please send in a bug
report. |bugs|
>
ATTENTION
Found a swap file by the name ...
See |ATTENTION|.
*E92* >
Buffer {N} not found
The buffer you requested does not exist. This can also happen when you have
wiped out a buffer which contains a mark or is referenced in another way.
|:bwipeout|
*E95* >
Buffer with this name already exists
You cannot have two buffers with the same name.
*E72* >
Close error on swap file
The |swap-file|, that is used to keep a copy of the edited text, could not be
closed properly. Mostly harmless.
*E169* >
Command too recursive
This happens when an Ex command executes an Ex command that executes an Ex
command, etc. This is only allowed 200 times. When it's more there probably
is an endless loop. Probably a |:execute| or |:source| command is involved.
*E254* >
Cannot allocate color {name}
The color name {name} is unknown. See |gui-colors| for a list of colors that
are available on most systems.
*E458* >
Cannot allocate colormap entry, some colors may be incorrect
This means that there are not enough colors available for Vim. It will still
run, but some of the colors will not appear in the specified color. Try
stopping other applications that use many colors, or start them after starting
gvim.
Browsers are known to consume a lot of colors. You can avoid this with
netscape by telling it to use its own colormap: >
netscape -install
Or tell it to limit to a certain number of colors (64 should work well): >
netscape -ncols 64
This can also be done with a line in your Xdefaults file: >
Netscape*installColormap: Yes
or >
Netscape*maxImageColors: 64
<
*E79* >
Cannot expand wildcards
A filename contains a strange combination of characters, which causes Vim to
attempt expanding wildcards but this fails. This does NOT mean that no
matching file names could be found, but that the pattern was illegal.
*E459* >
Cannot go back to previous directory
While expanding a file name, Vim failed to go back to the previously used
directory. All file names being used may be invalid now! You need to have
execute permission on the current directory.
*E190* *E212* >
Cannot open "{filename}" for writing
Can't open file for writing
For some reason the file you are writing to cannot be created or overwritten.
The reason could be that you do not have permission to write in the directory
or the file name is not valid.
*E166* >
Can't open linked file for writing
You are trying to write to a file which can't be overwritten, and the file is
a link (either a hard link or a symbolic link). Writing might still be
possible if the directory that contains the link or the file is writable, but
Vim now doesn't know if you want to delete the link and write the file in its
place, or if you want to delete the file itself and write the new file in its
place. If you really want to write the file under this name, you have to
manually delete the link or the file, or change the permissions so that Vim
can overwrite.
*E46* >
Cannot change read-only variable "{name}"
You are trying to assign a value to an argument of a function |a:var| or a Vim
internal variable |v:var| which is read-only.
*E90* >
Cannot unload last buffer
Vim always requires one buffer to be loaded, otherwise there would be nothing
to display in the window.
*E40* >
Can't open errorfile <filename>
When using the ":make" or ":grep" commands: The file used to save the error
messages or grep output cannot be opened. This can have several causes:
- 'shellredir' has a wrong value.
- The shell changes directory, causing the error file to be written in another
directory. This could be fixed by changing 'makeef', but then the make
command is still executed in the wrong directory.
- 'makeef' has a wrong value.
- The 'grepprg' or 'makeprg' could not be executed. This cannot always be
detected (especially on MS-Windows). Check your $PATH.
>
Can't open file C:\TEMP\VIoD243.TMP
On MS-Windows, this message appears when the output of an external command was
to be read, but the command didn't run successfully. This can be caused by
many things. Check the 'shell', 'shellquote', 'shellxquote', 'shellslash' and
related options. It might also be that the external command was not found,
there is no different error message for that.
*E12* >
Command not allowed from exrc/vimrc in current dir or tag search
Some commands are not allowed for security reasons. These commands mostly
come from a .exrc or .vimrc file in the current directory, or from a tags
file. Also see 'secure'.
*E74* >
Command too complex
A mapping resulted in a very long command string. Could be caused by a
mapping that indirectly calls itself.
>
CONVERSION ERROR
When writing a file and the text "CONVERSION ERROR" appears, this means that
some bits were lost when converting text from the internally used UTF-8 to the
format of the file. The file will not be marked unmodified. If you care
about the loss of information, set the 'fileencoding' option to another value
that can handle the characters in the buffer and write again. If you don't
care, you can abandon the buffer or reset the 'modified' option.
*E302* >
Could not rename swap file
When the file name changes, Vim tries to rename the |swap-file| as well.
This failed and the old swap file is now still used. Mostly harmless.
*E43* *E44* >
Damaged match string
Corrupted regexp program
Something inside Vim went wrong and resulted in a corrupted regexp. If you
know how to reproduce this problem, please report it. |bugs|
*E208* *E209* *E210* >
Error writing to "{filename}"
Error closing "{filename}"
Error reading "{filename}"
This occurs when Vim is trying to rename a file, but a simple change of file
name doesn't work. Then the file will be copied, but somehow this failed.
The result may be that both the original file and the destination file exist
and the destination file may be incomplete.
>
Vim: Error reading input, exiting...
This occurs when Vim cannot read typed characters while input is required.
Vim got stuck, the only thing it can do is exit. This can happen when both
stdin and stderr are redirected and executing a script that doesn't exit Vim.
*E47* >
Error while reading errorfile
Reading the error file was not possible. This is NOT caused by an error
message that was not recognized.
*E80* >
Error while writing
Writing a file was not completed successfully. The file is probably
incomplete.
*E13* *E189* >
File exists (add ! to override)
"{filename}" exists (add ! to override)
You are protected from accidentally overwriting a file. When you want to
write anyway, use the same command, but add a "!" just after the command.
Example: >
:w /tmp/test
changes to: >
:w! /tmp/test
<
*E768* >
Swap file exists: {filename} (:silent! overrides)
You are protected from overwriting a file that is being edited by Vim. This
happens when you use ":w! filename" and a swapfile is found.
- If the swapfile was left over from an old crashed edit session you may want
to delete the swapfile. Edit {filename} to find out information about the
swapfile.
- If you want to write anyway prepend ":silent!" to the command. For example: >
:silent! w! /tmp/test
< The special command is needed, since you already added the ! for overwriting
an existing file.
*E139* >
File is loaded in another buffer
You are trying to write a file under a name which is also used in another
buffer. This would result in two versions of the same file.
*E142* >
File not written: Writing is disabled by 'write' option
The 'write' option is off. This makes all commands that try to write a file
generate this message. This could be caused by a |-m| commandline argument.
You can switch the 'write' option on with ":set write".
*E25* >
GUI cannot be used: Not enabled at compile time
You are running a version of Vim that doesn't include the GUI code. Therefore
"gvim" and ":gui" don't work.
*E49* >
Invalid scroll size
This is caused by setting an invalid value for the 'scroll', 'scrolljump' or
'scrolloff' options.
*E17* >
"{filename}" is a directory
You tried to write a file with the name of a directory. This is not possible.
You probably need to append a file name.
*E19* >
Mark has invalid line number
You are using a mark that has a line number that doesn't exist. This can
happen when you have a mark in another file, and some other program has
deleted lines from it.
*E219* *E220* >
Missing {.
Missing }.
Using a {} construct in a file name, but there is a { without a matching } or
the other way around. It should be used like this: {foo,bar}. This matches
"foo" and "bar".
*E315* >
ml_get: invalid lnum: {number}
This is an internal Vim error. Please try to find out how it can be
reproduced, and submit a bug report |bugreport.vim|.
*E173* >
{number} more files to edit
You are trying to exit, while the last item in the argument list has not been
edited. This protects you from accidentally exiting when you still have more
files to work on. See |argument-list|. If you do want to exit, just do it
again and it will work.
*E23* *E194* >
No alternate file
No alternate file name to substitute for '#'
The alternate file is not defined yet. See |alternate-file|.
*E32* >
No file name
The current buffer has no name. To write it, use ":w fname". Or give the
buffer a name with ":file fname".
*E141* >
No file name for buffer {number}
One of the buffers that was changed does not have a file name. Therefore it
cannot be written. You need to give the buffer a file name: >
:buffer {number}
:file {filename}
<
*E33* >
No previous substitute regular expression
When using the '~' character in a pattern, it is replaced with the previously
used pattern in a ":substitute" command. This fails when no such command has
been used yet. See |/~|. This also happens when using ":s/pat/%/", where the
"%" stands for the previous substitute string.
*E35* >
No previous regular expression
When using an empty search pattern, the previous search pattern is used. But
that is not possible if there was no previous search.
*E24* >
No such abbreviation
You have used an ":unabbreviate" command with an argument which is not an
existing abbreviation. All variations of this command give the same message:
":cunabbrev", ":iunabbrev", etc. Check for trailing white space.
>
/dev/dsp: No such file or directory
Only given for GTK GUI with Gnome support. Gnome tries to use the audio
device and it isn't present. You can ignore this error.
*E31* >
No such mapping
You have used an ":unmap" command with an argument which is not an existing
mapping. All variations of this command give the same message: ":cunmap",
":unmap!", etc. A few hints:
- Check for trailing white space.
- If the mapping is buffer-local you need to use ":unmap <buffer>".
|:map-<buffer>|
*E37* *E89* >
No write since last change (add ! to override)
No write since last change for buffer {N} (add ! to override)
You are trying to |abandon| a file that has changes. Vim protects you from
losing your work. You can either write the changed file with ":w", or, if you
are sure, |abandon| it anyway, and lose all the changes. This can be done by
adding a '!' character just after the command you used. Example: >
:e other_file
changes to: >
:e! other_file
<
*E162* >
No write since last change for buffer "{name}"
This appears when you try to exit Vim while some buffers are changed. You
will either have to write the changed buffer (with |:w|), or use a command to
abandon the buffer forcefully, e.g., with ":qa!". Careful, make sure you
don't throw away changes you really want to keep. You might have forgotten
about a buffer, especially when 'hidden' is set.
>
[No write since last change]
This appears when executing a shell command while at least one buffer was
changed. To avoid the message reset the 'warn' option.
*E38* >
Null argument
Something inside Vim went wrong and resulted in a NULL pointer. If you know
how to reproduce this problem, please report it. |bugs|
*E172* >
Only one file name allowed
The ":edit" command only accepts one file name. When you want to specify
several files for editing use ":next" |:next|.
*E41* *E82* *E83* *E342* >
Out of memory!
Out of memory! (allocating {number} bytes)
Cannot allocate any buffer, exiting...
Cannot allocate buffer, using other one...
Oh, oh. You must have been doing something complicated, or some other program
is consuming your memory. Be careful! Vim is not completely prepared for an
out-of-memory situation. First make sure that any changes are saved. Then
try to solve the memory shortage. To stay on the safe side, exit Vim and
start again.
Buffers are only partly kept in memory, thus editing a very large file is
unlikely to cause an out-of-memory situation. Undo information is completely
in memory, you can reduce that with these options:
- 'undolevels' Set to a low value, or to -1 to disable undo completely. This
helps for a change that affects all lines.
- 'undoreload' Set to zero to disable.
Also see |msdos-limitations|.
*E339* >
Pattern too long
This happens on systems with 16 bit ints: The compiled regexp pattern is
longer than about 65000 characters. Try using a shorter pattern.
It also happens when the offset of a rule doesn't fit in the space available.
Try simplifying the pattern.
*E45* >
'readonly' option is set (add ! to override)
You are trying to write a file that was marked as read-only. To write the
file anyway, either reset the 'readonly' option, or add a '!' character just
after the command you used. Example: >
:w
changes to: >
:w!
<
*E294* *E295* *E301* >
Read error in swap file
Seek error in swap file read
Oops, lost the swap file!!!
Vim tried to read text from the |swap-file|, but something went wrong. The
text in the related buffer may now be corrupted! Check carefully before you
write a buffer. You may want to write it in another file and check for
differences.
*E192* >
Recursive use of :normal too deep
You are using a ":normal" command, whose argument again uses a ":normal"
command in a recursive way. This is restricted to 'maxmapdepth' levels. This
example illustrates how to get this message: >
:map gq :normal gq<CR>
If you type "gq", it will execute this mapping, which will call "gq" again.
*E22* >
Scripts nested too deep
Scripts can be read with the "-s" command-line argument and with the ":source"
command. The script can then again read another script. This can continue
for about 14 levels. When more nesting is done, Vim assumes that there is a
recursive loop somewhere and stops with this error message.
*E319* >
Sorry, the command is not available in this version
You have used a command that is not present in the version of Vim you are
using. When compiling Vim, many different features can be enabled or
disabled. This depends on how big Vim has chosen to be and the operating
system. See |+feature-list| for when which feature is available. The
|:version| command shows which feature Vim was compiled with.
*E300* >
Swap file already exists (symlink attack?)
This message appears when Vim is trying to open a swap file and finds it
already exists or finds a symbolic link in its place. This shouldn't happen,
because Vim already checked that the file doesn't exist. Either someone else
opened the same file at exactly the same moment (very unlikely) or someone is
attempting a symlink attack (could happen when editing a file in /tmp or when
'directory' starts with "/tmp", which is a bad choice).
*E432* >
Tags file not sorted: {file name}
Vim (and Vi) expect tags files to be sorted in ASCII order. Binary searching
can then be used, which is a lot faster than a linear search. If your tags
files are not properly sorted, reset the |'tagbsearch'| option.
This message is only given when Vim detects a problem when searching for a
tag. Sometimes this message is not given, even though the tags file is not
properly sorted.
*E460* >
The resource fork would be lost (add ! to override)
On the Macintosh (classic), when writing a file, Vim attempts to preserve all
info about a file, including its resource fork. If this is not possible you
get this error message. Append "!" to the command name to write anyway (and
lose the info).
*E424* >
Too many different highlighting attributes in use
Vim can only handle about 223 different kinds of highlighting. If you run
into this limit, you have used too many |:highlight| commands with different
arguments. A ":highlight link" is not counted.
*E77* >
Too many file names
When expanding file names, more than one match was found. Only one match is
allowed for the command that was used.
*E303* >
Unable to open swap file for "{filename}", recovery impossible
Vim was not able to create a swap file. You can still edit the file, but if
Vim unexpectedly exits the changes will be lost. And Vim may consume a lot of
memory when editing a big file. You may want to change the 'directory' option
to avoid this error. See |swap-file|.
*E140* >
Use ! to write partial buffer
When using a range to write part of a buffer, it is unusual to overwrite the
original file. It is probably a mistake (e.g., when Visual mode was active
when using ":w"), therefore Vim requires using a ! after the command, e.g.:
":3,10w!".
>
Warning: Cannot convert string "<Key>Escape,_Key_Cancel" to type
VirtualBinding
Messages like this appear when starting up. This is not a Vim problem, your
X11 configuration is wrong. You can find a hint on how to solve this here:
http://groups.yahoo.com/group/solarisonintel/message/12179.
[this URL is no longer valid]
*W10* >
Warning: Changing a readonly file
The file is read-only and you are making a change to it anyway. You can use
the |FileChangedRO| autocommand event to avoid this message (the autocommand
must reset the 'readonly' option). See 'modifiable' to completely disallow
making changes to a file.
This message is only given for the first change after 'readonly' has been set.
*W13* >
Warning: File "{filename}" has been created after editing started
You are editing a file in Vim when it didn't exist, but it does exist now.
You will have to decide if you want to keep the version in Vim or the newly
created file. This message is not given when 'buftype' is not empty.
*W11* >
Warning: File "{filename}" has changed since editing started
The file which you have started editing has got another timestamp and the
contents changed (more precisely: When reading the file again with the current
option settings and autocommands you would end up with different text). This
probably means that some other program changed the file. You will have to
find out what happened, and decide which version of the file you want to keep.
Set the 'autoread' option if you want to do this automatically.
This message is not given when 'buftype' is not empty.
There is one situation where you get this message even though there is nothing
wrong: If you save a file in Windows on the day the daylight saving time
starts. It can be fixed in one of these ways:
- Add this line in your autoexec.bat: >
SET TZ=-1
< Adjust the "-1" for your time zone.
- Disable "automatically adjust clock for daylight saving changes".
- Just write the file again the next day. Or set your clock to the next day,
write the file twice and set the clock back.
*W12* >
Warning: File "{filename}" has changed and the buffer was changed in Vim as well
Like the above, and the buffer for the file was changed in this Vim as well.
You will have to decide if you want to keep the version in this Vim or the one
on disk. This message is not given when 'buftype' is not empty.
*W16* >
Warning: Mode of file "{filename}" has changed since editing started
When the timestamp for a buffer was changed and the contents are still the
same but the mode (permissions) have changed. This usually occurs when
checking out a file from a version control system, which causes the read-only
bit to be reset. It should be safe to reload the file. Set 'autoread' to
automatically reload the file.
*E211* >
File "{filename}" no longer available
The file which you have started editing has disappeared, or is no longer
accessible. Make sure you write the buffer somewhere to avoid losing
changes. This message is not given when 'buftype' is not empty.
*W14* >
Warning: List of file names overflow
You must be using an awful lot of buffers. It's now possible that two buffers
have the same number, which causes various problems. You might want to exit
Vim and restart it.
*E296* *E297* >
Seek error in swap file write
Write error in swap file
This mostly happens when the disk is full. Vim could not write text into the
|swap-file|. It's not directly harmful, but when Vim unexpectedly exits some
text may be lost without recovery being possible. Vim might run out of memory
when this problem persists.
*connection-refused* >
Xlib: connection to "<machine-name:0.0" refused by server
This happens when Vim tries to connect to the X server, but the X server does
not allow a connection. The connection to the X server is needed to be able
to restore the title and for the xterm clipboard support. Unfortunately this
error message cannot be avoided, except by disabling the |+xterm_clipboard|
and |+X11| features.
*E10* >
\\ should be followed by /, ? or &
A command line started with a backslash or the range of a command contained a
backslash in a wrong place. This is often caused by command-line continuation
being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it.
Or use ":set nocp".
*E471* >
Argument required
This happens when an Ex command with mandatory argument(s) was executed, but
no argument has been specified.
*E474* *E475* >
Invalid argument
Invalid argument: {arg}
An Ex command has been executed, but an invalid argument has been specified.
*E488* >
Trailing characters
An argument has been added to an Ex command that does not permit one.
*E477* *E478* >
No ! allowed
Don't panic!
You have added a "!" after an Ex command that doesn't permit one.
*E481* >
No range allowed
A range was specified for an Ex command that doesn't permit one. See
|cmdline-ranges|.
*E482* *E483* >
Can't create file {filename}
Can't get temp file name
Vim cannot create a temporary file.
*E484* *E485* >
Can't open file {filename}
Can't read file {filename}
Vim cannot read a temporary file. Especially on Windows, this can be caused
by wrong escaping of special characters for cmd.exe; the approach was
changed with patch 7.3.443. Try using |shellescape()| for all shell arguments
given to |system()|, or explicitly add escaping with ^. Also see
'shellxquote' and 'shellxescape'.
*E464* >
Ambiguous use of user-defined command
There are two user-defined commands with a common name prefix, and you used
Command-line completion to execute one of them. |user-cmd-ambiguous|
Example: >
:command MyCommand1 echo "one"
:command MyCommand2 echo "two"
:MyCommand
<
*E492* >
Not an editor command
You tried to execute a command that is neither an Ex command nor
a user-defined command.
==============================================================================
3. Messages *messages*
This is an (incomplete) overview of various messages that Vim gives:
*hit-enter* *press-enter* *hit-return*
*press-return* *hit-enter-prompt*
Press ENTER or type command to continue
This message is given when there is something on the screen for you to read,
and the screen is about to be redrawn:
- After executing an external command (e.g., ":!ls" and "=").
- Something is displayed on the status line that is longer than the width of
the window, or runs into the 'showcmd' or 'ruler' output.
-> Press <Enter> or <Space> to redraw the screen and continue, without that
key being used otherwise.
-> Press ':' or any other Normal mode command character to start that command.
-> Press 'k', <Up>, 'u', 'b' or 'g' to scroll back in the messages. This
works the same way as at the |more-prompt|. Only works when 'compatible'
is off and 'more' is on.
-> Pressing 'j', 'f', 'd' or <Down> is ignored when messages scrolled off the
top of the screen, 'compatible' is off and 'more' is on, to avoid that
typing one 'j' or 'f' too many causes the messages to disappear.
-> Press <C-Y> to copy (yank) a modeless selection to the clipboard register.
-> Use a menu. The characters defined for Cmdline-mode are used.
-> When 'mouse' contains the 'r' flag, clicking the left mouse button works
like pressing <Space>. This makes it impossible to select text though.
-> For the GUI clicking the left mouse button in the last line works like
pressing <Space>.
{Vi: only ":" commands are interpreted}
If you accidentally hit <Enter> or <Space> and you want to see the displayed
text then use |g<|. This only works when 'more' is set.
To reduce the number of hit-enter prompts:
- Set 'cmdheight' to 2 or higher.
- Add flags to 'shortmess'.
- Reset 'showcmd' and/or 'ruler'.
If your script causes the hit-enter prompt and you don't know why, you may
find the |v:scrollstart| variable useful.
Also see 'mouse'. The hit-enter message is highlighted with the |hl-Question|
group.
*more-prompt* *pager* >
-- More --
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
This message is given when the screen is filled with messages. It is only
given when the 'more' option is on. It is highlighted with the |hl-MoreMsg|
group.
Type effect ~
<CR> or <NL> or j or <Down> one more line
d down a page (half a screen)
<Space> or f or <PageDown> down a screen
G down all the way, until the hit-enter
prompt
<BS> or k or <Up> one line back (*)
u up a page (half a screen) (*)
b or <PageUp> back a screen (*)
g back to the start (*)
q, <Esc> or CTRL-C stop the listing
: stop the listing and enter a
command-line
<C-Y> yank (copy) a modeless selection to
the clipboard ("* and "+ registers)
{menu-entry} what the menu is defined to in
Cmdline-mode.
<LeftMouse> (**) next page
Any other key causes the meaning of the keys to be displayed.
(*) backwards scrolling is {not in Vi}. Only scrolls back to where messages
started to scroll.
(**) Clicking the left mouse button only works:
- For the GUI: in the last line of the screen.
- When 'r' is included in 'mouse' (but then selecting text won't work).
Note: The typed key is directly obtained from the terminal, it is not mapped
and typeahead is ignored.
The |g<| command can be used to see the last page of previous command output.
This is especially useful if you accidentally typed <Space> at the hit-enter
prompt.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

View file

@ -1,210 +0,0 @@
*mlang.txt* For Vim version 7.4. Last change: 2012 Jan 15
VIM REFERENCE MANUAL by Bram Moolenaar
Multi-language features *multilang* *multi-lang*
This is about using messages and menus in various languages. For editing
multi-byte text see |multibyte|.
The basics are explained in the user manual: |usr_45.txt|.
1. Messages |multilang-messages|
2. Menus |multilang-menus|
3. Scripts |multilang-scripts|
Also see |help-translated| for multi-language help.
{Vi does not have any of these features}
{not available when compiled without the |+multi_lang| feature}
==============================================================================
1. Messages *multilang-messages*
Vim picks up the locale from the environment. In most cases this means Vim
will use the language that you prefer, unless it's not available.
To see a list of supported locale names on your system, look in one of these
directories (for Unix):
/usr/lib/locale ~
/usr/share/locale ~
Unfortunately, upper/lowercase differences matter. Also watch out for the
use of "-" and "_".
*:lan* *:lang* *:language* *E197*
:lan[guage]
:lan[guage] mes[sages]
:lan[guage] cty[pe]
:lan[guage] tim[e]
Print the current language (aka locale).
With the "messages" argument the language used for
messages is printed. Technical: LC_MESSAGES.
With the "ctype" argument the language used for
character encoding is printed. Technical: LC_CTYPE.
With the "time" argument the language used for
strftime() is printed. Technical: LC_TIME.
Without argument all parts of the locale are printed
(this is system dependent).
The current language can also be obtained with the
|v:lang|, |v:ctype| and |v:lc_time| variables.
:lan[guage] {name}
:lan[guage] mes[sages] {name}
:lan[guage] cty[pe] {name}
:lan[guage] tim[e] {name}
Set the current language (aka locale) to {name}.
The locale {name} must be a valid locale on your
system. Some systems accept aliases like "en" or
"en_US", but some only accept the full specification
like "en_US.ISO_8859-1". On Unix systems you can use
this command to see what locales are supported: >
:!locale -a
< With the "messages" argument the language used for
messages is set. This can be different when you want,
for example, English messages while editing Japanese
text. This sets $LC_MESSAGES.
With the "ctype" argument the language used for
character encoding is set. This affects the libraries
that Vim was linked with. It's unusual to set this to
a different value from 'encoding' or "C". This sets
$LC_CTYPE.
With the "time" argument the language used for time
and date messages is set. This affects strftime().
This sets $LC_TIME.
Without an argument both are set, and additionally
$LANG is set.
When compiled with the |+float| feature the LC_NUMERIC
value will always be set to "C", so that floating
point numbers use '.' as the decimal point.
This will make a difference for items that depend on
the language (some messages, time and date format).
Not fully supported on all systems
If this fails there will be an error message. If it
succeeds there is no message. Example: >
:language
Current language: C
:language de_DE.ISO_8859-1
:language mes
Current messages language: de_DE.ISO_8859-1
:lang mes en
<
MS-WINDOWS MESSAGE TRANSLATIONS *win32-gettext*
If you used the self-installing .exe file, message translations should work
already. Otherwise get the libintl.dll file if you don't have it yet:
http://sourceforge.net/projects/gettext
This also contains tools xgettext, msgformat and others.
libintl.dll should be placed in same directory with (g)vim.exe, or some
place where PATH environment value describe. Message files (vim.mo)
have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the
abbreviation of the language (mostly two letters).
If you write your own translations you need to generate the .po file and
convert it to a .mo file. You need to get the source distribution and read
the file "src/po/README.txt".
To overrule the automatic choice of the language, set the $LANG variable to
the language of your choice. use "en" to disable translations. >
:let $LANG = 'ja'
(text for Windows by Muraoka Taro)
==============================================================================
2. Menus *multilang-menus*
See |45.2| for the basics, esp. using 'langmenu'.
Note that if changes have been made to the menus after the translation was
done, some of the menus may be shown in English. Please try contacting the
maintainer of the translation and ask him to update it. You can find the
name and e-mail address of the translator in
"$VIMRUNTIME/lang/menu_<lang>.vim".
To set the font (or fontset) to use for the menus, use the |:highlight|
command. Example: >
:highlight Menu font=k12,r12
ALIAS LOCALE NAMES
Unfortunately, the locale names are different on various systems, even though
they are for the same language and encoding. If you do not get the menu
translations you expected, check the output of this command: >
echo v:lang
Now check the "$VIMRUNTIME/lang" directory for menu translation files that use
a similar language. A difference in a "-" being a "_" already causes a file
not to be found! Another common difference to watch out for is "iso8859-1"
versus "iso_8859-1". Fortunately Vim makes all names lowercase, thus you
don't have to worry about case differences. Spaces are changed to
underscores, to avoid having to escape them.
If you find a menu translation file for your language with a different name,
create a file in your own runtime directory to load that one. The name of
that file could be: >
~/.vim/lang/menu_<v:lang>.vim
Check the 'runtimepath' option for directories which are searched. In that
file put a command to load the menu file with the other name: >
runtime lang/menu_<other_lang>.vim
TRANSLATING MENUS
If you want to do your own translations, you can use the |:menutrans| command,
explained below. It is recommended to put the translations for one language
in a Vim script. For a language that has no translation yet, please consider
becoming the maintainer and make your translations available to all Vim users.
Send an e-mail to the Vim maintainer <maintainer@vim.org>.
*:menut* *:menutrans* *:menutranslate*
:menut[ranslate] clear
Clear all menu translations.
:menut[ranslate] {english} {mylang}
Translate menu name {english} to {mylang}. All
special characters like "&" and "<Tab>" need to be
included. Spaces and dots need to be escaped with a
backslash, just like in other |:menu| commands.
See the $VIMRUNTIME/lang directory for examples.
To try out your translations you first have to remove all menus. This is how
you can do it without restarting Vim: >
:source $VIMRUNTIME/delmenu.vim
:source <your-new-menu-file>
:source $VIMRUNTIME/menu.vim
Each part of a menu path is translated separately. The result is that when
"Help" is translated to "Hilfe" and "Overview" to "Überblick" then
"Help.Overview" will be translated to "Hilfe.Überblick".
==============================================================================
3. Scripts *multilang-scripts*
In Vim scripts you can use the |v:lang| variable to get the current language
(locale). The default value is "C" or comes from the $LANG environment
variable.
The following example shows how this variable is used in a simple way, to make
a message adapt to language preferences of the user, >
:if v:lang =~ "de_DE"
: echo "Guten Morgen"
:else
: echo "Good morning"
:endif
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,135 +0,0 @@
*os_390.txt* For Vim version 7.4. Last change: 2010 May 30
VIM REFERENCE MANUAL by Ralf Schandl
*zOS* *z/OS* *OS390* *os390* *MVS*
This file contains the particulars for the z/OS UNIX version of Vim.
1. ASCII/EBCDIC dependent scripts |zOS-has-ebcdic|
2. Putty and Colors |zOS-PuTTY|
3. Motif Problems |zOS-Motif|
4. Bugs |zOS-Bugs|
5. Limitations |zOS-limitations|
6. Open source on z/OS UNIX |zOS-open-source|
Contributors: ~
The port to z/OS UNIX was done by Ralf Schandl for the Redbook mentioned
below.
Changes, bug-reports, or both by:
David Moore
Anthony Giorgio
and others
==============================================================================
1. ASCII/EBCDIC dependent scripts *OS390-has-ebcdic* *zOS-has-ebcdic*
For the internal script language the feature "ebcdic" was added. With this
you can fix ASCII dependent scripts like this:
>
if has("ebcdic")
let space = 64
else
let space = 32
endif
<
==============================================================================
2. PuTTY and Colors *OS390-PuTTY* *zOS-PuTTY*
If you see problems with syntax highlighting or screen corruptions when you
connect to z/OS using Putty, try the following:
- Configure Putty as "vt220" terminal (Connection->Data)
- Add the following 3 lines to your vimrc:
>
set t_AB=[4%p1%dm
set t_AF=[3%p1%dm
set t_CO=8
<
Note:  is one character use <C-V><Esc> to enter it.
==============================================================================
3. Motif Problems *OS390-Motif* *zOS-Motif*
Note: Seen with Vim 6.*, never tested since.
It seems that in porting the Motif library to z/OS, a translation from EBCDIC
to ASCII for the accelerator characters of the pull-down menus was forgotten.
Even after I tried to hand convert the menus, the accelerator keys continued
to only work for the opening of menus (like <Alt-F> to open the file menu).
They still do not work for the menu items themselves (like <Alt-F>O to open
the file browser).
There is no solution for this yet.
==============================================================================
4. Bugs *OS390-bugs* *zOS-Bugs*
- Vim will consistently hang when a large amount of text is selected in
visual block mode. This may be due to a memory corruption issue. Note that
this occurs in both the terminal and gui versions.
==============================================================================
5. Limitations *OS390-limitations* *zOS-limitations*
- No binary search in tag files.
The program /bin/sort sorts by ASCII value by default. This program is
normally used by ctags to sort the tags. There might be a version of
ctags out there, that does it right, but we can't be sure. So this seems to
be a permanent restriction.
- The cscope interface (|cscope|) doesn't work for the version of cscope
that we use on our mainframe. We have a copy of version 15.0b12, and it
causes Vim to hang when using the "cscope add" command. I'm guessing that
the binary format of the cscope database isn't quite what Vim is expecting.
I've tried to port the current version of cscope (15.3) to z/OS, without
much success. If anyone is interested in trying, drop me a line if you
make any progress.
- No glib/gtk support. I have not been able to successfully compile glib on
z/OS UNIX. This means you'll have to live without the pretty gtk toolbar.
Disabled at compile time:
- Multibyte support (|multibyte|)
- Right-to-left mode (|rileft|)
- Farsi key map (|Farsi|)
- Arabic language support (|Arabic|)
- Spell checking (|spell|)
Never tested:
- Perl interface (|perl|)
- Hangul input (|hangul|)
- Encryption support (|encryption|)
- Langmap (|'langmap'|)
- Python support (|Python|)
- Right-to-left mode (|'rightleft'|)
- SNiFF+ interface (|sniff|)
- TCL interface (|tcl|)
...
==============================================================================
6. Open source on z/OS UNIX *OS390-open-source* *zOS-open-source*
If you are interested in other Open Source Software on z/OS UNIX, have a
look at the following Redbook:
Mike MacIsaac et al
"Open Source Software for z/OS and OS/390 UNIX"
IBM Form Number: SG24-5944-01
ISBN: 0738424633
http://www-03.ibm.com/systems/resources/servers_eserver_zseries_zos_unix_redbook_sg245944.pdf
Also look at:
http://www.redbooks.ibm.com
http://www-03.ibm.com/systems/z/os/zos/features/unix/
http://www-03.ibm.com/systems/z/os/zos/features/unix/library/IBM+Redbooks/index.html
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:ts=8:ft=help:norl:

View file

@ -1,147 +0,0 @@
*os_amiga.txt* For Vim version 7.4. Last change: 2010 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar
*Amiga*
This file contains the particularities for the Amiga version of Vim.
There is also a section specifically for |MorphOS| below.
NOTE: The Amiga code is still included, but has not been maintained or tested.
Installation on the Amiga:
- Assign "VIM:" to the directory where the Vim "doc" directory is. Vim will
look for the file "VIM:doc/help.txt" (for the help command).
Setting the environment variable $VIM also works. And the other way around:
when $VIM used and it is not defined, "VIM:" is used.
- With DOS 1.3 or earlier: Put "arp.library" in "libs:". Vim must have been
compiled with the |+ARP| feature enabled. Make sure that newcli and run are
in "C:" (for executing external commands).
- Put a shell that accepts a command with "-c" (e.g. "Csh" from Fish disk
624) in "c:" or in any other directory that is in your search path (for
executing external commands).
If you have sufficient memory you can avoid startup delays by making Vim and
csh resident with the command "rez csh vim". You will have to put
"rezlib.library" in your "libs:" directory. Under 2.0 you will need rez
version 0.5.
If you do not use digraphs, you can save some memory by recompiling without
the |+digraphs| feature. If you want to use Vim with other terminals you can
recompile with the TERMCAP option. Vim compiles with Manx 5.x and SAS 6.x.
See the makefiles and feature.h.
If you notice Vim crashes on some files when syntax highlighting is on, or
when using a search pattern with nested wildcards, it might be that the stack
is too small. Try increasing the stack size. In a shell use the Stack
command before launching Vim. On the Workbench, select the Vim icon, use the
workbench "Info" menu and change the Stack field in the form.
If you want to use different colors set the termcap codes:
t_mr (for inverted text)
t_md (for bold text)
t_me (for normal text after t_mr and t_md)
t_so (for standout mode)
t_se (for normal text after t_so)
t_us (for underlined text)
t_ue (for normal text after t_us)
t_ZH (for italic text)
t_ZR (for normal text after t_ZH)
Standard ANSI escape sequences are used. The codes are:
30 grey char 40 grey cell >0 grey background 0 all attributes off
31 black char 41 black cell >1 black background 1 boldface
32 white char 42 white cell >2 white background 2 faint
33 blue char 43 blue cell >3 blue background 3 italic
34 grey char 44 grey cell >4 grey background 4 underscore
35 black char 45 black cell >5 black background 7 reverse video
36 white char 46 white cell >6 white background 8 invisible
37 blue char 47 blue cell >7 blue background
The codes with '>' must be the last. The cell and background color should be
the same. The codes can be combined by separating them with a semicolon. For
example to get white text on a blue background: >
:set t_me=^V<Esc>[0;32;43;>3m
:set t_se=^V<Esc>[0;32;43;>3m
:set t_ue=^V<Esc>[0;32;43;>3m
:set t_ZR=^V<Esc>[0;32;43;>3m
:set t_md=^V<Esc>[1;32;43;>3m
:set t_mr=^V<Esc>[7;32;43;>3m
:set t_so=^V<Esc>[0;31;43;>3m
:set t_us=^V<Esc>[4;32;43;>3m
:set t_ZH=^V<Esc>[3;32;43;>3m
When using multiple commands with a filter command, e.g. >
:r! echo this; echo that
Only the output of the last command is used. To fix this you have to group the
commands. This depends on the shell you use (that is why it is not done
automatically in Vim). Examples: >
:r! (echo this; echo that)
:r! {echo this; echo that}
Commands that accept a single file name allow for embedded spaces in the file
name. However, when using commands that accept several file names, embedded
spaces need to be escaped with a backslash.
------------------------------------------------------------------------------
Vim for MorphOS *MorphOS*
[this section mostly by Ali Akcaagac]
For the latest info about the MorphOS version:
http://www.akcaagac.com/index_vim.html
Problems ~
There are a couple of problems which are not MorphOS related but more Vim and
UN*X related. When starting up Vim in ram: it complains with a nag requester
from MorphOS please simply ignore it. Another problem is when running Vim as
is some plugins will cause a few problems which you can ignore as well.
Hopefully someone will be fixing it over the time.
To pass all these problems for now you can either run:
vim <file to be edited>
or if you want to run Vim plain and enjoy the motion of Helpfiles etc. it then
would be better to enter:
vim --noplugins <of course you can add a file>
Installation ~
1) Please copy the binary 'VIM' file to c:
2) Get the Vim runtime package from:
ftp://ftp.vim.org/pub/vim/amiga/vim62rt.tgz
and unpack it in your 'Apps' directory of the MorphOS installation. For me
this would create following directory hierarchy:
MorphOS:Apps/Vim/Vim62/...
3) Add the following lines to your s:shell-startup (Important!).
;Begin VIM
Set VIM=MorphOS:Apps/Vim/Vim62
Assign HOME: ""
;End VIM
4) Copy the '.vimrc' file to s:
5) There is also a file named 'color-sequence' included in this archive. This
will set the MorphOS Shell to show ANSI colors. Please copy the file to s:
and change the s:shell-startup to:
;Begin VIM
Set VIM=MorphOS:Apps/Vim/Vim62
Assign HOME: ""
Execute S:Color-Sequence
Cls
;End VIM
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,319 +0,0 @@
*os_beos.txt* For Vim version 7.4. Last change: 2010 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar
*BeOS* *BeBox*
This is a port of Vim 5.1 to the BeOS Preview Release 2 (also known as PR2)
or later.
This file contains the particularities for the BeBox/BeOS version of Vim. For
matters not discussed in this file, Vim behaves very much like the Unix
|os_unix.txt| version.
1. General |beos-general|
2. Compiling Vim |beos-compiling|
3. Timeout in the Terminal |beos-timeout|
4. Unicode vs. Latin1 |beos-unicode|
5. The BeOS GUI |beos-gui|
6. The $VIM directory |beos-vimdir|
7. Drag & Drop |beos-dragndrop|
8. Single Launch vs. Multiple
Launch |beos-launch|
9. Fonts |beos-fonts|
10. The meta key modifier |beos-meta|
11. Mouse key mappings |beos-mouse|
12. Color names |beos-colors|
13. Compiling with Perl |beos-perl|
1. General *beos-general*
The default syntax highlighting mostly works with different foreground colors
to highlight items. This works best if you set your Terminal window to a
darkish background and light letters. Some middle-grey background (for
instance (r,g,b)=(168,168,168)) with black letters also works nicely. If you
use the default light background and dark letters, it may look better to
simply reverse the notion of foreground and background color settings. To do
this, add this to your .vimrc file (where <Esc> may need to be replaced with
the escape character): >
:if &term == "beos-ansi"
: set t_AB=<Esc>[3%dm
: set t_AF=<Esc>[4%dm
:endif
2. Compiling Vim *beos-compiling*
From the Advanced Access Preview Release (AAPR) on, Vim can be configured with
the standard configure script. To get the compiler and its flags right, use
the following command-line in the shell (you can cut and paste it in one go):
CC=$BE_C_COMPILER CFLAGS="$BE_DEFAULT_C_FLAGS -O7" \
./configure --prefix=/boot/home/config
$BE_C_COMPILER is usually "mwcc", $BE_DEFAULT_C_FLAGS is usually "-I- -I."
When configure has run, and you wish to enable GUI support, you must edit the
config.mk file so that the lines with GUI_xxx refer to $(BEOSGUI_xxx) instead
of $(NONE_xxx).
Alternatively you can make this change in the Makefile; it will have a
more permanent effect. Search for "NONE_".
After compilation you need to add the resources to the binary. Add the
following few lines near the end (before the line with "exit $exit_value") of
the link.sh script to do this automatically.
rmattr BEOS:TYPE vim
copyres os_beos.rsrc vim
mimeset vim
Also, create a dummy file "strip":
#!/bin/sh
mimeset $1
exit 0
You will need it when using "make install" to install Vim.
Now type "make" to compile Vim, then "make install" to install it.
If you want to install Vim by hand, you must copy Vim to $HOME/config/bin, and
create a bunch of symlinks to it ({g,r,rg}{vim,ex,view}). Furthermore you must
copy Vim's configuration files to $HOME/config/share/vim:
vim-5.0s/{*.vim,doc,syntax}. For completeness, you should also copy the nroff
manual pages to $HOME/config/man/man1. Don't forget ctags/ctags and xxd/xxd!
Obviously, you need the unlimited linker to actually link Vim. See
http://www.metrowerks.com for purchasing the CodeWarrior compiler for BeOS.
There are currently no other linkers that can do the job.
This won't be able to include the Perl or Python interfaces even if
you have the appropriate files installed. |beos-perl|
3. Timeout in the Terminal *beos-timeout*
Because some POSIX/UNIX features are still missing[1], there is no direct OS
support for read-with-timeout in the Terminal. This would mean that you cannot
use :mappings of more than one character, unless you also :set notimeout.
|'timeout'|
To circumvent this problem, I added a workaround to provide the necessary
input with timeout by using an extra thread which reads ahead one character.
As a side effect, it also makes Vim recognize when the Terminal window
resizes.
Function keys are not supported in the Terminal since they produce very
indistinctive character sequences.
These problems do not exist in the GUI.
[1]: there is no select() on file descriptors; also the termios VMIN and VTIME
settings do not seem to work properly. This has been the case since DR7 at
least and still has not been fixed as of PR2.
*beos-unicode*
4. Unicode vs. Latin1 *beos-utf8*
BeOS uses Unicode and UTF-8 for text strings (16-bit characters encoded to
8-bit characters). Vim assumes ISO-Latin1 or other 8-bit character codes.
This does not produce the desired results for non-ASCII characters. Try the
command :digraphs to see. If they look messed up, use :set isprint=@ to
(slightly) improve the display of ISO-Latin1 characters 128-255. This works
better in the GUI, depending on which font you use (below).
You may also use the /boot/bin/xtou command to convert UTF-8 files from (xtou
-f iso1 filename) or to (xtou -t iso1 filename) ISO-Latin1 characters.
5. The BeOS GUI *beos-gui*
The BeOS GUI is no longer included. It was not maintained for a while and
most likely didn't work. If you want to work on this: get the Vim 6.x version
and merge it back in.
6. The $VIM directory *beos-vimdir*
$VIM is the symbolic name for the place where Vims support files are stored.
The default value for $VIM is set at compile time and can be determined with >
:version
The normal value is /boot/home/config/share/vim. If you don't like it you can
set the VIM environment variable to override this, or set 'helpfile' in your
.vimrc: >
:if version >= 500
: set helpfile=~/vim/vim54/doc/help.txt
: syntax on
:endif
7. Drag & Drop *beos-dragndrop*
You can drop files and directories on either the Vim icon (starts a new Vim
session, unless you use the File Types application to set Vim to be "Single
Launch") or on the Vim window (starts editing the files). Dropping a folder
sets Vim's current working directory. |:cd| |:pwd| If you drop files or
folders with either SHIFT key pressed, Vim changes directory to the folder
that contains the first item dropped. When starting Vim, there is no need to
press shift: Vim behaves as if you do.
Files dropped set the current argument list. |argument-list|
8. Single Launch vs. Multiple Launch *beos-launch*
As distributed Vim's Application Flags (as seen in the FileTypes preference)
are set to Multiple Launch. If you prefer, you can set them to Single Launch
instead. Attempts to start a second copy of Vim will cause the first Vim to
open the files instead. This works from the Tracker but also from the command
line. In the latter case, non-file (option) arguments are not supported.
NB: Only the GUI version has a BApplication (and hence Application Flags).
This section does not apply to the GUI-less version, should you compile one.
9. Fonts *beos-fonts*
Set fonts with >
:set guifont=Courier10_BT/Roman/10
where the first part is the font family, the second part the style, and the
third part the size. You can use underscores instead of spaces in family and
style.
Best results are obtained with monospaced fonts (such as Courier). Vim
attempts to use all fonts in B_FIXED_SPACING mode but apparently this does not
work for proportional fonts (despite what the BeBook says).
Vim also tries to use the B_ISO8859_1 encoding, also known as ISO Latin 1.
This also does not work for all fonts. It does work for Courier, but not for
ProFontISOLatin1/Regular (strangely enough). You can verify this by giving the >
:digraphs
command, which lists a bunch of characters with their ISO Latin 1 encoding.
If, for instance, there are "box" characters among them, or the last character
isn't a dotted-y, then for this font the encoding does not work.
If the font you specify is unavailable, you get the system fixed font.
Standard fixed-width system fonts are:
ProFontISOLatin1/Regular
Courier10_BT/Roman
Courier10_BT/Italic
Courier10_BT/Bold
Courier10_BT/Bold_Italic
Standard proportional system fonts are:
Swis721_BT/Roman
Swis721_BT/Italic
Swis721_BT/Bold
Swis721_BT/Bold_Italic
Dutch801_Rm_BT/Roman
Dutch801_Rm_BT/Italic
Dutch801_Rm_BT/Bold
Dutch801_Rm_BT/Bold_Italic
Baskerville/Roman
Baskerville/Italic
Baskerville/Bold
Baskerville/Bold_Italic
SymbolProp_BT/Regular
Try some of them, just for fun.
10. The meta key modifier *beos-meta*
The META key modifier is obtained by the left or right OPTION keys. This is
because the ALT (aka COMMAND) keys are not passed to applications.
11. Mouse key mappings *beos-mouse*
Vim calls the various mouse buttons LeftMouse, MiddleMouse and RightMouse. If
you use the default Mouse preference settings these names indeed correspond to
reality. Vim uses this mapping:
Button 1 -> LeftMouse,
Button 2 -> RightMouse,
Button 3 -> MiddleMouse.
If your mouse has fewer than 3 buttons you can provide your own mapping from
mouse clicks with modifier(s) to other mouse buttons. See the file
vim-5.x/macros/swapmous.vim for an example. |gui-mouse-mapping|
12. Color names *beos-colors*
Vim has a number of color names built-in. Additional names are read from the
file $VIMRUNTIME/rgb.txt, if present. This file is basically the color
database from X. Names used from this file are cached for efficiency.
13. Compiling with Perl *beos-perl*
Compiling with Perl support enabled is slightly tricky. The Metrowerks
compiler has some strange ideas where to search for include files. Since
several include files with Perl have the same names as some Vim header
files, the wrong ones get included. To fix this, run the following Perl
script while in the vim-5.0/src directory: >
preproc.pl > perl.h
#!/bin/env perl
# Simple #include expander, just good enough for the Perl header files.
use strict;
use IO::File;
use Config;
sub doinclude
{
my $filename = $_[0];
my $fh = new IO::File($filename, "r");
if (defined $fh) {
print "/* Start of $filename */\n";
while (<$fh>) {
if (/^#include "(.*)"/) {
doinclude($1);
print "/* Back in $filename */\n";
} else {
print $_;
}
}
print "/* End of $filename */\n";
undef $fh;
} else {
print "/* Cannot open $filename */\n";
print "#include \"$filename\"\n";
}
}
chdir $Config{installarchlib}."/CORE";
doinclude "perl.h";
It expands the "perl.h" header file, using only other Perl header files.
Now you can configure & make Vim with the --enable-perlinterp option.
Be warned though that this adds about 616 kilobytes to the size of Vim!
Without Perl, Vim with default features and GUI is about 575K, with Perl
it is about 1191K.
-Olaf Seibert
[Note: these addresses no longer work:]
<rhialto@polder.ubc.kun.nl>
http://polder.ubc.kun.nl/~rhialto/be
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,296 +0,0 @@
*os_dos.txt* For Vim version 7.4. Last change: 2006 Mar 30
VIM REFERENCE MANUAL by Bram Moolenaar
*dos* *DOS*
This file documents the common particularities of the MS-DOS and Win32
versions of Vim. Also see |os_win32.txt| and |os_msdos.txt|.
1. File locations |dos-locations|
2. Using backslashes |dos-backslash|
3. Standard mappings |dos-standard-mappings|
4. Screen output and colors |dos-colors|
5. File formats |dos-file-formats|
6. :cd command |dos-:cd|
7. Interrupting |dos-CTRL-Break|
8. Temp files |dos-temp-files|
9. Shell option default |dos-shell|
==============================================================================
1. File locations *dos-locations*
If you keep the Vim executable in the directory that contains the help and
syntax subdirectories, there is no need to do anything special for Vim to
work. No registry entries or environment variables need to be set. Just make
sure that the directory is in your search path, or use a shortcut on the
desktop.
Your vimrc files ("_vimrc" and "_gvimrc") are normally located one directory
up from the runtime files. If you want to put them somewhere else, set the
environment variable $VIM to the directory where you keep them. Example: >
set VIM=C:\user\piet
Will find "c:\user\piet\_vimrc".
Note: This would only be needed when the computer is used by several people.
Otherwise it's simpler to keep your _vimrc file in the default place.
If you move the executable to another location, you also need to set the $VIM
environment variable. The runtime files will be found in "$VIM/vim{version}".
Example: >
set VIM=E:\vim
Will find the version 5.4 runtime files in "e:\vim\vim54".
Note: This is _not_ recommended. The preferred way is to keep the executable
in the runtime directory.
If you move your executable AND want to put your "_vimrc" and "_gvimrc" files
somewhere else, you must set $VIM to where you vimrc files are, and set
$VIMRUNTIME to the runtime files. Example: >
set VIM=C:\usr\piet
set VIMRUNTIME=E:\vim\vim54
Will find "c:\user\piet\_vimrc" and the runtime files in "e:\vim\vim54".
See |$VIM| and |$VIMRUNTIME| for more information.
Under Windows 95, you can set $VIM in your C:\autoexec.bat file. For
example: >
set VIM=D:\vim
Under Windows NT, you can set environment variables for each user separately
under "Start/Settings/Control Panel->System", or through the properties in the
menu of "My Computer", under the Environment Tab.
==============================================================================
2. Using backslashes *dos-backslash*
Using backslashes in file names can be a problem. Vi halves the number of
backslashes for some commands. Vim is a bit more tolerant and does not remove
backslashes from a file name, so ":e c:\foo\bar" works as expected. But when
a backslash occurs before a special character (space, comma, backslash, etc.),
Vim removes the backslash. Use slashes to avoid problems: ":e c:/foo/bar"
works fine. Vim replaces the slashes with backslashes internally to avoid
problems with some MS-DOS programs and Win32 programs.
When you prefer to use forward slashes, set the 'shellslash' option. Vim will
then replace backslashes with forward slashes when expanding file names. This
is especially useful when using a Unix-like 'shell'.
==============================================================================
3. Standard mappings *dos-standard-mappings*
The mappings for CTRL-PageUp and CTRL-PageDown have been removed, they now
jump to the next or previous tab page |<C-PageUp>| |<C-PageDown>|
If you want them to move to the first and last screen line you can use these
mappings:
key key code Normal/Visual mode Insert mode ~
CTRL-PageUp <M-N><M-C-D> H <C-O>H
CTRL-PageDown <M-N>v L$ <C-O>L<C-O>$
Additionally, these keys are available for copy/cut/paste. In the Win32
and DJGPP versions, they also use the clipboard.
Shift-Insert paste text (from clipboard) *<S-Insert>*
CTRL-Insert copy Visual text (to clipboard) *<C-Insert>*
CTRL-Del cut Visual text (to clipboard) *<C-Del>*
Shift-Del cut Visual text (to clipboard) *<S-Del>*
These mappings accomplish this (Win32 and DJGPP versions of Vim):
key key code Normal Visual Insert ~
Shift-Insert <M-N><M-T> "*P "-d"*P <C-R><C-O>*
CTRL-Insert <M-N><M-U> "*y
Shift-Del <M-N><M-W> "*d
CTRL-Del <M-N><M-X> "*d
Or these mappings (non-Win32 version of Vim):
key key code Normal Visual Insert ~
Shift-Insert <M-N><M-T> P "-dP <C-R><C-O>"
CTRL-Insert <M-N><M-U> y
Shift-Del <M-N><M-W> d
CTRL-Del <M-N><M-X> d
When the clipboard is supported, the "* register is used.
==============================================================================
4. Screen output and colors *dos-colors*
The default output method for the screen is to use bios calls. This works
right away on most systems. You do not need ansi.sys. You can use ":mode" to
set the current screen mode. See |:mode|.
To change the screen colors that Vim uses, you can use the |:highlight|
command. The Normal highlight group specifies the colors Vim uses for normal
text. For example, to get grey text on a blue background: >
:hi Normal ctermbg=Blue ctermfg=grey
See |highlight-groups| for other groups that are available.
A DOS console does not support attributes like bold and underlining. You can
set the color used in five modes with nine terminal options. Note that this
is not necessary since you can set the color directly with the ":highlight"
command; these options are for backward compatibility with older Vim versions.
The |'highlight'| option specifies which of the five modes is used for which
action. >
:set t_mr=^V^[\|xxm start of invert mode
:set t_md=^V^[\|xxm start of bold mode
:set t_me=^V^[\|xxm back to normal text
:set t_so=^V^[\|xxm start of standout mode
:set t_se=^V^[\|xxm back to normal text
:set t_us=^V^[\|xxm start of underline mode
:set t_ue=^V^[\|xxm back to normal text
:set t_ZH=^V^[\|xxm start of italics mode
:set t_ZR=^V^[\|xxm back to normal text
^V is CTRL-V
^[ is <Esc>
You must replace xx with a decimal code, which is the foreground color number
and background color number added together:
COLOR FOREGROUND BACKGROUND ~
Black 0 0
DarkBlue 1 16
DarkGreen 2 32
DarkCyan 3 48
DarkRed 4 64
DarkMagenta 5 80
Brown, DarkYellow 6 96
LightGray 7 112
DarkGray 8 128 *
Blue, LightBlue 9 144 *
Green, LightGreen 10 160 *
Cyan, LightCyan 11 176 *
Red, LightRed 12 192 *
Magenta, LightMagenta 13 208 *
Yellow, LightYellow 14 224 *
White 15 240 *
* Depending on the display mode, the color codes above 128 may not be
available, and code 128 will make the text blink.
When you use 0, the color is reset to the one used when you started Vim
(usually 7, lightgray on black, but you can override this. If you have
overridden the default colors in a command prompt, you may need to adjust
some of the highlight colors in your vimrc---see below).
This is the default for t_me.
The defaults for the various highlight modes are:
t_mr 112 reverse mode: Black text (0) on LightGray (112)
t_md 15 bold mode: White text (15) on Black (0)
t_me 0 normal mode (revert to default)
t_so 31 standout mode: White (15) text on DarkBlue (16)
t_se 0 standout mode end (revert to default)
t_czh 225 italic mode: DarkBlue text (1) on Yellow (224)
t_czr 0 italic mode end (revert to default)
t_us 67 underline mode: DarkCyan text (3) on DarkRed (64)
t_ue 0 underline mode end (revert to default)
These colors were chosen because they also look good when using an inverted
display, but you can change them to your liking.
Example: >
:set t_mr=^V^[\|97m " start of invert mode: DarkBlue (1) on Brown (96)
:set t_md=^V^[\|67m " start of bold mode: DarkCyan (3) on DarkRed (64)
:set t_me=^V^[\|112m " back to normal mode: Black (0) on LightGray (112)
:set t_so=^V^[\|37m " start of standout mode: DarkMagenta (5) on DarkGreen
(32)
:set t_se=^V^[\|112m " back to normal mode: Black (0) on LightGray (112)
==============================================================================
5. File formats *dos-file-formats*
If the 'fileformat' option is set to "dos" (which is the default), Vim accepts
a single <NL> or a <CR><NL> pair for end-of-line (<EOL>). When writing a
file, Vim uses <CR><NL>. Thus, if you edit a file and write it, Vim replaces
<NL> with <CR><NL>.
If the 'fileformat' option is set to "unix", Vim uses a single <NL> for <EOL>
and shows <CR> as ^M.
You can use Vim to replace <NL> with <CR><NL> by reading in any mode and
writing in Dos mode (":se ff=dos").
You can use Vim to replace <CR><NL> with <NL> by reading in Dos mode and
writing in Unix mode (":se ff=unix").
Vim sets 'fileformat' automatically when 'fileformats' is not empty (which is
the default), so you don't really have to worry about what you are doing.
|'fileformat'| |'fileformats'|
If you want to edit a script file or a binary file, you should set the
'binary' option before loading the file. Script files and binary files may
contain single <NL> characters which Vim would replace with <CR><NL>. You can
set 'binary' automatically by starting Vim with the "-b" (binary) option.
==============================================================================
6. :cd command *dos-:cd*
The ":cd" command recognizes the drive specifier and changes the current
drive. Use ":cd c:" to make drive C the active drive. Use ":cd d:\foo" to go
to the directory "foo" in the root of drive D. Vim also recognizes UNC names
if the system supports them; e.g., ":cd \\server\share\dir". |:cd|
==============================================================================
7. Interrupting *dos-CTRL-Break*
Use CTRL-Break instead of CTRL-C to interrupt searches. Vim does not detect
the CTRL-C until it tries to read a key.
==============================================================================
8. Temp files *dos-temp-files*
Only for the 16 bit and 32 bit DOS version:
Vim puts temporary files (for filtering) in the first of these directories
that exists and in which Vim can create a file:
$TMP
$TEMP
C:\TMP
C:\TEMP
current directory
For the Win32 version (both console and GUI):
Vim uses standard Windows functions to obtain a temporary file name (for
filtering). The first of these directories that exists and in which Vim can
create a file is used:
$TMP
$TEMP
current directory
==============================================================================
9. Shell option default *dos-shell*
The default for the 'sh' ('shell') option is "command.com" on Windows 95 and
"cmd.exe" on Windows NT. If SHELL is defined, Vim uses SHELL instead, and if
SHELL is not defined but COMSPEC is, Vim uses COMSPEC. Vim starts external
commands with "<shell> /c <command_name>". Typing CTRL-Z starts a new command
subshell. Return to Vim with "exit". |'shell'| |CTRL-Z|
If you are running a third-party shell, you may need to set the
|'shellcmdflag'| ('shcf') and |'shellquote'| ('shq') or |'shellxquote'|
('sxq') options. Unfortunately, this also depends on the version of Vim used.
For example, with the MKS Korn shell or with bash, the values of the options
should be:
DOS 16 bit DOS 32 bit Win32 ~
'shellcmdflag' -c -c -c
'shellquote' "
'shellxquote' "
For Dos 16 bit this starts the shell as:
<shell> -c "command name" >file
For Win32 as:
<shell> -c "command name >file"
For DOS 32 bit, DJGPP does this internally somehow.
When starting up, Vim checks for the presence of "sh" anywhere in the 'shell'
option. If it is present, Vim sets the 'shellcmdflag' and 'shellquote' or
'shellxquote' options will be set as described above.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,118 +0,0 @@
*os_mac.txt* For Vim version 7.4. Last change: 2006 Apr 30
VIM REFERENCE MANUAL by Bram Moolenaar et al.
*mac* *Mac* *macintosh* *Macintosh*
This file documents the particularities of the Macintosh version of Vim.
NOTE: This file is a bit outdated. You might find more useful info here:
http://macvim.org/
1. Filename Convention |mac-filename|
2. .vimrc an .vim files |mac-vimfile|
3. FAQ |mac-faq|
4. Known Lack |mac-lack|
5. Mac Bug Report |mac-bug|
6. Compiling Vim |mac-compile|
There was a Mac port for version 3.0 of Vim. Here are the first few lines
from the old file:
VIM Release Notes
Initial Macintosh release, VIM version 3.0
19 October 1994
Eric Fischer
<enf1@midway.uchicago.edu>, <eric@jcp.uchicago.edu>, <etaoin@uchicago.edu>
5759 N. Guilford Ave
Indianapolis IN 46220 USA
==============================================================================
1. Filename Convention *mac-filename*
Starting with Vim version 7 you can just use the unix path separators with
Vim. In order to determine if the specified filename is relative to the
current folder or absolute (i.e. relative to the "Desktop"), the following
algorithm is used:
If the path start by a "/", the path is absolute
If the path start by a ":", the path is relative
If the path doesn't start by neither a "/" nor ":",
and a ":" is found before a "/" then the path is absolute
>
:e /HD/text
:e HD:text
< Edit the file "text" of the disk "HD" >
:e :src:main.c
:e src/main.c
< Edit the file "main.c" in the folder "src" in the current folder >
:e os_mac.c
< Edit the file "os_mac.c" in the current folder.
You can use the |$VIM| and |$VIMRUNTIME| variable. >
:so $VIMRUNTIME:syntax:syntax.vim
==============================================================================
2. .vimrc and .vim files *mac-vimfile*
It is recommended to use Unix style line separators for Vim scripts, thus a
single newline character.
When starting up Vim will load the $VIMRUNTIME/macmap.vim script to define
default command-key mappings.
On older systems files starting with a dot "." are discouraged, thus the rc
files are named "vimrc" or "_vimrc" and "gvimrc" or "_gvimrc". These files
can be in any format (mac, dos or unix). Vim can handle any file format when
the |'nocompatible'| option is set, otherwise it will only handle mac format
files.
==============================================================================
3. Mac FAQ *mac-faq*
On the internet: http://macvim.org/OSX/index.php#FAQ
Q: I can't enter non-ASCII character in Apple Terminal.
A: Under Window Settings, Emulation, make sure that "Escape non-ASCII
characters" is not checked.
Q: How do I start the GUI from the command line?
A: Assuming that Vim.app is located in /Applications:
open /Applications/Vim.app
Or:
/Applications/Vim.app/Contents/MacOS/Vim -g {arguments}
Q: How can I set $PATH to something reasonable when I start Vim.app from the
GUI or with open?
A: The following trick works with most shells. Put it in your vimrc file.
This is included in the system vimrc file included with the binaries
distributed at macvim.org . >
let s:path = system("echo echo VIMPATH'${PATH}' | $SHELL -l")
let $PATH = matchstr(s:path, 'VIMPATH\zs.\{-}\ze\n')
==============================================================================
4. Mac Lack *mac-lack*
In a terminal CTRL-^ needs to be entered as Shift-Control-6. CTRL-@ as
Shift-Control-2.
==============================================================================
5. Mac Bug Report *mac-bug*
When reporting any Mac specific bug or feature change, please use the vim-mac
maillist |vim-mac|. However, you need to be subscribed. An alternative is to
send a message to the current MacVim maintainers:
mac@vim.org
==============================================================================
6. Compiling Vim *mac-compile*
See the file "src/INSTALLmac.txt" that comes with the source files.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,39 +0,0 @@
*os_mint.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Jens M. Felderhoff
*MiNT* *Atari*
This file contains the particularities for the Atari MiNT version of Vim.
For compiling Vim on the Atari running MiNT see "INSTALL" and "Makefile"
in the src directory.
Vim for MiNT behaves almost exactly like the Unix version.
The Unix behavior described in the documentation also refers to the
MiNT version of Vim unless explicitly stated otherwise.
For wildcard expansion of <~> (home directory) you need a shell that
expands the tilde. The vanilla Bourne shell doesn't recognize it.
With csh and ksh it should work OK.
The MiNT version of vim needs the termcap file /etc/termcap with the
terminal capabilities of your terminal. Builtin termcaps are
supported for the vt52 terminal. Termcap entries for the TOSWIN window
manager and the virtual console terminals have been appended to the
termcap file that comes with the Vim distribution.
If you should encounter problems with swapped <BS> and <Del> keys, see
|:fixdel|.
Because terminal updating under MiNT is often slow (e.g. serial line
terminal), the 'showcmd' and 'ruler' options are default off.
If you have a fast terminal, try setting them on. You might
also want to set 'ttyfast'.
Send bug reports to
Jens M. Felderhoff, e-mail: <jmf@infko.uni-koblenz.de>
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,276 +0,0 @@
*os_msdos.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
*msdos* *ms-dos* *MSDOS* *MS-DOS*
This file contains the particularities for the MS-DOS version of Vim.
1. Two versions for MS-DOS |msdos-versions|
2. Known problems |msdos-problems|
3. Long file names |msdos-longfname|
4. Termcap codes |msdos-termcap|
5. Shifted arrow keys |msdos-arrows|
6. Filename extensions |msdos-fname-extensions|
7. Memory usage and limitations |msdos-limitations|
8. Symbolically linked files |msdos-linked-files|
9. Copy/paste in a dos box |msdos-copy-paste|
Additionally, there are a number of common Win32 and DOS items:
File locations |dos-locations|
Using backslashes |dos-backslash|
Standard mappings |dos-standard-mappings|
Screen output and colors |dos-colors|
File formats |dos-file-formats|
:cd command |dos-:cd|
Interrupting |dos-CTRL-Break|
Temp files |dos-temp-files|
Shell option default |dos-shell|
For compiling Vim see src/INSTALL.pc. *msdos-compiling*
==============================================================================
1. Two versions for MS-DOS *msdos-versions*
There are two versions of Vim that can be used with MS-DOS machines:
*dos16*
Dos16 version Can be used on any MS-DOS system, only uses up to 640 Kbyte of
memory. Also runs on OS/2, Windows 95, and NT. Excludes some
Vim-specific features (autocommands, syntax highlighting,
etc.). Recommended for use on pre-386 machines.
*dos32*
Dos32 version Requires 386 processor and a |DPMI| driver, uses all
available memory. Supports long file names and the Windows
clipboard, but NOT on Windows NT. Recommended for MS-DOS,
Windows 3.1 and Windows 95.
There are also two versions that run under Windows:
Win32 version Requires Windows 95 or Windows NT, uses all available
memory, supports long file names, etc. Has some problems on
Windows 95. Recommended for Windows NT. See |os_win32.txt|
Win32 GUI Requirements like the Win32 version, but runs in its own
window, instead of a console. Has scrollbars, menu, etc.
Recommended for Windows 95 and Windows NT. See |gui-w32|.
It is recommended to use the Dos32 or Win32 version. Although the Dos16
version is able to edit very big files, it quickly runs out of memory when
making big changes. Disabling undo helps: ":set ul=-1". The screen updating
of the Dos16 version is the fastest of the three on DOS or Windows 95; on
Windows NT, the Win32 version is just as fast.
*DPMI*
For the Dos32 version, you may need a DPMI driver when running in MS-DOS. If
you are running Windows or installed a clever memory manager, it will probably
work already. If you get the message "No DPMI", you need to install a DPMI
driver. Such a driver is included with the executable in CSDPMI4B.ZIP. Run
"cwsdpmi" just before starting Vim each time. Or you might want to include
"cwsdpmi -p" in your autoexec.bat to make it resident. The latest version of
"CSDPMI*.ZIP" can be obtained from: "ftp.neosoft.com:pub/users/s/sandmann".
*minimal-features*
The 16 bit DOS version has been compiled with minimal features. Check the
|+feature-list| which ones are included (marked with a "T").
You can include more features by editing feature.h and recompiling.
==============================================================================
2. Known problems *msdos-problems*
When using smartdrive (MS-DOS 6.x) with write-behind caching, it is possible
that Vim will try to create a swap file on a read-only file system (e.g.
write protected floppy). You will then be given the message >
A serious disk error has occurred .., Retry (r)?
There is nothing you can do but unprotect the floppy or switch off the
computer. Even CTRL-ALT-DEL will not get you out of this. This is really a
problem of smartdrive, not Vim. Smartdrive works fine otherwise. If this
bothers you, don't use the write-behind caching.
Vim can't read swap files that have been opened already, unless the "share"
command has been used. If you see stray warnings for existing swap files,
include the "share" command in your config.sys or autoexec.bat (see your MSDOS
documentation).
The Dos16 version can only have about 10 files open (in a window or hidden) at
one time. With more files you will get error messages when trying to read or
write a file, and for filter commands. Or Vim runs out of memory, and random
problems may result.
The Dos32 version cannot have an unlimited number of files open at any one
time. The limit depends on the setting of FILES in your CONFIG.SYS. This
defaults to 15; if you need to edit a lot of files, you should increase this.
If you do not set FILES high enough, you can get strange errors, and shell
commands may cause a crash!
The Dos32 version can work with long file names. When doing file name
completion, matches for the short file name will also be found. But this will
result in the corresponding long file name. For example, if you have the long
file name "this_is_a_test" with the short file name "this_i~1", the command
":e *1" will start editing "this_is_a_test".
When using the Dos32 version and you run into problems with DPMI support,
check if there is a program in your config.sys that eats resources. One
program known to cause this problem is "netx", which says "NetWare v. 3.26
Workstation shell". Replace it with version 3.32 to fix the problem.
The Dos32 version will parse its arguments to handle quotation. This is good
to edit a file with spaces in its name, for example: >
vim "program files\accessories\ppp.scp"
A side effect is that single quotes are removed. Insert a backslash to avoid
that. For example, to edit the file "fi'le.txt": >
vim fi\'le.txt
==============================================================================
3. Long file names *msdos-longfname*
If the Dos32 version is run on Windows 95, it can use long file names. It
will work by default. If you want to disable this, use this setting:
set LFN=N
You can put this in your autoexec.bat file.
Note: If you have installed DJGPP on your machine, you probably have a
"djgpp.env" file, which contains "LFN=n". You need to use "LFN=Y" to switch
on using long file names then.
==============================================================================
4. Termcap codes *msdos-termcap*
If you want to use another output method (e.g., when using a terminal on a COM
port), set the terminal name to "pcansi". You can change the termcap options
when needed (see |terminal-options|). Note that the
normal IBM ansi.sys does not support all the codes of the builtin pcansi
terminal. If you use ansi.sys, you will need to delete the termcap entries
t_al and t_dl with >
:set t_al= t_dl=
Otherwise, the screen will not be updated correctly. It is better to use
nansi.sys, nnansi.sys, or the like instead of ansi.sys.
If you want to use Vim on a terminal connected to a COM: port, reset the
'bioskey' option. Otherwise the commands will be read from the PC keyboard.
CTRL-C and CTRL-P may not work correctly with 'bioskey' reset.
==============================================================================
5. Shifted arrow keys *msdos-arrows*
Use CTRL-arrow-left and CTRL-arrow-right instead of SHIFT-arrow-left and
SHIFT-arrow-right. The arrow-up and arrow-down cannot be used with SHIFT or
CTRL.
==============================================================================
6. Filename extensions *msdos-fname-extensions*
MS-DOS allows for only one file name extension. Therefore, when appending an
extension, the '.' in the original file name is replaced with a '_', the name
is truncated to 8 characters, and the new extension (e.g., ".swp") is
appended. Two examples: "test.c" becomes "test_c.bak", "thisisat.est"
becomes "thisisat.bak". To reduce these problems, the default for
'backupext' is "~" instead of ".bak". The backup file for "thisisat.est"
then becomes "thisisat.es~". The 'shortname' option is not available,
because it would always be set.
==============================================================================
7. Memory usage and limitations *msdos-limitations*
A swap file is used to store most of the text. You should be able to edit
very large files. However, memory is used for undo and other things. If you
delete a lot of text, you can still run out of memory in the Dos16 version.
If Vim gives an "Out of memory" warning, you should stop editing. The result
of further editing actions is unpredictable. Setting 'undolevels' to 0 saves
some memory. Running the maze macros on a big maze is guaranteed to run out
of memory, because each change is remembered for undo. In this case set
'undolevels' to a negative number. This will switch off undo completely.
*msdos-clipboard-limits*
In the Dos32 version, extended memory is used to avoid these problems.
However, if you are using the clipboard, you can still run into memory
limitations because the Windows clipboard can only communicate with Vim using
Dos memory. This means that the largest amount of text that can be sent to
or received from the Windows clipboard is limited by how much free Dos memory
is available on your system.
You can usually maximize the amount of available Dos memory by adding the
following lines to Dos's "config.sys" file: >
DOS=HIGH,UMB
DEVICE=C:\WINDOWS\himem.sys
DEVICE=C:\WINDOWS\emm386.exe RAM
Modifying config.sys in this way will also help to make more memory available
for the Dos16 version, if you are using that.
In the Dos16 version the line length is limited to about 32000 characters.
When reading a file the lines are automatically split. But editing a line
in such a way that it becomes too long may give unexpected results.
==============================================================================
8. Symbolically linked files *msdos-linked-files*
When using Vim to edit a symbolically linked file on a unix NFS file server,
you may run into problems. When writing the file, Vim does not "write
through" the symlink. Instead, it deletes the symbolic link and creates a new
file in its place.
On Unix, Vim is prepared for links (symbolic or hard). A backup copy of the
original file is made and then the original file is overwritten. This assures
that all properties of the file remain the same. On non-Unix systems, the
original file is renamed and a new file is written. Only the protection bits
are set like the original file. However, this doesn't work properly when
working on an NFS-mounted file system where links and other things exist. The
only way to fix this in the current version is not making a backup file, by
":set nobackup nowritebackup" |'writebackup'|
A similar problem occurs when mounting a Unix filesystem through Samba or a
similar system. When Vim creates a new file it will get the default user ID
for the mounted file system. This may be different from the original user ID.
To avoid this set the 'backupcopy' option to "yes".
==============================================================================
9. Copy/paste in a dos box *msdos-copy-paste*
*E450* *E451* *E452* *E453* *E454*
The 32 bit version can copy/paste from/to the Windows clipboard directly. Use
the "* register. Large amounts of text can be copied this way, but it must be
possible to allocate memory for it, see |msdos-clipboard-limits|. When moving
text from one Vim to another, the type of the selection
(characterwise/linewise/blockwise) is passed on.
In other versions, the following can be used.
(posted to comp.editors by John Velman <velman@igate1.hac.com>)
How to copy/paste text from/to vim in a dos box:
1) To get VIM to run in a window, instead of full screen, press alt+enter.
This toggles back and forth between full screen and a dos window.
NOTE: In Windows 95 you must have the property "Fast Pasting" unchecked!
In the properties dialog box for the MS-DOS window, go to "MS-DOS
Prompt/Misc/Fast pasting" and make sure that it is NOT checked.
To make this permanent, change the properties for
"\windows\system\conagent.exe" (from Philip Nelson, unverified).
2) To paste something _into_ Vim, put Vim in insert mode.
3) Put the text you want to paste on the windows clipboard.
4) Click the control box in the upper left of the Vim window. (This looks
like a big minus sign.) If you don't want to use the mouse, you can get
this with alt+spacebar.
5) On the resulting dropdown menu choose "Edit".
6) On the child dropdown menu choose "Paste".
To copy something from the Vim window to the clipboard,
1) Select the control box to get the control drop down menu.
2) Select "Edit".
3) Select "Mark".
4) Using either the keys or the mouse, select the part of the Vim window that
you want to copy. To use the keys, use the arrow keys, and hold down shift
to extend the selection.
5) When you've completed your selection, press 'enter'. The selection
is now in the windows clipboard. By the way, this can be any
rectangular selection, for example columns 4-25 in rows 7-10. It can
include anything in the VIM window: the output of a :!dir, for
example.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,221 +0,0 @@
*os_os2.txt* For Vim version 7.4. Last change: 2007 Apr 22
VIM REFERENCE MANUAL by Paul Slootman
*os2* *OS2* *OS/2*
This file contains the particularities for the OS/2 version of Vim.
At present there is no native PM version of the GUI version of Vim: The OS/2
version is a console application. However, there is now a Win32s-compatible
GUI version, which should be usable by owners of Warp 4 (which supports
Win32s) in a Win-OS/2 session. The notes in this file refer to the native
console version.
NOTE
This OS/2 port works well for me and a couple of other OS/2 users; however,
since I haven't had much feedback, that either means no (OS/2-specific) bugs
exist (besides the ones mentioned below), or no one has yet created a
situation in which any bugs are apparent. File I/O in Dos and Unix mode,
binary mode, and FAT handling all seem to work well, which would seem to be
the most likely places for trouble.
A known problem is that files opened by Vim are inherited by other programs
that are started via a shell escape from within Vim. This specifically means
that Vim won't be able to remove the swap file(s) associated with buffers open
at the time the other program was started, until the other program is stopped.
At that time, the swap file may be removed, but if Vim could not do that the
first time, it won't be removed at all. You'll get warnings that some other
Vim session may be editing the file when you start Vim up again on that file.
This can be reproduced with ":!start epm". Now quit Vim, and start Vim again
with the file that was in the buffer at the time epm was started. I'm working
on this!
A second problem is that Vim doesn't understand the situation when using it
when accessing the OS/2 system via the network, e.g. using telnet from a Unix
system, and then starting Vim. The problem seems to be that OS/2 =sometimes=
recognizes function / cursor keys, and tries to convert those to the
corresponding OS/2 codes generated by the "normal" PC keyboard. I've been
testing a workaround (mapping the OS/2 codes to the correct functions), but so
far I can't say anything conclusive (this is on Warp 3, by the way). In the
meantime any help will be appreciated.
PREREQUISITES
To run Vim, you need the emx runtime environment (at least rev. 0.9b). This
is generally available as (ask Archie about it):
emxrt.zip emx runtime package
I've included a copy of emx.dll, which should be copied to one of the
directories listed in your LIBPATH. Emx is GPL'ed, but the emx.dll library is
not (read COPYING.EMX to find out what that means to you).
This emx.dll is from the emxfix04.zip package, which unfortunately has a bug,
eh, I mean a POSIX feature, in select(). Versions of Vim before 3.27 will
appear to hang when starting (actually, while processing vimrc). Hit <Enter> a
couple of times until Vim starts working if this happens. Next, get an up to
date version of Vim!
HELP AND VIMRC FILE
If you unpack the archive that Vim came in and run Vim directly from where it
was unpacked, Vim should be able to find the runtime files and your .vimrc
without any settings.
If you put the runtime files separately from the binary, the VIM environment
variable is used to find the location of the help files and the system .vimrc.
Place an entry such as this in CONFIG.SYS: >
SET VIM=c:/local/lib/vim
Put your .vimrc and your other Vim files in this directory. Copy the runtime
directory to this directory. Each version of Vim has its own runtime
directory. It will be called something like "c:/local/lib/vim/vim54". Thus
you get a tree of Vim files like this:
c:/local/lib/vim/.vimrc
c:/local/lib/vim/vim54/filetype.vim
c:/local/lib/vim/vim54/doc/help.txt
etc.
Note: .vimrc may also be called _vimrc to accommodate those who have chosen to
install OS/2 on a FAT file system. Vim first tries to find .vimrc and if that
fails, looks for _vimrc in the same place. The existence of a .vimrc or
_vimrc file influences the 'compatible' options, which can have unexpected side
effects. See |'compatible'|.
If you're using network drives with OS/2, then you can install Vim on a
network drive (including .vimrc; this is then called the "system" vimrc file),
and then use a personal copy of .vimrc (the "user" vimrc file). This should be
located in a directory indicated by the HOME environment variable.
ENVIRONMENT VARIABLES IN FILE NAMES
This HOME environment variable is also used when using ~ in file names, so
":e ~/textfile" will edit the file "textfile" in the directory referred to by
HOME. Additionally you can use other environment variables in file names, as
in ":n $SRC/*.c".
The HOME environment variable is also used to locate the .viminfo file
(see |viminfo-file|). There is no support yet for .viminfo on FAT file
systems yet, sorry. You could try the -i startup flag (as in "vim -i
$HOME/_viminfo") however.
If the HOME environment variable is not set, the value "C:/" is used as a
default.
BACKSLASHES
Using slashes ('/') and backslashes ('\') can be a bit of a problem (see
|dos-backslash| for more explanation), but in almost all cases Vim does "The
Right Thing". Vim itself uses backslashes in file names, but will happily
accept forward slashes if they are entered (in fact, sometimes that works
better!).
TEMP FILES
Temporary files (for filtering) are put in the first directory in the next
list that exists and where a file can be created:
$TMP
$TEMP
C:\TMP
C:\TEMP
current directory
TERMINAL SETTING
*os2ansi*
Use "os2ansi" as the TERM environment variable (or don't set it at all, as the
default is the correct value). You can set term to os2ansi in the .vimrc, in
case you need TERM to be a different value for other applications. The
problem is that OS/2 ANSI emulation is quite limited (it doesn't have insert /
delete line, for example).
If you want to use a different value for TERM (because of other programs, for
example), make sure that the termcap entry for that TERM value has the
appropriate key mappings. The termcap.dat distributed with emx does not always
have them. Here are some suitable values to add to the termcap entry of your
choice; these allow the cursor keys and the named function keys (such as
pagedown) to work.
:ku=\316H:kd=\316P:kl=\316K:kr=\316M:%i=\316t:#4=\316s:\
:kD=\316S:kI=\316R:kN=\316Q:kP=\316I:kh=\316G:@7=\316O:\
:k1=\316;:k2=\316<:k3=\316=:k4=\316>:k5=\316?:k6=\316@:\
:k7=\316A:k8=\316B:k9=\316C:k;=\316D:
Paul Slootman
43 LINE WINDOW
A suggestion from Steven Tryon, on how to run Vim in a bigger window:
When I call Vim from an OS/2 WPS application such as PMMail it comes up
in the default 25-line mode. To get a more useful window size I make
my external editor "vimbig.cmd" which in turn calls "vimbig2.cmd".
Brute force and awkwardness, perhaps, but it works.
vimbig.cmd: >
@echo off
start "Vi Improved" /f vimbig2.cmd %1 %2 %3 %4
vimbig2.cmd: >
@echo off
mode 80,43
vim.exe %1 %2 %3 %4
exit
<
CLIPBOARD ACCESS (provided by Alexander Wagner)
Vim for OS/2 has no direct access to the system clipboard. To enable access
anyway you need an additional tool which gives you access to the clipboard
from within a vio application. The freeware package clipbrd.zip by Stefan
Gruendel can be used for this purpose. You might download the package
including precompiled binaries and all sources from:
http://www.os2site.com/sw/util/clipboard/index.html
http://download.uni-hd.de/ftp/pub/os2/pmtools/
Installation of this package is straight forward: just put the two executables
that come with this package into a directory within your PATH for Vim should
be able to call them from whatever directory you are working.
To copy text from the clipboard to your Vim session you can use the :r
command. Simply call clipbrd.exe from within Vim in the following way: >
:r !clipbrd -r
To copy text from Vim to the system clipboard just mark the text in the usual
vim-manner and call: >
:!clipbrd -w
which will write your selection right into OS/2's clipboard.
For ease of use you might want to add some maps for these commands. E.g. to
use F11 to paste the clipboard into Vim and F12 to copy selected text to the
clipboard you would use: >
if has("os2")
imap <F11> <ESC>:r !clipbrd -r<CR>i
vmap <F12> :!clipbrd -w<cr>
else
imap <F11> <ESC>"*p<CR>i
vmap <F12> "*y
endif
This will ensure that only on OS/2 clipbrd is called whereas on other
platforms vims build in mechanism is used. (To enable this functions on every
load of Vim place the above lines in your .vimrc.)
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,138 +0,0 @@
*os_qnx.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Julian Kinraid
*QNX* *qnx*
1. General |qnx-general|
2. Compiling Vim |qnx-compiling|
3. Terminal support |qnx-terminal|
4. Photon GUI |photon-gui|
5. Photon fonts |photon-fonts|
6. Bugs & things To Do
==============================================================================
1. General *qnx-general*
Vim on QNX behaves much like other unix versions. |os_unix.txt|
2. Compiling Vim *qnx-compiling*
Vim can be compiled using the standard configure/make approach. If you want to
compile for X11, pass the --with-x option to configure. Otherwise, running
./configure without any arguments or passing --enable-gui=photon, will compile
vim with the Photon gui support. Run ./configure --help , to find out other
features you can enable/disable.
3. Terminal support *qnx-terminal*
Vim has support for the mouse and clipboard in a pterm, if those options
are compiled in, which they are normally.
The options that affect mouse support are |'mouse'| and |'ttymouse'|. When
using the mouse, only simple left and right mouse clicking/dragging is
supported. If you hold down shift, ctrl, or alt while using the mouse, pterm
will handle the mouse itself. It will make a selection, separate from what
vim's doing.
When the mouse is in use, you can press Alt-RightMouse to open the pterm menu.
To turn the mouse off in vim, set the mouse option to nothing, set mouse=
4. Photon GUI *photon-gui*
To start the gui for vim, you need to run either gvim or vim -g, otherwise
the terminal version will run. For more info - |gui-x11-start|
Supported features:
:browse command |:browse|
:confirm command |:confirm|
Cursor blinking |'guicursor'|
Menus, popup menus and menu priorities |:menu|
|popup-menu|
|menu-priority|
Toolbar |gui-toolbar|
|'toolbar'|
Font selector (:set guifont=*) |photon-fonts|
Mouse focus |'mousefocus'|
Mouse hide |'mousehide'|
Mouse cursor shapes |'mouseshape'|
Clipboard |gui-clipboard|
Unfinished features:
Various international support, such as Farsi & Hebrew support,
different encodings, etc.
This help file
Unsupported features:
Find & Replace window |:promptfind|
Tearoff menus
Other things which I can't think of so I can't list them
5. Fonts *photon-fonts*
You set fonts in the gui with the guifont option >
:set guifont=Lucida\ Terminal
<
The font must be a monospace font, and any spaces in the font name must be
escaped with a '\'. The default font used is PC Terminal, size 8. Using
'*' as the font name will open a standard Photon font selector where you can
select a font.
Following the name, you can include optional settings to control the size and
style of the font, each setting separated by a ':'. Not all fonts support the
various styles.
The options are,
s{size} Set the size of the font to {size}
b Bold style
a Use antialiasing
i Italic style
Examples:
Set the font to monospace size 10 with antialiasing >
:set guifont=monospace:s10:a
<
Set the font to Courier size 12, with bold and italics >
:set guifont=Courier:s12:b:i
<
Select a font with the requester >
:set guifont=*
<
6. Bugs & things To Do
Known problems:
- Vim hangs sometimes when running an external program. Workaround:
put this line in your |vimrc| file: >
set noguipty
Bugs:
- Still a slight problem with menu highlighting.
- When using phditto/phinows/etc., if you are using a font that
doesn't support the bold attribute, when vim attempts to draw
bold text it will be all messed up.
- The cursor can sometimes be hard to see.
- A number of minor problems that can fixed. :)
Todo:
- Improve multi-language support.
- Options for setting the fonts used in the menu and toolbar.
- Find & Replace dialog.
- The clientserver features.
- Maybe tearoff menus.
- Replace usage of fork() with spawn() when launching external
programs.
vim:tw=78:sw=4:ts=8:ts=8:ft=help:norl:

View file

@ -1,12 +0,0 @@
*os_risc.txt* For Vim version 7.4. Last change: 2011 May 10
VIM REFERENCE MANUAL by Thomas Leonard
*riscos* *RISCOS* *RISC-OS*
The RISC OS support has been removed from Vim with patch 7.3.187.
If you would like to use Vim on RISC OS get the files from before that patch.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,60 +0,0 @@
*os_unix.txt* For Vim version 7.4. Last change: 2005 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
*unix* *Unix*
This file contains the particularities for the Unix version of Vim.
For compiling Vim on Unix see "INSTALL" and "Makefile" in the src directory.
The default help file name is "/usr/local/lib/vim/help.txt"
The files "$HOME/.vimrc" and "$HOME/.exrc" are used instead of "s:.vimrc" and
"s:.exrc". Additionally "/usr/local/etc/vimrc" is used first.
If "/usr/local/share" exists it is used instead of "/usr/local/lib".
Temporary files (for filtering) are put in "/tmp". If you want to place them
somewhere else, set the environment variable $TMPDIR to the directory you
prefer.
With wildcard expansion you can use '~' (home directory) and '$'
(environment variable).
*fork* *spoon*
For executing external commands fork()/exec() is used when possible, otherwise
system() is used, which is a bit slower. The output of ":version" includes
|+fork| when fork()/exec() is used, |+system()| when system() is used. This
can be changed at compile time.
(For forking of the GUI version see |gui-fork|.)
Because terminal updating under Unix is often slow (e.g. serial line
terminal, shell window in suntools), the 'showcmd' and 'ruler' options
are default off. If you have a fast terminal, try setting them on. You might
also want to set 'ttyfast'.
When using Vim in an xterm the mouse clicks can be used by Vim by setting
'mouse' to "a". If there is access to an X-server gui style copy/paste will
be used and visual feedback will be provided while dragging with the mouse.
If you then still want the xterm copy/paste with the mouse, press the shift
key when using the mouse. See |mouse-using|. Visual feedback while dragging
can also be achieved via the 'ttymouse' option if your xterm is new enough.
*terminal-colors*
To use colors in Vim you can use the following example (if your terminal
supports colors, but "T_Co" is empty or zero): >
:set t_me=^[[0;1;36m " normal mode (undoes t_mr and t_md)
:set t_mr=^[[0;1;33;44m " reverse (invert) mode
:set t_md=^[[1;33;41m " bold mode
:set t_se=^[[1;36;40m " standout end
:set t_so=^[[1;32;45m " standout mode
:set t_ue=^[[0;1;36m " underline end
:set t_us=^[[1;32m " underline mode start
[the ^[ is an <Esc>, type CTRL-V <Esc> to enter it]
For real color terminals the ":highlight" command can be used.
The file "tools/vim132" is a shell script that can be used to put Vim in 132
column mode on a vt100 and lookalikes.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,939 +0,0 @@
*os_vms.txt* For Vim version 7.4. Last change: 2011 Aug 14
VIM REFERENCE MANUAL
*VMS* *vms*
This file contains the particularities for the VMS version of Vim.
You can reach this information file by typing :help VMS in Vim command
prompt.
1. Getting started |vms-started|
2. Download files |vms-download|
3. Compiling |vms-compiling|
4. Problems |vms-problems|
5. Deploy |vms-deploy|
6. Practical usage |vms-usage|
7. GUI mode questions |vms-gui|
8. Useful notes |vms-notes|
9. VMS related changes |vms-changes|
10. Authors |vms-authors|
==============================================================================
1. Getting started *vms-started*
Vim (Vi IMproved) is a vi-compatible text editor that runs on nearly every
operating system known to humanity. Now use Vim on OpenVMS too, in character
or X/Motif environment. It is fully featured and absolutely compatible with
Vim on other operating systems.
==============================================================================
2. Download files *vms-download*
You can download the Vim source code by ftp from the official Vim site:
ftp://ftp.vim.org/pub/vim/
Or use one of the mirrors:
ftp://ftp.vim.org/pub/vim/MIRRORS
You can download precompiled executables from:
http://www.polarhome.com/vim/
ftp://ftp.polarhome.com/pub/vim/
To use the precompiled binary version, you need one of these archives:
vim-XX-exe-ia64-gui.zip IA64 GUI/Motif executables
vim-XX-exe-ia64-gtk.zip IA64 GUI/GTK executables
vim-XX-exe-ia64-term.zip IA64 console executables
vim-XX-exe-axp-gui.zip Alpha GUI/Motif executables
vim-XX-exe-axp-gtk.zip Alpha GUI/GTK executables
vim-XX-exe-axp-term.zip Alpha console executables
vim-XX-exe-vax-gui.zip VAX GUI executables
vim-XX-exe-vax-term.zip VAX console executables
and of course (optional)
vim-XX-runtime.zip runtime files
The binary archives contain: vim.exe, ctags.exe, xxd.exe files.
For GTK executables you will need GTKLIB that is available for
Alpha and IA64 platform.
==============================================================================
3. Compiling *vms-compiling*
See the file [.SRC]INSTALLVMS.TXT.
==============================================================================
4. Problems *vms-problems*
The code has been tested under Open VMS 6.2 - 8.2 on Alpha, VAX and IA64
platforms with the DEC C compiler. It should work without big problems.
If your system does not have some include libraries you can tune up in
OS_VMS_CONF.H file.
If you decided to build Vim with +perl, +python, etc. options, first you need
to download OpenVMS distributions of Perl and Python. Build and deploy the
libraries and change adequate lines in MAKE_VMS.MMS file. There should not be
a problem from Vim side.
Also GTK, XPM library paths should be configured in MAKE_VMS.MMS
Note: Under VAX it should work with the DEC C compiler without problems. The
VAX C compiler is not fully ANSI C compatible in pre-processor directives
semantics, therefore you have to use a converter program that will do the lion
part of the job. For detailed instructions read file INSTALLvms.txt
MMS_VIM.EXE is build together with VIM.EXE, but for XXD.EXE you should
change to a subdirectory and build it separately.
CTAGS is not part of the Vim source distribution anymore, however the OpenVMS
specific source might contain CTAGS source files as described above.
You can find more information about CTAGS on VMS at
http://www.polarhome.com/ctags/
Advanced users may try some acrobatics in FEATURE.H file as well.
It is possible to compile with +xfontset +xim options too, but then you have
to set up GUI fonts etc. correctly. See :help xim from Vim command prompt.
You may want to use GUI with GTK icons, then you have to download and install
GTK for OpenVMS or at least runtime shareable images - LIBGTK from
polarhome.com
For more advanced questions, please send your problem to Vim on VMS mailing
list <vim-vms@polarhome.com>
More about the vim-vms list can be found at:
http://www.polarhome.com/mailman/listinfo/vim-vms
==============================================================================
5. Deploy *vms-deploy*
Vim uses a special directory structure to hold the document and runtime files:
vim (or wherever)
|- tmp
|- vim57
|----- doc
|----- syntax
|- vim62
|----- doc
|----- syntax
|- vim64
|----- doc
|----- syntax
vimrc (system rc files)
gvimrc
Use: >
define/nolog VIM device:[path.vim]
define/nolog VIMRUNTIME device:[path.vim.vim60]
define/nolog TMP device:[path.tmp]
To get vim.exe to find its document, filetype, and syntax files, and to
specify a directory where temporary files will be located. Copy the "runtime"
subdirectory of the Vim distribution to vimruntime.
Logicals $VIMRUNTIME and $TMP are optional.
If $VIMRUNTIME is not set, Vim will guess and try to set up automatically.
Read more about it at :help runtime
If $TMP is not set, you will not be able to use some functions as CTAGS,
XXD, printing etc. that use temporary directory for normal operation.
The $TMP directory should be readable and writable by the user(s).
The easiest way to set up $TMP is to define a logical: >
define/nolog TMP SYS$SCRATCH
or as: >
define/nolog TMP SYS$LOGIN
==============================================================================
6. Practical usage *vms-usage*
Usually, you want to run just one version of Vim on your system, therefore
it is enough to dedicate one directory for Vim.
Copy the whole Vim runtime directory structure to the deployment position.
Add the following lines to your LOGIN.COM (in SYS$LOGIN directory).
Set up the logical $VIM as: >
$ define VIM device:<path>
Set up some symbols: >
$ ! vi starts Vim in chr. mode.
$ vi*m :== mcr VIM:VIM.EXE
$ !gvi starts Vim in GUI mode.
$ gv*im :== spawn/nowait mcr VIM:VIM.EXE -g
Please, check the notes for customization and configuration of symbols.
You may want to create .vimrc and .gvimrc files in your home directory
(SYS$LOGIN) to overwrite default settings.
The easiest way is just rename example files. You may leave the menu file
(MENU.VIM) and files vimrc and gvimrc in the original $VIM directory. It will
be the default setup for all users, and for users it is enough to just have
their own additions or resetting in their home directory in files .vimrc and
.gvimrc. It should work without problems.
Note: Remember, system rc files (default for all users) don't have a leading
".". So, system rc files are: >
$VIM:vimrc
$VIM:gvimrc
$VIM:menu.vim
and user customized rc files are: >
sys$login:.vimrc
sys$login:.gvimrc
You can check that everything is at the right place with the :version command.
Example LOGIN.COM: >
$ define/nolog VIM RF10:[UTIL.VIM]
$ vi*m :== mcr VIM:VIM.EXE
$ gv*im:== spawn/nowait/input=NLA0 mcr VIM:VIM.EXE -g -GEOMETRY 80x40
$ set disp/create/node=192.168.5.223/trans=tcpip
Note: This set-up should be enough, if you are working on a standalone server or
clustered environment, but if you want to use Vim as an internode editor in
DECNET environment, it will satisfy as well.
You just have to define the "whole" path: >
$ define VIM "<server_name>[""user password""]::device:<path>"
$ vi*m :== "mcr VIM:VIM.EXE"
For example: >
$ define VIM "PLUTO::RF10:[UTIL.VIM]"
$ define VIM "PLUTO""ZAY mypass""::RF10:[UTIL.VIM]" ! if passwd required
You can also use the $VIMRUNTIME logical to point to the proper version of Vim
if you have installed more versions at the same time. If $VIMRUNTIME is not
defined Vim will borrow its value from the $VIM logical. You can find more
information about the $VIMRUNTIME logical by typing :help runtime as a Vim
command.
System administrators might want to set up a system wide Vim installation,
then add to the SYS$STARTUP:SYLOGICALS.COM >
$ define/nolog/sys VIM device:<path>
$ define/nolog/sys TMP SYS$SCRATCH
And to the SYS$STARTUP:SYLOGIN.COM >
$ vi*m :== mcr VIM:VIM.EXE
$ gv*im:== spawn/nowait/input=NLA0 mcr VIM:VIM.EXE -g -GEOMETRY 80x40
It will set up a normal Vim work environment for every user on the system.
IMPORTANT: Vim on OpenVMS (and on other case insensitive system) command line
parameters are assumed to be lowercase. In order to indicate that a command
line parameter is uppercase "/" sign must be used.
Examples:
>
vim -R filename ! means: -r List swap files and exit
vim -/r filename ! means: -R Readonly mode (like "view")
vim -u <vimrc> ! means: -u Use <vimrc> instead of any .vimrc
vim -/u <gvimrc> ! means: -U Use <gvimrc> instead of any .gvimrc
==============================================================================
7. GUI mode questions *vms-gui*
OpenVMS is a real mainframe OS, therefore even if it has a GUI console, most
of the users do not use a native X/Window environment during normal operation.
It is not possible to start Vim in GUI mode "just like that". But anyhow it
is not too complicated either.
First of all: you will need an executable that is built with the GUI enabled.
Second: you need to have installed DECW/Motif on your VMS server, otherwise
you will get errors that some shareable libraries are missing.
Third: If you choose to run Vim with extra features such as GUI/GTK then you
need a GTK installation too or at least a GTK runtime environment (LIBGTK
can be downloaded from http://www.polarhome.com/vim/).
1) If you are working on the VMS X/Motif console:
Start Vim with the command: >
$ mc device:<path>VIM.EXE -g
<
or type :gui as a command to the Vim command prompt. For more info :help
gui
2) If you are working on some other X/Window environment like Unix or a remote
X VMS console. Set up display to your host with: >
$ set disp/create/node=<your IP address>/trans=<transport-name>
<
and start Vim as in point 1. You can find more help in VMS documentation or
type: help set disp in VMS prompt.
Examples: >
$ set disp/create/node=192.168.5.159 ! default trans is DECnet
$ set disp/create/node=192.168.5.159/trans=tcpip ! TCP/IP network
$ set disp/create/node=192.168.5.159/trans=local ! display on the same node
Note: you should define just one of these.
For more information type $help set disp in VMS prompt.
3) Another elegant solution is XDM if you have installed on OpenVMS box.
It is possible to work from XDM client as from GUI console.
4) If you are working on MS-Windows or some other non X/Window environment
you need to set up one X server and run Vim as in point 2.
For MS-Windows there are available free X servers as MIX, Omni X etc.,
as well as excellent commercial products as eXcursion or ReflectionX with
built-in DEC support.
Please note, that executables without GUI are slightly faster during startup
than with enabled GUI in character mode. Therefore, if you do not use GUI
features, it is worth to choose non GUI executables.
==============================================================================
8. Useful notes *vms-notes*
8.1 Backspace/delete
8.2 Filters
8.3 VMS file version numbers
8.4 Directory conversion
8.5 Remote host invocation
8.6 Terminal problems
8.7 Hex-editing and other external tools
8.8 Sourcing vimrc and gvimrc
8.9 Printing from Vim
8.10 Setting up the symbols
8.11 diff and other GNU programs
8.12 diff-mode
8.13 Allow '$' in C keywords
8.14 VIMTUTOR for beginners
8.15 Slow start in console mode issue
8.16 Common VIM directory - different architectures
8.1 Backspace/delete
There are backspace/delete key inconsistencies with VMS.
:fixdel doesn't do the trick, but the solution is: >
:inoremap ^? ^H " for terminal mode
:inoremap <Del> ^H " for gui mode
Read more in ch: 8.6 (Terminal problems).
(Bruce Hunsaker <BNHunsaker@chq.byu.edu> Vim 5.3)
8.2 Filters
Vim supports filters, i.e., if you have a sort program that can handle
input/output redirection like Unix (<infile >outfile), you could use >
:map \s 0!'aqsort<CR>
(Charles E. Campbell, Jr. <cec@gryphon.gsfc.nasa.gov> Vim 5.4)
8.3 VMS file version numbers
Vim is saving files into a new file with the next higher file version
number, try these settings. >
:set nobackup " does not create *.*_ backup files
:set nowritebackup " does not have any purpose on VMS. It's the
" default.
Recovery is working perfectly as well from the default swap file.
Read more with :help swapfile
(Claude Marinier <ClaudeMarinier@xwavesolutions.com> Vim 5.5, Zoltan Arpadffy
Vim 5.6)
8.4 Directory conversion
Vim will internally convert any unix-style paths and even mixed unix/VMS
paths into VMS style paths. Some typical conversions resemble:
/abc/def/ghi -> abc:[def]ghi.
/abc/def/ghi.j -> abc:[def]ghi.j
/abc/def/ghi.j;2 -> abc:[def]ghi.j;2
/abc/def/ghi/jkl/mno -> abc:[def.ghi.jkl]mno.
abc:[def.ghi]jkl/mno -> abc:[def.ghi.jkl]mno.
./ -> current directory
../ -> relative parent directory
[.def.ghi] -> relative child directory
./def/ghi -> relative child directory
Note: You may use <,> brackets as well (device:<path>file.ext;version) as
rf10:<user.zay.work>test.c;1
(David Elins <delins@foliage.com>, Jerome Lauret
<JLAURET@mail.chem.sunysb.edu> Vim 5.6)
8.5 Remote host invocation
It is possible to use Vim as an internode editor.
1. Edit some file from remote node: >
vi "<server>""username passwd""::<device>:<path><filename>;<version>"
Example: >
vi "pluto""zay passwd""::RF10:<USER.ZAY.WORK>TEST.C;1"
Note: syntax is very important, otherwise VMS will recognize more parameters
instead of one (resulting with: file not found)
2. Set up Vim as your internode editor. If Vim is not installed on your
host, just set up your IP address, the full Vim path including the server name
and run the command procedure below: >
$ if (p1 .eqs. "") .OR. (p2 .eqs. "") then goto usage
$ set disp/create/node=<your_IP_here>/trans=tcpip
$ define "VIM "<vim_server>""''p1' ''p2'""::<device>:<vim_path>"
$ vi*m :== "mcr VIM:VIM.EXE"
$ gv*im :== "spawn/nowait mcr VIM:VIM.EXE -g"
$ goto end
$ usage:
$ write sys$output " Please enter username and password as a parameter."
$ write sys$output " Example: @SETVIM.COM username passwd"
$ end:
Note: Never use it in a clustered environment (you do not need it), loading
could be very-very slow, but even faster than a local Emacs. :-)
(Zoltan Arpadffy, Vim 5.6)
8.6 Terminal problems
If your terminal name is not known to Vim and it is trying to find the default
one you will get the following message during start-up:
---
Terminal entry not found in termcap
'unknown-terminal' not known. Available built-in terminals are:
builtin_gui
builtin_riscos
builtin_amiga
builtin_beos-ansi
builtin_ansi
builtin_vt320
builtin_vt52
builtin_pcansi
builtin_win32
builtin_xterm
builtin_iris-ansi
builtin_debug
builtin_dumb
defaulting to 'vt320'
---
The solution is to define the default terminal name: >
$ ! unknown terminal name. Let us use vt320 or ansi instead.
$ ! Note: it's case sensitive
$ define term "vt320"
Terminals from VT100 to VT320 (as V300, VT220, VT200) do not need any extra
keyboard mappings. They should work perfectly as they are, including arrows,
Ins, Del buttons etc., except Backspace in GUI mode. To solve it, add to
.gvimrc: >
inoremap <Del> <BS>
Vim will also recognize that they are fast terminals.
If you have some annoying line jumping on the screen between windows add to
your .vimrc file: >
set ttyfast " set fast terminal
Note: if you're using Vim on remote host or through a very slow connection, it's
recommended to avoid the fast terminal option with: >
set nottyfast " set terminal to slow mode
(Zoltan Arpadffy, Vim 5.6)
8.7 Hex-editing and other external tools
A very important difference between OpenVMS and other systems is that VMS uses
special commands to execute executables: >
RUN <path>filename
MCR <path>filename <parameters>
OpenVMS users always have to be aware that the Vim command :! "just" drop them
to DCL prompt. This feature is possible to use without any problem with all
DCL commands, but if we want to execute some programs such as XXD, CTAGS, JTAGS,
etc. we're running into trouble if we follow the Vim documentation (see: help
xxd).
Solution: Execute with the MC command and add the full path to the executable.
Example: Instead of :%!xxd command use: >
:%!mc vim:xxd
... or in general: >
:!mc <path>filename <parameters>
Note: You can use XXD and CTAGS from GUI menu.
To customize ctags it is possible to define the logical $CTAGS with standard
parameters as: >
define/nolog CTAGS "--totals -o sys$login:tags"
For additional information, please read :help tagsearch and CTAGS
documentation at http://ctags.sourceforge.net/ctags.html.
(Zoltan Arpadffy, Vim 5.6-70)
8.8 Sourcing vimrc and gvimrc
If you want to use your .vimrc and .gvimrc from other platforms (e.g. Windows)
you can get in trouble if you ftp that file(s): VMS has different end-of-line
indication.
The symptom is that Vim is not sourcing your .vimrc/.gvimrc, even if you say:
>
:so sys$login:.vimrc
One trick is to compress (e.g. zip) the files on the other platform and
uncompress it on VMS; if you have the same symptom, try to create the files
with copy-paste (for this you need both op. systems reachable from one
machine, e.g. an Xterm on Windows or telnet to Windows from VMS).
(Sandor Kopanyi, <sandor.kopanyi@mailbox.hu> Vim 6.0a)
8.9 Printing from Vim
To be able to print from Vim (running in GUI mode) under VMS you have to set
up $TMP logical which should point to some temporary directory and logical
SYS$PRINT to your default print queue.
Example: >
$define SYS$PRINT HP5ANSI
You can print out the whole buffer or just the marked area.
More info under :help hardcopy
(Zoltan Arpadffy, Vim 6.0c)
8.10 Setting up the symbols
When I use GVIM this way and press CTRL-Y in the parent terminal, gvim exits.
I now use a different symbol that seems to work OK and fixes the problem.
I suggest this instead: >
$ GV*IM:==SPAWN/NOWAIT/INPUT=NLA0: MCR VIM:VIM.EXE -G -GEOMETRY 80X40
The /INPUT=NLA0: separates the standard input of the gvim process from the
parent terminal, to block signals from the parent window.
Without the -GEOMETRY, the GVIM window size will be minimal and the menu
will be confused after a window-resize.
(Carlo Mekenkamp, Coen Engelbarts, Vim 6.0ac)
8.11 diff and other GNU programs
From 6.0 diff functionality has been implemented, but OpenVMS does not use
GNU/Unix like diff therefore built in diff does not work.
There is a simple solution to solve this anomaly. Install a Unix like diff
and Vim will work perfectly in diff mode too. You just have to redefine your
diff program as: >
define /nolog diff <GNU_PATH>diff.exe
Another, more sophisticated solution is described below (8.12 diff-mode)
There are other programs such as patch, make etc that may cause the same
problems. At www.polarhome.com is possible to download an GNU package for
Alpha and VAX boxes that is meant to solve GNU problems on OpenVMS.
(Zoltan Arpadffy, Vim 6.1)
8.12 diff-mode
Vim 6.0 and higher supports Vim diff-mode (See |new-diff-mode|, |diff-mode|
and |08.7|). This uses the external program 'diff' and expects a Unix-like
output format from diff. The standard VMS diff has a different output
format. To use Vim on VMS in diff-mode, you need to:
1 Install a Unix-like diff program, e.g. GNU diff
2 Tell Vim to use the Unix-like diff for diff-mode.
You can download GNU diff from the VIM-VMS website, it is one of the GNU
tools in http://www.polarhome.com/vim/files/gnu_tools.zip. I suggest to
unpack it in a separate directory "GNU" and create a logical GNU: that
points to that directory, e.g: >
DEFINE GNU <DISK>:[<DIRECTORY>.BIN.GNU]
You may also want to define a symbol GDIFF, to use the GNU diff from the DCL
prompt: >
GDIFF :== $GNU:DIFF.EXE
Now you need to tell Vim to use the new diff program. Take the example
settings from |diff-diffexpr| and change the call to the external diff
program to the new diff on VMS. Add this to your .vimrc file: >
" Set up vimdiff options
if v:version >= 600
" Use GNU diff on VMS
set diffexpr=MyDiff()
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-b "
endif
silent execute "!mc GNU:diff.exe -a " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
endfunction
endif
You can now use Vim in diff-mode, e.g. to compare two files in read-only
mode: >
$ VIM -D/R <FILE1> <FILE2>
You can also define new symbols for vimdiff, e.g.: >
$ VIMDIFF :== 'VIM' -D/R
$ GVIMDIFF :== 'GVIM' -D/R
You can now compare files in 4 ways: >
1. VMS diff: $ DIFF <FILE1> <FILE2>
2. GNU diff: $ GDIFF <FILE1> <FILE2>
3. VIM diff: $ VIMDIFF <FILE1> <FILE2>
4. GVIM diff: $ GVIMDIFF <FILE1> <FILE2>
(Coen Engelbarts, Vim 6.1)
8.13 Allow '$' in C keywords
DEC C uses many identifiers with '$' in them. This is not allowed in ANSI C,
and Vim recognises the '$' as the end of the identifier. You can change this
with the 'iskeyword' option.
Add this command to your .vimrc file: >
autocmd FileType c,cpp,cs set iskeyword+=$
You can also create the file(s) $VIM/FTPLUGIN/C.VIM (and/or CPP.VIM and
CS.VIM) and add this command: >
set iskeyword+=$
Now word-based commands, e.g. the '*'-search-command and the CTRL-]
tag-lookup, work on the whole identifier. (Ctags on VMS also supports '$' in
C keywords since ctags version 5.1.)
(Coen Engelbarts, Vim 6.1)
8.14 VIMTUTOR for beginners
The VIMTUTOR.COM DCL script can help Vim beginners to learn/make their first
steps with Vim on OpenVMS. Depending of binary distribution you may start it
with: >
@vim:vimtutor
(Thomas.R.Wyant III, Vim 6.1)
8.16 Slow start in console mode issue
As GUI/GTK Vim works equally well in console mode, many administrators
deploy those executables system wide.
Unfortunately, on a remote slow connections GUI/GTK executables behave rather
slow when user wants to run Vim just in the console mode - because of X
environment detection timeout.
Luckily, there is a simple solution for that. Administrators need to deploy
both GUI/GTK build and just console build executables, like below: >
|- vim73
|----- doc
|----- syntax
vimrc (system rc files)
gvimrc
gvim.exe (the renamed GUI or GTK built vim.exe)
vim.exe (the console only executable)
Define system symbols like below in for ex in LOGIN.COM or SYLOGIN.COM: >
$ define/nolog VIM RF10:[UTIL.VIM73] ! where you VIM directory is
$ vi*m :== mcr VIM:VIM.EXE
$ gvi*m :== mcr VIM:GVIM.EXE
$ ! or you can try to spawn with
$ gv*im :== spawn/nowait/input=NLA0 mcr VIM:GVIM.EXE -g -GEOMETRY 80x40
Like this, users that do not have X environment and want to use Vim just in
console mode can avoid performance problems.
(Zoltan Arpadffy, Vim 7.2)
8.15 Common VIM directory - different architectures
In a cluster that contains nodes with different architectures like below:
$show cluster
View of Cluster from system ID 11655 node: TOR 18-AUG-2008 11:58:31
+---------------------------------+
¦ SYSTEMS ¦ MEMBERS ¦
+-----------------------+---------¦
¦ NODE ¦ SOFTWARE ¦ STATUS ¦
+--------+--------------+---------¦
¦ TOR ¦ VMS V7.3-2 ¦ MEMBER ¦
¦ TITAN2 ¦ VMS V8.3 ¦ MEMBER ¦
¦ ODIN ¦ VMS V7.3-2 ¦ MEMBER ¦
+---------------------------------+
It is convenient to have a common VIM directory but execute different
executables.
There are several solutions for this problem:
Solution 1. All executables in the same directory with different names
This is easily done with the following script that can be added
to the login.com or sylogin.com: >
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
$ then
$ say "VAX platform"
$ vi*m:== mcr vim:VIM.EXE_VAX
$ endif
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
$ then
$ say "ALPHA platform"
$ vi*m :== mcr vim:VIM.EXE_AXP
$ endif
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
$ then
$ say "IA64 platform"
$ vi*m :== mcr vim:VIM.EXE_IA64
$ endif
Solution 2. Different directories: >
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
$ then
$ say "VAX platform"
$ define/nolog VIM RF10:[UTIL.VAX_EXE] ! VAX executables
$ endif
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
$ then
$ say "ALPHA platform"
$ define/nolog VIM RF10:[UTIL.AXP_EXE] ! AXP executables
$ endif
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
$ then
$ say "IA64 platform"
$ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables
$ endif
$! VIMRUNTIME must be defined in order to find runtime files
$ define/nolog VIMRUNTIME RF10:[UTIL.VIM73]
A good example for this approach is the [GNU]gnu_tools.com script from
GNU_TOOLS.ZIP package downloadable from http://www.polarhome.com/vim/
(Zoltan Arpadffy, Vim 7.2)
==============================================================================
9. VMS related changes *vms-changes*
Version 7.3
- CTAGS 5.8 included
- VMS compile warnings fixed - floating-point overflow warning corrected on VAX
- filepath completion corrected - too many chars were escaped in filename
and shell commands
- the following plugins are included into VMS runtime:
genutils 2.4, multiselect 2.2, multvals 3.1, selectbuf 4.3,
bufexplorer 7.1.7, taglist 4.5
- minor changes in vimrc (just in VMS runtime)
- make_vms.mms - HUGE model is the default
- [TESTDIR]make_vms.mms include as many tests possible
- modify test30 and test54 for VMS
- enable FLOAT feature in VMS port
- os_vms.txt updated
Version 7.2 (2008 Aug 9)
- VCF files write corrected
- CTAGS 5.7 included
- corrected make_vms.mms (on VAX gave syntax error)
Version 7.1 (2007 Jun 15)
- create TAGS file from menu
Version 7 (2006 May 8)
- Improved low level char input (affects just console mode)
- Fixed plugin bug
- CTAGS 5.6 included
Version 6.4 (2005 Oct 15)
- GTKLIB and Vim build on IA64
- colors in terminal mode
- syntax highlighting in terminal mode
- write problem fixed (extra CR)
- ESC and ESC sequence recognition in terminal mode
- make file changed to support new MMS version
- env variable expansion in path corrected
- printing problems corrected
- help text added for case insensitive arguments
Version 6.3 (2004 May 10)
- Improved vms_read function
- CTAGS v5.5.4 included
- Documentation corrected and updated
Version 6.2 (2003 May 7)
- Corrected VMS system call results
- Low level character input is rewritten
- Correction in tag and quickfix handling
- First GTK build
- Make file changes
- GTK feature added
- Define for OLD_VMS
- OpenVMS version 6.2 or older
- Documentation updated with GTK features
- CTAGS v5.5 included
- VMS VIM tutor created
Version 6.1 (2002 Mar 25)
- TCL init_tcl() problem fixed
- CTAGS v5.4 included
- GNU tools binaries for OpenVMS
- Make file changes
- PERL, PYTHON and TCL support improved
- InstallVMS.txt has a detailed description HOWTO build
- VMS/Unix file handling rewritten
- Minor casting and bug fixes
Version 6.0 (2001 Sep 28)
- Unix and VMS code has been merged
- separated "really" VMS related code
- included all possible Unix functionality
- simplified or deleted the configuration files
- makefile MAKE_VMS.MMS reviewed
- menu changes (fixed printing, CTAGS and XXD usage)
- fixed variable RMS record format handling anomaly
- corrected syntax, ftplugin etc files load
- changed expand_wildcards and expandpath functions to work more general
- created OS_VMS_FILTER.COM - DECC->VAXC pre-processor directive convert
script.
- Improved code's VAXC and new DECC compilers compatibility
- changed quickfix parameters:
- errormessage format to suite DECC
- search, make and other commands to suite VMS system
- updated and renamed MMS make files for Vim and CTAGS.
- CTAGS has been removed from source distribution of Vim but it will remain
in OpenVMS binary distributions.
- simplified build/configuration procedure
- created INSTALLvms.txt - detailed compiling instructions under VMS.
- updated test scripts.
Version 5.8 (2001 Jun 1)
- OS_VMS.TXT updated with new features.
- other minor fixes.
- documentation updated
- this version had been tested much more than any other OpenVMS version
earlier
Version 5.7 (2000 Jun 24)
- New CTAGS v5.0 in distribution
- Documentation updated
Version 5.6 (2000 Jan 17)
- VMS filename related changes:
- version handling (open everything, save to new version)
- correct file extension matching for syntax (version problem)
- handle <,> characters and passwords in directory definition
- handle internode/remote invocation and editing with passwords
- OpenVMS files will be treated case insensitive from now
- corrected response of expand("%:.") etc path related functions
(in one word: VMS directory handling internally)
- version command
- corrected (+,-) information data
- added compiler and OS version
- added user and host information
- resolving $VIM and $VIMRUNTIME logicals
- VMS port is in MAX_FEAT (maximum features) club with Unix, Win32 and OS/2.
- enabled farsi, rightleft etc. features
- undo level raised up to 1000
- Updated OS_VMS.MMS file.
- maximum features ON is default
- Vim is compilable with +perl, +python and +tcl features.
- improved MMK compatibility
- Created MAKEFILE_VMS.MMS, makefile for testing Vim during development.
- Defined DEC terminal VT320
- compatibility for VT3*0, VT2*0 and VT1*0 - ANSI terminals
backwards, but not VT340 and newer with colour capability.
- VT320 is default terminal for OpenVMS
- these new terminals are also fast ttys (default for OpenVMS).
- allowed dec_mouse ttym
- Updated files vimrc and gvimrc with VMS specific suggestions.
- OS_VMS.TXT updated with new features.
Version 5.5 (1999 Dec 3)
- Popup menu line crash corrected.
- Handle full file names with version numbers.
- Directory handling (CD command etc.)
- Corrected file name conversion VMS to Unix and v.v.
- Correct response of expand wildcards
- Recovery is working from this version under VMS as well.
- Improved terminal and signal handing.
- Improved OS_VMS.TXT
Version 5.4 (1999 Sep 9)
- Cut and paste mismatch corrected.
- Motif directories during open and save are corrected.
Version 5.3 (1998 Oct 12)
- Minor changes in the code
- Standard distribution with +GUI option
Version 5.1 (1998 Apr 21)
- Syntax and DEC C changes in the code
- Fixing problems with the /doc subdirectory
- Improve OS_VMS.MMS
Version 4.5 (1996 Dec 16)
- First VMS port by Henk Elbers <henk@xs4all.nl>
==============================================================================
10. Authors *vms-authors*
OpenVMS documentation and executables are maintained by:
Zoltan Arpadffy <arpadffy@polarhome.com>
OpenVMS Vim page: http://www.polarhome.com/vim/
This document uses parts and remarks from earlier authors and contributors
of OS_VMS.TXT:
Charles E. Campbell, Jr. <cec@gryphon.gsfc.nasa.gov>
Bruce Hunsaker <BNHunsaker@chq.byu.edu>
Sandor Kopanyi <sandor.kopanyi@mailbox.hu>
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,370 +0,0 @@
*os_win32.txt* For Vim version 7.4. Last change: 2012 May 18
VIM REFERENCE MANUAL by George Reilly
*win32* *Win32* *MS-Windows*
This file documents the idiosyncrasies of the Win32 version of Vim.
The Win32 version of Vim works on Windows NT, 95, 98, ME, XP, Vista and
Windows 7. There are both console and GUI versions.
The 32 bit version also runs on 64 bit MS-Windows systems.
There is GUI version for use in the Win32s subsystem in Windows 3.1[1]. You
can also use the 32-bit DOS version of Vim instead. See |os_msdos.txt|.
1. Known problems |win32-problems|
2. Startup |win32-startup|
3. Restore screen contents |win32-restore|
4. Using the mouse |win32-mouse|
5. Running under Windows 3.1 |win32-win3.1|
6. Win32 mini FAQ |win32-faq|
Additionally, there are a number of common Win32 and DOS items:
File locations |dos-locations|
Using backslashes |dos-backslash|
Standard mappings |dos-standard-mappings|
Screen output and colors |dos-colors|
File formats |dos-file-formats|
:cd command |dos-:cd|
Interrupting |dos-CTRL-Break|
Temp files |dos-temp-files|
Shell option default |dos-shell|
Win32 GUI |gui-w32|
Credits:
The Win32 version was written by George V. Reilly <george@reilly.org>.
The original Windows NT port was done by Roger Knobbe <RogerK@wonderware.com>.
The GUI version was made by George V. Reilly and Robert Webb.
For compiling see "src/INSTALLpc.txt". *win32-compiling*
==============================================================================
1. Known problems *windows95* *win32-problems*
There are a few known problems with running in a console on Windows 95. As
far as we know, this is the same in Windows 98 and Windows ME.
Comments from somebody working at Microsoft: "Win95 console support has always
been and will always be flaky".
1. Dead key support doesn't work.
2. Resizing the window with ":set columns=nn lines=nn" works, but executing
external commands MAY CAUSE THE SYSTEM TO HANG OR CRASH.
3. Screen updating is slow, unless you change 'columns' or 'lines' to a
non-DOS value. But then the second problem applies!
If this bothers you, use the 32 bit MS-DOS version or the Win32 GUI version.
When doing file name completion, Vim also finds matches for the short file
name. But Vim will still find and use the corresponding long file name. For
example, if you have the long file name "this_is_a_test" with the short file
name "this_i~1", the command ":e *1" will start editing "this_is_a_test".
==============================================================================
2. Startup *win32-startup*
Current directory *win32-curdir*
If Vim is started with a single file name argument, and it has a full path
(starts with "x:\"), Vim assumes it was started from the file explorer and
will set the current directory to where that file is. To avoid this when
typing a command to start Vim, use a forward slash instead of a backslash.
Example: >
vim c:\text\files\foo.txt
Will change to the "C:\text\files" directory. >
vim c:/text\files\foo.txt
Will use the current directory.
Term option *win32-term*
The only kind of terminal type that the Win32 version of Vim understands is
"win32", which is built-in. If you set 'term' to anything else, you will
probably get very strange behavior from Vim. Therefore Vim does not obtain
the default value of 'term' from the environment variable "TERM".
$PATH *win32-PATH*
The directory of the Vim executable is appended to $PATH. This is mostly to
make "!xxd' work, as it is in the Tools menu. And it also means that when
executable() returns 1 the executable can actually be executed.
==============================================================================
3. Restore screen contents *win32-restore*
When 'restorescreen' is set (which is the default), Vim will restore the
original contents of the console when exiting or when executing external
commands. If you don't want this, use ":set nors". |'restorescreen'|
==============================================================================
4. Using the mouse *win32-mouse*
The Win32 version of Vim supports using the mouse. If you have a two-button
mouse, the middle button can be emulated by pressing both left and right
buttons simultaneously - but note that in the Win32 GUI, if you have the right
mouse button pop-up menu enabled (see 'mouse'), you should err on the side of
pressing the left button first. |mouse-using|
When the mouse doesn't work, try disabling the "Quick Edit Mode" feature of
the console.
==============================================================================
5. Running under Windows 3.1 *win32-win3.1*
*win32s* *windows-3.1*
There is a special version of Gvim that runs under Windows 3.1 and 3.11. You
need the gvim.exe that was compiled with Visual C++ 4.1.
To run the Win32 version under Windows 3.1, you need to install Win32s. You
might have it already from another Win32 application which you have installed.
If Vim doesn't seem to be running properly, get the latest version: 1.30c.
You can find it at:
http://support.microsoft.com/download/support/mslfiles/pw1118.exe
(Microsoft moved it again, we don't know where it is now :-( ).
The reason for having two versions of gvim.exe is that the Win32s version was
compiled with VC++ 4.1. This is the last version of VC++ that supports Win32s
programs. VC++ 5.0 is better, so that one was used for the Win32 version.
Apart from that, there is no difference between the programs. If you are in a
mixed environment, you can use the gvim.exe for Win32s on both.
The Win32s version works the same way as the Win32 version under 95/NT. When
running under Win32s the following differences apply:
- You cannot use long file names, because Windows 3.1 doesn't support them!
- When executing an external command, it doesn't return an exit code. After
doing ":make" you have to do ":cn" yourself.
==============================================================================
6. Win32 mini FAQ *win32-faq*
Q. Why does the Win32 version of Vim update the screen so slowly on Windows 95?
A. The support for Win32 console mode applications is very buggy in Win95.
For some unknown reason, the screen updates very slowly when Vim is run at
one of the standard resolutions (80x25, 80x43, or 80x50) and the 16-bit DOS
version updates the screen much more quickly than the Win32 version.
However, if the screen is set to some other resolution, such as by ":set
columns=100" or ":set lines=40", screen updating becomes about as fast as
it is with the 16-bit version.
WARNING: Changing 'columns' may make Windows 95 crash while updating the
window (complaints --> Microsoft). Since this mostly works, this has not
been disabled, but be careful with changing 'columns'.
Changing the screen resolution makes updates faster, but it brings
additional problems. External commands (e.g., ":!dir") can cause Vim to
freeze when the screen is set to a non-standard resolution, particularly
when 'columns' is not equal to 80. It is not possible for Vim to reliably
set the screen resolution back to the value it had upon startup before
running external commands, so if you change the number of 'lines' or
'columns', be very, very careful. In fact, Vim will not allow you to
execute external commands when 'columns' is not equal to 80, because it is
so likely to freeze up afterwards.
None of the above applies on Windows NT. Screen updates are fast, no
matter how many 'lines' or 'columns' the window has, and external commands
do not cause Vim to freeze.
Q. So if the Win32 version updates the screen so slowly on Windows 95 and the
16-bit DOS version updates the screen quickly, why would I want to run the
Win32 version?
A. Firstly, the Win32 version isn't that slow, especially when the screen is
set to some non-standard number of 'lines' or 'columns'. Secondly, the
16-bit DOS version has some severe limitations: It can't do big changes and
it doesn't know about long file names. The Win32 version doesn't have these
limitations and it's faster overall (the same is true for the 32-bit DJGPP
DOS version of Vim). The Win32 version is smarter about handling the
screen, the mouse, and the keyboard than the DJGPP version is.
Q. And what about the 16-bit DOS version versus the Win32 version on NT?
A. There are no good reasons to run the 16-bit DOS version on NT. The Win32
version updates the screen just as fast as the 16-bit version does when
running on NT. All of the above disadvantages apply. Finally, DOS
applications can take a long time to start up and will run more slowly. On
non-Intel NT platforms, the DOS version is almost unusably slow, because it
runs on top of an 80x86 emulator.
Q. How do I change the font?
A. In the GUI version, you can use the 'guifont' option. Example: >
:set guifont=Lucida_Console:h15:cDEFAULT
< In the console version, you need to set the font of the console itself.
You cannot do this from within Vim.
Q. When I change the size of the console window with ':set lines=xx' or
similar, the font changes! (Win95)
A. You have the console font set to 'Auto' in Vim's (or your MS-DOS prompt's)
properties. This makes W95 guess (badly!) what font is best. Set an explicit
font instead.
Q. Why can't I paste into Vim when running Windows 95?
A. In the properties dialog box for the MS-DOS window, go to "MS-DOS
Prompt/Misc/Fast pasting" and make sure that it is NOT checked. You should
also do ":set paste" in Vim to avoid unexpected effects. |'paste'|
Q. How do I type dead keys on Windows 95, in the console version?
(A dead key is an accent key, such as acute, grave, or umlaut, that doesn't
produce a character by itself, but when followed by another key, produces
an accented character, such as a-acute, e-grave, u-umlaut, n-tilde, and so
on. Very useful for most European languages. English-language keyboard
layouts don't use dead keys, as far as we know.)
A. You don't. The console mode input routines simply do not work correctly in
Windows 95, and I have not been able to work around them. In the words
of a senior developer at Microsoft:
Win95 console support has always been and will always be flaky.
The flakiness is unavoidable because we are stuck between the world of
MS-DOS keyboard TSRs like KEYB (which wants to cook the data;
important for international) and the world of Win32.
So keys that don't "exist" in MS-DOS land (like dead keys) have a
very tenuous existence in Win32 console land. Keys that act
differently between MS-DOS land and Win32 console land (like
capslock) will act flaky.
Don't even _mention_ the problems with multiple language keyboard
layouts...
You may be able to fashion some sort of workaround with the digraphs
mechanism. |digraphs|
The best solution is to use the Win32 GUI version gvim.exe. Alternatively,
you can try one of the DOS versions of Vim where dead keys reportedly do
work.
Q. How do I type dead keys on Windows NT?
A. Dead keys work on NT 3.51. Just type them as you would in any other
application.
On NT 4.0, you need to make sure that the default locale (set in the
Keyboard part of the Control Panel) is the same as the currently active
locale. Otherwise the NT code will get confused and crash! This is a NT
4.0 problem, not really a Vim problem.
Q. I'm using Vim to edit a symbolically linked file on a Unix NFS file server.
When I write the file, Vim does not "write through" the symlink. Instead,
it deletes the symbolic link and creates a new file in its place. Why?
A. On Unix, Vim is prepared for links (symbolic or hard). A backup copy of
the original file is made and then the original file is overwritten. This
assures that all properties of the file remain the same. On non-Unix
systems, the original file is renamed and a new file is written. Only the
protection bits are set like the original file. However, this doesn't work
properly when working on an NFS-mounted file system where links and other
things exist. The only way to fix this in the current version is not
making a backup file, by ":set nobackup nowritebackup" |'writebackup'|
Q. I'm using Vim to edit a file on a Unix file server through Samba. When I
write the file, the owner of the file is changed. Why?
A. When writing a file Vim renames the original file, this is a backup (in
case writing the file fails halfway). Then the file is written as a new
file. Samba then gives it the default owner for the file system, which may
differ from the original owner.
To avoid this set the 'backupcopy' option to "yes". Vim will then make a
copy of the file for the backup, and overwrite the original file. The
owner isn't changed then.
Q. How do I get to see the output of ":make" while it's running?
A. Basically what you need is to put a tee program that will copy its input
(the output from make) to both stdout and to the errorfile. You can find a
copy of tee (and a number of other GNU tools) at
http://gnuwin32.sourceforge.net or http://unxutils.sourceforge.net
Alternatively, try the more recent Cygnus version of the GNU tools at
http://www.cygwin.com Other Unix-style tools for Win32 are listed at
http://directory.google.com/Top/Computers/Software/Operating_Systems/Unix/Win32/
When you do get a copy of tee, you'll need to add >
:set shellpipe=\|\ tee
< to your _vimrc.
Q. I'm storing files on a remote machine that works with VisionFS, and files
disappear!
A. VisionFS can't handle certain dot (.) three letter extension file names.
SCO declares this behavior required for backwards compatibility with 16bit
DOS/Windows environments. The two commands below demonstrate the behavior:
>
echo Hello > file.bat~
dir > file.bat
<
The result is that the "dir" command updates the "file.bat~" file, instead
of creating a new "file.bat" file. This same behavior is exhibited in Vim
when editing an existing file named "foo.bat" because the default behavior
of Vim is to create a temporary file with a '~' character appended to the
name. When the file is written, it winds up being deleted.
Solution: Add this command to your _vimrc file: >
:set backupext=.temporary
Q. How do I change the blink rate of the cursor?
A. You can't! This is a limitation of the NT console. NT 5.0 is reported to
be able to set the blink rate for all console windows at the same time.
*:!start*
Q. How can I run an external command or program asynchronously?
A. When using :! to run an external command, you can run it with "start": >
:!start winfile.exe<CR>
< Using "start" stops Vim switching to another screen, opening a new console,
or waiting for the program to complete; it indicates that you are running a
program that does not affect the files you are editing. Programs begun
with :!start do not get passed Vim's open file handles, which means they do
not have to be closed before Vim.
To avoid this special treatment, use ":! start".
There are two optional arguments (see the next Q):
/min the window will be minimized
/b no console window will be opened
You can use only one of these flags at a time. A second one will be
treated as the start of the command.
Q. How do I avoid getting a window for programs that I run asynchronously?
A. You have two possible solutions depending on what you want:
1) You may use the /min flag in order to run program in a minimized state
with no other changes. It will work equally for console and GUI
applications.
2) You can use the /b flag to run console applications without creating a
console window for them (GUI applications are not affected). But you
should use this flag only if the application you run doesn't require any
input. Otherwise it will get an EOF error because its input stream
(stdin) would be redirected to \\.\NUL (stdout and stderr too).
Example for a console application, run Exuberant ctags: >
:!start /min ctags -R .
< When it has finished you should see file named "tags" in your current
directory. You should notice the window title blinking on your taskbar.
This is more noticable for commands that take longer.
Now delete the "tags" file and run this command: >
:!start /b ctags -R .
< You should have the same "tags" file, but this time there will be no
blinking on the taskbar.
Example for a GUI application: >
:!start /min notepad
:!start /b notepad
< The first command runs notepad minimized and the second one runs it
normally.
Q. I'm using Win32s, and when I try to run an external command like "make",
Vim doesn't wait for it to finish! Help!
A. The problem is that a 32-bit application (Vim) can't get notification from
Windows that a 16-bit application (your DOS session) has finished. Vim
includes a work-around for this, but you must set up your DOS commands to
run in a window, not full-screen. Unfortunately the default when you
install Windows is full-screen. To change this:
1) Start PIF editor (in the Main program group).
2) Open the file "_DEFAULT.PIF" in your Windows directory.
3) Changes the display option from "Full Screen" to "Windowed".
4) Save and exit.
To test, start Vim and type >
:!dir C:\<CR>".
< You should see a DOS box window appear briefly with the directory listing.
Q. I use Vim under Win32s and NT. In NT, I can define the console to default to
50 lines, so that I get a 80x50 shell when I ':sh'. Can I do the same in
W3.1x, or am I stuck with 80x25?
A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp] section. DOS
prompts and external DOS commands will now run in a 50-line window.
vim:tw=78:fo=tcq2:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

View file

@ -1,478 +0,0 @@
*pi_getscript.txt* For Vim version 7.4. Last change: 2012 Apr 07
>
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
<
Authors: Charles E. Campbell <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address)
*GetLatestVimScripts-copyright*
Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright*
The VIM LICENSE (see |copyright|) applies to the files in this
package, including getscriptPlugin.vim, getscript.vim,
GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript"
instead of "VIM". Like anything else that's free, getscript and its
associated files are provided *as is* and comes with no warranty of
any kind, either expressed or implied. No guarantees of
merchantability. No guarantees of suitability for any purpose. 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. Use at your own risk!
Getscript is a plugin that simplifies retrieval of the latest versions of the
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
get the latest versions of scripts listed therein from http://vim.sf.net/.
==============================================================================
1. Contents *glvs-contents* *glvs* *getscript*
*GetLatestVimScripts*
1. Contents........................................: |glvs-contents|
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
3. GetLatestVimScripts Usage.......................: |glvs-usage|
4. GetLatestVimScripts Data File...................: |glvs-data|
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
7. GetLatestViMScripts Options.....................: |glvs-options|
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
9. GetLatestVimScripts History.....................: |glvs-hist|
==============================================================================
2. GetLatestVimScripts -- Getting Started *getscript-start*
*getlatestvimscripts-install*
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
Vim 7.0 does not include the GetLatestVimScripts.dist file which
serves as an example and a template. So, you'll need to create
your own! See |GetLatestVimScripts_dat|.
VERSION FROM VIM SF NET *glvs-install*
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
the first time.
The GetLatestVimScripts.dist file serves as an example and a template for your
own personal list. Feel free to remove all the scripts mentioned within it;
the "important" part of it is the first two lines.
Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
1. if compressed: gunzip getscript.vba.gz
2. Unix:
vim getscript.vba
:so %
:q
cd ~/.vim/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|)
3. Windows:
vim getscript.vba
:so %
:q
cd **path-to-vimfiles**/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|)
==============================================================================
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
Unless it has been defined elsewhere, >
:GLVS
will invoke GetLatestVimScripts(). If some other plugin has defined that
command, then you may type
>
:GetLatestVimScripts
<
The script will attempt to update and, if permitted, will automatically
install scripts from http://vim.sourceforge.net/. To do so it will peruse a
file,
>
.vim/GetLatest/GetLatestVimScripts.dat (unix)
<
or >
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
directory (see |glvs-plugins|).
Scripts which have been downloaded will appear in the
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
subdirectory. GetLatestVimScripts will attempt to automatically
install them if you have the following line in your <.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall=1
The <GetLatestVimScripts.dat> file will be automatically be updated to
reflect the latest version of script(s) so downloaded.
(also see |glvs-options|)
==============================================================================
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
*:GetLatestVimScripts_dat*
The data file <GetLatestVimScripts.dat> must have for its first two lines
the following text:
>
ScriptID SourceID Filename
--------------------------
<
Following those two lines are three columns; the first two are numeric
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
contains an example of such a data file. Anything following a #... is
ignored, so you may embed comments in the file.
The first number on each line gives the script's ScriptID. When you're about
to use a web browser to look at scripts on http://vim.sf.net/, just before you
click on the script's link, you'll see a line resembling
http://vim.sourceforge.net/scripts/script.php?script_id=40
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
download the associated page, and is assigned by vim.sf.net itself
during initial uploading of the plugin.
The second number on each line gives the script's SourceID. The SourceID
records the count of uploaded scripts as determined by vim.sf.net; hence it
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
insures that GetLatestVimScripts will assume that the script it has is
out-of-date.
The SourceID is extracted by GetLatestVimScripts from the script's page on
vim.sf.net; whenever it is greater than the one stored in the
GetLatestVimScripts.dat file, the script will be downloaded
(see |GetLatestVimScripts_dat|).
If your script's author has included a special comment line in his/her plugin,
the plugin itself will be used by GetLatestVimScripts to build your
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
may have. As an example, consider: >
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
This comment line tells getscript.vim to check vimscript #884 and that the
script is automatically installable. Getscript will also use this line to
help build the GetLatestVimScripts.dat file, by including a line such as: >
884 1 :AutoInstall: AutoAlign.vim
<
assuming that such a line isn't already in GetLatestVimScripts.dat file.
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
comprehensive ability to keep your plugins up-to-date!
In summary:
* Optionally tell getscript that it is allowed to build/append a
GetLatestVimScripts.dat file based upon already installed plugins: >
let g:GetLatestVimScripts_allowautoinstall=1
<
* A line such as >
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
< in an already-downloaded plugin constitutes the concurrence of the
plugin author that getscript may do AutoInstall. Not all plugins
may be AutoInstall-able, and the plugin's author is best situated
to know whether or not his/her plugin will AutoInstall properly.
* A line such as >
884 1 :AutoInstall: AutoAlign.vim
< in your GetLatestVimScripts.dat file constitutes your permission
to getscript to do AutoInstall. AutoInstall requires both your
and the plugin author's permission. See |GetLatestVimScripts_dat|.
*GetLatestVimScripts_dat*
As an example of a <GetLatestVimScripts.dat> file:
>
ScriptID SourceID Filename
--------------------------
294 1 :AutoInstall: Align.vim
120 2 Decho.vim
40 3 DrawIt.tar.gz
451 4 EasyAccents.vim
195 5 engspchk.vim
642 6 GetLatestVimScripts.vim
489 7 Manpageview.vim
<
Note: the first two lines are required, but essentially act as comments.
==============================================================================
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
(this section is for plugin authors)~
If a plugin author includes the following comment anywhere in their plugin,
GetLatestVimScripts will find it and use it to automatically build the user's
GetLatestVimScripts.dat files:
>
src_id
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
<
As an author, you should include such a line in to refer to your own script
plus any additional lines describing any plugin dependencies it may have.
Same format, of course!
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
are, then you may include :AutoInstall: just before "yourscriptname":
>
src_id
v
" GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
^
scriptid
<
NOTE: The :AutoInstall: feature requires both the plugin author's and~
the user's permission to operate!~
GetLatestVimScripts commands for those scripts are then appended, if not
already present, to the user's GetLatest/GetLatestVimScripts.dat file. It is
a relatively painless way to automate the acquisition of any scripts your
plugins depend upon.
Now, as an author, you probably don't want GetLatestVimScripts to download
your own scripts atop your own copy, thereby overwriting your not-yet-released
hard work. GetLatestVimScripts provides a solution for this: put
>
0 0 yourscriptname
<
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
lines. As a result, those lines won't be inadvertently installed into your
<GetLatestVimScripts.dat> file and subsequently used to download your own
scripts. This is especially important to do if you've included the
:AutoInstall: option.
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
as you've used in your GetLatestVimScripts comment!
==============================================================================
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
*glvs-autoinstall*
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
supportive of auto-install, as they may have special things you need to do to
install them (please refer to the script's "install" directions). On the
other hand, most scripts will be auto-installable.
To let GetLatestVimScripts do an autoinstall, the data file's comment field
should begin with (surrounding blanks are ignored): >
:AutoInstall:
<
Both colons are needed, and it should begin the comment (yourscriptname)
field.
One may prevent any autoinstalling by putting the following line in your
<.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall= 0
<
With :AutoInstall: enabled, as it is by default, files which end with
---.tar.bz2 : decompressed & untarred in .vim/ directory
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
---.vim.bz2 : decompressed & moved into .vim/plugin directory
---.tar.gz : decompressed & untarred in .vim/ directory
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
---.vim.gz : decompressed & moved into .vim/plugin directory
---.vba : unzipped in .vim/ directory
---.vim : moved to .vim/plugin directory
---.zip : unzipped in .vim/ directory
and which merely need to have their components placed by the untar/gunzip or
move-to-plugin-directory process should be auto-installable. Vimballs, of
course, should always be auto-installable.
When is a script not auto-installable? Let me give an example:
.vim/after/syntax/blockhl.vim
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
available at:
http://vim.sourceforge.net/scripts/script.php?script_id=104
Currently, vim's after/syntax only supports by-filetype scripts (in
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
possibly overwrite the current user's after/syntax/c.vim file.
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
allow a after/syntax/c/ directory:
http://vim.sourceforge.net/scripts/script.php?script_id=1023
The script allows multiple syntax files to exist separately in the
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
appropriate tarball for auto-install because of the potential for the
after/syntax/c.vim contained in it to overwrite a user's c.vim.
==============================================================================
7. GetLatestVimScripts Options *glvs-options*
>
g:GetLatestVimScripts_wget
< default= "wget"
This variable holds the name of the command for obtaining
scripts.
>
g:GetLatestVimScripts_options
< default= "-q -O"
This variable holds the options to be used with the
g:GetLatestVimScripts_wget command.
>
g:GetLatestVimScripts_allowautoinstall
< default= 1
This variable indicates whether GetLatestVimScripts is allowed
to attempt to automatically install scripts. Furthermore, the
plugin author has to have explicitly indicated that his/her
plugin is automatically installable (via the :AutoInstall:
keyword in the GetLatestVimScripts comment line).
>
g:GetLatestVimScripts_autoinstalldir
< default= $HOME/.vim (linux)
default= $HOME/vimfiles (windows)
Override where :AutoInstall: scripts will be installed.
Doesn't override vimball installation.
>
g:GetLatestVimScripts_scriptaddr
< default='http://vim.sourceforge.net/script.php?script_id='
Override this if your system needs
... ='http://vim.sourceforge.net/script/script.php?script_id='
==============================================================================
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
The Vim sourceforge page dynamically creates a page by keying off of the
so-called script-id. Within the webpage of
http://vim.sourceforge.net/scripts/script.php?script_id=40
is a line specifying the latest source-id (src_id). The source identifier
numbers are always increasing, hence if the src_id is greater than the one
recorded for the script in GetLatestVimScripts then it's time to download a
newer copy of that script.
GetLatestVimScripts will then download the script and update its internal
database of script ids, source ids, and scriptnames.
The AutoInstall process will:
Move the file from GetLatest/ to the following directory
Unix : $HOME/.vim
Windows: $HOME\vimfiles
if the downloaded file ends with ".bz2"
bunzip2 it
else if the downloaded file ends with ".gz"
gunzip it
if the resulting file ends with ".zip"
unzip it
else if the resulting file ends with ".tar"
tar -oxvf it
else if the resulting file ends with ".vim"
move it to the plugin subdirectory
==============================================================================
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script url has
changed (somewhat). However, it doesn't work, and
the original one does (under Linux). I'll make it
yet-another-option.
v34 Jun 23, 2011 : * handles additional decompression options for tarballs
(tgz taz tbz txz)
v33 May 31, 2011 : * using fnameescape() instead of escape()
* *.xz support
v32 Jun 19, 2010 : * (Jan Steffens) added support for xz compression
v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
* (David Schaefer) the acd option interferes with vimballs
Solution: bypass the acd option
v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
issue an error message if it is not supported
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
getscriptPlugin.vim was setting it but not restoring it.
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
interface, register-a bypass
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
creating pop-up windows
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
loading
v23 Nov 03, 2006 : * ignores comments (#...)
* handles vimballs
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
available
v21 May 01, 2006 : * now takes advantage of autoloading.
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:ft=help:fdm=marker

View file

@ -1,41 +0,0 @@
*pi_gzip.txt* For Vim version 7.4. Last change: 2012 Jul 19
VIM REFERENCE MANUAL by Bram Moolenaar
Editing compressed files with Vim *gzip* *bzip2* *compress*
1. Autocommands |gzip-autocmd|
The functionality mentioned here is a |standard-plugin|.
This plugin is only available if 'compatible' is not set.
You can avoid loading this plugin by setting the "loaded_gzip" variable: >
:let loaded_gzip = 1
{Vi does not have any of this}
==============================================================================
1. Autocommands *gzip-autocmd*
The plugin installs autocommands to intercept reading and writing of files
with these extensions:
extension compression ~
*.Z compress (Lempel-Ziv)
*.gz gzip
*.bz2 bzip2
*.lzma lzma
*.xz xz
That's actually the only thing you need to know. There are no options.
After decompressing a file, the filetype will be detected again. This will
make a file like "foo.c.gz" get the "c" filetype.
If you have 'patchmode' set, it will be appended after the extension for
compression. Thus editing the patchmode file will not give you the automatic
decompression. You have to rename the file if you want this.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

View file

@ -1,60 +0,0 @@
*pi_paren.txt* For Vim version 7.4. Last change: 2013 May 08
VIM REFERENCE MANUAL by Bram Moolenaar
Highlighting matching parens *matchparen*
The functionality mentioned here is a |standard-plugin|.
This plugin is only available if 'compatible' is not set.
You can avoid loading this plugin by setting the "loaded_matchparen" variable: >
:let loaded_matchparen = 1
The plugin installs CursorMoved, CursorMovedI and WinEnter autocommands to
redefine the match highlighting.
*:NoMatchParen* *:DoMatchParen*
To disable the plugin after it was loaded use this command: >
:NoMatchParen
And to enable it again: >
:DoMatchParen
The highlighting used is MatchParen. You can specify different colors with
the ":highlight" command. Example: >
:hi MatchParen ctermbg=blue guibg=lightblue
The characters to be matched come from the 'matchpairs' option. You can
change the value to highlight different matches. Note that not everything is
possible. For example, you can't highlight single or double quotes, because
the start and end are equal.
The syntax highlighting attributes are used. When the cursor currently is not
in a string or comment syntax item, then matches inside string and comment
syntax items are ignored. Any syntax items with "string" or "comment"
somewhere in their name are considered string or comment items.
The search is limited to avoid a delay when moving the cursor. The limits
are:
- What is visible in the window.
- 100 lines above or below the cursor to avoid a long delay when there are
closed folds.
- 'synmaxcol' times 2 bytes before or after the cursor to avoid a delay
in a long line with syntax highlighting.
- A timeout of 300 msec (60 msec in Insert mode). This can be changed with the
g:matchparen_timeout and g:matchparen_insert_timeout variables and their
buffer-local equivalents b:matchparen_timeout and
b:matchparen_insert_timeout.
If you would like the |%| command to work better, the matchit plugin can be
used, see |matchit-install|. This plugin also helps to skip matches in
comments. This is unrelated to the matchparen highlighting, they use a
different mechanism.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,111 +0,0 @@
*pi_spec.txt* For Vim version 7.4. Last change: 2006 Apr 24
by Gustavo Niemeyer ~
This is a filetype plugin to work with rpm spec files.
Currently, this Vim plugin allows you to easily update the %changelog
section in RPM spec files. It will even create a section for you if it
doesn't exist yet. If you've already inserted an entry today, it will
give you the opportunity to just add a new item in today's entry. If you
don't provide a format string (|spec_chglog_format|), it'll ask you an
email address and build a format string by itself.
1. How to use it |spec-how-to-use-it|
2. Customizing |spec-customizing|
==============================================================================
1. How to use it *spec-how-to-use-it*
The spec_chglog plugin provides a map like the following:
:map <buffer> <LocalLeader>c <Plug>SpecChangelog
It means that you may run the plugin inside a spec file by pressing
your maplocalleader key (default is '\') plus 'c'. If you do not have
|spec_chglog_format| set, the plugin will ask you for an email address
to use in this edit session.
Every time you run the plugin, it will check to see if the last entry in the
changelog has been written today and by you. If the entry matches, it will
just insert a new changelog item, otherwise it will create a new changelog
entry. If you are running with |spec_chglog_release_info| enabled, it will
also check if the name, version and release matches. The plugin is smart
enough to ask you if it should update the package release, if you have not
done so.
Setting a map *spec-setting-a-map*
-------------
As you should know, you can easily set a map to access any Vim command (or
anything, for that matter). If you don't like the default map of
<LocalLeader>c, you may just set up your own key. The following line
shows you how you could do this in your .vimrc file, mapping the plugin to
the <F5> key:
au FileType spec map <buffer> <F5> <Plug>SpecChangelog
Note: the plugin will respect your desire to change the default mapping
and won't set it.
This command will add a map only in the spec file buffers.
==============================================================================
2. Customizing *spec-customizing*
The format string *spec_chglog_format*
-----------------
You can easily customize how your spec file entry will look like. To do
this just set the variable "spec_chglog_format" in your .vimrc file like
this: >
let spec_chglog_format = "%a %b %d %Y My Name <my@email.com>"
Note that "%a %b %d %Y" is the most used time format. If you don't provide
a format string, when you run the SpecChangelog command for the first
time, it will ask you an email address and build the |spec_chglog_format|
variable for you. This way, you will only need to provide your email
address once.
To discover which format options you can use, take a look at the strftime()
function man page.
Where to insert new items *spec_chglog_prepend*
-------------------------
The plugin will usually insert new %changelog entry items (note that it's
not the entry itself) after the existing ones. If you set the
spec_chglog_prepend variable >
let spec_chglog_prepend = 1
it will insert new items before the existing ones.
Inserting release info *spec_chglog_release_info*
----------------------
If you want, the plugin may automatically insert release information
on each changelog entry. One advantage of turning this feature on is
that it may control if the release has been updated after the last
change in the package or not. If you have not updated the package
version or release, it will ask you if it should update the package
release for you. To turn this feature on, just insert the following
code in your .vimrc: >
let spec_chglog_release_info = 1
Then, the first item in your changelog entry will be something like: >
+ name-1.0-1cl
If you don't like the release updating feature and don't want to answer
"No" each time it detects an old release, you may disable it with >
let spec_chglog_never_increase_release = 1
Good luck!!
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,151 +0,0 @@
*pi_tar.txt* For Vim version 7.4. Last change: 2013 Apr 17
+====================+
| Tar File Interface |
+====================+
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright 2005-2012: *tar-copyright*
The VIM LICENSE (see |copyright|) applies to the files in this
package, including tarPlugin.vim, tar.vim, and pi_tar.txt. Like
anything else that's except use "tar.vim" instead of "VIM". Like
anything else that's free, tar.vim and its associated files are
provided *as is* and comes with no warranty of any kind, either
expressed or implied. No guarantees of merchantability. No
guarantees of suitability for any purpose. 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. Use at your own risk!
==============================================================================
1. Contents *tar* *tar-contents*
1. Contents..................................................|tar-contents|
2. Usage.....................................................|tar-usage|
3. Options...................................................|tar-options|
4. History...................................................|tar-history|
==============================================================================
2. Usage *tar-usage* *tar-manual*
When one edits a *.tar file, this plugin will handle displaying a
contents page. Select a file to edit by moving the cursor atop
the desired file, then hit the <return> key. After editing, one may
also write to the file. Currently, one may not make a new file in
tar archives via the plugin.
*:Vimuntar*
VIMUNTAR~
:Vimuntar [vimhome]
This command copies, if necessary, the tarball to the .vim or vimfiles
directory using the first writable directory in the |'runtimepath'|
when no [vimhome] is specified. Otherwise, the [vimhome] argument
allows the user to specify that directory, instead.
The copy is done using the command in *g:tar_copycmd* , which is >
cp for cygwin, unix, macunix
copy for windows (32, 95, 64, 16)
< The extraction is done with the command specified with
*g:tar_extractcmd* , which by default is >
"tar -xf"
<
*:TarDiff*
DIFFERENCING SUPPORT~
:TarDiff [filename]
This command will attempt to show the differences between the tarball
version of a file and the associated file on the system. In order to
find that file on the system, the script uses the path associated with
the file mentioned in the tarball. If the current directory is not
correct for that path, :TarDiff will fail to find the associated file.
If the [filename] is given, that that filename (and path) will be used
to specify the associated file.
PREVENTING LOADING~
If for some reason you do not wish to use vim to examine tar'd files,
you may put the following two variables into your <.vimrc> to prevent
the tar plugin from loading: >
let g:loaded_tarPlugin= 1
let g:loaded_tar = 1
<
==============================================================================
3. Options *tar-options*
These options are variables that one may change, typically in one's
<.vimrc> file.
Default
Variable Value Explanation
*g:tar_browseoptions* "Ptf" used to get a list of contents
*g:tar_readoptions* "OPxf" used to extract a file from a tarball
*g:tar_cmd* "tar" the name of the tar program
*g:tar_nomax* 0 if true, file window will not be maximized
*g:tar_secure* undef if exists:
"--"s will be used to prevent unwanted
option expansion in tar commands.
Please be sure that your tar command
accepts "--"; Posix compliant tar
utilities do accept them.
if not exists:
The tar plugin will reject any tar
files or member files that begin with
"-"
Not all tar's support the "--" which is why
it isn't default.
*g:tar_writeoptions* "uf" used to update/replace a file
==============================================================================
4. History *tar-history*
v28 Jun 23, 2011 * a few more decompression options (tbz tb2 txz)
v27 May 31, 2011 * moved cygwin detection before g:tar_copycmd handling
* inserted additional |:keepj| modifiers
* changed silent to sil! (|:silent|)
v26 Aug 09, 2010 * uses buffer-local instead of window variables to hold
tarfile name
* inserted keepj before 0d to protect jump list
v25 Jun 19, 2010 * (Jan Steffens) added support for xz compression
v24 Apr 07, 2009 * :Untarvim command implemented
Sep 28, 2009 * Added lzma support
v22 Aug 08, 2008 * security fixes
v16 Jun 06, 2008 * tarfile:: used instead of tarfile: when editing files
inside tarballs. Fixes a problem with tarballs called
things like c:\abc.tar. (tnx to Bill McCarthy)
v14 May 09, 2008 * arno caught a security bug
May 28, 2008 * various security improvements. Now requires patch 299
which provides the fnameescape() function
May 30, 2008 * allows one to view *.gz and *.bz2 files that are in
*.tar files.
v12 Sep 07, 2007 * &shq now used if not the empty string for g:tar_shq
v10 May 02, 2006 * now using "redraw then echo" to show messages, instead
of "echo and prompt user"
v9 May 02, 2006 * improved detection of masquerading as tar file
v8 May 02, 2006 * allows editing of files that merely masquerade as tar
files
v7 Mar 22, 2006 * work on making tar plugin work across network
Mar 27, 2006 * g:tar_cmd now available for users to change the name
of the tar program to be used. By default, of course,
it's "tar".
v6 Dec 21, 2005 * writing to files not in directories caused problems -
fixed (pointed out by Christian Robinson)
v5 Nov 22, 2005 * report option workaround installed
v3 Sep 16, 2005 * handles writing files in an archive back to the
archive
Oct 18, 2005 * <amatch> used instead of <afile> in autocmds
Oct 18, 2005 * handles writing to compressed archives
Nov 03, 2005 * handles writing tarfiles across a network using
netrw#NetWrite()
v2 * converted to use Vim7's new autoload feature by
Bram Moolenaar
v1 (original) * Michael Toren (see http://michael.toren.net/code/)
==============================================================================
vim:tw=78:ts=8:ft=help

View file

@ -1,273 +0,0 @@
*pi_vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17
----------------
Vimball Archiver
----------------
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2012 by Charles E. Campbell, Jr. *Vimball-copyright*
The VIM LICENSE (see |copyright|) applies to the files in this
package, including vimballPlugin.vim, vimball.vim, and pi_vimball.txt.
except use "vimball" instead of "VIM". Like anything else that's free,
vimball.vim and its associated files are provided *as is* and comes with
no warranty of any kind, either expressed or implied. No guarantees
of merchantability. No guarantees of suitability for any purpose. 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. Use at your own risk!
==============================================================================
1. Contents *vba* *vimball* *vimball-contents*
1. Contents......................................: |vimball-contents|
2. Vimball Introduction..........................: |vimball-intro|
3. Vimball Manual................................: |vimball-manual|
MkVimball.....................................: |:MkVimball|
UseVimball....................................: |:UseVimball|
RmVimball.....................................: |:RmVimball|
4. Vimball History...............................: |vimball-history|
==============================================================================
2. Vimball Introduction *vimball-intro*
Vimball is intended to make life simpler for users of plugins. All
a user needs to do with a vimball is: >
vim someplugin.vba
:so %
:q
< and the plugin and all its components will be installed into their
appropriate directories. Note that one doesn't need to be in any
particular directory when one does this. Plus, any help for the
plugin will also be automatically installed.
If a user has decided to use the AsNeeded plugin, vimball is smart
enough to put scripts nominally intended for .vim/plugin/ into
.vim/AsNeeded/ instead.
Removing a plugin that was installed with vimball is really easy: >
vim
:RmVimball someplugin
< This operation is not at all easy for zips and tarballs, for example.
Vimball examines the user's |'runtimepath'| to determine where to put
the scripts. The first directory mentioned on the runtimepath is
usually used if possible. Use >
:echo &rtp
< to see that directory.
==============================================================================
3. Vimball Manual *vimball-manual*
MAKING A VIMBALL *:MkVimball*
:[range]MkVimball[!] filename [path]
The range is composed of lines holding paths to files to be included
in your new vimball, omitting the portion of the paths that is
normally specified by the runtimepath (|'rtp'|). As an example: >
plugin/something.vim
doc/something.txt
< using >
:[range]MkVimball filename
<
on this range of lines will create a file called "filename.vba" which
can be used by Vimball.vim to re-create these files. If the
"filename.vba" file already exists, then MkVimball will issue a
warning and not create the file. Note that these paths are relative
to your .vim (vimfiles) directory, and the files should be in that
directory. The vimball plugin normally uses the first |'runtimepath'|
directory that exists as a prefix; don't use absolute paths, unless
the user has specified such a path.
If you use the exclamation point (!), then MkVimball will create the
"filename.vba" file, overwriting it if it already exists. This
behavior resembles that for |:w|.
If you wish to force slashes into the filename, that can also be done
by using the exclamation mark (ie. :MkVimball! path/filename).
The tip at http://vim.wikia.com/wiki/Using_VimBall_with_%27Make%27
has a good idea on how to automate the production of vimballs using
make.
MAKING DIRECTORIES VIA VIMBALLS *g:vimball_mkdir*
First, the |mkdir()| command is tried (not all systems support it).
If it doesn't exist, then if g:vimball_mkdir doesn't exist, it is set
as follows: >
|g:netrw_local_mkdir|, if it exists
"mkdir" , if it is executable
"makedir" , if it is executable
Otherwise , it is undefined.
< One may explicitly specify the directory making command using
g:vimball_mkdir. This command is used to make directories that
are needed as indicated by the vimball.
CONTROLLING THE VIMBALL EXTRACTION DIRECTORY *g:vimball_home*
You may override the use of the |'runtimepath'| by specifying a
variable, g:vimball_home.
*vimball-extract*
vim filename.vba
Simply editing a Vimball will cause Vimball.vim to tell the user to
source the file to extract its contents.
Extraction will only proceed if the first line of a putative vimball
file holds the "Vimball Archiver by Charles E. Campbell, Jr., Ph.D."
line.
LISTING FILES IN A VIMBALL *:VimballList*
:VimballList
This command will tell Vimball to list the files in the archive, along
with their lengths in lines.
MANUALLY INVOKING VIMBALL EXTRACTION *:UseVimball*
:UseVimball [path]
This command is contained within the vimball itself; it invokes the
vimball#Vimball() routine which is responsible for unpacking the
vimball. One may choose to execute it by hand instead of sourcing
the vimball; one may also choose to specify a path for the
installation, thereby overriding the automatic choice of the first
existing directory on the |'runtimepath'|.
REMOVING A VIMBALL *:RmVimball*
:RmVimball vimballfile [path]
This command removes all files generated by the specified vimball
(but not any directories it may have made). One may choose a path
for de-installation, too (see |'runtimepath'|); otherwise, the
default is the first existing directory on the |'runtimepath'|.
To implement this, a file (.VimballRecord) is made in that directory
containing a record of what files need to be removed for all vimballs
used thus far.
PREVENTING LOADING
If for some reason you don't want to be able to extract plugins
using vimballs: you may prevent the loading of vimball.vim by
putting the following two variables in your <.vimrc>: >
let g:loaded_vimballPlugin= 1
let g:loaded_vimball = 1
<
WINDOWS *vimball-windows*
Many vimball files are compressed with gzip. Windows, unfortunately,
does not come provided with a tool to decompress gzip'ped files.
Fortunately, there are a number of tools available for Windows users
to un-gzip files:
>
Item Tool/Suite Free Website
---- ---------- ---- -------
7zip tool y http://www.7-zip.org/
Winzip tool n http://www.winzip.com/downwz.htm
unxutils suite y http://unxutils.sourceforge.net/
cygwin suite y http://www.cygwin.com/
GnuWin32 suite y http://gnuwin32.sourceforge.net/
MinGW suite y http://www.mingw.org/
<
==============================================================================
4. Vimball History *vimball-history* {{{1
34 : Sep 22, 2011 * "UseVimball path" now supports a non-full path by
prepending the current directory to it.
33 : Apr 02, 2011 * Gave priority to *.vmb over *.vba
* Changed silent! to sil! (shorter)
* Safed |'swf'| setting (during vimball extraction,
its now turned off)
32 : May 19, 2010 * (Christian Brabrandt) :so someplugin.vba and
:so someplugin.vba.gz (and the other supported
compression types) now works
* (Jan Steffens) added support for xz compression
* fenc extraction was erroneously picking up the
end of the line number when no file encoding
was present. Fixed.
* By request, beginning the switchover from the vba
extension to vmb. Currently both are supported;
MkVimball, however, now will create *.vmb files.
Feb 11, 2011 * motoyakurotsu reported an error with vimball's
handling of zero-length files
30 : Dec 08, 2008 * fnameescape() inserted to protect error
messaging using corrupted filenames from
causing problems
* RmVimball supports filenames that would
otherwise be considered to have "magic"
characters (ie. Abc[1].vba)
Feb 18, 2009 * s:Escape(), g:vimball_shq, and g:netrw_shq
removed (shellescape() used directly)
Oct 05, 2009 * (Nikolai Weibull) suggested that MkVimball
be allowed to use slashes in the filename.
26 : May 27, 2008 * g:vimball_mkdir usage installed. Makes the
$HOME/.vim (or $HOME\vimfiles) directory if
necessary.
May 30, 2008 * (tnx to Bill McCarthy) found and fixed a bug:
vimball wasn't updating plugins to AsNeeded/
when it should
25 : Mar 24, 2008 * changed vimball#Vimball() to recognize doc/*.??x
files as help files, too.
Apr 18, 2008 * RmVimball command is now protected by saving and
restoring settings -- in particular, acd was
causing problems as reported by Zhang Shuhan
24 : Nov 15, 2007 * g:vimball_path_escape used by s:Path() to
prevent certain characters from causing trouble
(defunct: |fnameescape()| and |shellescape()|
now used instead)
22 : Mar 21, 2007 * uses setlocal instead of set during BufEnter
21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header
handling problem and it now changes \s to /s
20 : Nov 20, 2006 * substitute() calls have all had the 'e' flag
removed.
18 : Aug 01, 2006 * vimballs now use folding to easily display their
contents.
* if a user has AsNeeded/somefile, then vimball
will extract plugin/somefile to the AsNeeded/
directory
17 : Jun 28, 2006 * changes all \s to /s internally for Windows
16 : Jun 15, 2006 * A. Mechelynck's idea to allow users to specify
installation root paths implemented for
UseVimball, MkVimball, and RmVimball.
* RmVimball implemented
15 : Jun 13, 2006 * bugfix
14 : May 26, 2006 * bugfixes
13 : May 01, 2006 * exists("&acd") used to determine if the acd
option exists
12 : May 01, 2006 * bugfix - the |'acd'| option is not always defined
11 : Apr 27, 2006 * VimballList would create missing subdirectories that
the vimball specified were needed. Fixed.
10 : Apr 27, 2006 * moved all setting saving/restoration to a pair of
functions. Included some more settings in them
which frequently cause trouble.
9 : Apr 26, 2006 * various changes to support Windows' predilection
for backslashes and spaces in file and directory
names.
7 : Apr 25, 2006 * bypasses foldenable
* uses more exe and less norm! (:yank :put etc)
* does better at insuring a "Press ENTER" prompt
appears to keep its messages visible
4 : Mar 31, 2006 * BufReadPost seems to fire twice; BufReadEnter
only fires once, so the "Source this file..."
message is now issued only once.
3 : Mar 20, 2006 * removed query, now requires sourcing to be
extracted (:so %). Message to that effect
included.
* :VimballList now shows files that would be
extracted.
2 : Mar 20, 2006 * query, :UseVimball included
1 : Mar 20, 2006 * initial release
==============================================================================
vim:tw=78:ts=8:ft=help:fdm=marker

View file

@ -1,126 +0,0 @@
*pi_zip.txt* For Vim version 7.4. Last change: 2013 Apr 17
+====================+
| Zip File Interface |
+====================+
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright*
The VIM LICENSE (see |copyright|) applies to the files in this
package, including zipPlugin.vim, zip.vim, and pi_zip.vim. except use
"zip.vim" instead of "VIM". Like anything else that's free, zip.vim
and its associated files are provided *as is* and comes with no
warranty of any kind, either expressed or implied. No guarantees of
merchantability. No guarantees of suitability for any purpose. 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. Use at your own risk!
==============================================================================
1. Contents *zip* *zip-contents*
1. Contents................................................|zip-contents|
2. Usage...................................................|zip-usage|
3. Additional Extensions...................................|zip-extension|
4. History.................................................|zip-history|
==============================================================================
2. Usage *zip-usage* *zip-manual*
When one edits a *.zip file, this plugin will handle displaying a
contents page. Select a file to edit by moving the cursor atop
the desired file, then hit the <return> key. After editing, one may
also write to the file. Currently, one may not make a new file in
zip archives via the plugin.
OPTIONS
*g:zip_nomax*
If this variable exists and is true, the file window will not be
automatically maximized when opened.
*g:zip_shq*
Different operating systems may use one or more shells to execute
commands. Zip will try to guess the correct quoting mechanism to
allow spaces and whatnot in filenames; however, if it is incorrectly
guessing the quote to use for your setup, you may use >
g:zip_shq
< which by default is a single quote under Unix (') and a double quote
under Windows ("). If you'd rather have no quotes, simply set
g:zip_shq to the empty string (let g:zip_shq= "") in your <.vimrc>.
*g:zip_unzipcmd*
Use this option to specify the program which does the duty of "unzip".
It's used during browsing. By default: >
let g:zip_unzipcmd= "unzip"
<
*g:zip_zipcmd*
Use this option to specify the program which does the duty of "zip".
It's used during the writing (updating) of a file already in a zip
file; by default: >
let g:zip_zipcmd= "zip"
<
PREVENTING LOADING~
If for some reason you do not wish to use vim to examine zipped files,
you may put the following two variables into your <.vimrc> to prevent
the zip plugin from loading: >
let g:loaded_zipPlugin= 1
let g:loaded_zip = 1
<
==============================================================================
3. Additional Extensions *zip-extension*
Apparently there are a number of archivers which generate zip files that
don't use the .zip extension (.jar, .xpi, etc). To handle such files,
place a line in your <.vimrc> file: >
au BufReadCmd *.jar,*.xpi call zip#Browse(expand("<amatch>"))
<
One can simply extend this line to accommodate additional extensions that
should be treated as zip files.
==============================================================================
4. History *zip-history* {{{1
v26 Nov 15, 2012 * (Jason Spiro) provided a lot of new extensions that
are synonyms for .zip
v25 Jun 27, 2011 * using keepj with unzip -Z
(consistent with the -p variant)
* (Ben Staniford) now uses
has("win32unix") && executable("cygpath")
before converting to cygwin-style paths
v24 Jun 21, 2010 * (Cédric Bosdonnat) unzip seems to need its filenames
fnameescape'd as well as shellquote'd
* (Motoya Kurotsu) inserted keepj before 0d to protect
jump list
v17 May 09, 2008 * arno caught a security bug
v15 Sep 07, 2007 * &shq now used if not the empty string for g:zip_shq
v14 May 07, 2007 * using b:zipfile instead of w:zipfile to avoid problem
when editing alternate file to bring up a zipfile
v10 May 02, 2006 * now using "redraw then echo" to show messages, instead
of "echo and prompt user"
* g:zip_shq provided to allow for quoting control for the
command being passed via :r! ... commands.
v8 Apr 10, 2006 * Bram Moolenaar reported that he received an error message
due to "Pattern not found: ^.*\%0c"; this was caused by
stridx finding a Name... at the beginning of the line;
zip.vim tried 4,$s/^.*\%0c//, but that doesn't work.
Fixed.
v7 Mar 22, 2006 * escaped some characters that can cause filename handling
problems.
v6 Dec 21, 2005 * writing to files not in directories caused problems -
fixed (pointed out by Christian Robinson)
v5 Nov 22, 2005 * report option workaround installed
v3 Oct 18, 2005 * <amatch> used instead of <afile> in autocmds
v2 Sep 16, 2005 * silenced some commands (avoiding hit-enter prompt)
* began testing under Windows; works thus far
* filetype detection fixed
Nov 03, 2005 * handles writing zipfiles across a network using
netrw#NetWrite()
v1 Sep 15, 2005 * Initial release, had browsing, reading, and writing
==============================================================================
vim:tw=78:ts=8:ft=help:fdm=marker

View file

@ -1,755 +0,0 @@
*print.txt* For Vim version 7.4. Last change: 2010 Jul 20
VIM REFERENCE MANUAL by Bram Moolenaar
Printing *printing*
1. Introduction |print-intro|
2. Print options |print-options|
3. PostScript Printing |postscript-printing|
4. PostScript Printing Encoding |postscript-print-encoding|
5. PostScript CJK Printing |postscript-cjk-printing|
6. PostScript Printing Troubleshooting |postscript-print-trouble|
7. PostScript Utilities |postscript-print-util|
8. Formfeed Characters |printing-formfeed|
{Vi has None of this}
{only available when compiled with the |+printer| feature}
==============================================================================
1. Introduction *print-intro*
On MS-Windows Vim can print your text on any installed printer. On other
systems a PostScript file is produced. This can be directly sent to a
PostScript printer. For other printers a program like ghostscript needs to be
used.
Note: If you have problems printing with |:hardcopy|, an alternative is to use
|:TOhtml| and print the resulting html file from a browser.
*:ha* *:hardcopy* *E237* *E238* *E324*
:[range]ha[rdcopy][!] [arguments]
Send [range] lines (default whole file) to the
printer.
On MS-Windows a dialog is displayed to allow selection
of printer, paper size etc. To skip the dialog, use
the [!]. In this case the printer defined by
'printdevice' is used, or, if 'printdevice' is empty,
the system default printer.
For systems other than MS-Windows, PostScript is
written in a temp file and 'printexpr' is used to
actually print it. Then [arguments] can be used by
'printexpr' through |v:cmdarg|. Otherwise [arguments]
is ignored. 'printoptions' can be used to specify
paper size, duplex, etc.
:[range]ha[rdcopy][!] >{filename}
As above, but write the resulting PostScript in file
{filename}.
Things like "%" are expanded |cmdline-special|
Careful: An existing file is silently overwritten.
{only available when compiled with the |+postscript|
feature}
On MS-Windows use the "print to file" feature of the
printer driver.
Progress is displayed during printing as a page number and a percentage. To
abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break).
Printer output is controlled by the 'printfont' and 'printoptions' options.
'printheader' specifies the format of a page header.
The printed file is always limited to the selected margins, irrespective of
the current window's 'wrap' or 'linebreak' settings. The "wrap" item in
'printoptions' can be used to switch wrapping off.
The current highlighting colors are used in the printout, with the following
considerations:
1) The normal background is always rendered as white (i.e. blank paper).
2) White text or the default foreground is rendered as black, so that it shows
up!
3) If 'background' is "dark", then the colours are darkened to compensate for
the fact that otherwise they would be too bright to show up clearly on
white paper.
==============================================================================
2. Print options *print-options*
Here are the details for the options that change the way printing is done.
For generic info about setting options see |options.txt|.
*pdev-option*
'printdevice' 'pdev' string (default empty)
global
This defines the name of the printer to be used when the |:hardcopy| command
is issued with a bang (!) to skip the printer selection dialog. On Win32, it
should be the printer name exactly as it appears in the standard printer
dialog.
If the option is empty, then vim will use the system default printer for
":hardcopy!"
*penc-option* *E620*
'printencoding' 'penc' String (default empty, except for:
Windows, OS/2: cp1252,
Macintosh: mac-roman,
VMS: dec-mcs,
HPUX: hp-roman8,
EBCDIC: ebcdic-uk)
global
Sets the character encoding used when printing. This option tells VIM which
print character encoding file from the "print" directory in 'runtimepath' to
use.
This option will accept any value from |encoding-names|. Any recognized names
are converted to VIM standard names - see 'encoding' for more details. Names
not recognized by VIM will just be converted to lower case and underscores
replaced with '-' signs.
If 'printencoding' is empty or VIM cannot find the file then it will use
'encoding' (if VIM is compiled with |+multi_byte| and it is set an 8-bit
encoding) to find the print character encoding file. If VIM is unable to find
a character encoding file then it will use the "latin1" print character
encoding file.
When 'encoding' is set to a multi-byte encoding, VIM will try to convert
characters to the printing encoding for printing (if 'printencoding' is empty
then the conversion will be to latin1). Conversion to a printing encoding
other than latin1 will require VIM to be compiled with the |+iconv| feature.
If no conversion is possible then printing will fail. Any characters that
cannot be converted will be replaced with upside down question marks.
Four print character encoding files are provided to support default Mac, VMS,
HPUX, and EBCDIC character encodings and are used by default on these
platforms. Code page 1252 print character encoding is used by default on
Windows and OS/2 platforms.
*pexpr-option*
'printexpr' 'pexpr' String (default: see below)
global
Expression that is evaluated to print the PostScript produced with
|:hardcopy|.
The file name to be printed is in |v:fname_in|.
The arguments to the ":hardcopy" command are in |v:cmdarg|.
The expression must take care of deleting the file after printing it.
When there is an error, the expression must return a non-zero number.
If there is no error, return zero or an empty string.
The default for non MS-Windows or VMS systems is to simply use "lpr" to print
the file: >
system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)
. ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error
On MS-Dos, MS-Windows and OS/2 machines the default is to copy the file to the
currently specified printdevice: >
system('copy' . ' ' . v:fname_in . (&printdevice == ''
? ' LPT1:' : (' \"' . &printdevice . '\"')))
. delete(v:fname_in)
On VMS machines the default is to send the file to either the default or
currently specified printdevice: >
system('print' . (&printdevice == '' ? '' : ' /queue=' .
&printdevice) . ' ' . v:fname_in) . delete(v:fname_in)
If you change this option, using a function is an easy way to avoid having to
escape all the spaces. Example: >
:set printexpr=PrintFile(v:fname_in)
:function PrintFile(fname)
: call system("ghostview " . a:fname)
: call delete(a:fname)
: return v:shell_error
:endfunc
Be aware that some print programs return control before they have read the
file. If you delete the file too soon it will not be printed. These programs
usually offer an option to have them remove the file when printing is done.
*E365*
If evaluating the expression fails or it results in a non-zero number, you get
an error message. In that case Vim will delete the file. In the default
value for non-MS-Windows a trick is used: Adding "v:shell_error" will result
in a non-zero number when the system() call fails.
This option cannot be set from a |modeline| or in the |sandbox|, for security
reasons.
*pfn-option* *E613*
'printfont' 'pfn' string (default "courier")
global
This is the name of the font that will be used for the |:hardcopy| command's
output. It has the same format as the 'guifont' option, except that only one
font may be named, and the special "guifont=*" syntax is not available.
In the Win32 GUI version this specifies a font name with its extra attributes,
as with the 'guifont' option.
For other systems, only ":h11" is recognized, where "11" is the point size of
the font. When omitted, the point size is 10.
*pheader-option*
'printheader' 'pheader' string (default "%<%f%h%m%=Page %N")
global
This defines the format of the header produced in |:hardcopy| output. The
option is defined in the same way as the 'statusline' option. If Vim has not
been compiled with the |+statusline| feature, this option has no effect and a
simple default header is used, which shows the page number. The same simple
header is used when this option is empty.
*pmbcs-option*
'printmbcharset' 'pmbcs' string (default "")
global
Sets the CJK character set to be used when generating CJK output from
|:hardcopy|. The following predefined values are currently recognised by VIM:
Value Description ~
Chinese GB_2312-80
(Simplified) GBT_12345-90
MAC Apple Mac Simplified Chinese
GBT-90_MAC GB/T 12345-90 Apple Mac Simplified
Chinese
GBK GBK (GB 13000.1-93)
ISO10646 ISO 10646-1:1993
Chinese CNS_1993 CNS 11643-1993, Planes 1 & 2
(Traditional) BIG5
ETEN Big5 with ETen extensions
ISO10646 ISO 10646-1:1993
Japanese JIS_C_1978
JIS_X_1983
JIS_X_1990
MSWINDOWS Win3.1/95J (JIS X 1997 + NEC +
IBM extensions)
KANJITALK6 Apple Mac KanjiTalk V6.x
KANJITALK7 Apple Mac KanjiTalk V7.x
Korean KS_X_1992
MAC Apple Macintosh Korean
MSWINDOWS KS X 1992 with MS extensions
ISO10646 ISO 10646-1:1993
Only certain combinations of the above values and 'printencoding' are
possible. The following tables show the valid combinations:
euc-cn gbk ucs-2 utf-8 ~
Chinese GB_2312-80 x
(Simplified) GBT_12345-90 x
MAC x
GBT-90_MAC x
GBK x
ISO10646 x x
euc-tw big5 ucs-2 utf-8 ~
Chinese CNS_1993 x
(Traditional) BIG5 x
ETEN x
ISO10646 x x
euc-jp sjis ucs-2 utf-8 ~
Japanese JIS_C_1978 x x
JIS_X_1983 x x
JIS_X_1990 x x x
MSWINDOWS x
KANJITALK6 x
KANJITALK7 x
euc-kr cp949 ucs-2 utf-8 ~
Korean KS_X_1992 x
MAC x
MSWINDOWS x
ISO10646 x x
To set up the correct encoding and character set for printing some
Japanese text you would do the following; >
:set printencoding=euc-jp
:set printmbcharset=JIS_X_1983
If 'printmbcharset' is not one of the above values then it is assumed to
specify a custom multi-byte character set and no check will be made that it is
compatible with the value for 'printencoding'. VIM will look for a file
defining the character set in the "print" directory in 'runtimepath'.
*pmbfn-option*
'printmbfont' 'pmbfn' string (default "")
global
This is a comma-separated list of fields for font names to be used when
generating CJK output from |:hardcopy|. Each font name has to be preceded
with a letter indicating the style the font is to be used for as follows:
r:{font-name} font to use for normal characters
b:{font-name} font to use for bold characters
i:{font-name} font to use for italic characters
o:{font-name} font to use for bold-italic characters
A field with the r: prefix must be specified when doing CJK printing. The
other fontname specifiers are optional. If a specifier is missing then
another font will be used as follows:
if b: is missing, then use r:
if i: is missing, then use r:
if o: is missing, then use b:
Some CJK fonts do not contain characters for codes in the ASCII code range.
Also, some characters in the CJK ASCII code ranges differ in a few code points
from traditional ASCII characters. There are two additional fields to control
printing of characters in the ASCII code range.
c:yes Use Courier font for characters in the ASCII
c:no (default) code range.
a:yes Use ASCII character set for codes in the ASCII
a:no (default) code range.
The following is an example of specifying two multi-byte fonts, one for normal
and italic printing and one for bold and bold-italic printing, and using
Courier to print codes in the ASCII code range but using the national
character set: >
:set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,c:yes
<
*popt-option*
'printoptions' 'popt' string (default "")
global
This is a comma-separated list of items that control the format of the output
of |:hardcopy|:
left:{spec} left margin (default: 10pc)
right:{spec} right margin (default: 5pc)
top:{spec} top margin (default: 5pc)
bottom:{spec} bottom margin (default: 5pc)
{spec} is a number followed by "in" for inches, "pt"
for points (1 point is 1/72 of an inch), "mm" for
millimeters or "pc" for a percentage of the media
size.
Weird example:
left:2in,top:30pt,right:16mm,bottom:3pc
If the unit is not recognized there is no error and
the default value is used.
header:{nr} Number of lines to reserve for the header.
Only the first line is actually filled, thus when {nr}
is 2 there is one empty line. The header is formatted
according to 'printheader'.
header:0 Do not print a header.
header:2 (default) Use two lines for the header
syntax:n Do not use syntax highlighting. This is faster and
thus useful when printing large files.
syntax:y Do syntax highlighting.
syntax:a (default) Use syntax highlighting if the printer appears to be
able to print color or grey.
number:y Include line numbers in the printed output.
number:n (default) No line numbers.
wrap:y (default) Wrap long lines.
wrap:n Truncate long lines.
duplex:off Print on one side.
duplex:long (default) Print on both sides (when possible), bind on long
side.
duplex:short Print on both sides (when possible), bind on short
side.
collate:y (default) Collating: 1 2 3, 1 2 3, 1 2 3
collate:n No collating: 1 1 1, 2 2 2, 3 3 3
jobsplit:n (default) Do all copies in one print job
jobsplit:y Do each copy as a separate print job. Useful when
doing N-up postprocessing.
portrait:y (default) Orientation is portrait.
portrait:n Orientation is landscape.
*a4* *letter*
paper:A4 (default) Paper size: A4
paper:{name} Paper size from this table:
{name} size in cm size in inch ~
10x14 25.4 x 35.57 10 x 14
A3 29.7 x 42 11.69 x 16.54
A4 21 x 29.7 8.27 x 11.69
A5 14.8 x 21 5.83 x 8.27
B4 25 x 35.3 10.12 x 14.33
B5 17.6 x 25 7.17 x 10.12
executive 18.42 x 26.67 7.25 x 10.5
folio 21 x 33 8.27 x 13
ledger 43.13 x 27.96 17 x 11
legal 21.59 x 35.57 8.5 x 14
letter 21.59 x 27.96 8.5 x 11
quarto 21.59 x 27.5 8.5 x 10.83
statement 13.97 x 21.59 5.5 x 8.5
tabloid 27.96 x 43.13 11 x 17
formfeed:n (default) Treat form feed characters (0x0c) as a normal print
character.
formfeed:y When a form feed character is encountered, continue
printing of the current line at the beginning of the
first line on a new page.
The item indicated with (default) is used when the item is not present. The
values are not always used, especially when using a dialog to select the
printer and options.
Example: >
:set printoptions=paper:letter,duplex:off
==============================================================================
3. PostScript Printing *postscript-printing*
*E455* *E456* *E457* *E624*
Provided you have enough disk space there should be no problems generating a
PostScript file. You need to have the runtime files correctly installed (if
you can find the help files, they probably are).
There are currently a number of limitations with PostScript printing:
- 'printfont' - The font name is ignored (the Courier family is always used -
it should be available on all PostScript printers) but the font size is
used.
- 'printoptions' - The duplex setting is used when generating PostScript
output, but it is up to the printer to take notice of the setting. If the
printer does not support duplex printing then it should be silently ignored.
Some printers, however, don't print at all.
- 8-bit support - While a number of 8-bit print character encodings are
supported it is possible that some characters will not print. Whether a
character will print depends on the font in the printer knowing the
character. Missing characters will be replaced with an upside down question
mark, or a space if that character is also not known by the font. It may be
possible to get all the characters in an encoding to print by installing a
new version of the Courier font family.
- Multi-byte support - Currently VIM will try to convert multi-byte characters
to the 8-bit encoding specified by 'printencoding' (or latin1 if it is
empty). Any characters that are not successfully converted are shown as
unknown characters. Printing will fail if VIM cannot convert the multi-byte
to the 8-bit encoding.
==============================================================================
4. Custom 8-bit Print Character Encodings *postscript-print-encoding*
*E618* *E619*
To use your own print character encoding when printing 8-bit character data
you need to define your own PostScript font encoding vector. Details on how
to define a font encoding vector is beyond the scope of this help file, but
you can find details in the PostScript Language Reference Manual, 3rd Edition,
published by Addison-Wesley and available in PDF form at
http://www.adobe.com/. The following describes what you need to do for VIM to
locate and use your print character encoding.
i. Decide on a unique name for your encoding vector, one that does not clash
with any of the recognized or standard encoding names that VIM uses (see
|encoding-names| for a list), and that no one else is likely to use.
ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your
'runtimepath' and rename it with your unique name.
iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1
with your unique name (don't forget the line starting %%Title:), and
modify the array of glyph names to define your new encoding vector. The
array must have exactly 256 entries or you will not be able to print!
iv. Within VIM, set 'printencoding' to your unique encoding name and then
print your file. VIM will now use your custom print character encoding.
VIM will report an error with the resource file if you change the order or
content of the first 3 lines, other than the name of the encoding on the line
starting %%Title: or the version number on the line starting %%Version:.
[Technical explanation for those that know PostScript - VIM looks for a file
with the same name as the encoding it will use when printing. The file
defines a new PostScript Encoding resource called /VIM-name, where name is the
print character encoding VIM will use.]
==============================================================================
5. PostScript CJK Printing *postscript-cjk-printing*
*E673* *E674* *E675*
VIM supports printing of Chinese, Japanese, and Korean files. Setting up VIM
to correctly print CJK files requires setting up a few more options.
Each of these countries has many standard character sets and encodings which
require that both be specified when printing. In addition, CJK fonts normally
do not have the concept of italic glyphs and use different weight or stroke
style to achieve emphasis when printing. This in turn requires a different
approach to specifying fonts to use when printing.
The encoding and character set are specified with the 'printencoding' and
'printmbcharset' options. If 'printencoding' is not specified then 'encoding'
is used as normal. If 'printencoding' is specified then characters will be
translated to this encoding for printing. You should ensure that the encoding
is compatible with the character set needed for the file contents or some
characters may not appear when printed.
The fonts to use for CJK printing are specified with 'printmbfont'. This
option allows you to specify different fonts to use when printing characters
which are syntax highlighted with the font styles normal, italic, bold and
bold-italic.
No CJK fonts are supplied with VIM. There are some free Korean, Japanese, and
Traditional Chinese fonts available at:
http://examples.oreilly.com/cjkvinfo/adobe/samples/
You can find descriptions of the various fonts in the read me file at
http://examples.oreilly.de/english_examples/cjkvinfo/adobe/00README
Please read your printer documentation on how to install new fonts.
CJK fonts can be large containing several thousand glyphs, and it is not
uncommon to find that they only contain a subset of a national standard. It
is not unusual to find the fonts to not include characters for codes in the
ASCII code range. If you find half-width Roman characters are not appearing
in your printout then you should configure VIM to use the Courier font the
half-width ASCII characters with 'printmbfont'. If your font does not include
other characters then you will need to find another font that does.
Another issue with ASCII characters, is that the various national character
sets specify a couple of different glyphs in the ASCII code range. If you
print ASCII text using the national character set you may see some unexpected
characters. If you want true ASCII code printing then you need to configure
VIM to output ASCII characters for the ASCII code range with 'printmbfont'.
It is possible to define your own multi-byte character set although this
should not be attempted lightly. A discussion on the process if beyond the
scope of these help files. You can find details on CMap (character map) files
in the document 'Adobe CMap and CIDFont Files Specification, Version 1.0',
available from http://www.adobe.com as a PDF file.
==============================================================================
6. PostScript Printing Troubleshooting *postscript-print-trouble*
*E621*
Usually the only sign of a problem when printing with PostScript is that your
printout does not appear. If you are lucky you may get a printed page that
tells you the PostScript operator that generated the error that prevented the
print job completing.
There are a number of possible causes as to why the printing may have failed:
- Wrong version of the prolog resource file. The prolog resource file
contains some PostScript that VIM needs to be able to print. Each version
of VIM needs one particular version. Make sure you have correctly installed
the runtime files, and don't have any old versions of a file called prolog
in the print directory in your 'runtimepath' directory.
- Paper size. Some PostScript printers will abort printing a file if they do
not support the requested paper size. By default VIM uses A4 paper. Find
out what size paper your printer normally uses and set the appropriate paper
size with 'printoptions'. If you cannot find the name of the paper used,
measure a sheet and compare it with the table of supported paper sizes listed
for 'printoptions', using the paper that is closest in both width AND height.
Note: The dimensions of actual paper may vary slightly from the ones listed.
If there is no paper listed close enough, then you may want to try psresize
from PSUtils, discussed below.
- Two-sided printing (duplex). Normally a PostScript printer that does not
support two-sided printing will ignore any request to do it. However, some
printers may abort the job altogether. Try printing with duplex turned off.
Note: Duplex prints can be achieved manually using PS utils - see below.
- Collated printing. As with Duplex printing, most PostScript printers that
do not support collating printouts will ignore a request to do so. Some may
not. Try printing with collation turned off.
- Syntax highlighting. Some print management code may prevent the generated
PostScript file from being printed on a black and white printer when syntax
highlighting is turned on, even if solid black is the only color used. Try
printing with syntax highlighting turned off.
A safe printoptions setting to try is: >
:set printoptions=paper:A4,duplex:off,collate:n,syntax:n
Replace "A4" with the paper size that best matches your printer paper.
==============================================================================
7. PostScript Utilities *postscript-print-util*
7.1 Ghostscript
Ghostscript is a PostScript and PDF interpreter that can be used to display
and print on non-PostScript printers PostScript and PDF files. It can also
generate PDF files from PostScript.
Ghostscript will run on a wide variety of platforms.
There are three available versions:
- AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for
non-commercial use. It can be obtained from:
http://www.cs.wisc.edu/~ghost/
- GNU Ghostscript which is available under the GNU General Public License. It
can be obtained from:
ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/
- A commercial version for inclusion in commercial products.
Additional information on Ghostscript can also be found at:
http://www.ghostscript.com/
Support for a number of non PostScript printers is provided in the
distribution as standard, but if you cannot find support for your printer
check the Ghostscript site for other printers not included by default.
7.2 Ghostscript Previewers.
The interface to Ghostscript is very primitive so a number of graphical front
ends have been created. These allow easier PostScript file selection,
previewing at different zoom levels, and printing. Check supplied
documentation for full details.
X11
- Ghostview. Obtainable from:
http://www.cs.wisc.edu/~ghost/gv/
- gv. Derived from Ghostview. Obtainable from:
http://wwwthep.physik.uni-mainz.de/~plass/gv/
Copies (possibly not the most recent) can be found at:
http://www.cs.wisc.edu/~ghost/gv/
OpenVMS
- Is apparently supported in the main code now (untested). See:
http://wwwthep.physik.uni-mainz.de/~plass/gv/
Windows and OS/2
- GSview. Obtainable from:
http://www.cs.wisc.edu/~ghost/gsview/
DOS
- ps_view. Obtainable from:
ftp://ftp.pg.gda.pl/pub/TeX/support/ps_view/
ftp://ftp.dante.de/tex-archive/support/ps_view/
Linux
- GSview. Linux version of the popular Windows and OS/2 previewer.
Obtainable from:
http://www.cs.wisc.edu/~ghost/gsview/
- BMV. Different from Ghostview and gv in that it doesn't use X but svgalib.
Obtainable from:
ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz
7.3 PSUtils
PSUtils is a collection of utility programs for manipulating PostScript
documents. Binary distributions are available for many platforms, as well as
the full source. PSUtils can be found at:
http://knackered.org/angus/psutils
The utilities of interest include:
- psnup. Convert PS files for N-up printing.
- psselect. Select page range and order of printing.
- psresize. Change the page size.
- psbook. Reorder and lay out pages ready for making a book.
The output of one program can be used as the input to the next, allowing for
complex print document creation.
N-UP PRINTING
The psnup utility takes an existing PostScript file generated from VIM and
convert it to an n-up version. The simplest way to create a 2-up printout is
to first create a PostScript file with: >
:hardcopy > test.ps
Then on your command line execute: >
psnup -n 2 test.ps final.ps
Note: You may get warnings from some Ghostscript previewers for files produced
by psnup - these may safely be ignored.
Finally print the file final.ps to your PostScript printer with your
platform's print command. (You will need to delete the two PostScript files
afterwards yourself.) 'printexpr' could be modified to perform this extra
step before printing.
ALTERNATE DUPLEX PRINTING
It is possible to achieve a poor man's version of duplex printing using the PS
utility psselect. This utility has options -e and -o for printing just the
even or odd pages of a PS file respectively.
First generate a PS file with the 'hardcopy' command, then generate a new
files with all the odd and even numbered pages with: >
psselect -o test.ps odd.ps
psselect -e test.ps even.ps
Next print odd.ps with your platform's normal print command. Then take the
print output, turn it over and place it back in the paper feeder. Now print
even.ps with your platform's print command. All the even pages should now
appear on the back of the odd pages.
There are a couple of points to bear in mind:
1. Position of the first page. If the first page is on top of the printout
when printing the odd pages then you need to reverse the order that the odd
pages are printed. This can be done with the -r option to psselect. This
will ensure page 2 is printed on the back of page 1.
Note: it is better to reverse the odd numbered pages rather than the even
numbered in case there are an odd number of pages in the original PS file.
2. Paper flipping. When turning over the paper with the odd pages printed on
them you may have to either flip them horizontally (along the long edge) or
vertically (along the short edge), as well as possibly rotating them 180
degrees. All this depends on the printer - it will be more obvious for
desktop ink jets than for small office laser printers where the paper path
is hidden from view.
==============================================================================
8. Formfeed Characters *printing-formfeed*
By default VIM does not do any special processing of |formfeed| control
characters. Setting the 'printoptions' formfeed item will make VIM recognize
formfeed characters and continue printing the current line at the beginning
of the first line on a new page. The use of formfeed characters provides
rudimentary print control but there are certain things to be aware of.
VIM will always start printing a line (including a line number if enabled)
containing a formfeed character, even if it is the first character on the
line. This means if a line starting with a formfeed character is the first
line of a page then VIM will print a blank page.
Since the line number is printed at the start of printing the line containing
the formfeed character, the remainder of the line printed on the new page
will not have a line number printed for it (in the same way as the wrapped
lines of a long line when wrap in 'printoptions' is enabled).
If the formfeed character is the last character on a line, then printing will
continue on the second line of the new page, not the first. This is due to
VIM processing the end of the line after the formfeed character and moving
down a line to continue printing.
Due to the points made above it is recommended that when formfeed character
processing is enabled, printing of line numbers is disabled, and that form
feed characters are not the last character on a line. Even then you may need
to adjust the number of lines before a formfeed character to prevent
accidental blank pages.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,275 +0,0 @@
*quotes.txt* For Vim version 7.4. Last change: 2010 Nov 03
VIM REFERENCE MANUAL by Bram Moolenaar
*quotes*
Here are some nice quotes about Vim that I collected from news and mail.
vim (vim) noun - Ebullient vitality and energy. [Latin, accusative of vis,
strength] (Dictionary)
Vim is so much better than vi that a great many of my old vi :map's became
immediately obsolete! (Tony Nugent, Australia)
Coming with a very GUI mindset from Windows, I always thought of people using
Vi as some kind of outer space alien in human clothes. Once I tried I really
got addicted by its power and now I found myself typing Vim keypresses in the
oddest places! That's why I would like to see Vim embedded in every
application which deals with text editing. (José Fonseca)
I was a 12-year emacs user who switched to Vim about a year ago after finally
giving up on the multiple incompatible versions, flaky contributed packages,
disorganized keystrokes, etc. And it was one of the best moves I ever made.
(Joel Burton)
Although all of the programs were used during the preparation of the new and
revised material, most of the editing was done with Vim versions 4.5 and 5.0
under GNU-Linux (Redhat 4.2). (Arnold Robbins, Israel, author of "Learning
the Vi editor")
Out of all the open software i've ever seen and used, and i've seen a lot, Vim
is the best, most useful and highest quality to work with, second only to the
linux kernel itself. (Peter Jay Salzman)
It's well worth noting that the _entirety_ of SourceForge was written using
Vim and its nifty PHP syntax highlighting. I think the entire SF.net tech
staff uses Vim and we're all excited to have you aboard! (Tim Perdue)
Vim is one of a select bunch of tools for which I have no substitute. It is
a brilliant piece of work! (Biju Chacko)
A previous girlfriend of mine switched to emacs. Needless to say, the
relationship went nowhere. (Geoffrey Mann)
I rarely think about Vim, in the same way that I guess a fish rarely thinks
about water. It's the environment in which everything else happens. I'm a
fairly busy system administrator working on a lot of different platforms. Vim
is the only thing that's consistent across all my systems, and it's just about
the only thing that doesn't break from time to time. When a new system comes
in the door without Vim, I install it right away. Great to have a tool that's
the same everywhere, that's completely reliable, so I can ignore it and think
about other things. (Pete Schaeffer)
Having recently succeeded in running Vim via telnet through a Nokia
Communicator, I can now report that it works nicely on a Palm Pilot too.
(Allan Kelly, Scotland)
You've done a tremendous job with 'VIM', Bram! The more I use it, the more
impressed I get (I am an old 'vi' die hard who once started out with early
versions of 'emacs' in the late 1970's and was relieved by finding 'vi' in the
first UNIX I came across in 1983). In my opinion, it's about time 'VIM'
replace 'emacs' as the standard for top editors. (Bo Thide', Sweden)
I love and use VIM heavily too. (Larry Wall)
Vi is like a Ferrari, if you're a beginner, it handles like a bitch, but once
you get the hang of it, it's small, powerful and FAST! (Unknown)
VIM is like a new model Ferrari, and sounds like one too - "VIIIIIIMMM!"
(Stephen Riehm, Germany)
Schon bei Nutzung eines Bruchteils der VIM-Funktionen wird der Benutzer recht
schnell die Vorzuege dieses Editors kennen- und schaetzenlernen.
Translated: Even when only using a fraction of VIM-functions, the user will
quickly get used to and appreciate the advantages of this editor. (Garry
Glendown, conclusion of an article on VIM in iX magazine 9/1998)
I've recently acquired the O'Reilly book on VI (it also discusses VIM
in-depth), and I'm amazed at just how powerful this application is. (Jeffrey
Rankin)
This guide was written using the Windows 9.x distribution of GVIM, which is
quite possibly the greatest thing to come along since God created the naked
girl. (Michael DiBernardo)
Boy, I thought I knew almost everything about VIM, but every time I browse the
online documentation, I hit upon a minor but cool aspect of a VIM feature that
I didn't know before! I must say the documentation is one the finest I've
ever seen in a product -- even better than most commercial products.
(Gautam Mudunuri)
VIM 4.5 is really a fantastic editor. It has sooooo many features and more
importantly, the defaults are so well thought out that you really don't have
to change anything!! Words cannot express my amazement and gratitude to the
creators of VIM. Keep it up. (Vikas, USA)
I wonder how long it will be before people will refer to other Vi editors as
VIM clones? (Darren Hiebert)
I read about [auto-positioning-in-file-based-on-the-errors-from-make] in one
of those "Perfect Programmer's Editor" threads and was delighted to discover
that VIM already supports it. (Brendan Macmillan, Australia)
I just discovered VIM (5.0) and I'm telling everyone I know about it!
I tell them VIM stands for VI for the new (M)illenium. Thanks so much!
(Matt F. Valentine)
I think from now on "vi" should be called "Vim Imitation", not the other way
around. (Rungun Ramanathan)
The Law of VIM:
For each member b of the possible behaviour space B of program P, there exists
a finite time t before which at least one user u in the total user space U of
program P will request b becomes a member of the allowed behaviour space B'
(B' <= B).
In other words: Sooner or later everyone wants everything as an option.
(Negri)
Whenever I move to a new computing platform, the first thing I do is to port
VIM. Lately, I am simply stunned by its ease of compilation using the
configure facility. (A.M. Sabuncu, Turkey)
The options are really excellent and very powerful. (Anish Maharaj)
The Spring user-interface designs are in, and word from the boutiques is that
80x24 text-only mode is back with a *vengeance! Vi editor clone VIM burst onto
March desk-tops with a dazzling show of pastel syntax highlights for its 5.0
look. Strident and customizable, VIM raises eyebrows with its interpretation
of the classic Vi single-key macro collection.
http://www.ntk.net/index.cgi?back=archive98/now0327.txt&line=179#l
I just wanted to take this opportunity to let you know that VIM 5 ROCKS!
Syntax highlighting: how did I survive without it?! Thank you for creating
mankind's best editor! (Mun Johl, USA)
Thanks again for VIM. I use it every day on Linux. (Eric Foster-Johnson,
author of the book "UNIX Programming Tools")
The BEST EDITOR EVER (Stuart Woolford)
I have used most of VIM's fancy features at least once, many frequently, and I
can honestly say that I couldn't live with anything less anymore. My
productivity has easily doubled compared to what it was when I used vi.
(Sitaram Chamarty)
I luv VIM. It is incredible. I'm naming my first-born Vimberly. (Jose
Unpingco, USA)
Hint: "VIM" is "vi improved" - much better! (Sven Guckes, Germany)
I use VIM every day. I spend more time in VIM than in any other program...
It's the best vi clone there is. I think it's great. (Craig Sanders,
Australia)
I strongly advise using VIM--its infinite undo/redo saved me much grief.
(Terry Brown)
Thanks very much for writing what in my opinion is the finest text editor on
the planet. If I were to get another cat, I would name it "Vim".
(Bob Sheehan, USA)
I typed :set all and the screen FILLED up with options. A whole screen of
things to be set and unset. I saw some of my old friends like wrapmargin,
modelines and showmode, but the screen was FILLED with new friends! I love
them all! I love VIM! I'm so happy that I've found this editor! I feel
like how I once felt when I started using vi after a couple of years of using
ed. I never thought I'd forsake my beloved ed, but vi ... oh god, vi was
great. And now, VIM. (Peter Jay Salzman, USA)
I am really happy with such a wonderful software package. Much better than
almost any expensive, off the shelf program. (Jeff Walker)
Whenever I reread the VIM documentation I'm overcome with excitement at the
power of the editor. (William Edward Webber, Australia)
Hurrah for VIM!! It is "at your fingertips" like vi, and has the extensions
that vi sorely needs: highlighting for executing commands on blocks, an easily
navigable and digestible help screen, and more. (Paul Pax)
The reason WHY I don't have this amazingly useful macro any more, is that I
now use VIM - and this is built in!! (Stephen Riehm, Germany)
I am a user of VIM and I love it. I use it to do all my programming, C,
C++, HTML what ever. (Tim Allwine)
I discovered VIM after years of struggling with the original vi, and I just
can't live without it any more. (Emmanuel Mogenet, USA)
Emacs has not a bit of chance to survive so long as VIM is around. Besides,
it also has the most detailed software documentation I have ever seen---much
better than most commercial software! (Leiming Qian)
This version of VIM will just blow people apart when they discover just how
fantastic it is! (Tony Nugent, Australia)
I took your advice & finally got VIM & I'm really impressed. Instant convert.
(Patrick Killelea, USA)
VIM is by far my favorite piece of shareware and I have been particularly
pleased with version 3.0. This is really a solid piece of work. (Robert
Colon, USA)
VIM is a joy to use, it is so well thought and practical that I wonder why
anybody would use visual development tools. VIM is powerful and elegant, it
looks deceptively simple but is almost as complex as a 747 (especially when I
look at my growing .vimrc), keep up that wonderful job, VIM is a centerpiece
of the free software world. (Louis-David Mitterand, USA)
I cannot believe how great it is to use VIM. I think the guys at work are
getting tired of hearing me bragging about it. Others eyes are lighting up.
(Rick Croote)
Emacs takes way too much time to start up and run, it is too big and bulky for
effective use and the interface is more confusing than it is of any help. VIM
however is short, it is fast, it is powerful, it has a good interface and it
is all purpose. (Paal Ditlefsen Ekran)
From the first time I got VIM3.0, I was very enthusiastic. It has almost no
problems. The swapfile handling and the backup possibilities are robust, also
the protection against editing one file twice. It is very compatible to the
real VI (and that is a MUST, because my brain is trained over years in using
it). (Gert van Antwerpen, Holland)
Visual mode in VIM is a very powerful thing! (Tony Nugent, Australia)
I have to say that VIM is =THE= single greatest piece of source code to ever
come across the net (Jim Battle, USA).
In fact, if you do want to get a new vi I'd suggest VIM-3.0. This is, by
far, the best version of vi I've ever seen (Albert W. Schueller).
I should mention that VIM is a very good editor and can compete with anything
(Ilya Beloozerov).
To tell the truth sometimes I used elvis, vile, xvi, calvin, etc. And this is
the reason that I can state that VIM is the best! (Ferenc Deak, Hungary)
VIM is by far the best editor that I have used in a long time, and I have
looked at just about every thing that is available for every platform that I
use. VIM is the best on all of them. (Guy L. Oliver)
VIM is the greatest editor since the stone chisel. (Jose Unpingco, USA)
I would like to say that with VIM I am finally making the 'emacs to vi'
transition - as an Editor it is so much better in many ways: keyboard layout,
memory usage, text alteration to name 3. (Mark Adam)
In fact, now if I want to know what a particular setting does in vi, I fire up
VIM and check out its help! (Nikhil Patel, USA)
As a vi user, VIM has made working with text a far more pleasant task than
before I encountered this program. (Steinar Knutsen, Norway)
I use VIM since version 3.0. Since that time, it is the ONLY editor I use,
with Solaris, Linux and OS/2 Warp. I suggest all my friends to use VIM, they
try, and they continue using it. VIM is really the best software I have ever
downloaded from the Internet, and the best editor I know of. (Marco
Eccettuato, Italy)
In summary:
__ ___ _ _ _ ___ _____ `
\ \ / (_)_ __ ___ (_)___ | | | |/ _ \_ _| `
\ \ / /| | '_ ` _ \ | / __| | |_| | | | || | `
\ V / | | | | | | | | \__ \ | _ | |_| || | `
\_/ |_|_| |_| |_| |_|___/ |_| |_|\___/ |_| `
____ _____ _ _ _____ _____ _ _ `
/ ___|_ _| | | | ___| ___| | | `
\___ \ | | | | | | |_ | |_ | | | `
___) || | | |_| | _| | _| |_|_| `
|____/ |_| \___/|_| |_| (_|_) (Tony Nugent, Australia) `
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,230 +0,0 @@
*recover.txt* For Vim version 7.4. Last change: 2010 Jul 20
VIM REFERENCE MANUAL by Bram Moolenaar
Recovery after a crash *crash-recovery*
You have spent several hours typing in that text that has to be finished
next morning, and then disaster strikes: Your computer crashes.
DON'T PANIC!
You can recover most of your changes from the files that Vim uses to store
the contents of the file. Mostly you can recover your work with one command:
vim -r filename
1. The swap file |swap-file|
2. Recovery |recovery|
==============================================================================
1. The swap file *swap-file*
Vim stores the things you changed in a swap file. Using the original file
you started from plus the swap file you can mostly recover your work.
You can see the name of the current swap file being used with the command:
:sw[apname] *:sw* *:swapname*
The name of the swap file is normally the same as the file you are editing,
with the extension ".swp".
- On Unix, a '.' is prepended to swap file names in the same directory as the
edited file. This avoids that the swap file shows up in a directory
listing.
- On MS-DOS machines and when the 'shortname' option is on, any '.' in the
original file name is replaced with '_'.
- If this file already exists (e.g., when you are recovering from a crash) a
warning is given and another extension is used, ".swo", ".swn", etc.
- An existing file will never be overwritten.
- The swap file is deleted as soon as Vim stops editing the file.
Technical: The replacement of '.' with '_' is done to avoid problems with
MS-DOS compatible filesystems (e.g., crossdos, multidos). If Vim
is able to detect that the file is on an MS-DOS-like filesystem, a
flag is set that has the same effect as the 'shortname' option.
This flag is reset when you start editing another file.
*E326*
If the ".swp" file name already exists, the last character is
decremented until there is no file with that name or ".saa" is
reached. In the last case, no swap file is created.
By setting the 'directory' option you can place the swap file in another place
than where the edited file is.
Advantages:
- You will not pollute the directories with ".swp" files.
- When the 'directory' is on another partition, reduce the risk of damaging
the file system where the file is (in a crash).
Disadvantages:
- You can get name collisions from files with the same name but in different
directories (although Vim tries to avoid that by comparing the path name).
This will result in bogus ATTENTION warning messages.
- When you use your home directory, and somebody else tries to edit the same
file, he will not see your swap file and will not get the ATTENTION warning
message.
On the Amiga you can also use a recoverable ram disk, but there is no 100%
guarantee that this works. Putting swap files in a normal ram disk (like RAM:
on the Amiga) or in a place that is cleared when rebooting (like /tmp on Unix)
makes no sense, you will lose the swap file in a crash.
If you want to put swap files in a fixed place, put a command resembling the
following ones in your .vimrc:
:set dir=dh2:tmp (for Amiga)
:set dir=~/tmp (for Unix)
:set dir=c:\\tmp (for MS-DOS and Win32)
This is also very handy when editing files on floppy. Of course you will have
to create that "tmp" directory for this to work!
For read-only files, a swap file is not used. Unless the file is big, causing
the amount of memory used to be higher than given with 'maxmem' or
'maxmemtot'. And when making a change to a read-only file, the swap file is
created anyway.
The 'swapfile' option can be reset to avoid creating a swapfile.
Detecting an existing swap file ~
You can find this in the user manual, section |11.3|.
Updating the swapfile ~
The swap file is updated after typing 200 characters or when you have not
typed anything for four seconds. This only happens if the buffer was
changed, not when you only moved around. The reason why it is not kept up to
date all the time is that this would slow down normal work too much. You can
change the 200 character count with the 'updatecount' option. You can set
the time with the 'updatetime' option. The time is given in milliseconds.
After writing to the swap file Vim syncs the file to disk. This takes some
time, especially on busy Unix systems. If you don't want this you can set the
'swapsync' option to an empty string. The risk of losing work becomes bigger
though. On some non-Unix systems (MS-DOS, Amiga) the swap file won't be
written at all.
If the writing to the swap file is not wanted, it can be switched off by
setting the 'updatecount' option to 0. The same is done when starting Vim
with the "-n" option. Writing can be switched back on by setting the
'updatecount' option to non-zero. Swap files will be created for all buffers
when doing this. But when setting 'updatecount' to zero, the existing swap
files will not be removed, it will only affect files that will be opened
after this.
If you want to make sure that your changes are in the swap file use this
command:
*:pre* *:preserve* *E313* *E314*
:pre[serve] Write all text for all buffers into swap file. The
original file is no longer needed for recovery.
This sets a flag in the current buffer. When the '&'
flag is present in 'cpoptions' the swap file will not
be deleted for this buffer when Vim exits and the
buffer is still loaded |cpo-&|.
{Vi: might also exit}
A Vim swap file can be recognized by the first six characters: "b0VIM ".
After that comes the version number, e.g., "3.0".
Links and symbolic links ~
On Unix it is possible to have two names for the same file. This can be done
with hard links and with symbolic links (symlinks).
For hard links Vim does not know the other name of the file. Therefore, the
name of the swapfile will be based on the name you used to edit the file.
There is no check for editing the same file by the other name too, because Vim
cannot find the other swapfile (except for searching all of your harddisk,
which would be very slow).
For symbolic links Vim resolves the links to find the name of the actual file.
The swap file name is based on that name. Thus it doesn't matter by what name
you edit the file, the swap file name will normally be the same. However,
there are exceptions:
- When the directory of the actual file is not writable the swapfile is put
elsewhere.
- When the symbolic links somehow create a loop you get an *E773* error
message and the unmodified file name will be used. You won't be able to
save your file normally.
==============================================================================
2. Recovery *recovery* *E308* *E311*
Basic file recovery is explained in the user manual: |usr_11.txt|.
Another way to do recovery is to start Vim and use the ":recover" command.
This is easy when you start Vim to edit a file and you get the "ATTENTION:
Found a swap file ..." message. In this case the single command ":recover"
will do the work. You can also give the name of the file or the swap file to
the recover command:
*:rec* *:recover* *E305* *E306* *E307*
:rec[over] [file] Try to recover [file] from the swap file. If [file]
is not given use the file name for the current
buffer. The current contents of the buffer are lost.
This command fails if the buffer was modified.
:rec[over]! [file] Like ":recover", but any changes in the current
buffer are lost.
*E312* *E309* *E310*
Vim has some intelligence about what to do if the swap file is corrupt in
some way. If Vim has doubt about what it found, it will give an error
message and insert lines with "???" in the text. If you see an error message
while recovering, search in the file for "???" to see what is wrong. You may
want to cut and paste to get the text you need.
The most common remark is "???LINES MISSING". This means that Vim cannot read
the text from the original file. This can happen if the system crashed and
parts of the original file were not written to disk.
Be sure that the recovery was successful before overwriting the original
file or deleting the swap file. It is good practice to write the recovered
file elsewhere and run 'diff' to find out if the changes you want are in the
recovered file. Or use |:DiffOrig|.
Once you are sure the recovery is ok delete the swap file. Otherwise, you
will continue to get warning messages that the ".swp" file already exists.
{Vi: recovers in another way and sends mail if there is something to recover}
ENCRYPTION AND THE SWAP FILE *:recover-crypt*
When the text file is encrypted the swap file is encrypted as well. This
makes recovery a bit more complicated. When recovering from a swap file and
encryption has been used, you will be asked to enter one or two crypt keys.
If the text file does not exist you will only be asked to enter the crypt key
for the swap file.
If the text file does exist, it may be encrypted in a different way than the
swap file. You will be asked for the crypt key twice:
Need encryption key for "/tmp/tt" ~
Enter encryption key: ****** ~
"/tmp/tt" [crypted] 23200L, 522129C ~
Using swap file "/tmp/.tt.swp" ~
Original file "/tmp/tt" ~
Swap file is encrypted: "/tmp/.tt.swp" ~
If you entered a new crypt key but did not write the text file, ~
enter the new crypt key. ~
If you wrote the text file after changing the crypt key press enter ~
to use the same key for text file and swap file ~
Enter encryption key: ~
You can be in one of these two situations:
1. The encryption key was not changed, or after changing the key the text file
was written. You will be prompted for the crypt key twice. The second
time you can simply press Enter. That means the same key is used for the
text file and the swap file.
2. You entered a new encryption key, but did not save the text file. Vim will
then use the new key for the swap file, and the text file will still be
encrypted with the old key. At the second prompt enter the new key.
Note that after recovery the key of the swap file will be used for the text
file. Thus if you write the text file, you need to use that new key.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,204 +0,0 @@
*remote.txt* For Vim version 7.4. Last change: 2008 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
Vim client-server communication *client-server*
1. Common functionality |clientserver|
2. X11 specific items |x11-clientserver|
3. MS-Windows specific items |w32-clientserver|
{Vi does not have any of these commands}
==============================================================================
1. Common functionality *clientserver*
When compiled with the |+clientserver| option, Vim can act as a command
server. It accepts messages from a client and executes them. At the same
time, Vim can function as a client and send commands to a Vim server.
The following command line arguments are available:
argument meaning ~
--remote [+{cmd}] {file} ... *--remote*
Open the file list in a remote Vim. When
there is no Vim server, execute locally.
There is one optional init command: +{cmd}.
This must be an Ex command that can be
followed by "|".
The rest of the command line is taken as the
file list. Thus any non-file arguments must
come before this.
You cannot edit stdin this way |--|.
The remote Vim is raised. If you don't want
this use >
vim --remote-send "<C-\><C-N>:n filename<CR>"
< --remote-silent [+{cmd}] {file} ... *--remote-silent*
As above, but don't complain if there is no
server and the file is edited locally.
--remote-wait [+{cmd}] {file} ... *--remote-wait*
As --remote, but wait for files to complete
(unload) in remote Vim.
--remote-wait-silent [+{cmd}] {file} ... *--remote-wait-silent*
As --remote-wait, but don't complain if there
is no server.
*--remote-tab*
--remote-tab Like --remote but open each file in a new
tabpage.
*--remote-tab-silent*
--remote-tab-silent Like --remote-silent but open each file in a
new tabpage.
*--remote-tab-wait*
--remote-tab-wait Like --remote-wait but open each file in a new
tabpage.
*--remote-tab-wait-silent*
--remote-tab-wait-silent Like --remote-wait-silent but open each file
in a new tabpage.
*--servername*
--servername {name} Become the server {name}. When used together
with one of the --remote commands: connect to
server {name} instead of the default (see
below).
*--remote-send*
--remote-send {keys} Send {keys} to server and exit. The {keys}
are not mapped. Special key names are
recognized, e.g., "<CR>" results in a CR
character.
*--remote-expr*
--remote-expr {expr} Evaluate {expr} in server and print the result
on stdout.
*--serverlist*
--serverlist Output a list of server names.
Examples ~
Edit "file.txt" in an already running GVIM server: >
gvim --remote file.txt
Edit "file.txt" in an already running server called FOOBAR: >
gvim --servername FOOBAR --remote file.txt
Edit "file.txt" in server "FILES" if it exists, become server "FILES"
otherwise: >
gvim --servername FILES --remote-silent file.txt
This doesn't work, all arguments after --remote will be used as file names: >
gvim --remote --servername FOOBAR file.txt
Edit file "+foo" in a remote server (note the use of "./" to avoid the special
meaning of the leading plus): >
vim --remote ./+foo
Tell the remote server "BLA" to write all files and exit: >
vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>'
SERVER NAME
By default Vim will try to register the name under which it was invoked (gvim,
egvim ...). This can be overridden with the --servername argument. If the
specified name is not available, a postfix is applied until a free name is
encountered, i.e. "gvim1" for the second invocation of gvim on a particular
X-server. The resulting name is available in the servername builtin variable
|v:servername|. The case of the server name is ignored, thus "gvim" and
"GVIM" are considered equal.
When Vim is invoked with --remote, --remote-wait or --remote-send it will try
to locate the server name determined by the invocation name and --servername
argument as described above. If an exact match is not available, the first
server with the number postfix will be used. If a name with the number
postfix is specified with the --servername argument, it must match exactly.
If no server can be located and --remote or --remote-wait was used, Vim will
start up according to the rest of the command line and do the editing by
itself. This way it is not necessary to know whether gvim is already started
when sending command to it.
The --serverlist argument will cause Vim to print a list of registered command
servers on the standard output (stdout) and exit.
Win32 Note: Making the Vim server go to the foreground doesn't always work,
because MS-Windows doesn't allow it. The client will move the server to the
foreground when using the --remote or --remote-wait argument and the server
name starts with "g".
REMOTE EDITING
The --remote argument will cause a |:drop| command to be constructed from the
rest of the command line and sent as described above.
The --remote-wait argument does the same thing and additionally sets up to
wait for each of the files to have been edited. This uses the BufUnload
event, thus as soon as a file has been unloaded, Vim assumes you are done
editing it.
Note that the --remote and --remote-wait arguments will consume the rest of
the command line. I.e. all remaining arguments will be regarded as filenames.
You can not put options there!
FUNCTIONS
*E240* *E573*
There are a number of Vim functions for scripting the command server. See
the description in |eval.txt| or use CTRL-] on the function name to jump to
the full explanation.
synopsis explanation ~
remote_expr( server, string, idvar) send expression
remote_send( server, string, idvar) send key sequence
serverlist() get a list of available servers
remote_peek( serverid, retvar) check for reply string
remote_read( serverid) read reply string
server2client( serverid, string) send reply string
remote_foreground( server) bring server to the front
See also the explanation of |CTRL-\_CTRL-N|. Very useful as a leading key
sequence.
The {serverid} for server2client() can be obtained with expand("<client>")
==============================================================================
2. X11 specific items *x11-clientserver*
*E247* *E248* *E251* *E258* *E277*
The communication between client and server goes through the X server. The
display of the Vim server must be specified. The usual protection of the X
server is used, you must be able to open a window on the X server for the
communication to work. It is possible to communicate between different
systems.
By default, a GUI Vim will register a name on the X-server by which it can be
addressed for subsequent execution of injected strings. Vim can also act as
a client and send strings to other instances of Vim on the same X11 display.
When an X11 GUI Vim (gvim) is started, it will try to register a send-server
name on the 'VimRegistry' property on the root window.
A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can
also act as a command server if a server name is explicitly given with the
--servername argument.
An empty --servername argument will cause the command server to be disabled.
To send commands to a Vim server from another application, read the source
file src/if_xcmdsrv.c, it contains some hints about the protocol used.
==============================================================================
3. Win32 specific items *w32-clientserver*
Every Win32 Vim can work as a server, also in the console. You do not need a
version compiled with OLE. Windows messages are used, this works on any
version of MS-Windows. But only communication within one system is possible.
Since MS-Windows messages are used, any other application should be able to
communicate with a Vim server. An alternative is using the OLE functionality
|ole-interface|.
When using gvim, the --remote-wait only works properly this way: >
start /w gvim --remote-wait file.txt
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

View file

@ -1,683 +0,0 @@
*repeat.txt* For Vim version 7.4. Last change: 2013 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
Repeating commands, Vim scripts and debugging *repeating*
Chapter 26 of the user manual introduces repeating |usr_26.txt|.
1. Single repeats |single-repeat|
2. Multiple repeats |multi-repeat|
3. Complex repeats |complex-repeat|
4. Using Vim scripts |using-scripts|
5. Debugging scripts |debug-scripts|
6. Profiling |profiling|
==============================================================================
1. Single repeats *single-repeat*
*.*
. Repeat last change, with count replaced with [count].
Also repeat a yank command, when the 'y' flag is
included in 'cpoptions'. Does not repeat a
command-line command.
Simple changes can be repeated with the "." command. Without a count, the
count of the last change is used. If you enter a count, it will replace the
last one. If the last change included a specification of a numbered register,
the register number will be incremented. See |redo-register| for an example
how to use this. Note that when repeating a command that used a Visual
selection, the same SIZE of area is used, see |visual-repeat|.
*@:*
@: Repeat last command-line [count] times.
{not available when compiled without the
|+cmdline_hist| feature}
==============================================================================
2. Multiple repeats *multi-repeat*
*:g* *:global* *E147* *E148*
:[range]g[lobal]/{pattern}/[cmd]
Execute the Ex command [cmd] (default ":p") on the
lines within [range] where {pattern} matches.
:[range]g[lobal]!/{pattern}/[cmd]
Execute the Ex command [cmd] (default ":p") on the
lines within [range] where {pattern} does NOT match.
*:v* *:vglobal*
:[range]v[global]/{pattern}/[cmd]
Same as :g!.
Instead of the '/' which surrounds the {pattern}, you can use any other
single byte character, but not an alphabetic character, '\', '"' or '|'.
This is useful if you want to include a '/' in the search pattern or
replacement string.
For the definition of a pattern, see |pattern|.
The global commands work by first scanning through the [range] lines and
marking each line where a match occurs (for a multi-line pattern, only the
start of the match matters).
In a second scan the [cmd] is executed for each marked line with its line
number prepended. For ":v" and ":g!" the command is executed for each not
marked line. If a line is deleted its mark disappears.
The default for [range] is the whole buffer (1,$). Use "CTRL-C" to interrupt
the command. If an error message is given for a line, the command for that
line is aborted and the global command continues with the next marked or
unmarked line.
To repeat a non-Ex command, you can use the ":normal" command: >
:g/pat/normal {commands}
Make sure that {commands} ends with a whole command, otherwise Vim will wait
for you to type the rest of the command for each match. The screen will not
have been updated, so you don't know what you are doing. See |:normal|.
The undo/redo command will undo/redo the whole global command at once.
The previous context mark will only be set once (with "''" you go back to
where the cursor was before the global command).
The global command sets both the last used search pattern and the last used
substitute pattern (this is vi compatible). This makes it easy to globally
replace a string:
:g/pat/s//PAT/g
This replaces all occurrences of "pat" with "PAT". The same can be done with:
:%s/pat/PAT/g
Which is two characters shorter!
When using "global" in Ex mode, a special case is using ":visual" as a
command. This will move to a matching line, go to Normal mode to let you
execute commands there until you use |Q| to return to Ex mode. This will be
repeated for each matching line. While doing this you cannot use ":global".
To abort this type CTRL-C twice.
==============================================================================
3. Complex repeats *complex-repeat*
*q* *recording*
q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
(uppercase to append). The 'q' command is disabled
while executing a register, and it doesn't work inside
a mapping and |:normal|. {Vi: no recording}
q Stops recording. (Implementation note: The 'q' that
stops recording is not stored in the register, unless
it was the result of a mapping) {Vi: no recording}
*@*
@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} [count]
times. Note that register '%' (name of the current
file) and '#' (name of the alternate file) cannot be
used.
The register is executed like a mapping, that means
that the difference between 'wildchar' and 'wildcharm'
applies.
For "@=" you are prompted to enter an expression. The
result of the expression is then executed.
See also |@:|. {Vi: only named registers}
*@@* *E748*
@@ Repeat the previous @{0-9a-z":*} [count] times.
:[addr]*{0-9a-z".=+} *:@* *:star*
:[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex
command. First set cursor at line [addr] (default is
current line). When the last line in the register does
not have a <CR> it will be added automatically when
the 'e' flag is present in 'cpoptions'.
Note that the ":*" command is only recognized when the
'*' flag is present in 'cpoptions'. This is NOT the
default when 'nocompatible' is used.
For ":@=" the last used expression is used. The
result of evaluating the expression is executed as an
Ex command.
Mappings are not recognized in these commands.
{Vi: only in some versions} Future: Will execute the
register for each line in the address range.
*:@:*
:[addr]@: Repeat last command-line. First set cursor at line
[addr] (default is current line). {not in Vi}
*:@@*
:[addr]@@ Repeat the previous :@{0-9a-z"}. First set cursor at
line [addr] (default is current line). {Vi: only in
some versions}
==============================================================================
4. Using Vim scripts *using-scripts*
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script*
:so[urce] {file} Read Ex commands from {file}. These are commands that
start with a ":".
Triggers the |SourcePre| autocommand.
:so[urce]! {file} Read Vim commands from {file}. These are commands
that are executed from Normal mode, like you type
them.
When used after |:global|, |:argdo|, |:windo|,
|:bufdo|, in a loop or when another command follows
the display won't be updated while executing the
commands.
{not in Vi}
*:ru* *:runtime*
:ru[ntime][!] {file} ..
Read Ex commands from {file} in each directory given
by 'runtimepath'. There is no error for non-existing
files. Example: >
:runtime syntax/c.vim
< There can be multiple {file} arguments, separated by
spaces. Each {file} is searched for in the first
directory from 'runtimepath', then in the second
directory, etc. Use a backslash to include a space
inside {file} (although it's better not to use spaces
in file names, it causes trouble).
When [!] is included, all found files are sourced.
When it is not included only the first found file is
sourced.
When {file} contains wildcards it is expanded to all
matching files. Example: >
:runtime! plugin/*.vim
< This is what Vim uses to load the plugin files when
starting up. This similar command: >
:runtime plugin/*.vim
< would source the first file only.
When 'verbose' is one or higher, there is a message
when no file could be found.
When 'verbose' is two or higher, there is a message
about each searched file.
{not in Vi}
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
Specify the character encoding used in the script.
The following lines will be converted from [encoding]
to the value of the 'encoding' option, if they are
different. Examples: >
scriptencoding iso-8859-5
scriptencoding cp932
<
When [encoding] is empty, no conversion is done. This
can be used to restrict conversion to a sequence of
lines: >
scriptencoding euc-jp
... lines to be converted ...
scriptencoding
... not converted ...
< When conversion isn't supported by the system, there
is no error message and no conversion is done.
Don't use "ucs-2" or "ucs-4", scripts cannot be in
these encodings (they would contain NUL bytes).
When a sourced script starts with a BOM (Byte Order
Mark) in utf-8 format Vim will recognize it, no need
to use ":scriptencoding utf-8" then.
When compiled without the |+multi_byte| feature this
command is ignored.
{not in Vi}
*:scrip* *:scriptnames*
:scrip[tnames] List all sourced script names, in the order they were
first sourced. The number is used for the script ID
|<SID>|.
{not in Vi} {not available when compiled without the
|+eval| feature}
*:fini* *:finish* *E168*
:fini[sh] Stop sourcing a script. Can only be used in a Vim
script file. This is a quick way to skip the rest of
the file. If it is used after a |:try| but before the
matching |:finally| (if present), the commands
following the ":finally" up to the matching |:endtry|
are executed first. This process applies to all
nested ":try"s in the script. The outermost ":endtry"
then stops sourcing the script. {not in Vi}
All commands and command sequences can be repeated by putting them in a named
register and then executing it. There are two ways to get the commands in the
register:
- Use the record command "q". You type the commands once, and while they are
being executed they are stored in a register. Easy, because you can see
what you are doing. If you make a mistake, "p"ut the register into the
file, edit the command sequence, and then delete it into the register
again. You can continue recording by appending to the register (use an
uppercase letter).
- Delete or yank the command sequence into the register.
Often used command sequences can be put under a function key with the ':map'
command.
An alternative is to put the commands in a file, and execute them with the
':source!' command. Useful for long command sequences. Can be combined with
the ':map' command to put complicated commands under a function key.
The ':source' command reads Ex commands from a file line by line. You will
have to type any needed keyboard input. The ':source!' command reads from a
script file character by character, interpreting each character as if you
typed it.
Example: When you give the ":!ls" command you get the |hit-enter| prompt. If
you ':source' a file with the line "!ls" in it, you will have to type the
<Enter> yourself. But if you ':source!' a file with the line ":!ls" in it,
the next characters from that file are read until a <CR> is found. You will
not have to type <CR> yourself, unless ":!ls" was the last line in the file.
It is possible to put ':source[!]' commands in the script file, so you can
make a top-down hierarchy of script files. The ':source' command can be
nested as deep as the number of files that can be opened at one time (about
15). The ':source!' command can be nested up to 15 levels deep.
You can use the "<sfile>" string (literally, this is not a special key) inside
of the sourced file, in places where a file name is expected. It will be
replaced by the file name of the sourced file. For example, if you have a
"other.vimrc" file in the same directory as your ".vimrc" file, you can source
it from your ".vimrc" file with this command: >
:source <sfile>:h/other.vimrc
In script files terminal-dependent key codes are represented by
terminal-independent two character codes. This means that they can be used
in the same way on different kinds of terminals. The first character of a
key code is 0x80 or 128, shown on the screen as "~@". The second one can be
found in the list |key-notation|. Any of these codes can also be entered
with CTRL-V followed by the three digit decimal code. This does NOT work for
the <t_xx> termcap codes, these can only be used in mappings.
*:source_crnl* *W15*
MS-DOS, Win32 and OS/2: Files that are read with ":source" normally have
<CR><NL> <EOL>s. These always work. If you are using a file with <NL> <EOL>s
(for example, a file made on Unix), this will be recognized if 'fileformats'
is not empty and the first line does not end in a <CR>. This fails if the
first line has something like ":map <F1> :help^M", where "^M" is a <CR>. If
the first line ends in a <CR>, but following ones don't, you will get an error
message, because the <CR> from the first lines will be lost.
Mac Classic: Files that are read with ":source" normally have <CR> <EOL>s.
These always work. If you are using a file with <NL> <EOL>s (for example, a
file made on Unix), this will be recognized if 'fileformats' is not empty and
the first line does not end in a <CR>. Be careful not to use a file with <NL>
linebreaks which has a <CR> in first line.
On other systems, Vim expects ":source"ed files to end in a <NL>. These
always work. If you are using a file with <CR><NL> <EOL>s (for example, a
file made on MS-DOS), all lines will have a trailing <CR>. This may cause
problems for some commands (e.g., mappings). There is no automatic <EOL>
detection, because it's common to start with a line that defines a mapping
that ends in a <CR>, which will confuse the automaton.
*line-continuation*
Long lines in a ":source"d Ex command script file can be split by inserting
a line continuation symbol "\" (backslash) at the start of the next line.
There can be white space before the backslash, which is ignored.
Example: the lines >
:set comments=sr:/*,mb:*,el:*/,
\://,
\b:#,
\:%,
\n:>,
\fb:-
are interpreted as if they were given in one line:
:set comments=sr:/*,mb:*,el:*/,://,b:#,:%,n:>,fb:-
All leading whitespace characters in the line before a backslash are ignored.
Note however that trailing whitespace in the line before it cannot be
inserted freely; it depends on the position where a command is split up
whether additional whitespace is allowed or not.
When a space is required it's best to put it right after the backslash. A
space at the end of a line is hard to see and may be accidentally deleted. >
:syn match Comment
\ "very long regexp"
\ keepend
There is a problem with the ":append" and ":insert" commands: >
:1append
\asdf
.
The backslash is seen as a line-continuation symbol, thus this results in the
command: >
:1appendasdf
.
To avoid this, add the 'C' flag to the 'cpoptions' option: >
:set cpo+=C
:1append
\asdf
.
:set cpo-=C
Note that when the commands are inside a function, you need to add the 'C'
flag when defining the function, it is not relevant when executing it. >
:set cpo+=C
:function Foo()
:1append
\asdf
.
:endfunction
:set cpo-=C
Rationale:
Most programs work with a trailing backslash to indicate line
continuation. Using this in Vim would cause incompatibility with Vi.
For example for this Vi mapping: >
:map xx asdf\
< Therefore the unusual leading backslash is used.
==============================================================================
5. Debugging scripts *debug-scripts*
Besides the obvious messages that you can add to your scripts to find out what
they are doing, Vim offers a debug mode. This allows you to step through a
sourced file or user function and set breakpoints.
NOTE: The debugging mode is far from perfect. Debugging will have side
effects on how Vim works. You cannot use it to debug everything. For
example, the display is messed up by the debugging messages.
{Vi does not have a debug mode}
An alternative to debug mode is setting the 'verbose' option. With a bigger
number it will give more verbose messages about what Vim is doing.
STARTING DEBUG MODE *debug-mode*
To enter debugging mode use one of these methods:
1. Start Vim with the |-D| argument: >
vim -D file.txt
< Debugging will start as soon as the first vimrc file is sourced. This is
useful to find out what is happening when Vim is starting up. A side
effect is that Vim will switch the terminal mode before initialisations
have finished, with unpredictable results.
For a GUI-only version (Windows, Macintosh) the debugging will start as
soon as the GUI window has been opened. To make this happen early, add a
":gui" command in the vimrc file.
*:debug*
2. Run a command with ":debug" prepended. Debugging will only be done while
this command executes. Useful for debugging a specific script or user
function. And for scripts and functions used by autocommands. Example: >
:debug edit test.txt.gz
3. Set a breakpoint in a sourced file or user function. You could do this in
the command line: >
vim -c "breakadd file */explorer.vim" .
< This will run Vim and stop in the first line of the "explorer.vim" script.
Breakpoints can also be set while in debugging mode.
In debugging mode every executed command is displayed before it is executed.
Comment lines, empty lines and lines that are not executed are skipped. When
a line contains two commands, separated by "|", each command will be displayed
separately.
DEBUG MODE
Once in debugging mode, the usual Ex commands can be used. For example, to
inspect the value of a variable: >
echo idx
When inside a user function, this will print the value of the local variable
"idx". Prepend "g:" to get the value of a global variable: >
echo g:idx
All commands are executed in the context of the current function or script.
You can also set options, for example setting or resetting 'verbose' will show
what happens, but you might want to set it just before executing the lines you
are interested in: >
:set verbose=20
Commands that require updating the screen should be avoided, because their
effect won't be noticed until after leaving debug mode. For example: >
:help
won't be very helpful.
There is a separate command-line history for debug mode.
The line number for a function line is relative to the start of the function.
If you have trouble figuring out where you are, edit the file that defines
the function in another Vim, search for the start of the function and do
"99j". Replace "99" with the line number.
Additionally, these commands can be used:
*>cont*
cont Continue execution until the next breakpoint is hit.
*>quit*
quit Abort execution. This is like using CTRL-C, some
things might still be executed, doesn't abort
everything. Still stops at the next breakpoint.
*>next*
next Execute the command and come back to debug mode when
it's finished. This steps over user function calls
and sourced files.
*>step*
step Execute the command and come back to debug mode for
the next command. This steps into called user
functions and sourced files.
*>interrupt*
interrupt This is like using CTRL-C, but unlike ">quit" comes
back to debug mode for the next command that is
executed. Useful for testing |:finally| and |:catch|
on interrupt exceptions.
*>finish*
finish Finish the current script or user function and come
back to debug mode for the command after the one that
sourced or called it.
About the additional commands in debug mode:
- There is no command-line completion for them, you get the completion for the
normal Ex commands only.
- You can shorten them, up to a single character: "c", "n", "s" and "f".
- Hitting <CR> will repeat the previous one. When doing another command, this
is reset (because it's not clear what you want to repeat).
- When you want to use the Ex command with the same name, prepend a colon:
":cont", ":next", ":finish" (or shorter).
DEFINING BREAKPOINTS
*:breaka* *:breakadd*
:breaka[dd] func [lnum] {name}
Set a breakpoint in a function. Example: >
:breakadd func Explore
< Doesn't check for a valid function name, thus the breakpoint
can be set before the function is defined.
:breaka[dd] file [lnum] {name}
Set a breakpoint in a sourced file. Example: >
:breakadd file 43 .vimrc
:breaka[dd] here
Set a breakpoint in the current line of the current file.
Like doing: >
:breakadd file <cursor-line> <current-file>
< Note that this only works for commands that are executed when
sourcing the file, not for a function defined in that file.
The [lnum] is the line number of the breakpoint. Vim will stop at or after
this line. When omitted line 1 is used.
*:debug-name*
{name} is a pattern that is matched with the file or function name. The
pattern is like what is used for autocommands. There must be a full match (as
if the pattern starts with "^" and ends in "$"). A "*" matches any sequence
of characters. 'ignorecase' is not used, but "\c" can be used in the pattern
to ignore case |/\c|. Don't include the () for the function name!
The match for sourced scripts is done against the full file name. If no path
is specified the current directory is used. Examples: >
breakadd file explorer.vim
matches "explorer.vim" in the current directory. >
breakadd file *explorer.vim
matches ".../plugin/explorer.vim", ".../plugin/iexplorer.vim", etc. >
breakadd file */explorer.vim
matches ".../plugin/explorer.vim" and "explorer.vim" in any other directory.
The match for functions is done against the name as it's shown in the output
of ":function". For local functions this means that something like "<SNR>99_"
is prepended.
Note that functions are first loaded and later executed. When they are loaded
the "file" breakpoints are checked, when they are executed the "func"
breakpoints.
DELETING BREAKPOINTS
*:breakd* *:breakdel* *E161*
:breakd[el] {nr}
Delete breakpoint {nr}. Use |:breaklist| to see the number of
each breakpoint.
:breakd[el] *
Delete all breakpoints.
:breakd[el] func [lnum] {name}
Delete a breakpoint in a function.
:breakd[el] file [lnum] {name}
Delete a breakpoint in a sourced file.
:breakd[el] here
Delete a breakpoint at the current line of the current file.
When [lnum] is omitted, the first breakpoint in the function or file is
deleted.
The {name} must be exactly the same as what was typed for the ":breakadd"
command. "explorer", "*explorer.vim" and "*explorer*" are different.
LISTING BREAKPOINTS
*:breakl* *:breaklist*
:breakl[ist]
List all breakpoints.
OBSCURE
*:debugg* *:debuggreedy*
:debugg[reedy]
Read debug mode commands from the normal input stream, instead
of getting them directly from the user. Only useful for test
scripts. Example: >
echo 'q^Mq' | vim -e -s -c debuggreedy -c 'breakadd file script.vim' -S script.vim
:0debugg[reedy]
Undo ":debuggreedy": get debug mode commands directly from the
user, don't use typeahead for debug commands.
==============================================================================
6. Profiling *profile* *profiling*
Profiling means that Vim measures the time that is spent on executing
functions and/or scripts. The |+profile| feature is required for this.
It is only included when Vim was compiled with "huge" features.
{Vi does not have profiling}
You can also use the |reltime()| function to measure time. This only requires
the |+reltime| feature, which is present more often.
For profiling syntax highlighting see |:syntime|.
:prof[ile] start {fname} *:prof* *:profile* *E750*
Start profiling, write the output in {fname} upon exit.
If {fname} already exists it will be silently overwritten.
The variable |v:profiling| is set to one.
:prof[ile] pause
Don't profile until the following ":profile continue". Can be
used when doing something that should not be counted (e.g., an
external command). Does not nest.
:prof[ile] continue
Continue profiling after ":profile pause".
:prof[ile] func {pattern}
Profile function that matches the pattern {pattern}.
See |:debug-name| for how {pattern} is used.
:prof[ile][!] file {pattern}
Profile script file that matches the pattern {pattern}.
See |:debug-name| for how {pattern} is used.
This only profiles the script itself, not the functions
defined in it.
When the [!] is added then all functions defined in the script
will also be profiled. But only if the script is loaded after
this command.
:profd[el] ... *:profd* *:profdel*
Stop profiling for the arguments specified. See |:breakdel|
for the arguments.
You must always start with a ":profile start fname" command. The resulting
file is written when Vim exits. Here is an example of the output, with line
numbers prepended for the explanation:
1 FUNCTION Test2() ~
2 Called 1 time ~
3 Total time: 0.155251 ~
4 Self time: 0.002006 ~
5 ~
6 count total (s) self (s) ~
7 9 0.000096 for i in range(8) ~
8 8 0.153655 0.000410 call Test3() ~
9 8 0.000070 endfor ~
10 " Ask a question ~
11 1 0.001341 echo input("give me an answer: ") ~
The header (lines 1-4) gives the time for the whole function. The "Total"
time is the time passed while the function was executing. The "Self" time is
the "Total" time reduced by time spent in:
- other user defined functions
- sourced scripts
- executed autocommands
- external (shell) commands
Lines 7-11 show the time spent in each executed line. Lines that are not
executed do not count. Thus a comment line is never counted.
The Count column shows how many times a line was executed. Note that the
"for" command in line 7 is executed one more time as the following lines.
That is because the line is also executed to detect the end of the loop.
The time Vim spends waiting for user input isn't counted at all. Thus how
long you take to respond to the input() prompt is irrelevant.
Profiling should give a good indication of where time is spent, but keep in
mind there are various things that may clobber the results:
- The accuracy of the time measured depends on the gettimeofday() system
function. It may only be as accurate as 1/100 second, even though the times
are displayed in micro seconds.
- Real elapsed time is measured, if other processes are busy they may cause
delays at unpredictable moments. You may want to run the profiling several
times and use the lowest results.
- If you have several commands in one line you only get one time. Split the
line to see the time for the individual commands.
- The time of the lines added up is mostly less than the time of the whole
function. There is some overhead in between.
- Functions that are deleted before Vim exits will not produce profiling
information. You can check the |v:profiling| variable if needed: >
:if !v:profiling
: delfunc MyFunc
:endif
<
- Profiling may give weird results on multi-processor systems, when sleep
mode kicks in or the processor frequency is reduced to save power.
- The "self" time is wrong when a function is used recursively.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,124 +0,0 @@
*rileft.txt* For Vim version 7.4. Last change: 2006 Apr 24
VIM REFERENCE MANUAL by Avner Lottem
updated by Nadim Shaikli
Right to Left display mode for Vim *rileft*
These functions were originally created by Avner Lottem:
E-mail: alottem@iil.intel.com
Phone: +972-4-8307322
{Vi does not have any of these commands}
*E26*
{only available when compiled with the |+rightleft| feature}
Introduction
------------
Some languages such as Arabic, Farsi, Hebrew (among others) require the
ability to display their text from right-to-left. Files in those languages
are stored conventionally and the right-to-left requirement is only a
function of the display engine (per the Unicode specification). In
right-to-left oriented files the characters appear on the screen from
right to left.
Bidirectionality (or bidi for short) is what Unicode offers as a full
solution to these languages. Bidi offers the user the ability to view
both right-to-left as well as left-to-right text properly at the same time
within the same window. Vim currently, due to simplicity, does not offer
bidi and is merely opting to present a functional means to display/enter/use
right-to-left languages. An older hybrid solution in which direction is
encoded for every character (or group of characters) are not supported either
as this kind of support is out of the scope of a simple addition to an
existing editor (and it's not sanctioned by Unicode either).
Highlights
----------
o Editing left-to-right files as in the original Vim, no change.
o Viewing and editing files in right-to-left windows. File orientation
is per window, so it is possible to view the same file in right-to-left
and left-to-right modes, simultaneously. (Useful for editing mixed files
in which both right-to-left and left-to-right text exist).
o Compatibility to the original Vim. Almost all features work in
right-to-left mode (see Bugs below).
o Backing from reverse insert mode to the correct place in the file
(if possible).
o No special terminal with right-to-left capabilities is required. The
right-to-left changes are completely hardware independent.
o Many languages use and require right-to-left support. These languages
can quite easily be supported given the inclusion of their required
keyboard mappings and some possible minor code change. Some of the
current supported languages include - |arabic.txt|, |farsi.txt| and
|hebrew.txt|.
Of Interest...
--------------
o Invocations
-----------
+ 'rightleft' ('rl') sets window orientation to right-to-left.
+ 'delcombine' ('deco'), boolean, if editing UTF-8 encoded languages,
allows one to remove a composing character which gets superimposed
on those that proceeded them (some languages require this).
+ 'rightleftcmd' ('rlc') sets the command-line within certain modes
(such as search) to be utilized in right-to-left orientation as well.
o Typing backwards *ins-reverse*
----------------
In lieu of using full-fledged the 'rightleft' option, one can opt for
reverse insertion. When the 'revins' (reverse insert) option is set,
inserting happens backwards. This can be used to type right-to-left
text. When inserting characters the cursor is not moved and the text
moves rightwards. A <BS> deletes the character under the cursor.
CTRL-W and CTRL-U also work in the opposite direction. <BS>, CTRL-W
and CTRL-U do not stop at the start of insert or end of line, no matter
how the 'backspace' option is set.
There is no reverse replace mode (yet).
If the 'showmode' option is set, "-- REVERSE INSERT --" will be shown
in the status line when reverse Insert mode is active.
o Pasting when in a rightleft window
----------------------------------
When cutting text with the mouse and pasting it in a rightleft window
the text will be reversed, because the characters come from the cut buffer
from the left to the right, while inserted in the file from the right to
the left. In order to avoid it, toggle 'revins' before pasting.
Bugs
----
o Does not handle CTRL-A and CTRL-X commands (add and subtract) correctly
when in rightleft window.
o Does not support reverse insert and rightleft modes on the command-line.
However, functionality of the editor is not reduced, because it is
possible to enter mappings, abbreviations and searches typed from the
left to the right on the command-line.
o Somewhat slower in right-to-left mode, because right-to-left motion is
emulated inside Vim, not by the controlling terminal.
o When the Athena GUI is used, the bottom scrollbar works in the wrong
direction. This is difficult to fix.
o When both 'rightleft' and 'revins' are on: 'textwidth' does not work.
Lines do not wrap at all; you just get a single, long line.
o There is no full bidirectionality (bidi) support.
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,74 +0,0 @@
*russian.txt* For Vim version 7.4. Last change: 2006 Apr 24
VIM REFERENCE MANUAL by Vassily Ragosin
Russian language localization and support in Vim *russian* *Russian*
1. Introduction |russian-intro|
2. Russian keymaps |russian-keymap|
3. Localization |russian-l18n|
4. Known issues |russian-issues|
===============================================================================
1. Introduction *russian-intro*
Russian language is supported perfectly well in Vim. You can type and view
Russian text just as any other, without the need to tweak the settings.
===============================================================================
2. Russian keymaps *russian-keymap*
To switch between languages you can use your system native keyboard switcher,
or use one of the Russian keymaps, included in the Vim distribution. For
example,
>
:set keymap=russian-jcukenwin
<
In the latter case, you can switch between languages even if you do not have
system Russian keyboard or independently from a system-wide keyboard settings.
See 'keymap'. You can also map a key to switch between keyboards, if you
choose the latter option. See |:map|.
For your convenience, to avoid switching between keyboards, when you need to
enter Normal mode command, you can also set 'langmap' option:
>
:set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,
фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz
This is in utf-8, you cannot read this if your 'encoding' is not utf-8.
You have to type this command in one line, it is wrapped for the sake of
readability.
===============================================================================
3. Localization *russian-l18n*
If you wish to use messages, help files, menus and other items translated to
Russian, you will need to install the RuVim Language Pack, available in
different codepages from
http://www.sourceforge.net/projects/ruvim/
Make sure that your Vim is at least 6.2.506 and use ruvim 0.5 or later for
automatic installs. Vim also needs to be compiled with |+gettext| feature for
user interface items translations to work.
After downloading an archive from RuVim project, unpack it into your
$VIMRUNTIME directory. We recommend using UTF-8 archive, if your version of
Vim is compiled with |+multi_byte| feature enabled.
In order to use the Russian documentation, make sure you have set the
'helplang' option to "ru".
===============================================================================
4. Known issues *russian-issues*
-- If you are using Russian message translations in Win32 console, then
you may see the output produced by "vim --help", "vim --version" commands
and Win32 console window title appearing in a wrong codepage. This problem
is related to a bug in GNU gettext library and may be fixed in the future
releases of gettext.
===============================================================================
vim:tw=78:ts=8:ft=help:norl:

View file

@ -1,332 +0,0 @@
*scroll.txt* For Vim version 7.4. Last change: 2006 Aug 27
VIM REFERENCE MANUAL by Bram Moolenaar
Scrolling *scrolling*
These commands move the contents of the window. If the cursor position is
moved off of the window, the cursor is moved onto the window (with
'scrolloff' screen lines around it). A page is the number of lines in the
window minus two. The mnemonics for these commands may be a bit confusing.
Remember that the commands refer to moving the window (the part of the buffer
that you see) upwards or downwards in the buffer. When the window moves
upwards in the buffer, the text in the window moves downwards on your screen.
See section |03.7| of the user manual for an introduction.
1. Scrolling downwards |scroll-down|
2. Scrolling upwards |scroll-up|
3. Scrolling relative to cursor |scroll-cursor|
4. Scrolling horizontally |scroll-horizontal|
5. Scrolling synchronously |scroll-binding|
6. Scrolling with a mouse wheel |scroll-mouse-wheel|
==============================================================================
1. Scrolling downwards *scroll-down*
The following commands move the edit window (the part of the buffer that you
see) downwards (this means that more lines downwards in the text buffer can be
seen):
*CTRL-E*
CTRL-E Scroll window [count] lines downwards in the buffer.
Mnemonic: Extra lines.
*CTRL-D*
CTRL-D Scroll window Downwards in the buffer. The number of
lines comes from the 'scroll' option (default: half a
screen). If [count] given, first set 'scroll' option
to [count]. The cursor is moved the same number of
lines down in the file (if possible; when lines wrap
and when hitting the end of the file there may be a
difference). When the cursor is on the last line of
the buffer nothing happens and a beep is produced.
See also 'startofline' option.
{difference from vi: Vim scrolls 'scroll' screen
lines, instead of file lines; makes a difference when
lines wrap}
<S-Down> or *<S-Down>* *<kPageDown>*
<PageDown> or *<PageDown>* *CTRL-F*
CTRL-F Scroll window [count] pages Forwards (downwards) in
the buffer. See also 'startofline' option.
When there is only one window the 'window' option
might be used.
*z+*
z+ Without [count]: Redraw with the line just below the
window at the top of the window. Put the cursor in
that line, at the first non-blank in the line.
With [count]: just like "z<CR>".
==============================================================================
2. Scrolling upwards *scroll-up*
The following commands move the edit window (the part of the buffer that you
see) upwards (this means that more lines upwards in the text buffer can be
seen):
*CTRL-Y*
CTRL-Y Scroll window [count] lines upwards in the buffer.
Note: When using the MS-Windows key bindings CTRL-Y is
remapped to redo.
*CTRL-U*
CTRL-U Scroll window Upwards in the buffer. The number of
lines comes from the 'scroll' option (default: half a
screen). If [count] given, first set the 'scroll'
option to [count]. The cursor is moved the same
number of lines up in the file (if possible; when
lines wrap and when hitting the end of the file there
may be a difference). When the cursor is on the first
line of the buffer nothing happens and a beep is
produced. See also 'startofline' option.
{difference from vi: Vim scrolls 'scroll' screen
lines, instead of file lines; makes a difference when
lines wrap}
<S-Up> or *<S-Up>* *<kPageUp>*
<PageUp> or *<PageUp>* *CTRL-B*
CTRL-B Scroll window [count] pages Backwards (upwards) in the
buffer. See also 'startofline' option.
When there is only one window the 'window' option
might be used.
*z^*
z^ Without [count]: Redraw with the line just above the
window at the bottom of the window. Put the cursor in
that line, at the first non-blank in the line.
With [count]: First scroll the text to put the [count]
line at the bottom of the window, then redraw with the
line which is now at the top of the window at the
bottom of the window. Put the cursor in that line, at
the first non-blank in the line.
==============================================================================
3. Scrolling relative to cursor *scroll-cursor*
The following commands reposition the edit window (the part of the buffer that
you see) while keeping the cursor on the same line:
*z<CR>*
z<CR> Redraw, line [count] at top of window (default
cursor line). Put cursor at first non-blank in the
line.
*zt*
zt Like "z<CR>", but leave the cursor in the same
column. {not in Vi}
*zN<CR>*
z{height}<CR> Redraw, make window {height} lines tall. This is
useful to make the number of lines small when screen
updating is very slow. Cannot make the height more
than the physical screen height.
*z.*
z. Redraw, line [count] at center of window (default
cursor line). Put cursor at first non-blank in the
line.
*zz*
zz Like "z.", but leave the cursor in the same column.
Careful: If caps-lock is on, this command becomes
"ZZ": write buffer and exit! {not in Vi}
*z-*
z- Redraw, line [count] at bottom of window (default
cursor line). Put cursor at first non-blank in the
line.
*zb*
zb Like "z-", but leave the cursor in the same column.
{not in Vi}
==============================================================================
4. Scrolling horizontally *scroll-horizontal*
For the following four commands the cursor follows the screen. If the
character that the cursor is on is moved off the screen, the cursor is moved
to the closest character that is on the screen. The value of 'sidescroll' is
not used.
z<Right> or *zl* *z<Right>*
zl Move the view on the text [count] characters to the
right, thus scroll the text [count] characters to the
left. This only works when 'wrap' is off. {not in
Vi}
z<Left> or *zh* *z<Left>*
zh Move the view on the text [count] characters to the
left, thus scroll the text [count] characters to the
right. This only works when 'wrap' is off. {not in
Vi}
*zL*
zL Move the view on the text half a screenwidth to the
right, thus scroll the text half a screenwidth to the
left. This only works when 'wrap' is off. {not in
Vi}
*zH*
zH Move the view on the text half a screenwidth to the
left, thus scroll the text half a screenwidth to the
right. This only works when 'wrap' is off. {not in
Vi}
For the following two commands the cursor is not moved in the text, only the
text scrolls on the screen.
*zs*
zs Scroll the text horizontally to position the cursor
at the start (left side) of the screen. This only
works when 'wrap' is off. {not in Vi}
*ze*
ze Scroll the text horizontally to position the cursor
at the end (right side) of the screen. This only
works when 'wrap' is off. {not in Vi}
==============================================================================
5. Scrolling synchronously *scroll-binding*
Occasionally, it is desirable to bind two or more windows together such that
when one window is scrolled, the other windows are also scrolled. In Vim,
windows can be given this behavior by setting the (window-specific)
'scrollbind' option. When a window that has 'scrollbind' set is scrolled, all
other 'scrollbind' windows are scrolled the same amount, if possible. The
behavior of 'scrollbind' can be modified by the 'scrollopt' option.
When using the scrollbars, the binding only happens when scrolling the window
with focus (where the cursor is). You can use this to avoid scroll-binding
for a moment without resetting options.
When a window also has the 'diff' option set, the scroll-binding uses the
differences between the two buffers to synchronize the position precisely.
Otherwise the following method is used.
*scrollbind-relative*
Each 'scrollbind' window keeps track of its "relative offset," which can be
thought of as the difference between the current window's vertical scroll
position and the other window's vertical scroll position. When one of the
'scrollbind' windows is asked to vertically scroll past the beginning or end
limit of its text, the window no longer scrolls, but remembers how far past
the limit it wishes to be. The window keeps this information so that it can
maintain the same relative offset, regardless of its being asked to scroll
past its buffer's limits.
However, if a 'scrollbind' window that has a relative offset that is past its
buffer's limits is given the cursor focus, the other 'scrollbind' windows must
jump to a location where the current window's relative offset is valid. This
behavior can be changed by clearing the 'jump' flag from the 'scrollopt'
option.
*syncbind* *:syncbind* *:sync*
:syncbind Force all 'scrollbind' windows to have the same
relative offset. I.e., when any of the 'scrollbind'
windows is scrolled to the top of its buffer, all of
the 'scrollbind' windows will also be at the top of
their buffers.
*scrollbind-quickadj*
The 'scrollbind' flag is meaningful when using keyboard commands to vertically
scroll a window, and also meaningful when using the vertical scrollbar of the
window which has the cursor focus. However, when using the vertical scrollbar
of a window which doesn't have the cursor focus, 'scrollbind' is ignored.
This allows quick adjustment of the relative offset of 'scrollbind' windows.
==============================================================================
6. Scrolling with a mouse wheel *scroll-mouse-wheel*
When your mouse has a scroll wheel, it should work with Vim in the GUI. How
it works depends on your system. It might also work in an xterm
|xterm-mouse-wheel|. By default only vertical scroll wheels are supported,
but some GUIs also support horizontal scroll wheels.
For the Win32 GUI the scroll action is hard coded. It works just like
dragging the scrollbar of the current window. How many lines are scrolled
depends on your mouse driver. If the scroll action causes input focus
problems, see |intellimouse-wheel-problems|.
For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key
presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and
<ScrollWheelRight>. For example, if you push the scroll wheel upwards a
<ScrollWheelUp> key press is generated causing the window to scroll upwards
(while the text is actually moving downwards). The default action for these
keys are:
<ScrollWheelUp> scroll three lines up *<ScrollWheelUp>*
<S-ScrollWheelUp> scroll one page up *<S-ScrollWheelUp>*
<C-ScrollWheelUp> scroll one page up *<C-ScrollWheelUp>*
<ScrollWheelDown> scroll three lines down *<ScrollWheelDown>*
<S-ScrollWheelDown> scroll one page down *<S-ScrollWheelDown>*
<C-ScrollWheelDown> scroll one page down *<C-ScrollWheelDown>*
<ScrollWheelLeft> scroll six columns left *<ScrollWheelLeft>*
<S-ScrollWheelLeft> scroll one page left *<S-ScrollWheelLeft>*
<C-ScrollWheelLeft> scroll one page left *<C-ScrollWheelLeft>*
<ScrollWheelRight> scroll six columns right *<ScrollWheelRight>*
<S-ScrollWheelRight> scroll one page right *<S-ScrollWheelRight>*
<C-ScrollWheelRight> scroll one page right *<C-ScrollWheelRight>*
This should work in all modes, except when editing the command line.
Note that horizontal scrolling only works if 'nowrap' is set. Also, unless
the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
line if the cursor line is about to be scrolled off the screen (similarly to
how the horizontal scrollbar works).
You can modify the default behavior by mapping the keys. For example, to make
the scroll wheel move one line or half a page in Normal mode: >
:map <ScrollWheelUp> <C-Y>
:map <S-ScrollWheelUp> <C-U>
:map <ScrollWheelDown> <C-E>
:map <S-ScrollWheelDown> <C-D>
You can also use Alt and Ctrl modifiers.
This only works when Vim gets the scroll wheel events, of course. You can
check if this works with the "xev" program.
When using XFree86, the /etc/XF86Config file should have the correct entry for
your mouse. For FreeBSD, this entry works for a Logitech scrollmouse: >
Protocol "MouseMan"
Device "/dev/psm0"
ZAxisMapping 4 5
See the XFree86 documentation for information.
*<MouseDown>* *<MouseUp>*
The keys <MouseDown> and <MouseUp> have been deprecated. Use <ScrollWheelUp>
instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>.
*xterm-mouse-wheel*
To use the mouse wheel in a new xterm you only have to make the scroll wheel
work in your Xserver, as mentioned above.
To use the mouse wheel in an older xterm you must do this:
1. Make it work in your Xserver, as mentioned above.
2. Add translations for the xterm, so that the xterm will pass a scroll event
to Vim as an escape sequence.
3. Add mappings in Vim, to interpret the escape sequences as <ScrollWheelDown>
or <ScrollWheelUp> keys.
You can do the translations by adding this to your ~.Xdefaults file (or other
file where your X resources are kept): >
XTerm*VT100.Translations: #override \n\
s<Btn4Down>: string("0x9b") string("[64~") \n\
s<Btn5Down>: string("0x9b") string("[65~") \n\
<Btn4Down>: string("0x9b") string("[62~") \n\
<Btn5Down>: string("0x9b") string("[63~") \n\
<Btn4Up>: \n\
<Btn5Up>:
Add these mappings to your vimrc file: >
:map <M-Esc>[62~ <ScrollWheelUp>
:map! <M-Esc>[62~ <ScrollWheelUp>
:map <M-Esc>[63~ <ScrollWheelDown>
:map! <M-Esc>[63~ <ScrollWheelDown>
:map <M-Esc>[64~ <S-ScrollWheelUp>
:map! <M-Esc>[64~ <S-ScrollWheelUp>
:map <M-Esc>[65~ <S-ScrollWheelDown>
:map! <M-Esc>[65~ <S-ScrollWheelDown>
<
vim:tw=78:ts=8:ft=help:norl:

Some files were not shown because too many files have changed in this diff Show more