Skip to content

Commit

Permalink
Changed :function endings: :endfun instead of :endf/:endfu
Browse files Browse the repository at this point in the history
Changed :if endings: :endif always, no :end
  • Loading branch information
ZyX-I committed Oct 28, 2012
1 parent 5781f5d commit f147736
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 89 deletions.
6 changes: 3 additions & 3 deletions autoload/sample_vimrc_for_new_users.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fun! FastGlob(glob)
" let exclude = a:exclude_pattern == ''? '' : ' | grep -v -e '.shellescape(a:exclude_pattern) " let exclude = a:exclude_pattern == ''? '' : ' | grep -v -e '.shellescape(a:exclude_pattern)
" let cmd .= exclude " let cmd .= exclude
return system(cmd) return system(cmd)
endf endfun
noremap \go :exec 'e '. fnameescape(tlib#input#List('s','select file', split(FastGlob(input('glob pattern, curr dir:','**/*')),"\n") ))<cr> noremap \go :exec 'e '. fnameescape(tlib#input#List('s','select file', split(FastGlob(input('glob pattern, curr dir:','**/*')),"\n") ))<cr>
" sometimes when using tags the list is too long. filtering it by library or " sometimes when using tags the list is too long. filtering it by library or
Expand All @@ -133,7 +133,7 @@ noremap \go :exec 'e '. fnameescape(tlib#input#List('s','select file', split(Fas
let tag = eval(tlib#input#List('s','select tag', map(taglist(a:regex), 'string([v:val.kind, v:val.filename, v:val.cmd])'))) let tag = eval(tlib#input#List('s','select tag', map(taglist(a:regex), 'string([v:val.kind, v:val.filename, v:val.cmd])')))
exec 'e '.fnameescape(tag[1]) exec 'e '.fnameescape(tag[1])
exec tag[2] exec tag[2]
endf endfun
command!-nargs=1 TJump call SelectTag(<f-args>) command!-nargs=1 TJump call SelectTag(<f-args>)


" }}} " }}}
Expand All @@ -147,7 +147,7 @@ fun! sample_vimrc_for_new_users#Load()
" no code. If this function is called this file is sourced " no code. If this function is called this file is sourced
" As alternative this can be used: " As alternative this can be used:
" runtime autoload/sample_vimrc_for_new_users.vim " runtime autoload/sample_vimrc_for_new_users.vim
endf endfun


" create directory for files before Vim tries writing them: " create directory for files before Vim tries writing them:
augroup CREATE_MISSING_DIR_ON_BUF_WRITE augroup CREATE_MISSING_DIR_ON_BUF_WRITE
Expand Down
4 changes: 2 additions & 2 deletions autoload/scriptmanager.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ fun! scriptmanager#Activate(...) abort
let g:vim_addon_manager=g:vim_script_manager let g:vim_addon_manager=g:vim_script_manager
endif endif
call call(function('vam#ActivateAddons'),a:000) call call(function('vam#ActivateAddons'),a:000)
endf endfun


fun! scriptmanager#DefineAndBind(...) fun! scriptmanager#DefineAndBind(...)
echoe "fix your code!, scriptmanager#DefineAndBind was renamed to vam#DefineAndBind(. Drop this function to find the usage location faster!" echoe "fix your code!, scriptmanager#DefineAndBind was renamed to vam#DefineAndBind(. Drop this function to find the usage location faster!"
return call(function('vam#DefineAndBind'),a:000) return call(function('vam#DefineAndBind'),a:000)
endf endfun


" vim: sts=2 et sw=2 " vim: sts=2 et sw=2
40 changes: 20 additions & 20 deletions autoload/vam.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
" anyway " anyway
fun! vam#DefineAndBind(local,global,default) fun! vam#DefineAndBind(local,global,default)
return 'if !exists('.string(a:global).') | let '.a:global.' = '.a:default.' | endif | let '.a:local.' = '.a:global return 'if !exists('.string(a:global).') | let '.a:global.' = '.a:default.' | endif | let '.a:local.' = '.a:global
endf endfun




