summaryrefslogtreecommitdiff
path: root/.vim/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to '.vim/ftplugin')
-rw-r--r--.vim/ftplugin/haskell.vim14
-rw-r--r--.vim/ftplugin/haskell_doc.vim881
-rw-r--r--.vim/ftplugin/haskell_hpaste.vim79
-rw-r--r--.vim/ftplugin/java/CTree.vim240
-rw-r--r--.vim/ftplugin/java/java.vim84
-rw-r--r--.vim/ftplugin/java/java_getset.vim871
6 files changed, 0 insertions, 2169 deletions
diff --git a/.vim/ftplugin/haskell.vim b/.vim/ftplugin/haskell.vim
deleted file mode 100644
index 968741e..0000000
--- a/.vim/ftplugin/haskell.vim
+++ /dev/null
@@ -1,14 +0,0 @@
-"
-" general Haskell source settings
-" (shared functions are in autoload/haskellmode.vim)
-"
-" (Claus Reinke, last modified: 28/04/2009)
-"
-" part of haskell plugins: http://projects.haskell.org/haskellmode-vim
-" please send patches to <claus.reinke@talk21.com>
-
-" try gf on import line, or ctrl-x ctrl-i, or [I, [i, ..
-setlocal include=^import\\s*\\(qualified\\)\\?\\s*
-setlocal includeexpr=substitute(v:fname,'\\.','/','g').'.'
-setlocal suffixesadd=hs,lhs,hsc
-
diff --git a/.vim/ftplugin/haskell_doc.vim b/.vim/ftplugin/haskell_doc.vim
deleted file mode 100644
index 482ea69..0000000
--- a/.vim/ftplugin/haskell_doc.vim
+++ /dev/null
@@ -1,881 +0,0 @@
-"
-" use haddock docs and index files
-" show documentation, complete & qualify identifiers
-"
-" (Claus Reinke; last modified: 17/06/2009)
-"
-" part of haskell plugins: http://projects.haskell.org/haskellmode-vim
-" please send patches to <claus.reinke@talk21.com>
-
-" :Doc <name> and :IDoc <name> open haddocks for <name> in opera
-"
-" :Doc needs qualified name (default Prelude) and package (default base)
-" :IDoc needs unqualified name, looks up possible links in g:haddock_index
-"
-" :DocIndex populates g:haddock_index from haddock's index files
-" :ExportDocIndex saves g:haddock_index to cache file
-" :ImportDocIndex reloads g:haddock_index from cache file
-"
-" all the following use the haddock index (g:haddock_index)
-"
-" _? opens haddocks for unqualified name under cursor,
-" suggesting alternative full qualifications in popup menu
-"
-" _. fully qualifies unqualified name under cursor,
-" suggesting alternative full qualifications in popup menu
-"
-" _i add import <module>(<name>) statement for unqualified <name> under cursor,
-" _im add import <module> statement for unqualified <name> under cursor,
-" suggesting alternative full qualifications in popup menu
-" (this currently adds one statement per call, instead of
-" merging into existing import statements, but it's a start;-)
-"
-" CTRL-X CTRL-U (user-defined insert mode completion)
-" suggests completions of unqualified names in popup menu
-
-let s:scriptname = "haskell_doc.vim"
-
-" script parameters
-" g:haddock_browser *mandatory* which browser to call
-" g:haddock_browser_callformat [optional] how to call browser
-" g:haddock_indexfiledir [optional] where to put 'haddock_index.vim'
-" g:haddock_docdir [optional] where to find html docs
-" g:ghc [optional] which ghc to call
-" g:ghc_pkg [optional] which ghc_pkg to call
-
-" been here before?
-if exists("g:haddock_index")
- finish
-endif
-
-" initialise nested dictionary, to be populated
-" - from haddock index files via :DocIndex
-" - from previous cached version via :ImportDocIndex
-let g:haddock_index = {}
-
-" initialise dictionary, mapping modules with haddocks to their packages,
-" populated via MkHaddockModuleIndex() or HaveModuleIndex()
-let g:haddock_moduleindex = {}
-
-" program to open urls, please set this in your vimrc
- "examples (for windows):
- "let g:haddock_browser = "C:/Program Files/Opera/Opera.exe"
- "let g:haddock_browser = "C:/Program Files/Mozilla Firefox/firefox.exe"
- "let g:haddock_browser = "C:/Program Files/Internet Explorer/IEXPLORE.exe"
-if !exists("g:haddock_browser")
- echoerr s:scriptname." WARNING: please set g:haddock_browser!"
-endif
-
-if !haskellmode#GHC() | finish | endif
-
-if (!exists("g:ghc_pkg") || !executable(g:ghc_pkg))
- let g:ghc_pkg = substitute(g:ghc,'\(.*\)ghc','\1ghc-pkg','')
-endif
-
-if exists("g:haddock_docdir") && isdirectory(g:haddock_docdir)
- let s:docdir = g:haddock_docdir
-elseif executable(g:ghc_pkg)
-" try to figure out location of html docs
-" first choice: where the base docs are (from the first base listed)
- let [field;x] = split(system(g:ghc_pkg . ' field base haddock-html'),'\n')
- " path changes in ghc-6.12.*
- " let field = substitute(field,'haddock-html: \(.*\)libraries.base','\1','')
- let field = substitute(field,'haddock-html: \(.*\)lib\(raries\)\?.base.*$','\1','')
- let field = substitute(field,'\\','/','g')
- " let alternate = substitute(field,'html','doc/html','')
- " changes for ghc-6.12.*: check for doc/html/ first
- let alternate = field.'doc/html/'
- if isdirectory(alternate)
- let s:docdir = alternate
- elseif isdirectory(field)
- let s:docdir = field
- endif
-else
- echoerr s:scriptname." can't find ghc-pkg (set g:ghc_pkg ?)."
-endif
-
-" second choice: try some known suspects for windows/unix
-if !exists('s:docdir') || !isdirectory(s:docdir)
- let s:ghc_libdir = substitute(system(g:ghc . ' --print-libdir'),'\n','','')
- let location1a = s:ghc_libdir . '/doc/html/'
- let location1b = s:ghc_libdir . '/doc/'
- let location2 = '/usr/share/doc/ghc-' . haskellmode#GHC_Version() . '/html/'
- if isdirectory(location1a)
- let s:docdir = location1a
- elseif isdirectory(location1b)
- let s:docdir = location1b
- elseif isdirectory(location2)
- let s:docdir = location2
- else " give up
- echoerr s:scriptname." can't find locaton of html documentation (set g:haddock_docdir)."
- finish
- endif
-endif
-
-" todo: can we turn s:docdir into a list of paths, and
-" include docs for third-party libs as well?
-
-let s:libraries = s:docdir . 'libraries/'
-let s:guide = s:docdir . 'users_guide/'
-let s:index = 'index.html'
-if exists("g:haddock_indexfiledir") && filewritable(g:haddock_indexfiledir)
- let s:haddock_indexfiledir = g:haddock_indexfiledir
-elseif filewritable(s:libraries)
- let s:haddock_indexfiledir = s:libraries
-elseif filewritable($HOME)
- let s:haddock_indexfiledir = $HOME.'/'
-else "give up
- echoerr s:scriptname." can't locate index file. please set g:haddock_indexfiledir"
- finish
-endif
-let s:haddock_indexfile = s:haddock_indexfiledir . 'haddock_index.vim'
-
-" different browser setups require different call formats;
-" you might want to call the browser synchronously or
-" asynchronously, and the latter is os-dependent;
-"
-" by default, the browser is started in the background when on
-" windows or if running in a gui, and in the foreground otherwise
-" (eg, console-mode for remote sessions, with text-mode browsers).
-"
-" you can override these defaults in your vimrc, via a format
-" string including 2 %s parameters (the first being the browser
-" to call, the second being the url).
-if !exists("g:haddock_browser_callformat")
- if has("win32") || has("win64")
- let g:haddock_browser_callformat = 'start %s "%s"'
- else
- if has("gui_running")
- let g:haddock_browser_callformat = '%s %s '.printf(&shellredir,'/dev/null').' &'
- else
- let g:haddock_browser_callformat = '%s %s'
- endif
- endif
-endif
-
-" allow map leader override
-if !exists("maplocalleader")
- let maplocalleader='_'
-endif
-
-command! DocSettings call DocSettings()
-function! DocSettings()
- for v in ["g:haddock_browser","g:haddock_browser_callformat","g:haddock_docdir","g:haddock_indexfiledir","s:ghc_libdir","g:ghc_version","s:docdir","s:libraries","s:guide","s:haddock_indexfile"]
- if exists(v)
- echo v '=' eval(v)
- else
- echo v '='
- endif
- endfor
-endfunction
-
-function! DocBrowser(url)
- "echomsg "DocBrowser(".url.")"
- if (!exists("g:haddock_browser") || !executable(g:haddock_browser))
- echoerr s:scriptname." can't find documentation browser. please set g:haddock_browser"
- return
- endif
- " start browser to open url, according to specified format
- let url = a:url=~'^\(file://\|http://\)' ? a:url : 'file://'.a:url
- silent exe '!'.printf(g:haddock_browser_callformat,g:haddock_browser,escape(url,'#%'))
-endfunction
-
-"Doc/Doct are an old interface for documentation lookup
-"(that is the reason they are not documented!-)
-"
-"These uses are still fine at the moment, and are the reason
-"that this command still exists at all
-"
-" :Doc -top
-" :Doc -libs
-" :Doc -guide
-"
-"These uses may or may not work, and shouldn't be relied on anymore
-"(usually, you want _?/_?1/_?2 or :MDoc; there is also :IDoc)
-"
-" :Doc length
-" :Doc Control.Monad.when
-" :Doc Data.List.
-" :Doc Control.Monad.State.runState mtl
-command! -nargs=+ Doc call Doc('v',<f-args>)
-command! -nargs=+ Doct call Doc('t',<f-args>)
-
-function! Doc(kind,qualname,...)
- let suffix = '.html'
- let relative = '#'.a:kind.'%3A'
-
- if a:qualname=="-top"
- call DocBrowser(s:docdir . s:index)
- return
- elseif a:qualname=="-libs"
- call DocBrowser(s:libraries . s:index)
- return
- elseif a:qualname=="-guide"
- call DocBrowser(s:guide . s:index)
- return
- endif
-
- if a:0==0 " no package specified
- let package = 'base/'
- else
- let package = a:1 . '/'
- endif
-
- if match(a:qualname,'\.')==-1 " unqualified name
- let [qual,name] = [['Prelude'],a:qualname]
- let file = join(qual,'-') . suffix . relative . name
- elseif a:qualname[-1:]=='.' " module qualifier only
- let parts = split(a:qualname,'\.')
- let quallen = len(parts)-1
- let [qual,name] = [parts[0:quallen],parts[-1]]
- let file = join(qual,'-') . suffix
- else " qualified name
- let parts = split(a:qualname,'\.')
- let quallen = len(parts)-2
- let [qual,name] = [parts[0:quallen],parts[-1]]
- let file = join(qual,'-') . suffix . relative . name
- endif
-
- let path = s:libraries . package . file
- call DocBrowser(path)
-endfunction
-
-" TODO: add commandline completion for :IDoc
-" switch to :emenu instead of inputlist?
-" indexed variant of Doc, looking up links in g:haddock_index
-" usage:
-" 1. :IDoc length
-" 2. click on one of the choices, or select by number (starting from 0)
-command! -nargs=+ IDoc call IDoc(<f-args>)
-function! IDoc(name,...)
- let choices = HaddockIndexLookup(a:name)
- if choices=={} | return | endif
- if a:0==0
- let keylist = map(deepcopy(keys(choices)),'substitute(v:val,"\\[.\\]","","")')
- let choice = inputlist(keylist)
- else
- let choice = a:1
- endif
- let path = values(choices)[choice] " assumes same order for keys/values..
- call DocBrowser(path)
-endfunction
-
-let s:flagref = s:guide . 'flag-reference.html'
-if filereadable(s:flagref)
- " extract the generated fragment ids for the
- " flag reference sections
- let s:headerPat = '.\{-}<h3 class="title"><a name="\([^"]*\)"><\/a>\([^<]*\)<\/h3>\(.*\)'
- let s:flagheaders = []
- let s:flagheaderids = {}
- let s:contents = join(readfile(s:flagref))
- let s:ml = matchlist(s:contents,s:headerPat)
- while s:ml!=[]
- let [_,s:id,s:title,s:r;s:x] = s:ml
- let s:flagheaders = add(s:flagheaders, s:title)
- let s:flagheaderids[s:title] = s:id
- let s:ml = matchlist(s:r,s:headerPat)
- endwhile
- command! -nargs=1 -complete=customlist,CompleteFlagHeaders FlagReference call FlagReference(<f-args>)
- function! FlagReference(section)
- let relativeUrl = a:section==""||!exists("s:flagheaderids['".a:section."']") ?
- \ "" : "#".s:flagheaderids[a:section]
- call DocBrowser(s:flagref.relativeUrl)
- endfunction
- function! CompleteFlagHeaders(al,cl,cp)
- let s:choices = s:flagheaders
- return CompleteAux(a:al,a:cl,a:cp)
- endfunction
-endif
-
-command! -nargs=1 -complete=customlist,CompleteHaddockModules MDoc call MDoc(<f-args>)
-function! MDoc(module)
- let suffix = '.html'
- call HaveModuleIndex()
- if !has_key(g:haddock_moduleindex,a:module)
- echoerr a:module 'not found in haddock module index'
- return
- endif
- let package = g:haddock_moduleindex[a:module]['package']
- let file = substitute(a:module,'\.','-','g') . suffix
-" let path = s:libraries . package . '/' . file
- let path = g:haddock_moduleindex[a:module]['html']
- call DocBrowser(path)
-endfunction
-
-function! CompleteHaddockModules(al,cl,cp)
- call HaveModuleIndex()
- let s:choices = keys(g:haddock_moduleindex)
- return CompleteAux(a:al,a:cl,a:cp)
-endfunction
-
-" create a dictionary g:haddock_index, containing the haddoc index
-command! DocIndex call DocIndex()
-function! DocIndex()
- let files = split(globpath(s:libraries,'doc-index*.html'),'\n')
- let g:haddock_index = {}
- if haskellmode#GHC_VersionGE([7,0,0])
- call ProcessHaddockIndexes3(s:libraries,files)
- else
- call ProcessHaddockIndexes2(s:libraries,files)
- endif
- if haskellmode#GHC_VersionGE([6,8,2])
- if &shell =~ 'sh' " unix-type shell
- let s:addon_libraries = split(system(g:ghc_pkg . ' field \* haddock-html'),'\n')
- else " windows cmd.exe and the like
- let s:addon_libraries = split(system(g:ghc_pkg . ' field * haddock-html'),'\n')
- endif
- for addon in s:addon_libraries
- let ml = matchlist(addon,'haddock-html: \("\)\?\(file:///\)\?\([^"]*\)\("\)\?')
- if ml!=[]
- let [_,quote,file,addon_path;x] = ml
- let addon_path = substitute(addon_path,'\(\\\\\|\\\)','/','g')
- let addon_files = split(globpath(addon_path,'doc-index*.html'),'\n')
- if haskellmode#GHC_VersionGE([7,0,0])
- call ProcessHaddockIndexes3(addon_path,addon_files)
- else
- call ProcessHaddockIndexes2(addon_path,addon_files)
- endif
- endif
- endfor
- endif
- return 1
-endfunction
-
-function! ProcessHaddockIndexes(location,files)
- let entryPat= '.\{-}"indexentry"[^>]*>\([^<]*\)<\(\%([^=]\{-}TD CLASS="\%(indexentry\)\@!.\{-}</TD\)*\)[^=]\{-}\(\%(="indexentry\|TABLE\).*\)'
- let linkPat = '.\{-}HREF="\([^"]*\)".>\([^<]*\)<\(.*\)'
-
- redraw
- echo 'populating g:haddock_index from haddock index files in ' a:location
- for f in a:files
- echo f[len(a:location):]
- let contents = join(readfile(f))
- let ml = matchlist(contents,entryPat)
- while ml!=[]
- let [_,entry,links,r;x] = ml
- "echo entry links
- let ml2 = matchlist(links,linkPat)
- let link = {}
- while ml2!=[]
- let [_,l,m,links;x] = ml2
- "echo l m
- let link[m] = a:location . '/' . l
- let ml2 = matchlist(links,linkPat)
- endwhile
- let g:haddock_index[DeHTML(entry)] = deepcopy(link)
- "echo entry g:haddock_index[entry]
- let ml = matchlist(r,entryPat)
- endwhile
- endfor
-endfunction
-
-" concatenating all lines is too slow for a big file, process lines directly
-function! ProcessHaddockIndexes2(location,files)
- let entryPat= '^>\([^<]*\)</'
- let linkPat = '.\{-}A HREF="\([^"]*\)"'
- let kindPat = '#\(.\)'
-
- " redraw
- echo 'populating g:haddock_index from haddock index files in ' a:location
- for f in a:files
- echo f[len(a:location):]
- let isEntry = 0
- let isLink = ''
- let link = {}
- let entry = ''
- for line in readfile(f)
- if line=~'CLASS="indexentry'
- if (link!={}) && (entry!='')
- if has_key(g:haddock_index,DeHTML(entry))
- let dict = extend(g:haddock_index[DeHTML(entry)],deepcopy(link))
- else
- let dict = deepcopy(link)
- endif
- let g:haddock_index[DeHTML(entry)] = dict
- let link = {}
- let entry = ''
- endif
- let isEntry=1
- continue
- endif
- if isEntry==1
- let ml = matchlist(line,entryPat)
- if ml!=[] | let [_,entry;x] = ml | let isEntry=0 | continue | endif
- endif
- if entry!=''
- let ml = matchlist(line,linkPat)
- if ml!=[] | let [_,isLink;x]=ml | continue | endif
- endif
- if isLink!=''
- let ml = matchlist(line,entryPat)
- if ml!=[]
- let [_,module;x] = ml
- let [_,kind;x] = matchlist(isLink,kindPat)
- let last = a:location[strlen(a:location)-1]
- let link[module."[".kind."]"] = a:location . (last=='/'?'':'/') . isLink
- let isLink=''
- continue
- endif
- endif
- endfor
- if link!={}
- if has_key(g:haddock_index,DeHTML(entry))
- let dict = extend(g:haddock_index[DeHTML(entry)],deepcopy(link))
- else
- let dict = deepcopy(link)
- endif
- let g:haddock_index[DeHTML(entry)] = dict
- endif
- endfor
-endfunction
-
-function! ProcessHaddockIndexes3(location,files)
- let entryPat= '>\(.*\)$'
- let linkPat = '<a href="\([^"]*\)"'
- let kindPat = '#\(.\)'
-
- " redraw
- echo 'populating g:haddock_index from haddock index files in ' a:location
- for f in a:files
- echo f[len(a:location):]
- let isLink = ''
- let link = {}
- let entry = ''
- let lines = split(join(readfile(f,'b')),'\ze<')
- for line in lines
- if (line=~'class="src') || (line=~'/table')
- if (link!={}) && (entry!='')
- if has_key(g:haddock_index,DeHTML(entry))
- let dict = extend(g:haddock_index[DeHTML(entry)],deepcopy(link))
- else
- let dict = deepcopy(link)
- endif
- let g:haddock_index[DeHTML(entry)] = dict
- let link = {}
- let entry = ''
- endif
- let ml = matchlist(line,entryPat)
- if ml!=[] | let [_,entry;x] = ml | continue | endif
- continue
- endif
- if entry!=''
- let ml = matchlist(line,linkPat)
- if ml!=[]
- let [_,isLink;x]=ml
- let ml = matchlist(line,entryPat)
- if ml!=[]
- let [_,module;x] = ml
- let [_,kind;x] = matchlist(isLink,kindPat)
- let last = a:location[strlen(a:location)-1]
- let link[module."[".kind."]"] = a:location . (last=='/'?'':'/') . isLink
- let isLink=''
- endif
- continue
- endif
- endif
- endfor
- if link!={}
- if has_key(g:haddock_index,DeHTML(entry))
- let dict = extend(g:haddock_index[DeHTML(entry)],deepcopy(link))
- else
- let dict = deepcopy(link)
- endif
- let g:haddock_index[DeHTML(entry)] = dict
- endif
- endfor
-endfunction
-
-
-command! ExportDocIndex call ExportDocIndex()
-function! ExportDocIndex()
- call HaveIndex()
- let entries = []
- for key in keys(g:haddock_index)
- let entries += [key,string(g:haddock_index[key])]
- endfor
- call writefile(entries,s:haddock_indexfile)
- redir end
-endfunction
-
-command! ImportDocIndex call ImportDocIndex()
-function! ImportDocIndex()
- if filereadable(s:haddock_indexfile)
- let lines = readfile(s:haddock_indexfile)
- let i=0
- while i<len(lines)
- let [key,dict] = [lines[i],lines[i+1]]
- sandbox let g:haddock_index[key] = eval(dict)
- let i+=2
- endwhile
- return 1
- else
- return 0
- endif
-endfunction
-
-function! HaveIndex()
- return (g:haddock_index!={} || ImportDocIndex() || DocIndex() )
-endfunction
-
-function! MkHaddockModuleIndex()
- let g:haddock_moduleindex = {}
- call HaveIndex()
- for key in keys(g:haddock_index)
- let dict = g:haddock_index[key]
- for module in keys(dict)
- let html = dict[module]
- let html = substitute(html ,'#.*$','','')
- let module = substitute(module,'\[.\]','','')
- let ml = matchlist(html,'libraries/\([^\/]*\)[\/]')
- if ml!=[]
- let [_,package;x] = ml
- let g:haddock_moduleindex[module] = {'package':package,'html':html}
- endif
- let ml = matchlist(html,'/\([^\/]*\)\/html/[A-Z]')
- if ml!=[]
- let [_,package;x] = ml
- let g:haddock_moduleindex[module] = {'package':package,'html':html}
- endif
- endfor
- endfor
-endfunction
-
-function! HaveModuleIndex()
- return (g:haddock_moduleindex!={} || MkHaddockModuleIndex() )
-endfunction
-
-" decode HTML symbol encodings (are these all we need?)
-function! DeHTML(entry)
- let res = a:entry
- let decode = { '&lt;': '<', '&gt;': '>', '&amp;': '\\&' }
- for enc in keys(decode)
- exe 'let res = substitute(res,"'.enc.'","'.decode[enc].'","g")'
- endfor
- return res
-endfunction
-
-" find haddocks for word under cursor
-" also lists possible definition sites
-" - needs to work for both qualified and unqualified items
-" - for 'import qualified M as A', consider M.item as source of A.item
-" - offer sources from both type [t] and value [v] namespaces
-" - for unqualified items, list all possible sites
-" - for qualified items, list imported sites only
-" keep track of keys with and without namespace tags:
-" the former are needed for lookup, the latter for matching against source
-map <LocalLeader>? :call Haddock()<cr>
-function! Haddock()
- amenu ]Popup.- :echo '-'<cr>
- aunmenu ]Popup
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [start,symb,qual,unqual] = namsym
- let imports = haskellmode#GatherImports()
- let asm = has_key(imports[1],qual) ? imports[1][qual]['modules'] : []
- let name = unqual
- let dict = HaddockIndexLookup(name)
- if dict=={} | return | endif
- " for qualified items, narrow results to possible imports that provide qualifier
- let filteredKeys = filter(copy(keys(dict))
- \ ,'match(asm,substitute(v:val,''\[.\]'','''',''''))!=-1')
- let keys = (qual!='') ? filteredKeys : keys(dict)
- if (keys==[]) && (qual!='')
- echoerr qual.'.'.unqual.' not found in imports'
- return 0
- endif
- " use 'setlocal completeopt+=menuone' if you always want to see menus before
- " anything happens (I do, but many users don't..)
- if len(keys)==1 && (&completeopt!~'menuone')
- call DocBrowser(dict[keys[0]])
- elseif has("gui_running")
- for key in keys
- exe 'amenu ]Popup.'.escape(key,'\.').' :call DocBrowser('''.dict[key].''')<cr>'
- endfor
- popup ]Popup
- else
- let s:choices = keys
- let key = input('browse docs for '.name.' in: ','','customlist,CompleteAux')
- if key!=''
- call DocBrowser(dict[key])
- endif
- endif
-endfunction
-
-if !exists("g:haskell_search_engines")
- let g:haskell_search_engines =
- \ {'hoogle':'http://www.haskell.org/hoogle/?hoogle=%s'
- \ ,'hayoo!':'http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=%s'
- \ }
-endif
-
-map <LocalLeader>?? :let es=g:haskell_search_engines
- \ \|echo "g:haskell_search_engines"
- \ \|for e in keys(es)
- \ \|echo e.' : '.es[e]
- \ \|endfor<cr>
-map <LocalLeader>?1 :call HaskellSearchEngine('hoogle')<cr>
-map <LocalLeader>?2 :call HaskellSearchEngine('hayoo!')<cr>
-
-" query one of the Haskell search engines for the thing under cursor
-" - unqualified symbols need to be url-escaped
-" - qualified ids need to be fed as separate qualifier and id for
-" both hoogle (doesn't handle qualified symbols) and hayoo! (no qualified
-" ids at all)
-" - qualified ids referring to import-qualified-as qualifiers need to be
-" translated to the multi-module searches over the list of original modules
-function! HaskellSearchEngine(engine)
- amenu ]Popup.- :echo '-'<cr>
- aunmenu ]Popup
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [start,symb,qual,unqual] = namsym
- let imports = haskellmode#GatherImports()
- let asm = has_key(imports[1],qual) ? imports[1][qual]['modules'] : []
- let unqual = haskellmode#UrlEncode(unqual)
- if a:engine=='hoogle'
- let name = asm!=[] ? unqual.'+'.join(map(copy(asm),'"%2B".v:val'),'+')
- \ : qual!='' ? unqual.'+'.haskellmode#UrlEncode('+').qual
- \ : unqual
- elseif a:engine=='hayoo!'
- let name = asm!=[] ? unqual.'+module:('.join(copy(asm),' OR ').')'
- \ : qual!='' ? unqual.'+module:'.qual
- \ : unqual
- else
- let name = qual=="" ? unqual : qual.".".unqual
- endif
- if has_key(g:haskell_search_engines,a:engine)
- call DocBrowser(printf(g:haskell_search_engines[a:engine],name))
- else
- echoerr "unknown search engine: ".a:engine
- endif
-endfunction
-
-" used to pass on choices to CompleteAux
-let s:choices=[]
-
-" if there's no gui, use commandline completion instead of :popup
-" completion function CompleteAux suggests completions for a:al, wrt to s:choices
-function! CompleteAux(al,cl,cp)
- "echomsg '|'.a:al.'|'.a:cl.'|'.a:cp.'|'
- let res = []
- let l = len(a:al)-1
- for r in s:choices
- if l==-1 || r[0 : l]==a:al
- let res += [r]
- endif
- endfor
- return res
-endfunction
-
-" CamelCase shorthand matching:
-" favour upper-case letters and module qualifier separators (.) for disambiguation
-function! CamelCase(shorthand,string)
- let s1 = a:shorthand
- let s2 = a:string
- let notFirst = 0 " don't elide before first pattern letter
- while ((s1!="")&&(s2!=""))
- let head1 = s1[0]
- let head2 = s2[0]
- let elide = notFirst && ( ((head1=~'[A-Z]') && (head2!~'[A-Z.]'))
- \ ||((head1=='.') && (head2!='.')) )
- if elide
- let s2=s2[1:]
- elseif (head1==head2)
- let s1=s1[1:]
- let s2=s2[1:]
- else
- return 0
- endif
- let notFirst = (head1!='.')||(head2!='.') " treat separators as new beginnings
- endwhile
- return (s1=="")
-endfunction
-
-" use haddock name index for insert mode completion (CTRL-X CTRL-U)
-function! CompleteHaddock(findstart, base)
- if a:findstart
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),-1) " insert-mode: we're 1 beyond the text
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return -1
- endif
- let [start,symb,qual,unqual] = namsym
- return (start-1)
- else " find keys matching with "a:base"
- let res = []
- let l = len(a:base)-1
- let qual = a:base =~ '^[A-Z][a-zA-Z0-9_'']*\(\.[A-Z][a-zA-Z0-9_'']*\)*\(\.[a-zA-Z0-9_'']*\)\?$'
- call HaveIndex()
- for key in keys(g:haddock_index)
- let keylist = map(deepcopy(keys(g:haddock_index[key])),'substitute(v:val,"\\[.\\]","","")')
- if (key[0 : l]==a:base)
- for m in keylist
- let res += [{"word":key,"menu":m,"dup":1}]
- endfor
- elseif qual " this tends to be slower
- for m in keylist
- let word = m . '.' . key
- if word[0 : l]==a:base
- let res += [{"word":word,"menu":m,"dup":1}]
- endif
- endfor
- endif
- endfor
- if res==[] " no prefix matches, try CamelCase shortcuts
- for key in keys(g:haddock_index)
- let keylist = map(deepcopy(keys(g:haddock_index[key])),'substitute(v:val,"\\[.\\]","","")')
- if CamelCase(a:base,key)
- for m in keylist
- let res += [{"word":key,"menu":m,"dup":1}]
- endfor
- elseif qual " this tends to be slower
- for m in keylist
- let word = m . '.' . key
- if CamelCase(a:base,word)
- let res += [{"word":word,"menu":m,"dup":1}]
- endif
- endfor
- endif
- endfor
- endif
- return res
- endif
-endfunction
-setlocal completefunc=CompleteHaddock
-"
-" Vim's default completeopt is menu,preview
-" you probably want at least menu, or you won't see alternatives listed
-" setlocal completeopt+=menu
-
-" menuone is useful, but other haskellmode menus will try to follow your choice here in future
-" setlocal completeopt+=menuone
-
-" longest sounds useful, but doesn't seem to do what it says, and interferes with CTRL-E
-" setlocal completeopt-=longest
-
-" fully qualify an unqualified name
-" TODO: - standardise commandline versions of menus
-map <LocalLeader>. :call Qualify()<cr>
-function! Qualify()
- amenu ]Popup.- :echo '-'<cr>
- aunmenu ]Popup
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [start,symb,qual,unqual] = namsym
- if qual!='' " TODO: should we support re-qualification?
- redraw
- echo 'already qualified'
- return 0
- endif
- let name = unqual
- let line = line('.')
- let prefix = (start<=1 ? '' : getline(line)[0:start-2] )
- let dict = HaddockIndexLookup(name)
- if dict=={} | return | endif
- let keylist = map(deepcopy(keys(dict)),'substitute(v:val,"\\[.\\]","","")')
- let imports = haskellmode#GatherImports()
- let qualifiedImports = []
- for qualifiedImport in keys(imports[1])
- let c=0
- for module in imports[1][qualifiedImport]['modules']
- if haskellmode#ListElem(keylist,module) | let c+=1 | endif
- endfor
- if c>0 | let qualifiedImports=[qualifiedImport]+qualifiedImports | endif
- endfor
- "let asm = has_key(imports[1],qual) ? imports[1][qual]['modules'] : []
- let keylist = filter(copy(keylist),'index(qualifiedImports,v:val)==-1')
- if has("gui_running")
- " amenu ]Popup.-imported- :
- for key in qualifiedImports
- let lhs=escape(prefix.name,'/.|\')
- let rhs=escape(prefix.key.'.'.name,'/&|\')
- exe 'amenu ]Popup.'.escape(key,'\.').' :'.line.'s/'.lhs.'/'.rhs.'/<cr>:noh<cr>'
- endfor
- amenu ]Popup.-not\ imported- :
- for key in keylist
- let lhs=escape(prefix.name,'/.|\')
- let rhs=escape(prefix.key.'.'.name,'/&|\')
- exe 'amenu ]Popup.'.escape(key,'\.').' :'.line.'s/'.lhs.'/'.rhs.'/<cr>:noh<cr>'
- endfor
- popup ]Popup
- else
- let s:choices = qualifiedImports+keylist
- let key = input('qualify '.name.' with: ','','customlist,CompleteAux')
- if key!=''
- let lhs=escape(prefix.name,'/.\')
- let rhs=escape(prefix.key.'.'.name,'/&\')
- exe line.'s/'.lhs.'/'.rhs.'/'
- noh
- endif
- endif
-endfunction
-
-" create (qualified) import for a (qualified) name
-" TODO: refine search patterns, to avoid misinterpretation of
-" oddities like import'Neither or not'module
-map <LocalLeader>i :call Import(0,0)<cr>
-map <LocalLeader>im :call Import(1,0)<cr>
-map <LocalLeader>iq :call Import(0,1)<cr>
-map <LocalLeader>iqm :call Import(1,1)<cr>
-function! Import(module,qualified)
- amenu ]Popup.- :echo '-'<cr>
- aunmenu ]Popup
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [start,symb,qual,unqual] = namsym
- let name = unqual
- let pname = ( symb ? '('.name.')' : name )
- let importlist = a:module ? '' : '('.pname.')'
- let qualified = a:qualified ? 'qualified ' : ''
-
- if qual!=''
- exe 'call append(search(''\%1c\(\<import\>\|\<module\>\|{-# OPTIONS\|{-# LANGUAGE\)'',''nb''),''import '.qualified.qual.importlist.''')'
- return
- endif
-
- let line = line('.')
- let prefix = getline(line)[0:start-1]
- let dict = HaddockIndexLookup(name)
- if dict=={} | return | endif
- let keylist = map(deepcopy(keys(dict)),'substitute(v:val,"\\[.\\]","","")')
- if has("gui_running")
- for key in keylist
- " exe 'amenu ]Popup.'.escape(key,'\.').' :call append(search("\\%1c\\(import\\\\|module\\\\|{-# OPTIONS\\)","nb"),"import '.key.importlist.'")<cr>'
- exe 'amenu ]Popup.'.escape(key,'\.').' :call append(search(''\%1c\(\<import\>\\|\<module\>\\|{-# OPTIONS\\|{-# LANGUAGE\)'',''nb''),''import '.qualified.key.escape(importlist,'|').''')<cr>'
- endfor
- popup ]Popup
- else
- let s:choices = keylist
- let key = input('import '.name.' from: ','','customlist,CompleteAux')
- if key!=''
- exe 'call append(search(''\%1c\(\<import\>\|\<module\>\|{-# OPTIONS\|{-# LANGUAGE\)'',''nb''),''import '.qualified.key.importlist.''')'
- endif
- endif
-endfunction
-
-function! HaddockIndexLookup(name)
- call HaveIndex()
- if !has_key(g:haddock_index,a:name)
- echoerr a:name 'not found in haddock index'
- return {}
- endif
- return g:haddock_index[a:name]
-endfunction
-
diff --git a/.vim/ftplugin/haskell_hpaste.vim b/.vim/ftplugin/haskell_hpaste.vim
deleted file mode 100644
index 33ea0bd..0000000
--- a/.vim/ftplugin/haskell_hpaste.vim
+++ /dev/null
@@ -1,79 +0,0 @@
-" rudimentary hpaste support for vim
-" (using netrw for reading, wget for posting/annotating)
-"
-" claus reinke, last modified: 07/04/2009
-"
-" part of haskell plugins: http://projects.haskell.org/haskellmode-vim
-
-" unless wget is in your PATH, you need to set g:wget
-" before loading this script. windows users are out of
-" luck, unless they have wget installed (such as the
-" cygwin one looked for here), or adapt this script to
-" whatever alternative they have at hand (perhaps using
-" vim's perl/python bindings?)
-if !exists("g:wget")
- if executable("wget")
- let g:wget = "!wget -q"
- else
- let g:wget = "!c:\\cygwin\\bin\\wget -q"
- endif
-endif
-
-" read (recent) hpaste files
-" show index in new buffer, where ,r will open current entry
-" and ,p will annotate current entry with current buffer
-command! HpasteIndex call HpasteIndex()
-function! HpasteIndex()
- new
- read http://hpaste.org
- %s/\_$\_.//g
- %s/<tr[^>]*>//g
- %s/<\/tr>/ /g
- g/<\/table>/d
- g/DOCTYPE/d
- %s/<td>\([^<]*\)<\/td><td><a href="\/fastcgi\/hpaste\.fcgi\/view?id=\([0-9]*\)">\([^<]*\)<\/a><\/td><td>\([^<]*\)<\/td><td>\([^<]*\)<\/td><td>\([^<]*\)<\/td>/\2 [\1] "\3" \4 \5 \6/
- map <buffer> ,r 0yE:noh<cr>:call HpasteEditEntry('"')<cr>
-endfunction
-
-" load an existing entry for editing
-command! -nargs=1 HpasteEditEntry call HpasteEditEntry(<f-args>)
-function! HpasteEditEntry(entry)
- new
- exe 'Nread http://hpaste.org/fastcgi/hpaste.fcgi/raw?id='.a:entry
- "exe 'map <buffer> ,p :call HpasteAnnotate('''.a:entry.''')<cr>'
-endfunction
-
-" " posting temporarily disabled -- needs someone to look into new
-" " hpaste.org structure
-
-" " annotate existing entry (only to be called via ,p in HpasteIndex)
-" function! HpasteAnnotate(entry)
-" let nick = input("nick? ")
-" let title = input("title? ")
-" if nick=='' || title==''
-" echo "nick or title missing. aborting annotation"
-" return
-" endif
-" call HpastePost('annotate/'.a:entry,nick,title)
-" endfunction
-"
-" " post new hpaste entry
-" " using 'wget --post-data' and url-encoded content
-" command! HpastePostNew call HpastePost('new',<args>)
-" function! HpastePost(mode,nick,title,...)
-" let lines = getbufline("%",1,"$")
-" let pat = '\([^[:alnum:]]\)'
-" let code = '\=printf("%%%02X",char2nr(submatch(1)))'
-" let lines = map(lines,'substitute(v:val."\r\n",'''.pat.''','''.code.''',''g'')')
-"
-" let url = 'http://hpaste.org/' . a:mode
-" let nick = substitute(a:nick,pat,code,'g')
-" let title = substitute(a:title,pat,code,'g')
-" if a:0==0
-" let announce = 'false'
-" else
-" let announce = a:1
-" endif
-" let cmd = g:wget.' --post-data="content='.join(lines,'').'&nick='.nick.'&title='.title.'&announce='.announce.'" '.url
-" exe escape(cmd,'%')
-" endfunction
diff --git a/.vim/ftplugin/java/CTree.vim b/.vim/ftplugin/java/CTree.vim
deleted file mode 100644
index a67fdbc..0000000
--- a/.vim/ftplugin/java/CTree.vim
+++ /dev/null
@@ -1,240 +0,0 @@
-" -------------------------------------------------------------------
-" CTree.vim -- Display Class/Interface Hierarchy "{{{
-"
-" Author: Yanbiao Zhao (yanbiao_zhao at yahoo.com)
-" Requires: Vim 7
-" Version: 1.1.2
-"
-" Command:
-" CTree -- Display a tree of Class/Interface hierarchy
-" CTag -- Jump to the class/interface definition of the tag
-" }}}
-
-if v:version < 700
- echomsg "Vim 7 or higher is required for CTree.vim"
- finish
-endif
-
-command! -nargs=1 -complete=tag CTree call s:CTree_GetTypeTree(<f-args>)
-command! -nargs=1 -complete=tag CTag call s:CT_Jump_To_ClassName(<f-args>)
-
-"Short cut to use the commands
-"nmap <silent> <M-F9> :exec "CTree ".expand("<cword>")<CR>
-"nmap <silent> <M-]> :exec "CTag ".expand("<cword>")<CR>
-
-function! s:CT_Jump_To_ClassName(className)
- let tagEntry = {}
- let tagEntry["name"] = a:className
- if s:CT_Jump_To_Class(tagEntry)== 0
- echohl WarningMsg | echo 'tag not found: '.a:className | echohl None
- endif
-endfunction
-
-let s:CTree_AllTypeEntries = []
-let s:CTree_TagEnvCache = ''
-let s:CTree_tagFilesCache = {}
-
-function! s:CTree_GetTypeTree(typeName)
- call s:CTree_LoadAllTypeEntries()
-
- let rootEntry = s:CTree_GetRootType(a:typeName, '')
-
- if empty(rootEntry)
- let rootEntry["name"] = a:typeName
- let rootEntry["namespace"] = ""
- let rootEntry["kind"] = 'c'
- let rootEntry["inherits"] = ""
- endif
-
- echohl Title | echo ' # tag' | echohl None
-
- let allEntries = []
- call s:CTree_GetChildren(allEntries, rootEntry, 0)
-
- let i = input('Choice number (<Enter> cancels):')
- let i = str2nr(i)
- if i > 0 && i <= len(allEntries)
- call s:CT_Jump_To_Class(allEntries[i-1])
- endif
-endfunction
-
-function! s:CTree_GetChildren(allEntries, rootEntry, depth)
- call add(a:allEntries, a:rootEntry)
- call s:CTree_DisplayTagEntry(len(a:allEntries), a:rootEntry, a:depth)
-
- let children = []
- let rootTypeName = a:rootEntry["name"]
- for tagEntry in s:CTree_AllTypeEntries
- if index(split(tagEntry["inherits"], ","), rootTypeName) >= 0
- call add(children, tagEntry)
- endif
- endfor
-
- let rootKind = a:rootEntry["kind"]
- for child in children
- "We only want to display class that implement an interface directly
- if child["kind"] == 'c' && rootKind == 'i'
- call add(a:allEntries, child)
- call s:CTree_DisplayTagEntry(len(a:allEntries), child, a:depth+1)
- else
- call s:CTree_GetChildren(a:allEntries, child, a:depth+1)
- endif
- endfor
-
-endfunction
-
-" Return if a tag file has changed in tagfiles()
-function! s:HasTagFileChanged()
- let result = 0
- let tagFiles = map(tagfiles(), 'escape(v:val, " ")')
- let newTagFilesCache = {}
-
- if len(tagFiles) != len(s:CTree_tagFilesCache)
- let result = 1
- endif
-
- for tagFile in tagFiles
- let currentFiletime = getftime(tagFile)
- let newTagFilesCache[tagFile] = currentFiletime
-
- if !has_key(s:CTree_tagFilesCache, tagFile)
- let result = 1
- elseif currentFiletime != s:CTree_tagFilesCache[tagFile]
- let result = 1
- endif
- endfor
-
- let s:CTree_tagFilesCache = newTagFilesCache
- return result
-endfunc
-
-function! s:CTree_LoadAllTypeEntries()
- if s:HasTagFileChanged()
- let s:CTree_AllTypeEntries = []
- else
- return
- endif
-
- echo 'Loading tag information. It may take a while...'
- let ch = 'A'
- while ch <= 'Z'
- call s:CTree_GetTypeEntryWithCh(ch)
- let ch = nr2char(char2nr(ch)+1)
- endwhile
-
- call s:CTree_GetTypeEntryWithCh('_')
-
- let ch = 'a'
- while ch <= 'z'
- call s:CTree_GetTypeEntryWithCh(ch)
- let ch = nr2char(char2nr(ch)+1)
- endwhile
-
- echo "Count of type tag entries loaded: ".len(s:CTree_AllTypeEntries)
-endfunction
-
-function! s:CTree_GetTypeEntryWithCh(ch)
- for tagEntry in taglist('^'.a:ch)
- let kind = tagEntry["kind"]
- if (kind == 'i' || kind == 'c') && has_key(tagEntry, "inherits")
- call add(s:CTree_AllTypeEntries, tagEntry)
- endif
- endfor
-endfunction
-
-function! s:CTree_GetRootType(typeName, originalKind)
- for tagEntry in taglist("^".a:typeName."$")
-
- let kind = tagEntry["kind"]
- if kind != 'c' && kind != 'i'
- continue
- endif
-
- let originalKind = a:originalKind
- if originalKind == ''
- let originalKind = kind
- elseif originalKind != tagEntry["kind"]
- "We will not accept interface as a parent of class
- return {}
- endif
-
- if !has_key(tagEntry, "inherits")
- return tagEntry
- endif
-
- "interface support multiple inheritance, so we will not try to get its
- "parent if it has more than one parent
- let parents = split(tagEntry["inherits"], ",")
- if originalKind == 'i' && len(parents) > 1
- return tagEntry
- endif
-
- for parent in parents
- let rootEntry = s:CTree_GetRootType(parent, originalKind)
-
- if !empty(rootEntry)
- return rootEntry
- endif
- endfor
-
- return tagEntry
- endfor
-
- return {}
-endfunction
-
-function! s:CTree_DisplayTagEntry(index, typeEntry, depth)
- let s = string(a:index)
- while strlen(s) < 4
- let s = ' '.s
- endwhile
-
- let s = s." "
- let i = 0
- while i < a:depth
- let s = s." "
- let i = i + 1
- endwhile
-
- let s = s.a:typeEntry["name"]
-
- if has_key(a:typeEntry, "namespace")
- let s = s.' ['.a:typeEntry["namespace"].']'
- elseif has_key(a:typeEntry, "class")
- let s = s.' <'.a:typeEntry["class"].'>'
- endif
-
- echo s
-endfunction
-
-function! s:CT_Jump_To_Class(tagEntry)
- let className = a:tagEntry["name"]
-
- if has_key(a:tagEntry, "namespace")
- let keyName = "namespace"
- elseif has_key(a:tagEntry, "class")
- let keyName = "class"
- else
- let keyName = ""
- endif
-
- if keyName == ""
- let namespace = ""
- else
- let namespace = a:tagEntry[keyName]
- endif
-
- let i = 1
- let entries = taglist('^'.className.'$')
- for entry in entries
- let kind = entry["kind"]
- if kind == 'c' || kind == 'i' || kind == 'g'
- if namespace == "" || namespace == entry[keyName]
- exec "silent ".i."tag ".className
- return 1
- endif
- endif
- let i += 1
- endfor
- return 0
-endfunction
diff --git a/.vim/ftplugin/java/java.vim b/.vim/ftplugin/java/java.vim
deleted file mode 100644
index e442356..0000000
--- a/.vim/ftplugin/java/java.vim
+++ /dev/null
@@ -1,84 +0,0 @@
-
-" Editing settings
-"set tabstop=4 shiftwidth=4 expandtab textwidth=90
-
-" Syntax highlighting settings.
-"let g:java_allow_cpp_keywords=1
-"syntax on
-
-" Comma (,) prefixes a KEYWORD abbreviation
-inoremap <buffer> ,c class
-inoremap <buffer> ,i interface
-inoremap <buffer> ,I implements
-inoremap <buffer> ,m import
-inoremap <buffer> ,f final
-inoremap <buffer> ,s static
-inoremap <buffer> ,y synchronized
-inoremap <buffer> ,e extends
-inoremap <buffer> ,p public
-inoremap <buffer> ,P private
-inoremap <buffer> ,o protected
-inoremap <buffer> ,f final
-inoremap <buffer> ,s static
-inoremap <buffer> ,y synchronized
-inoremap <buffer> ,a package
-
-" Colon (:) prefixes a FLOW abbreviation
-
-inoremap <buffer> :f for
-inoremap <buffer> :w while
-inoremap <buffer> :s switch
-inoremap <buffer> :C case
-inoremap <buffer> :b break
-inoremap <buffer> :d default
-inoremap <buffer> :i if
-inoremap <buffer> :r return
-inoremap <buffer> :t try
-inoremap <buffer> :c catch
-inoremap <buffer> :f finally
-inoremap <buffer> :T throws
-inoremap <buffer> :R throw
-
-" CTRL + T (^T) prefixes a TYPE abbreviation
-
-inoremap <buffer> <C-T>i int
-inoremap <buffer> <C-T>I Integer
-inoremap <buffer> <C-T>l long
-inoremap <buffer> <C-T>L Long
-inoremap <buffer> <C-T>b boolean
-inoremap <buffer> <C-T>B Boolean
-inoremap <buffer> <C-T>c char
-inoremap <buffer> <C-T>C Char
-inoremap <buffer> <C-T>d Double
-inoremap <buffer> <C-T>D Double
-inoremap <buffer> <C-T>v void
-inoremap <buffer> <C-T>V Void
-inoremap <buffer> <C-T>s String
-inoremap <buffer> <C-T>S String
-inoremap <buffer> <C-T>e Exception
-inoremap <buffer> <C-T>E Exception
-
-" CTRL + Underscore (_) prefixes a GENERAL abbreviation
-
-inoremap <buffer> <C-_>m public static void main(String args[])
-inoremap <buffer> <C-_>o System.out.println(X);<Esc>FXs
-inoremap <buffer> <C-_>e System.err.println(X);<Esc>FXs
-inoremap <buffer> <C-_>t true
-inoremap <buffer> <C-_>f false
-inoremap <buffer> <C-_>E e.printStackTrace();
-inoremap <buffer> <C-_>C <C-V><code>
-inoremap <buffer> <C-_>c <C-V></code>
-
-" Helpful mappings when creating a new object
-" Type: Object o<F2>
-" Get: Object o = new Object();
-" F3 leaves the cursor between the parentheses.
-inoremap <buffer> <F2> <C-O>A = new <Esc>^yE<End>pA();<CR>
-inoremap <buffer> <F3> <C-O>A = new <Esc>^yE<End>pA();<Left><Left>
-
-" To create a javadoc comment above the current line
-nnoremap Zc O/**<CR><BS>*<CR>*/<Up><Space>
-
-" Useful when editing javadoc comments
-nnoremap ZR :se formatoptions+=ro<CR>
-nnoremap Zr :se formatoptions-=ro<CR>
diff --git a/.vim/ftplugin/java/java_getset.vim b/.vim/ftplugin/java/java_getset.vim
deleted file mode 100644
index 6a906e9..0000000
--- a/.vim/ftplugin/java/java_getset.vim
+++ /dev/null
@@ -1,871 +0,0 @@
-" Vim filetype plugin file for adding getter/setter methods
-" Language: Java
-" Maintainer: Pete Kazmier (pete-vim AT kazmier DOT com)
-" Last Change: 2002 Nov 21
-" Revision: $Id: java_getset.vim,v 1.10 2002/12/02 15:14:31 kaz Exp $
-" Credit:
-" - Based on jcommenter.vim by Kalle Björklid <bjorklid@st.jyu.fi.
-" - Thanks to Dan Sharp for his feedback, suggestions and help.
-" - Thanks to Steven Op de beeck for his feedback and help.
-"
-" =======================================================================
-"
-" Copyright 2002 by Peter Kazmier
-"
-" Redistribution and use in source and binary forms, with or without
-" modification, are permitted provided that the following conditions
-" are met:
-"
-" 1. Redistributions of source code must retain the above copyright
-" notice, this list of conditions and the following disclaimer.
-"
-" 2. Redistributions in binary form must reproduce the above
-" copyright notice, this list of conditions and the following
-" disclaimer in the documentation and/or other materials provided
-" with the distribution.
-"
-" 3. The name of the author may not be used to endorse or promote
-" products derived from this software without specific prior
-" written permission.
-"
-" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"
-" =======================================================================
-"
-" DESCRIPTION
-" This filetype plugin enables a user to automatically add getter/setter
-" methods for Java properties. The script will insert a getter, setter,
-" or both depending on the command/mapping invoked. Users can select
-" properties one at a time, or in bulk (via a visual block or specifying a
-" range). In either case, the selected block may include comments as they
-" will be ignored during the parsing. For example, you could select all
-" of these properties with a single visual block.
-"
-" public class Test
-" {
-" // The global count
-" private static int count;
-"
-" /** The name */
-" private String name;
-"
-" /** The array of addresses */
-" private String[] address;
-" }
-"
-" The script will also add the 'static' modifier to the method if the
-" property was declared as 'static'. Array-based properties will get
-" additional methods added to support indexing. In addition, if a
-" property is declared 'final', it will not generate a setter for it.
-" If a previous getter OR setter exists for a property, the script will
-" not add any methods (under the assumption that you've manually added
-" your own).
-"
-" The getters/setters that are inserted can be configured by the user.
-" First, the insertion point can be selected. It can be one of the
-" following: before the current line / block, after the current line /
-" block, or at the end of the class (default). Finally, the text that is
-" inserted can be configured by defining your own templates. This allows
-" the user to format for his/her coding style. For example, the default
-" value for s:javagetset_getterTemplate is:
-"
-" /**
-" * Get %varname%.
-" *
-" * @return %varname% as %type%.
-" */
-" %modifiers% %type% %funcname%()
-" {
-" return %varname%;
-" }
-"
-" Where the items surrounded by % are parameters that are substituted when
-" the script is invoked on a particular property. For more information on
-" configuration, please see the section below on the INTERFACE.
-"
-" INTERFACE (commands, mappings, and variables)
-" The following section documents the commands, mappings, and variables
-" used to customize the behavior of this script.
-"
-" Commands:
-" :InsertGetterSetter
-" Inserts a getter/setter for the property on the current line, or
-" the range of properties specified via a visual block or x,y range
-" notation. The user is prompted to determine what type of method
-" to insert.
-"
-" :InsertGetterOnly
-" Inserts a getter for the property on the current line, or the
-" range of properties specified via a visual block or x,y range
-" notation. The user is not prompted.
-"
-" :InsertSetterOnly
-" Inserts a setter for the property on the current line, or the
-" range of properties specified via a visual block or x,y range
-" notation. The user is not prompted.
-"
-" :InsertBothGetterSetter
-" Inserts a getter and setter for the property on the current line,
-" or the range of properties specified via a visual block or x,y
-" range notation. The user is not prompted.
-"
-"
-" Mappings:
-" The following mappings are pre-defined. You can disable the mappings
-" by setting a variable (see the Variables section below). The default
-" key mappings use the <LocalLeader> which is the backslash key by
-" default '\'. This can also be configured via a variable (see below).
-"
-" <LocalLeader>p (or <Plug>JavagetsetInsertGetterSetter)
-" Inserts a getter/setter for the property on the current line, or
-" the range of properties specified via a visual block. User is
-" prompted for choice.
-"
-" <LocalLeader>g (or <Plug>JavagetsetInsertGetterOnly)
-" Inserts a getter for the property on the current line, or the
-" range of properties specified via a visual block. User is not
-" prompted.
-"
-" <LocalLeader>s (or <Plug>JavagetsetInsertSetterOnly)
-" Inserts a getter for the property on the current line, or the
-" range of properties specified via a visual block. User is not
-" prompted.
-"
-" <LocalLeader>b (or <Plug>JavagetsetInsertBothGetterSetter)
-" Inserts both a getter and setter for the property on the current
-" line, or the range of properties specified via a visual block.
-" User is not prompted.
-"
-" If you want to define your own mapping, you can map whatever you want
-" to <Plug>JavagetsetInsertGetterSetter (or any of the other <Plug>s
-" defined above). For example,
-"
-" map <buffer> <C-p> <Plug>JavagetsetInsertGetterSetter
-"
-" When you define your own mapping, the default mapping does not get
-" set, only the mapping you specify.
-"
-" Variables:
-" The following variables allow you to customize the behavior of this
-" script so that you do not need to make changes directly to the script.
-" These variables can be set in your vimrc.
-"
-" no_plugin_maps
-" Setting this variable will disable all key mappings defined by any
-" of your plugins (if the plugin writer adhered to the standard
-" convention documented in the scripting section of the VIM manual)
-" including this one.
-"
-" no_java_maps
-" Setting this variable will disable all key mappings defined by any
-" java specific plugin including this one.
-"
-" maplocalleader
-" By default, the key mappings defined by this script use
-" <LocalLeader> which is the backslash character by default. You can
-" change this by setting this variable to a different key. For
-" example, if you want to use the comma-key, you can add this line to
-" your vimrc:
-"
-" let maplocalleader = ','
-"
-" b:javagetset_insertPosition
-" This variable determines the location where the getter and/or setter
-" will be inserted. Currently, three positions have been defined:
-"
-" 0 - insert at the end of the class (default)
-" 1 - insert before the current line / block
-" 2 - insert after the current line / block
-"
-" b:javagetset_getterTemplate
-" b:javagetset_setterTemplate
-" b:javagetset_getterArrayTemplate
-" b:javagetset_setterArrayTemplate
-" These variables determine the text that will be inserted for a
-" getter, setter, array-based getter, and array-based setter
-" respectively. The templates may contain the following placeholders
-" which will be substituted by their appropriate values at insertion
-" time:
-"
-" %type% Java type of the property
-" %varname% The name of the property
-" %funcname% The method name ("getXzy" or "setXzy")
-" %modifiers% "public" followed by "static" if the property is static
-"
-" For example, if you wanted to set the default getter template so
-" that it would produce the following block of code for a property
-" defined as "public static String name":
-"
-" /**
-" * Get name.
-" * @return name as String
-" */
-" public static String getName() { return name; }
-"
-" This block of code can be produced by adding the following variable
-" definition to your vimrc file.
-"
-" let b:javagetset_getterTemplate =
-" \ "\n" .
-" \ "/**\n" .
-" \ " * Get %varname%.\n" .
-" \ " * @return %varname% as %type%.\n" .
-" \ " */\n" .
-" \ "%modifiers% %type% %funcname%() { return %varname%; }"
-"
-" The defaults for these variables are defined in the script. For
-" both the getterTemplate and setterTemplate, there is a corresponding
-" array-baded template that is invoked if a property is array-based.
-" This allows you to set indexed-based getters/setters if you desire.
-" This is the default behavior.
-"
-"
-" INSTALLATION
-" 1. Copy the script to your ${HOME}/.vim/ftplugins directory and make
-" sure its named "java_getset.vim" or "java_something.vim" where
-" "something" can be anything you want.
-"
-" 2. (Optional) Customize the mapping and/or templates. You can create
-" your own filetype plugin (just make sure its loaded before this one)
-" and set the variables in there (i.e. ${HOME}/.vim/ftplugin/java.vim)
-"
-" =======================================================================
-"
-" NOTE:
-" This is my very first VIM script. I read all of the documentation, and
-" have tried to follow the conventions outlined there; however, I may have
-" missed some so please bear with me.
-
-" Only do this when not done yet for this buffer
-if exists("b:did_javagetset_ftplugin")
- finish
-endif
-let b:did_javagetset_ftplugin = 1
-
-" Make sure we are in vim mode
-let s:save_cpo = &cpo
-set cpo&vim
-
-" TEMPLATE SECTION:
-" The templates can use the following placeholders which will be replaced
-" with appropriate values when the template is invoked:
-"
-" %type% Java type of the property
-" %varname% The name of the property
-" %funcname% The method name ("getXzy" or "setXzy")
-" %modifiers% "public" followed by "static" if the property is static
-"
-" The templates consist of a getter and setter template. In addition,
-" there are also templates for array-based properties. These are defined
-" below.
-"
-" Getter Templates (non-array and array-based)
-if exists("b:javagetset_getterTemplate")
- let s:javagetset_getterTemplate = b:javagetset_getterTemplate
-else
- let s:javagetset_getterTemplate =
- \ "\n" .
- \ "/**\n" .
- \ " * Get %varname%.\n" .
- \ " *\n" .
- \ " * @return %varname% as %type%.\n" .
- \ " */\n" .
- \ "%modifiers% %type% %funcname%()\n" .
- \ "{\n" .
- \ " return %varname%;\n" .
- \ "}"
-endif
-
-if exists("b:javagetset_getterArrayTemplate")
- let s:javagetset_getterArrayTemplate = b:javagetset_getterArrayTemplate
-else
- let s:javagetset_getterArrayTemplate =
- \ "\n" .
- \ "/**\n" .
- \ " * Get %varname%.\n" .
- \ " *\n" .
- \ " * @return %varname% as %type%[].\n" .
- \ " */\n" .
- \ "%modifiers% %type%[] %funcname%()\n" .
- \ "{\n" .
- \ " return %varname%;\n" .
- \ "}\n" .
- \ "\n" .
- \ "/**\n" .
- \ " * Get %varname% element at specified index.\n" .
- \ " *\n" .
- \ " * @param index the index.\n" .
- \ " * @return %varname% at index as %type%.\n" .
- \ " */\n" .
- \ "%modifiers% %type% %funcname%(int index)\n" .
- \ "{\n" .
- \ " return %varname%[index];\n" .
- \ "}"
-endif
-
-" Setter Templates (non-array and array-based)
-if exists("b:javagetset_setterTemplate")
- let s:javagetset_setterTemplate = b:javagetset_setterTemplate
-else
- let s:javagetset_setterTemplate =
- \ "\n" .
- \ "/**\n" .
- \ " * Set %varname%.\n" .
- \ " *\n" .
- \ " * @param %varname% the value to set.\n" .
- \ " */\n" .
- \ "%modifiers% void %funcname%(%type% %varname%)\n" .
- \ "{\n" .
- \ " this.%varname% = %varname%;\n" .
- \ "}"
-endif
-
-if exists("b:javagetset_setterArrayTemplate")
- let s:javagetset_setterArrayTemplate = b:javagetset_setterArrayTemplate
-else
- let s:javagetset_setterArrayTemplate =
- \ "\n" .
- \ "/**\n" .
- \ " * Set %varname%.\n" .
- \ " *\n" .
- \ " * @param %varname% the value to set.\n" .
- \ " */\n" .
- \ "%modifiers% void %funcname%(%type%[] %varname%)\n" .
- \ "{\n" .
- \ " this.%varname% = %varname%;\n" .
- \ "}\n" .
- \ "\n" .
- \ "/**\n" .
- \ " * Set %varname% at the specified index.\n" .
- \ " *\n" .
- \ " * @param %varname% the value to set.\n" .
- \ " * @param index the index.\n" .
- \ " */\n" .
- \ "%modifiers% void %funcname%(%type% %varname%, int index)\n" .
- \ "{\n" .
- \ " this.%varname%[index] = %varname%;\n" .
- \ "}"
-endif
-
-" Position where methods are inserted. The possible values are:
-" 0 - end of class
-" 1 = above block / line
-" 2 = below block / line
-if exists("b:javagetset_insertPosition")
- let s:javagetset_insertPosition = b:javagetset_insertPosition
-else
- let s:javagetset_insertPosition = 0
-endif
-
-" Script local variables that are used like globals.
-"
-" If set to 1, the user has requested that getters be inserted
-let s:getter = 0
-
-" If set to 1, the user has requested that setters be inserted
-let s:setter = 0
-
-" If set to 1, the property was a static property (i.e. static methods)
-let s:static = 0
-
-" If set to 1, the property was declared final (i.e. doesn't need a setter)
-let s:final = 0
-
-" If set to 1, use the array based templates
-let s:isarray = 0
-
-" The current indentation level of the property (i.e. used for the methods)
-let s:indent = ''
-
-" The list of property modifiers
-let s:modifiers = ''
-
-" The type of the property
-let s:vartype = ''
-
-" If the property is an array, the []'s will be stored here
-let s:vararray = ''
-
-" The name of the property
-let s:varname = ''
-
-" The function name of the property (capitalized varname)
-let s:funcname = ''
-
-" The first line of the block selected
-let s:firstline = 0
-
-" The last line of the block selected
-let s:lastline = 0
-
-" Regular expressions used to match property statements
-let s:javaname = '[a-zA-Z_$][a-zA-Z0-9_$]*'
-let s:brackets = '\(\s*\(\[\s*\]\)\)\='
-let s:modifier = '\(private\|protected\|public\|volatile\|static\|final\)'
-let s:variable = '\(\s*\)\(\(' . s:modifier . '\s\+\)*\)\(' . s:javaname . '\)' . s:brackets . '\s\+\(' . s:javaname . '\)\s*\(;\|=[^;]\+;\)'
-
-" The main entry point. This function saves the current position of the
-" cursor without the use of a mark (see note below) Then the selected
-" region is processed for properties.
-"
-" FIXME: I wanted to avoid clobbering any marks in use by the user, so I
-" manually try to save the current position and restore it. The only drag
-" is that the position isn't restored correctly if the user opts to insert
-" the methods ABOVE the current position. Using a mark would solve this
-" problem as they are automatically adjusted. Perhaps I just haven't
-" found it yet, but I wish that VIM would let a scripter save a mark and
-" then restore it later. Why? In this case, I'd be able to use a mark
-" safely without clobbering any user marks already set. First, I'd save
-" the contents of the mark, then set the mark, do my stuff, jump back to
-" the mark, and finally restore the mark to what the user may have had
-" previously set. Seems weird to me that you can't save/restore marks.
-"
-if !exists("*s:InsertGetterSetter")
- function s:InsertGetterSetter(flag) range
- let restorepos = line(".") . "normal!" . virtcol(".") . "|"
- let s:firstline = a:firstline
- let s:lastline = a:lastline
-
- if s:DetermineAction(a:flag)
- call s:ProcessRegion(s:GetRangeAsString(a:firstline, a:lastline))
- endif
-
- execute restorepos
-
- " Not sure why I need this but if I don't have it, the drawing on the
- " screen is messed up from my insert. Perhaps I'm doing something
- " wrong, but it seems to me that I probably shouldn't be calling
- " redraw.
- redraw!
-
- endfunction
-endif
-
-" Set the appropriate script variables (s:getter and s:setter) to
-" appropriate values based on the flag that was selected. The current
-" valid values for flag are: 'g' for getter, 's' for setter, 'b' for both
-" getter/setter, and 'a' for ask/prompt user.
-if !exists("*s:DetermineAction")
- function s:DetermineAction(flag)
-
- if a:flag == 'g'
- let s:getter = 1
- let s:setter = 0
-
- elseif a:flag == 's'
- let s:getter = 0
- let s:setter = 1
-
- elseif a:flag == 'b'
- let s:getter = 1
- let s:setter = 1
-
- elseif a:flag == 'a'
- return s:DetermineAction(s:AskUser())
-
- else
- return 0
- endif
-
- return 1
- endfunction
-endif
-
-" Ask the user what they want to insert, getter, setter, or both. Return
-" an appropriate flag for use with s:DetermineAction, or return 0 if the
-" user cancelled out.
-if !exists("*s:AskUser")
- function s:AskUser()
- let choice =
- \ confirm("What do you want to insert?",
- \ "&Getter\n&Setter\n&Both", 3)
-
- if choice == 0
- return 0
-
- elseif choice == 1
- return 'g'
-
- elseif choice == 2
- return 's'
-
- elseif choice == 3
- return 'b'
-
- else
- return 0
-
- endif
- endfunction
-endif
-
-" Gets a range specified by a first and last line and returns it as a
-" single string that will eventually be parsed using regular expresssions.
-" For example, if the following lines were selected:
-"
-" // Age
-" private int age;
-"
-" // Name
-" private static String name;
-"
-" Then, the following string would be returned:
-"
-" // Age private int age; // Name priavte static String name;
-"
-if !exists("*s:GetRangeAsString")
- function s:GetRangeAsString(first, last)
- let line = a:first
- let string = s:TrimRight(getline(line))
-
- while line < a:last
- let line = line + 1
- let string = string . s:TrimRight(getline(line))
- endwhile
-
- return string
- endfunction
-endif
-
-" Trim whitespace from right of string.
-if !exists("*s:TrimRight")
- function s:TrimRight(text)
- return substitute(a:text, '\(\.\{-}\)\s*$', '\1', '')
- endfunction
-endif
-
-" Process the specified region indicated by the user. The region is
-" simply a concatenated string of the lines that were selected by the
-" user. This string is searched for properties (that match the s:variable
-" regexp). Each property is then processed. For example, if the region
-" was:
-"
-" // Age private int age; // Name priavte static String name;
-"
-" Then, the following strings would be processed one at a time:
-"
-" private int age;
-" private static String name;
-"
-if !exists("*s:ProcessRegion")
- function s:ProcessRegion(region)
- let startPosition = match(a:region, s:variable, 0)
- let endPosition = matchend(a:region, s:variable, 0)
-
- while startPosition != -1
- let result = strpart(a:region, startPosition, endPosition - startPosition)
-
- "call s:DebugParsing(result)
- call s:ProcessVariable(result)
-
- let startPosition = match(a:region, s:variable, endPosition)
- let endPosition = matchend(a:region, s:variable, endPosition)
- endwhile
-
- endfunction
-endif
-
-" Process a single property. The first thing this function does is
-" break apart the property into the following components: indentation,
-" modifiers ,type, array, and name. In addition, the following other
-" components are then derived from the previous: funcname, static,
-" final, and isarray. For example, if the specified variable was:
-"
-" private static String name;
-"
-" Then the following would be set for the global variables:
-"
-" indent = ' '
-" modifiers = 'private static'
-" vartype = 'String'
-" vararray = ''
-" varname = 'name'
-" funcname = 'Name'
-" static = 1
-" final = 0
-" isarray = 0
-"
-if !exists("*s:ProcessVariable")
- function s:ProcessVariable(variable)
- let s:static = 0
- let s:isarray = 0
- let s:final = 0
- let s:indent = substitute(a:variable, s:variable, '\1', '')
- let s:modifiers = substitute(a:variable, s:variable, '\2', '')
- let s:vartype = substitute(a:variable, s:variable, '\5', '')
- let s:vararray = substitute(a:variable, s:variable, '\7', '')
- let s:varname = substitute(a:variable, s:variable, '\8', '')
- let s:funcname = toupper(s:varname[0]) . strpart(s:varname, 1)
-
- " If any getter or setter already exists, then just return as there
- " is nothing to be done. The assumption is that the user already
- " made his choice.
- if s:AlreadyExists()
- return
- endif
-
- if s:modifiers =~ 'static'
- let s:static = 1
- endif
-
- if s:modifiers =~ 'final'
- let s:final = 1
- endif
-
- if s:vararray =~ '['
- let s:isarray = 1
- endif
-
- if s:getter
- call s:InsertGetter()
- endif
-
- if s:setter && !s:final
- call s:InsertSetter()
- endif
-
- endfunction
-endif
-
-" Checks to see if any getter/setter exists.
-if !exists("*s:AlreadyExists")
- function s:AlreadyExists()
- return search('\(get\|set\)' . s:funcname . '\_s*([^)]*)\_s*{', 'w')
- endfunction
-endif
-
-" Inserts a getter by selecting the appropriate template to use and then
-" populating the template parameters with actual values.
-if !exists("*s:InsertGetter")
- function s:InsertGetter()
-
- if s:isarray
- let method = s:javagetset_getterArrayTemplate
- else
- let method = s:javagetset_getterTemplate
- endif
-
- let mods = "public"
- if s:static
- let mods = mods . " static"
- endif
-
- let method = substitute(method, '%type%', s:vartype, 'g')
- let method = substitute(method, '%varname%', s:varname, 'g')
- let method = substitute(method, '%funcname%', 'get' . s:funcname, 'g')
- let method = substitute(method, '%modifiers%', mods, 'g')
-
- call s:InsertMethodBody(method)
-
- endfunction
-endif
-
-" Inserts a setter by selecting the appropriate template to use and then
-" populating the template parameters with actual values.
-if !exists("*s:InsertSetter")
- function s:InsertSetter()
-
- if s:isarray
- let method = s:javagetset_setterArrayTemplate
- else
- let method = s:javagetset_setterTemplate
- endif
-
- let mods = "public"
- if s:static
- let mods = mods . " static"
- endif
-
- let method = substitute(method, '%type%', s:vartype, 'g')
- let method = substitute(method, '%varname%', s:varname, 'g')
- let method = substitute(method, '%funcname%', 'set' . s:funcname, 'g')
- let method = substitute(method, '%modifiers%', mods, 'g')
-
- call s:InsertMethodBody(method)
-
- endfunction
-endif
-
-" Inserts a body of text using the indentation level. The passed string
-" may have embedded newlines so we need to search for each "line" and then
-" call append separately. I couldn't figure out how to get a string with
-" newlines to be added in one single call to append (it kept inserting the
-" newlines as ^@ characters which is not what I wanted).
-if !exists("*s:InsertMethodBody")
- function s:InsertMethodBody(text)
- call s:MoveToInsertPosition()
-
- let pos = line('.')
- let string = a:text
-
- while 1
- let len = stridx(string, "\n")
-
- if len == -1
- call append(pos, s:indent . string)
- break
- endif
-
- call append(pos, s:indent . strpart(string, 0, len))
-
- let pos = pos + 1
- let string = strpart(string, len + 1)
-
- endwhile
- endfunction
-endif
-
-" Move the cursor to the insertion point. This insertion point can be
-" defined by the user by setting the b:javagetset_insertPosition variable.
-if !exists("*s:MoveToInsertPosition")
- function s:MoveToInsertPosition()
-
- " 1 indicates above the current block / line
- if s:javagetset_insertPosition == 1
- execute "normal! " . (s:firstline - 1) . "G0"
-
- " 2 indicates below the current block / line
- elseif s:javagetset_insertPosition == 2
- execute "normal! " . s:lastline . "G0"
-
- " 0 indicates end of class (and is default)
- else
- execute "normal! ?{\<CR>w99[{%k" | nohls
-
- endif
-
- endfunction
-endif
-
-" Debug code to decode the properties.
-if !exists("*s:DebugParsing")
- function s:DebugParsing(variable)
- echo 'DEBUG: ===================================================='
- echo 'DEBUG:' a:variable
- echo 'DEBUG: ----------------------------------------------------'
- echo 'DEBUG: indent:' substitute(a:variable, s:variable, '\1', '')
- echo 'DEBUG: modifiers:' substitute(a:variable, s:variable, '\2', '')
- echo 'DEBUG: type:' substitute(a:variable, s:variable, '\5', '')
- echo 'DEBUG: array:' substitute(a:variable, s:variable, '\7', '')
- echo 'DEBUG: name:' substitute(a:variable, s:variable, '\8', '')
- echo ''
- endfunction
-endif
-
-" Add mappings, unless the user didn't want this. I'm still not clear why
-" I need to have two (2) noremap statements for each, but that is what the
-" example shows in the documentation so I've stuck with that convention.
-" Ideally, I'd prefer to use only one noremap line and map the <Plug>
-" directly to the ':call <SID>function()<CR>'.
-if !exists("no_plugin_maps") && !exists("no_java_maps")
- if !hasmapto('<Plug>JavagetsetInsertGetterSetter')
- map <unique> <buffer> <LocalLeader>p <Plug>JavagetsetInsertGetterSetter
- endif
- noremap <buffer> <script>
- \ <Plug>JavagetsetInsertGetterSetter
- \ <SID>InsertGetterSetter
- noremap <buffer>
- \ <SID>InsertGetterSetter
- \ :call <SID>InsertGetterSetter('a')<CR>
-
- if !hasmapto('<Plug>JavagetsetInsertGetterOnly')
- map <unique> <buffer> <LocalLeader>g <Plug>JavagetsetInsertGetterOnly
- endif
- noremap <buffer> <script>
- \ <Plug>JavagetsetInsertGetterOnly
- \ <SID>InsertGetterOnly
- noremap <buffer>
- \ <SID>InsertGetterOnly
- \ :call <SID>InsertGetterSetter('g')<CR>
-
- if !hasmapto('<Plug>JavagetsetInsertSetterOnly')
- map <unique> <buffer> <LocalLeader>s <Plug>JavagetsetInsertSetterOnly
- endif
- noremap <buffer> <script>
- \ <Plug>JavagetsetInsertSetterOnly
- \ <SID>InsertSetterOnly
- noremap <buffer>
- \ <SID>InsertSetterOnly
- \ :call <SID>InsertGetterSetter('s')<CR>
-
- if !hasmapto('<Plug>JavagetsetInsertBothGetterSetter')
- map <unique> <buffer> <LocalLeader>b <Plug>JavagetsetInsertBothGetterSetter
- endif
- noremap <buffer> <script>
- \ <Plug>JavagetsetInsertBothGetterSetter
- \ <SID>InsertBothGetterSetter
- noremap <buffer>
- \ <SID>InsertBothGetterSetter
- \ :call <SID>InsertGetterSetter('b')<CR>
-endif
-
-" Add commands, unless already set.
-if !exists(":InsertGetterSetter")
- command -range -buffer
- \ InsertGetterSetter
- \ :<line1>,<line2>call s:InsertGetterSetter('a')
-endif
-if !exists(":InsertGetterOnly")
- command -range -buffer
- \ InsertGetterOnly
- \ :<line1>,<line2>call s:InsertGetterSetter('g')
-endif
-if !exists(":InsertSetterOnly")
- command -range -buffer
- \ InsertSetterOnly
- \ :<line1>,<line2>call s:InsertGetterSetter('s')
-endif
-if !exists(":InsertBothGetterSetter")
- command -range -buffer
- \ InsertBothGetterSetter
- \ :<line1>,<line2>call s:InsertGetterSetter('b')
-endif
-
-let &cpo = s:save_cpo
-
-"if !exists("*s:InsertText")
-" function s:InsertText(text)
-" let pos = line('.')
-" let beg = 0
-" let len = stridx(a:text, "\n")
-"
-" while beg < strlen(a:text)
-" if len == -1
-" call append(pos, s:indent . strpart(a:text, beg))
-" break
-" endif
-"
-" call append(pos, s:indent . strpart(a:text, beg, len))
-" let pos = pos + 1
-" let beg = beg + len + 1
-" let len = stridx(strpart(a:text, beg), "\n")
-" endwhile
-"
-" " Not too sure why I have to call redraw, but weirdo things appear
-" " on the screen if I don't.
-" redraw!
-"
-" endfunction
-"endif
-"
-"if !exists("*s:InsertAccessor")
-" function s:InsertAccessor()
-" echo "InsertAccessor was called"
-" endfunction
-"endif
-"
-"if !exists("*s:SqueezeWhitespace")
-" function s:SqueezeWhitespace(string)
-" return substitute(a:string, '\_s\+', ' ', 'g')
-" endfunction
-"endif