" assign g:os " assign g:os
Expand Down Expand Up @@ -90,7 +90,7 @@ fun! vam#VerifyIsJSON(s)
" adds missing addon information to work " adds missing addon information to work
let scalarless_body = substitute(a:s, '\v\"%(\\.|[^"\\])*\"|\''%(\''{2}|[^''])*\''|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') let scalarless_body = substitute(a:s, '\v\"%(\\.|[^"\\])*\"|\''%(\''{2}|[^''])*\''|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g')
return scalarless_body !~# "[^,:{}[\\] \t]" return scalarless_body !~# "[^,:{}[\\] \t]"
endf endfun


" use join so that you can break the dict into multiple lines. This makes " use join so that you can break the dict into multiple lines. This makes
" reading it much easier " reading it much easier
Expand All @@ -114,7 +114,7 @@ fun! vam#ReadAddonInfo(path)
return {} return {}
endif endif


endf endfun


fun! vam#DefaultPluginDirFromName(name) fun! vam#DefaultPluginDirFromName(name)
" this function maps addon names to their storage location. \/: are replaced " this function maps addon names to their storage location. \/: are replaced
Expand All @@ -123,11 +123,11 @@ fun! vam#DefaultPluginDirFromName(name)
endfun endfun
fun! vam#PluginDirFromName(...) fun! vam#PluginDirFromName(...)
return call(s:c.plugin_dir_by_name, a:000, {}) return call(s:c.plugin_dir_by_name, a:000, {})
endf endfun
fun! vam#PluginRuntimePath(name) fun! vam#PluginRuntimePath(name)
let info = vam#AddonInfo(a:name) let info = vam#AddonInfo(a:name)
return vam#PluginDirFromName(a:name).(has_key(info, 'runtimepath') ? '/'.info['runtimepath'] : '') return vam#PluginDirFromName(a:name).(has_key(info, 'runtimepath') ? '/'.info['runtimepath'] : '')
endf endfun


" adding VAM, so that its contained in list passed to :UpdateActivatedAddons " adding VAM, so that its contained in list passed to :UpdateActivatedAddons
if filewritable(vam#PluginDirFromName('vim-addon-manager'))==2 if filewritable(vam#PluginDirFromName('vim-addon-manager'))==2
Expand All @@ -151,15 +151,15 @@ fun! vam#IsPluginInstalled(name)
return isdirectory(d) return isdirectory(d)
\ && (!isdirectory(d.'/archive') \ && (!isdirectory(d.'/archive')
\ || !empty(glob(fnameescape(d).'/archive/*', 1))) \ || !empty(glob(fnameescape(d).'/archive/*', 1)))
endf endfun


" {} if file doesn't exist " {} if file doesn't exist
fun! vam#AddonInfo(name) fun! vam#AddonInfo(name)
let infoFile = vam#AddonInfoFile(a:name) let infoFile = vam#AddonInfoFile(a:name)
return filereadable(infoFile) return filereadable(infoFile)
\ ? vam#ReadAddonInfo(infoFile) \ ? vam#ReadAddonInfo(infoFile)
\ : {} \ : {}
endf endfun




" opts: { " opts: {
Expand Down Expand Up @@ -211,10 +211,10 @@ fun! vam#ActivateRecursively(list_of_names, ...)
\ (' as it was specified by user.'): \ (' as it was specified by user.'):
\ ("\n as it was requested by ". \ ("\n as it was requested by ".
\ join(opts.requested_by, "\n which was requested by ").'.'))) \ join(opts.requested_by, "\n which was requested by ").'.')))
end endif
endif endif
endfor endfor
endf endfun


let s:top_level = 0 let s:top_level = 0
" see also ActivateRecursively " see also ActivateRecursively
Expand Down Expand Up @@ -278,7 +278,7 @@ fun! vam#ActivateAddons(...) abort
call filter(to_be_activated, 'index(g:vam_plugin_whitelist, v:key) != -1 || has_key(are_dependencies, v:key)') call filter(to_be_activated, 'index(g:vam_plugin_whitelist, v:key) != -1 || has_key(are_dependencies, v:key)')
call filter(path_plugins, 'has_key(to_be_activated, v:val)') call filter(path_plugins, 'has_key(to_be_activated, v:val)')
call filter(new_runtime_paths, 'has_key(path_plugins, v:val)') call filter(new_runtime_paths, 'has_key(path_plugins, v:val)')
end endif
" deferred tasks: " deferred tasks:
" - add addons to runtimepath " - add addons to runtimepath
" - add source plugin/**/*.vim files in case Activate was called long " - add source plugin/**/*.vim files in case Activate was called long
Expand Down Expand Up @@ -351,7 +351,7 @@ fun! vam#DisplayAddonInfoLines(name, repository)
call add(lines, key.': '.string(repository[key])) call add(lines, key.': '.string(repository[key]))
endfor endfor
return lines return lines
endf endfun


fun! vam#DisplayAddonInfo(name) fun! vam#DisplayAddonInfo(name)
let repository = get(g:vim_addon_manager['plugin_sources'], a:name, {}) let repository = get(g:vim_addon_manager['plugin_sources'], a:name, {})
Expand All @@ -365,7 +365,7 @@ fun! vam#DisplayAddonInfo(name)
let repository = get(values(dict), 0, {}) let repository = get(values(dict), 0, {})
let name = keys(dict)[0] let name = keys(dict)[0]
endif endif
end endif
if empty(repository) if empty(repository)
echo "Invalid plugin name: " . a:name echo "Invalid plugin name: " . a:name
return return
Expand All @@ -380,13 +380,13 @@ fun! vam#DisplayAddonsInfo(names)
for name in a:names for name in a:names
call vam#DisplayAddonInfo(name) call vam#DisplayAddonInfo(name)
endfor endfor
endf endfun


fun! vam#SourceFiles(fs) fun! vam#SourceFiles(fs)
for file in a:fs for file in a:fs
exec 'source '.fnameescape(file) exec 'source '.fnameescape(file)
endfor endfor
endf endfun


" FIXME won't list hidden files as well " FIXME won't list hidden files as well
if v:version>703 || (v:version==703 && has('patch465')) if v:version>703 || (v:version==703 && has('patch465'))
Expand All @@ -405,11 +405,11 @@ endfun
fun! vam#GlobThenSource(glob) fun! vam#GlobThenSource(glob)
if s:c.dont_source | return | endif if s:c.dont_source | return | endif
call vam#SourceFiles(vam#GlobList(a:glob)) call vam#SourceFiles(vam#GlobList(a:glob))
endf endfun


augroup VIM_PLUGIN_MANAGER augroup VIM_PLUGIN_MANAGER
autocmd VimEnter * call vam#SourceMissingPlugins() autocmd VimEnter * call vam#SourceMissingPlugins()
augroup end augroup END


" taken from tlib " taken from tlib
fun! vam#OutputAsList(command) "{{{3 fun! vam#OutputAsList(command) "{{{3
Expand All @@ -418,7 +418,7 @@ fun! vam#OutputAsList(command) "{{{3
silent! exec a:command silent! exec a:command
redir END redir END
return split(lines, '\n') return split(lines, '\n')
endf endfun


" hack: Vim sources plugin files after sourcing .vimrc " hack: Vim sources plugin files after sourcing .vimrc
" Vim doesn't source the after/plugin/*.vim files in other runtime " Vim doesn't source the after/plugin/*.vim files in other runtime
Expand All @@ -438,7 +438,7 @@ fun! vam#SourceMissingPlugins()
let scriptnames = map(vam#OutputAsList('scriptnames'), 'v:val[(stridx(v:val,":")+2):-1]') let scriptnames = map(vam#OutputAsList('scriptnames'), 'v:val[(stridx(v:val,":")+2):-1]')
call filter(fs, 'index(scriptnames, v:val) == -1') call filter(fs, 'index(scriptnames, v:val) == -1')
call vam#SourceFiles(fs) call vam#SourceFiles(fs)
endf endfun


fun! vam#AddonInfoFile(name) fun! vam#AddonInfoFile(name)
" history: " history:
Expand Down Expand Up @@ -517,11 +517,11 @@ command! -nargs=* -bar -complete=customlist,vam#install#UninstallCompletion Unin


command! -nargs=* -complete=customlist,vam#bisect#BisectCompletion AddonsBisect :call vam#bisect#Bisect(<f-args>) command! -nargs=* -complete=customlist,vam#bisect#BisectCompletion AddonsBisect :call vam#bisect#Bisect(<f-args>)


function! s:RunInstallHooks(plugins) fun! s:RunInstallHooks(plugins)
for name in a:plugins for name in a:plugins
call vam#install#RunHook('post-install', vam#AddonInfo(name), vam#install#GetRepo(name, {}), vam#PluginDirFromName(name), {}) call vam#install#RunHook('post-install', vam#AddonInfo(name), vam#install#GetRepo(name, {}), vam#PluginDirFromName(name), {})
endfor endfor
endfunction endfun
command! -nargs=+ -complete=customlist,vam#install#InstalledAddonCompletion RunInstallHooks :call s:RunInstallHooks([<f-args>]) command! -nargs=+ -complete=customlist,vam#install#InstalledAddonCompletion RunInstallHooks :call s:RunInstallHooks([<f-args>])




Expand Down
10 changes: 5 additions & 5 deletions autoload/vam/bisect.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun! vam#bisect#StepBad(vim, plain, addons, vimrc_tmp) abort
else else
throw "You used neither OKVAMBisect nor BADVAMBisect to exit vim!" throw "You used neither OKVAMBisect nor BADVAMBisect to exit vim!"
endif endif
endf endfun


" ... must be cache " ... must be cache
fun! vam#bisect#List(vim_executable, skip_initial, addons, force_addons, ...) abort fun! vam#bisect#List(vim_executable, skip_initial, addons, force_addons, ...) abort
Expand Down Expand Up @@ -67,7 +67,7 @@ fun! vam#bisect#List(vim_executable, skip_initial, addons, force_addons, ...) ab
else else
let cache.bisect_plain_result = {'problem_found': 0, 'message': 'Problem was not found - nothing left to test. Are you sure you have a problem?'} let cache.bisect_plain_result = {'problem_found': 0, 'message': 'Problem was not found - nothing left to test. Are you sure you have a problem?'}
return cache.bisect_plain_result return cache.bisect_plain_result
end endif
endif endif


if len(addons) == 1 if len(addons) == 1
Expand Down Expand Up @@ -116,7 +116,7 @@ fun! vam#bisect#List(vim_executable, skip_initial, addons, force_addons, ...) ab
" let r = vam#bisect#Bisect(a:vim_executable, left_half, right_half) " let r = vam#bisect#Bisect(a:vim_executable, left_half, right_half)
endif endif
endif endif
endf endfun


" argument1: ['vim'] or ['gvim','--nofork'] " argument1: ['vim'] or ['gvim','--nofork']
" rerun vim bisecting the plugin list to find out which plugin might be " rerun vim bisecting the plugin list to find out which plugin might be
Expand All @@ -135,11 +135,11 @@ fun! vam#bisect#Bisect(...)
endtry endtry
let g:vim_addon_bisect_result = r let g:vim_addon_bisect_result = r
call vam#Log(r.message) call vam#Log(r.message)
endf endfun


fun! vam#bisect#BisectCompletion(A, L, P, ...) fun! vam#bisect#BisectCompletion(A, L, P, ...)
let list = ['vim','gvim'] let list = ['vim','gvim']
return list return list
endf endfun


" vim: et ts=8 sts=2 sw=2 " vim: et ts=8 sts=2 sw=2
38 changes: 19 additions & 19 deletions autoload/vam/install.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fun! vam#install#CheckPoolItem(key, i)
if url =~ '^http' | call vam#Log("pool item ".url.": should not be using http:// for consistency. If you need http see MyGitCheckout example") | endif if url =~ '^http' | call vam#Log("pool item ".url.": should not be using http:// for consistency. If you need http see MyGitCheckout example") | endif
if url =~ '\.git$' | call vam#Log('pool item '.url.': github urls also work without .git suffix. Drop if for copy paste and consistency reasons') | endif if url =~ '\.git$' | call vam#Log('pool item '.url.': github urls also work without .git suffix. Drop if for copy paste and consistency reasons') | endif
endif endif
endf endfun


fun! vam#install#RewriteName(name) fun! vam#install#RewriteName(name)
if a:name[:6]==#'github:' if a:name[:6]==#'github:'
Expand Down Expand Up @@ -155,7 +155,7 @@ fun! vam#install#RunHook(hook, info, repository, pluginDir, opts)
\'%i', 'a:info', 'g'), \'%i', 'a:info', 'g'),
\'%o', 'a:opts', 'g') \'%o', 'a:opts', 'g')
endif endif
endfu endfun


" opts: same as ActivateAddons " opts: same as ActivateAddons
fun! vam#install#Install(toBeInstalledList, ...) fun! vam#install#Install(toBeInstalledList, ...)
Expand Down Expand Up @@ -233,7 +233,7 @@ fun! vam#install#Install(toBeInstalledList, ...)
let installed += [name] let installed += [name]
endfor endfor
return installed return installed
endf endfun


fun! vam#install#CreatePatch(info, repository, pluginDir, hook_opts) fun! vam#install#CreatePatch(info, repository, pluginDir, hook_opts)
let a:hook_opts.diff_do_diff=(s:c.do_diff && executable('diff')) let a:hook_opts.diff_do_diff=(s:c.do_diff && executable('diff'))
Expand Down Expand Up @@ -378,7 +378,7 @@ fun! vam#install#UpdateAddon(name)
call vam#Log( "Not updating plugin ".a:name." because there is no version according to version key") call vam#Log( "Not updating plugin ".a:name." because there is no version according to version key")
endif endif
return 'up-to-date' return 'up-to-date'
endf endfun


fun! vam#install#Update(list) fun! vam#install#Update(list)
let list = a:list let list = a:list
Expand Down Expand Up @@ -412,7 +412,7 @@ fun! vam#install#Update(list)
for [k,v] in items(by_reply) for [k,v] in items(by_reply)
call vam#Log(get(labels,k,k).' '.string(by_reply[k]).".", k is# 'failed' ? 'WarningMsg' : 'Type') call vam#Log(get(labels,k,k).' '.string(by_reply[k]).".", k is# 'failed' ? 'WarningMsg' : 'Type')
endfor endfor
endf endfun


" completion {{{ " completion {{{


Expand All @@ -434,7 +434,7 @@ fun! vam#install#KnownAddons(type)
endfor endfor
endif endif
return sort(keys(k)) return sort(keys(k))
endf endfun


" Filters: " Filters:
" 1. Start of the name must be the same as completed name " 1. Start of the name must be the same as completed name
Expand Down Expand Up @@ -523,23 +523,23 @@ endfun


fun! vam#install#AddonCompletion(...) fun! vam#install#AddonCompletion(...)
return call('vam#install#DoCompletion',a:000) return call('vam#install#DoCompletion',a:000)
endf endfun


fun! vam#install#NotInstalledAddonCompletion(...) fun! vam#install#NotInstalledAddonCompletion(...)
return call('vam#install#DoCompletion',a:000+["notinstalled"]) return call('vam#install#DoCompletion',a:000+["notinstalled"])
endf endfun


fun! vam#install#InstalledAddonCompletion(...) fun! vam#install#InstalledAddonCompletion(...)
return call('vam#install#DoCompletion',a:000+["installed"]) return call('vam#install#DoCompletion',a:000+["installed"])
endf endfun


fun! vam#install#UninstallCompletion(...) fun! vam#install#UninstallCompletion(...)
return call('vam#install#DoCompletion',a:000+["notloaded"]) return call('vam#install#DoCompletion',a:000+["notloaded"])
endf endfun


fun! vam#install#UpdateCompletion(...) fun! vam#install#UpdateCompletion(...)
return call('vam#install#DoCompletion',a:000+["installed"]) return call('vam#install#DoCompletion',a:000+["installed"])
endf endfun
"}}} "}}}


fun! vam#install#UninstallAddons(list) fun! vam#install#UninstallAddons(list)
Expand All @@ -552,12 +552,12 @@ fun! vam#install#UninstallAddons(list)
if s:confirm('Will now remove '.join(list, ', ').'. Confirm?') if s:confirm('Will now remove '.join(list, ', ').'. Confirm?')
call map(list, 'vam#utils#RmFR(v:val)') call map(list, 'vam#utils#RmFR(v:val)')
endif endif
endf endfun


fun! vam#install#HelpTags(name) fun! vam#install#HelpTags(name)
let d=vam#PluginDirFromName(a:name).'/doc' let d=vam#PluginDirFromName(a:name).'/doc'
if isdirectory(d) | exec 'helptags '.fnameescape(d) | endif if isdirectory(d) | exec 'helptags '.fnameescape(d) | endif
endf endfun


" basename of url. if archive_name is given use that instead " basename of url. if archive_name is given use that instead
fun! vam#install#ArchiveNameFromDict(repository) fun! vam#install#ArchiveNameFromDict(repository)
Expand All @@ -566,7 +566,7 @@ fun! vam#install#ArchiveNameFromDict(repository)
let archiveName = fnamemodify(a:repository['url'],':t') let archiveName = fnamemodify(a:repository['url'],':t')
endif endif
return archiveName return archiveName
endf endfun




" may throw EXCEPTION_UNPACK " may throw EXCEPTION_UNPACK
Expand Down Expand Up @@ -615,7 +615,7 @@ endfun


fun! vam#install#MergeTarget() fun! vam#install#MergeTarget()
return split(&runtimepath,",")[0].'/after/plugin/vim-addon-manager-merged.vim' return split(&runtimepath,",")[0].'/after/plugin/vim-addon-manager-merged.vim'
endf endfun


" if you machine is under IO load starting up Vim can take some time " if you machine is under IO load starting up Vim can take some time
" This function tries to optimize this by reading all the plugin/*.vim " This function tries to optimize this by reading all the plugin/*.vim
Expand Down Expand Up @@ -737,7 +737,7 @@ fun! vam#install#MergePluginFiles(plugins, skip_pattern)
if !isdirectory(d) | call mkdir(d,'p') | endif if !isdirectory(d) | call mkdir(d,'p') | endif
call writefile(split(all_contents,"\n"), target) call writefile(split(all_contents,"\n"), target)


endf endfun


fun! vam#install#UnmergePluginFiles() fun! vam#install#UnmergePluginFiles()
let path = fnamemodify(vam#PluginRuntimePath('vim-addon-manager'),':h') let path = fnamemodify(vam#PluginRuntimePath('vim-addon-manager'),':h')
Expand Down Expand Up @@ -804,7 +804,7 @@ fun! vam#install#LoadPool(...)


let s:c.pool_loaded = 1 let s:c.pool_loaded = 1
endif endif
endf endfun
"}}}1 "}}}1




Expand Down Expand Up @@ -858,7 +858,7 @@ if g:is_win
"let _7zurl = 'mirror://sourceforge/sevenzip/7-Zip/4.65/7z465.exe' "let _7zurl = 'mirror://sourceforge/sevenzip/7-Zip/4.65/7z465.exe'
"call vam#utils#DownloadFromMirrors(_7zurl, s:c['binary_utils'].'/7z.exe') "call vam#utils#DownloadFromMirrors(_7zurl, s:c['binary_utils'].'/7z.exe')


endf endfun
endif endif


fun! vam#install#ShowShortLog(info, repository, pluginDir, hook_opts) fun! vam#install#ShowShortLog(info, repository, pluginDir, hook_opts)
Expand All @@ -873,6 +873,6 @@ fun! vam#install#ShowShortLog(info, repository, pluginDir, hook_opts)
\matchstr(a:hook_opts.newVersion, "[^ \t\r\n]*")], get(c, 2, {})), \matchstr(a:hook_opts.newVersion, "[^ \t\r\n]*")], get(c, 2, {})),
\'Normal') \'Normal')
endif endif
endf endfun


" vim: et ts=8 sts=2 sw=2 " vim: et ts=8 sts=2 sw=2
Loading

0 comments on commit f147736

Please sign in to comment.