diff --git a/vim-plugins/.filetype.vim.un~ b/vim-plugins/.filetype.vim.un~ new file mode 100644 index 0000000..eabd95d Binary files /dev/null and b/vim-plugins/.filetype.vim.un~ differ diff --git a/vim-plugins/.netrwhist b/vim-plugins/.netrwhist new file mode 100644 index 0000000..1543754 --- /dev/null +++ b/vim-plugins/.netrwhist @@ -0,0 +1,9 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =7 +let g:netrw_dirhist_1='/etc/NetworkManager/system-connections' +let g:netrw_dirhist_2='/etc/NetworkManager/system-connections/USRP' +let g:netrw_dirhist_3='/etc/NetworkManager/system-connections' +let g:netrw_dirhist_4='/etc/cron.hourly' +let g:netrw_dirhist_5='/home/viktor/Documents/Software_Development/python/hackbulgaria-python/week-10' +let g:netrw_dirhist_6='/home/viktor/Documents/Software_Development/python/hackbulgaria-python/week-10/decorators' +let g:netrw_dirhist_7='/home/viktor/Documents/Software_Development/python/HackBulgaria-Django/week-03/blog' diff --git a/vim-plugins/Rename.vim b/vim-plugins/Rename.vim new file mode 100644 index 0000000..819dccd --- /dev/null +++ b/vim-plugins/Rename.vim @@ -0,0 +1,64 @@ +" Rename.vim - Rename a buffer within Vim and on the disk +" +" Copyright June 2007-2011 by Christian J. Robinson +" +" Distributed under the terms of the Vim license. See ":help license". +" +" Usage: +" +" :Rename[!] {newname} + +command! -nargs=* -complete=file -bang Rename call Rename(, '') + +function! Rename(name, bang) + let l:name = a:name + let l:oldfile = expand('%:p') + + if bufexists(fnamemodify(l:name, ':p')) + if (a:bang ==# '!') + silent exe bufnr(fnamemodify(l:name, ':p')) . 'bwipe!' + else + echohl ErrorMsg + echomsg 'A buffer with that name already exists (use ! to override).' + echohl None + return 0 + endif + endif + + let l:status = 1 + + let v:errmsg = '' + silent! exe 'saveas' . a:bang . ' ' . l:name + + if v:errmsg =~# '^$\|^E329' + let l:lastbufnr = bufnr('$') + + if expand('%:p') !=# l:oldfile && filewritable(expand('%:p')) + if fnamemodify(bufname(l:lastbufnr), ':p') ==# l:oldfile + silent exe l:lastbufnr . 'bwipe!' + else + echohl ErrorMsg + echomsg 'Could not wipe out the old buffer for some reason.' + echohl None + let l:status = 0 + endif + + if delete(l:oldfile) != 0 + echohl ErrorMsg + echomsg 'Could not delete the old file: ' . l:oldfile + echohl None + let l:status = 0 + endif + else + echohl ErrorMsg + echomsg 'Rename failed for some reason.' + echohl None + let l:status = 0 + endif + else + echoerr v:errmsg + let l:status = 0 + endif + + return l:status +endfunction diff --git a/vim-plugins/autoload/pathogen.vim b/vim-plugins/autoload/pathogen.vim new file mode 100644 index 0000000..59a75c1 --- /dev/null +++ b/vim-plugins/autoload/pathogen.vim @@ -0,0 +1,353 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.4 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction + +function! s:Findcomplete(A,L,P) + let sep = pathogen#slash() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/vim-plugins/bundle/.asd.markdown.un~ b/vim-plugins/bundle/.asd.markdown.un~ new file mode 100644 index 0000000..d6041fc Binary files /dev/null and b/vim-plugins/bundle/.asd.markdown.un~ differ diff --git a/vim-plugins/bundle/.asd.md.un~ b/vim-plugins/bundle/.asd.md.un~ new file mode 100644 index 0000000..fa39f23 Binary files /dev/null and b/vim-plugins/bundle/.asd.md.un~ differ diff --git a/vim-plugins/bundle/.vundle/script-names.vim-scripts.org.json b/vim-plugins/bundle/.vundle/script-names.vim-scripts.org.json new file mode 100644 index 0000000..c5a91ce --- /dev/null +++ b/vim-plugins/bundle/.vundle/script-names.vim-scripts.org.json @@ -0,0 +1 @@ +["test.vim","test.zip","test_syntax.vim","ToggleCommentify.vim","DoxyGen-Syntax","keepcase.vim","ifdef-highlighting","vimbuddy.vim","buffoptions.vim","fortune.vim","drawing.vim","ctags.vim","closetag.vim","htmlcmd.vim","ccase.vim","compiler.tar.gz","ls.vim","calendar.vim","dl.vim","jcommenter.vim","info.vim","hunspchk.zip","EnhCommentify.vim","LoadHeaderFile.vim","mailbrowser.vim","vimmailr.zip","format.vim","vimxmms.tar.gz","sourceSafe.zip","python.vim","a.vim","vimrc.tcl","oravim.txt","javabean.vim","jbean.vim","vimvccmd.zip","dbhelper.tgz","matchit.zip","DrawIt","rcs-menu.vim","bufexplorer.zip","sccs-menu.vim","completeWord.py","Mail_Sig.set","Mail_mutt_alias.set","Mail_Re.set","Triggers.vim","Mail_cc.set","lh-brackets","cscope_macros.vim","calendar.vim","colorize.vim","ConvertBase.vim","TagsMenu.zip","perl.vim","oberon.vim","cvsmenu.vim","dtags","delphi.vim","Embperl_Syntax.zip","whatdomain.vim","emacs.vim","po.vim","CD.vim","_vim_wok_visualcpp01.zip","nqc.vim","vfp.vim","project.tar.gz","pt.vim.gz","dctl.vim.gz","foo.vim","word_complete.vim","aux2tags.vim","javaimp.vim","uri-ref","incfiles.vim","functags.vim","wordlist.vim","files2menu.pm","translate.vim","AppendComment.vim","let-modeline.vim","gdbvim.tar.gz","Mkcolorscheme.vim","brief.vim","plkeyb.vim","vimtips.zip","savevers.vim","vcscommand.vim","nsis.vim","borland.vim","tex.vim","express.vim","winmanager","methods.vim","sqlplus.vim","spec.vim","mail.tgz","TagsBase.zip","nlist.vim","DirDiff.vim","regview.vim","BlockHL","desert.vim","colorscheme_template.vim","SelectBuf","bufNwinUtils.vim","lightWeightArray.vim","golden.vim","torte.vim","borland.vim","idutils","MultiPrompt.vim","blue.vim","csharp.vim","cs.vim","Shell.vim","vim.vim","Decho","asu1dark.vim","Astronaut","sum.vim","quickhigh.tgz","selbuff.vim","ctx-1.15.vim","runscript.vim","random_vim_tip.tar.gz","PushPop.vim","usr2latex.pl","spellcheck.vim","PopupBuffer.vim","TableTab.vim","djgpp.vim","vim-spell.tar.gz","ada.vim","ada.vim","which.vim","VirMark.vim","oracle.vim","sql.vim","words_tools.vim","chcmdmod.vim","increment.vim","CmdlineCompl.vim","SearchCompl.vim","perl_io.vim","darkslategray.vim","undoins.vim","cisco-syntax.tar.gz","ShowMarks","EasyHtml.vim","ctags.vim","ant_menu.vim","increment.vim","autoload_cscope.vim","foldutil.vim","minibufexpl.vim","gtkvim.tgz","FavMenu.vim","auctex.vim","ruby-macros.vim","html-macros.vim","vimsh.tar.gz","libList.vim","perforce.vim","idevim.tgz","email.vim","mcant.vim","multvals.vim","TeTrIs.vim","boxdraw","tf.vim","CreateMenuPath.vim","Lineup--A-simple-text-aligner","Justify","A-better-tcl-indent","ViMail","remcmd.vim","prt_mgr.zip","SuperTab","treeexplorer","vtreeexplorer","bk-menu.vim","glib.vim","win-manager-Improved","ruby-menu.vim","renumber.vim","navajo.vim","wcd.vim","RExplorer","fortune.vim","MRU","Engspchk","vcal.vim","genutils","template-file-loader","charset.vim","ComplMenu.vim","bcbuf.vim","quickfonts.vim","DSP-Make","vimconfig","morse.vim","LaTeX-Help","MRU-Menu","ctx","Perldoc.vim","fine_blue.vim","sokoban.vim","linuxmag.vim","c.vim","lh-vim-lib","tagmenu.vim","xmms-play-and-enqueue","cmvc.vim","tex.vim","bccalc.vim","mkview.vim","VIlisp.vim","mu-template","xl_tiv.vim","night.vim","einstimer.vim","closeb","Brown","Expand-Template","search-in-runtime","Brace-Complete-for-CCpp","Smart-Tabs","spell.vim","print_bw.zip","std_c.zip","Naught-n-crosses","SourceSafe-Integration","Michaels-Standard-Settings","Hex-Output","Visual-Mapping-Maker","perforce","xul.vim","cream-capitalization","mu-marks","imaps.vim","JavaRun","Buffer-Menus","cream-ascii","vimRubyX","update_vim","bnf.vim","lid.vim","UserMenu.vim","midnight.vim","tmpl.vim","ihtml.vim","pascii","XSLT-syntax","htmlmap","lastchange.vim","manxome-foes-colorscheme","vimdoc","doc.vim","csc.vim","aspnet.vim","brief.vim","java.vim","Nsis-color","byteme.vim","scite-colors","Cool-colors","navajo-night","multi.vim","taglist.vim","User-Defined-Type-Highlighter","camo.vim","adrian.vim","PrintWithLNum","sybase.vim","Projmgr","netdict","ExecPerl","candy.vim","txt2pdf.vim","unilatex.vim","potts.vim","sessmgr","outlineMode.vim","aqua","serverlist.vim","ruby-matchit","autodate.vim","xian.vim","utl.vim","Align","bluegreen","showbrace","latextags","vimfortune","TabIndent","Vimacs","xmledit","AnsiEsc.vim","ftpluginruby.vim","pyimp.vim","sql_iabbr.vim","gnome-doc.vim","xemacs-colorscheme","fog-colorscheme","CSV-delimited-field-jumper","cream-sort","grep.vim","ipsec_conf.vim","EDIFACT-position-in-a-segment","tomatosoup.vim","xchat-log-syntax","broadcast.vim","vera.vim","f.vim","highlightline.vim","hungarian_to_english","Buffer-Search","srecord.vim","reformat.vim","multivim","JavaImp.vim","PHPcollection","JHTML-syntax-file","Nightshimmer","cfengine-syntax-file","code2html","prt_hdr","cream-progressbar","QuickAscii","bw.vim","lh-cpp","vtags","vtags_def","ASP-maps","tforge.vim","pf.vim","sand","fstab-syntax","MqlMenu.vim","lcscheck.vim","php.vim","textlink.vim","White-Dust","ruby.vim","Highlight-UnMatched-Brackets","localColorSchemes.vim","multipleRanges.vim","getVar.vim","variableSort.vim","vimrc_nopik","dbext.vim","openroad.vim","java_apidoc.vim","ABAP.vim","rcsdiff.vim","snippet.vim","opsplorer","cream-showinvisibles","bash-support.vim","ldraw.vim","DirDo.vim","oceandeep","atomcoder-vim","Expmod","timstamp.vim","Red-Black","ftpluginruby.vim","indentruby.vim","Denim","mof.vim","vim-game-of-life","ia64.vim","d.vim","PreviewTag.vim","ShowLine.vim","ShowBlockName.vim","SyntaxAttr.vim","DarkOcean.vim","ibmedit.vim","python_match.vim","rnc.vim","LbdbQuery.vim","scratch-utility","plp.vim","LaTeX-functions","ocean.vim","spectre.vim","bugfixes-to-vim-indent-for-verilog","gri.vim","scilab.vim","ShowFunc.vim","maxima.vim","ironman.vim","sean.vim","regRedir.vim","colormenu.vim","eruby.vim","getmail.vim","colour_flip.pl","blackdust.vim","CVSAnnotate.vim","beanshell.vim","svn.vim","muf.vim","tex.vim","cvopsefsa.vim","ActionScript","plsql.vim","Zenburn","Kent-Vim-Extensions","plsql.vim","Registryedit-win32","syslog-syntax-file","MySQL-script-runner","elinks.vim","eukleides.vim","jcl.vim","midnight2.vim","smlisp.vim","lustre","lustre-syntax","VimFootnotes","biogoo.vim","Get-Win32-Short-Name","Get-UNC-Path-Win32","pythonhelper","javaGetSet.vim","copycppdectoimp.vim","cppgetset.vim","titlecase.vim","stata.vim","localvimrc","lilac.vim","spacehi.vim","deldiff.vim","Syntax-for-the-BETA-programming-language","JavaDecompiler.vim","exim.vim","java_checkstyle.vim","gmt.vim","xhtml.vim","EasyAccents","draw.vim","HTML.zip","sql.vim","php_abb","xgen.vim","noweb.vim","PCP-header","vim-templates","rrd.vim","TTCoach","nw.vim","rainbow.zip","VB-Line-Number","vimspell","perl_h2xs","emodeline","VEC","fnaqevan","HTML-Photo-Board","cream-vimabbrev","mup.vim","BlockComment.vim","SearchComplete","LaTeX-Suite-aka-Vim-LaTeX","Transparent","python.vim","aj.vim","MultipleSearch","toothpik.vim","cscomment.vim","cuecat.vim","tagexplorer.vim","ddldbl.vim","markjump.vim","SAPDB_Pascal.vim","Posting","cream-keytest","ManPageView","java_getset.vim","debug.vim","SQLUtilities","Cpp-code-template-generator","ri-browser","sql.vim","poser.vim","waimea.vim","sql.vim","SpellChecker","foldlist","OO-code-completion","transvim.vim","Macromedia-Director-Lingo-Syntax","oz.vim","python_box.vim","greputil.vim","mercury.vim","ZoomWin","mailsig","Varrays","casejump.vim","Printer-Dialog","Indent-Finder","mrswin.vim","python_fold","sr.vim","TVO--The-Vim-Outliner","csv-color","CVS-conflict-highlight","PHPDoc-Script-PDocS","mru.vim","tar.vim","VimITunes.vim","Visual-Studio-.NET-compiler-file","cscope-menu","pdbvim","cppcomplete","mh","blockquote.vim","Mixed-sourceassembly-syntax-objdump","elvis-c-highlighting","colorer-color-scheme","ntservices","PHP-dictionary","tiger.vim","tiger.vim","tab-syntax","cream-email-munge","FavEx","apdl.vim","velocity.vim","russian-menu-translation","nuweb.vim","flyaccent.vim","ebnf.vim","IDLATL-Helper","as.vim","Mines","coffee.vim","adp.vim","mruex","HiCurLine","perl-support.vim","BOG","spreadsheet.vim","BufClose.vim","MPD-syntax-highlighting","help.vim","rd.vim","rcsvers.vim","ASPRecolor.vim","HTML--insert","ctrlax.vim","desc.vim","ntprocesses","caramel.vim","GTK","autolisp-help","wintersday.vim","darkdot","TEXT--fill-char","gnu-c","psp.vim","dawn","allfold","fgl.vim","autonumbering-in-vim","cg.vim","matlab.vim","comment.vim","pyljpost.vim","todolist.vim","northsky","fgl.c","JavaBrowser","seashell","BlackSea","PapayaWhip","ChocolateLiquor","guifontpp.vim","TaQua","HelpClose","colorpalette.vim","python-tools","execmap","cmake.vim","cmake.vim","vimwc.sh","vimbadword.sh","oceanblack.vim","php.vim-html-enhanced","cream-numberlines","asmMIPS","valgrind.vim","toc.vim","Qt.vim","ctags.vim","dante.vim","cpp.vim","gisdk","CRefVim","ruler.vim","Asciitable.vim","Adaryn.vim","BreakPts","brookstream","Russian-menu-for-gvimwin32","Conflict2Diff","tagsubmenu","m4pic.vim","nightwish.vim","Color-Sampler-Pack","ShowPairs","MarkShift","SeeTab","putty","resolv.conf-syntax","cf.vim","make-element","Reindent","otf.vim","sparc.vim","getdp","COMMENT.vim","WC.vim","gmsh.vim","SYN2HTML","tcsoft.vim","GetLatestVimScripts","WML-Wireless-Markup-Language-syntax","Color-Scheme-Test","greyblue.vim","colorize","DOS-Commands","fte.vim","chordpro.vim","vectorscript.vim","uniq.vim","stol.vim","ldap_schema.vim","ldif.vim","proc.vim","esperanto","epperl.vim","headers.vim","sip.vim","gpg.vim","gnupg","xml_cbks","VimDebug","scratch.vim","FeralToggleCommentify.vim","hexman.vim","Dotnet-Dictionaries","random.vim","matrix.vim","VisIncr","autumn.vim","listmaps.vim","Maxlen.vim","MakeDoxygenComment","VS-like-Class-Completion","GenerateMatlabFunctionComment","pgn.vim","genindent.vim","fluxbox.vim","ferallastchange.vim","blockhl2.vim","cschemerotate.vim","ftplugin-for-Calendar","Comment-Tools","incbufswitch.vim","feralalign.vim","VimTweak","calibre.vim","cleanphp","actionscript.vim","POD-Folder","VimSpeak","ample.vim","quancept.vim","po.vim","timecolor.vim","timecolor.vim","Visual-Cpp","NEdit","OIL.vim","cg.vim","parrot.vim","xmmsctrl.vim","isi2bib","sketch.vim","gdl.vim","msp.vim","brainfuck-syntax","sfl.vim","browser-like-scrolling-for-readonly-file","nuvola.vim","SideBar.vim","MSIL-Assembly","cygwin.vim","mupad.vim","trash.vim","wiki.vim","tagMenu","local_vimrc.vim","Hanoi-Tower","sudo.vim","co.vim","xmidas.vim","folddigest.vim","quicksession.vim","sql.vim","pam.vim","kickstart.vim","mdl.vim","gor.vim","yaml.vim","sbutils","movewin.vim","SwapHeader","svn.vim","dhcpd.vim","curcmdmode","cmdalias.vim","Intellisense-for-Vim","HelpExtractor","pic.vim","aiseered.vim","winhelp","opengl.vim","ttcn-syntax","ttcn-indent","VDLGBX.DLL","python_encoding.vim","showpairs-mutated","dusk","LogCVSCommit","peaksea","lpc.vim","hlcontext.vim","dont-click","gvim-with-tabs","VHDL-indent","ttcn-dict","mis.vim","table.vim","Source-Control","ocamlhelp.vim","umber-green","vgrep","lebrief.vim","vimcdoc","whereis.vim","highlight_cursor.vim","ntp.vim","php_console.vim","sessions.vim","pyfold","oasis.vim","gdm.vim","fluka.vim","vartabs.vim","delek.vim","qt2vimsyntax","tokens.vim","set_utf8.vim","python.vim","Relaxed-Green","simpleandfriendly.vim","ttcn-ftplugin","promela.vim","xterm16.vim","bmichaelsen","preview.vim","Walk.vim","FindMakefile","MixCase.vim","javaDoc.vim","gramadoir.vim","XQuery-syntax","expand.vim","zrf.vim","truegrid.vim","dks-il2-tex.vim","vimcommander","Smart-Diffsplit","robinhood.vim","darkblue2.vim","billw.vim","mail.vim","white.vim","HHCS_D","enumratingptn","HHCS","ephtml","rgbasm.vim","Mouse-Toggle","BlockWork","avrasm.vim","yum.vim","asmM68k.vim","find_in_files","mp.vim","Intellisense","VimNotes","gq","TT2-syntax","xmaslights.vim","smartmake","httpclog","RTF-1.6-Spec-in-Vim-Help-Format","systemc_syntax.tar.gz","selected-resizer","PureBasic-Syntax-file","macro.vim","python.vim","text.py","yo-speller","increment.vim","nasl.vim","ptl.vim","pyab","mars.vim","howto-ftplugin","SrchRplcHiGrp.vim","latex-mik.vim","Pydiction","Posting","Gothic","File-local-variables","less.vim","FX-HLSL","NSIS-2.0--Syntax","table_format.vim","LocateOpen","Destructive-Paste","inform.vim","VikiDeplate","cscope-quickfix","BlackBeauty","visual_studio.vim","unmswin.vim","Israelli-hebrew-shifted","phoneticvisual-hebrew-keyboard-mapphone","Redundant-phoneticvisual-Hebrew-keyboar","changesqlcase.vim","changeColorScheme.vim","allout.vim","Syntax-context-abbreviations","srec.vim","emacsmode","bufman.vim","automation.vim","GVColors","Posting","RegExpRef","passwd","buttercream.vim","fluxkeys.vim","ods.vim","AutoAlign","FormatBlock","FormatComment.vim","docbkhelper","armasm","EvalSelection.vim","edo_sea","pylint.vim","winpos.vim","gtags.vim","Viewing-Procmail-Log","Toggle","perl_synwrite.vim","ViewOutput","CharTab","nesC","Tower-of-Hanoi","sharp-Plugin-Added","ratfor.vim","fvl.vim","yiheb-il.vim","sql.vim","Editable-User-Interface-EUI-eui_vim","html_umlaute","nvi.vim","unicodeswitch.vim","pydoc.vim","nedit2","adam.vim","po.vim","sieve.vim","AsNeeded","Nibble","fdcc.vim","CSS-2.1-Specification","sqlldr.vim","tex_autoclose.vim","bufmenu2","svncommand.vim","timestamp.vim","html_portuquese","AutoFold.vim","russian-phonetic_utf-8.vim","colorsel.vim","XpMenu","timelog.vim","virata.vim","VimIRC.vim","TogFullscreen.vim","database-client","ftpsync","svg.vim","Karma-Decompiler","autosession.vim","newheader.vim","sccs.vim","screen.vim","edifact.vim","pqmagic.vim","ProjectBrowse","n3.vim","groovy.vim","StyleChecker--perl","2tex.vim","Scons-compiler-plugin","qf.vim","af.vim","aspnet.vim","psql.vim","multiselect","xml2latex","ToggleComment","php-doc","YAPosting","blugrine","latex_pt","replace","DumpStr.vim","RemoteSaveAll.vim","FTP-Completion","nexus.vim","uptime.vim","asmx86","php.vim-for-php5","autoit.vim","pic18fxxx","IncrediBuild.vim","folds.vim","chela_light","rest.vim","indentpython.vim","Siebel-VB-Script-SVB","Tibet","Maxscript","svn-diff.vim","idf.vim","ssa.vim","GtkFileChooser","Simple-templates","onsgmls.vim","mappinggroup.vim","metacosm.vim","ASPJScript","DoxygenToolkit.vim","VHT","pdftotext","rpl","rpl","rpl","aspvbs.vim","FiletypeRegisters","nant-compiler-script","tbf-vimfiles","Window-Sizes","menu_pt_br.vimfix","TransferChinese.vim","gtk-vim-syntax","2htmlj","glsl.vim","SearchInBuffers.vim","Docbook-XSL-compiler-file","Phrases","Olive","Lynx-Offline-Documentation-Browser","srec.vim","srec.vim","lingo.vim","buflist","lingodirector.vim","PLI-Tools","clipbrd","check-mutt-attachments.vim","corewars.vim","redcode.vim","potwiki.vim","updt.vim","revolutions.vim","feralstub.vim","Phoenity-discontinued","aftersyntax.vim","IndentHL","xmlwf.vim","Visual-Mark","errsign","log.vim","msvc2003","scalefont","uc.vim","commenter","OOP.vim","cream-iso639.vim","cream-iso3166-1","HTMLxC.vim","vimgrep.vim","array.vim","vimtabs.vim","CodeReviewer.vim","cube.vim","uc.vim","uc.vim","sf.vim","monday","ST20-compiler-plugin","R.vim","octave.vim","delete.py","groff-keymap","The-Mail-Suite-tms","browser.vim","InteractHL.vim","curBuf.vim","vsutil.vim","DavesVimPack","Menu-Autohide","pygtk_color","Vive.vim","actionscript.vim","greputils","HC12-syntax-highlighting","asp.vim","click.vim","cecutil","mingw.vim","abap.vim","vimsh","dsPIC30f","BufOnly.vim","ConfirmQuit.vim","fasm-compiler","python_calltips","netrw.vim","cscope_win","lindo.vim","VUT","replvim.sh","xmms.vim","HiColors","MS-Word-from-VIM","multiwin.vim","multiAPIsyntax","earth.vim","Black-Angus","tpp.vim","cfengine.vim","sas.vim","InsertTry.vim","VimRegEx.vim","blitzbasic.vim","Archive","cream-statusline-prototype","TabLaTeX","buffer-perlpython.pl","txt2tags-menu","hamster.vim","hamster.vim","clearsilver","hamster.vim","VB.NET-Syntax","VB.NET-Indent","ACScope","ptu","java_src_link.vim","AutumnLeaf","WhatsMissing.vim","bulgarian.vim","edifile.vim","rcs.vim","pydoc.vim","TWiki-Syntax","pmd.vim","BodySnatcher","MapleSyrup","ooosetup.vim","reverse.vim","mod_tcsoft.vim","PHP-correct-Indenting","anttestreport","lingo.vim","lpl.vim","UpdateModDate.vim","vimUnit","lxTrace","vim2ansi","synmark.vim","vim_faq.vim","jhlight.vim","javascript.vim","css.vim","scratch.vim","Japanese-Keymapping","vcbc.vim","scilab.tar.gz","scilab.tar.gz","tree","FileTree","Cisco-ACL-syntax-highlighting-rules","header.vim","inkpot","jhdark","C-fold","ccimpl.vim","bufkill.vim","perl-test-manage.vim","GetFDCText.vim","cygwin_utils.vim","globalreplace.vim","remote-PHP-debugger","xbl.vim","JavaKit","ledger.vim","ledger.vim","txt2tags","unhtml","pagemaker6","tSkeleton","foldcol.vim","jexplorer","html_danish","EditJava","tolerable.vim","Wiked","substitute.vim","sharp-Indent","GoboLinux-ColorScheme","Abc-Menu","DetectIndent","templates.vim","tComment","Rhythmbox-Control-Plugin","sharp-Syntax","oceanlight","OAL-Syntax","PVCS-access","context_complete.vim","fileaccess","avr.vim","tesei.vim","MultipleSearch2.vim","uniface.vim","turbo.vim","rotate.vim","cream-replacemulti","cleanswap","matrix.vim","hcc.vim","wc.vim","AutoUpload","expander.vim","vfp8.vim","vis","omlet.vim","ocaml.annot.pl","nodiff.vim","increment_new.vim","namazu.vim","c.vim","bsh.vim","WhereFrom","oo","Java-Syntax-and-Folding","ProvideX-Syntax","DNA-Tools","vimCU","cvsvimdiff","latexmenu","XML-Indent","AddIfndefGuard","Vim-JDE","cvsdiff.vim","Super-Shell-Indent","cool.vim","Perldoc-from-VIM","The-NERD-Commenter","darkblack.vim","OpenGLSL","monkeyd-configuration-syntax","OCaml-instructions-signature---parser","plist.vim","my-_vimrc-for-Windows-2000XP7-users","DotOutlineTree","Vim-klip-for-Serence-Klipfolio-Windows","explorer-reader.vim","recent.vim","crontab.freebsd.vim","Rainbow-Parenthesis","mom.vim","DoTagStuff","gentypes.py","YankRing.vim","mathml.vim","xhtml.vim","MS-SQL-Server-Syntax","Mark","autoit.vim","Guardian","octave.vim","Markdown-syntax","desert256.vim","Embedded-Vim-Preprocessor","cvsmenu.vim-updated","Omap.vim","swig","cccs.vim","vc_diff","Teradata-syntax","timekeeper","trt.vim","greens","VIMEN","pike.vim","aspvbs.vim","wood.vim","custom","sienna","tmda_filter.vim","cstol.vim","tex_umlaute","Quick-access-file-Menu","IComplete","Emacs-outline-mode","teol.vim","acsb","drcstubs","drc_indent","rubikscube.vim","php_check_syntax.vim","Mathematica-Syntax-File","Mathematica-Indent-File","SpotlightOpen","autoscroll","vsearch.vim","quantum.vim","ToggleOptions.vim","crontab.vim","tagselect","TinyBufferExplorer","TortoiseSVN.vim","nasl.vim","sadic.tgz","tabs.vim","otherfile.vim","otherfile.vim","LogiPat","luarefvim","keywords.vim","Pida","nightshade.vim","form.vim","rsl.vim","Color-Scheme-Explorer","Project-Browser-or-File-explorer-for-vim","Shortcut-functions-for-KeepCase-script-","maximize.dll","recycle.dll-and-recycle.vim","php_funcinfo.vim","T7ko","cguess","php_template","another-dark-scheme","java_fold","DataStage-Universe-Basic","vimplate","vimplate","bwftmenu.vim","asmM6502.vim","udvm.vim","bwHomeEndAdv.vim","bwUtility.vim","snippetsEmu","perlprove.vim","Dynamic-Keyword-Highlighting","CSVTK","ps2vsm","advantage","The-Stars-Color-Scheme","bufferlist.vim","Impact","Windows-PowerShell-Syntax-Plugin","xslt","verilogams.vim","XHTML-1.0-strict-help-file","sudoku","tidy","Pleasant-colorscheme","VST","A-soft-mellow-color-scheme","Professional-colorscheme-for-Vim","pluginfonts.vim","TabBar","Autoproject","last_change","last_change","AutoTag","switchtags.vim","dmd","VIM-Email-Client","cxxcomplete","The-Vim-Gardener","Colortest","Mud","Mud","Modelines-Bundle","syntaxada.vim","Night-Vision-Colorscheme","PDV--phpDocumentor-for-Vim","eraseSubword","larlet.vim","Cthulhian","SmartCase","HP-41-syntax-file","HP-41-file-type-plugin","Last-Modified","cloudy","xslhelper.vim","adobe.vim","Peppers","syntaxconkyrc.vim","bookmarks.vim","Zopedav","CVSconflict","TextMarker","ldap.vim","asmh8300","TailMinusF","QFixToggle","fpc.vim","Chars2HTML","cfengine-log-file-highlighting","syntaxuil.vim","cHeaderFinder","syntaxudev.vim","charon","SessionMgr","UniCycle","interfaces","gdbvim","build.vim","jay-syntax","d.vim","GreedyBackspace.vim","BuildWin","py_jump.vim","motus.vim","fish.vim","Processing-Syntax","range-search.vim","xml.vim","tagSetting.vim","javap.vim","desertedocean.vim","Zen-Color-Scheme","DarkZen-Color-Scheme","gnupg-symmetric.vim","desertedocean.vim","understated","impactG","DesertedOceanBurnt","Local-configuration","OMNeTpp-NED-syntax-file","Workspace-Manager","bwTemplate","vim_colors","brsccs.vim","bibFindIndex","Auto-debug-your-vim","shorewall.vim","carvedwood","avs.vim","jadl.vim","openvpn","softblue","bufmap.vim","corn","dtdmenu","iptables","CarvedWoodCool","darkerdesert","selection_eval.vim","cfname","checksyntax","textutil.vim","haml.zip","Dev-Cpp-Scheme","HiMtchBrkt","Compiler-Plugin-for-msbuild-csc","XML-Folding","compilerpython.vim","winmanager","xsl-fo","XML-Completion","telstar.vim","colors","AllBuffersToOneWindow.vim","MoveLine","Altair-OptiStruct-Syntax","Low-Contrast-Color-Schemes","vera.vim","VHDL-indent-93-syntax","svn_commit","cecscope","baycomb","VCard-syntax","copypath.vim","CycleColor","Grape-Color","moin.vim","glark.vim","syntaxm4.vim","dtd2vim","docbook44","moria","Ant","netrw.vim","far","bayQua","promela","lbnf.vim","watermark","Sift","vim7-install.sh","yellow","maude.vim","Modeliner","Surveyor","muttrc.vim","CmdlineCompl.vim","cvops-aut.vim","kid.vim","marklar.vim","spectro.vim","StickyCursor","fasm.vim","django.vim","ScrollColors","PluginKiller","jr.vim","JavaScript-syntax","pyte","Sudoku-Solver","Efficient-python-folding","derefined","initng","Align.vim","all-colors-pack","rfc2html","delins.vim","slr.vim","Vimball","Search-unFold","jbase.vim","jbase.vim","LargeFile","TabLineSet.vim","XHTML-1.0-Strict-vim7-xml-data-file","autohi","manuscript.vim","screenpaste.vim","VimVS6","SwitchExt","VhdlNav","smcl.vim","changelog","ClassTree","icalendar.vim","OmniCppComplete","maven2.vim","WinWalker.vim","cmaxx","magic.vim","vbnet.vim","javaimports.vim","habiLight","comments.vim","FlexWiki-syntax-highlighting","timing.vim","backburnerEdit_Visual_Block.vim","txt.vim","amarok.vim","vimproject","TagsParser","remind","pluginbackup.vim","colorsmartin_krischik.vim","Highlighter.vim","mousefunc-option-patch","GetChar-event-patch","pythoncomplete","Tabline-wrapping-patch","foxpro.vim","abolish.vim","perl_search_lib","compilergnat.vim","ftpluginada.vim","bluez","jVim","Simple-Color-Scheme","ScreenShot","autoproto.vim","autoloadadacomplete.vim","CD_Plus","xul.vim","Toggle-Window-Size","icansee.vim","KDE-GVIM-vimopen","Neverness-colour-scheme","Rainbow-Parenthsis-Bundle","patchreview.vim","forth.vim","ftdetectada.vim","gtd","rails.vim","abnf","montz.vim","redstring.vim","php.vim","SQLComplete.vim","systemverilog.vim","settlemyer.vim","findstr.vim","crt.vim","css.vim","tcl.vim","cr-bs-del-space-tab.vim","FlagIt","lookupfile","vim-addon-background-cmd","tobase","Erlang-plugin-package","actionscript.vim","verilog_systemverilog.vim","myghty.vim","ShowFunc","skk.vim","unimpaired.vim","octave.vim","crestore.vim","comment.vim","showhide.vim","warsow.vim","blacklight","color_toon","yanktmp.vim","highlight.vim","pop11.vim","Smooth-Scroll","developer","tcl.vim","colornames","gsl.vim","HelpWords","color_peruse","Chrome-syntax-script","Ada-Bundle","IncRoman.vim","Access-SQL-Syntax-file","vj","phps","Satori-Color-Scheme","SWIG-syntax","tdl.vim","afterimage.vim","cshelper","vimtips_with_comments","scvim","phpx","TIMEIT","phpfolding.vim","pastie.vim","x12-syntax","liquid.vim","doriath.vim","findfuncname.vim","XChat-IRC-Log","gnuchangelog","sh.vim","svncommand-tng","matlab_run.vim","candycode.vim","JDL-syntax-file","myfold.vim","SourceCodeObedience","MultiTabs","cpp.vim","AfterColors.vim","zzsplash","SuperTab-continued.","switch_headers.vim","tikiwiki.vim","str2numchar.vim","addexecmod.vim","ASL","scrollfix","asmx86_64","freya","highlight_current_line.vim","proe.vim","git.zip","cobol.zip","quilt","doxygenerator","The-NERD-tree","dw_colors","mint","redocommand","rubycomplete.vim","asm8051.vim","buftabs","tavi.vim","Alternate-workspace","campfire","blink","doorhinge.vim","darktango.vim","blueprint.vim","pdf.vim","Drupal-5.0-function-dictionary","toggle_words.vim","twilight","Tab-Name","tidy-compiler-script","Vexorian-color-scheme","ekvoli","IndexedSearch","Darcs","DNA-sequence-highlighter","plaintex.vim","Tango-colour-scheme","jdox","MakeInBuilddir","mail_indenter","IndentConsistencyCop","IndentConsistencyCopAutoCmds","tailtab.vim","desertEx","SnippetsMgr","StateExp","VPars","surround.vim","C_Epita","vimGTD","vimksh","Remove-Trailing-Spaces","edc-support","vdb.vim","vdb-duplicated","redcode.vim","Marks-Browser","php_getset.vim","FencView.vim","scons.vim","SWIFT-ATE-Syntax","Business-Objects-Syntax","Test.Base-syntax","darker-robin","Tail-Bundle","tcl_snit.vim","tcl_sqlite.vim","tcl.vim","tabula.vim","WLS-Mode","gvimext.dll--support-tabs-under-VIM-7","renamer.vim","cf.vim","vimpager","pyljvim","capslock.vim","ruby_imaps","Templeet","sal-syntax","exUtility","tAssert","perlcritic-compiler-script","rdark","aedit","vbugle","echofunc.vim","applescript.vim","gnuplot.vim","RunVim.applescript","Info.plist","filetype.vim","R-MacOSX","Utility","vst_with_syn","nightflight.vim","amifmt.vim","compilerflex.vim","javascript.vim","toggle_word.vim","GotoFileArg.vim","kib_darktango.vim","tGpg","kib_plastic","surrparen","TTrCodeAssistor","sparql.vim","BinarySearchMove","lbdbq","kate.vim","conlangs","lojban","surrogat","aspnetcs","lua-support","code_complete","tcl_itcl.vim","tcl_togl.vim","recent.vim","SnipSnap","lispcomplete.vim","etk-vim-syntax","woc","DAMOS-tools","Haml","Menu_SQL_Templates.vim","tcl_critcl.vim","Vimgrep-Replace","cvsdiff","Wombat","tcmdbar.vim","scala.vim","mlint.vim","polycl.vim","cscope-wrapper","apachestyle","javacomplete","hexsearch.vim","wikipedia.vim","Bexec","Audacious-Control","tagscan","erm.vim","fcsh-tools","vibrantink","autoloadTemplate.vim","SETL2","svnvimdiff","smarty.vim","polycfg.vim","IndentHL","c16gui","eclipse.vim","compview","brief2","SearchFold","MultiEnc.vim","calmar256-lightdark.vim","Vimplate-Enhanced","guicolorscheme.vim","Infobasic-Set-Syntax-FTDetect-FTPlugi","Random-Tip-Displayer","gotofile","greplace.vim","sqlvim.sh","Windows-PowerShell-Indent-File","Windows-PowerShell-File-Type-Plugin","buffers_search_and_replace","Yankcode","vimbuddy.vim","NAnt-completion","NAnt-syntax","incfilesearch.vim","NetSend.vim","Hints-for-C-Library-Functions","Hints-for-C-Library-Functions","smp","writebackup","writebackupVersionControl","html-improved-indentation","VimSpy","asciidoc.vim","des3.vim","st.vim","RDF-Namespace-complete","bufpos","BlitzBasic-syntax-and-indentation","tEchoPair","IndentAnything","Javascript-Indentation","nicotine.vim","screenplay","jman.vim","OceanBlack256","haproxy","gitdiff.vim","NesC-Syntax-Highlighting","arpalert","AutoClose","carrot.vim","SearchSyntaxError","clarity.vim","Twitter","Xdebugxs-dictionary-of-functions","textmate16.vim","Jinja","native.vim","mako.vim","eZVim","Directory-specific-settings","errormarker.vim","kpl.vim","tlib","tmru","tselectfiles","tselectbuffer","doctest-syntax","simplefold","genshi.vim","django.vim","fruity.vim","summerfruit.vim","projtags.vim","psql.vim","verilog_emacsauto.vim","securemodelines","voodu.vim","vimoutliner-colorscheme-fix","AutoComplPop","ck.vim","svndiff","Increment-and-Decrement-number","felix.vim","python_import.vim","scmCloseParens","nginx.vim","AnyPrinter","DiffGoFile","automated-rafb.net-uploader-plugin","LustyExplorer","vividchalk.vim","CimpTabulate.vim","vmake","Vim-Setup-system","gmcs.vim","ragtag.vim","synic.vim","vcsnursery","FindFile","ael.vim","freefem.vim","skill_comment.vim","REPL","ReloadScript","camelcasemotion","tmboxbrowser","snipper","creole.vim","QuickBuf","SuperPre","in.vim","perlhelp.vim","tbibtools","vdm.vim","mySqlGenQueryMenu.vim","Scheme-Mode","clibs.vim","cvsps-syntax","javalog.vim","ChocolatePapaya","vpp.vim","omniperl","context-complier-plugin","bbs.vim","syntaxalgol68.vim","Rename","DBGp-client","maxscript.vim","svndiff.vim","visSum.vim","html_french","git-commit","rectcut","OOP-javascript-indentation","Syntax-for-XUL","todo.vim","autofmt","drools.vim","fx.vim","stingray","JSON.vim","QuickFixFilterUtil","outline","Dictionary","VimExplorer","gvim-pdfsync","systemverilog.vim","Vimpress","yavdb","doxygen-support.vim","smart_cr","yasnippets","SmartX","CharSort","cimpl","Tabmerge","Simple256","vimscript-coding-aids","tie.vim","lodgeit.vim","Ruby-Snippets","gvim-extensions-for-TALpTAL","indenthaskell.vim","Highlight-and-Mark-Lines","deb.vim","trivial256","Parameter-Helpers","JET_toggle","pyconsole_vim.vim","lettuce.vim","rcscript","rcscript","Easy-alignment-to-column","Sass","vimremote.sh","halfmove","vimff","GtagsClient","FuzzyFinder","runtests.vim","mosalisp.vim","khaki.vim","two2tango","gitvimdiff","kwiki.vim","Shell-History","triangle.vim","NightVision","confluencewiki.vim","railscasts","bruce.vim","undo_tags","iast.vim","sas.vim","blinking_cursor","lookup.vim","python_ifold","gobgen","ColorSchemeMenuMaker","karma.vim","progressbar-widget","greplist.vim","buffer-status-menu.vim","AutoClose","sessionman.vim","dbext4rdb","openssl.vim","DrillCtg","ttoc","cheat.vim","no_quarter","tregisters","ttags","3DGlasses.vim","Gettext-PO-file-compiler","headerguard.vim","Tailf","erlang-indent-file","brew.vim","camlanot.vim","motion.vim","taskpaper.vim","MarkLines","4NT-Bundle","vimblog.vim","makeprgs","swap-parameters","trag","colorful256.vim","F6_Comment-old","F6_Comment","hookcursormoved","narrow_region","QuickComment","tcalc","AutoScrollMode","of.vim","VimPdb","myvim.vim","mips.vim","Flash-Live-Support-Agent-and-Chatroom","nosql.vim","BlockDiff","vimpp","LustyJuggler","enscript-highlight","idlang.vim","asmc54xx","TranslateIt","ttagecho","soso.vim","PropBank-Semantic-Role-Annotations","matchparenpp","winwkspaceexplorer","Warm-grey","haskell.vim","coq-syntax","xemacs-mouse-drag-copy","checksum.vim","executevimscript","newlisp","yate","ttagcomplete","bbcode","yet-another-svn-script","switch-files","rcg_gui","rcg_term","indenthtml.vim","setsyntax","phtml.vim","industrial","Coq-indent","autoresize.vim","mysqlquery","comments.vim","javascript.vim","gen_vimoptrc.vim","TI-Basic-Syntax","code-snippet","refactor","WuYe","Acpp","view_diff","verilog.vim","reloaded.vim","complval.vim","Puppet-Syntax-Highlighting","Smartput","Tab-Menu","narrow","fakeclip","xml_autons","textobj-user","textobj-datetime","EnvEdit.vim","kwbdi.vim","R.vim","oberon2","hiveminder.vim","scratch","csv-reader","BBCode","chords","robocom","autohotkey-ahk","pspad-colors-scheme","Torquescript-syntax-highlighting","Processing","Io-programming-language-syntax","GCov-plugin","gcov.vim","webpreview","speeddating.vim","HeaderCVS","bg.py","basic-colors","Twitter","SDL-library-syntax-for-C","accurev","Wikidoc-syntax-highlighting","symfony.vim","Noweb","XmlPretty","Socialtext-wiki-syntax-highlighting","byter","tintin.vim","tabpage_sort.vim","syntax-highlighting-for-tintinttpp","repeat.vim","Css-Pretty","PBwiki-syntax-highlighting","sgf.vim","xoria256.vim","undobranche_viewer.vim","showmarks","unibasic.vim","nice-vim","GOBject-Builder-gob2","prmths","VimTrac","quiltdiff","ncss.vim","css_color.vim","sessions.vim","snippets.vim","RecentFiles","marvim","greenvision","leo256","altfile","diffchanges.vim","timestamp","VFT--VIM-Form-Toolkit","DataStage-Server-and-Parallel","sharp-Syntax","GNU-R","renamec.vim","ukrainian-enhanced.vim","patran.vim","dakota.vim","Doxygen-via-Doxygen","jammy.vim","osx_like","PERLDOC2","head.vim","repmo.vim","Railscasts-Theme-GUIand256color","cwiki","rdhelp.txt","cqml.vim","Source-Explorer-srcexpl.vim","ColorSchemeEditor","reliable","vimlatex","smoothPageScroll.vim","file-line","git-file.vim","pig.vim","Latex-Text-Formatter","earendel","Luinnar","dtrace-syntax-file","MountainDew.vim","Syntax-for-Fasta","fpdf.vim","number-marks","Unicode-Macro-Table","antlr3.vim","beauty256","rastafari.vim","gauref.vim","northland.vim","SCMDiff","Boost-Build-v2-BBv2-syntax","vimgen","TwitVim","CoremoSearch","runzip","Relativize","Txtfmt-The-Vim-Highlighter","pyrex.vim","Shobogenzo","seoul","Obvious-Mode","VimTAP","Switch","darkspectrum","qfn","groovy.vim","debugger.py","Limp","bensday","Allegro-4.2-syntax-file","CmdlineComplete","tinymode.vim","STL-improved","sort-python-imports","vimwiki","browser.vim","autopreview","pacific.vim","beachcomber.vim","WriteRoom-for-Vim","h80","nc.vim","rtorrent-syntax-file","previewtag","WarzoneResourceFileSyntax","useful-optistruct-functions","StringComplete","darkrobot.vim","256-jungle","vcsbzr.vim","openser.vim","RemoveDups.VIM","less.bat","upf.vim","darkroom","FFeedVim","xml_taginsert","pac.vim","common_vimrc","journal.vim","publish.vim","railstab.vim","musicbox.vim","buffergrep","dark-ruby","bpel.vim","Git-Branch-Info","Named-Buffers","Contrasty","nagios-syntax","occur.vim","xtemplate","EZComment","vera.vim","silent.vim","colorful","apachelogs.vim","vim-rpcpaste","pygdb","AutoInclude","nightflight2.vim","gladecompletion.vim","flydiff","textobj-fold","textobj-jabraces","DevEiate-theme","jptemplate","cmdlinehelp","blackboard.vim","pink","brook.vim","huerotation.vim","cup.vim","vmv","Specky","fgl.vim","ctags.exe","loremipsum","smartchr","skeleton","linglang","Resolve","SwapIt","Glob-Edit","sipngrep","sipngrep-helper","codepad","fortran.vim","perl-mauke.vim","Gembase-dml-plugins","foldsearch","spring.vim","vimdb.vim","Textile-for-VIM","Text-Especially-LaTeX-Formatter","Clever-Tabs","portablemsys","GoogleSearchVIM","Indent-Highlight","softlight.vim","sofu.vim","QuickName","thegoodluck","auto_wc.vim","zoom.vim","zshr.vim","TextFormat","LaTeX-error-filter","batch.vim","catn.vim","nopaste.vim","Tumblr","log.vim","chlordane.vim","pathogen.vim","session.vim","backup.vim","metarw","metarw-git","ku","bundle","simple-pairs","molokai","postmail.vim","dictview.vim","ku-bundle","ku-metarw","Vimchant","bufmru.vim","trinity.vim","Chimp","indentgenie.vim","rootwater.vim","RltvNmbr.vim","stlrefvim","FastGrep","textobj-lastpat","Superior-Haskell-Interaction-Mode-SHIM","Nekthuth","tags-for-std-cpp-STL-streams-...","clue","louver.vim","diff_navigator","simplewhite.vim","vimxmms2","autoincludex.vim","ScopeVerilog","vcsc.py","darkbone.vim","CCTree","vimmp","Duplicated","sqloracle.vim","automatic-for-Verilog","ClosePairs","dokuwiki.vim","if_v8","vim-addon-sql","htmlspecialchars","mlint.vim","win9xblueback.vim","Verilog-constructs-plugin","RemoveIfdef","Note-Maker","winter.vim","buf2html.vim","sqlite_c","endwise.vim","cern_root.vim","conomode.vim","pdc.vim","CSApprox","MPC-syntax","Django-Projects","QuickTemplate","darkeclipse.vim","Fly-Between-Projects","Cutting-and-pasting-txt-file-in-middle","Fly-Between-Projects","hfile","cheat","sqlplsql","Russian-PLansliterated","advice","stackreg","Pit-Configuration","Robotbattle-Scripting-Language","Lissard-syntax","MatlabFilesEdition","Refactor-Color-Scheme","sql_iabbr-2","ku-args","Yow","lastchange","Miranda-syntax-highlighting","Tango2","textobj-diff","jQuery","Merb-and-Datamapper","Format-Helper","quickrun","gadgetxml.vim","PySmell","Wordnet.vim","Gist.vim","Transmit-FTP","arpeggio","nour.vim","code_complete-new-update","LineCommenter","autocorrect.vim","literal_tango.vim","commentToggle","corporation","W3AF-script-syntax-file","Side-C","Php-Doc","fuzzyjump.vim","shymenu","EasyGrep","Php-Doc","TagManager-BETA","pyflakes.vim","VimLocalHistory","Python-Documentation","Download-Vim-Scripts-as-Cron-Task","UpdateDNSSerial","narrow","Pago","PylonsCommand","sqlserver.vim","msdn_help.vim","nightsky","miko","eyapp","google","outputz","mtys-vimrc","unibox","enzyme.vim","AutoTmpl","AutoTmpl","Python-Syntax-Folding","kellys","session_dialog.vim","wombat256.vim","cdargs","submode","sandbox","translit","smartword","paintbox","Csound-compiler-plugin","python_open_module","Gentooish","ini-syntax-definition","cbackup.vim","Persistent-Abbreviations","ActionScript-3-Omnicomplete","grsecurity.vim","maroloccio","pygtk_syntax","Quagmire","Gorilla","textobj-indent","python_check_syntax.vim","proc.vim","fortran_codecomplete.vim","Rack.Builder-syntax","maroloccio2","eclm_wombat.vim","maroloccio3","ViBlip","pty.vim","Fruidle","Pimp","Changed","shellinsidevim.vim","blood","toggle_unit_tests","VimClojure","fly.vim","lightcolors","vanzan_color","tetragrammaton","VimIM","0scan","DBGp-Remote-Debugger-Interface","Spiderhawk","proton","RunView","guepardo.vim","charged-256.vim","ctxabbr","widower.vim","lilydjwg_green","norwaytoday","WOIM.vim","Dpaste.com-Plugin","reorder-tabs","searchfold.vim","wokmarks.vim","Jifty-syntax","Scratch","Thousand-separator","Perl-MooseX.Declare-Syntax","jpythonfold.vim","Thesaurus","IndentCommentPrefix","po.vim","slimv.vim","nxc.vim","muttaliasescomplete.vim","d.vim","cca.vim","Lucius","earthburn","ashen.vim","css-color-preview","snipMate","Mastermind-board-game","StarRange","SearchCols.vim","EditSimilar","Buffer-grep","repy.vim","xsltassistant.vim","php.vim","BusyBee","wps.vim","Vicle","jam.vim","irssilog.vim","CommentAnyWay","jellybeans.vim","myprojects","gitignore","Match-Bracket-for-Objective-C","gams.vim","numbertotext","NumberToEnglish","ansi_blows.vim","bufMenuToo","simple_comments.vim","runVimTests","utf8-math","Vim-Rspec","Blazer","LogMgr","vimdecdef","apidock.vim","ack.vim","Darkdevel","codeburn","std-includes","WinMove","summerfruit256.vim","lint.vim","Session-manager","spec.vim","Fdgrep","blogit.vim","popup_it","quickfixsigns","lilydjwg_dark","upAndDown","PDV-revised","glimpse","vylight","FSwitch","HTML-AutoCloseTag","Zmrok","LBufWin","tmarks","Skittles-Dark","gvimfullscreen_win32","lighttpd-syntax","reorder.vim","todolist.vim","Symfony","wargreycolorscheme","paster.vim","Haskell-Cuteness","svk","nextfile","vimuiex","TaskList.vim","send.vim","PA_translator","textobj-entire","xptemplate","Rubytest.vim","vimstall","sdticket","vimtemplate","graywh","SpamAssassin-syntax","ctk.vim","textobj-function","neocomplcache","up2picasaweb","ku-quickfix","TODO-List","ProtoDef","Cabal.vim","Vimya","exVim","Vim-R-plugin","explorer","compilerjsl.vim","dosbatch-indent","nimrod.vim","csindent.vim","SearchPosition","smartmatcheol.vim","google.vim","ScmFrontEnd-former-name--MinSCM","blogger","jlj.vim","tango-morning.vim","haskell.vim","PLI-Auto-Complete","python_coverage.vim","Erlang_detectVariable","bandit.vim","TagHighlight","Templates-for-Files-and-Function-Groups","darkburn","PBASIC-syntax","darkZ","fitnesse.vim","bblean.vim","cuteErrorMarker","Arduino-syntax-file","squirrel.vim","Simple-R-Omni-Completion","VOoM","Changing-color-script","g15vim","clips.vim","plumbing.vim","ywvim","mako.vim","HtmlHelper","Mark","setget","shell_it","fastlane","TuttiColori-Colorscheme","tango-desert.vim","Hoogle","smarttill","cocoa.vim","altercmd","supercat.vim","nature.vim","GoogleReader.vim","textobj-verticalbar","cursoroverdictionary","Colorzone","colorsupport.vim","FastLadder.vim","herald.vim","zOS-Enterprise-Compiler-PLI","cuteTodoList","iabassist","dual.vim","kalt.vim","kaltex.vim","fbc.vim","operator-user","ats-lang-vim","MediaWiki-folding-and-syntax-highlight","EnhancedJumps","elise.vim","elisex.vim","Dictionary-file-for-Luxology-Modo-Python","argtextobj.vim","PKGBUILD","editsrec","regreplop.vim","ReplaceWithRegister","mrpink","tiddlywiki","PA_ruby_ri","EnumToCase","commentop.vim","SudoEdit.vim","vimrc","Screen-vim---gnu-screentmux","sign-diff","nextCS","Tag-Signature-Balloons","UltiSnips","textobj-syntax","mutt-aliases","mutt-canned","Proj","arc.vim","AutoFenc.vim","cssvar","math","Rename2","translit_converter","Syntax-Highlighting-for-db2diag.log","jsbeautify","tkl.vim","jslint.vim","donbass.vim","sherlock.vim","Notes","Buffer-Reminder-Remake","PreviewDialog","Logcat-syntax-highlighter","Syntastic","bib_autocomp.vim","v2.vim","bclear","vimper","blue.vim","ruby.vim","greek_polytonic.vim","git-cheat","falcon.vim","nuweb-multi-language","d8g_01","d8g_02","d8g_03","d8g_04","vimdiff-vcs","falcon.vim","banned.vim","delimitMate.vim","evening_2","color-chooser.vim","forneus","Mustang2","Quich-Filter","Tortoise","qtmplsel.vim","falcon.vim","falcon.vim","dull","Better-Javascript-Indentation","Join.vim","emv","vimscript","pipe.vim","JumpInCode","Conque-Shell","Crazy-Home-Key","grex","whitebox.vim","logpad.vim","vilight.vim","tir_black","gui2term.py","moss","python-tag-import","Django-helper-utils","operator-replace","DumbBuf","template-init.vim","wwwsearch","cpan.vim","Melt-Vim","InsertList","rargs.vim","cmdline-increment.vim","popup_it","perdirvimrc--Autoload-vimrc-files-per-di","hybridevel","phpErrorMarker","Functionator","CheckAttach.vim","SoftTabStops","Pasto","tango.vim","Windows-PowerShell-indent-enhanced","NERD_tree-Project","JavaScript-syntax-add-E4X-support","php_localvarcheck.vim","chocolate.vim","assistant","md5.vim","Nmap-syntax-highlight","haxe_plugin","fontsize.vim","InsertChar","hlasm.vim","term.vim","MailApp","PyMol-syntax","hornet.vim","Execute-selection-in-Python-and-append","testname","Asneeded-2","smarty-syntax","DBGp-client","sqlplus.vim","unicode.vim","baan.vim","libperl.vim","filter","multisearch.vim","RTM.vim","Cobalt-Colour-scheme","roo.vim","csv.vim","mimicpak","xmms2ctrl","buf_it","template.vim","phpcodesniffer.vim","wikinotes","powershellCall","HiVim","QuickFixHighlight","noused","coldgreen.vim","vorg","FlipLR","simple-comment","ywchaos","haskellFold","pod-helper.vim","Script-Walker","color-codes-SQL-keywords-from-Oracle-11g","FindInNERDTree","Speedware","perlomni.vim","go.vim","go.vim","github-theme","vimmpc","exjumplist","textobj-fatpack","grey2","prettyprint.vim","JumpInCode-new-update","GNU-as-syntax","NSIS-syntax-highlighting","colqer","gemcolors","Go-Syntax","fortran_line_length","Ruby-Single-Test","OmniTags","FindMate","signature_block.vim","record-repeat.vim","php.vim","signal_dec_VHDL","HTML-menu-for-GVIM","spinner.vim","RDoc","XPstatusline","rc.vim","mib_translator","Markdown","growlnotify.vim","JavaAspect","gsession.vim","cgc.vim","manuscript","CodeOverview","bluechia.vim","slurper.vim","create_start_fold_marker.vim","doubleTap","filetype-completion.vim","vikitasks","PyPit","open-terminal-filemanager","Chrysoprase","circos.vim","TxtBrowser","gitolite.vim","ShowFunc.vim","AuthorInfo","Cfengine-3-ftplugin","Cfengine-version-3-syntax","vim-addon-manager","Vim-Condensed-Quick-Reference","hlint","Enhanced-Ex","Flex-Development-Support","restart.vim","selfdot","syntaxGemfile.vim","spidermonkey.vim","pep8","startup_profile","extended-help","tplugin","SpitVspit","Preamble","Mercury-compiler-support","FirstEffectiveLine.vim","vimomni","std.vim","tocterm","apt-complete.vim","SnippetComplete","Dictionary-List-Replacements","Vimrc-Version-Numbering","mark_tools","rfc-syntax","fontzoom.vim","histwin.vim","vim-addon-fcsh","vim-addon-actions","superSnipMate","bzr-commit","hexHighlight.vim","Multi-Replace","strawimodo","vim-addon-mw-utils","actionscript3id.vim","RubySinatra","ccvext.vim","visualstar.vim","AutomaticLaTeXPlugin","AGTD","bvemu.vim","GoogleSuggest-Complete","The-Max-Impact-Experiment","cflow-output-colorful","SaneCL","c-standard-functions-highlight","Wavefronts-obj","hypergit.vim","hex.vim","csp.vim","load_template","emoticon.vim","emoticon.vim","bisect","groovyindent","liftweb.vim","line-number-yank","neutron.vim","SyntaxMotion.vim","Doxia-APT","daemon_saver.vim","ikiwiki-nav","ucf.vim","ISBN-10-to-EAN-13-converter","sha1.vim","hmac.vim","cucumber.zip","mrkn256.vim","fugitive.vim","blowfish.vim","underwater","trogdor","Parameter-Text-Objects","php-doc-upgrade","ZenCoding.vim","jumphl.vim","qmake--syntax.vim","R-syntax-highlighting","BUGS-language","AddCppClass","loadtags","OpenCL-C-syntax-highlighting","pummode","stickykey","rcom","SaveSigns","ywtxt","Rackup","colorselector","TranslateEnToCn","utlx_interwiki.vim","BackgroundColor.vim","django-template-textobjects","html-advanced-text-objects","candyman.vim","tag_in_new_tab","indentpython","vxfold.vim","simplecommenter","CSSMinister","Twee-Integration-for-Vim","httplog","treemenu.vim","delete-surround-html","tumblr.vim","vspec","tcommand","ColorX","alex.vim","happy.vim","Cppcheck-compiler","vim-addon-completion","spin.vim","EasyOpts","Find-files","Bookmarking","tslime.vim","vimake","Command-T","PickAColor.vim","grsecurity","rename.vim","tex-turkce","motpat.vim","orange","Mahewincs","Vim-Title-Formatter","syntaxhaskell.vim","tesla","XTermEsc","vim-indent-object","noweb.vim","vimgdb","cmd.vim","RST-Tables","css3","clevercss.vim","compilerpython.vim","cmakeref","operator-camelize","scalacommenter.vim","vicom","acomment","smartmove.vim","vimform","changesPlugin","Maynard","Otter.vim","ciscoasa.vim","translit3","vimsizer","tex_mini.vim","lastpos.vim","Manuals","VxLib","256-grayvim","mdark.vim","aftersyntaxc.vim","mayansmoke","repeater.vim","ref.vim","recover.vim","Slidedown-Syntax","ShowMultiBase","reimin","self.vim","kiss.vim","Trac-Wikimarkup","NrrwRgn","ego.vim","Delphi-7-2010","CodeFactory","JavaScript-Indent","tagmaster","qiushibaike","dc.vim","tf2.vim","glyph.vim","OutlookVim","GetFile","vimtl","RTL","Sessions","autocomp.vim","TortoiseTyping","syntax-codecsconf","cvsdiff.vim","yaifa.vim","Silence","PNote","mflrename","nevfn","Tumble","vplinst","tony_light","pyref.vim","legiblelight","truebasic.vim","writebackupToAdjacentDir","GUI-Box","LaTeX-Box","mdx.vim","leglight2","RemoveFile.vim","formatvim","easytags.vim","SingleCompile","CFWheels-Dictionary","fu","skk.vim","tcbuild.vim","grails-vim","django_templates.vim","PySuite","shell.vim","vim-addon-sbt","PIV","xpcomplete","gams","Search-in-Addressbook","teraterm","CountJump","darkBlue","underwater-mod","open-browser.vim","rvm.vim","Vim-Script-Updater","beluga-syntax","tac-syntax","datascript.vim","phd","obsidian","ez_scroll","vim-snipplr","vim-haxe","hgrev","zetavim","quickrun.vim","wmgraphviz","reload.vim","Smooth-Center","session.vim","pytestator","sablecc.vim","CSS-one-line--multi-line-folding","vorax","slang_syntax","ikiwiki-syntax","opencl.vim","gitview","ekini-dark-colorscheme","pep8","pyflakes","tabops","endline","pythondo","obviously-insert","toggle_mouse","regbuf.vim","mojo.vim","luainspect.vim","pw","phpcomplete.vim","SyntaxComplete","vimgcwsyntax","JsLint-Helper","Haskell-Highlight-Enhanced","typeredeemer","BusierBee","Shapley-Values","help_movement","diff_movement","fortunes_movement","mail_movement","CSS3-Highlights","vimpluginloader","jsonvim","vimstuff","vimargumentchec","vimcompcrtr","vimoop","yamlvim","DokuVimKi","jade.vim","v4daemon","ovim","Starting-.vimrc","gedim","current-func-info.vim","undofile.vim","vim-addon-ocaml","Haskell-Conceal","trailing-whitespace","rdark-terminal","mantip","htip","python_showpydoc.vim","tangoshady","bundler","cHiTags","Quotes","Smart-Parentheses","operator-reverse","python_showpydoc","rslTools","presets","View-Ports","Replay.vim","qnamebuf","processing-snipmate","ProjectTag","Better-CSS-Syntax-for-Vim","indexer.tar.gz","285colors-with-az-menu","LanguageTool","VIM-Color-Picker","Flex-4","lodestone","Simple-Javascript-Indenter","porter-stem","stem-search","TeX-PDF","PyInteractive","HTML5-Syntax-File","VimgrepBuffer","ToggleLineNumberMode","showcolor.vim","html5.vim","blockinsert","LimitWindowSize","minibufexplorerpp","tdvim_FoldDigest","bufsurf","Open-associated-programs","aspnetide.vim","Timer-routine","Heliotrope","CaptureClipboard","Shades-of-Amber","Zephyr-Color-Scheme","Jasmine-snippets-for-snipMate","swap","RubyProxy","L9","makesd.vim","ora-workbench","sequence","phaver","Say-Time","pyunit","clang","Son-of-Obisidian","Selenitic","diff-fold.vim","Bird-Syntax","Vimtodo","cSyntaxAfter","Code.Blocks-Dark","omnetpp","command-list","open_file_from_clip_board","CommandWithMutableRange","RangeMacro","tchaba","kirikiri.vim","Liquid-Carbon","actionscript.vim","ProjectCTags","Python-2.x-Standard-Library-Reference","Python-3.x-Standard-Library-Reference","ProjectParse","Tabbi","run_python_tests","eregex.vim","OMNeTpp4.x-NED-Syntax-file","Quotes","looks","Lite-Tab-Page","Show-mandictperldocpydocphpdoc-use-K","newsprint.vim","pf_earth.vim","RevealExtends","openurl.vim","southernlights","numbered.vim","grass.vim","toggle_option","idp.vim","sjump.vim","vim_faq","Sorcerer","up.vim","TrimBlank","clang-complete","smartbd","Gundo","altera_sta.vim","altera.vim","vim-addon-async","vim-refact","vydark","gdb4vim","savemap.vim","operator-html-escape","Mizore","maxivim","vim-addon-json-encoding","tohtml_wincp","vim-addon-signs","unite-colorscheme","unite-font","vim-addon-xdebug","VimCoder.jar","FTPDEV","lilypink","js-mask","vim-fileutils","stakeholders","PyScratch","Blueshift","VimCalc","unite-locate","lua_omni","verilog_systemverilog_fix","mheg","void","VIP","Smart-Home-Key","tracwiki","newspaper.vim","rdist-syntax","zenesque.vim","auto","VimOrganizer","stackoverflow.vim","preview","inccomplete","screen_line_jumper","chance-of-storm","unite-gem","devbox-dark-256","lastchange.vim","qthelp","auto_mkdir","jbosslog","wesnothcfg.vim","UnconditionalPaste","unite-yarm","NERD_Tree-and-ack","tabpagecolorscheme","Figlet.vim","Peasy","Indent-Guides","janitor.vim","southwest-fog","Ceasy","txt.vim","Shebang","vimblogger_ft","List-File","softbluev2","eteSkeleton","hdl_plugin","blockle.vim","ColorSelect","notes.vim","FanVim","Vimblr","vcslogdiff","JumpNextLongLine","vimorator","emacsmodeline.vim","textobj-rubyblock","StatusLineHighlight","shadow.vim","csc.vim","JumpToLastOccurrence","perfect.vim","polytonic.utf-8.spl","opencl.vim","iim.vim","line-based_jump_memory.vim","hdl_plugin","localrc.vim","BOOKMARKS--Mark-and-Highlight-Full-Lines","chapa","unite.vim","neverland.vim--All-colorschemes-suck","fokus","phpunit","vim-creole","Search-Google","mophiaSmoke","mophiaDark","Google-translator","auto-kk","update_perl_line_directives","headerGatesAdd.vim","JellyX","HJKL","nclipper.vim","syntax_check_embedded_perl.vim","xterm-color-table.vim","zazen","bocau","supp.vim","w3cvalidator","toner.vim","QCL-syntax-hilighting","kkruby.vim","hdl_plugin","Mind_syntax","Comment-Squawk","neco-ghc","pytest.vim","Enhanced-Javascript-syntax","LispXp","Nazca","obsidian2.vim","vim-addon-sml","pep8","AsyncCommand","lazysnipmate","Biorhythm","IniParser","codepath.vim","twilight256.vim","PreciseJump","cscope_plus.vim","Cobaltish","neco-look","XFST-syntax-file","Royal-Colorschemes","pbcopy.vim","golded.vim","Getafe","ParseJSON","activity-log","File-Case-Enforcer","Microchip-Linker-Script-syntax-file","RST-Tables-works-with-non-english-langu","lexctwolc-Syntax-Highlighter","mxl.vim","fecompressor.vim","Flog","Headlights","Chess-files-.pgn-extension","vim-paint","vundle","funprototypes.vim","SVF-syntax","indentpython.vim","Compile","dragon","Tabular","Tagbar","vimake-vim-programmers-ide","align","windows-sif-syntax","csc.snippets","tidydiff","latte","thermometer","Clean","Neopro","Vim-Blog","bitly.vim","bad-apple","robokai","makebg","asp.net","Atom","vim-remote","IPC-syntax-highlight","PyREPL.vim","phrase.vim","virtualenv.vim","reporoot.vim","rebar","urilib","visualctrlg","textmanip.vim","compilerg95.vim","Risto-Color-Scheme","underlinetag","paper","compilergfortran.vim","compilerifort.vim","Scala-argument-formatter","FindEverything","vim_etx","emacs-like-macro-recorder","To-Upper-case-case-changer","vim-erlang-skeleteons","taglist-plus","PasteBin.vim","compilerpcc.vim","scrnpipe.vim","TeX-9","extradite.vim","VimRepress","text-object-left-and-right","Scala-Java-Edit","vim-stylus","vim-activator","VimOutliner","avr8bit.vim","iconv","accentuate.vim","Solarized","Gravity","SAS-Syntax","gem.vim","vim-scala","Rename","EasyMotion","boost.vim","ciscoacl.vim","Distinguished","mush.vim","cmdline-completion","UltraBlog","GetFilePlus","strange","vim-task","Tab-Manager","XPath-Search","plantuml-syntax","rvmprompt.vim","Save-Current-Font","fatrat.vim","Sesiones.vim","opener.vim","cascading.vim","Google-Translate","molly.vim","jianfan","Dagon","plexer","vim-online","gsearch","Message-Formatter","sudoku_game","emacscommandline","fso","openscad.vim","editqf","visual-increment","gtrans.vim","PairTools","Table-Helper","DayTimeColorer","Amethyst","hier","Javascript-OmniCompletion-with-YUI-and-j","m2sh.vim","colorizer","Tabs-only-for-indentation","modelica","terse","dogmatic.vim","ro-when-swapfound","quit-another-window","gitv","Enter-Indent","jshint.vim","pacmanlog.vim","lastmod.vim","ignore-me","vim-textobj-quoted","simplenote.vim","Comceal","checklist.vim","typofree.vim","Redhawk-Vim-Plugin","vim-soy","Find-XML-Tags","cake.vim","vim-coffee-script","browserprint","jovial.vim","pdub","ucompleteme","ethna-switch","Fanfou.vim","colorv.vim","Advancer-Abbreviation","Auto-Pairs","octave.vim","cmdline-insertdatetime","reorder-columns","calm","nicer-vim-regexps","listtag","Diablo3","vim_django","nautilus-py-vim","IDLE","operator-star","XQuery-indentomnicompleteftplugin","browsereload-mac.vim","splitjoin.vim","vimshell-ssh","ShowMarks7","warez-colorscheme","Quicksilver.vim","wikilink","Buffergator","Buffersaurus","ri-viewer","beautiful-pastebin","chef.vim","indsas","lua.vim","AutoSaveSetting","resizewin","cpp_gnuchlog.vim","tangolight","IDSearch","frawor","git_patch_tags.vim","snipmate-snippets","widl.vim","WinFastFind","ReplaceFile","gUnit-syntax","Handlebars","svnst.vim","The-Old-Ones","Atomic-Save","vim-orgmode","Vimper-IDE","vimgtd","gnupg.vim","Filesearch","VimLite","AutoCpp","simpleRGB","cakephp.vim","googleclosurevim","vim-task-org","brep","vrackets","xorium.vim","transpose-words","Powershell-FTDetect","LycosaExplorer","ldap_schema.vim","Lookup","Intelligent-Tags","lemon.vim","SnipMgr","repeat-motion","skyWeb","Toxic","sgmlendtag","rake.vim","orangeocean256","cdevframework","textgenshi.vim","aldmeris","univresal-blue-scheme","cab.vim","copy-as-rtf","baobaozhu","rfc5424","saturn.vim","tablistlite.vim","functionlist.vim","hints_opengl.vim","wikiatovimhelp","ctags_cache","werks.vim","RegImap","Calm-Breeze","Rst-edit-block-in-tab","Ambient-Color-Scheme","golden-ratio","annotatedmarks","quickhl.vim","FixCSS.vim","enablelvimrc.vim","commentary.vim","prefixer.vim","cssbaseline.vim","html_emogrifier.vim","Premailer.vim","tryit.vim","fthook.vim","sql.vim","zim-syntax","Transcription-Name-Helper","Rcode","obvious-resize","lemon256","swapcol.vim","vim-ipython","EasyPeasy","chinachess.vim","tabpage.vim","tabasco","light2011","numlist.vim","fuzzee.vim","SnippetySnip","melt-syntax","diffwindow_movement","noweboutline.vim","Threesome","quickfixstatus.vim","SimpylFold","indent-motion","mcabberlog.vim","easychair","right_align","galaxy.vim","vim-pandoc","putcmd.vim","vim-rpsl","olga_key","statusline.vim","bad-whitespace","ctrlp.vim","sexy-railscasts","TagmaTips","blue_sky","gccsingle.vim","kiwi.vim","mediawiki","Vimerl","MarkdownFootnotes","linediff.vim","watchdog.vim","syntaxdosini.vim","pylint-mode","NagelfarVim","TclShell","google_prettify.vim","Vimpy","vim-pad","baancomplete","racket.vim","scribble.vim","racket-auto-keywords.vim","Ambient-Theme","White","vim-dokuwiki","slide-show","Speech","vim-google-scribe","fcitx.vim","TagmaTasks","vimroom.vim","MapFinder","mappingmanager","ahkcomplete","Python-mode-klen","tagfinder.vim","rainbow_parentheses.vim","Lyrics","abbott.vim","wiki.vim","todotxt.vim","RST-Tables-CJK","utags","mango.vim","indentfolds","Twilight-for-python","Python-Syntax","vim-json-bundle","VIM-Metaprogramming","statline","SonicTemplate.vim","vim-mnml","Tagma-Buffer-Manager","desert-warm-256","html-source-explorer","codepaper","php-doc","Cpp11-Syntax-Support","node.js","Cleanroom","anwolib","fontforge_script.vim","prop.vim","vim-symbols-strings","vim-diff","openrel.vim","apg.vim","TFS","ipi","RSTO","project.vim","tex_AutoKeymap","log.vim","mirodark","vim-kickstart","MatchTag","Lisper.vim","Dart","vim-ocaml-conceal","csslint.vim","nu42dark-color-scheme","Colour-theme-neon-pk","simple_bookmarks.vim","modeleasy-vim-plugin","aurum","inline_edit.vim","better-snipmate-snippet","LastBuf.vim","SchemeXp","TVO--The-Vim-Outliner-with-asciidoc-supp","yankstack","vim-octopress","ChickenMetaXp","ChickenSetupXp","nscripter.vim","weibo.vim","vim-python-virtualenv","vim-django-support","nose.vim","nodeunit.vim","SpellCheck","lrc.vim","cue.vim","visualrepeat","git-time-lapse","boolpat.vim","Mark-Ring","Festoon","dokuwiki","unite-scriptenames","ide","tocdown","Word-Fuzzy-Completion","rmvim","Xoria256m","shelp","Lawrencium","grads.vim","epegzz.vim","Eddie.vim","behat.zip","phidgets.vim","gtags-multiwindow-browsing","lightdiff","vm.vim","SmartusLine","vimprj","turbux.vim","html-xml-tag-matcher","git-diff","ft_improved","nerdtree-ack","ambicmd.vim","fountain.vim","Powerline","EasyDigraph.vim","autosess","DfrankUtil","ruscmd","textobj-line","Independence","qtpy.vim","switch-buffer-quickly","simple-dark","gf-user","gf-diff","viewdoc","Limbo-syntax","rhinestones","buffet.vim","pwdstatus.vim","gtk-mode","indentjava.vim","coffee-check.vim-B","coffee-check.vim","compot","xsnippet","nsl.vim","vombato-colorscheme","ocamlMultiAnnot","mozpp.vim","mozjs.vim","e2.lua","gmlua.vim","vim-punto-switcher","toggle_comment","CapsulaPigmentorum.vim","CompleteHelper","CamelCaseComplete","vim-addon-haskell","tagport","cd-hook","pfldap.vim","WhiteWash","TagmaLast","Gummybears","taskmanagementvim","flymaker","ditaa","lout.vim","vim-flake8","phpcs.vim","badwolf","jbi.vim","Vim-Support","murphi.vim","argumentative.vim","editorconfig-vim","thinkpad.vim","Coverity-compiler-plugin","vim-wmfs","Trailer-Trash","ipyqtmacvim.vim","writebackupAutomator","CodeCommenter","sandbox_hg","pdv-standalone","Yii-API-manual-for-Vim","fountainwiki.vim","hop-language-syntax-highlight","Skittles-Berry","django.vim","pyunit.vim","EasyColour","tmpclip.vim","Improved-paragraph-motion","tortex","Add-to-Word-Search","fwk-notes","calendar.vim","mystatusinfo.vim","workflowish","tabman.vim","flashdevelop.vim","hammer.vim","Colorizer--Brabandt","less-syntax","DynamicSigns","ShowTrailingWhitespace","DeleteTrailingWhitespace","JumpToTrailingWhitespace","source.vim","mediawiki.vim","regexroute.vim","css3-syntax-plus","diff-toggle","showmarks2","Finder-for-vim","vim-human-dates","vim-addon-commenting","cudajinja.vim","vim-pomodoro","phpqa","TaskMotions","ConflictMotions","Sauce","gitvimrc.vim","instant-markdown.vim","vroom","portmon","spacebox.vim","paredit.vim","Ayumi","Clam","vim_movement","vbs_movement","dosbatch_movement","TextTransform","HyperList","python-imports.vim","youdao.dict","XDebug-DBGp-client-for-PHP","Vim-Gromacs","vimux","Vimpy--Stoner","readnovel","Vitality","close-duplicate-tabs","StripWhiteSpaces","vim-jsbeautify","clean_imports","WebAPI.vim","flipwords.vim","restore_view.vim","SpaceBetween","autolink","vim-addon-rdebug","DBGp-X-client","Splice","vim-htmldjango_omnicomplete","vim-addon-ruby-debug-ide","a-new-txt2tags-syntax","vim-cpp-auto-include","rstatusline","muxmate","vim4rally","SAS-Indent","modx","ucpp-vim-syntax","bestfriend.vim","vim-dasm","evervim","Fortune-vimtips","VDBI.vim","Ideone.vim","neocomplcache-snippets_complete","RbREPL.vim","AmbiCompletion","london.vim","jsruntime.vim","maven-plugin","vim-mou","Transpose","PHPUnit-QF","TimeTap","jsoncodecs.vim","jsflakes.vim","jsflakes","DBGPavim","nosyntaxwords","mathematic.vim","vtimer.vim","_jsbeautify","license-loader","cmdpathup","matchindent.vim","automatic-for-Verilog--guo","lingodirector.vim--Pawlik","Ubloh-Color-Scheme","html_FileCompletion","PyChimp","sonoma.vim","highlights-for-radiologist","Xdebug","burnttoast256","vmark.vim--Visual-Bookmarking","gprof.vim","jshint.vim--Stelmach","sourcebeautify.vim","HgCi","EscapeBchars","cscope.vim","php-cs-fixer","cst","OnSyntaxChange","python_fold_compact","EditPlus"] \ No newline at end of file diff --git a/vim-plugins/bundle/AutoComplPop/README b/vim-plugins/bundle/AutoComplPop/README new file mode 100644 index 0000000..8a72261 --- /dev/null +++ b/vim-plugins/bundle/AutoComplPop/README @@ -0,0 +1,101 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=1879 + +Repository: + https://bitbucket.org/ns9tks/vim-autocomplpop/ + +Issues: + http://bitbucket.org/ns9tks/vim-autocomplpop/issues/ + +Download latest(development) version + https://bitbucket.org/ns9tks/vim-autocomplpop/get/tip.zip + +============================================================================== +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: +> + /plugin/acp.vim + /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 "<", "" characters + " ") + Omni html/xhtml "<", "" 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. + + +============================================================================== + diff --git a/vim-plugins/bundle/AutoComplPop/autoload/acp.vim b/vim-plugins/bundle/AutoComplPop/autoload/acp.vim new file mode 100644 index 0000000..827bbcc --- /dev/null +++ b/vim-plugins/bundle/AutoComplPop/autoload/acp.vim @@ -0,0 +1,431 @@ +"============================================================================= +" Copyright (c) 2007-2009 Takeshi NISHIDA +" +"============================================================================= +" LOAD GUARD {{{1 + +if exists('g:loaded_autoload_acp') || v:version < 702 + finish +endif +let g:loaded_autoload_acp = 1 + +" }}}1 +"============================================================================= +" GLOBAL FUNCTIONS: {{{1 + +" +function acp#enable() + call acp#disable() + + augroup AcpGlobalAutoCommand + autocmd! + autocmd InsertEnter * unlet! s:posLast s:lastUncompletable + autocmd InsertLeave * call s:finishPopup(1) + augroup END + + if g:acp_mappingDriven + call s:mapForMappingDriven() + else + autocmd AcpGlobalAutoCommand CursorMovedI * call s:feedPopup() + endif + + nnoremap i i=feedPopup() + nnoremap a a=feedPopup() + nnoremap R R=feedPopup() +endfunction + +" +function acp#disable() + call s:unmapForMappingDriven() + augroup AcpGlobalAutoCommand + autocmd! + augroup END + nnoremap i | nunmap i + nnoremap a | nunmap a + nnoremap R | nunmap R +endfunction + +" +function acp#lock() + let s:lockCount += 1 +endfunction + +" +function acp#unlock() + let s:lockCount -= 1 + if s:lockCount < 0 + let s:lockCount = 0 + throw "AutoComplPop: not locked" + endif +endfunction + +" +function acp#meetsForSnipmate(context) + if g:acp_behaviorSnipmateLength < 0 + return 0 + endif + let matches = matchlist(a:context, '\(^\|\s\|\<\)\(\u\{' . + \ g:acp_behaviorSnipmateLength . ',}\)$') + return !empty(matches) && !empty(s:getMatchingSnipItems(matches[2])) +endfunction + +" +function acp#meetsForKeyword(context) + if g:acp_behaviorKeywordLength < 0 + return 0 + endif + let matches = matchlist(a:context, '\(\k\{' . g:acp_behaviorKeywordLength . ',}\)$') + if empty(matches) + return 0 + endif + for ignore in g:acp_behaviorKeywordIgnores + if stridx(ignore, matches[1]) == 0 + return 0 + endif + endfor + return 1 +endfunction + +" +function acp#meetsForFile(context) + if g:acp_behaviorFileLength < 0 + return 0 + endif + if has('win32') || has('win64') + let separator = '[/\\]' + else + let separator = '\/' + endif + if a:context !~ '\f' . separator . '\f\{' . g:acp_behaviorFileLength . ',}$' + return 0 + endif + return a:context !~ '[*/\\][/\\]\f*$\|[^[:print:]]\f*$' +endfunction + +" +function acp#meetsForRubyOmni(context) + if !has('ruby') + return 0 + endif + if g:acp_behaviorRubyOmniMethodLength >= 0 && + \ a:context =~ '[^. \t]\(\.\|::\)\k\{' . + \ g:acp_behaviorRubyOmniMethodLength . ',}$' + return 1 + endif + if g:acp_behaviorRubyOmniSymbolLength >= 0 && + \ a:context =~ '\(^\|[^:]\):\k\{' . + \ g:acp_behaviorRubyOmniSymbolLength . ',}$' + return 1 + endif + return 0 +endfunction + +" +function acp#meetsForPythonOmni(context) + return has('python') && g:acp_behaviorPythonOmniLength >= 0 && + \ a:context =~ '\k\.\k\{' . g:acp_behaviorPythonOmniLength . ',}$' +endfunction + +" +function acp#meetsForPerlOmni(context) + return g:acp_behaviorPerlOmniLength >= 0 && + \ a:context =~ '\w->\k\{' . g:acp_behaviorPerlOmniLength . ',}$' +endfunction + +" +function acp#meetsForXmlOmni(context) + return g:acp_behaviorXmlOmniLength >= 0 && + \ a:context =~ '\(<\|<\/\|<[^>]\+ \|<[^>]\+=\"\)\k\{' . + \ g:acp_behaviorXmlOmniLength . ',}$' +endfunction + +" +function acp#meetsForHtmlOmni(context) + return g:acp_behaviorHtmlOmniLength >= 0 && + \ a:context =~ '\(<\|<\/\|<[^>]\+ \|<[^>]\+=\"\)\k\{' . + \ g:acp_behaviorHtmlOmniLength . ',}$' +endfunction + +" +function acp#meetsForCssOmni(context) + if g:acp_behaviorCssOmniPropertyLength >= 0 && + \ a:context =~ '\(^\s\|[;{]\)\s*\k\{' . + \ g:acp_behaviorCssOmniPropertyLength . ',}$' + return 1 + endif + if g:acp_behaviorCssOmniValueLength >= 0 && + \ a:context =~ '[:@!]\s*\k\{' . + \ g:acp_behaviorCssOmniValueLength . ',}$' + return 1 + endif + return 0 +endfunction + +" +function acp#completeSnipmate(findstart, base) + if a:findstart + let s:posSnipmateCompletion = len(matchstr(s:getCurrentText(), '.*\U')) + return s:posSnipmateCompletion + endif + let lenBase = len(a:base) + let items = filter(GetSnipsInCurrentScope(), + \ 'strpart(v:key, 0, lenBase) ==? a:base') + return map(sort(items(items)), 's:makeSnipmateItem(v:val[0], v:val[1])') +endfunction + +" +function acp#onPopupCloseSnipmate() + let word = s:getCurrentText()[s:posSnipmateCompletion :] + for trigger in keys(GetSnipsInCurrentScope()) + if word ==# trigger + call feedkeys("\=TriggerSnippet()\", "n") + return 0 + endif + endfor + return 1 +endfunction + +" +function acp#onPopupPost() + " to clear = expression on command-line + echo '' + if pumvisible() + inoremap acp#onBs() + inoremap acp#onBs() + " a command to restore to original text and select the first match + return (s:behavsCurrent[s:iBehavs].command =~# "\" ? "\\" + \ : "\\") + endif + let s:iBehavs += 1 + if len(s:behavsCurrent) > s:iBehavs + call s:setCompletefunc() + return printf("\%s\=acp#onPopupPost()\", + \ s:behavsCurrent[s:iBehavs].command) + else + let s:lastUncompletable = { + \ 'word': s:getCurrentWord(), + \ 'commands': map(copy(s:behavsCurrent), 'v:val.command')[1:], + \ } + call s:finishPopup(0) + return "\" + endif +endfunction + +" +function acp#onBs() + " using "matchstr" and not "strpart" in order to handle multi-byte + " characters + if call(s:behavsCurrent[s:iBehavs].meets, + \ [matchstr(s:getCurrentText(), '.*\ze.')]) + return "\" + endif + return "\\" +endfunction + +" }}}1 +"============================================================================= +" LOCAL FUNCTIONS: {{{1 + +" +function s:mapForMappingDriven() + call s:unmapForMappingDriven() + let s:keysMappingDriven = [ + \ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + \ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + \ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + \ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + \ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + \ '-', '_', '~', '^', '.', ',', ':', '!', '#', '=', '%', '$', '@', '<', '>', '/', '\', + \ '', '', '', ] + for key in s:keysMappingDriven + execute printf('inoremap %s %s=feedPopup()', + \ key, key) + endfor +endfunction + +" +function s:unmapForMappingDriven() + if !exists('s:keysMappingDriven') + return + endif + for key in s:keysMappingDriven + execute 'iunmap ' . key + endfor + let s:keysMappingDriven = [] +endfunction + +" +function s:setTempOption(group, name, value) + call extend(s:tempOptionSet[a:group], { a:name : eval('&' . a:name) }, 'keep') + execute printf('let &%s = a:value', a:name) +endfunction + +" +function s:restoreTempOptions(group) + for [name, value] in items(s:tempOptionSet[a:group]) + execute printf('let &%s = value', name) + endfor + let s:tempOptionSet[a:group] = {} +endfunction + +" +function s:getCurrentWord() + return matchstr(s:getCurrentText(), '\k*$') +endfunction + +" +function s:getCurrentText() + return strpart(getline('.'), 0, col('.') - 1) +endfunction + +" +function s:getPostText() + return strpart(getline('.'), col('.') - 1) +endfunction + +" +function s:isModifiedSinceLastCall() + if exists('s:posLast') + let posPrev = s:posLast + let nLinesPrev = s:nLinesLast + let textPrev = s:textLast + endif + let s:posLast = getpos('.') + let s:nLinesLast = line('$') + let s:textLast = getline('.') + if !exists('posPrev') + return 1 + elseif posPrev[1] != s:posLast[1] || nLinesPrev != s:nLinesLast + return (posPrev[1] - s:posLast[1] == nLinesPrev - s:nLinesLast) + elseif textPrev ==# s:textLast + return 0 + elseif posPrev[2] > s:posLast[2] + return 1 + elseif has('gui_running') && has('multi_byte') + " NOTE: auto-popup causes a strange behavior when IME/XIM is working + return posPrev[2] + 1 == s:posLast[2] + endif + return posPrev[2] != s:posLast[2] +endfunction + +" +function s:makeCurrentBehaviorSet() + let modified = s:isModifiedSinceLastCall() + if exists('s:behavsCurrent[s:iBehavs].repeat') && s:behavsCurrent[s:iBehavs].repeat + let behavs = [ s:behavsCurrent[s:iBehavs] ] + elseif exists('s:behavsCurrent[s:iBehavs]') + return [] + elseif modified + let behavs = copy(exists('g:acp_behavior[&filetype]') + \ ? g:acp_behavior[&filetype] + \ : g:acp_behavior['*']) + else + return [] + endif + let text = s:getCurrentText() + call filter(behavs, 'call(v:val.meets, [text])') + let s:iBehavs = 0 + if exists('s:lastUncompletable') && + \ stridx(s:getCurrentWord(), s:lastUncompletable.word) == 0 && + \ map(copy(behavs), 'v:val.command') ==# s:lastUncompletable.commands + let behavs = [] + else + unlet! s:lastUncompletable + endif + return behavs +endfunction + +" +function s:feedPopup() + " NOTE: CursorMovedI is not triggered while the popup menu is visible. And + " it will be triggered when popup menu is disappeared. + if s:lockCount > 0 || pumvisible() || &paste + return '' + endif + if exists('s:behavsCurrent[s:iBehavs].onPopupClose') + if !call(s:behavsCurrent[s:iBehavs].onPopupClose, []) + call s:finishPopup(1) + return '' + endif + endif + let s:behavsCurrent = s:makeCurrentBehaviorSet() + if empty(s:behavsCurrent) + call s:finishPopup(1) + return '' + endif + " In case of dividing words by symbols (e.g. "for(int", "ab==cd") while a + " popup menu is visible, another popup is not available unless input + " or try popup once. So first completion is duplicated. + call insert(s:behavsCurrent, s:behavsCurrent[s:iBehavs]) + call s:setTempOption(s:GROUP0, 'spell', 0) + call s:setTempOption(s:GROUP0, 'completeopt', 'menuone' . (g:acp_completeoptPreview ? ',preview' : '')) + call s:setTempOption(s:GROUP0, 'complete', g:acp_completeOption) + call s:setTempOption(s:GROUP0, 'ignorecase', g:acp_ignorecaseOption) + " NOTE: With CursorMovedI driven, Set 'lazyredraw' to avoid flickering. + " With Mapping driven, set 'nolazyredraw' to make a popup menu visible. + call s:setTempOption(s:GROUP0, 'lazyredraw', !g:acp_mappingDriven) + " NOTE: 'textwidth' must be restored after . + call s:setTempOption(s:GROUP1, 'textwidth', 0) + call s:setCompletefunc() + call feedkeys(s:behavsCurrent[s:iBehavs].command . "\=acp#onPopupPost()\", 'n') + return '' " this function is called by = +endfunction + +" +function s:finishPopup(fGroup1) + inoremap | iunmap + inoremap | iunmap + let s:behavsCurrent = [] + call s:restoreTempOptions(s:GROUP0) + if a:fGroup1 + call s:restoreTempOptions(s:GROUP1) + endif +endfunction + +" +function s:setCompletefunc() + if exists('s:behavsCurrent[s:iBehavs].completefunc') + call s:setTempOption(0, 'completefunc', s:behavsCurrent[s:iBehavs].completefunc) + endif +endfunction + +" +function s:makeSnipmateItem(key, snip) + if type(a:snip) == type([]) + let descriptions = map(copy(a:snip), 'v:val[0]') + let snipFormatted = '[MULTI] ' . join(descriptions, ', ') + else + let snipFormatted = substitute(a:snip, '\(\n\|\s\)\+', ' ', 'g') + endif + return { + \ 'word': a:key, + \ 'menu': strpart(snipFormatted, 0, 80), + \ } +endfunction + +" +function s:getMatchingSnipItems(base) + let key = a:base . "\n" + if !exists('s:snipItems[key]') + let s:snipItems[key] = items(GetSnipsInCurrentScope()) + call filter(s:snipItems[key], 'strpart(v:val[0], 0, len(a:base)) ==? a:base') + call map(s:snipItems[key], 's:makeSnipmateItem(v:val[0], v:val[1])') + endif + return s:snipItems[key] +endfunction + +" }}}1 +"============================================================================= +" INITIALIZATION {{{1 + +let s:GROUP0 = 0 +let s:GROUP1 = 1 +let s:lockCount = 0 +let s:behavsCurrent = [] +let s:iBehavs = 0 +let s:tempOptionSet = [{}, {}] +let s:snipItems = {} + +" }}}1 +"============================================================================= +" vim: set fdm=marker: diff --git a/vim-plugins/bundle/AutoComplPop/doc/acp.jax b/vim-plugins/bundle/AutoComplPop/doc/acp.jax new file mode 100644 index 0000000..12e55ce --- /dev/null +++ b/vim-plugins/bundle/AutoComplPop/doc/acp.jax @@ -0,0 +1,298 @@ +*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ファイルをランタイムディレクトリã«å±•é–‹ã—ã¾ã™ã€‚ + +以下ã®ã‚ˆã†ã«ãƒ•ァイルãŒé…ç½®ã•れるã¯ãšã§ã™ã€‚ +> + /plugin/acp.vim + /doc/acp.txt + ... +< +ã‚‚ã—ランタイムディレクトリãŒä»–ã®ãƒ—ラグインã¨ã”ãŸæ··ãœã«ãªã‚‹ã®ãŒå«Œãªã‚‰ã€ãƒ•ァイル +ã‚’æ–°è¦ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«é…ç½®ã—ã€ãã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ãƒ‘スを 'runtimepath' ã«è¿½åŠ ã—㦠+ãã ã•ã„。アンインストールも楽ã«ãªã‚Šã¾ã™ã€‚ + +ãã®å¾Œ FuzzyFinder ã®ãƒ˜ãƒ«ãƒ—を有効ã«ã™ã‚‹ãŸã‚ã«ã‚¿ã‚°ãƒ•ァイルを更新ã—ã¦ãã ã•ã„。 +詳ã—ãã¯|add-local-help|ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 + + +============================================================================== +ä½¿ã„æ–¹ *acp-usage* + +ã“ã®ãƒ—ラグインãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„れã°ã€è‡ªå‹•ãƒãƒƒãƒ—アップ㯠vim ã®é–‹å§‹æ™‚ã‹ã‚‰ +有効ã«ãªã‚Šã¾ã™ã€‚ + +カーソル直å‰ã®ãƒ†ã‚­ã‚¹ãƒˆã«å¿œã˜ã¦ã€åˆ©ç”¨ã™ã‚‹è£œå®Œã®ç¨®é¡žã‚’切り替ãˆã¾ã™ã€‚デフォルト㮠+è£œå®Œå‹•ä½œã¯æ¬¡ã®é€šã‚Šã§ã™: + + 補完モード filetype カーソル直å‰ã®ãƒ†ã‚­ã‚¹ãƒˆ ~ + キーワード補完 * 2文字ã®ã‚­ãƒ¼ãƒ¯ãƒ¼ãƒ‰æ–‡å­— + ファイルå補完 * ãƒ•ã‚¡ã‚¤ãƒ«åæ–‡å­— + パスセパレータ + + 0文字以上ã®ãƒ•ã‚¡ã‚¤ãƒ«åæ–‡å­— + オムニ補完 ruby ".", "::" or å˜èªžã‚’æ§‹æˆã™ã‚‹æ–‡å­—以外 + ":" + オムニ補完 python "." + オムニ補完 xml "<", ""ä»¥å¤–ã®æ–‡å­—列 + " ") + オムニ補完 html/xhtml "<", ""ä»¥å¤–ã®æ–‡å­—列 + " ") + オムニ補完 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 = "\" +< + キーワード補完ã®ã‚³ãƒžãƒ³ãƒ‰ã€‚ã“ã®ã‚ªãƒ—ションã«ã¯æ™®é€š "\" ã‹ "\" + を設定ã—ã¾ã™ã€‚ + + *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" ㌠"" ã®ã¨ãã ã‘ + æ„味ãŒã‚りã¾ã™ã€‚ + + "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 +ライセンス: 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: + diff --git a/vim-plugins/bundle/AutoComplPop/doc/acp.txt b/vim-plugins/bundle/AutoComplPop/doc/acp.txt new file mode 100644 index 0000000..324c88b --- /dev/null +++ b/vim-plugins/bundle/AutoComplPop/doc/acp.txt @@ -0,0 +1,512 @@ +*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: +> + /plugin/acp.vim + /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 "<", "" characters + " ") + Omni html/xhtml "<", "" 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 = "\" +< + Command for keyword completion. This option is usually set "\" or + "\". + + *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 "". + + "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 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 "\" cause a problem which inserts a match without + 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 "\". + - 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 or , the command to + restore the original text (in on_popup_post()) must be reverted, too. + - BUG: When using a custom completion function () 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 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 +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: + diff --git a/vim-plugins/bundle/AutoComplPop/plugin/acp.vim b/vim-plugins/bundle/AutoComplPop/plugin/acp.vim new file mode 100644 index 0000000..0c01a31 --- /dev/null +++ b/vim-plugins/bundle/AutoComplPop/plugin/acp.vim @@ -0,0 +1,170 @@ +"============================================================================= +" Copyright (c) 2007-2009 Takeshi NISHIDA +" +" GetLatestVimScripts: 1879 1 :AutoInstall: AutoComplPop +"============================================================================= +" LOAD GUARD {{{1 + +if exists('g:loaded_acp') + finish +elseif v:version < 702 + echoerr 'AutoComplPop does not support this version of vim (' . v:version . ').' + finish +endif +let g:loaded_acp = 1 + +" }}}1 +"============================================================================= +" FUNCTION: {{{1 + +" +function s:defineOption(name, default) + if !exists(a:name) + let {a:name} = a:default + endif +endfunction + +" +function s:makeDefaultBehavior() + let behavs = { + \ '*' : [], + \ 'ruby' : [], + \ 'python' : [], + \ 'perl' : [], + \ 'xml' : [], + \ 'html' : [], + \ 'xhtml' : [], + \ 'css' : [], + \ } + "--------------------------------------------------------------------------- + if !empty(g:acp_behaviorUserDefinedFunction) && + \ !empty(g:acp_behaviorUserDefinedMeets) + for key in keys(behavs) + call add(behavs[key], { + \ 'command' : "\\", + \ 'completefunc' : g:acp_behaviorUserDefinedFunction, + \ 'meets' : g:acp_behaviorUserDefinedMeets, + \ 'repeat' : 0, + \ }) + endfor + endif + "--------------------------------------------------------------------------- + for key in keys(behavs) + call add(behavs[key], { + \ 'command' : "\\", + \ 'completefunc' : 'acp#completeSnipmate', + \ 'meets' : 'acp#meetsForSnipmate', + \ 'onPopupClose' : 'acp#onPopupCloseSnipmate', + \ 'repeat' : 0, + \ }) + endfor + "--------------------------------------------------------------------------- + for key in keys(behavs) + call add(behavs[key], { + \ 'command' : g:acp_behaviorKeywordCommand, + \ 'meets' : 'acp#meetsForKeyword', + \ 'repeat' : 0, + \ }) + endfor + "--------------------------------------------------------------------------- + for key in keys(behavs) + call add(behavs[key], { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForFile', + \ 'repeat' : 1, + \ }) + endfor + "--------------------------------------------------------------------------- + call add(behavs.ruby, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForRubyOmni', + \ 'repeat' : 0, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.python, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForPythonOmni', + \ 'repeat' : 0, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.perl, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForPerlOmni', + \ 'repeat' : 0, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.xml, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForXmlOmni', + \ 'repeat' : 1, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.html, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForHtmlOmni', + \ 'repeat' : 1, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.xhtml, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForHtmlOmni', + \ 'repeat' : 1, + \ }) + "--------------------------------------------------------------------------- + call add(behavs.css, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForCssOmni', + \ 'repeat' : 0, + \ }) + "--------------------------------------------------------------------------- + return behavs +endfunction + +" }}}1 +"============================================================================= +" INITIALIZATION {{{1 + +"----------------------------------------------------------------------------- +call s:defineOption('g:acp_enableAtStartup', 1) +call s:defineOption('g:acp_mappingDriven', 0) +call s:defineOption('g:acp_ignorecaseOption', 1) +call s:defineOption('g:acp_completeOption', '.,w,b,k') +call s:defineOption('g:acp_completeoptPreview', 0) +call s:defineOption('g:acp_behaviorUserDefinedFunction', '') +call s:defineOption('g:acp_behaviorUserDefinedMeets', '') +call s:defineOption('g:acp_behaviorSnipmateLength', -1) +call s:defineOption('g:acp_behaviorKeywordCommand', "\") +call s:defineOption('g:acp_behaviorKeywordLength', 2) +call s:defineOption('g:acp_behaviorKeywordIgnores', []) +call s:defineOption('g:acp_behaviorFileLength', 0) +call s:defineOption('g:acp_behaviorRubyOmniMethodLength', 0) +call s:defineOption('g:acp_behaviorRubyOmniSymbolLength', 1) +call s:defineOption('g:acp_behaviorPythonOmniLength', 0) +call s:defineOption('g:acp_behaviorPerlOmniLength', -1) +call s:defineOption('g:acp_behaviorXmlOmniLength', 0) +call s:defineOption('g:acp_behaviorHtmlOmniLength', 0) +call s:defineOption('g:acp_behaviorCssOmniPropertyLength', 1) +call s:defineOption('g:acp_behaviorCssOmniValueLength', 0) +call s:defineOption('g:acp_behavior', {}) +"----------------------------------------------------------------------------- +call extend(g:acp_behavior, s:makeDefaultBehavior(), 'keep') +"----------------------------------------------------------------------------- +command! -bar -narg=0 AcpEnable call acp#enable() +command! -bar -narg=0 AcpDisable call acp#disable() +command! -bar -narg=0 AcpLock call acp#lock() +command! -bar -narg=0 AcpUnlock call acp#unlock() +"----------------------------------------------------------------------------- +" legacy commands +command! -bar -narg=0 AutoComplPopEnable AcpEnable +command! -bar -narg=0 AutoComplPopDisable AcpDisable +command! -bar -narg=0 AutoComplPopLock AcpLock +command! -bar -narg=0 AutoComplPopUnlock AcpUnlock +"----------------------------------------------------------------------------- +if g:acp_enableAtStartup + AcpEnable +endif +"----------------------------------------------------------------------------- + +" }}}1 +"============================================================================= +" vim: set fdm=marker: diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp.vim new file mode 100644 index 0000000..19ac146 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp.vim @@ -0,0 +1,2289 @@ +" ============================================================================= +" File: autoload/ctrlp.vim +" Description: Fuzzy file, buffer, mru, tag, etc finder. +" Author: Kien Nguyen +" Version: 1.79 +" ============================================================================= + +" ** Static variables {{{1 +" s:ignore() {{{2 +fu! s:ignore() + let igdirs = [ + \ '\.git', + \ '\.hg', + \ '\.svn', + \ '_darcs', + \ '\.bzr', + \ '\.cdv', + \ '\~\.dep', + \ '\~\.dot', + \ '\~\.nib', + \ '\~\.plst', + \ '\.pc', + \ '_MTN', + \ 'blib', + \ 'CVS', + \ 'RCS', + \ 'SCCS', + \ '_sgbak', + \ 'autom4te\.cache', + \ 'cover_db', + \ '_build', + \ ] + let igfiles = [ + \ '\~$', + \ '#.+#$', + \ '[._].*\.swp$', + \ 'core\.\d+$', + \ '\.exe$', + \ '\.so$', + \ '\.bak$', + \ '\.png$', + \ '\.jpg$', + \ '\.gif$', + \ '\.zip$', + \ '\.rar$', + \ '\.tar\.gz$', + \ ] + retu { + \ 'dir': '\v[\/]('.join(igdirs, '|').')$', + \ 'file': '\v'.join(igfiles, '|'), + \ } +endf +" Script local vars {{{2 +let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = + \ ['g:ctrlp_', 'b:ctrlp_', { + \ 'abbrev': ['s:abbrev', {}], + \ 'arg_map': ['s:argmap', 0], + \ 'buffer_func': ['s:buffunc', {}], + \ 'by_filename': ['s:byfname', 0], + \ 'custom_ignore': ['s:usrign', s:ignore()], + \ 'default_input': ['s:deftxt', 0], + \ 'dont_split': ['s:nosplit', 'netrw'], + \ 'dotfiles': ['s:showhidden', 0], + \ 'extensions': ['s:extensions', []], + \ 'follow_symlinks': ['s:folsym', 0], + \ 'highlight_match': ['s:mathi', [1, 'CtrlPMatch']], + \ 'jump_to_buffer': ['s:jmptobuf', 'Et'], + \ 'key_loop': ['s:keyloop', 0], + \ 'lazy_update': ['s:lazy', 0], + \ 'match_func': ['s:matcher', {}], + \ 'match_window': ['s:mw', ''], + \ 'match_window_bottom': ['s:mwbottom', 1], + \ 'match_window_reversed': ['s:mwreverse', 1], + \ 'max_depth': ['s:maxdepth', 40], + \ 'max_files': ['s:maxfiles', 10000], + \ 'max_height': ['s:mxheight', 10], + \ 'max_history': ['s:maxhst', exists('+hi') ? &hi : 20], + \ 'mruf_default_order': ['s:mrudef', 0], + \ 'open_func': ['s:openfunc', {}], + \ 'open_multi': ['s:opmul', '1v'], + \ 'open_new_file': ['s:newfop', 'v'], + \ 'prompt_mappings': ['s:urprtmaps', 0], + \ 'regexp_search': ['s:regexp', 0], + \ 'root_markers': ['s:rmarkers', []], + \ 'split_window': ['s:splitwin', 0], + \ 'status_func': ['s:status', {}], + \ 'tabpage_position': ['s:tabpage', 'ac'], + \ 'use_caching': ['s:caching', 1], + \ 'use_migemo': ['s:migemo', 0], + \ 'user_command': ['s:usrcmd', ''], + \ 'working_path_mode': ['s:pathmode', 'ra'], + \ }, { + \ 'open_multiple_files': 's:opmul', + \ 'regexp': 's:regexp', + \ 'reuse_window': 's:nosplit', + \ 'show_hidden': 's:showhidden', + \ 'switch_buffer': 's:jmptobuf', + \ }, { + \ 'root_markers': 's:rmarkers', + \ 'user_command': 's:usrcmd', + \ 'working_path_mode': 's:pathmode', + \ }] + +" Global options +let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0, + \ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'ttimeout': 0, + \ 'gcr': 'a:blinkon0', 'ic': 1, 'lmap': '', 'mousef': 0, 'imd': 1 } + +" Keymaps +let [s:lcmap, s:prtmaps] = ['nn ', { + \ 'PrtBS()': ['', ''], + \ 'PrtDelete()': [''], + \ 'PrtDeleteWord()': [''], + \ 'PrtClear()': [''], + \ 'PrtSelectMove("j")': ['', ''], + \ 'PrtSelectMove("k")': ['', ''], + \ 'PrtSelectMove("t")': ['', ''], + \ 'PrtSelectMove("b")': ['', ''], + \ 'PrtSelectMove("u")': ['', ''], + \ 'PrtSelectMove("d")': ['', ''], + \ 'PrtHistory(-1)': [''], + \ 'PrtHistory(1)': [''], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], + \ 'AcceptSelection("h")': ['', '', ''], + \ 'AcceptSelection("t")': [''], + \ 'AcceptSelection("v")': ['', ''], + \ 'ToggleFocus()': [''], + \ 'ToggleRegex()': [''], + \ 'ToggleByFname()': [''], + \ 'ToggleType(1)': ['', ''], + \ 'ToggleType(-1)': ['', ''], + \ 'PrtExpandDir()': [''], + \ 'PrtInsert("c")': ['', ''], + \ 'PrtInsert()': [''], + \ 'PrtCurStart()': [''], + \ 'PrtCurEnd()': [''], + \ 'PrtCurLeft()': ['', '', ''], + \ 'PrtCurRight()': ['', ''], + \ 'PrtClearCache()': [''], + \ 'PrtDeleteEnt()': [''], + \ 'CreateNewFile()': [''], + \ 'MarkToOpen()': [''], + \ 'OpenMulti()': [''], + \ 'PrtExit()': ['', '', ''], + \ }] + +if !has('gui_running') + cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0)) +en + +let s:compare_lim = 3000 + +let s:ficounts = {} + +let s:ccex = s:pref.'clear_cache_on_exit' + +" Regexp +let s:fpats = { + \ '^\(\\|\)\|\(\\|\)$': '\\|', + \ '^\\\(zs\|ze\|<\|>\)': '^\\\(zs\|ze\|<\|>\)', + \ '^\S\*$': '\*', + \ '^\S\\?$': '\\?', + \ } + +" Keypad +let s:kprange = { + \ 'Plus': '+', + \ 'Minus': '-', + \ 'Divide': '/', + \ 'Multiply': '*', + \ 'Point': '.', + \ } + +" Highlight groups +let s:hlgrps = { + \ 'NoEntries': 'Error', + \ 'Mode1': 'Character', + \ 'Mode2': 'LineNr', + \ 'Stats': 'Function', + \ 'Match': 'Identifier', + \ 'PrtBase': 'Comment', + \ 'PrtText': 'Normal', + \ 'PrtCursor': 'Constant', + \ } +" Get the options {{{2 +fu! s:opts(...) + unl! s:usrign s:usrcmd s:urprtmaps + for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) + let {each} = s:{each} + en | endfo + for [ke, va] in items(s:opts) + let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] + endfo + unl va + for [ke, va] in items(s:new_opts) + let {va} = {exists(s:pref.ke) ? s:pref.ke : va} + endfo + unl va + for [ke, va] in items(s:lc_opts) + if exists(s:bpref.ke) + unl {va} + let {va} = {s:bpref.ke} + en + endfo + " Match window options + cal s:match_window_opts() + " One-time values + if a:0 && a:1 != {} + unl va + for [ke, va] in items(a:1) + let opke = substitute(ke, '\(\w:\)\?ctrlp_', '', '') + if has_key(s:lc_opts, opke) + let sva = s:lc_opts[opke] + unl {sva} + let {sva} = va + en + endfo + en + for each in ['byfname', 'regexp'] | if exists(each) + let s:{each} = {each} + en | endfo + if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en + let s:maxdepth = min([s:maxdepth, 100]) + let s:glob = s:showhidden ? '.*\|*' : '*' + let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) + let s:lash = ctrlp#utils#lash() + if s:keyloop + let [s:lazy, s:glbs['imd']] = [0, 0] + en + if s:lazy + cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) + en + " Extensions + if !( exists('extensions') && extensions == s:extensions ) + for each in s:extensions + exe 'ru autoload/ctrlp/'.each.'.vim' + endfo + en + " Keymaps + if type(s:urprtmaps) == 4 + cal extend(s:prtmaps, s:urprtmaps) + en +endf + +fu! s:match_window_opts() + let s:mw_pos = + \ s:mw =~ 'top\|bottom' ? matchstr(s:mw, 'top\|bottom') : + \ exists('g:ctrlp_match_window_bottom') ? ( s:mwbottom ? 'bottom' : 'top' ) + \ : 'bottom' + let s:mw_order = + \ s:mw =~ 'order:[^,]\+' ? matchstr(s:mw, 'order:\zs[^,]\+') : + \ exists('g:ctrlp_match_window_reversed') ? ( s:mwreverse ? 'btt' : 'ttb' ) + \ : 'btt' + let s:mw_max = + \ s:mw =~ 'max:[^,]\+' ? str2nr(matchstr(s:mw, 'max:\zs\d\+')) : + \ exists('g:ctrlp_max_height') ? s:mxheight + \ : 10 + let s:mw_min = + \ s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1 + let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])] + let s:mw_min = min([s:mw_min, s:mw_max]) + let s:mw_res = + \ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+')) + \ : min([s:mw_max, &lines]) + let s:mw_res = max([s:mw_res, 1]) +endf +"}}}1 +" * Open & Close {{{1 +fu! s:Open() + cal s:log(1) + cal s:getenv() + cal s:execextvar('enter') + sil! exe 'keepa' ( s:mw_pos == 'top' ? 'to' : 'bo' ) '1new ControlP' + cal s:buffunc(1) + let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)] + let [s:focus, s:prompt] = [1, ['', '', '']] + abc + if !exists('s:hstry') + let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : [''] + let s:hstry = empty(hst) || !s:maxhst ? [''] : hst + en + for [ke, va] in items(s:glbs) | if exists('+'.ke) + sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va) + en | endfo + if s:opmul != '0' && has('signs') + sign define ctrlpmark text=+> texthl=Search + en + cal s:setupblank() +endf + +fu! s:Close() + cal s:buffunc(0) + if winnr('$') == 1 + bw! + el + try | bun! + cat | clo! | endt + cal s:unmarksigns() + en + for key in keys(s:glbs) | if exists('+'.key) + sil! exe 'let &'.key.' = s:glb_'.key + en | endfo + if exists('s:glb_acd') | let &acd = s:glb_acd | en + let g:ctrlp_lines = [] + if s:winres[1] >= &lines && s:winres[2] == winnr('$') + exe s:winres[0].s:winres[0] + en + unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr + \ s:mrbs s:did_exp + cal ctrlp#recordhist() + cal s:execextvar('exit') + cal s:log(0) + let v:errmsg = s:ermsg + ec +endf +" * Clear caches {{{1 +fu! ctrlp#clr(...) + let [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1] +endf + +fu! ctrlp#clra() + let cadir = ctrlp#utils#cachedir() + if isdirectory(cadir) + let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n") + let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$''' + sil! cal map(s:ifilter(cafiles, eval), 'delete(v:val)') + en + cal ctrlp#clr() +endf + +fu! s:Reset(args) + let opts = has_key(a:args, 'opts') ? [a:args['opts']] : [] + cal call('s:opts', opts) + cal s:autocmds() + cal ctrlp#utils#opts() + cal s:execextvar('opts') +endf +" * Files {{{1 +fu! ctrlp#files() + let cafile = ctrlp#utils#cachefile() + if g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile) + let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] + " Get the list of files + if empty(lscmd) + if !ctrlp#igncwd(s:dyncwd) + cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) + en + el + sil! cal ctrlp#progress('Indexing...') + try | cal s:UserCmd(lscmd) + cat | retu [] | endt + en + " Remove base directory + cal ctrlp#rmbasedir(g:ctrlp_allfiles) + if len(g:ctrlp_allfiles) <= s:compare_lim + cal sort(g:ctrlp_allfiles, 'ctrlp#complen') + en + cal s:writecache(cafile) + let catime = getftime(cafile) + el + let catime = getftime(cafile) + if !( exists('s:initcwd') && s:initcwd == s:dyncwd ) + \ || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime + let s:initcwd = s:dyncwd + let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) + en + en + cal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] }) + retu g:ctrlp_allfiles +endf + +fu! s:GlobPath(dirs, depth) + let entries = split(globpath(a:dirs, s:glob), "\n") + let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] + cal extend(g:ctrlp_allfiles, dnf[1]) + if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth + sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) + cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) + en +endf + +fu! s:UserCmd(lscmd) + let [path, lscmd] = [s:dyncwd, a:lscmd] + let do_ign = + \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] + if do_ign && ctrlp#igncwd(s:cwd) | retu | en + if exists('+ssl') && &ssl + let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] + en + if has('win32') || has('win64') + let lscmd = substitute(lscmd, '\v(^|\&\&\s*)\zscd (/d)@!', 'cd /d ', '') + en + let path = exists('*shellescape') ? shellescape(path) : path + let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n") + if exists('+ssl') && exists('ssl') + let &ssl = ssl + cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")') + en + if exists('s:vcscmd') && s:vcscmd + cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")') + en + if do_ign + if !empty(s:usrign) + let g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1] + en + if &wig != '' + cal filter(g:ctrlp_allfiles, 'glob(v:val) != ""') + en + en +endf + +fu! s:lsCmd() + let cmd = s:usrcmd + if type(cmd) == 1 + retu cmd + elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', ''] + if s:findroot(s:dyncwd, cmd[0], 0, 1) == [] + retu len(cmd) == 3 ? cmd[2] : '' + en + let s:vcscmd = s:lash == '\' + retu cmd[1] + elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') ) + let fndroot = [] + if has_key(cmd, 'types') && cmd['types'] != {} + let [markrs, cmdtypes] = [[], values(cmd['types'])] + for pair in cmdtypes + cal add(markrs, pair[0]) + endfo + let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) + en + if fndroot == [] + retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' + en + for pair in cmdtypes + if pair[0] == fndroot[0] | brea | en + endfo + let s:vcscmd = s:lash == '\' + retu pair[1] + en +endf +" - Buffers {{{1 +fu! ctrlp#buffers(...) + let ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' + \ .' && getbufvar(v:val, "&bl")'), 's:compmreb') + if a:0 && a:1 == 'id' + retu ids + el + let bufs = [[], []] + for id in ids + let bname = bufname(id) + let ebname = bname == '' + let fname = fnamemodify(ebname ? '['.id.'*No Name]' : bname, ':.') + cal add(bufs[ebname], fname) + endfo + retu bufs[0] + bufs[1] + en +endf +" * MatchedItems() {{{1 +fu! s:MatchIt(items, pat, limit, exc) + let [lines, id] = [[], 0] + let pat = + \ s:byfname() ? map(split(a:pat, '^[^;]\+\\\@= 0 + cal add(lines, item) + en | cat | brea | endt + if a:limit > 0 && len(lines) >= a:limit | brea | en + endfo + let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)] + retu lines +endf + +fu! s:MatchedItems(items, pat, limit) + let exc = exists('s:crfilerel') ? s:crfilerel : '' + let items = s:narrowable() ? s:matched + s:mdata[3] : a:items + if s:matcher != {} + let argms = + \ has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{ + \ 'items': items, + \ 'str': a:pat, + \ 'limit': a:limit, + \ 'mmode': s:mmode(), + \ 'ispath': s:ispath, + \ 'crfile': exc, + \ 'regex': s:regexp, + \ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] + let lines = call(s:matcher['match'], argms, s:matcher) + el + let lines = s:MatchIt(items, a:pat, a:limit, exc) + en + let s:matches = len(lines) + unl! s:did_exp + retu lines +endf + +fu! s:SplitPattern(str) + let str = a:str + if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') + let str = s:migemo(str) + en + let s:savestr = str + if s:regexp + let pat = s:regexfilter(str) + el + let lst = split(str, '\zs') + if exists('+ssl') && !&ssl + cal map(lst, 'escape(v:val, ''\'')') + en + for each in ['^', '$', '.'] + cal map(lst, 'escape(v:val, each)') + endfo + en + if exists('lst') + let pat = '' + if !empty(lst) + if s:byfname() && index(lst, ';') > 0 + let fbar = index(lst, ';') + let lst_1 = s:sublist(lst, 0, fbar - 1) + let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : [''] + let pat = s:buildpat(lst_1).';'.s:buildpat(lst_2) + el + let pat = s:buildpat(lst) + en + en + en + retu escape(pat, '~') +endf +" * BuildPrompt() {{{1 +fu! s:Render(lines, pat) + let [&ma, lines, s:res_count] = [1, a:lines, len(a:lines)] + let height = min([max([s:mw_min, s:res_count]), s:winmaxh]) + let pat = s:byfname() ? split(a:pat, '^[^;]\+\\\@' ).( s:byfname() ? 'd' : '>' ).'> ' + let str = escape(s:getinput(), '\') + let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy + if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp') + \ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' ) + sil! cal s:Update(str) + en + sil! cal ctrlp#statusline() + " Toggling + let [hiactive, hicursor, base] = s:focus + \ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base] + \ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] + let hibase = 'CtrlPPrtBase' + " Build it + redr + let prt = copy(s:prompt) + cal map(prt, 'escape(v:val, ''"\'')') + exe 'echoh' hibase '| echon "'.base.'" + \ | echoh' hiactive '| echon "'.prt[0].'" + \ | echoh' hicursor '| echon "'.prt[1].'" + \ | echoh' hiactive '| echon "'.prt[2].'" | echoh None' + " Append the cursor at the end + if empty(prt[1]) && s:focus + exe 'echoh' hibase '| echon "_" | echoh None' + en +endf +" - SetDefTxt() {{{1 +fu! s:SetDefTxt() + if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en + let txt = s:deftxt + if !type(txt) + let path = s:crfpath.s:lash(s:crfpath) + let txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : '' + en + let s:prompt[0] = txt +endf +" ** Prt Actions {{{1 +" Editing {{{2 +fu! s:PrtClear() + if !s:focus | retu | en + unl! s:hstgot + let [s:prompt, s:matches] = [['', '', ''], 1] + cal s:BuildPrompt(1) +endf + +fu! s:PrtAdd(char) + unl! s:hstgot + let s:act_add = 1 + let s:prompt[0] .= a:char + cal s:BuildPrompt(1) + unl s:act_add +endf + +fu! s:PrtBS() + if !s:focus | retu | en + unl! s:hstgot + let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1] + cal s:BuildPrompt(1) +endf + +fu! s:PrtDelete() + if !s:focus | retu | en + unl! s:hstgot + let [prt, s:matches] = [s:prompt, 1] + let prt[1] = matchstr(prt[2], '^.') + let prt[2] = substitute(prt[2], '^.', '', '') + cal s:BuildPrompt(1) +endf + +fu! s:PrtDeleteWord() + if !s:focus | retu | en + unl! s:hstgot + let [str, s:matches] = [s:prompt[0], 1] + let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$') + \ : str =~ '\w\W\+$' ? matchstr(str, '^.\+\w\ze\W\+$') + \ : str =~ '\s\+$' ? matchstr(str, '^.*\S\ze\s\+$') + \ : str =~ '\v^(\S+|\s+)$' ? '' : str + let s:prompt[0] = str + cal s:BuildPrompt(1) +endf + +fu! s:PrtInsert(...) + if !s:focus | retu | en + let type = !a:0 ? '' : a:1 + if !a:0 + let type = s:insertstr() + if type == 'cancel' | retu | en + en + if type ==# 'r' + let regcont = s:getregs() + if regcont < 0 | retu | en + en + unl! s:hstgot + let s:act_add = 1 + let s:prompt[0] .= type ==# 'w' ? s:crword + \ : type ==# 'f' ? s:crgfile + \ : type ==# 's' ? s:regisfilter('/') + \ : type ==# 'v' ? s:crvisual + \ : type ==# 'c' ? s:regisfilter('+') + \ : type ==# 'r' ? regcont : '' + cal s:BuildPrompt(1) + unl s:act_add +endf + +fu! s:PrtExpandDir() + if !s:focus | retu | en + let str = s:getinput('c') + if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi + let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs') + let str = get(hasat, 1, '') + if str =~# '\v^[~$]\i{-}[\/]?|^#(\):(p|h|8|\~|\.|g?s+)' + let spc = str =~# '^%' ? s:crfile + \ : str =~# '^' ? s:crgfile + \ : str =~# '^' ? s:crword + \ : str =~# '^' ? s:crnbword : '' + let pat = '(:(p|h|8|\~|\.|g?s(.)[^\3]*\3[^\3]*\3))+' + let mdr = matchstr(str, '\v^[^:]+\zs'.pat) + let nmd = matchstr(str, '\v^[^:]+'.pat.'\zs.{-}$') + let str = fnamemodify(s:fnesc(spc, 'g'), mdr).nmd + en + en + if str == '' | retu | en + unl! s:hstgot + let s:act_add = 1 + let [base, seed] = s:headntail(str) + if str =~# '^[\/]' + let base = expand('/').base + en + let dirs = s:dircompl(base, seed) + if len(dirs) == 1 + let str = dirs[0] + elsei len(dirs) > 1 + let str .= s:findcommon(dirs, str) + en + let s:prompt[0] = exists('hasat') ? hasat[0].str : str + cal s:BuildPrompt(1) + unl s:act_add +endf +" Movement {{{2 +fu! s:PrtCurLeft() + if !s:focus | retu | en + let prt = s:prompt + if !empty(prt[0]) + let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'), + \ prt[1] . prt[2]] + en + cal s:BuildPrompt(0) +endf + +fu! s:PrtCurRight() + if !s:focus | retu | en + let prt = s:prompt + let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'), + \ substitute(prt[2], '^.', '', '')] + cal s:BuildPrompt(0) +endf + +fu! s:PrtCurStart() + if !s:focus | retu | en + let str = join(s:prompt, '') + let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')] + cal s:BuildPrompt(0) +endf + +fu! s:PrtCurEnd() + if !s:focus | retu | en + let s:prompt = [join(s:prompt, ''), '', ''] + cal s:BuildPrompt(0) +endf + +fu! s:PrtSelectMove(dir) + let wht = winheight(0) + let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} + exe 'keepj norm!' dirs[a:dir] + if s:nolim != 1 | let s:cline = line('.') | en + if line('$') > winheight(0) | cal s:BuildPrompt(0) | en +endf + +fu! s:PrtSelectJump(char) + let lines = copy(s:lines) + if s:byfname() + cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]') + en + " Cycle through matches, use s:jmpchr to store last jump + let chr = escape(matchstr(a:char, '^.'), '.~') + let smartcs = &scs && chr =~ '\u' ? '\C' : '' + if match(lines, smartcs.'^'.chr) >= 0 + " If not exists or does but not for the same char + let pos = match(lines, smartcs.'^'.chr) + if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr ) + let [jmpln, s:jmpchr] = [pos, [chr, pos]] + elsei exists('s:jmpchr') && s:jmpchr[0] == chr + " Start of lines + if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en + let npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1) + let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] + en + exe 'keepj norm!' ( jmpln + 1 ).'G' + if s:nolim != 1 | let s:cline = line('.') | en + if line('$') > winheight(0) | cal s:BuildPrompt(0) | en + en +endf +" Misc {{{2 +fu! s:PrtFocusMap(char) + cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char]) +endf + +fu! s:PrtClearCache() + if s:itemtype == 0 + cal ctrlp#clr() + elsei s:itemtype > 2 + cal ctrlp#clr(s:statypes[s:itemtype][1]) + en + if s:itemtype == 2 + let g:ctrlp_lines = ctrlp#mrufiles#refresh() + el + cal ctrlp#setlines() + en + let s:force = 1 + cal s:BuildPrompt(1) + unl s:force +endf + +fu! s:PrtDeleteEnt() + if s:itemtype == 2 + cal s:PrtDeleteMRU() + elsei type(s:getextvar('wipe')) == 1 + cal s:delent(s:getextvar('wipe')) + en +endf + +fu! s:PrtDeleteMRU() + if s:itemtype == 2 + cal s:delent('ctrlp#mrufiles#remove') + en +endf + +fu! s:PrtExit() + if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' + noa cal s:Close() + noa winc p + en +endf + +fu! s:PrtHistory(...) + if !s:focus || !s:maxhst | retu | en + let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1] + " Save to history if not saved before + let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)] + let idx = exists('s:hisidx') ? s:hisidx + a:1 : a:1 + " Limit idx within 0 and hslen + let idx = idx < 0 ? 0 : idx >= hslen ? hslen > 1 ? hslen - 1 : 0 : idx + let s:prompt = [hst[idx], '', ''] + let [s:hisidx, s:hstgot, s:force] = [idx, 1, 1] + cal s:BuildPrompt(1) + unl s:force +endf +"}}}1 +" * Mappings {{{1 +fu! s:MapNorms() + if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en + let pcmd = "nn \ \ \ :\cal \%s(\"%s\")\" + let cmd = substitute(pcmd, 'k%s', 'char-%d', '') + let pfunc = 'PrtFocusMap' + let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123) + for each in [34, 92, 124] + exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\')) + endfo + for each in ranges + exe printf(cmd, each, pfunc, nr2char(each)) + endfo + for each in range(0, 9) + exe printf(pcmd, each, pfunc, each) + endfo + for [ke, va] in items(s:kprange) + exe printf(pcmd, ke, pfunc, va) + endfo + let s:nmapped = s:bufnr +endf + +fu! s:MapSpecs() + if !( exists('s:smapped') && s:smapped == s:bufnr ) + " Correct arrow keys in terminal + if ( has('termresponse') && v:termresponse =~ "\" ) + \ || &term =~? '\vxterm|','\B ','\C ','\D '] + exe s:lcmap.' ['.each + endfo + en + en + for [ke, va] in items(s:prtmaps) | for kp in va + exe s:lcmap kp ':cal '.ke.'' + endfo | endfo + let s:smapped = s:bufnr +endf + +fu! s:KeyLoop() + wh exists('s:init') && s:keyloop + redr + let nr = getchar() + let chr = !type(nr) ? nr2char(nr) : nr + if nr >=# 0x20 + cal s:PrtFocusMap(chr) + el + let cmd = matchstr(maparg(chr), ':\zs.\+\ze$') + exe ( cmd != '' ? cmd : 'norm '.chr ) + en + endw +endf +" * Toggling {{{1 +fu! s:ToggleFocus() + let s:focus = !s:focus + cal s:BuildPrompt(0) +endf + +fu! s:ToggleRegex() + let s:regexp = !s:regexp + cal s:PrtSwitcher() +endf + +fu! s:ToggleByFname() + if s:ispath + let s:byfname = !s:byfname + let s:mfunc = s:mfunc() + cal s:PrtSwitcher() + en +endf + +fu! s:ToggleType(dir) + let max = len(g:ctrlp_ext_vars) + 2 + let next = s:walker(max, s:itemtype, a:dir) + cal ctrlp#syntax() + cal ctrlp#setlines(next) + cal s:PrtSwitcher() +endf + +fu! s:ToggleKeyLoop() + let s:keyloop = !s:keyloop + if exists('+imd') + let &imd = !s:keyloop + en + if s:keyloop + let [&ut, s:lazy] = [0, 0] + cal s:KeyLoop() + elsei has_key(s:glbs, 'ut') + let [&ut, s:lazy] = [s:glbs['ut'], 1] + en +endf + +fu! s:ToggleMRURelative() + cal ctrlp#mrufiles#tgrel() + cal s:PrtClearCache() +endf + +fu! s:PrtSwitcher() + let [s:force, s:matches] = [1, 1] + cal s:BuildPrompt(1) + unl s:force +endf +" - SetWD() {{{1 +fu! s:SetWD(args) + if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0 + \ && exists('s:dyncwd') + cal ctrlp#setdir(s:dyncwd) | retu + en + if has_key(a:args, 'dir') && a:args['dir'] != '' + cal ctrlp#setdir(a:args['dir']) | retu + en + let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode + let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] + if s:crfile =~ '^.\+://' | retu | en + if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 ) + \ || ( !type(pmode) && pmode ) + if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en + cal ctrlp#setdir(s:crfpath) + en + if pmode =~ 'r' || pmode == 2 + let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs'] + let spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath + if type(s:rmarkers) == 3 && !empty(s:rmarkers) + if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en + cal filter(markers, 'index(s:rmarkers, v:val) < 0') + en + cal s:findroot(spath, markers, 0, 0) + en +endf +" * AcceptSelection() {{{1 +fu! ctrlp#acceptfile(...) + let useb = 0 + if a:0 == 1 && type(a:1) == 4 + let [md, line] = [a:1['action'], a:1['line']] + let atl = has_key(a:1, 'tail') ? a:1['tail'] : '' + el + let [md, line] = [a:1, a:2] + let atl = a:0 > 2 ? a:3 : '' + en + if !type(line) + let [filpath, bufnr, useb] = [line, line, 1] + el + let filpath = fnamemodify(line, ':p') + if s:nonamecond(line, filpath) + let bufnr = str2nr(matchstr(line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + let [filpath, useb] = [bufnr, 1] + el + let bufnr = bufnr('^'.filpath.'$') + en + en + cal s:PrtExit() + let tail = s:tail() + let j2l = atl != '' ? atl : matchstr(tail, '^ +\zs\d\+$') + if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0 + \ && !( md == 'e' && bufnr == bufnr('%') ) + let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)] + let buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 ) + \ ? s:buftab(bufnr, md) : [0, 0] + en + " Switch to existing buffer or open new one + if exists('jmpb') && bufwinnr > 0 + \ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) ) + exe bufwinnr.'winc w' + if j2l | cal ctrlp#j2l(j2l) | en + elsei exists('jmpb') && buftab[0] + \ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) ) + exe 'tabn' buftab[0] + exe buftab[1].'winc w' + if j2l | cal ctrlp#j2l(j2l) | en + el + " Determine the command to use + let useb = bufnr > 0 && buflisted(bufnr) && ( empty(tail) || useb ) + let cmd = + \ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) : + \ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) : + \ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) : + \ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) + " Reset &switchbuf option + let [swb, &swb] = [&swb, ''] + " Open new window/buffer + let [fid, tail] = [( useb ? bufnr : filpath ), ( atl != '' ? ' +'.atl : tail )] + let args = [cmd, fid, tail, 1, [useb, j2l]] + cal call('s:openfile', args) + let &swb = swb + en +endf + +fu! s:SpecInputs(str) + if a:str =~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*)$' && s:spi + let cwd = s:dyncwd + cal ctrlp#setdir(a:str =~ '^\.\.\.*$' ? + \ '../'.repeat('../', strlen(a:str) - 2) : a:str) + if cwd != s:dyncwd | cal ctrlp#setlines() | en + cal s:PrtClear() + retu 1 + elsei a:str == s:lash && s:spi + cal s:SetWD({ 'mode': 'rd' }) + cal ctrlp#setlines() + cal s:PrtClear() + retu 1 + elsei a:str =~ '^@.\+' && s:spi + retu s:at(a:str) + elsei a:str == '?' + cal s:PrtExit() + let hlpwin = &columns > 159 ? '| vert res 80' : '' + sil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0' + retu 1 + en + retu 0 +endf + +fu! s:AcceptSelection(action) + let [md, icr] = [a:action[0], match(a:action, 'r') >= 0] + let subm = icr || ( !icr && md == 'e' ) + if !subm && s:OpenMulti(md) != -1 | retu | en + let str = s:getinput() + if subm | if s:SpecInputs(str) | retu | en | en + " Get the selected line + let line = ctrlp#getcline() + if !subm && !s:itemtype && line == '' && line('.') > s:offset + \ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$' + cal s:CreateNewFile(md) | retu + en + if empty(line) | retu | en + " Do something with it + if s:openfunc != {} && has_key(s:openfunc, s:ctype) + let actfunc = s:openfunc[s:ctype] + let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list' + el + if s:itemtype < 3 + let [actfunc, type] = ['ctrlp#acceptfile', 'dict'] + el + let [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')] + let type = exttype == 'dict' ? exttype : 'list' + en + en + let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }] + \ : [md, line] + cal call(actfunc, actargs) +endf +" - CreateNewFile() {{{1 +fu! s:CreateNewFile(...) + let [md, str] = ['', s:getinput('n')] + if empty(str) | retu | en + if s:argmap && !a:0 + " Get the extra argument + let md = s:argmaps(md, 1) + if md == 'cancel' | retu | en + en + let str = s:sanstail(str) + let [base, fname] = s:headntail(str) + if fname =~ '^[\/]$' | retu | en + if exists('s:marked') && len(s:marked) + " Use the first marked file's path + let path = fnamemodify(values(s:marked)[0], ':p:h') + let base = path.s:lash(path).base + let str = fnamemodify(base.s:lash.fname, ':.') + en + if base != '' | if isdirectory(ctrlp#utils#mkdir(base)) + let optyp = str | en | el | let optyp = fname + en + if !exists('optyp') | retu | en + let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()] + if !stridx(filpath, s:dyncwd) | cal s:insertcache(str) | en + cal s:PrtExit() + let cmd = md == 'r' ? ctrlp#normcmd('e') : + \ s:newfop =~ '1\|t' || ( a:0 && a:1 == 't' ) || md == 't' ? 'tabe' : + \ s:newfop =~ '2\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' : + \ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' : + \ ctrlp#normcmd('e') + cal s:openfile(cmd, filpath, tail, 1) +endf +" * OpenMulti() {{{1 +fu! s:MarkToOpen() + if s:bufnr <= 0 || s:opmul == '0' + \ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) + retu + en + let line = ctrlp#getcline() + if empty(line) | retu | en + let filpath = s:ispath ? fnamemodify(line, ':p') : line + if exists('s:marked') && s:dictindex(s:marked, filpath) > 0 + " Unmark and remove the file from s:marked + let key = s:dictindex(s:marked, filpath) + cal remove(s:marked, key) + if empty(s:marked) | unl s:marked | en + if has('signs') + exe 'sign unplace' key 'buffer='.s:bufnr + en + el + " Add to s:marked and place a new sign + if exists('s:marked') + let vac = s:vacantdict(s:marked) + let key = empty(vac) ? len(s:marked) + 1 : vac[0] + let s:marked = extend(s:marked, { key : filpath }) + el + let [key, s:marked] = [1, { 1 : filpath }] + en + if has('signs') + exe 'sign place' key 'line='.line('.').' name=ctrlpmark buffer='.s:bufnr + en + en + sil! cal ctrlp#statusline() +endf + +fu! s:OpenMulti(...) + let has_marked = exists('s:marked') + if ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath + \ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) + retu -1 + en + " Get the options + let [nr, md] = [matchstr(s:opmul, '\d\+'), matchstr(s:opmul, '[thvi]')] + let [ur, jf] = [s:opmul =~ 'r', s:opmul =~ 'j'] + let md = a:0 ? a:1 : ( md == '' ? 'v' : md ) + let nopt = exists('g:ctrlp_open_multiple_files') + if !has_marked + let line = ctrlp#getcline() + if line == '' | retu | en + let marked = { 1 : fnamemodify(line, ':p') } + let [nr, ur, jf, nopt] = ['1', 0, 0, 1] + en + if ( s:argmap || !has_marked ) && !a:0 + let md = s:argmaps(md, !has_marked ? 2 : 0) + if md == 'c' + cal s:unmarksigns() + unl! s:marked + cal s:BuildPrompt(0) + elsei !has_marked && md =~ '[axd]' + retu s:OpenNoMarks(md, line) + en + if md =~ '\v^c(ancel)?$' | retu | en + let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr + let ur = !has_marked && md == 'r' ? 1 : ur + en + let mkd = values(has_marked ? s:marked : marked) + cal s:sanstail(join(s:prompt, '')) + cal s:PrtExit() + if nr == '0' || md == 'i' + retu map(mkd, "s:openfile('bad', v:val, '', 0)") + en + let tail = s:tail() + let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')] + let useb = bufnr > 0 && buflisted(bufnr) && emptytail + " Move to a replaceable window + let ncmd = ( useb ? ['b', 'bo vert sb'] : ['e', 'bo vne'] ) + \ + ( ur ? [] : ['ignruw'] ) + let fst = call('ctrlp#normcmd', ncmd) + " Check if the current window has a replaceable buffer + let repabl = !( md == 't' && !ur ) && empty(bufname('%')) && empty(&l:ft) + " Commands for the rest of the files + let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'], + \ 't': ['tab sb', 'tabe'] }] + let [swb, &swb] = [&swb, ''] + if md == 't' && ctrlp#tabcount() < tabpagenr() + let s:tabct = ctrlp#tabcount() + en + " Open the files + for va in mkd + let bufnr = bufnr('^'.va.'$') + if bufnr < 0 && getftype(va) == '' | con | en + let useb = bufnr > 0 && buflisted(bufnr) && emptytail + let snd = md != '' && has_key(cmds, md) ? + \ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' ) + let cmd = ic == 1 && ( !( !ur && fst =~ '^[eb]$' ) || repabl ) ? fst : snd + let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ), + \ nr != '' && nr < ic] + if conds[nopt] + if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en + el + cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1) + if jf | if ic == 1 + let crpos = [tabpagenr(), winnr()] + el + let crpos[0] += tabpagenr() <= crpos[0] + let crpos[1] += winnr() <= crpos[1] + en | en + let ic += 1 + en + endfo + if jf && exists('crpos') && ic > 2 + exe ( md == 't' ? 'tabn '.crpos[0] : crpos[1].'winc w' ) + en + let &swb = swb + unl! s:tabct +endf + +fu! s:OpenNoMarks(md, line) + if a:md == 'a' + let [s:marked, key] = [{}, 1] + for line in s:lines + let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') }) + let key += 1 + endfo + cal s:remarksigns() + cal s:BuildPrompt(0) + elsei a:md == 'x' + let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'dict' + let argms = type == 'dict' ? [{ 'action': a:md, 'line': a:line }] + \ : [a:md, a:line] + cal call(s:openfunc[s:ctype], argms, s:openfunc) + elsei a:md == 'd' + let dir = fnamemodify(a:line, ':h') + if isdirectory(dir) + cal ctrlp#setdir(dir) + cal ctrlp#switchtype(0) + cal ctrlp#recordhist() + cal s:PrtClear() + en + en +endf +" ** Helper functions {{{1 +" Sorting {{{2 +fu! ctrlp#complen(...) + " By length + let [len1, len2] = [strlen(a:1), strlen(a:2)] + retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 +endf + +fu! s:compmatlen(...) + " By match length + let mln1 = s:shortest(s:matchlens(a:1, s:compat)) + let mln2 = s:shortest(s:matchlens(a:2, s:compat)) + retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 +endf + +fu! s:comptime(...) + " By last modified time + let [time1, time2] = [getftime(a:1), getftime(a:2)] + retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1 +endf + +fu! s:compmreb(...) + " By last entered time (bufnr) + let [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)] + retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 +endf + +fu! s:compmref(...) + " By last entered time (MRU) + let [id1, id2] = [index(g:ctrlp_lines, a:1), index(g:ctrlp_lines, a:2)] + retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 +endf + +fu! s:comparent(...) + " By same parent dir + if !stridx(s:crfpath, s:dyncwd) + let [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2] + let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)] + if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en + if loc2 == s:crfpath && loc1 != s:crfpath | retu 1 | en + retu 0 + en + retu 0 +endf + +fu! s:compfnlen(...) + " By filename length + let len1 = strlen(split(a:1, s:lash)[-1]) + let len2 = strlen(split(a:2, s:lash)[-1]) + retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 +endf + +fu! s:matchlens(str, pat, ...) + if empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en + let st = a:0 ? a:1 : 0 + let lens = a:0 >= 2 ? a:2 : {} + let nr = a:0 >= 3 ? a:3 : 0 + if nr > 20 | retu {} | en + if match(a:str, a:pat, st) >= 0 + let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)] + let lens = extend(lens, { nr : [strlen(mst), mst] }) + let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) + en + retu lens +endf + +fu! s:shortest(lens) + retu min(map(values(a:lens), 'v:val[0]')) +endf + +fu! s:mixedsort(...) + if s:itemtype == 1 + let pat = '[\/]\?\[\d\+\*No Name\]$' + if a:1 =~# pat && a:2 =~# pat | retu 0 + elsei a:1 =~# pat | retu 1 + elsei a:2 =~# pat | retu -1 | en + en + let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] + if s:ispath + let ms = [] + if s:res_count < 21 + let ms += [s:compfnlen(a:1, a:2)] + if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en + if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en + en + if s:itemtype =~ '^[12]$' + let ms += [s:compmref(a:1, a:2)] + let cln = cml ? cln : 0 + en + let ms += [cml, 0, 0, 0] + let mp = call('s:multipliers', ms[:3]) + retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3] + en + retu cln + cml * 2 +endf + +fu! s:multipliers(...) + let mp0 = !a:1 ? 0 : 2 + let mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 ) + let mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) ) + let mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) ) + retu [mp0, mp1, mp2, mp3] +endf + +fu! s:compval(...) + retu a:1 - a:2 +endf +" Statusline {{{2 +fu! ctrlp#statusline() + if !exists('s:statypes') + let s:statypes = [ + \ ['files', 'fil'], + \ ['buffers', 'buf'], + \ ['mru files', 'mru'], + \ ] + if !empty(g:ctrlp_ext_vars) + cal map(copy(g:ctrlp_ext_vars), + \ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])') + en + en + let tps = s:statypes + let max = len(tps) - 1 + let nxt = tps[s:walker(max, s:itemtype, 1)][1] + let prv = tps[s:walker(max, s:itemtype, -1)][1] + let s:ctype = tps[s:itemtype][0] + let focus = s:focus ? 'prt' : 'win' + let byfname = s:ispath ? s:byfname ? 'file' : 'path' : 'line' + let marked = s:opmul != '0' ? + \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' + if s:status != {} + let argms = + \ has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ + \ 'focus': focus, + \ 'byfname': byfname, + \ 'regex': s:regexp, + \ 'prev': prv, + \ 'item': s:ctype, + \ 'next': nxt, + \ 'marked': marked, + \ }] : [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] + let &l:stl = call(s:status['main'], argms, s:status) + el + let item = '%#CtrlPMode1# '.s:ctype.' %*' + let focus = '%#CtrlPMode2# '.focus.' %*' + let byfname = '%#CtrlPMode1# '.byfname.' %*' + let regex = s:regexp ? '%#CtrlPMode2# regex %*' : '' + let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' + let dir = ' %=%<%#CtrlPMode2# %{getcwd()} %*' + let &l:stl = focus.byfname.regex.slider.marked.dir + en +endf + +fu! s:dismrk() + retu has('signs') ? len(s:marked) : + \ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ') +endf + +fu! ctrlp#progress(enum, ...) + if has('macunix') || has('mac') | sl 1m | en + let txt = a:0 ? '(press ctrl-c to abort)' : '' + if s:status != {} + let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' + \ ? [{ 'str': a:enum }] : [a:enum] + let &l:stl = call(s:status['prog'], argms, s:status) + el + let &l:stl = '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' + en + redraws +endf +" *** Paths {{{2 +" Line formatting {{{3 +fu! s:formatline(str) + let str = a:str + if s:itemtype == 1 + let filpath = fnamemodify(str, ':p') + let bufnr = s:nonamecond(str, filpath) + \ ? str2nr(matchstr(str, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + \ : bufnr('^'.filpath.'$') + let idc = ( bufnr == bufnr('#') ? '#' : '' ) + \ . ( getbufvar(bufnr, '&ma') ? '' : '-' ) + \ . ( getbufvar(bufnr, '&ro') ? '=' : '' ) + \ . ( getbufvar(bufnr, '&mod') ? '+' : '' ) + let str .= idc != '' ? ' '.idc : '' + en + let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str) + retu '> '.( cond ? s:pathshorten(str) : str ) +endf + +fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') +endf + +fu! s:offset(lines, height) + let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 + retu s:offset > 0 ? ( repeat([''], s:offset) + a:lines ) : a:lines +endf +" Directory completion {{{3 +fu! s:dircompl(be, sd) + if a:sd == '' | retu [] | en + if a:be == '' + let [be, sd] = [s:dyncwd, a:sd] + el + let be = a:be.s:lash(a:be) + let sd = be.a:sd + en + let dirs = split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), "\n") + if a:be == '' + let dirs = ctrlp#rmbasedir(dirs) + en + cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))' + \ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''') + retu dirs +endf + +fu! s:findcommon(items, seed) + let [items, id, cmn, ic] = [copy(a:items), strlen(a:seed), '', 0] + cal map(items, 'strpart(v:val, id)') + for char in split(items[0], '\zs') + for item in items[1:] + if item[ic] != char | let brk = 1 | brea | en + endfo + if exists('brk') | brea | en + let cmn .= char + let ic += 1 + endfo + retu cmn +endf +" Misc {{{3 +fu! s:headntail(str) + let parts = split(a:str, '[\/]\ze[^\/]\+[\/:]\?$') + retu len(parts) == 1 ? ['', parts[0]] : len(parts) == 2 ? parts : [] +endf + +fu! s:lash(...) + retu ( a:0 ? a:1 : s:dyncwd ) !~ '[\/]$' ? s:lash : '' +endf + +fu! s:ispathitem() + retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) +endf + +fu! ctrlp#igncwd(cwd) + retu ctrlp#utils#glob(a:cwd, 0) == '' || + \ ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) ) +endf + +fu! ctrlp#dirnfile(entries) + let [items, cwd] = [[[], []], s:dyncwd.s:lash()] + for each in a:entries + let etype = getftype(each) + if s:igntype >= 0 && s:usrign(each, etype) | con | en + if etype == 'dir' + if s:showhidden | if each !~ '[\/]\.\{1,2}$' + cal add(items[0], each) + en | el + cal add(items[0], each) + en + elsei etype == 'link' + if s:folsym + let isfile = !isdirectory(each) + if s:folsym == 2 || !s:samerootsyml(each, isfile, cwd) + cal add(items[isfile], each) + en + en + elsei etype == 'file' + cal add(items[1], each) + en + endfo + retu items +endf + +fu! s:usrign(item, type) + retu s:igntype == 1 ? a:item =~ s:usrign + \ : s:igntype == 4 && has_key(s:usrign, a:type) && s:usrign[a:type] != '' + \ ? a:item =~ s:usrign[a:type] : 0 +endf + +fu! s:samerootsyml(each, isfile, cwd) + let resolve = fnamemodify(resolve(a:each), ':p:h') + let resolve .= s:lash(resolve) + retu !( stridx(resolve, a:cwd) && ( stridx(a:cwd, resolve) || a:isfile ) ) +endf + +fu! ctrlp#rmbasedir(items) + let cwd = s:dyncwd.s:lash() + if a:items != [] && !stridx(a:items[0], cwd) + let idx = strlen(cwd) + retu map(a:items, 'strpart(v:val, idx)') + en + retu a:items +endf +" Working directory {{{3 +fu! s:getparent(item) + let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '') + if parent == '' || parent !~ '[\/]' + let parent .= s:lash + en + retu parent +endf + +fu! s:findroot(curr, mark, depth, type) + let [depth, fnd] = [a:depth + 1, 0] + if type(a:mark) == 1 + let fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != '' + elsei type(a:mark) == 3 + for markr in a:mark + if s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != '' + let fnd = 1 + brea + en + endfo + en + if fnd + if !a:type | cal ctrlp#setdir(a:curr) | en + retu [exists('markr') ? markr : a:mark, a:curr] + elsei depth > s:maxdepth + cal ctrlp#setdir(s:cwd) + el + let parent = s:getparent(a:curr) + if parent != a:curr + retu s:findroot(parent, a:mark, depth, a:type) + en + en + retu [] +endf + +fu! ctrlp#setdir(path, ...) + let cmd = a:0 ? a:1 : 'lc!' + sil! exe cmd s:fnesc(a:path, 'c') + let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] +endf +" Fallbacks {{{3 +fu! s:glbpath(...) + retu call('ctrlp#utils#globpath', a:000) +endf + +fu! s:fnesc(...) + retu call('ctrlp#utils#fnesc', a:000) +endf + +fu! ctrlp#setlcdir() + if exists('*haslocaldir') + cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') + en +endf +" Highlighting {{{2 +fu! ctrlp#syntax() + if ctrlp#nosy() | retu | en + for [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo + if synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' + sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' + en + sy match CtrlPNoEntries '^ == NO ENTRIES ==$' + if hlexists('CtrlPLinePre') + sy match CtrlPLinePre '^>' + en +endf + +fu! s:highlight(pat, grp) + if s:matcher != {} | retu | en + cal clearmatches() + if !empty(a:pat) && s:ispath + let pat = s:regexp ? substitute(a:pat, '\\\@ \\zs', 'g') : a:pat + if s:byfname + let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') + let pat = substitute(pat, '\$\@') + en +endf + +fu! s:dohighlight() + retu s:mathi[0] && exists('*clearmatches') && !ctrlp#nosy() +endf +" Prompt history {{{2 +fu! s:gethistloc() + let utilcadir = ctrlp#utils#cachedir() + let cache_dir = utilcadir.s:lash(utilcadir).'hist' + retu [cache_dir, cache_dir.s:lash(cache_dir).'cache.txt'] +endf + +fu! s:gethistdata() + retu ctrlp#utils#readfile(s:gethistloc()[1]) +endf + +fu! ctrlp#recordhist() + let str = join(s:prompt, '') + if empty(str) || !s:maxhst | retu | en + let hst = s:hstry + if len(hst) > 1 && hst[1] == str | retu | en + cal extend(hst, [str], 1) + if len(hst) > s:maxhst | cal remove(hst, s:maxhst, -1) | en + cal ctrlp#utils#writecache(hst, s:gethistloc()[0], s:gethistloc()[1]) +endf +" Signs {{{2 +fu! s:unmarksigns() + if !s:dosigns() | retu | en + for key in keys(s:marked) + exe 'sign unplace' key 'buffer='.s:bufnr + endfo +endf + +fu! s:remarksigns() + if !s:dosigns() | retu | en + for ic in range(1, len(s:lines)) + let line = s:ispath ? fnamemodify(s:lines[ic - 1], ':p') : s:lines[ic - 1] + let key = s:dictindex(s:marked, line) + if key > 0 + exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr + en + endfo +endf + +fu! s:dosigns() + retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs') +endf +" Lists & Dictionaries {{{2 +fu! s:ifilter(list, str) + let [rlist, estr] = [[], substitute(a:str, 'v:val', 'each', 'g')] + for each in a:list + try + if eval(estr) + cal add(rlist, each) + en + cat | con | endt + endfo + retu rlist +endf + +fu! s:dictindex(dict, expr) + for key in keys(a:dict) + if a:dict[key] == a:expr | retu key | en + endfo + retu -1 +endf + +fu! s:vacantdict(dict) + retu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)') +endf + +fu! s:sublist(l, s, e) + retu v:version > 701 ? a:l[(a:s):(a:e)] : s:sublist7071(a:l, a:s, a:e) +endf + +fu! s:sublist7071(l, s, e) + let [newlist, id, ae] = [[], a:s, a:e == -1 ? len(a:l) - 1 : a:e] + wh id <= ae + cal add(newlist, get(a:l, id)) + let id += 1 + endw + retu newlist +endf +" Buffers {{{2 +fu! s:buftab(bufnr, md) + for tabnr in range(1, tabpagenr('$')) + if tabpagenr() == tabnr && a:md == 't' | con | en + let buflist = tabpagebuflist(tabnr) + if index(buflist, a:bufnr) >= 0 + for winnr in range(1, tabpagewinnr(tabnr, '$')) + if buflist[winnr - 1] == a:bufnr | retu [tabnr, winnr] | en + endfo + en + endfo + retu [0, 0] +endf + +fu! s:bufwins(bufnr) + let winns = 0 + for tabnr in range(1, tabpagenr('$')) + let winns += count(tabpagebuflist(tabnr), a:bufnr) + endfo + retu winns +endf + +fu! s:nonamecond(str, filpath) + retu a:str =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(a:filpath) + \ && bufnr('^'.a:filpath.'$') < 1 +endf + +fu! ctrlp#normcmd(cmd, ...) + if a:0 < 2 && s:nosplit() | retu a:cmd | en + let norwins = filter(range(1, winnr('$')), + \ 'empty(getbufvar(winbufnr(v:val), "&bt"))') + for each in norwins + let bufnr = winbufnr(each) + if empty(bufname(bufnr)) && empty(getbufvar(bufnr, '&ft')) + let fstemp = each | brea + en + endfo + let norwin = empty(norwins) ? 0 : norwins[0] + if norwin + if index(norwins, winnr()) < 0 + exe ( exists('fstemp') ? fstemp : norwin ).'winc w' + en + retu a:cmd + en + retu a:0 ? a:1 : 'bo vne' +endf + +fu! ctrlp#modfilecond(w) + retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf && + \ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 ) +endf + +fu! s:nosplit() + retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0 +endf + +fu! s:setupblank() + setl noswf nonu nobl nowrap nolist nospell nocuc wfh + setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload + if v:version > 702 + setl nornu noudf cc=0 + en +endf + +fu! s:leavepre() + if exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en + if !( exists(s:ccex) && !{s:ccex} ) + \ && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) + cal ctrlp#clra() + en +endf + +fu! s:checkbuf() + if !exists('s:init') && exists('s:bufnr') && s:bufnr > 0 + exe s:bufnr.'bw!' + en +endf + +fu! s:iscmdwin() + let ermsg = v:errmsg + sil! noa winc p + sil! noa winc p + let [v:errmsg, ermsg] = [ermsg, v:errmsg] + retu ermsg =~ '^E11:' +endf +" Arguments {{{2 +fu! s:at(str) + if a:str =~ '\v^\@(cd|lc[hd]?|chd).*' + let str = substitute(a:str, '\v^\@(cd|lc[hd]?|chd)\s*', '', '') + if str == '' | retu 1 | en + let str = str =~ '^%:.\+' ? fnamemodify(s:crfile, str[1:]) : str + let path = fnamemodify(expand(str, 1), ':p') + if isdirectory(path) + if path != s:dyncwd + cal ctrlp#setdir(path) + cal ctrlp#setlines() + en + cal ctrlp#recordhist() + cal s:PrtClear() + en + retu 1 + en + retu 0 +endf + +fu! s:tail() + if exists('s:optail') && !empty('s:optail') + let tailpref = s:optail !~ '^\s*+' ? ' +' : ' ' + retu tailpref.s:optail + en + retu '' +endf + +fu! s:sanstail(str) + let str = s:spi ? + \ substitute(a:str, '^\(@.*$\|\\\\\ze@\|\.\.\zs[.\/]\+$\)', '', 'g') : a:str + let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] + unl! s:optail + if str =~ '\\\@= 0 + retu char + elsei char =~# "\\v\|\|\|\|\|\" + cal s:BuildPrompt(0) + retu 'cancel' + elsei char =~# "\" && a:args != [] + retu a:args[0] + en + retu call(a:func, a:args) +endf + +fu! s:getregs() + let char = s:textdialog('Insert from register: ') + if char =~# "\\v\|\|\|\|\|\" + cal s:BuildPrompt(0) + retu -1 + elsei char =~# "\" + retu s:getregs() + en + retu s:regisfilter(char) +endf + +fu! s:regisfilter(reg) + retu substitute(getreg(a:reg), "[\t\n]", ' ', 'g') +endf +" Misc {{{2 +fu! s:modevar() + let s:matchtype = s:mtype() + let s:ispath = s:ispathitem() + let s:mfunc = s:mfunc() + let s:nolim = s:getextvar('nolim') + let s:dosort = s:getextvar('sort') + let s:spi = !s:itemtype || s:getextvar('specinput') > 0 +endf + +fu! s:nosort() + retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef ) + \ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort +endf + +fu! s:byfname() + retu s:ispath && s:byfname +endf + +fu! s:narrowable() + retu exists('s:act_add') && exists('s:matched') && s:matched != [] + \ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp] + \ && s:matcher == {} && !exists('s:did_exp') +endf + +fu! s:getinput(...) + let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )] + if s:abbrev != {} + let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : '' + let str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '') + if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k' + retu join(prt, '') + en + let [pf, rz] = [( s:byfname() ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )] + for dict in s:abbrev['abbrevs'] + let dmd = has_key(dict, 'mode') ? dict['mode'] : '' + let pat = escape(dict['pattern'], '~') + if ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 ) + \ || dmd =~ '['.spi.']' ) && str =~ pat + let [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1] + en + endfo + if gmd =~ 't' && !a:0 + let prt[0] = str + el + retu str + en + en + retu spi == 'c' ? prt[0] : join(prt, '') +endf + +fu! s:migemo(str) + let [str, rtp] = [a:str, s:fnesc(&rtp, 'g')] + let dict = s:glbpath(rtp, printf("dict/%s/migemo-dict", &enc), 1) + if !len(dict) + let dict = s:glbpath(rtp, "dict/migemo-dict", 1) + en + if len(dict) + let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s'] + for token in tokens + let rtn = system(printf(cmd, shellescape(token), shellescape(dict))) + let str .= !v:shell_error && strlen(rtn) > 0 ? '.*'.rtn : token + endfo + en + retu str +endf + +fu! s:strwidth(str) + retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str) +endf + +fu! ctrlp#j2l(nr) + exe 'norm!' a:nr.'G' + sil! norm! zvzz +endf + +fu! s:maxf(len) + retu s:maxfiles && a:len > s:maxfiles +endf + +fu! s:regexfilter(str) + let str = a:str + for key in keys(s:fpats) | if str =~ key + let str = substitute(str, s:fpats[key], '', 'g') + en | endfo + retu str +endf + +fu! s:walker(m, p, d) + retu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m +endf + +fu! s:delent(rfunc) + if a:rfunc == '' | retu | en + let [s:force, tbrem] = [1, []] + if exists('s:marked') + let tbrem = values(s:marked) + cal s:unmarksigns() + unl s:marked + en + if tbrem == [] && ( has('dialog_gui') || has('dialog_con') ) && + \ confirm("Wipe all entries?", "&OK\n&Cancel") != 1 + unl s:force + cal s:BuildPrompt(0) + retu + en + let g:ctrlp_lines = call(a:rfunc, [tbrem]) + cal s:BuildPrompt(1) + unl s:force +endf +" Entering & Exiting {{{2 +fu! s:getenv() + let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] + let [s:crword, s:crnbword] = [expand('', 1), expand('', 1)] + let [s:crgfile, s:crline] = [expand('', 1), getline('.')] + let [s:winmaxh, s:crcursor] = [min([s:mw_max, &lines]), getpos('.')] + let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] + let s:crfile = bufname('%') == '' + \ ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1) + let s:crfpath = expand('%:p:h', 1) + let s:mrbs = ctrlp#mrufiles#bufs() +endf + +fu! s:lastvisual() + let cview = winsaveview() + let [ovreg, ovtype] = [getreg('v'), getregtype('v')] + let [oureg, outype] = [getreg('"'), getregtype('"')] + sil! norm! gv"vy + let selected = s:regisfilter('v') + cal setreg('v', ovreg, ovtype) + cal setreg('"', oureg, outype) + cal winrestview(cview) + retu selected +endf + +fu! s:log(m) + if exists('g:ctrlp_log') && g:ctrlp_log | if a:m + let cadir = ctrlp#utils#cachedir() + let apd = g:ctrlp_log > 1 ? '>' : '' + sil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log' + el + sil! redi END + en | en +endf + +fu! s:buffunc(e) + if a:e && has_key(s:buffunc, 'enter') + cal call(s:buffunc['enter'], [], s:buffunc) + elsei !a:e && has_key(s:buffunc, 'exit') + cal call(s:buffunc['exit'], [], s:buffunc) + en +endf + +fu! s:openfile(cmd, fid, tail, chkmod, ...) + let cmd = a:cmd + if a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw )) + let cmd = cmd == 'b' ? 'sb' : 'sp' + en + let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd + let j2l = a:0 && a:1[0] ? a:1[1] : 0 + exe cmd.( a:0 && a:1[0] ? '' : a:tail ) s:fnesc(a:fid, 'f') + if j2l + cal ctrlp#j2l(j2l) + en + if !empty(a:tail) + sil! norm! zvzz + en + if cmd != 'bad' + cal ctrlp#setlcdir() + en +endf + +fu! ctrlp#tabcount() + if exists('s:tabct') + let tabct = s:tabct + let s:tabct += 1 + elsei !type(s:tabpage) + let tabct = s:tabpage + elsei type(s:tabpage) == 1 + let tabpos = + \ s:tabpage =~ 'c' ? tabpagenr() : + \ s:tabpage =~ 'f' ? 1 : + \ s:tabpage =~ 'l' ? tabpagenr('$') : + \ tabpagenr() + let tabct = + \ s:tabpage =~ 'a' ? tabpos : + \ s:tabpage =~ 'b' ? tabpos - 1 : + \ tabpos + en + retu tabct < 0 ? 0 : tabct +endf + +fu! s:settype(type) + retu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type +endf +" Matching {{{2 +fu! s:matchfname(item, pat) + let parts = split(a:item, '[\/]\ze[^\/]\+$') + let mfn = match(parts[-1], a:pat[0]) + retu len(a:pat) == 1 ? mfn : len(a:pat) == 2 ? + \ ( mfn >= 0 && ( len(parts) == 2 ? match(parts[0], a:pat[1]) : -1 ) >= 0 + \ ? 0 : -1 ) : -1 + en +endf + +fu! s:matchtabs(item, pat) + retu match(split(a:item, '\t\+')[0], a:pat) +endf + +fu! s:matchtabe(item, pat) + retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat) +endf + +fu! s:buildpat(lst) + let pat = a:lst[0] + for item in range(1, len(a:lst) - 1) + let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] + endfo + retu pat +endf + +fu! s:mfunc() + let mfunc = 'match' + if s:byfname() + let mfunc = 's:matchfname' + elsei s:itemtype > 2 + let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } + if has_key(matchtypes, s:matchtype) + let mfunc = matchtypes[s:matchtype] + en + en + retu mfunc +endf + +fu! s:mmode() + let matchmodes = { + \ 'match': 'full-line', + \ 's:matchfname': 'filename-only', + \ 's:matchtabs': 'first-non-tab', + \ 's:matchtabe': 'until-last-tab', + \ } + retu matchmodes[s:mfunc] +endf +" Cache {{{2 +fu! s:writecache(cafile) + if ( g:ctrlp_newcache || !filereadable(a:cafile) ) && !s:nocache() + cal ctrlp#utils#writecache(g:ctrlp_allfiles) + let g:ctrlp_newcache = 0 + en +endf + +fu! s:nocache(...) + if !s:caching + retu 1 + elsei s:caching > 1 + if !( exists(s:ccex) && !{s:ccex} ) || has_key(s:ficounts, s:dyncwd) + retu get(s:ficounts, s:dyncwd, [0, 0])[0] < s:caching + elsei a:0 && filereadable(a:1) + retu len(ctrlp#utils#readfile(a:1)) < s:caching + en + retu 1 + en + retu 0 +endf + +fu! s:insertcache(str) + let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str] + if data == [] || strlen(str) <= strlen(data[0]) + let pos = 0 + elsei strlen(str) >= strlen(data[-1]) + let pos = len(data) - 1 + el + let pos = 0 + for each in data + if strlen(each) > strlen(str) | brea | en + let pos += 1 + endfo + en + cal insert(data, str, pos) + cal s:writecache(ctrlp#utils#cachefile()) +endf +" Extensions {{{2 +fu! s:mtype() + retu s:itemtype > 2 ? s:getextvar('type') : 'path' +endf + +fu! s:execextvar(key) + if !empty(g:ctrlp_ext_vars) + cal map(filter(copy(g:ctrlp_ext_vars), + \ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])') + en +endf + +fu! s:getextvar(key) + if s:itemtype > 2 + let vars = g:ctrlp_ext_vars[s:itemtype - 3] + retu has_key(vars, a:key) ? vars[a:key] : -1 + en + retu -1 +endf + +fu! ctrlp#getcline() + let [linenr, offset] = [line('.'), ( s:offset > 0 ? s:offset : 0 )] + retu !empty(s:lines) && !( offset && linenr <= offset ) + \ ? s:lines[linenr - 1 - offset] : '' +endf + +fu! ctrlp#getmarkedlist() + retu exists('s:marked') ? values(s:marked) : [] +endf + +fu! ctrlp#exit() + cal s:PrtExit() +endf + +fu! ctrlp#prtclear() + cal s:PrtClear() +endf + +fu! ctrlp#switchtype(id) + cal s:ToggleType(a:id - s:itemtype) +endf + +fu! ctrlp#nosy() + retu !( has('syntax') && exists('g:syntax_on') ) +endf + +fu! ctrlp#hicheck(grp, defgrp) + if !hlexists(a:grp) + exe 'hi link' a:grp a:defgrp + en +endf + +fu! ctrlp#call(func, ...) + retu call(a:func, a:000) +endf + +fu! ctrlp#getvar(var) + retu {a:var} +endf +"}}}1 +" * Initialization {{{1 +fu! ctrlp#setlines(...) + if a:0 | let s:itemtype = a:1 | en + cal s:modevar() + let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()'] + if !empty(g:ctrlp_ext_vars) + cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])') + en + let g:ctrlp_lines = eval(types[s:itemtype]) +endf + +fu! ctrlp#init(type, ...) + if exists('s:init') || s:iscmdwin() | retu | en + let [s:ermsg, v:errmsg] = [v:errmsg, ''] + let [s:matches, s:init] = [1, 1] + cal s:Reset(a:0 ? a:1 : {}) + noa cal s:Open() + cal s:SetWD(a:0 ? a:1 : {}) + cal s:MapNorms() + cal s:MapSpecs() + cal ctrlp#syntax() + cal ctrlp#setlines(s:settype(a:type)) + cal s:SetDefTxt() + cal s:BuildPrompt(1) + if s:keyloop | cal s:KeyLoop() | en +endf +" - Autocmds {{{1 +if has('autocmd') + aug CtrlPAug + au! + au BufEnter ControlP cal s:checkbuf() + au BufLeave ControlP noa cal s:Close() + au VimLeavePre * cal s:leavepre() + aug END +en + +fu! s:autocmds() + if !has('autocmd') | retu | en + if exists('#CtrlPLazy') + au! CtrlPLazy + en + if s:lazy + aug CtrlPLazy + au! + au CursorHold ControlP cal s:ForceUpdate() + aug END + en +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim new file mode 100644 index 0000000..89bda89 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/bookmarkdir.vim @@ -0,0 +1,140 @@ +" ============================================================================= +" File: autoload/ctrlp/bookmarkdir.vim +" Description: Bookmarked directories extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir + fini +en +let g:loaded_ctrlp_bookmarkdir = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#bookmarkdir#init()', + \ 'accept': 'ctrlp#bookmarkdir#accept', + \ 'lname': 'bookmarked dirs', + \ 'sname': 'bkd', + \ 'type': 'tabs', + \ 'opmul': 1, + \ 'nolim': 1, + \ 'wipe': 'ctrlp#bookmarkdir#remove', + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:getinput(str, ...) + echoh Identifier + cal inputsave() + let input = call('input', a:0 ? [a:str] + a:000 : [a:str]) + cal inputrestore() + echoh None + retu input +endf + +fu! s:cachefile() + if !exists('s:cadir') || !exists('s:cafile') + let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd' + let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' + en + retu s:cafile +endf + +fu! s:writecache(lines) + cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile) +endf + +fu! s:getbookmarks() + retu ctrlp#utils#readfile(s:cachefile()) +endf + +fu! s:savebookmark(name, cwd) + let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd] + let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0') + cal s:writecache(insert(entries, a:name.' '.a:cwd)) +endf + +fu! s:setentries() + let time = getftime(s:cachefile()) + if !( exists('s:bookmarks') && time == s:bookmarks[0] ) + let s:bookmarks = [time, s:getbookmarks()] + en +endf + +fu! s:parts(str) + let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$') + retu mlist != [] ? mlist[1:2] : ['', ''] +endf + +fu! s:process(entries, type) + retu map(a:entries, 's:modify(v:val, a:type)') +endf + +fu! s:modify(entry, type) + let [name, dir] = s:parts(a:entry) + let dir = fnamemodify(dir, a:type) + retu name.' '.( dir == '' ? '.' : dir ) +endf + +fu! s:msg(name, cwd) + redr + echoh Identifier | echon 'Bookmarked ' | echoh Constant + echon a:name.' ' | echoh Directory | echon a:cwd + echoh None +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBookmark', 'Identifier') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre + sy match CtrlPTabExtra '\zs\t.*\ze$' + en +endf +" Public {{{1 +fu! ctrlp#bookmarkdir#init() + cal s:setentries() + cal s:syntax() + retu s:process(copy(s:bookmarks[1]), ':.') +endf + +fu! ctrlp#bookmarkdir#accept(mode, str) + let parts = s:parts(s:modify(a:str, ':p')) + cal call('s:savebookmark', parts) + if a:mode =~ 't\|v\|h' + cal ctrlp#exit() + en + cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!') + if a:mode == 'e' + cal ctrlp#switchtype(0) + cal ctrlp#recordhist() + cal ctrlp#prtclear() + en +endf + +fu! ctrlp#bookmarkdir#add(dir, ...) + let str = 'Directory to bookmark: ' + let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir') + if cwd == '' | retu | en + let cwd = fnamemodify(cwd, ':p') + let name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd) + if name == '' | retu | en + let name = tr(name, ' ', ' ') + cal s:savebookmark(name, cwd) + cal s:msg(name, cwd) +endf + +fu! ctrlp#bookmarkdir#remove(entries) + cal s:process(a:entries, ':p') + cal s:writecache(a:entries == [] ? [] : + \ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0')) + cal s:setentries() + retu s:process(copy(s:bookmarks[1]), ':.') +endf + +fu! ctrlp#bookmarkdir#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim new file mode 100644 index 0000000..a38cad5 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim @@ -0,0 +1,264 @@ +" ============================================================================= +" File: autoload/ctrlp/buffertag.vim +" Description: Buffer Tag extension +" Maintainer: Kien Nguyen +" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus +" a few lines from taglist.vim by Yegappan Lakshmanan and from +" buffertag.vim by Takeshi Nishida. +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag + fini +en +let g:loaded_ctrlp_buftag = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#buffertag#init(s:crfile)', + \ 'accept': 'ctrlp#buffertag#accept', + \ 'lname': 'buffer tags', + \ 'sname': 'bft', + \ 'exit': 'ctrlp#buffertag#exit()', + \ 'type': 'tabs', + \ 'opts': 'ctrlp#buffertag#opts()', + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +let [s:pref, s:opts] = ['g:ctrlp_buftag_', { + \ 'systemenc': ['s:enc', &enc], + \ 'ctags_bin': ['s:bin', ''], + \ 'types': ['s:usr_types', {}], + \ }] + +let s:bins = [ + \ 'ctags-exuberant', + \ 'exuberant-ctags', + \ 'exctags', + \ '/usr/local/bin/ctags', + \ '/opt/local/bin/ctags', + \ 'ctags', + \ 'ctags.exe', + \ 'tags', + \ ] + +let s:types = { + \ 'asm' : '%sasm%sasm%sdlmt', + \ 'aspperl': '%sasp%sasp%sfsv', + \ 'aspvbs' : '%sasp%sasp%sfsv', + \ 'awk' : '%sawk%sawk%sf', + \ 'beta' : '%sbeta%sbeta%sfsv', + \ 'c' : '%sc%sc%sdgsutvf', + \ 'cpp' : '%sc++%sc++%snvdtcgsuf', + \ 'cs' : '%sc#%sc#%sdtncEgsipm', + \ 'cobol' : '%scobol%scobol%sdfgpPs', + \ 'eiffel' : '%seiffel%seiffel%scf', + \ 'erlang' : '%serlang%serlang%sdrmf', + \ 'expect' : '%stcl%stcl%scfp', + \ 'fortran': '%sfortran%sfortran%spbceiklmntvfs', + \ 'html' : '%shtml%shtml%saf', + \ 'java' : '%sjava%sjava%spcifm', + \ 'javascript': '%sjavascript%sjavascript%sf', + \ 'lisp' : '%slisp%slisp%sf', + \ 'lua' : '%slua%slua%sf', + \ 'make' : '%smake%smake%sm', + \ 'ocaml' : '%socaml%socaml%scmMvtfCre', + \ 'pascal' : '%spascal%spascal%sfp', + \ 'perl' : '%sperl%sperl%sclps', + \ 'php' : '%sphp%sphp%scdvf', + \ 'python' : '%spython%spython%scmf', + \ 'rexx' : '%srexx%srexx%ss', + \ 'ruby' : '%sruby%sruby%scfFm', + \ 'scheme' : '%sscheme%sscheme%ssf', + \ 'sh' : '%ssh%ssh%sf', + \ 'csh' : '%ssh%ssh%sf', + \ 'zsh' : '%ssh%ssh%sf', + \ 'slang' : '%sslang%sslang%snf', + \ 'sml' : '%ssml%ssml%secsrtvf', + \ 'sql' : '%ssql%ssql%scFPrstTvfp', + \ 'tcl' : '%stcl%stcl%scfmp', + \ 'vera' : '%svera%svera%scdefgmpPtTvx', + \ 'verilog': '%sverilog%sverilog%smcPertwpvf', + \ 'vim' : '%svim%svim%savf', + \ 'yacc' : '%syacc%syacc%sl', + \ } + +cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")') + +if executable('jsctags') + cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } }) +en + +fu! ctrlp#buffertag#opts() + for [ke, va] in items(s:opts) + let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] + endfo + " Ctags bin + if empty(s:bin) + for bin in s:bins | if executable(bin) + let s:bin = bin + brea + en | endfo + el + let s:bin = expand(s:bin, 1) + en + " Types + cal extend(s:types, s:usr_types) +endf +" Utilities {{{1 +fu! s:validfile(fname, ftype) + if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname) + \ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en + retu 0 +endf + +fu! s:exectags(cmd) + if exists('+ssl') + let [ssl, &ssl] = [&ssl, 0] + en + if &sh =~ 'cmd\.exe' + let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c'] + en + let output = system(a:cmd) + if &sh =~ 'cmd\.exe' + let [&sxq, &shcf] = [sxq, shcf] + en + if exists('+ssl') + let &ssl = ssl + en + retu output +endf + +fu! s:exectagsonfile(fname, ftype) + let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype] + if type(s:types[ft]) == 1 + let ags .= s:types[ft] + let bin = s:bin + elsei type(s:types[ft]) == 4 + let ags = s:types[ft]['args'] + let bin = expand(s:types[ft]['bin'], 1) + en + if empty(bin) | retu '' | en + let cmd = s:esctagscmd(bin, ags, a:fname) + if empty(cmd) | retu '' | en + let output = s:exectags(cmd) + if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en + retu output +endf + +fu! s:esctagscmd(bin, args, ...) + if exists('+ssl') + let [ssl, &ssl] = [&ssl, 0] + en + let fname = a:0 ? shellescape(a:1) : '' + let cmd = shellescape(a:bin).' '.a:args.' '.fname + if &sh =~ 'cmd\.exe' + let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g') + en + if exists('+ssl') + let &ssl = ssl + en + if has('iconv') + let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc + let cmd = iconv(cmd, &enc, last) + en + retu cmd +endf + +fu! s:process(fname, ftype) + if !s:validfile(a:fname, a:ftype) | retu [] | endif + let ftime = getftime(a:fname) + if has_key(g:ctrlp_buftags, a:fname) + \ && g:ctrlp_buftags[a:fname]['time'] >= ftime + let lines = g:ctrlp_buftags[a:fname]['lines'] + el + let data = s:exectagsonfile(a:fname, a:ftype) + let [raw, lines] = [split(data, '\n\+'), []] + for line in raw + if line !~# '^!_TAG_' && len(split(line, ';"')) == 2 + let parsed_line = s:parseline(line) + if parsed_line != '' + cal add(lines, parsed_line) + en + en + endfo + let cache = { a:fname : { 'time': ftime, 'lines': lines } } + cal extend(g:ctrlp_buftags, cache) + en + retu lines +endf + +fu! s:parseline(line) + let vals = matchlist(a:line, + \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)') + if vals == [] | retu '' | en + let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] + retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPTagKind', 'Title') + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|' + sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind + en +endf + +fu! s:chknearby(pat) + if match(getline('.'), a:pat) < 0 + let [int, forw, maxl] = [1, 1, line('$')] + wh !search(a:pat, 'W'.( forw ? '' : 'b' )) + if !forw + if int > maxl | brea | en + let int += int + en + let forw = !forw + endw + en +endf +" Public {{{1 +fu! ctrlp#buffertag#init(fname) + let bufs = exists('s:btmode') && s:btmode + \ ? filter(ctrlp#buffers(), 'filereadable(v:val)') + \ : [exists('s:bufname') ? s:bufname : a:fname] + let lines = [] + for each in bufs + let bname = fnamemodify(each, ':p') + let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '') + cal extend(lines, s:process(bname, tftype)) + endfo + cal s:syntax() + retu lines +endf + +fu! ctrlp#buffertag#accept(mode, str) + let vals = matchlist(a:str, + \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$') + let bufnr = str2nr(get(vals, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, bufnr) + exe 'norm!' str2nr(get(vals, 2, line('.'))).'G' + cal s:chknearby('\V\C'.get(vals, 3, '')) + sil! norm! zvzz + en +endf + +fu! ctrlp#buffertag#cmd(mode, ...) + let s:btmode = a:mode + if a:0 && !empty(a:1) + let s:btmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufname = fnamemodify(bname, ':p') + en + retu s:id +endf + +fu! ctrlp#buffertag#exit() + unl! s:btmode s:bufname +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/changes.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/changes.vim new file mode 100644 index 0000000..313d8c2 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/changes.vim @@ -0,0 +1,98 @@ +" ============================================================================= +" File: autoload/ctrlp/changes.vim +" Description: Change list extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes + fini +en +let g:loaded_ctrlp_changes = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)', + \ 'accept': 'ctrlp#changes#accept', + \ 'lname': 'changes', + \ 'sname': 'chs', + \ 'exit': 'ctrlp#changes#exit()', + \ 'type': 'tabe', + \ 'sort': 0, + \ 'nolim': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:changelist(bufnr) + sil! exe 'noa hid b' a:bufnr + redi => result + sil! changes + redi END + retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")') +endf + +fu! s:process(clines, ...) + let [clines, evas] = [[], []] + for each in a:clines + let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$') + if !empty(parts) + if parts[3] == '' | let parts[3] = ' ' | en + cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|') + en + endfo + retu reverse(filter(clines, 'count(clines, v:val) == 1')) +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName + en +endf +" Public {{{1 +fu! ctrlp#changes#init(original_bufnr, bufnr) + let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr + let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr] + cal filter(bufs, 'v:val > 0') + let [swb, &swb] = [&swb, ''] + let lines = [] + for each in bufs + let bname = bufname(each) + let fnamet = fnamemodify(bname == '' ? '[No Name]' : bname, ':t') + cal extend(lines, s:process(s:changelist(each), each, fnamet)) + endfo + sil! exe 'noa hid b' a:original_bufnr + let &swb = swb + cal ctrlp#syntax() + cal s:syntax() + retu lines +endf + +fu! ctrlp#changes#accept(mode, str) + let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') + let bufnr = str2nr(get(info, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, bufnr) + cal cursor(get(info, 2), get(info, 3)) + sil! norm! zvzz + en +endf + +fu! ctrlp#changes#cmd(mode, ...) + let s:clmode = a:mode + if a:0 && !empty(a:1) + let s:clmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$') + en + retu s:id +endf + +fu! ctrlp#changes#exit() + unl! s:clmode s:bufnr +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/dir.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/dir.vim new file mode 100644 index 0000000..4e6d4ad --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/dir.vim @@ -0,0 +1,95 @@ +" ============================================================================= +" File: autoload/ctrlp/dir.vim +" Description: Directory extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir + fini +en +let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0] + +let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching'] + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')', + \ 'accept': 'ctrlp#dir#accept', + \ 'lname': 'dirs', + \ 'sname': 'dir', + \ 'type': 'path', + \ 'specinput': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +let s:dircounts = {} +" Utilities {{{1 +fu! s:globdirs(dirs, depth) + let entries = split(globpath(a:dirs, s:glob), "\n") + let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1] + cal extend(g:ctrlp_alldirs, dirs) + let nr = len(g:ctrlp_alldirs) + if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth + sil! cal ctrlp#progress(nr) + cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")') + cal s:globdirs(join(dirs, ','), depth) + en +endf + +fu! s:max(len, max) + retu a:max && a:len > a:max +endf + +fu! s:nocache() + retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching ) +endf +" Public {{{1 +fu! ctrlp#dir#init(...) + let s:cwd = getcwd() + for each in range(len(s:ars)) + let {s:ars[each]} = a:{each + 1} + endfo + let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir' + let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir') + if g:ctrlp_newdir || s:nocache() || !filereadable(cafile) + let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []] + if !ctrlp#igncwd(s:cwd) + cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0) + en + cal ctrlp#rmbasedir(g:ctrlp_alldirs) + if len(g:ctrlp_alldirs) <= s:compare_lim + cal sort(g:ctrlp_alldirs, 'ctrlp#complen') + en + cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile) + let g:ctrlp_newdir = 0 + el + if !( exists('s:initcwd') && s:initcwd == s:cwd ) + let s:initcwd = s:cwd + let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) + en + en + cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) }) + retu g:ctrlp_alldirs +endf + +fu! ctrlp#dir#accept(mode, str) + let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#call('s:lash', s:cwd).a:str + if a:mode =~ 't\|v\|h' + cal ctrlp#exit() + en + cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!') + if a:mode == 'e' + sil! cal ctrlp#statusline() + cal ctrlp#setlines(s:id) + cal ctrlp#recordhist() + cal ctrlp#prtclear() + en +endf + +fu! ctrlp#dir#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/line.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/line.vim new file mode 100644 index 0000000..5bec47e --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/line.vim @@ -0,0 +1,72 @@ +" ============================================================================= +" File: autoload/ctrlp/line.vim +" Description: Line extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line + fini +en +let g:loaded_ctrlp_line = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#line#init(s:crbufnr)', + \ 'accept': 'ctrlp#line#accept', + \ 'lname': 'lines', + \ 'sname': 'lns', + \ 'type': 'tabe', + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName + en +endf +" Public {{{1 +fu! ctrlp#line#init(bufnr) + let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr] + let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr] + for bufnr in bufs + let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] + if lfb == [] && bufn != '' + let lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p')) + en + cal map(lfb, 'tr(v:val, '' '', '' '')') + let [linenr, len_lfb] = [1, len(lfb)] + let buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t') + wh linenr <= len_lfb + let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|' + let linenr += 1 + endw + cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''')) + endfo + cal s:syntax() + retu lines +endf + +fu! ctrlp#line#accept(mode, str) + let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') + let bufnr = str2nr(get(info, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2)) + en +endf + +fu! ctrlp#line#cmd(mode, ...) + let s:lnmode = a:mode + if a:0 && !empty(a:1) + let s:lnmode = 0 + let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1 + let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$') + en + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mixed.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mixed.vim new file mode 100644 index 0000000..74d904d --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mixed.vim @@ -0,0 +1,88 @@ +" ============================================================================= +" File: autoload/ctrlp/mixed.vim +" Description: Mixing Files + MRU + Buffers +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed + fini +en +let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0] + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#mixed#init(s:compare_lim)', + \ 'accept': 'ctrlp#acceptfile', + \ 'lname': 'fil + mru + buf', + \ 'sname': 'mix', + \ 'type': 'path', + \ 'opmul': 1, + \ 'specinput': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:newcache(cwd) + if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en + retu g:ctrlp_allmixes['cwd'] != a:cwd + \ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile()) + \ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile()) + \ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs()) +endf + +fu! s:getnewmix(cwd, clim) + if g:ctrlp_newmix + cal ctrlp#mrufiles#refresh('raw') + let g:ctrlp_newcache = 1 + en + let g:ctrlp_lines = copy(ctrlp#files()) + cal ctrlp#progress('Mixing...') + let mrufs = copy(ctrlp#mrufiles#list('raw')) + if exists('+ssl') && &ssl + cal map(mrufs, 'tr(v:val, "\\", "/")') + en + let allbufs = map(ctrlp#buffers(), 'fnamemodify(v:val, ":p")') + let [bufs, ubufs] = [[], []] + for each in allbufs + cal add(filereadable(each) ? bufs : ubufs, each) + endfo + let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0') + if len(mrufs) > len(g:ctrlp_lines) + cal filter(mrufs, 'stridx(v:val, a:cwd)') + el + let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)') + let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs) + for each in cwd_mrufs + let id = index(g:ctrlp_lines, each) + if id >= 0 | cal remove(g:ctrlp_lines, id) | en + endfo + en + let mrufs += ubufs + cal map(mrufs, 'fnamemodify(v:val, ":.")') + let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines) + \ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines + if len(g:ctrlp_lines) <= a:clim + cal sort(g:ctrlp_lines, 'ctrlp#complen') + en + let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()), + \ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd, + \ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines } +endf +" Public {{{1 +fu! ctrlp#mixed#init(clim) + let cwd = getcwd() + if s:newcache(cwd) + cal s:getnewmix(cwd, a:clim) + el + let g:ctrlp_lines = g:ctrlp_allmixes['data'] + en + let g:ctrlp_newmix = 0 + retu g:ctrlp_lines +endf + +fu! ctrlp#mixed#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim new file mode 100644 index 0000000..a182111 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim @@ -0,0 +1,154 @@ +" ============================================================================= +" File: autoload/ctrlp/mrufiles.vim +" Description: Most Recently Used Files extension +" Author: Kien Nguyen +" ============================================================================= + +" Static variables {{{1 +let [s:mrbs, s:mrufs] = [[], []] + +fu! ctrlp#mrufiles#opts() + let [pref, opts] = ['g:ctrlp_mruf_', { + \ 'max': ['s:max', 250], + \ 'include': ['s:in', ''], + \ 'exclude': ['s:ex', ''], + \ 'case_sensitive': ['s:cseno', 1], + \ 'relative': ['s:re', 0], + \ 'save_on_update': ['s:soup', 1], + \ }] + for [ke, va] in items(opts) + let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]] + endfo +endf +cal ctrlp#mrufiles#opts() +" Utilities {{{1 +fu! s:excl(fn) + retu !empty({s:ex}) && a:fn =~# {s:ex} +endf + +fu! s:mergelists() + let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile()) + cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0') + let mrufs = s:mrufs + diskmrufs + retu s:chop(mrufs) +endf + +fu! s:chop(mrufs) + if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en + retu a:mrufs +endf + +fu! s:reformat(mrufs, ...) + let cwd = getcwd() + let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : '' + if {s:re} + let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd + cal filter(a:mrufs, '!stridx(v:val, cwd)') + en + if a:0 && a:1 == 'raw' | retu a:mrufs | en + let idx = strlen(cwd) + if exists('+ssl') && &ssl + let cwd = tr(cwd, '\', '/') + cal map(a:mrufs, 'tr(v:val, "\\", "/")') + en + retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val') +endf + +fu! s:record(bufnr) + if s:locked | retu | en + let bufnr = a:bufnr + 0 + let bufname = bufname(bufnr) + if bufnr > 0 && !empty(bufname) + cal filter(s:mrbs, 'v:val != bufnr') + cal insert(s:mrbs, bufnr) + cal s:addtomrufs(bufname) + en +endf + +fu! s:addtomrufs(fname) + let fn = fnamemodify(a:fname, ':p') + let fn = exists('+ssl') ? tr(fn, '/', '\') : fn + if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} ) + \ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu + en + let idx = index(s:mrufs, fn, 0, !{s:cseno}) + if idx + cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn') + cal insert(s:mrufs, fn) + if {s:soup} && idx < 0 + cal s:savetofile(s:mergelists()) + en + en +endf + +fu! s:savetofile(mrufs) + cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile) +endf +" Public {{{1 +fu! ctrlp#mrufiles#refresh(...) + let mrufs = s:mergelists() + cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') + if exists('+ssl') + cal map(mrufs, 'tr(v:val, "/", "\\")') + cal map(s:mrufs, 'tr(v:val, "/", "\\")') + let cond = 'count(mrufs, v:val, !{s:cseno}) == 1' + cal filter(mrufs, cond) + cal filter(s:mrufs, cond) + en + cal s:savetofile(mrufs) + retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs) +endf + +fu! ctrlp#mrufiles#remove(files) + let mrufs = [] + if a:files != [] + let mrufs = s:mergelists() + let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0' + cal filter(mrufs, cond) + cal filter(s:mrufs, cond) + en + cal s:savetofile(mrufs) + retu s:reformat(mrufs) +endf + +fu! ctrlp#mrufiles#add(fn) + if !empty(a:fn) + cal s:addtomrufs(a:fn) + en +endf + +fu! ctrlp#mrufiles#list(...) + retu a:0 ? a:1 == 'raw' ? s:reformat(s:mergelists(), a:1) : 0 + \ : s:reformat(s:mergelists()) +endf + +fu! ctrlp#mrufiles#bufs() + retu s:mrbs +endf + +fu! ctrlp#mrufiles#tgrel() + let {s:re} = !{s:re} +endf + +fu! ctrlp#mrufiles#cachefile() + if !exists('s:cadir') || !exists('s:cafile') + let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' + let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' + en + retu s:cafile +endf + +fu! ctrlp#mrufiles#init() + if !has('autocmd') | retu | en + let s:locked = 0 + aug CtrlPMRUF + au! + au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('', 1)) + au QuickFixCmdPre *vimgrep* let s:locked = 1 + au QuickFixCmdPost *vimgrep* let s:locked = 0 + au VimLeavePre * cal s:savetofile(s:mergelists()) + aug END +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim new file mode 100644 index 0000000..03ab921 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim @@ -0,0 +1,59 @@ +" ============================================================================= +" File: autoload/ctrlp/quickfix.vim +" Description: Quickfix extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix + fini +en +let g:loaded_ctrlp_quickfix = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#quickfix#init()', + \ 'accept': 'ctrlp#quickfix#accept', + \ 'lname': 'quickfix', + \ 'sname': 'qfx', + \ 'type': 'line', + \ 'sort': 0, + \ 'nolim': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +fu! s:lineout(dict) + retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'], + \ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S')) +endf +" Utilities {{{1 +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPqfLineCol', 'Search') + sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' + en +endf +" Public {{{1 +fu! ctrlp#quickfix#init() + cal s:syntax() + retu map(getqflist(), 's:lineout(v:val)') +endf + +fu! ctrlp#quickfix#accept(mode, str) + let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|') + if vals == [] || vals[1] == '' | retu | en + cal ctrlp#acceptfile(a:mode, vals[1]) + let cur_pos = getpos('.')[1:2] + if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)') + mark ' + en + cal cursor(vals[2], vals[3]) + sil! norm! zvzz +endf + +fu! ctrlp#quickfix#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim new file mode 100644 index 0000000..eed21c6 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim @@ -0,0 +1,59 @@ +" ============================================================================= +" File: autoload/ctrlp/rtscript.vim +" Description: Runtime scripts extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript + fini +en +let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0] + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#rtscript#init(s:caching)', + \ 'accept': 'ctrlp#acceptfile', + \ 'lname': 'runtime scripts', + \ 'sname': 'rts', + \ 'type': 'path', + \ 'opmul': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +let s:filecounts = {} +" Utilities {{{1 +fu! s:nocache() + retu g:ctrlp_newrts || + \ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching ) +endf +" Public {{{1 +fu! ctrlp#rtscript#init(caching) + let [s:caching, s:cwd] = [a:caching, getcwd()] + if s:nocache() || + \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) + sil! cal ctrlp#progress('Indexing...') + let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n") + cal filter(entries, 'count(entries, v:val) == 1') + let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1] + el + let [entries, results] = g:ctrlp_rtscache[2:3] + en + if s:nocache() || + \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] ) + if !exists('echoed') + sil! cal ctrlp#progress('Processing...') + en + let results = map(copy(entries), 'fnamemodify(v:val, '':.'')') + en + let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0] + cal extend(s:filecounts, { s:cwd : len(results) }) + retu results +endf + +fu! ctrlp#rtscript#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/tag.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/tag.vim new file mode 100644 index 0000000..626363a --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/tag.vim @@ -0,0 +1,138 @@ +" ============================================================================= +" File: autoload/ctrlp/tag.vim +" Description: Tag file extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag + fini +en +let g:loaded_ctrlp_tag = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#tag#init()', + \ 'accept': 'ctrlp#tag#accept', + \ 'lname': 'tags', + \ 'sname': 'tag', + \ 'enter': 'ctrlp#tag#enter()', + \ 'type': 'tabs', + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:findcount(str) + let [tg, ofname] = split(a:str, '\t\+\ze[^\t]\+$') + let tgs = taglist('^'.tg.'$') + if len(tgs) < 2 + retu [0, 0, 0, 0] + en + let bname = fnamemodify(bufname('%'), ':p') + let fname = expand(fnamemodify(simplify(ofname), ':s?^[.\/]\+??:p:.'), 1) + let [fnd, cnt, pos, ctgs, otgs] = [0, 0, 0, [], []] + for tgi in tgs + let lst = bname == fnamemodify(tgi["filename"], ':p') ? 'ctgs' : 'otgs' + cal call('add', [{lst}, tgi]) + endfo + let ntgs = ctgs + otgs + for tgi in ntgs + let cnt += 1 + let fulname = fnamemodify(tgi["filename"], ':p') + if stridx(fulname, fname) >= 0 + \ && strlen(fname) + stridx(fulname, fname) == strlen(fulname) + let fnd += 1 + let pos = cnt + en + endfo + let cnt = 0 + for tgi in ntgs + let cnt += 1 + if tgi["filename"] == ofname + let [fnd, pos] = [0, cnt] + en + endfo + retu [1, fnd, pos, len(ctgs)] +endf + +fu! s:filter(tags) + let nr = 0 + wh 0 < 1 + if a:tags == [] | brea | en + if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_' + let nr += 1 + con + en + if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr + cal remove(a:tags, nr) + el + brea + en + endw + retu a:tags +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPTabExtra '\zs\t.*\ze$' + en +endf +" Public {{{1 +fu! ctrlp#tag#init() + if empty(s:tagfiles) | retu [] | en + let g:ctrlp_alltags = [] + let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1')) + for each in tagfiles + let alltags = s:filter(ctrlp#utils#readfile(each)) + cal extend(g:ctrlp_alltags, alltags) + endfo + cal s:syntax() + retu g:ctrlp_alltags +endf + +fu! ctrlp#tag#accept(mode, str) + cal ctrlp#exit() + let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t') + let [tg, fdcnt] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)] + let cmds = { + \ 't': ['tab sp', 'tab stj'], + \ 'h': ['sp', 'stj'], + \ 'v': ['vs', 'vert stj'], + \ 'e': ['', 'tj'], + \ } + let utg = fdcnt[3] < 2 && fdcnt[0] == 1 && fdcnt[1] == 1 + let cmd = !fdcnt[0] || utg ? cmds[a:mode][0] : cmds[a:mode][1] + let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw) + \ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd + let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd + if !fdcnt[0] || utg + if cmd != '' + exe cmd + en + let save_cst = &cst + set cst& + cal feedkeys(":".( utg ? fdcnt[2] : "" )."ta ".tg."\r", 'nt') + let &cst = save_cst + el + let ext = "" + if fdcnt[1] < 2 && fdcnt[2] + let [sav_more, &more] = [&more, 0] + let ext = fdcnt[2]."\r".":let &more = ".sav_more."\r" + en + cal feedkeys(":".cmd." ".tg."\r".ext, 'nt') + en + cal ctrlp#setlcdir() +endf + +fu! ctrlp#tag#id() + retu s:id +endf + +fu! ctrlp#tag#enter() + let tfs = tagfiles() + let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'), + \ 'filereadable(v:val)') : [] +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/undo.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/undo.vim new file mode 100644 index 0000000..dee705e --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/undo.vim @@ -0,0 +1,154 @@ +" ============================================================================= +" File: autoload/ctrlp/undo.vim +" Description: Undo extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo ) + fini +en +let g:loaded_ctrlp_undo = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#undo#init()', + \ 'accept': 'ctrlp#undo#accept', + \ 'lname': 'undo', + \ 'sname': 'udo', + \ 'enter': 'ctrlp#undo#enter()', + \ 'exit': 'ctrlp#undo#exit()', + \ 'type': 'line', + \ 'sort': 0, + \ 'nolim': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks', + \ 'months', 'years'], '" ".v:val." ago"') +" Utilities {{{1 +fu! s:getundo() + if exists('*undotree') + \ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) ) + retu [1, undotree()] + el + redi => result + sil! undol + redi END + retu [0, split(result, "\n")[1:]] + en +endf + +fu! s:flatten(tree, cur) + let flatdict = {} + for each in a:tree + let saved = has_key(each, 'save') ? 'saved' : '' + let current = each['seq'] == a:cur ? 'current' : '' + cal extend(flatdict, { each['seq'] : [each['time'], saved, current] }) + if has_key(each, 'alt') + cal extend(flatdict, s:flatten(each['alt'], a:cur)) + en + endfo + retu flatdict +endf + +fu! s:elapsed(nr) + let [text, time] = [s:text, localtime() - a:nr] + let mins = time / 60 + let hrs = time / 3600 + let days = time / 86400 + let wks = time / 604800 + let mons = time / 2592000 + let yrs = time / 31536000 + if yrs > 1 + retu yrs.text[7] + elsei mons > 1 + retu mons.text[6] + elsei wks > 1 + retu wks.text[5] + elsei days > 1 + retu days.text[4] + elsei hrs > 1 + retu hrs.text[3] + elsei mins > 1 + retu mins.text[2] + elsei time == 1 + retu time.text[0] + elsei time < 120 + retu time.text[1] + en +endf + +fu! s:syntax() + if ctrlp#nosy() | retu | en + for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String', + \ 'Sv': 'Comment', 'Po': 'Title'}) + cal ctrlp#hicheck('CtrlPUndo'.ke, va) + endfo + sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+' + sy match CtrlPUndoBr '\[\|\]' + sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr + sy match CtrlPUndoSv 'saved' + sy match CtrlPUndoPo 'current' +endf + +fu! s:dict2list(dict) + for ke in keys(a:dict) + let a:dict[ke][0] = s:elapsed(a:dict[ke][0]) + endfo + retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')') +endf + +fu! s:compval(...) + retu a:2[0] - a:1[0] +endf + +fu! s:format(...) + let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : '' + let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : '' + retu a:1[1][0].' ['.a:1[0].']'.saved.current +endf + +fu! s:formatul(...) + let parts = matchlist(a:1, + \ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$') + retu parts == [] ? '----' + \ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' ) +endf +" Public {{{1 +fu! ctrlp#undo#init() + let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1] + if empty(entries) | retu [] | en + if !exists('s:lines') + if s:undos[0] + let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur'])) + let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)') + el + let s:lines = map(reverse(entries), 's:formatul(v:val)') + en + en + cal s:syntax() + retu s:lines +endf + +fu! ctrlp#undo#accept(mode, str) + let undon = matchstr(a:str, '\[\zs\d\+\ze\]') + if empty(undon) | retu | en + cal ctrlp#exit() + exe 'u' undon +endf + +fu! ctrlp#undo#id() + retu s:id +endf + +fu! ctrlp#undo#enter() + let s:undos = s:getundo() +endf + +fu! ctrlp#undo#exit() + unl! s:lines +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/utils.vim b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/utils.vim new file mode 100644 index 0000000..91b9f24 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/autoload/ctrlp/utils.vim @@ -0,0 +1,110 @@ +" ============================================================================= +" File: autoload/ctrlp/utils.vim +" Description: Utilities +" Author: Kien Nguyen +" ============================================================================= + +" Static variables {{{1 +fu! ctrlp#utils#lash() + retu &ssl || !exists('+ssl') ? '/' : '\' +endf + +fu! s:lash(...) + retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : '' +endf + +fu! ctrlp#utils#opts() + let s:lash = ctrlp#utils#lash() + let usrhome = $HOME . s:lash( $HOME ) + let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache' + let cadir = isdirectory(usrhome.'.ctrlp_cache') + \ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp' + if exists('g:ctrlp_cache_dir') + let cadir = expand(g:ctrlp_cache_dir, 1) + if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache') + let cadir = cadir.s:lash(cadir).'.ctrlp_cache' + en + en + let s:cache_dir = cadir +endf +cal ctrlp#utils#opts() + +let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') ) +" Files and Directories {{{1 +fu! ctrlp#utils#cachedir() + retu s:cache_dir +endf + +fu! ctrlp#utils#cachefile(...) + let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()] + let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' + retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file +endf + +fu! ctrlp#utils#readfile(file) + if filereadable(a:file) + let data = readfile(a:file) + if empty(data) || type(data) != 3 + unl data + let data = [] + en + retu data + en + retu [] +endf + +fu! ctrlp#utils#mkdir(dir) + if exists('*mkdir') && !isdirectory(a:dir) + sil! cal mkdir(a:dir, 'p') + en + retu a:dir +endf + +fu! ctrlp#utils#writecache(lines, ...) + if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir)) + sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile()) + en +endf + +fu! ctrlp#utils#glob(...) + let path = ctrlp#utils#fnesc(a:1, 'g') + retu s:wig_cond ? glob(path, a:2) : glob(path) +endf + +fu! ctrlp#utils#globpath(...) + retu call('globpath', s:wig_cond ? a:000 : a:000[:1]) +endf + +fu! ctrlp#utils#fnesc(path, type, ...) + if exists('*fnameescape') + if exists('+ssl') + if a:type == 'c' + let path = escape(a:path, '%#') + elsei a:type == 'f' + let path = fnameescape(a:path) + elsei a:type == 'g' + let path = escape(a:path, '?*') + en + let path = substitute(path, '[', '[[]', 'g') + el + let path = fnameescape(a:path) + en + el + if exists('+ssl') + if a:type == 'c' + let path = escape(a:path, '%#') + elsei a:type == 'f' + let path = escape(a:path, " \t\n%#*?|<\"") + elsei a:type == 'g' + let path = escape(a:path, '?*') + en + let path = substitute(path, '[', '[[]', 'g') + el + let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<") + en + en + retu a:0 ? escape(path, a:1) : path +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/doc/ctrlp.txt b/vim-plugins/bundle/ctrlp.vim/doc/ctrlp.txt new file mode 100644 index 0000000..e697b93 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/doc/ctrlp.txt @@ -0,0 +1,1451 @@ +*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.79 +*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* +=============================================================================== +# # +# :::::::: ::::::::::: ::::::::: ::: ::::::::: # +# :+: :+: :+: :+: :+: :+: :+: :+: # +# +:+ +:+ +:+ +:+ +:+ +:+ +:+ # +# +#+ +#+ +#++:++#: +#+ +#++:++#+ # +# +#+ +#+ +#+ +#+ +#+ +#+ # +# #+# #+# #+# #+# #+# #+# #+# # +# ######## ### ### ### ########## ### # +# # +=============================================================================== +CONTENTS *ctrlp-contents* + + 1. Intro........................................|ctrlp-intro| + 2. Options......................................|ctrlp-options| + 3. Commands.....................................|ctrlp-commands| + 4. Mappings.....................................|ctrlp-mappings| + 5. Input Formats................................|ctrlp-input-formats| + 6. Extensions...................................|ctrlp-extensions| + +=============================================================================== +INTRO *ctrlp-intro* + +Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface. +Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full +support for Vim's |regexp| as search pattern, built-in MRU files monitoring, +project's root finder, and more. + +To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|. + +=============================================================================== +OPTIONS *ctrlp-options* + +Overview:~ + + |loaded_ctrlp|................Disable the plugin. + |ctrlp_map|...................Default mapping. + |ctrlp_cmd|...................Default command used for the default mapping. + |ctrlp_by_filename|...........Default to filename mode or not. + |ctrlp_regexp|................Default to regexp mode or not. + |ctrlp_match_window|..........Order, height and position of the match window. + |ctrlp_switch_buffer|.........Jump to an open buffer if already opened. + |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc). + |ctrlp_tabpage_position|......Where to put the new tab page. + |ctrlp_working_path_mode|.....How to set CtrlP's local working directory. + |ctrlp_root_markers|..........Additional, high priority root markers. + |ctrlp_use_caching|...........Use per-session caching or not. + |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not. + |ctrlp_cache_dir|.............Location of the cache directory. + |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not. + |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|. + |ctrlp_max_files|.............Number of files to scan initially. + |ctrlp_max_depth|.............Directory depth to recurse into when scanning. + |ctrlp_user_command|..........Use an external scanner. + |ctrlp_max_history|...........Number of entries saved in the prompt history. + |ctrlp_open_new_file|.........How to open a file created by . + |ctrlp_open_multiple_files|...How to open files selected by . + |ctrlp_arg_map|...............Intercept and or not. + |ctrlp_follow_symlinks|.......Follow symbolic links or not. + |ctrlp_lazy_update|...........Only update when typing has stopped. + |ctrlp_default_input|.........Seed the prompt with an initial string. + |ctrlp_abbrev|................Input abbreviations. + |ctrlp_key_loop|..............Use input looping for multi-byte input. + |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames. + |ctrlp_prompt_mappings|.......Change the mappings inside the prompt. + + MRU mode: + |ctrlp_mruf_max|..............Max MRU entries to remember. + |ctrlp_mruf_exclude|..........Files that shouldn't be remembered. + |ctrlp_mruf_include|..........Files to be remembered. + |ctrlp_mruf_relative|.........Show only MRU files in the working directory. + |ctrlp_mruf_default_order|....Disable sorting. + |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not. + |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added. + + BufferTag mode: (to enable, see |ctrlp-extensions|) + |g:ctrlp_buftag_ctags_bin|....The location of the ctags-compatible binary. + |g:ctrlp_buftag_systemenc|....The encoding used for the ctags command. + |g:ctrlp_buftag_types|........Add new filetypes and set the cmd arguments. + + Advanced options: + |ctrlp_open_func|.............Use custom file opening functions. + |ctrlp_status_func|...........Change CtrlP's two statuslines. + |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer. + |ctrlp_match_func|............Replace the built-in matching algorithm. + +------------------------------------------------------------------------------- +Detailed descriptions and default values:~ + + *'g:ctrlp_map'* +Use this option to change the mapping to invoke CtrlP in |Normal| mode: > + let g:ctrlp_map = '' +< + + *'g:ctrlp_cmd'* +Set the default opening command to use when pressing the above mapping: > + let g:ctrlp_cmd = 'CtrlP' +< + + *'g:loaded_ctrlp'* +Use this to disable the plugin completely: > + let g:loaded_ctrlp = 1 +< + + *'g:ctrlp_by_filename'* +Set this to 1 to set searching by filename (as opposed to full path) as the +default: > + let g:ctrlp_by_filename = 0 +< +Can be toggled on/off by pressing inside the prompt. + + *'g:ctrlp_regexp'* +Set this to 1 to set regexp search as the default: > + let g:ctrlp_regexp = 0 +< +Can be toggled on/off by pressing inside the prompt. + + *'g:ctrlp_match_window'* +Change the postion, the listing order of results, the minimum and the maximum +heights of the match window: > + let g:ctrlp_match_window = '' +< +Example: > + let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10' +< +The position: (default: bottom) + top - show the match window at the top of the screen. + bottom - show the match window at the bottom of the screen. + +The listing order of results: (default: btt) + order:ttb - from top to bottom. + order:btt - from bottom to top. + +The minimum and maximum heights: + min:{n} - show minimum {n} lines (default: 1). + max:{n} - show maximum {n} lines (default: 10). + +The maximum number of results: + results:{n} - list maximum {n} results (default: sync with max height). + +Note: When a setting isn't set, its default value will be used. + + *'g:ctrlp_switch_buffer'* +When opening a file, if it's already open in a window somewhere, CtrlP will try +to jump to it instead of opening a new instance: > + let g:ctrlp_switch_buffer = 'Et' +< + e - jump when is pressed, but only to windows in the current tab. + t - jump when is pressed, but only to windows in another tab. + v - like "e", but jump when is pressed. + h - like "e", but jump when is pressed. + E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere. + 0 or - disable this feature. + + *'g:ctrlp_reuse_window'* +When opening a file with , CtrlP avoids opening it in windows created by +plugins, help and quickfix. Use this to setup some exceptions: > + let g:ctrlp_reuse_window = 'netrw' +< +Acceptable values are partial name, filetype or buftype of the special buffers. +Use regexp to specify the pattern. +Example: > + let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' +< + + *'g:ctrlp_tabpage_position'* +Where to put the new tab page when opening one: > + let g:ctrlp_tabpage_position = 'ac' +< + a - after. + b - before. + c - the current tab page. + l - the last tab page. + f - the first tab page. + + *'g:ctrlp_working_path_mode'* +When starting up, CtrlP sets its local working directory according to this +variable: > + let g:ctrlp_working_path_mode = 'ra' +< + c - the directory of the current file. + a - like "c", but only applies when the current working directory outside of + CtrlP isn't a direct ancestor of the directory of the current file. + r - the nearest ancestor that contains one of these directories or files: + .git .hg .svn .bzr _darcs + w - begin finding a root from the current working directory outside of CtrlP + instead of from the directory of the current file (default). Only applies + when "r" is also present. + 0 or - disable this feature. + +Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as +a fallback) when a root can't be found. + +Note #2: you can use a |b:var| to set this option on a per buffer basis. + + *'g:ctrlp_root_markers'* +Use this to set your own root markers in addition to the default ones (.git, +.hg, .svn, .bzr, and _darcs). Your markers will take precedence: > + let g:ctrlp_root_markers = [''] +< +Note: you can use a |b:var| to set this option on a per buffer basis. + + *'g:ctrlp_use_caching'* +Enable/Disable per-session caching: > + let g:ctrlp_use_caching = 1 +< + 0 - Disable caching. + 1 - Enable caching. + n - When bigger than 1, disable caching and use the number as the limit to + enable caching again. + +Note: you can quickly purge the cache by pressing while inside CtrlP. + + *'g:ctrlp_clear_cache_on_exit'* +Set this to 0 to enable cross-session caching by not deleting the cache files +upon exiting Vim: > + let g:ctrlp_clear_cache_on_exit = 1 +< + + *'g:ctrlp_cache_dir'* +Set the directory to store the cache files: > + let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp' +< + + *'g:ctrlp_show_hidden'* +Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: > + let g:ctrlp_show_hidden = 0 +< +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. + + *'ctrlp-wildignore'* +You can use Vim's |'wildignore'| to exclude files and directories from the +results. +Examples: > + " Excluding version control directories + set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX + set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') +< +Note #1: the `*/` in front of each directory glob is required. + +Note #2: |wildignore| influences the result of |expand()|, |globpath()| and +|glob()| which many plugins use to find stuff on the system (e.g. VCS related +plugins look for .git/, .hg/,... some other plugins look for external *.exe +tools on Windows). So be a little mindful of what you put in your |wildignore|. + + *'g:ctrlp_custom_ignore'* +In addition to |'wildignore'|, use this for files and directories you want only +CtrlP to not show. Use regexp to specify the patterns: > + let g:ctrlp_custom_ignore = '' +< +Examples: > + let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' + let g:ctrlp_custom_ignore = { + \ 'dir': '\v[\/]\.(git|hg|svn)$', + \ 'file': '\v\.(exe|so|dll)$', + \ 'link': 'SOME_BAD_SYMBOLIC_LINKS', + \ } + let g:ctrlp_custom_ignore = { + \ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@ + let g:ctrlp_max_files = 10000 +< +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. + + *'g:ctrlp_max_depth'* +The maximum depth of a directory tree to recurse into: > + let g:ctrlp_max_depth = 40 +< +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. + + *'g:ctrlp_user_command'* +Specify an external tool to use for listing files instead of using Vim's +|globpath()|. Use %s in place of the target directory: > + let g:ctrlp_user_command = '' +< +Examples: > + let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux + let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows +< +You can also use 'grep', 'findstr' or something else to filter the results. +Examples: > + let g:ctrlp_user_command = + \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux + let g:ctrlp_user_command = + \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows +< +Use a version control listing command when inside a repository, this is faster +when scanning large projects: > + let g:ctrlp_user_command = [root_marker, listing_command, fallback_command] + let g:ctrlp_user_command = { + \ 'types': { + \ 1: [root_marker_1, listing_command_1], + \ n: [root_marker_n, listing_command_n], + \ }, + \ 'fallback': fallback_command, + \ 'ignore': 0 or 1 + \ } +< +Some examples: > + " Single VCS, listing command does not list untracked files: + let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files'] + let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .'] + + " Multiple VCS's: + let g:ctrlp_user_command = { + \ 'types': { + \ 1: ['.git', 'cd %s && git ls-files'], + \ 2: ['.hg', 'hg --cwd %s locate -I .'], + \ }, + \ 'fallback': 'find %s -type f' + \ } + + " Single VCS, listing command lists untracked files (slower): + let g:ctrlp_user_command = + \ ['.git', 'cd %s && git ls-files . -co --exclude-standard'] + + let g:ctrlp_user_command = + \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux + + let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') ' + \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows +< +Note #1: in the |Dictionary| format, 'fallback' and 'ignore' are optional. In +the |List| format, fallback_command is optional. + +Note #2: if the fallback_command is empty or the 'fallback' key is not defined, +|globpath()| will then be used when scanning outside of a repository. + +Note #3: unless the |Dictionary| format is used and 'ignore' is defined and set +to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when +these custom commands are being used. When not present, 'ignore' is set to 0 by +default to retain the performance advantage of using external commands. + +Note #4: when changing the option's variable type, remember to |:unlet| it +first or restart Vim to avoid the "E706: Variable type mismatch" error. + +Note #5: you can use a |b:var| to set this option on a per buffer basis. + + *'g:ctrlp_max_history'* +The maximum number of input strings you want CtrlP to remember. The default +value mirrors Vim's global |'history'| option: > + let g:ctrlp_max_history = &history +< +Set to 0 to disable prompt's history. Browse the history with and . + + *'g:ctrlp_open_new_file'* +Use this option to specify how the newly created file is to be opened when +pressing : > + let g:ctrlp_open_new_file = 'v' +< + t - in a new tab. + h - in a new horizontal split. + v - in a new vertical split. + r - in the current window. + + *'g:ctrlp_open_multiple_files'* +If non-zero, this will enable opening multiple files with and : > + let g:ctrlp_open_multiple_files = 'v' +< +Example: > + let g:ctrlp_open_multiple_files = '2vjr' +< +For the number: + - If given, it'll be used as the maximum number of windows or tabs to create + when opening the files (the rest will be opened as hidden buffers). + - If not given, will open all files, each in a new window or new tab. + +For the letters: + t - each file in a new tab. + h - each file in a new horizontal split. + v - each file in a new vertical split. + i - all files as hidden buffers. + j - after opening, jump to the first opened tab or window. + r - open the first file in the current window, then the remaining files in + new splits or new tabs depending on which of "h", "v" and "t" is also + present. + + *'g:ctrlp_arg_map'* +When this is set to 1, the and mappings will accept one extra key +as an argument to override their default behavior: > + let g:ctrlp_arg_map = 0 +< +Pressing or will then prompt for a keypress. The key can be: + t - open in tab(s) + h - open in horizontal split(s) + v - open in vertical split(s) + i - open as hidden buffers (for only) + c - clear the marked files (for only) + r - open in the current window (for only) + , , - cancel and go back to the prompt. + - use the default behavior specified with |g:ctrlp_open_new_file| and + |g:ctrlp_open_multiple_files|. + + *'g:ctrlp_follow_symlinks'* +If non-zero, CtrlP will follow symbolic links when listing files: > + let g:ctrlp_follow_symlinks = 0 +< + 0 - don't follow symbolic links. + 1 - follow but ignore looped internal symlinks to avoid duplicates. + 2 - follow all symlinks indiscriminately. + +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. + + *'g:ctrlp_lazy_update'* +Set this to 1 to enable the lazy-update feature: only update the match window +after typing's been stopped for a certain amount of time: > + let g:ctrlp_lazy_update = 0 +< +If is 1, update after 250ms. If bigger than 1, the number will be used as the +delay time in milliseconds. + + *'g:ctrlp_default_input'* +Set this to 1 to enable seeding the prompt with the current file's relative +path: > + let g:ctrlp_default_input = 0 +< +Instead of 1 or 0, if the value of the option is a string, it'll be used as-is +as the default input: > + let g:ctrlp_default_input = 'anystring' +< + + *'g:ctrlp_abbrev'* +Define input abbreviations that can be expanded (either internally or visibly) +in the prompt: > + let g:ctrlp_abbrev = {} +< +Examples: > + let g:ctrlp_abbrev = { + \ 'gmode': 'i', + \ 'abbrevs': [ + \ { + \ 'pattern': '^cd b', + \ 'expanded': '@cd ~/.vim/bundle', + \ 'mode': 'pfrz', + \ }, + \ { + \ 'pattern': '\(^@.\+\|\\\@ (use the expanded string in the + new filename). + c - only when auto-completing directory names with (expand the pattern + immediately before doing the auto-completion). + or not defined - always enable. + +Note: the abbrev entries are evaluated in sequence, so a later entry can be +evaluated against the expanded result of a previous entry; this includes itself +when 'gmode' is "t". + + *'g:ctrlp_key_loop'* +An experimental feature. Set this to 1 to enable input looping for the typing +of multi-byte characters: > + let g:ctrlp_key_loop = 0 +< +Note #1: when set, this option resets the |g:ctrlp_lazy_update| option. + +Note #2: you can toggle this feature inside the prompt with a custom mapping: > + let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': [''] } +< + + *'g:ctrlp_use_migemo'* +Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only +works in regexp mode. To split the pattern, separate words with space: > + let g:ctrlp_use_migemo = 0 +< + + *'g:ctrlp_prompt_mappings'* +Use this to customize the mappings inside CtrlP's prompt to your liking. You +only need to keep the lines that you've changed the values (inside []): > + let g:ctrlp_prompt_mappings = { + \ 'PrtBS()': ['', ''], + \ 'PrtDelete()': [''], + \ 'PrtDeleteWord()': [''], + \ 'PrtClear()': [''], + \ 'PrtSelectMove("j")': ['', ''], + \ 'PrtSelectMove("k")': ['', ''], + \ 'PrtSelectMove("t")': ['', ''], + \ 'PrtSelectMove("b")': ['', ''], + \ 'PrtSelectMove("u")': ['', ''], + \ 'PrtSelectMove("d")': ['', ''], + \ 'PrtHistory(-1)': [''], + \ 'PrtHistory(1)': [''], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], + \ 'AcceptSelection("h")': ['', '', ''], + \ 'AcceptSelection("t")': [''], + \ 'AcceptSelection("v")': ['', ''], + \ 'ToggleFocus()': [''], + \ 'ToggleRegex()': [''], + \ 'ToggleByFname()': [''], + \ 'ToggleType(1)': ['', ''], + \ 'ToggleType(-1)': ['', ''], + \ 'PrtExpandDir()': [''], + \ 'PrtInsert("c")': ['', ''], + \ 'PrtInsert()': [''], + \ 'PrtCurStart()': [''], + \ 'PrtCurEnd()': [''], + \ 'PrtCurLeft()': ['', '', ''], + \ 'PrtCurRight()': ['', ''], + \ 'PrtClearCache()': [''], + \ 'PrtDeleteEnt()': [''], + \ 'CreateNewFile()': [''], + \ 'MarkToOpen()': [''], + \ 'OpenMulti()': [''], + \ 'PrtExit()': ['', '', ''], + \ } +< +Note: if pressing moves the cursor one character to the left instead of +deleting a character for you, add this to your |.vimrc| to disable the plugin's +default mapping: > + let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['', ''] } +< + +---------------------------------------- +MRU mode options:~ + + *'g:ctrlp_mruf_max'* +Specify the number of recently opened files you want CtrlP to remember: > + let g:ctrlp_mruf_max = 250 +< + + *'g:ctrlp_mruf_exclude'* +Files you don't want CtrlP to remember. Use regexp to specify the patterns: > + let g:ctrlp_mruf_exclude = '' +< +Examples: > + let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux + let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows +< + + *'g:ctrlp_mruf_include'* +And if you want CtrlP to only remember some files, specify them here: > + let g:ctrlp_mruf_include = '' +< +Example: > + let g:ctrlp_mruf_include = '\.py$\|\.rb$' +< + + *'g:ctrlp_mruf_relative'* +Set this to 1 to show only MRU files in the current working directory: > + let g:ctrlp_mruf_relative = 0 +< +Note: you can use a custom mapping to toggle this option inside the prompt: > + let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': [''] } +< + + *'g:ctrlp_mruf_default_order'* +Set this to 1 to disable sorting when searching in MRU mode: > + let g:ctrlp_mruf_default_order = 0 +< + + *'g:ctrlp_mruf_case_sensitive'* +Match this with your file system case-sensitivity setting to avoid duplicate +MRU entries: > + let g:ctrlp_mruf_case_sensitive = 1 +< + + *'g:ctrlp_mruf_save_on_update'* +Set this to 0 to disable saving of the MRU list to hard drive whenever a new +entry is added, saving will then only occur when exiting Vim: > + let g:ctrlp_mruf_save_on_update = 1 +< + +---------------------------------------- +Advanced options:~ + + *'g:ctrlp_open_func'* +Define a custom function to open the selected file: > + let g:ctrlp_open_func = {} +< +Example: > + let g:ctrlp_open_func = { + \ 'files' : 'Function_Name_1', + \ 'buffers' : 'Function_Name_2', + \ 'mru files' : 'Function_Name_3', + \ } +< +Structure of the functions: > + function! Function_Name(action, line) + " Arguments: + " | + " +- a:action : The opening action: + " | + 'e' : user pressed (default) + " | + 'h' : user pressed (default) + " | + 'v' : user pressed (default) + " | + 't' : user pressed (default) + " | + 'x' : user used the console dialog (default) and + " | chose "e[x]ternal". + " | + " +- a:line : The selected line. + + endfunction +< +Note: does not apply when opening multiple files with and . + +Example: open HTML files in the default web browser when is pressed and +in Vim otherwise > + function! HTMLOpenFunc(action, line) + if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\?$' + + " Get the filename + let filename = fnameescape(fnamemodify(a:line, ':p')) + + " Close CtrlP + call ctrlp#exit() + + " Open the file + silent! execute '!xdg-open' filename + + elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$' + + " Not a HTML file, simulate pressing again and wait for new input + call feedkeys("\") + + else + + " Use CtrlP's default file opening function + call call('ctrlp#acceptfile', [a:action, a:line]) + + endif + endfunction + + let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' } +< + + *'g:ctrlp_status_func'* +Use this to customize the statuslines for the CtrlP window: > + let g:ctrlp_status_func = {} +< +Example: > + let g:ctrlp_status_func = { + \ 'main': 'Function_Name_1', + \ 'prog': 'Function_Name_2', + \ } +< +Structure of the functions: > + " Main statusline + function! Function_Name_1(focus, byfname, regex, prev, item, next, marked) + " Arguments: + " | + " +- a:focus : The focus of the prompt: "prt" or "win". + " | + " +- a:byfname : In filename mode or in full path mode: "file" or "path". + " | + " +- a:regex : In regex mode: 1 or 0. + " | + " +- a:prev : The previous search mode. + " | + " +- a:item : The current search mode. + " | + " +- a:next : The next search mode. + " | + " +- a:marked : The number of marked files, or a comma separated list of + " the marked filenames. + + return full_statusline + endfunction + + " Progress statusline + function! Function_Name_2(str) + " a:str : Either the number of files scanned so far, or a string indicating + " the current directory is being scanned with a user_command. + + return full_statusline + endfunction +< +See https://gist.github.com/1610859 for a working example. + + *'g:ctrlp_buffer_func'* +Specify the functions that will be called after entering and before exiting the +CtrlP buffer: > + let g:ctrlp_buffer_func = {} +< +Example: > + let g:ctrlp_buffer_func = { + \ 'enter': 'Function_Name_1', + \ 'exit': 'Function_Name_2', + \ } +< + + *'g:ctrlp_match_func'* +Set an external fuzzy matching function for CtrlP to use: > + let g:ctrlp_match_func = {} +< +Example: > + let g:ctrlp_match_func = { 'match': 'Function_Name' } +< +Structure of the function: > + function! Function_Name(items, str, limit, mmode, ispath, crfile, regex) + " Arguments: + " | + " +- a:items : The full list of items to search in. + " | + " +- a:str : The string entered by the user. + " | + " +- a:limit : The max height of the match window. Can be used to limit + " | the number of items to return. + " | + " +- a:mmode : The match mode. Can be one of these strings: + " | + "full-line": match the entire line. + " | + "filename-only": match only the filename. + " | + "first-non-tab": match until the first tab char. + " | + "until-last-tab": match until the last tab char. + " | + " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and + " | rtscript modes. Is 0 otherwise. + " | + " +- a:crfile : The file in the current window. Should be excluded from the + " | results when a:ispath == 1. + " | + " +- a:regex : In regex mode: 1 or 0. + + return list_of_matched_items + endfunction +< + +Note: you can extend any of the above options with { 'arg_type': 'dict' } to +enable passing all the function arguments in a single Dictionary argument. Use +the existing argument names as keys in this Dictionary. + +Example: > + let g:ctrlp_status_func = { + \ 'arg_type' : 'dict', + \ 'enter': 'Function_Name_1', + \ 'exit': 'Function_Name_2', + \ } + + function! Function_Name_1(dict) + " where dict == { + " \ 'focus': value, + " \ 'byfname': value, + " \ 'regex': value, + " \ ... + " } + endfunction +< + +=============================================================================== +COMMANDS *ctrlp-commands* + + *:CtrlP* +:CtrlP [starting-directory] + Open CtrlP in find file mode. + + If no argument is given, the value of |g:ctrlp_working_path_mode| will be + used to determine the starting directory. + + You can use to auto-complete the [starting-directory] when typing it. + + *:CtrlPBuffer* +:CtrlPBuffer + Open CtrlP in find buffer mode. + + *:CtrlPMRU* +:CtrlPMRU + Open CtrlP in find Most-Recently-Used file mode. + + *:CtrlPLastMode* +:CtrlPLastMode [--dir] + Open CtrlP in the last mode used. When having the "--dir" argument, also + reuse the last working directory. + + *:CtrlPRoot* +:CtrlPRoot + This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores + the variable's current value. + + *:CtrlPClearCache* +:CtrlPClearCache + Flush the cache for the current working directory. The same as pressing + inside CtrlP. + To enable or disable caching, use the |g:ctrlp_use_caching| option. + + *:CtrlPClearAllCaches* +:CtrlPClearAllCaches + Delete all the cache files saved in |g:ctrlp_cache_dir| location. + +------------------------------------------------------------------------------- +For commands provided by bundled extensions, see |ctrlp-extensions|. + +=============================================================================== +MAPPINGS *ctrlp-mappings* + + *'ctrlp-'* + + Default |Normal| mode mapping to open the CtrlP prompt in find file mode. + +---------------------------------------- +Once inside the prompt:~ + + + Toggle between full-path search and filename only search. + Note: in filename mode, the prompt's base is '>d>' instead of '>>>' + + *'ctrlp-fullregexp'* + Toggle between the string mode and full regexp mode. + Note: in full regexp mode, the prompt's base is 'r>>' instead of '>>>' + + See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option). + + , 'forward' + + Scroll to the 'next' search mode in the sequence. + + , 'backward' + + Scroll to the 'previous' search mode in the sequence. + + *'ctrlp-autocompletion'* + Auto-complete directory names under the current working directory inside + the prompt. + + + Toggle the focus between the match window and the prompt. + + , + + Exit CtrlP. + +Moving:~ + + , + + Move selection down. + + , + + Move selection up. + + + Move the cursor to the 'start' of the prompt. + + + Move the cursor to the 'end' of the prompt. + + , + , + + Move the cursor one character to the 'left'. + + , + + Move the cursor one character to the 'right'. + +Editing:~ + + , + + Delete the preceding character. + + + Delete the current character. + + + Delete a preceding inner word. + + + Clear the input field. + +Browsing input history:~ + + + Next string in the prompt's history. + + + Previous string in the prompt's history. + +Opening/Creating a file:~ + + + Open the selected file in the 'current' window if possible. + + + Open the selected file in a new 'tab'. + + + Open the selected file in a 'vertical' split. + + , + , + + Open the selected file in a 'horizontal' split. + + + Create a new file and its parent directories. + +Opening multiple files:~ + + + - Mark/unmark a file to be opened with . + - Mark/unmark a file to create a new file in its directory using . + + + - Open files marked by . + - When no file has been marked by , open a console dialog with the + following options: + + Open the selected file: + t - in a tab page. + v - in a vertical split. + h - in a horizontal split. + r - in the current window. + i - as a hidden buffer. + x - (optional) with the function defined in |g:ctrlp_open_func|. + + Other options (not shown): + a - mark all files in the match window. + d - change CtrlP's local working directory to the selected file's + directory and switch to find file mode. + +Function keys:~ + + + - Refresh the match window and purge the cache for the current directory. + - Remove deleted files from the MRU list. + + + - Wipe the MRU list. + - Delete MRU entries marked by . + +Pasting:~ + + , *'ctrlp-pasting'* + + Paste the clipboard content into the prompt. + + + Open a console dialog to paste , , the content of the search + register, the last visual selection, the clipboard or any register into the + prompt. + +Choose your own mappings with |g:ctrlp_prompt_mappings|. + +---------------------------------------- +When inside the match window (press to switch):~ + + a-z + 0-9 + ~^-=;`',.+!@#$%&_(){}[] + Cycle through the lines which have the matching first character. + +=============================================================================== +INPUT FORMATS *ctrlp-input-formats* + +Formats for inputting in the prompt:~ + +a) Simple string. + + E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c' + +b) When in regexp mode, the input string's treated as a Vim's regexp |pattern| + without any modification. + + E.g. 'abc\d*efg' will be read as 'abc\d*efg'. + + See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for + how to enable regexp mode. + +c) End the string with a colon ':' followed by a Vim command to execute that + command after opening the file. If you need to use ':' literally, escape it + with a backslash: '\:'. When opening multiple files, the command will be + executed on each opening file. + + E.g. Use ':45' to jump to line 45. + + Use ':/any\:string' to jump to the first instance of 'any:string'. + + Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then + jump to line 50. + + Use ':diffthis' when opening multiple files to run |:diffthis| on the + first 4 files. + + See also: Vim's |++opt| and |+cmd|. + +d) Submit two dots '..' to go upward the directory tree by 1 level. To go up + multiple levels, use one extra dot for each extra level: +> + Raw input Interpreted as + .. ../ + ... ../../ + .... ../../../ +< + Note: if the parent directories are large and uncached, this can be slow. + + You can also use '@cd path/' to change CtrlP's local working directory. + Use '@cd %:h' to change to the directory of the current file. + +e) Similarly, submit '/' or '\' to find and go to the project's root. + + If the project is large, using a VCS listing command to look for files + might help speeding up the intial scan (see |g:ctrlp_user_command| for more + details). + + Note: d) and e) only work in file, directory and mixed modes. + +f) Type the name of a non-existent file and press to create it. Mark a + file with to create the new file in the same directory as the marked + file. + + E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as + well as a file named 'newfile.txt'. + + If an entry 'some/old/dirs/oldfile.txt' is marked with , then + 'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The + final path will then be 'some/old/dirs/newdir/newfile.txt'. + + Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set). + +g) In filename mode (toggle with ), you can use one primary pattern and + one refining pattern separated by a semicolon. Both patterns work like (a), + or (b) when in regexp mode. + +h) Submit ? to open this help file. + +=============================================================================== +EXTENSIONS *ctrlp-extensions* + +Extensions are optional. To enable an extension, add its name to the variable +g:ctrlp_extensions: > + let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript', + \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir'] +< +The order of the items will be the order they appear on the statusline and when +using , . + +Available extensions:~ + + *:CtrlPTag* + * Tag mode:~ + - Name: 'tag' + - Command: ":CtrlPTag" + - Search for a tag within a generated central tags file, and jump to the + definition. Use the Vim's option |'tags'| to specify the names and the + locations of the tags file(s). + E.g. set tags+=doc/tags + + *:CtrlPBufTag* + *:CtrlPBufTagAll* + * Buffer Tag mode:~ + - Name: 'buffertag' + - Commands: ":CtrlPBufTag [buffer]", + ":CtrlPBufTagAll". + - Search for a tag within the current buffer or all listed buffers and jump + to the definition. Requires |exuberant_ctags| or compatible programs. + + *:CtrlPQuickfix* + * Quickfix mode:~ + - Name: 'quickfix' + - Command: ":CtrlPQuickfix" + - Search for an entry in the current quickfix errors and jump to it. + + *:CtrlPDir* + * Directory mode:~ + - Name: 'dir' + - Command: ":CtrlPDir [starting-directory]" + - Search for a directory and change the working directory to it. + - Mappings: + + change the local working directory for CtrlP and keep it open. + + change the global working directory (exit). + + change the local working directory for the current window (exit). + + change the global working directory to CtrlP's current local + working directory (exit). + + *:CtrlPRTS* + * Runtime script mode:~ + - Name: 'rtscript' + - Command: ":CtrlPRTS" + - Search for files (vimscripts, docs, snippets...) in runtimepath. + + *:CtrlPUndo* + * Undo mode:~ + - Name: 'undo' + - Command: ":CtrlPUndo" + - Browse undo history. + + *:CtrlPLine* + * Line mode:~ + - Name: 'line' + - Command: ":CtrlPLine [buffer]" + - Search for a line in all listed buffers or in the specified [buffer]. + + *:CtrlPChange* + *:CtrlPChangeAll* + * Change list mode:~ + - Name: 'changes' + - Commands: ":CtrlPChange [buffer]", + ":CtrlPChangeAll". + - Search for and jump to a recent change in the current buffer or in all + listed buffers. + + *:CtrlPMixed* + * Mixed mode:~ + - Name: 'mixed' + - Command: ":CtrlPMixed" + - Search in files, buffers and MRU files at the same time. + + *:CtrlPBookmarkDir* + *:CtrlPBookmarkDirAdd* + * BookmarkDir mode:~ + - Name: 'bookmarkdir' + - Commands: ":CtrlPBookmarkDir", + ":CtrlPBookmarkDirAdd [directory]". + - Search for a bookmarked directory and change the working directory to it. + - Mappings: + + change the local working directory for CtrlP, keep it open and + switch to find file mode. + + change the global working directory (exit). + + change the local working directory for the current window (exit). + + + - Wipe bookmark list. + - Delete entries marked by . + +---------------------------------------- +Buffer Tag mode options:~ + + *'g:ctrlp_buftag_ctags_bin'* +If ctags isn't in your $PATH, use this to set its location: > + let g:ctrlp_buftag_ctags_bin = '' +< + + *'g:ctrlp_buftag_systemenc'* +Match this with your OS's encoding (not Vim's). The default value mirrors Vim's +global |'encoding'| option: > + let g:ctrlp_buftag_systemenc = &encoding +< + + *'g:ctrlp_buftag_types'* +Use this to set the arguments for ctags, jsctags... for a given filetype: > + let g:ctrlp_buftag_types = '' +< +Examples: > + let g:ctrlp_buftag_types = { + \ 'erlang' : '--language-force=erlang --erlang-types=drmf', + \ 'javascript' : { + \ 'bin': 'jsctags', + \ 'args': '-f -', + \ }, + \ } +< + +=============================================================================== +CUSTOMIZATION *ctrlp-customization* + +Highlighting:~ + * For the CtrlP buffer: + CtrlPNoEntries : the message when no match is found (Error) + CtrlPMatch : the matched pattern (Identifier) + CtrlPLinePre : the line prefix '>' in the match window + CtrlPPrtBase : the prompt's base (Comment) + CtrlPPrtText : the prompt's text (|hl-Normal|) + CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant) + + * In extensions: + CtrlPTabExtra : the part of each line that's not matched against (Comment) + CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|) + CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|) + CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment) + CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|) + CtrlPUndoBr : the square brackets [] in undo mode (Comment) + CtrlPUndoNr : the undo number inside [] in undo mode (String) + CtrlPUndoSv : the point where the file was saved (Comment) + CtrlPUndoPo : the current position in the undo tree (|hl-Title|) + CtrlPBookmark : the name of the bookmark (Identifier) + +Statuslines:~ + * Highlight groups: + CtrlPMode1 : 'file' or 'path' or 'line', and the current mode (Character) + CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|) + CtrlPStats : the scanning status (Function) + + For rebuilding the statuslines, see |g:ctrlp_status_func|. + +=============================================================================== +MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* + +* Using |wildignore| for |g:ctrlp_user_command|: +> + function! s:wig2cmd() + " Change wildignore into space or | separated groups + " e.g. .aux .out .toc .jpg .bmp .gif + " or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$ + let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@) + +* A standalone function to set the working directory to the project's root, or + to the parent directory of the current file if a root can't be found: +> + function! s:setcwd() + let cph = expand('%:p:h', 1) + if cph =~ '^.\+://' | retu | en + for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects'] + let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';']) + if wd != '' | let &acd = 0 | brea | en + endfo + exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', '')) + endfunction + + autocmd BufEnter * call s:setcwd() +< +(requires Vim 7.1.299+) + +* Using a |count| to invoke different commands using the same mapping: +> + let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)' +< + +=============================================================================== +CREDITS *ctrlp-credits* + +Developed by Kien Nguyen . Distributed under Vim's |license|. + +Project's homepage: http://kien.github.com/ctrlp.vim +Git repository: https://github.com/kien/ctrlp.vim +Mercurial repository: https://bitbucket.org/kien/ctrlp.vim + +------------------------------------------------------------------------------- +Thanks to everyone that has submitted ideas, bug reports or helped debugging on +gibhub, bitbucket, and through email. + +Special thanks:~ + + * Woojong Koh + * Simon Ruderich + * Yasuhiro Matsumoto + * Ken Earley + * Kyo Nagashima + * Zak Johnson + * Diego Viola + * Piet Delport + * Thibault Duplessis + * Kent Sibilev + * Tacahiroy + * Luca Pette + * Seth Fowler + * Lowe Thiderman + * Christopher Fredén + * Zahary Karadjov + * Jo De Boeck + * Rudi Grinberg + * Timothy Mellor + +=============================================================================== +CHANGELOG *ctrlp-changelog* + + + Combine *g:ctrlp_match_window_bottom* *g:ctrlp_match_window_reversed* and + *g:ctrlp_max_height* into |g:ctrlp_match_window|. + + New option: |g:ctrlp_match_window|. + +Before 2012/11/30~ + + + New options: |g:ctrlp_abbrev|, + |g:ctrlp_key_loop|, + |g:ctrlp_open_func|, + |g:ctrlp_tabpage_position|, + |g:ctrlp_mruf_save_on_update| + + Rename: + *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|. + + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type + (old values still work). + + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'. + +Before 2012/06/15~ + + + New value for |g:ctrlp_follow_symlinks|: 2. + + New value for |g:ctrlp_open_multiple_files|: 'j'. + + Allow using , , to open files marked by . + + Extend '..' (|ctrlp-input-formats| (d)) + + New input format: '@cd' (|ctrlp-input-formats| (d)) + +Before 2012/04/30~ + + + New option: |g:ctrlp_mruf_default_order| + + New feature: Bookmarked directories extension. + + New commands: |:CtrlPBookmarkDir| + |:CtrlPBookmarkDirAdd| + +Before 2012/04/15~ + + + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer. + + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode. + + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used. + |:CtrlPMixed|, search in files, buffers and MRU files. + +Before 2012/03/31~ + + + New options: |g:ctrlp_default_input|, default input when entering CtrlP. + |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + + Rename: + *ClearCtrlPCache* -> |CtrlPClearCache| + *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches| + *ResetCtrlP* -> |CtrlPReload| + +Before 2012/03/02~ + + + Rename: + *g:ctrlp_regexp_search* -> |g:ctrlp_regexp|, + *g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|, + *g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|. + + Rename and tweak: + *g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|. + + Deprecate *g:ctrlp_highlight_match* + + Extend |g:ctrlp_user_command| to support multiple commands. + + New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered. + +Before 2012/01/15~ + + + New mapping: Switch and . is now used for completion + of directory names under the current working directory. + + New options: |g:ctrlp_arg_map| for , to accept an argument. + |g:ctrlp_status_func| custom statusline. + |g:ctrlp_mruf_relative| show only MRU files inside cwd. + + Extend g:ctrlp_open_multi with new optional values: tr, hr, vr. + + Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link. + +Before 2012/01/05~ + + + New feature: Buffer Tag extension. + + New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|. + + New options: |g:ctrlp_cmd|, + |g:ctrlp_custom_ignore| + +Before 2011/11/30~ + + + New features: Tag, Quickfix and Directory extensions. + + New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|. + + New options: |g:ctrlp_use_migemo|, + |g:ctrlp_lazy_update|, + |g:ctrlp_follow_symlinks| + +Before 2011/11/13~ + + + New special input: '/' and '\' find root (|ctrlp-input-formats| (e)) + + Remove ctrlp#SetWorkingPath(). + + Remove *g:ctrlp_mru_files* and make MRU mode permanent. + + Extend g:ctrlp_open_multi, add new ways to open files. + + New option: g:ctrlp_dont_split, + |g:ctrlp_mruf_case_sensitive| + +Before 2011/10/30~ + + + New feature: Support for custom extensions. + also removes non-existent files from MRU list. + + New option: g:ctrlp_jump_to_buffer + +Before 2011/10/12~ + + + New features: Open multiple files. + Pass Vim's |++opt| and |+cmd| to the opening file + (|ctrlp-input-formats| (c)) + Auto-complete each dir for |:CtrlP| [starting-directory] + + New mappings: mark/unmark a file to be opened with . + open all marked files. + + New option: g:ctrlp_open_multi + + Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and . + +Before 2011/09/29~ + + + New mappings: , next/prev string in the input history. + create a new file and its parent dirs. + + New options: |g:ctrlp_open_new_file|, + |g:ctrlp_max_history| + + Added a new open-in-horizontal-split mapping: + +Before 2011/09/19~ + + + New command: ResetCtrlP + + New options: |g:ctrlp_max_files|, + |g:ctrlp_max_depth|, + g:ctrlp_live_update + + New mapping: + +Before 2011/09/12~ + + + Ability to cycle through matched lines in the match window. + + Extend the behavior of g:ctrlp_persistent_input + + Extend the behavior of |:CtrlP| + + New options: |g:ctrlp_dotfiles|, + |g:ctrlp_clear_cache_on_exit|, + g:ctrlp_highlight_match, + |g:ctrlp_user_command| + + New special input: '..' (|ctrlp-input-formats| (d)) + + New mapping: . + + New commands: |:CtrlPCurWD|, + |:CtrlPCurFile|, + |:CtrlPRoot| + + + New feature: Search in most recently used (MRU) files + + New mapping: . + + Extended the behavior of . + + New options: g:ctrlp_mru_files, + |g:ctrlp_mruf_max|, + |g:ctrlp_mruf_exclude|, + |g:ctrlp_mruf_include| + + New command: |:CtrlPMRU| + +First public release: 2011/09/06~ + +=============================================================================== +vim:ft=help:et:ts=2:sw=2:sts=2:norl diff --git a/vim-plugins/bundle/ctrlp.vim/doc/tags b/vim-plugins/bundle/ctrlp.vim/doc/tags new file mode 100644 index 0000000..e1404fd --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/doc/tags @@ -0,0 +1,100 @@ +'ctrl-p' ctrlp.txt /*'ctrl-p'* +'ctrlp' ctrlp.txt /*'ctrlp'* +'ctrlp-' ctrlp.txt /*'ctrlp-'* +'ctrlp-autocompletion' ctrlp.txt /*'ctrlp-autocompletion'* +'ctrlp-fullregexp' ctrlp.txt /*'ctrlp-fullregexp'* +'ctrlp-pasting' ctrlp.txt /*'ctrlp-pasting'* +'ctrlp-wildignore' ctrlp.txt /*'ctrlp-wildignore'* +'g:ctrlp_abbrev' ctrlp.txt /*'g:ctrlp_abbrev'* +'g:ctrlp_arg_map' ctrlp.txt /*'g:ctrlp_arg_map'* +'g:ctrlp_buffer_func' ctrlp.txt /*'g:ctrlp_buffer_func'* +'g:ctrlp_buftag_ctags_bin' ctrlp.txt /*'g:ctrlp_buftag_ctags_bin'* +'g:ctrlp_buftag_systemenc' ctrlp.txt /*'g:ctrlp_buftag_systemenc'* +'g:ctrlp_buftag_types' ctrlp.txt /*'g:ctrlp_buftag_types'* +'g:ctrlp_by_filename' ctrlp.txt /*'g:ctrlp_by_filename'* +'g:ctrlp_cache_dir' ctrlp.txt /*'g:ctrlp_cache_dir'* +'g:ctrlp_clear_cache_on_exit' ctrlp.txt /*'g:ctrlp_clear_cache_on_exit'* +'g:ctrlp_cmd' ctrlp.txt /*'g:ctrlp_cmd'* +'g:ctrlp_custom_ignore' ctrlp.txt /*'g:ctrlp_custom_ignore'* +'g:ctrlp_default_input' ctrlp.txt /*'g:ctrlp_default_input'* +'g:ctrlp_follow_symlinks' ctrlp.txt /*'g:ctrlp_follow_symlinks'* +'g:ctrlp_key_loop' ctrlp.txt /*'g:ctrlp_key_loop'* +'g:ctrlp_lazy_update' ctrlp.txt /*'g:ctrlp_lazy_update'* +'g:ctrlp_map' ctrlp.txt /*'g:ctrlp_map'* +'g:ctrlp_match_func' ctrlp.txt /*'g:ctrlp_match_func'* +'g:ctrlp_match_window' ctrlp.txt /*'g:ctrlp_match_window'* +'g:ctrlp_max_depth' ctrlp.txt /*'g:ctrlp_max_depth'* +'g:ctrlp_max_files' ctrlp.txt /*'g:ctrlp_max_files'* +'g:ctrlp_max_history' ctrlp.txt /*'g:ctrlp_max_history'* +'g:ctrlp_mruf_case_sensitive' ctrlp.txt /*'g:ctrlp_mruf_case_sensitive'* +'g:ctrlp_mruf_default_order' ctrlp.txt /*'g:ctrlp_mruf_default_order'* +'g:ctrlp_mruf_exclude' ctrlp.txt /*'g:ctrlp_mruf_exclude'* +'g:ctrlp_mruf_include' ctrlp.txt /*'g:ctrlp_mruf_include'* +'g:ctrlp_mruf_max' ctrlp.txt /*'g:ctrlp_mruf_max'* +'g:ctrlp_mruf_relative' ctrlp.txt /*'g:ctrlp_mruf_relative'* +'g:ctrlp_mruf_save_on_update' ctrlp.txt /*'g:ctrlp_mruf_save_on_update'* +'g:ctrlp_open_func' ctrlp.txt /*'g:ctrlp_open_func'* +'g:ctrlp_open_multiple_files' ctrlp.txt /*'g:ctrlp_open_multiple_files'* +'g:ctrlp_open_new_file' ctrlp.txt /*'g:ctrlp_open_new_file'* +'g:ctrlp_prompt_mappings' ctrlp.txt /*'g:ctrlp_prompt_mappings'* +'g:ctrlp_regexp' ctrlp.txt /*'g:ctrlp_regexp'* +'g:ctrlp_reuse_window' ctrlp.txt /*'g:ctrlp_reuse_window'* +'g:ctrlp_root_markers' ctrlp.txt /*'g:ctrlp_root_markers'* +'g:ctrlp_show_hidden' ctrlp.txt /*'g:ctrlp_show_hidden'* +'g:ctrlp_status_func' ctrlp.txt /*'g:ctrlp_status_func'* +'g:ctrlp_switch_buffer' ctrlp.txt /*'g:ctrlp_switch_buffer'* +'g:ctrlp_tabpage_position' ctrlp.txt /*'g:ctrlp_tabpage_position'* +'g:ctrlp_use_caching' ctrlp.txt /*'g:ctrlp_use_caching'* +'g:ctrlp_use_migemo' ctrlp.txt /*'g:ctrlp_use_migemo'* +'g:ctrlp_user_command' ctrlp.txt /*'g:ctrlp_user_command'* +'g:ctrlp_working_path_mode' ctrlp.txt /*'g:ctrlp_working_path_mode'* +'g:loaded_ctrlp' ctrlp.txt /*'g:loaded_ctrlp'* +:CtrlP ctrlp.txt /*:CtrlP* +:CtrlPBookmarkDir ctrlp.txt /*:CtrlPBookmarkDir* +:CtrlPBookmarkDirAdd ctrlp.txt /*:CtrlPBookmarkDirAdd* +:CtrlPBufTag ctrlp.txt /*:CtrlPBufTag* +:CtrlPBufTagAll ctrlp.txt /*:CtrlPBufTagAll* +:CtrlPBuffer ctrlp.txt /*:CtrlPBuffer* +:CtrlPChange ctrlp.txt /*:CtrlPChange* +:CtrlPChangeAll ctrlp.txt /*:CtrlPChangeAll* +:CtrlPClearAllCaches ctrlp.txt /*:CtrlPClearAllCaches* +:CtrlPClearCache ctrlp.txt /*:CtrlPClearCache* +:CtrlPDir ctrlp.txt /*:CtrlPDir* +:CtrlPLastMode ctrlp.txt /*:CtrlPLastMode* +:CtrlPLine ctrlp.txt /*:CtrlPLine* +:CtrlPMRU ctrlp.txt /*:CtrlPMRU* +:CtrlPMixed ctrlp.txt /*:CtrlPMixed* +:CtrlPQuickfix ctrlp.txt /*:CtrlPQuickfix* +:CtrlPRTS ctrlp.txt /*:CtrlPRTS* +:CtrlPRoot ctrlp.txt /*:CtrlPRoot* +:CtrlPTag ctrlp.txt /*:CtrlPTag* +:CtrlPUndo ctrlp.txt /*:CtrlPUndo* +ClearAllCtrlPCaches ctrlp.txt /*ClearAllCtrlPCaches* +ClearCtrlPCache ctrlp.txt /*ClearCtrlPCache* +ControlP ctrlp.txt /*ControlP* +CtrlP ctrlp.txt /*CtrlP* +ResetCtrlP ctrlp.txt /*ResetCtrlP* +ctrlp-changelog ctrlp.txt /*ctrlp-changelog* +ctrlp-commands ctrlp.txt /*ctrlp-commands* +ctrlp-contents ctrlp.txt /*ctrlp-contents* +ctrlp-credits ctrlp.txt /*ctrlp-credits* +ctrlp-customization ctrlp.txt /*ctrlp-customization* +ctrlp-extensions ctrlp.txt /*ctrlp-extensions* +ctrlp-input-formats ctrlp.txt /*ctrlp-input-formats* +ctrlp-intro ctrlp.txt /*ctrlp-intro* +ctrlp-mappings ctrlp.txt /*ctrlp-mappings* +ctrlp-miscellaneous-configs ctrlp.txt /*ctrlp-miscellaneous-configs* +ctrlp-options ctrlp.txt /*ctrlp-options* +ctrlp.txt ctrlp.txt /*ctrlp.txt* +g:ctrlp_dont_split ctrlp.txt /*g:ctrlp_dont_split* +g:ctrlp_dotfiles ctrlp.txt /*g:ctrlp_dotfiles* +g:ctrlp_highlight_match ctrlp.txt /*g:ctrlp_highlight_match* +g:ctrlp_jump_to_buffer ctrlp.txt /*g:ctrlp_jump_to_buffer* +g:ctrlp_live_update ctrlp.txt /*g:ctrlp_live_update* +g:ctrlp_match_window_bottom ctrlp.txt /*g:ctrlp_match_window_bottom* +g:ctrlp_match_window_reversed ctrlp.txt /*g:ctrlp_match_window_reversed* +g:ctrlp_max_height ctrlp.txt /*g:ctrlp_max_height* +g:ctrlp_mru_files ctrlp.txt /*g:ctrlp_mru_files* +g:ctrlp_open_multi ctrlp.txt /*g:ctrlp_open_multi* +g:ctrlp_persistent_input ctrlp.txt /*g:ctrlp_persistent_input* +g:ctrlp_regexp_search ctrlp.txt /*g:ctrlp_regexp_search* diff --git a/vim-plugins/bundle/ctrlp.vim/plugin/ctrlp.vim b/vim-plugins/bundle/ctrlp.vim/plugin/ctrlp.vim new file mode 100644 index 0000000..c7b8fa3 --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/plugin/ctrlp.vim @@ -0,0 +1,68 @@ +" ============================================================================= +" File: plugin/ctrlp.vim +" Description: Fuzzy file, buffer, mru, tag, etc finder. +" Author: Kien Nguyen +" ============================================================================= +" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip + +if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp + fini +en +let g:loaded_ctrlp = 1 + +let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs, + \ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins] + \ = [[], [], [], [], {}, {}, [], 2] + +if !exists('g:ctrlp_map') | let g:ctrlp_map = '' | en +if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en + +com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': }) +com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': }) + +com! -bar CtrlPBuffer cal ctrlp#init(1) +com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': }) + +com! -bar CtrlPClearCache cal ctrlp#clr() +com! -bar CtrlPClearAllCaches cal ctrlp#clra() + +com! -bar ClearCtrlPCache cal ctrlp#clr() +com! -bar ClearAllCtrlPCaches cal ctrlp#clra() + +com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' }) +com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' }) +com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' }) + +if g:ctrlp_map != '' && !hasmapto(':'.g:ctrlp_cmd.'', 'n') + exe 'nn ' g:ctrlp_map ':'.g:ctrlp_cmd.'' +en + +cal ctrlp#mrufiles#init() + +com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id()) +com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id()) + +com! -n=? -com=dir CtrlPDir + \ cal ctrlp#init(ctrlp#dir#id(), { 'dir': }) + +com! -n=? -com=buffer CtrlPBufTag + \ cal ctrlp#init(ctrlp#buffertag#cmd(0, )) + +com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1)) +com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id()) +com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id()) + +com! -n=? -com=buffer CtrlPLine + \ cal ctrlp#init(ctrlp#line#cmd(1, )) + +com! -n=? -com=buffer CtrlPChange + \ cal ctrlp#init(ctrlp#changes#cmd(0, )) + +com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1)) +com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id()) +com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id()) + +com! -n=? -com=dir CtrlPBookmarkDirAdd + \ cal ctrlp#call('ctrlp#bookmarkdir#add', ) + +" vim:ts=2:sw=2:sts=2 diff --git a/vim-plugins/bundle/ctrlp.vim/readme.md b/vim-plugins/bundle/ctrlp.vim/readme.md new file mode 100644 index 0000000..d495fff --- /dev/null +++ b/vim-plugins/bundle/ctrlp.vim/readme.md @@ -0,0 +1,91 @@ +#**This project is unmaintained** +**You should use [this fork](https://github.com/ctrlpvim/ctrlp.vim) instead.** + +# ctrlp.vim +Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim. + +* Written in pure Vimscript for MacVim, gVim and Vim 7.0+. +* Full support for Vim's regexp as search patterns. +* Built-in Most Recently Used (MRU) files monitoring. +* Built-in project's root finder. +* Open multiple files at once. +* Create new files and directories. +* [Extensible][2]. + +![ctrlp][1] + +## Basic Usage +* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode. +* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode. +* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time. + +Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands. + +##### Once CtrlP is open: +* Press `` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options. +* Press `` and `` to cycle between modes. +* Press `` to switch to filename only search instead of full path. +* Press `` to switch to regexp mode. +* Use ``, `` or the arrow keys to navigate the result list. +* Use `` or ``, `` to open the selected entry in a new tab or in a new split. +* Use ``, `` to select the next/previous string in the prompt's history. +* Use `` to create a new file and its parent directories. +* Use `` to mark/unmark multiple files and `` to open them. + +Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help. + +* Submit two or more dots `..` to go up the directory tree by one or multiple levels. +* End the input string with a colon `:` followed by a command to execute it on the opening file(s): +Use `:25` to jump to line 25. +Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files. + +## Basic Options +* Change the default mapping and the default command to invoke CtrlP: + + ```vim + let g:ctrlp_map = '' + let g:ctrlp_cmd = 'CtrlP' + ``` + +* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable: + + ```vim + let g:ctrlp_working_path_mode = 'ra' + ``` + + `'c'` - the directory of the current file. + `'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs` + `'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file. + `0` or `''` (empty string) - disable this feature. + + Define additional root markers with the `g:ctrlp_root_markers` option. + +* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`: + + ```vim + set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux + set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows + + let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' + let g:ctrlp_custom_ignore = { + \ 'dir': '\v[\/]\.(git|hg|svn)$', + \ 'file': '\v\.(exe|so|dll)$', + \ 'link': 'some_bad_symbolic_links', + \ } + ``` + +* Use a custom file listing command: + + ```vim + let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux + let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows + ``` + +Check `:help ctrlp-options` for other options. + +## Installation +Use your favorite method or check the homepage for a [quick installation guide][3]. + +[1]: http://i.imgur.com/yIynr.png +[2]: https://github.com/kien/ctrlp.vim/tree/extensions +[3]: http://kien.github.com/ctrlp.vim#installation diff --git a/vim-plugins/bundle/emmet-vim/Makefile b/vim-plugins/bundle/emmet-vim/Makefile new file mode 100644 index 0000000..1c06023 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/Makefile @@ -0,0 +1,11 @@ +all : emmet-vim.zip + +remove-zip: + -rm doc/tags + -rm emmet-vim.zip + +emmet-vim.zip: remove-zip + zip -r emmet-vim.zip autoload plugin doc + +release: emmet-vim.zip + vimup update-script emmet.vim diff --git a/vim-plugins/bundle/emmet-vim/README.mkd b/vim-plugins/bundle/emmet-vim/README.mkd new file mode 100644 index 0000000..8bb52b2 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/README.mkd @@ -0,0 +1,149 @@ +# Emmet-vim + +[emmet-vim](http://mattn.github.com/emmet-vim) is a vim plug-in +which provides support for expanding abbreviations similar to +[emmet](http://emmet.io/). + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mattn/emmet-vim/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + +![](https://raw.githubusercontent.com/mattn/emmet-vim/master/doc/screenshot.gif) + +## Installation + +[Download zip file](http://www.vim.org/scripts/script.php?script_id=2981): + + cd ~/.vim + unzip emmet-vim.zip + +To install using pathogen.vim: + + cd ~/.vim/bundle + git clone https://github.com/mattn/emmet-vim.git + +To install using [Vundle](https://github.com/gmarik/vundle): + + " add this line to your .vimrc file + Plugin 'mattn/emmet-vim' + +To checkout the source from repository: + + cd ~/.vim/bundle + git clone https://github.com/mattn/emmet-vim.git + +or: + + git clone https://github.com/mattn/emmet-vim.git + cd emmet-vim + cp plugin/emmet.vim ~/.vim/plugin/ + cp autoload/emmet.vim ~/.vim/autoload/ + cp -a autoload/emmet ~/.vim/autoload/ + + +## Quick Tutorial + +Open or create a New File: + + vim index.html + +Type ("\_" is the cursor position): + + html:5_ + +Then type `,` (Ctrly,), and you should see: + +```html + + + + + + + + _ + + +``` + +[More Tutorials](https://raw.github.com/mattn/emmet-vim/master/TUTORIAL) + + +## Enable in different mode + +If you don't want to enable emmet in all modes, +you can use set these options in `vimrc`: + +```vim +let g:user_emmet_mode='n' "only enable normal mode functions. +let g:user_emmet_mode='inv' "enable all functions, which is equal to +let g:user_emmet_mode='a' "enable all function in all mode. +``` + +## Enable just for html/css + +```vim +let g:user_emmet_install_global = 0 +autocmd FileType html,css EmmetInstall +``` + +## Redefine trigger key +To remap the default `` leader: + +```vim +let g:user_emmet_leader_key='' +``` + +Note that the trailing `,` still needs to be entered, so the new keymap would be `,`. + +## Adding custom snippets +If you have installed the [web-api](https://github.com/mattn/webapi-vim) for **emmet-vim** you can also add your own snippets using a custom **snippets.json** file. + +Once you have installed the [web-api](https://github.com/mattn/webapi-vim) add this line to your **.vimrc**: +``` +let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets_custom.json')), "\n")) +``` +You can change the **path** to your **snippets_custom.json** according to your preferences. + +[Here](http://docs.emmet.io/customization/snippets/) you can find instructions about creating your customized **snippets.json** file. + +## Project Authors + +[Yasuhiro Matsumoto](http://mattn.kaoriya.net/) + +## Links + +### Emmet official site: + +* + +### zen-coding official site: + +* + +### emmet.vim: + +* + +### development repository: + +* + +### my blog posts about zencoding-vim: + +* + +* + +### Japanese blog posts about zencoding-vim: + +* + +* + +* + +* + +### A Chinese translation of the tutorial: + +* + diff --git a/vim-plugins/bundle/emmet-vim/TODO b/vim-plugins/bundle/emmet-vim/TODO new file mode 100644 index 0000000..e69de29 diff --git a/vim-plugins/bundle/emmet-vim/TUTORIAL b/vim-plugins/bundle/emmet-vim/TUTORIAL new file mode 100644 index 0000000..7d4ba61 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/TUTORIAL @@ -0,0 +1,212 @@ +Tutorial for Emmet.vim + + mattn + +1. Expand an Abbreviation + + Type the abbreviation as 'div>p#foo$*3>a' and type ','. + --------------------- +
+

+ +

+

+ +

+

+ +

+
+ --------------------- + +2. Wrap with an Abbreviation + + Write as below. + --------------------- + test1 + test2 + test3 + --------------------- + Then do visual select(line wise) and type ','. + Once you get to the 'Tag:' prompt, type 'ul>li*'. + --------------------- +
    +
  • test1
  • +
  • test2
  • +
  • test3
  • +
+ --------------------- + + If you type a tag, such as 'blockquote', then you'll see the following: + --------------------- +
+ test1 + test2 + test3 +
+ --------------------- + +3. Balance a Tag Inward + + type 'd' in insert mode. + +4. Balance a Tag Outward + + type 'D' in insert mode. + +5. Go to the Next Edit Point + + type 'n' in insert mode. + +6. Go to the Previous Edit Point + + type 'N' in insert mode. + +7. Update an ’s Size + + Move cursor to the img tag. + --------------------- + + --------------------- + Type 'i' on img tag + --------------------- + + --------------------- + +8. Merge Lines + + select the lines, which include '
  • ' + --------------------- +
      +
    • +
    • +
    • +
    + --------------------- + and then type 'm' + --------------------- +
      +
    • +
    + --------------------- + +9. Remove a Tag + + Move cursor in block + --------------------- + + --------------------- + Type 'k' in insert mode. + --------------------- +
    + +
    + --------------------- + + And type 'k' in there again. + --------------------- + + --------------------- + +10. Split/Join Tag + + Move the cursor inside block + --------------------- +
    + cursor is here +
    + --------------------- + Type 'j' in insert mode. + --------------------- +
    + --------------------- + + And then type 'j' in there again. + --------------------- +
    +
    + --------------------- + +11. Toggle Comment + + Move cursor inside the block + --------------------- +
    + hello world +
    + --------------------- + Type '/' in insert mode. + --------------------- + + --------------------- + Type '/' in there again. + --------------------- +
    + hello world +
    + --------------------- + +12. Make an anchor from a URL + + Move cursor to URL + --------------------- + http://www.google.com/ + --------------------- + Type 'a' + --------------------- + Google + --------------------- + +13. Make some quoted text from a URL + + Move cursor to the URL + --------------------- + http://github.com/ + --------------------- + Type 'A' + --------------------- +
    + Secure source code hosting and collaborative development - GitHub
    +

    How does it work? Get up and running in seconds by forking a project, pushing an existing repository...

    + http://github.com/ +
    + --------------------- + +14. Installing emmet.vim for the language you are using: + + # cd ~/.vim + # unzip emmet-vim.zip + + Or if you are using pathogen.vim: + + # cd ~/.vim/bundle # or make directory + # unzip /path/to/emmet-vim.zip + + Or if you get the sources from the repository: + + # cd ~/.vim/bundle # or make directory + # git clone http://github.com/mattn/emmet-vim.git + +15. Enable emmet.vim for the language you using. + + You can customize the behavior of the languages you are using. + + --------------------- + # cat >> ~/.vimrc + let g:user_emmet_settings = { + \ 'php' : { + \ 'extends' : 'html', + \ 'filters' : 'c', + \ }, + \ 'xml' : { + \ 'extends' : 'html', + \ }, + \ 'haml' : { + \ 'extends' : 'html', + \ }, + \} + --------------------- diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet.vim new file mode 100644 index 0000000..e344486 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet.vim @@ -0,0 +1,2033 @@ +"============================================================================= +" emmet.vim +" Author: Yasuhiro Matsumoto +" Last Change: 26-Jul-2015. + +let s:save_cpo = &cpoptions +set cpoptions&vim + +let s:filtermx = '|\(\%(bem\|html\|haml\|slim\|e\|c\|s\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$' + +function! emmet#getExpandos(type, key) abort + let expandos = emmet#getResource(a:type, 'expandos', {}) + if has_key(expandos, a:key) + return expandos[a:key] + endif + return a:key +endfunction + +function! emmet#splitFilterArg(filters) abort + for f in a:filters + if f =~# '^/' + return f[1:] + endif + endfor + return '' +endfunction + +function! emmet#useFilter(filters, filter) abort + for f in a:filters + if a:filter ==# '/' && f =~# '^/' + return 1 + elseif f ==# a:filter + return 1 + endif + endfor + return 0 +endfunction + +function! emmet#getIndentation(...) abort + if a:0 > 0 + let type = a:1 + else + let type = emmet#getFileType() + endif + if has_key(s:emmet_settings, type) && has_key(s:emmet_settings[type], 'indentation') + let indent = s:emmet_settings[type].indentation + elseif has_key(s:emmet_settings, 'indentation') + let indent = s:emmet_settings.indentation + elseif has_key(s:emmet_settings.variables, 'indentation') + let indent = s:emmet_settings.variables.indentation + else + let sw = exists('*shiftwidth') ? shiftwidth() : &l:shiftwidth + let indent = (&l:expandtab || &l:tabstop !=# sw) ? repeat(' ', sw) : "\t" + endif + return indent +endfunction + +function! emmet#getBaseType(type) abort + if !has_key(s:emmet_settings, a:type) + return '' + endif + if !has_key(s:emmet_settings[a:type], 'extends') + return a:type + endif + let extends = s:emmet_settings[a:type].extends + if type(extends) ==# 1 + let tmp = split(extends, '\s*,\s*') + let ext = tmp[0] + else + let ext = extends[0] + endif + if a:type !=# ext + return emmet#getBaseType(ext) + endif + return '' +endfunction + +function! emmet#isExtends(type, extend) abort + if a:type ==# a:extend + return 1 + endif + if !has_key(s:emmet_settings, a:type) + return 0 + endif + if !has_key(s:emmet_settings[a:type], 'extends') + return 0 + endif + let extends = s:emmet_settings[a:type].extends + if type(extends) ==# 1 + let tmp = split(extends, '\s*,\s*') + unlet! extends + let extends = tmp + endif + for ext in extends + if a:extend ==# ext + return 1 + endif + endfor + return 0 +endfunction + +function! emmet#parseIntoTree(abbr, type) abort + let abbr = a:abbr + let type = a:type + return emmet#lang#{emmet#lang#type(type)}#parseIntoTree(abbr, type) +endfunction + +function! emmet#expandAbbrIntelligent(feedkey) abort + if !emmet#isExpandable() + return a:feedkey + endif + return "\(emmet-expand-abbr)" +endfunction + +function! emmet#isExpandable() abort + let line = getline('.') + if col('.') < len(line) + let line = matchstr(line, '^\(.*\%'.col('.').'c\)') + endif + let part = matchstr(line, '\(\S.*\)$') + let type = emmet#getFileType() + let ftype = emmet#lang#exists(type) ? type : 'html' + let part = emmet#lang#{ftype}#findTokens(part) + return len(part) > 0 +endfunction + +function! emmet#mergeConfig(lhs, rhs) abort + let [lhs, rhs] = [a:lhs, a:rhs] + if type(lhs) ==# 3 + if type(rhs) ==# 3 + let lhs += rhs + if len(lhs) + call remove(lhs, 0, len(lhs)-1) + endif + for rhi in rhs + call add(lhs, rhs[rhi]) + endfor + elseif type(rhs) ==# 4 + let lhs += map(keys(rhs), '{v:val : rhs[v:val]}') + endif + elseif type(lhs) ==# 4 + if type(rhs) ==# 3 + for V in rhs + if type(V) != 4 + continue + endif + for k in keys(V) + let lhs[k] = V[k] + endfor + endfor + elseif type(rhs) ==# 4 + for key in keys(rhs) + if type(rhs[key]) ==# 3 + if !has_key(lhs, key) + let lhs[key] = [] + endif + if type(lhs[key]) == 3 + let lhs[key] += rhs[key] + elseif type(lhs[key]) == 4 + for k in keys(rhs[key]) + let lhs[key][k] = rhs[key][k] + endfor + endif + elseif type(rhs[key]) ==# 4 + if has_key(lhs, key) + call emmet#mergeConfig(lhs[key], rhs[key]) + else + let lhs[key] = rhs[key] + endif + else + let lhs[key] = rhs[key] + endif + endfor + endif + endif +endfunction + +function! emmet#newNode() abort + return { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'basevalue': 0, 'basedirect': 1, 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0, 'attrs_order': ['id', 'class'], 'block': 0, 'empty': 0 } +endfunction + +function! s:itemno(itemno, current) abort + let current = a:current + if current.basedirect > 0 + if current.basevalue ==# 0 + return a:itemno + else + return current.basevalue - 1 + a:itemno + endif + else + if current.basevalue ==# 0 + return current.multiplier - 1 - a:itemno + else + return current.multiplier + current.basevalue - 2 - a:itemno + endif + endif +endfunction + +function! emmet#toString(...) abort + let current = a:1 + if a:0 > 1 + let type = a:2 + else + let type = &filetype + endif + if len(type) ==# 0 | let type = 'html' | endif + if a:0 > 2 + let inline = a:3 + else + let inline = 0 + endif + if a:0 > 3 + if type(a:4) ==# 1 + let filters = split(a:4, '\s*,\s*') + else + let filters = a:4 + endif + else + let filters = ['html'] + endif + if a:0 > 4 + let group_itemno = a:5 + else + let group_itemno = 0 + endif + if a:0 > 5 + let indent = a:6 + else + let indent = '' + endif + + let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) + let itemno = 0 + let str = '' + let rtype = emmet#lang#type(type) + while itemno < current.multiplier + if len(current.name) + if current.multiplier ==# 1 + let inner = emmet#lang#{rtype}#toString(s:emmet_settings, current, type, inline, filters, s:itemno(group_itemno, current), indent) + else + let inner = emmet#lang#{rtype}#toString(s:emmet_settings, current, type, inline, filters, s:itemno(itemno, current), indent) + endif + if current.multiplier > 1 + let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g') + endif + let str .= inner + else + let snippet = current.snippet + if len(snippet) ==# 0 + let snippets = emmet#getResource(type, 'snippets', {}) + if !empty(snippets) && has_key(snippets, 'emmet_snippet') + let snippet = snippets['emmet_snippet'] + endif + endif + if len(snippet) > 0 + let tmp = snippet + let tmp = substitute(tmp, '\${emmet_name}', current.name, 'g') + let snippet_node = emmet#newNode() + let snippet_node.value = '{'.tmp.'}' + let snippet_node.important = current.important + let snippet_node.multiplier = current.multiplier + let str .= emmet#lang#{rtype}#toString(s:emmet_settings, snippet_node, type, inline, filters, s:itemno(group_itemno, current), indent) + if current.multiplier > 1 + let str .= "\n" + endif + else + if len(current.name) + let str .= current.name + endif + if len(current.value) + let text = current.value[1:-2] + if dollar_expr + " TODO: regexp engine specified + if exists('®expengine') + let text = substitute(text, '\%#=1\%(\\\)\@\ 0 + let key = get(matcharr, 1) + if key !~# '^\d\+:' + let key = substitute(key, '\\{', '{', 'g') + let key = substitute(key, '\\}', '}', 'g') + let value = emmet#getDollarValueByKey(key) + if type(value) ==# type('') + let expr = get(matcharr, 0) + call add(dollar_list, {'expr': expr, 'value': value}) + endif + endif + else + break + endif + let expand = substitute(expand, dollar_reg, '', '') + endwhile + return dollar_list +endfunction + +function! emmet#getDollarValueByKey(key) abort + let ret = 0 + let key = a:key + let ftsetting = get(s:emmet_settings, emmet#getFileType()) + if type(ftsetting) ==# 4 && has_key(ftsetting, key) + let V = get(ftsetting, key) + if type(V) ==# 1 | return V | endif + endif + if type(ret) !=# 1 && has_key(s:emmet_settings.variables, key) + let V = get(s:emmet_settings.variables, key) + if type(V) ==# 1 | return V | endif + endif + if has_key(s:emmet_settings, 'custom_expands') && type(s:emmet_settings['custom_expands']) ==# 4 + for k in keys(s:emmet_settings['custom_expands']) + if key =~# k + let V = get(s:emmet_settings['custom_expands'], k) + if type(V) ==# 1 | return V | endif + if type(V) ==# 2 | return V(key) | endif + endif + endfor + endif + return ret +endfunction + +function! emmet#reExpandDollarExpr(expand, times) abort + let expand = a:expand + let dollar_exprs = emmet#getDollarExprs(expand) + if len(dollar_exprs) > 0 + if a:times < 9 + for n in range(len(dollar_exprs)) + let pair = get(dollar_exprs, n) + let pat = get(pair, 'expr') + let sub = get(pair, 'value') + let expand = substitute(expand, pat, sub, '') + endfor + return emmet#reExpandDollarExpr(expand, a:times + 1) + endif + endif + return expand +endfunction + +function! emmet#expandDollarExpr(expand) abort + return emmet#reExpandDollarExpr(a:expand, 0) +endfunction + +function! emmet#expandCursorExpr(expand, mode) abort + let expand = a:expand + if expand !~# '\${cursor}' + if a:mode ==# 2 + let expand = '${cursor}' . expand + else + let expand .= '${cursor}' + endif + endif + let expand = substitute(expand, '\${\d\+:\?\([^}]\+\)}', '$select$$cursor$\1$select$', 'g') + let expand = substitute(expand, '\${\d\+}', '$select$$cursor$$select$', 'g') + let expand = substitute(expand, '\${cursor}', '$cursor$', '') + let expand = substitute(expand, '\${cursor}', '', 'g') + let expand = substitute(expand, '\${cursor}', '', 'g') + return expand +endfunction + +function! emmet#unescapeDollarExpr(expand) abort + return substitute(a:expand, '\\\$', '$', 'g') +endfunction + +function! emmet#expandAbbr(mode, abbr) range abort + let type = emmet#getFileType() + let rtype = emmet#lang#type(emmet#getFileType(1)) + let indent = emmet#getIndentation(type) + let expand = '' + let line = '' + let part = '' + let rest = '' + + let filters = emmet#getFilters(type) + if len(filters) ==# 0 + let filters = ['html'] + endif + + if a:mode ==# 2 + let leader = substitute(input('Tag: ', ''), '^\s*\(.*\)\s*$', '\1', 'g') + if len(leader) ==# 0 + return '' + endif + if leader =~# s:filtermx + let filters = map(split(matchstr(leader, s:filtermx)[1:], '\s*[^\\]\zs,\s*'), 'substitute(v:val, "\\\\\\\\zs.\\\\ze", "&", "g")') + let leader = substitute(leader, s:filtermx, '', '') + endif + if leader =~# '\*' + let query = substitute(leader, '*', '*' . (a:lastline - a:firstline + 1), '') + if query !~# '}\s*$' && query !~# '\$#' + let query .= '>{$#}' + endif + if emmet#useFilter(filters, '/') + let spl = emmet#splitFilterArg(filters) + let fline = getline(a:firstline) + let query = substitute(query, '>\{0,1}{\$#}\s*$', '{\\$column\\$}*' . len(split(fline, spl)), '') + else + let spl = '' + endif + let items = emmet#parseIntoTree(query, type).child + let itemno = 0 + for item in items + let inner = emmet#toString(item, type, 0, filters, 0, indent) + let inner = substitute(inner, '\$#', '$line'.(itemno*(a:lastline - a:firstline + 1)/len(items)+1).'$', 'g') + let expand .= inner + let itemno = itemno + 1 + endfor + if emmet#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + let line = getline(a:firstline) + let part = substitute(line, '^\s*', '', '') + for n in range(a:firstline, a:lastline) + let lline = getline(n) + let lpart = substitute(lline, '^\s\+', '', '') + if emmet#useFilter(filters, 't') + let lpart = substitute(lpart, '^[0-9.-]\+\s\+', '', '') + let lpart = substitute(lpart, '\s\+$', '', '') + endif + if emmet#useFilter(filters, '/') + for column in split(lpart, spl) + let expand = substitute(expand, '\$column\$', '\=column', '') + endfor + else + let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', '\=lpart', 'g') + endif + endfor + let expand = substitute(expand, '\$line\d*\$', '', 'g') + let expand = substitute(expand, '\$column\$', '', 'g') + let content = join(getline(a:firstline, a:lastline), "\n") + if stridx(expand, '$#') < len(expand)-2 + let expand = substitute(expand, '^\(.*\)\$#\s*$', '\1', '') + endif + let expand = substitute(expand, '\$#', '\=content', 'g') + else + let str = '' + if visualmode() ==# 'V' + let line = getline(a:firstline) + let lspaces = matchstr(line, '^\s*', '', '') + let part = substitute(line, '^\s*', '', '') + for n in range(a:firstline, a:lastline) + if len(leader) > 0 + let line = getline(a:firstline) + let spaces = matchstr(line, '^\s*', '', '') + if len(spaces) >= len(lspaces) + let str .= indent . getline(n)[len(lspaces):] . "\n" + else + let str .= getline(n) . "\n" + endif + else + let lpart = substitute(getline(n), '^\s*', '', '') + let str .= lpart . "\n" + endif + endfor + if stridx(leader, '{$#}') ==# -1 + let leader .= '{$#}' + endif + let items = emmet#parseIntoTree(leader, type).child + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvygv + let str = @" + call setreg('"', save_regcont, save_regtype) + if stridx(leader, '{$#}') ==# -1 + let leader .= '{$#}' + endif + let items = emmet#parseIntoTree(leader, type).child + endif + for item in items + let expand .= emmet#toString(item, type, 0, filters, 0, '') + endfor + if emmet#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + if stridx(leader, '{$#}') !=# -1 + let expand = substitute(expand, '\$#', '\="\n" . str', 'g') + endif + endif + elseif a:mode ==# 4 + let line = getline('.') + let spaces = matchstr(line, '^\s*') + if line !~# '^\s*$' + put =spaces.a:abbr + else + call setline('.', spaces.a:abbr) + endif + normal! $ + call emmet#expandAbbr(0, '') + return '' + else + let line = getline('.') + if col('.') < len(line) + let line = matchstr(line, '^\(.*\%'.col('.').'c\)') + endif + if a:mode ==# 1 + let part = matchstr(line, '\([a-zA-Z0-9:_\-\@|]\+\)$') + else + let part = matchstr(line, '\(\S.*\)$') + let ftype = emmet#lang#exists(type) ? type : 'html' + let part = emmet#lang#{ftype}#findTokens(part) + let line = line[0: strridx(line, part) + len(part) - 1] + endif + if col('.') ==# col('$') + let rest = '' + else + let rest = getline('.')[len(line):] + endif + let str = part + if str =~# s:filtermx + let filters = split(matchstr(str, s:filtermx)[1:], '\s*,\s*') + let str = substitute(str, s:filtermx, '', '') + endif + let items = emmet#parseIntoTree(str, type).child + for item in items + let expand .= emmet#toString(item, type, 0, filters, 0, indent) + endfor + if emmet#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g') + endif + let expand = emmet#expandDollarExpr(expand) + let expand = emmet#expandCursorExpr(expand, a:mode) + if len(expand) + if has_key(s:emmet_settings, 'timezone') && len(s:emmet_settings.timezone) + let expand = substitute(expand, '${datetime}', strftime('%Y-%m-%dT%H:%M:%S') . s:emmet_settings.timezone, 'g') + else + " TODO: on windows, %z/%Z is 'Tokyo(Standard)' + let expand = substitute(expand, '${datetime}', strftime('%Y-%m-%dT%H:%M:%S %z'), 'g') + endif + let expand = emmet#unescapeDollarExpr(expand) + if a:mode ==# 2 && visualmode() ==# 'v' + if a:firstline ==# a:lastline + let expand = substitute(expand, '[\r\n]\s*', '', 'g') + else + let expand = substitute(expand, '[\n]$', '', 'g') + endif + silent! normal! gv + let col = col('''<') + silent! normal! c + let line = getline('.') + let lhs = matchstr(line, '.*\%<'.col.'c.') + let rhs = matchstr(line, '\%>'.(col-1).'c.*') + let expand = lhs.expand.rhs + let lines = split(expand, '\n') + call setline(line('.'), lines[0]) + if len(lines) > 1 + call append(line('.'), lines[1:]) + endif + else + if line[:-len(part)-1] =~# '^\s\+$' + let indent = line[:-len(part)-1] + else + let indent = '' + endif + let expand = substitute(expand, '[\r\n]\s*$', '', 'g') + if emmet#useFilter(filters, 's') + let epart = substitute(expand, '[\r\n]\s*', '', 'g') + else + let epart = substitute(expand, '[\r\n]', "\n" . indent, 'g') + endif + let expand = line[:-len(part)-1] . epart . rest + let lines = split(expand, '[\r\n]', 1) + if a:mode ==# 2 + silent! exe 'normal! gvc' + endif + call setline('.', lines[0]) + if len(lines) > 1 + call append('.', lines[1:]) + endif + endif + endif + if g:emmet_debug > 1 + call getchar() + endif + if search('\ze\$\(cursor\|select\)\$', 'c') + let oldselection = &selection + let &selection = 'inclusive' + if foldclosed(line('.')) !=# -1 + silent! foldopen + endif + let pos = emmet#util#getcurpos() + let use_selection = emmet#getResource(type, 'use_selection', 0) + try + let l:gdefault = &gdefault + let &gdefault = 0 + if use_selection && getline('.')[col('.')-1:] =~# '^\$select' + let pos[2] += 1 + silent! s/\$select\$// + let next = searchpos('.\ze\$select\$', 'nW') + silent! %s/\$\(cursor\|select\)\$//g + call emmet#util#selectRegion([pos[1:2], next]) + return "\gv" + else + silent! %s/\$\(cursor\|select\)\$//g + silent! call setpos('.', pos) + if col('.') < col('$') + return "\" + endif + endif + finally + let &gdefault = l:gdefault + endtry + let &selection = oldselection + endif + return '' +endfunction + +function! emmet#updateTag() abort + let type = emmet#getFileType() + let region = emmet#util#searchRegion('<\S', '>') + if !emmet#util#regionIsValid(region) || !emmet#util#cursorInRegion(region) + return '' + endif + let content = emmet#util#getContent(region) + let content = matchstr(content, '^<[^><]\+>') + if content !~# '^<[^><]\+>$' + return '' + endif + let current = emmet#lang#html#parseTag(content) + if empty(current) + return '' + endif + + let str = substitute(input('Enter Abbreviation: ', ''), '^\s*\(.*\)\s*$', '\1', 'g') + let item = emmet#parseIntoTree(str, type).child[0] + for k in keys(item.attr) + let current.attr[k] = item.attr[k] + endfor + let html = substitute(emmet#toString(current, 'html', 1), '\n', '', '') + let html = substitute(html, '\${cursor}', '', '') + let html = matchstr(html, '^<[^><]\+>') + call emmet#util#setContent(region, html) + return '' +endfunction + +function! emmet#moveNextPrevItem(flag) abort + let type = emmet#getFileType() + return emmet#lang#{emmet#lang#type(type)}#moveNextPrevItem(a:flag) +endfunction + +function! emmet#moveNextPrev(flag) abort + let type = emmet#getFileType() + return emmet#lang#{emmet#lang#type(type)}#moveNextPrev(a:flag) +endfunction + +function! emmet#imageSize() abort + let orgpos = emmet#util#getcurpos() + let type = emmet#getFileType() + call emmet#lang#{emmet#lang#type(type)}#imageSize() + silent! call setpos('.', orgpos) + return '' +endfunction + +function! emmet#encodeImage() abort + let type = emmet#getFileType() + return emmet#lang#{emmet#lang#type(type)}#encodeImage() +endfunction + +function! emmet#toggleComment() abort + let type = emmet#getFileType() + call emmet#lang#{emmet#lang#type(type)}#toggleComment() + return '' +endfunction + +function! emmet#balanceTag(flag) range abort + let type = emmet#getFileType() + return emmet#lang#{emmet#lang#type(type)}#balanceTag(a:flag) +endfunction + +function! emmet#splitJoinTag() abort + let type = emmet#getFileType() + return emmet#lang#{emmet#lang#type(type)}#splitJoinTag() +endfunction + +function! emmet#mergeLines() range abort + let lines = join(map(getline(a:firstline, a:lastline), 'matchstr(v:val, "^\\s*\\zs.*\\ze\\s*$")'), '') + let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '') + silent! exe 'normal! gvc' + call setline('.', indent . lines) +endfunction + +function! emmet#removeTag() abort + let type = emmet#getFileType() + call emmet#lang#{emmet#lang#type(type)}#removeTag() + return '' +endfunction + +function! emmet#anchorizeURL(flag) abort + let mx = 'https\=:\/\/[-!#$%&*+,./:;=?@0-9a-zA-Z_~]\+' + let pos1 = searchpos(mx, 'bcnW') + let url = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let block = [pos1, [pos1[0], pos1[1] + len(url) - 1]] + if !emmet#util#cursorInRegion(block) + return '' + endif + + let mx = '.*]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*' + let content = emmet#util#getContentFromURL(url) + let content = substitute(content, '\r', '', 'g') + let content = substitute(content, '[ \n]\+', ' ', 'g') + let content = substitute(content, '', '', 'g') + let title = matchstr(content, mx) + + let type = emmet#getFileType() + let rtype = emmet#lang#type(type) + if &filetype ==# 'markdown' + let expand = printf('[%s](%s)', substitute(title, '[\[\]]', '\\&', 'g'), url) + elseif a:flag ==# 0 + let a = emmet#lang#html#parseTag('') + let a.attr.href = url + let a.value = '{' . title . '}' + let expand = emmet#toString(a, rtype, 0, []) + let expand = substitute(expand, '\${cursor}', '', 'g') + else + let body = emmet#util#getTextFromHTML(content) + let body = '{' . substitute(body, '^\(.\{0,100}\).*', '\1', '') . '...}' + + let blockquote = emmet#lang#html#parseTag('
    ') + let a = emmet#lang#html#parseTag('') + let a.attr.href = url + let a.value = '{' . title . '}' + call add(blockquote.child, a) + call add(blockquote.child, emmet#lang#html#parseTag('
    ')) + let p = emmet#lang#html#parseTag('

    ') + let p.value = body + call add(blockquote.child, p) + let cite = emmet#lang#html#parseTag('') + let cite.value = '{' . url . '}' + call add(blockquote.child, cite) + let expand = emmet#toString(blockquote, rtype, 0, []) + let expand = substitute(expand, '\${cursor}', '', 'g') + endif + let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '') + let expand = substitute(expand, "\n", "\n" . indent, 'g') + call emmet#util#setContent(block, expand) + return '' +endfunction + +function! emmet#codePretty() range abort + let type = input('FileType: ', &filetype, 'filetype') + if len(type) ==# 0 + return + endif + let block = emmet#util#getVisualBlock() + let content = emmet#util#getContent(block) + silent! 1new + let &l:filetype = type + call setline(1, split(content, "\n")) + let old_lazyredraw = &lazyredraw + set lazyredraw + silent! TOhtml + let &lazyredraw = old_lazyredraw + let content = join(getline(1, '$'), "\n") + silent! bw! + silent! bw! + let content = matchstr(content, ']*>[\s\n]*\zs.*\ze') + call emmet#util#setContent(block, content) +endfunction + +function! emmet#expandWord(abbr, type, orig) abort + let str = a:abbr + let type = a:type + let indent = emmet#getIndentation(type) + + if len(type) ==# 0 | let type = 'html' | endif + if str =~# s:filtermx + let filters = split(matchstr(str, s:filtermx)[1:], '\s*,\s*') + let str = substitute(str, s:filtermx, '', '') + else + let filters = emmet#getFilters(a:type) + if len(filters) ==# 0 + let filters = ['html'] + endif + endif + let str = substitute(str, '|', '${cursor}', 'g') + let items = emmet#parseIntoTree(str, a:type).child + let expand = '' + for item in items + let expand .= emmet#toString(item, a:type, 0, filters, 0, indent) + endfor + if emmet#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + if emmet#useFilter(filters, 's') + let expand = substitute(expand, "\n\s\*", '', 'g') + endif + if a:orig ==# 0 + let expand = emmet#expandDollarExpr(expand) + let expand = substitute(expand, '\${cursor}', '', 'g') + endif + return expand +endfunction + +function! emmet#getSnippets(type) abort + let type = a:type + if len(type) ==# 0 || !has_key(s:emmet_settings, type) + let type = 'html' + endif + return emmet#getResource(type, 'snippets', {}) +endfunction + +function! emmet#completeTag(findstart, base) abort + if a:findstart + let line = getline('.') + let start = col('.') - 1 + while start > 0 && line[start - 1] =~# '[a-zA-Z0-9:_\@\-]' + let start -= 1 + endwhile + return start + else + let type = emmet#getFileType() + let res = [] + + let snippets = emmet#getResource(type, 'snippets', {}) + for item in keys(snippets) + if stridx(item, a:base) !=# -1 + call add(res, substitute(item, '\${cursor}\||', '', 'g')) + endif + endfor + let aliases = emmet#getResource(type, 'aliases', {}) + for item in values(aliases) + if stridx(item, a:base) !=# -1 + call add(res, substitute(item, '\${cursor}\||', '', 'g')) + endif + endfor + return res + endif +endfunction + +unlet! s:emmet_settings +let s:emmet_settings = { +\ 'variables': { +\ 'lang': "en", +\ 'locale': "en-US", +\ 'charset': "UTF-8", +\ 'newline': "\n", +\ 'use_selection': 0, +\ }, +\ 'custom_expands' : { +\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#en#expand'), +\ }, +\ 'css': { +\ 'snippets': { +\ "@i": "@import url(|);", +\ "@import": "@import url(|);", +\ "@m": "@media ${1:screen} {\n\t|\n}", +\ "@media": "@media ${1:screen} {\n\t|\n}", +\ "@f": "@font-face {\n\tfont-family:|;\n\tsrc:url(|);\n}", +\ "@f+": "@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}", +\ "@kf": "@-webkit-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-o-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@-moz-keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}\n@keyframes ${1:identifier} {\n\t${2:from} { ${3} }${6}\n\t${4:to} { ${5} }\n}", +\ "anim": "animation:|;", +\ "anim-": "animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode};", +\ "animdel": "animation-delay:${1:time};", +\ "animdir": "animation-direction:${1:normal};", +\ "animdir:n": "animation-direction:normal;", +\ "animdir:r": "animation-direction:reverse;", +\ "animdir:a": "animation-direction:alternate;", +\ "animdir:ar": "animation-direction:alternate-reverse;", +\ "animdur": "animation-duration:${1:0}s;", +\ "animfm": "animation-fill-mode:${1:both};", +\ "animfm:f": "animation-fill-mode:forwards;", +\ "animfm:b": "animation-fill-mode:backwards;", +\ "animfm:bt": "animation-fill-mode:both;", +\ "animfm:bh": "animation-fill-mode:both;", +\ "animic": "animation-iteration-count:${1:1};", +\ "animic:i": "animation-iteration-count:infinite;", +\ "animn": "animation-name:${1:none};", +\ "animps": "animation-play-state:${1:running};", +\ "animps:p": "animation-play-state:paused;", +\ "animps:r": "animation-play-state:running;", +\ "animtf": "animation-timing-function:${1:linear};", +\ "animtf:e": "animation-timing-function:ease;", +\ "animtf:ei": "animation-timing-function:ease-in;", +\ "animtf:eo": "animation-timing-function:ease-out;", +\ "animtf:eio": "animation-timing-function:ease-in-out;", +\ "animtf:l": "animation-timing-function:linear;", +\ "animtf:cb": "animation-timing-function:cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1});", +\ "ap": "appearance:${none};", +\ "!": "!important", +\ "pos": "position:${1:relative};", +\ "pos:s": "position:static;", +\ "pos:a": "position:absolute;", +\ "pos:r": "position:relative;", +\ "pos:f": "position:fixed;", +\ "t": "top:|;", +\ "t:a": "top:auto;", +\ "r": "right:|;", +\ "r:a": "right:auto;", +\ "b": "bottom:|;", +\ "b:a": "bottom:auto;", +\ "l": "left:|;", +\ "l:a": "left:auto;", +\ "z": "z-index:|;", +\ "z:a": "z-index:auto;", +\ "fl": "float:${1:left};", +\ "fl:n": "float:none;", +\ "fl:l": "float:left;", +\ "fl:r": "float:right;", +\ "cl": "clear:${1:both};", +\ "cl:n": "clear:none;", +\ "cl:l": "clear:left;", +\ "cl:r": "clear:right;", +\ "cl:b": "clear:both;", +\ "colm": "columns:|;", +\ "colmc": "column-count:|;", +\ "colmf": "column-fill:|;", +\ "colmg": "column-gap:|;", +\ "colmr": "column-rule:|;", +\ "colmrc": "column-rule-color:|;", +\ "colmrs": "column-rule-style:|;", +\ "colmrw": "column-rule-width:|;", +\ "colms": "column-span:|;", +\ "colmw": "column-width:|;", +\ "d": "display:${1:block};", +\ "d:n": "display:none;", +\ "d:b": "display:block;", +\ "d:f": "display:flex;", +\ "d:if": "display:inline-flex;", +\ "d:i": "display:inline;", +\ "d:ib": "display:inline-block;", +\ "d:ib+": "display: inline-block;\n*display: inline;\n*zoom: 1;", +\ "d:li": "display:list-item;", +\ "d:ri": "display:run-in;", +\ "d:cp": "display:compact;", +\ "d:tb": "display:table;", +\ "d:itb": "display:inline-table;", +\ "d:tbcp": "display:table-caption;", +\ "d:tbcl": "display:table-column;", +\ "d:tbclg": "display:table-column-group;", +\ "d:tbhg": "display:table-header-group;", +\ "d:tbfg": "display:table-footer-group;", +\ "d:tbr": "display:table-row;", +\ "d:tbrg": "display:table-row-group;", +\ "d:tbc": "display:table-cell;", +\ "d:rb": "display:ruby;", +\ "d:rbb": "display:ruby-base;", +\ "d:rbbg": "display:ruby-base-group;", +\ "d:rbt": "display:ruby-text;", +\ "d:rbtg": "display:ruby-text-group;", +\ "v": "visibility:${1:hidden};", +\ "v:v": "visibility:visible;", +\ "v:h": "visibility:hidden;", +\ "v:c": "visibility:collapse;", +\ "ov": "overflow:${1:hidden};", +\ "ov:v": "overflow:visible;", +\ "ov:h": "overflow:hidden;", +\ "ov:s": "overflow:scroll;", +\ "ov:a": "overflow:auto;", +\ "ovx": "overflow-x:${1:hidden};", +\ "ovx:v": "overflow-x:visible;", +\ "ovx:h": "overflow-x:hidden;", +\ "ovx:s": "overflow-x:scroll;", +\ "ovx:a": "overflow-x:auto;", +\ "ovy": "overflow-y:${1:hidden};", +\ "ovy:v": "overflow-y:visible;", +\ "ovy:h": "overflow-y:hidden;", +\ "ovy:s": "overflow-y:scroll;", +\ "ovy:a": "overflow-y:auto;", +\ "ovs": "overflow-style:${1:scrollbar};", +\ "ovs:a": "overflow-style:auto;", +\ "ovs:s": "overflow-style:scrollbar;", +\ "ovs:p": "overflow-style:panner;", +\ "ovs:m": "overflow-style:move;", +\ "ovs:mq": "overflow-style:marquee;", +\ "zoo": "zoom:1;", +\ "zm": "zoom:1;", +\ "cp": "clip:|;", +\ "cp:a": "clip:auto;", +\ "cp:r": "clip:rect(${1:top} ${2:right} ${3:bottom} ${4:left});", +\ "bxz": "box-sizing:${1:border-box};", +\ "bxz:cb": "box-sizing:content-box;", +\ "bxz:bb": "box-sizing:border-box;", +\ "bxsh": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:color};", +\ "bxsh:r": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:spread }rgb(${6:0}, ${7:0}, ${8:0});", +\ "bxsh:ra": "box-shadow:${1:inset }${2:h} ${3:v} ${4:blur} ${5:spread }rgba(${6:0}, ${7:0}, ${8:0}, .${9:5});", +\ "bxsh:n": "box-shadow:none;", +\ "m": "margin:|;", +\ "m:a": "margin:auto;", +\ "mt": "margin-top:|;", +\ "mt:a": "margin-top:auto;", +\ "mr": "margin-right:|;", +\ "mr:a": "margin-right:auto;", +\ "mb": "margin-bottom:|;", +\ "mb:a": "margin-bottom:auto;", +\ "ml": "margin-left:|;", +\ "ml:a": "margin-left:auto;", +\ "p": "padding:|;", +\ "pt": "padding-top:|;", +\ "pr": "padding-right:|;", +\ "pb": "padding-bottom:|;", +\ "pl": "padding-left:|;", +\ "w": "width:|;", +\ "w:a": "width:auto;", +\ "h": "height:|;", +\ "h:a": "height:auto;", +\ "maw": "max-width:|;", +\ "maw:n": "max-width:none;", +\ "mah": "max-height:|;", +\ "mah:n": "max-height:none;", +\ "miw": "min-width:|;", +\ "mih": "min-height:|;", +\ "mar": "max-resolution:${1:res};", +\ "mir": "min-resolution:${1:res};", +\ "ori": "orientation:|;", +\ "ori:l": "orientation:landscape;", +\ "ori:p": "orientation:portrait;", +\ "ol": "outline:|;", +\ "ol:n": "outline:none;", +\ "olo": "outline-offset:|;", +\ "olw": "outline-width:|;", +\ "olw:tn": "outline-width:thin;", +\ "olw:m": "outline-width:medium;", +\ "olw:tc": "outline-width:thick;", +\ "ols": "outline-style:|;", +\ "ols:n": "outline-style:none;", +\ "ols:dt": "outline-style:dotted;", +\ "ols:ds": "outline-style:dashed;", +\ "ols:s": "outline-style:solid;", +\ "ols:db": "outline-style:double;", +\ "ols:g": "outline-style:groove;", +\ "ols:r": "outline-style:ridge;", +\ "ols:i": "outline-style:inset;", +\ "ols:o": "outline-style:outset;", +\ "olc": "outline-color:#${1:000};", +\ "olc:i": "outline-color:invert;", +\ "bfv": "backface-visibility:|;", +\ "bfv:h": "backface-visibility:hidden;", +\ "bfv:v": "backface-visibility:visible;", +\ "bd": "border:|;", +\ "bd+": "border:${1:1px} ${2:solid} ${3:#000};", +\ "bd:n": "border:none;", +\ "bdbk": "border-break:${1:close};", +\ "bdbk:c": "border-break:close;", +\ "bdcl": "border-collapse:|;", +\ "bdcl:c": "border-collapse:collapse;", +\ "bdcl:s": "border-collapse:separate;", +\ "bdc": "border-color:#${1:000};", +\ "bdc:t": "border-color:transparent;", +\ "bdi": "border-image:url(|);", +\ "bdi:n": "border-image:none;", +\ "bdti": "border-top-image:url(|);", +\ "bdti:n": "border-top-image:none;", +\ "bdri": "border-right-image:url(|);", +\ "bdri:n": "border-right-image:none;", +\ "bdbi": "border-bottom-image:url(|);", +\ "bdbi:n": "border-bottom-image:none;", +\ "bdli": "border-left-image:url(|);", +\ "bdli:n": "border-left-image:none;", +\ "bdci": "border-corner-image:url(|);", +\ "bdci:n": "border-corner-image:none;", +\ "bdci:c": "border-corner-image:continue;", +\ "bdtli": "border-top-left-image:url(|);", +\ "bdtli:n": "border-top-left-image:none;", +\ "bdtli:c": "border-top-left-image:continue;", +\ "bdtri": "border-top-right-image:url(|);", +\ "bdtri:n": "border-top-right-image:none;", +\ "bdtri:c": "border-top-right-image:continue;", +\ "bdbri": "border-bottom-right-image:url(|);", +\ "bdbri:n": "border-bottom-right-image:none;", +\ "bdbri:c": "border-bottom-right-image:continue;", +\ "bdbli": "border-bottom-left-image:url(|);", +\ "bdbli:n": "border-bottom-left-image:none;", +\ "bdbli:c": "border-bottom-left-image:continue;", +\ "bdf": "border-fit:${1:repeat};", +\ "bdf:c": "border-fit:clip;", +\ "bdf:r": "border-fit:repeat;", +\ "bdf:sc": "border-fit:scale;", +\ "bdf:st": "border-fit:stretch;", +\ "bdf:ow": "border-fit:overwrite;", +\ "bdf:of": "border-fit:overflow;", +\ "bdf:sp": "border-fit:space;", +\ "bdlen": "border-length:|;", +\ "bdlen:a": "border-length:auto;", +\ "bdsp": "border-spacing:|;", +\ "bds": "border-style:|;", +\ "bds:n": "border-style:none;", +\ "bds:h": "border-style:hidden;", +\ "bds:dt": "border-style:dotted;", +\ "bds:ds": "border-style:dashed;", +\ "bds:s": "border-style:solid;", +\ "bds:db": "border-style:double;", +\ "bds:dtds": "border-style:dot-dash;", +\ "bds:dtdtds": "border-style:dot-dot-dash;", +\ "bds:w": "border-style:wave;", +\ "bds:g": "border-style:groove;", +\ "bds:r": "border-style:ridge;", +\ "bds:i": "border-style:inset;", +\ "bds:o": "border-style:outset;", +\ "bdw": "border-width:|;", +\ "bdtw": "border-top-width:|;", +\ "bdrw": "border-right-width:|;", +\ "bdbw": "border-bottom-width:|;", +\ "bdlw": "border-left-width:|;", +\ "bdt": "border-top:|;", +\ "bt": "border-top:|;", +\ "bdt+": "border-top:${1:1px} ${2:solid} ${3:#000};", +\ "bdt:n": "border-top:none;", +\ "bdts": "border-top-style:|;", +\ "bdts:n": "border-top-style:none;", +\ "bdtc": "border-top-color:#${1:000};", +\ "bdtc:t": "border-top-color:transparent;", +\ "bdr": "border-right:|;", +\ "br": "border-right:|;", +\ "bdr+": "border-right:${1:1px} ${2:solid} ${3:#000};", +\ "bdr:n": "border-right:none;", +\ "bdrst": "border-right-style:|;", +\ "bdrst:n": "border-right-style:none;", +\ "bdrc": "border-right-color:#${1:000};", +\ "bdrc:t": "border-right-color:transparent;", +\ "bdb": "border-bottom:|;", +\ "bb": "border-bottom:|;", +\ "bdb+": "border-bottom:${1:1px} ${2:solid} ${3:#000};", +\ "bdb:n": "border-bottom:none;", +\ "bdbs": "border-bottom-style:|;", +\ "bdbs:n": "border-bottom-style:none;", +\ "bdbc": "border-bottom-color:#${1:000};", +\ "bdbc:t": "border-bottom-color:transparent;", +\ "bdl": "border-left:|;", +\ "bl": "border-left:|;", +\ "bdl+": "border-left:${1:1px} ${2:solid} ${3:#000};", +\ "bdl:n": "border-left:none;", +\ "bdls": "border-left-style:|;", +\ "bdls:n": "border-left-style:none;", +\ "bdlc": "border-left-color:#${1:000};", +\ "bdlc:t": "border-left-color:transparent;", +\ "bdrs": "border-radius:|;", +\ "bdtrrs": "border-top-right-radius:|;", +\ "bdtlrs": "border-top-left-radius:|;", +\ "bdbrrs": "border-bottom-right-radius:|;", +\ "bdblrs": "border-bottom-left-radius:|;", +\ "bg": "background:#${1:000};", +\ "bg+": "background:${1:#fff} url(${2}) ${3:0} ${4:0} ${5:no-repeat};", +\ "bg:n": "background:none;", +\ "bg:ie": "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1:x}.png',sizingMethod='${2:crop}');", +\ "bgc": "background-color:#${1:fff};", +\ "bgc:t": "background-color:transparent;", +\ "bgi": "background-image:url(|);", +\ "bgi:n": "background-image:none;", +\ "bgr": "background-repeat:|;", +\ "bgr:n": "background-repeat:no-repeat;", +\ "bgr:x": "background-repeat:repeat-x;", +\ "bgr:y": "background-repeat:repeat-y;", +\ "bgr:sp": "background-repeat:space;", +\ "bgr:rd": "background-repeat:round;", +\ "bga": "background-attachment:|;", +\ "bga:f": "background-attachment:fixed;", +\ "bga:s": "background-attachment:scroll;", +\ "bgp": "background-position:${1:0} ${2:0};", +\ "bgpx": "background-position-x:|;", +\ "bgpy": "background-position-y:|;", +\ "bgbk": "background-break:|;", +\ "bgbk:bb": "background-break:bounding-box;", +\ "bgbk:eb": "background-break:each-box;", +\ "bgbk:c": "background-break:continuous;", +\ "bgcp": "background-clip:${1:padding-box};", +\ "bgcp:bb": "background-clip:border-box;", +\ "bgcp:pb": "background-clip:padding-box;", +\ "bgcp:cb": "background-clip:content-box;", +\ "bgcp:nc": "background-clip:no-clip;", +\ "bgo": "background-origin:|;", +\ "bgo:pb": "background-origin:padding-box;", +\ "bgo:bb": "background-origin:border-box;", +\ "bgo:cb": "background-origin:content-box;", +\ "bgsz": "background-size:|;", +\ "bgsz:a": "background-size:auto;", +\ "bgsz:ct": "background-size:contain;", +\ "bgsz:cv": "background-size:cover;", +\ "c": "color:#${1:000};", +\ "c:r": "color:rgb(${1:0}, ${2:0}, ${3:0});", +\ "c:ra": "color:rgba(${1:0}, ${2:0}, ${3:0}, .${4:5});", +\ "cm": "/* |${child} */", +\ "cnt": "content:'|';", +\ "cnt:n": "content:normal;", +\ "cnt:oq": "content:open-quote;", +\ "cnt:noq": "content:no-open-quote;", +\ "cnt:cq": "content:close-quote;", +\ "cnt:ncq": "content:no-close-quote;", +\ "cnt:a": "content:attr(|);", +\ "cnt:c": "content:counter(|);", +\ "cnt:cs": "content:counters(|);", +\ "tbl": "table-layout:|;", +\ "tbl:a": "table-layout:auto;", +\ "tbl:f": "table-layout:fixed;", +\ "cps": "caption-side:|;", +\ "cps:t": "caption-side:top;", +\ "cps:b": "caption-side:bottom;", +\ "ec": "empty-cells:|;", +\ "ec:s": "empty-cells:show;", +\ "ec:h": "empty-cells:hide;", +\ "lis": "list-style:|;", +\ "lis:n": "list-style:none;", +\ "lisp": "list-style-position:|;", +\ "lisp:i": "list-style-position:inside;", +\ "lisp:o": "list-style-position:outside;", +\ "list": "list-style-type:|;", +\ "list:n": "list-style-type:none;", +\ "list:d": "list-style-type:disc;", +\ "list:c": "list-style-type:circle;", +\ "list:s": "list-style-type:square;", +\ "list:dc": "list-style-type:decimal;", +\ "list:dclz": "list-style-type:decimal-leading-zero;", +\ "list:lr": "list-style-type:lower-roman;", +\ "list:ur": "list-style-type:upper-roman;", +\ "lisi": "list-style-image:|;", +\ "lisi:n": "list-style-image:none;", +\ "q": "quotes:|;", +\ "q:n": "quotes:none;", +\ "q:ru": "quotes:'\\00AB' '\\00BB' '\\201E' '\\201C';", +\ "q:en": "quotes:'\\201C' '\\201D' '\\2018' '\\2019';", +\ "ct": "content:|;", +\ "ct:n": "content:normal;", +\ "ct:oq": "content:open-quote;", +\ "ct:noq": "content:no-open-quote;", +\ "ct:cq": "content:close-quote;", +\ "ct:ncq": "content:no-close-quote;", +\ "ct:a": "content:attr(|);", +\ "ct:c": "content:counter(|);", +\ "ct:cs": "content:counters(|);", +\ "coi": "counter-increment:|;", +\ "cor": "counter-reset:|;", +\ "va": "vertical-align:${1:top};", +\ "va:sup": "vertical-align:super;", +\ "va:t": "vertical-align:top;", +\ "va:tt": "vertical-align:text-top;", +\ "va:m": "vertical-align:middle;", +\ "va:bl": "vertical-align:baseline;", +\ "va:b": "vertical-align:bottom;", +\ "va:tb": "vertical-align:text-bottom;", +\ "va:sub": "vertical-align:sub;", +\ "ta": "text-align:${1:left};", +\ "ta:l": "text-align:left;", +\ "ta:c": "text-align:center;", +\ "ta:r": "text-align:right;", +\ "ta:j": "text-align:justify;", +\ "ta-lst": "text-align-last:|;", +\ "tal:a": "text-align-last:auto;", +\ "tal:l": "text-align-last:left;", +\ "tal:c": "text-align-last:center;", +\ "tal:r": "text-align-last:right;", +\ "td": "text-decoration:${1:none};", +\ "td:n": "text-decoration:none;", +\ "td:u": "text-decoration:underline;", +\ "td:o": "text-decoration:overline;", +\ "td:l": "text-decoration:line-through;", +\ "te": "text-emphasis:|;", +\ "te:n": "text-emphasis:none;", +\ "te:ac": "text-emphasis:accent;", +\ "te:dt": "text-emphasis:dot;", +\ "te:c": "text-emphasis:circle;", +\ "te:ds": "text-emphasis:disc;", +\ "te:b": "text-emphasis:before;", +\ "te:a": "text-emphasis:after;", +\ "th": "text-height:|;", +\ "th:a": "text-height:auto;", +\ "th:f": "text-height:font-size;", +\ "th:t": "text-height:text-size;", +\ "th:m": "text-height:max-size;", +\ "ti": "text-indent:|;", +\ "ti:-": "text-indent:-9999px;", +\ "tj": "text-justify:|;", +\ "tj:a": "text-justify:auto;", +\ "tj:iw": "text-justify:inter-word;", +\ "tj:ii": "text-justify:inter-ideograph;", +\ "tj:ic": "text-justify:inter-cluster;", +\ "tj:d": "text-justify:distribute;", +\ "tj:k": "text-justify:kashida;", +\ "tj:t": "text-justify:tibetan;", +\ "tov": "text-overflow:${ellipsis};", +\ "tov:e": "text-overflow:ellipsis;", +\ "tov:c": "text-overflow:clip;", +\ "to": "text-outline:|;", +\ "to+": "text-outline:${1:0} ${2:0} ${3:#000};", +\ "to:n": "text-outline:none;", +\ "tr": "text-replace:|;", +\ "tr:n": "text-replace:none;", +\ "tt": "text-transform:${1:uppercase};", +\ "tt:n": "text-transform:none;", +\ "tt:c": "text-transform:capitalize;", +\ "tt:u": "text-transform:uppercase;", +\ "tt:l": "text-transform:lowercase;", +\ "tw": "text-wrap:|;", +\ "tw:n": "text-wrap:normal;", +\ "tw:no": "text-wrap:none;", +\ "tw:u": "text-wrap:unrestricted;", +\ "tw:s": "text-wrap:suppress;", +\ "tsh": "text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000};", +\ "tsh:r": "text-shadow:${1:h} ${2:v} ${3:blur} rgb(${4:0}, ${5:0}, ${6:0});", +\ "tsh:ra": "text-shadow:${1:h} ${2:v} ${3:blur} rgba(${4:0}, ${5:0}, ${6:0}, .${7:5});", +\ "tsh+": "text-shadow:${1:0} ${2:0} ${3:0} ${4:#000};", +\ "tsh:n": "text-shadow:none;", +\ "trf": "transform:|;", +\ "trf:skx": "transform: skewX(${1:angle});", +\ "trf:sky": "transform: skewY(${1:angle});", +\ "trf:sc": "transform: scale(${1:x}, ${2:y});", +\ "trf:scx": "transform: scaleX(${1:x});", +\ "trf:scy": "transform: scaleY(${1:y});", +\ "trf:scz": "transform: scaleZ(${1:z});", +\ "trf:sc3": "transform: scale3d(${1:x}, ${2:y}, ${3:z});", +\ "trf:r": "transform: rotate(${1:angle});", +\ "trf:rx": "transform: rotateX(${1:angle});", +\ "trf:ry": "transform: rotateY(${1:angle});", +\ "trf:rz": "transform: rotateZ(${1:angle});", +\ "trf:t": "transform: translate(${1:x}, ${2:y});", +\ "trf:tx": "transform: translateX(${1:x});", +\ "trf:ty": "transform: translateY(${1:y});", +\ "trf:tz": "transform: translateZ(${1:z});", +\ "trf:t3": "transform: translate3d(${1:tx}, ${2:ty}, ${3:tz});", +\ "trfo": "transform-origin:|;", +\ "trfs": "transform-style:${1:preserve-3d};", +\ "trs": "transition:${1:prop} ${2:time};", +\ "trsde": "transition-delay:${1:time};", +\ "trsdu": "transition-duration:${1:time};", +\ "trsp": "transition-property:${1:prop};", +\ "trstf": "transition-timing-function:${1:tfunc};", +\ "lh": "line-height:|;", +\ "whs": "white-space:|;", +\ "whs:n": "white-space:normal;", +\ "whs:p": "white-space:pre;", +\ "whs:nw": "white-space:nowrap;", +\ "whs:pw": "white-space:pre-wrap;", +\ "whs:pl": "white-space:pre-line;", +\ "whsc": "white-space-collapse:|;", +\ "whsc:n": "white-space-collapse:normal;", +\ "whsc:k": "white-space-collapse:keep-all;", +\ "whsc:l": "white-space-collapse:loose;", +\ "whsc:bs": "white-space-collapse:break-strict;", +\ "whsc:ba": "white-space-collapse:break-all;", +\ "wob": "word-break:|;", +\ "wob:n": "word-break:normal;", +\ "wob:k": "word-break:keep-all;", +\ "wob:ba": "word-break:break-all;", +\ "wos": "word-spacing:|;", +\ "wow": "word-wrap:|;", +\ "wow:nm": "word-wrap:normal;", +\ "wow:n": "word-wrap:none;", +\ "wow:u": "word-wrap:unrestricted;", +\ "wow:s": "word-wrap:suppress;", +\ "wow:b": "word-wrap:break-word;", +\ "wm": "writing-mode:${1:lr-tb};", +\ "wm:lrt": "writing-mode:lr-tb;", +\ "wm:lrb": "writing-mode:lr-bt;", +\ "wm:rlt": "writing-mode:rl-tb;", +\ "wm:rlb": "writing-mode:rl-bt;", +\ "wm:tbr": "writing-mode:tb-rl;", +\ "wm:tbl": "writing-mode:tb-lr;", +\ "wm:btl": "writing-mode:bt-lr;", +\ "wm:btr": "writing-mode:bt-rl;", +\ "lts": "letter-spacing:|;", +\ "lts-n": "letter-spacing:normal;", +\ "f": "font:|;", +\ "f+": "font:${1:1em} ${2:Arial,sans-serif};", +\ "fw": "font-weight:|;", +\ "fw:n": "font-weight:normal;", +\ "fw:b": "font-weight:bold;", +\ "fw:br": "font-weight:bolder;", +\ "fw:lr": "font-weight:lighter;", +\ "fs": "font-style:${italic};", +\ "fs:n": "font-style:normal;", +\ "fs:i": "font-style:italic;", +\ "fs:o": "font-style:oblique;", +\ "fv": "font-variant:|;", +\ "fv:n": "font-variant:normal;", +\ "fv:sc": "font-variant:small-caps;", +\ "fz": "font-size:|;", +\ "fza": "font-size-adjust:|;", +\ "fza:n": "font-size-adjust:none;", +\ "ff": "font-family:|;", +\ "ff:s": "font-family:serif;", +\ "ff:ss": "font-family:sans-serif;", +\ "ff:c": "font-family:cursive;", +\ "ff:f": "font-family:fantasy;", +\ "ff:m": "font-family:monospace;", +\ "ff:a": "font-family: Arial, \"Helvetica Neue\", Helvetica, sans-serif;", +\ "ff:t": "font-family: \"Times New Roman\", Times, Baskerville, Georgia, serif;", +\ "ff:v": "font-family: Verdana, Geneva, sans-serif;", +\ "fef": "font-effect:|;", +\ "fef:n": "font-effect:none;", +\ "fef:eg": "font-effect:engrave;", +\ "fef:eb": "font-effect:emboss;", +\ "fef:o": "font-effect:outline;", +\ "fem": "font-emphasize:|;", +\ "femp": "font-emphasize-position:|;", +\ "femp:b": "font-emphasize-position:before;", +\ "femp:a": "font-emphasize-position:after;", +\ "fems": "font-emphasize-style:|;", +\ "fems:n": "font-emphasize-style:none;", +\ "fems:ac": "font-emphasize-style:accent;", +\ "fems:dt": "font-emphasize-style:dot;", +\ "fems:c": "font-emphasize-style:circle;", +\ "fems:ds": "font-emphasize-style:disc;", +\ "fsm": "font-smooth:|;", +\ "fsm:a": "font-smooth:auto;", +\ "fsm:n": "font-smooth:never;", +\ "fsm:aw": "font-smooth:always;", +\ "fst": "font-stretch:|;", +\ "fst:n": "font-stretch:normal;", +\ "fst:uc": "font-stretch:ultra-condensed;", +\ "fst:ec": "font-stretch:extra-condensed;", +\ "fst:c": "font-stretch:condensed;", +\ "fst:sc": "font-stretch:semi-condensed;", +\ "fst:se": "font-stretch:semi-expanded;", +\ "fst:e": "font-stretch:expanded;", +\ "fst:ee": "font-stretch:extra-expanded;", +\ "fst:ue": "font-stretch:ultra-expanded;", +\ "op": "opacity:|;", +\ "op+": "opacity: $1;\nfilter: alpha(opacity=$2);", +\ "op:ie": "filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);", +\ "op:ms": "-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';", +\ "rsz": "resize:|;", +\ "rsz:n": "resize:none;", +\ "rsz:b": "resize:both;", +\ "rsz:h": "resize:horizontal;", +\ "rsz:v": "resize:vertical;", +\ "cur": "cursor:${pointer};", +\ "cur:a": "cursor:auto;", +\ "cur:d": "cursor:default;", +\ "cur:c": "cursor:crosshair;", +\ "cur:ha": "cursor:hand;", +\ "cur:he": "cursor:help;", +\ "cur:m": "cursor:move;", +\ "cur:p": "cursor:pointer;", +\ "cur:t": "cursor:text;", +\ "fxd": "flex-direction:|;", +\ "fxd:r": "flex-direction:row;", +\ "fxd:rr": "flex-direction:row-reverse;", +\ "fxd:c": "flex-direction:column;", +\ "fxd:cr": "flex-direction:column-reverse;", +\ "fxw": "flex-wrap: |;", +\ "fxw:n": "flex-wrap:nowrap;", +\ "fxw:w": "flex-wrap:wrap;", +\ "fxw:wr": "flex-wrap:wrap-reverse;", +\ "fxf": "flex-flow:|;", +\ "jc": "justify-content:|;", +\ "jc:fs": "justify-content:flex-start;", +\ "jc:fe": "justify-content:flex-end;", +\ "jc:c": "justify-content:center;", +\ "jc:sb": "justify-content:space-between;", +\ "jc:sa": "justify-content:space-around;", +\ "ai": "align-items:|;", +\ "ai:fs": "align-items:flex-start;", +\ "ai:fe": "align-items:flex-end;", +\ "ai:c": "align-items:center;", +\ "ai:b": "align-items:baseline;", +\ "ai:s": "align-items:stretch;", +\ "ac": "align-content:|;", +\ "ac:fs": "align-content:flex-start;", +\ "ac:fe": "align-content:flex-end;", +\ "ac:c": "align-content:center;", +\ "ac:sb": "align-content:space-between;", +\ "ac:sa": "align-content:space-around;", +\ "ac:s": "align-content:stretch;", +\ "ord": "order:|;", +\ "fxg": "flex-grow:|;", +\ "fxsh": "flex-shrink:|;", +\ "fxb": "flex-basis:|;", +\ "fx": "flex:|;", +\ "as": "align-self:|;", +\ "as:a": "align-self:auto;", +\ "as:fs": "align-self:flex-start;", +\ "as:fe": "align-self:flex-end;", +\ "as:c": "align-self:center;", +\ "as:b": "align-self:baseline;", +\ "as:s": "align-self:stretch;", +\ "pgbb": "page-break-before:|;", +\ "pgbb:au": "page-break-before:auto;", +\ "pgbb:al": "page-break-before:always;", +\ "pgbb:l": "page-break-before:left;", +\ "pgbb:r": "page-break-before:right;", +\ "pgbi": "page-break-inside:|;", +\ "pgbi:au": "page-break-inside:auto;", +\ "pgbi:av": "page-break-inside:avoid;", +\ "pgba": "page-break-after:|;", +\ "pgba:au": "page-break-after:auto;", +\ "pgba:al": "page-break-after:always;", +\ "pgba:l": "page-break-after:left;", +\ "pgba:r": "page-break-after:right;", +\ "orp": "orphans:|;", +\ "us": "user-select:${none};", +\ "wid": "widows:|;", +\ "wfsm": "-webkit-font-smoothing:${antialiased};", +\ "wfsm:a": "-webkit-font-smoothing:antialiased;", +\ "wfsm:s": "-webkit-font-smoothing:subpixel-antialiased;", +\ "wfsm:sa": "-webkit-font-smoothing:subpixel-antialiased;", +\ "wfsm:n": "-webkit-font-smoothing:none;" +\ }, +\ 'filters': 'fc', +\ }, +\ 'sass': { +\ 'extends': 'css', +\ 'snippets': { +\ '@if': "@if {\n\t|\n}", +\ '@e': "@else {\n\t|\n}", +\ '@in': "@include |", +\ '@ex': "@extend |", +\ '@mx': "@mixin {\n\t|\n}", +\ '@fn': "@function {\n\t|\n}", +\ '@r': "@return |", +\ }, +\ }, +\ 'scss': { +\ 'extends': 'css', +\ }, +\ 'less': { +\ 'extends': 'css', +\ }, +\ 'css.drupal': { +\ 'extends': 'css', +\ }, +\ 'html': { +\ 'snippets': { +\ '!': "html:5", +\ '!!!': "\n", +\ '!!!4t': "\n", +\ '!!!4s': "\n", +\ '!!!xt': "\n", +\ '!!!xs': "\n", +\ '!!!xxs': "\n", +\ 'c': "", +\ 'cc:ie6': "", +\ 'cc:ie': "", +\ 'cc:noie': "\n\t${child}|\n", +\ 'html:4t': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:4s': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xt': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xs': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xxs': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:5': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ }, +\ 'default_attributes': { +\ 'a': [{'href': ''}], +\ 'a:link': [{'href': 'http://|'}], +\ 'a:mail': [{'href': 'mailto:|'}], +\ 'abbr': [{'title': ''}], +\ 'acronym': [{'title': ''}], +\ 'base': [{'href': ''}], +\ 'bdo': [{'dir': ''}], +\ 'bdo:r': [{'dir': 'rtl'}], +\ 'bdo:l': [{'dir': 'ltr'}], +\ 'del': [{'datetime': '${datetime}'}], +\ 'ins': [{'datetime': '${datetime}'}], +\ 'link:css': [{'rel': 'stylesheet'}, g:emmet_html5 ? {} : {'type': 'text/css'}, {'href': '|style.css'}, {'media': 'all'}], +\ 'link:print': [{'rel': 'stylesheet'}, g:emmet_html5 ? {} : {'type': 'text/css'}, {'href': '|print.css'}, {'media': 'print'}], +\ 'link:import': [{'rel': 'import'}, {'href': '|.html'}], +\ 'link:im': [{'rel': 'import'}, {'href': '|.html'}], +\ 'link:favicon': [{'rel': 'shortcut icon'}, {'type': 'image/x-icon'}, {'href': '|favicon.ico'}], +\ 'link:touch': [{'rel': 'apple-touch-icon'}, {'href': '|favicon.png'}], +\ 'link:rss': [{'rel': 'alternate'}, {'type': 'application/rss+xml'}, {'title': 'RSS'}, {'href': '|rss.xml'}], +\ 'link:atom': [{'rel': 'alternate'}, {'type': 'application/atom+xml'}, {'title': 'Atom'}, {'href': 'atom.xml'}], +\ 'meta:utf': [{'http-equiv': 'Content-Type'}, {'content': 'text/html;charset=UTF-8'}], +\ 'meta:vp': [{'name': 'viewport'}, {'content': 'width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0'}], +\ 'meta:win': [{'http-equiv': 'Content-Type'}, {'content': 'text/html;charset=Win-1251'}], +\ 'meta:compat': [{'http-equiv': 'X-UA-Compatible'}, {'content': 'IE=7'}], +\ 'style': g:emmet_html5 ? [] : [{'type': 'text/css'}], +\ 'script': g:emmet_html5 ? [] : [{'type': 'text/javascript'}], +\ 'script:src': (g:emmet_html5 ? [] : [{'type': 'text/javascript'}]) + [{'src': ''}], +\ 'img': [{'src': ''}, {'alt': ''}], +\ 'iframe': [{'src': ''}, {'frameborder': '0'}], +\ 'embed': [{'src': ''}, {'type': ''}], +\ 'object': [{'data': ''}, {'type': ''}], +\ 'param': [{'name': ''}, {'value': ''}], +\ 'map': {'name': ''}, +\ 'area': [{'shape': ''}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:d': [{'shape': 'default'}, {'href': ''}, {'alt': ''}], +\ 'area:c': [{'shape': 'circle'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:r': [{'shape': 'rect'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:p': [{'shape': 'poly'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'link': [{'rel': 'stylesheet'}, {'href': ''}], +\ 'form': [{'action': ''}], +\ 'form:get': [{'action': ''}, {'method': 'get'}], +\ 'form:post': [{'action': ''}, {'method': 'post'}], +\ 'form:upload': [{'action': ''}, {'method': 'post'}, {'enctype': 'multipart/form-data'}], +\ 'label': [{'for': ''}], +\ 'input': [{'type': ''}], +\ 'input:hidden': [{'type': 'hidden'}, {'name': ''}], +\ 'input:h': [{'type': 'hidden'}, {'name': ''}], +\ 'input:text': [{'type': 'text'}, {'name': ''}, {'id': ''}], +\ 'input:t': [{'type': 'text'}, {'name': ''}, {'id': ''}], +\ 'input:search': [{'type': 'search'}, {'name': ''}, {'id': ''}], +\ 'input:email': [{'type': 'email'}, {'name': ''}, {'id': ''}], +\ 'input:url': [{'type': 'url'}, {'name': ''}, {'id': ''}], +\ 'input:password': [{'type': 'password'}, {'name': ''}, {'id': ''}], +\ 'input:p': [{'type': 'password'}, {'name': ''}, {'id': ''}], +\ 'input:datetime': [{'type': 'datetime'}, {'name': ''}, {'id': ''}], +\ 'input:date': [{'type': 'date'}, {'name': ''}, {'id': ''}], +\ 'input:datetime-local': [{'type': 'datetime-local'}, {'name': ''}, {'id': ''}], +\ 'input:month': [{'type': 'month'}, {'name': ''}, {'id': ''}], +\ 'input:week': [{'type': 'week'}, {'name': ''}, {'id': ''}], +\ 'input:time': [{'type': 'time'}, {'name': ''}, {'id': ''}], +\ 'input:number': [{'type': 'number'}, {'name': ''}, {'id': ''}], +\ 'input:color': [{'type': 'color'}, {'name': ''}, {'id': ''}], +\ 'input:checkbox': [{'type': 'checkbox'}, {'name': ''}, {'id': ''}], +\ 'input:c': [{'type': 'checkbox'}, {'name': ''}, {'id': ''}], +\ 'input:radio': [{'type': 'radio'}, {'name': ''}, {'id': ''}], +\ 'input:r': [{'type': 'radio'}, {'name': ''}, {'id': ''}], +\ 'input:range': [{'type': 'range'}, {'name': ''}, {'id': ''}], +\ 'input:file': [{'type': 'file'}, {'name': ''}, {'id': ''}], +\ 'input:f': [{'type': 'file'}, {'name': ''}, {'id': ''}], +\ 'input:submit': [{'type': 'submit'}, {'value': ''}], +\ 'input:s': [{'type': 'submit'}, {'value': ''}], +\ 'input:image': [{'type': 'image'}, {'src': ''}, {'alt': ''}], +\ 'input:i': [{'type': 'image'}, {'src': ''}, {'alt': ''}], +\ 'input:reset': [{'type': 'reset'}, {'value': ''}], +\ 'input:button': [{'type': 'button'}, {'value': ''}], +\ 'input:b': [{'type': 'button'}, {'value': ''}], +\ 'select': [{'name': ''}, {'id': ''}], +\ 'option': [{'value': ''}], +\ 'textarea': [{'name': ''}, {'id': ''}, {'cols': '30'}, {'rows': '10'}], +\ 'menu:context': [{'type': 'context'}], +\ 'menu:c': [{'type': 'context'}], +\ 'menu:toolbar': [{'type': 'toolbar'}], +\ 'menu:t': [{'type': 'toolbar'}], +\ 'video': [{'src': ''}], +\ 'audio': [{'src': ''}], +\ 'html:xml': [{'xmlns': 'http://www.w3.org/1999/xhtml'}, {'xml:lang': '${lang}'}], +\ }, +\ 'aliases': { +\ 'link:*': 'link', +\ 'meta:*': 'meta', +\ 'area:*': 'area', +\ 'bdo:*': 'bdo', +\ 'form:*': 'form', +\ 'input:*': 'input', +\ 'script:*': 'script', +\ 'html:*': 'html', +\ 'a:*': 'a', +\ 'menu:*': 'menu', +\ 'bq': 'blockquote', +\ 'acr': 'acronym', +\ 'fig': 'figure', +\ 'ifr': 'iframe', +\ 'emb': 'embed', +\ 'obj': 'object', +\ 'src': 'source', +\ 'cap': 'caption', +\ 'colg': 'colgroup', +\ 'fst': 'fieldset', +\ 'btn': 'button', +\ 'optg': 'optgroup', +\ 'opt': 'option', +\ 'tarea': 'textarea', +\ 'leg': 'legend', +\ 'sect': 'section', +\ 'art': 'article', +\ 'hdr': 'header', +\ 'ftr': 'footer', +\ 'adr': 'address', +\ 'dlg': 'dialog', +\ 'str': 'strong', +\ 'sty': 'style', +\ 'prog': 'progress', +\ 'fset': 'fieldset', +\ 'datag': 'datagrid', +\ 'datal': 'datalist', +\ 'kg': 'keygen', +\ 'out': 'output', +\ 'det': 'details', +\ 'cmd': 'command', +\ }, +\ 'expandos': { +\ 'ol': 'ol>li', +\ 'ul': 'ul>li', +\ 'dl': 'dl>dt+dd', +\ 'map': 'map>area', +\ 'table': 'table>tr>td', +\ 'colgroup': 'colgroup>col', +\ 'colg': 'colgroup>col', +\ 'tr': 'tr>td', +\ 'select': 'select>option', +\ 'optgroup': 'optgroup>option', +\ 'optg': 'optgroup>option', +\ }, +\ 'empty_elements': 'area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,keygen,command', +\ 'block_elements': 'address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,link,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul,h1,h2,h3,h4,h5,h6', +\ 'inline_elements': 'a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,small,span,strike,strong,sub,sup,textarea,tt,u,var', +\ 'empty_element_suffix': g:emmet_html5 ? '>' : ' />', +\ 'indent_blockelement': 0, +\ }, +\ 'elm': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ }, +\ 'htmldjango': { +\ 'extends': 'html', +\ }, +\ 'html.django_template': { +\ 'extends': 'html', +\ }, +\ 'jade': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ 'snippets': { +\ '!': "html:5", +\ '!!!': "doctype html\n", +\ '!!!4t': "doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"\n", +\ '!!!4s': "doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"\n", +\ '!!!xt': "doctype transitional\n", +\ '!!!xs': "doctype strict\n", +\ '!!!xxs': "doctype 1.1\n", +\ 'c': "\/\/ |${child}", +\ 'html:4t': "doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"\n" +\ ."html(lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(http-equiv=\"Content-Type\", content=\"text/html;charset=${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ 'html:4s': "doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"\n" +\ ."html(lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(http-equiv=\"Content-Type\", content=\"text/html;charset=${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ 'html:xt': "doctype transitional\n" +\ ."html(xmlns=\"http://www.w3.org/1999/xhtml\", xml:lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(http-equiv=\"Content-Type\", content=\"text/html;charset=${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ 'html:xs': "doctype strict\n" +\ ."html(xmlns=\"http://www.w3.org/1999/xhtml\", xml:lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(http-equiv=\"Content-Type\", content=\"text/html;charset=${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ 'html:xxs': "doctype 1.1\n" +\ ."html(xmlns=\"http://www.w3.org/1999/xhtml\", xml:lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(http-equiv=\"Content-Type\", content=\"text/html;charset=${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ 'html:5': "doctype html\n" +\ ."html(lang=\"${lang}\")\n" +\ ."\thead\n" +\ ."\t\tmeta(charset=\"${charset}\")\n" +\ ."\t\ttitle\n" +\ ."\tbody\n\t\t${child}|", +\ }, +\ }, +\ 'pug': { +\ 'extends': 'jade', +\ }, +\ 'xsl': { +\ 'extends': 'html', +\ 'default_attributes': { +\ 'tmatch': [{'match': ''}, {'mode': ''}], +\ 'tname': [{'name': ''}], +\ 'xsl:when': {'test': ''}, +\ 'var': [{'name': ''}, {'select': ''}], +\ 'vari': {'name': ''}, +\ 'if': {'test': ''}, +\ 'call': {'name': ''}, +\ 'attr': {'name': ''}, +\ 'wp': [{'name': ''}, {'select': ''}], +\ 'par': [{'name': ''}, {'select': ''}], +\ 'val': {'select': ''}, +\ 'co': {'select': ''}, +\ 'each': {'select': ''}, +\ 'ap': [{'select': ''}, {'mode': ''}] +\ }, +\ 'aliases': { +\ 'tmatch': 'xsl:template', +\ 'tname': 'xsl:template', +\ 'var': 'xsl:variable', +\ 'vari': 'xsl:variable', +\ 'if': 'xsl:if', +\ 'choose': 'xsl:choose', +\ 'call': 'xsl:call-template', +\ 'wp': 'xsl:with-param', +\ 'par': 'xsl:param', +\ 'val': 'xsl:value-of', +\ 'attr': 'xsl:attribute', +\ 'co' : 'xsl:copy-of', +\ 'each' : 'xsl:for-each', +\ 'ap' : 'xsl:apply-templates', +\ }, +\ 'expandos': { +\ 'choose': 'xsl:choose>xsl:when+xsl:otherwise', +\ } +\ }, +\ 'jsx': { +\ 'extends': 'html', +\ 'attribute_name': {'class': 'className', 'for': 'htmlFor'}, +\ 'empty_element_suffix': ' />', +\ }, +\ 'xslt': { +\ 'extends': 'xsl', +\ }, +\ 'haml': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ 'snippets': { +\ 'html:5': "!!! 5\n" +\ ."%html{:lang => \"${lang}\"}\n" +\ ."\t%head\n" +\ ."\t\t%meta{:charset => \"${charset}\"}\n" +\ ."\t\t%title\n" +\ ."\t%body\n" +\ ."\t\t${child}|\n", +\ }, +\ 'attribute_style': 'hash', +\ }, +\ 'slim': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ 'snippets': { +\ 'html:5': "doctype 5\n" +\ ."html lang=\"${lang}\"\n" +\ ."\thead\n" +\ ."\t\tmeta charset=\"${charset}\"\n" +\ ."\t\ttitle\n" +\ ."\tbody\n" +\ ."\t\t${child}|\n", +\ }, +\ }, +\ 'xhtml': { +\ 'extends': 'html' +\ }, +\ 'mustache': { +\ 'extends': 'html' +\ }, +\ 'xsd': { +\ 'extends': 'html', +\ 'snippets': { +\ 'xsd:w3c': "\n" +\ ."\n" +\ ."\t\n" +\ ."\n" +\ } +\ }, +\} + +if exists('g:user_emmet_settings') + call emmet#mergeConfig(s:emmet_settings, g:user_emmet_settings) +endif + +let &cpoptions = s:save_cpo +unlet s:save_cpo + +" vim:set et: diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang.vim new file mode 100644 index 0000000..0bc416f --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang.vim @@ -0,0 +1,30 @@ +let s:exists = {} +function! emmet#lang#exists(type) abort + if len(a:type) == 0 + return 0 + elseif has_key(s:exists, a:type) + return s:exists[a:type] + endif + let s:exists[a:type] = len(globpath(&rtp, 'autoload/emmet/lang/'.a:type.'.vim')) > 0 + return s:exists[a:type] +endfunction + +function! emmet#lang#type(type) abort + let type = a:type + let base = type + let settings = emmet#getSettings() + while base != '' + for b in split(base, '\.') + if emmet#lang#exists(b) + return b + endif + if has_key(settings, b) && has_key(settings[b], 'extends') + let base = settings[b].extends + break + else + let base = '' + endif + endfor + endwhile + return 'html' +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/css.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/css.vim new file mode 100644 index 0000000..3796106 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/css.vim @@ -0,0 +1,350 @@ +function! emmet#lang#css#findTokens(str) abort + let tmp = substitute(substitute(a:str, '^.*[;{]\s*', '', ''), '}\s*$', '', '') + if tmp =~ '/' && tmp =~ '^[a-zA-Z0-9/_.]\+$' + " maybe path or something + return '' + endif + return substitute(substitute(a:str, '^.*[;{]\s*', '', ''), '}\s*$', '', '') +endfunction + +function! emmet#lang#css#parseIntoTree(abbr, type) abort + let abbr = a:abbr + let type = a:type + let prefix = 0 + let value = '' + + let indent = emmet#getIndentation(type) + let aliases = emmet#getResource(type, 'aliases', {}) + let snippets = emmet#getResource(type, 'snippets', {}) + let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1) + + let root = emmet#newNode() + + " emmet + let tokens = split(abbr, '+\ze[^+)!]') + let block = emmet#util#searchRegion('{', '}') + if abbr !~# '^@' && emmet#getBaseType(type) ==# 'css' && type !=# 'sass' && block[0] ==# [0,0] && block[1] ==# [0,0] + let current = emmet#newNode() + let current.snippet = substitute(abbr, '\s\+$', '', '') . " {\n" . indent . "${cursor}\n}" + let current.name = '' + call add(root.child, deepcopy(current)) + else + for n in range(len(tokens)) + let token = tokens[n] + let prop = matchlist(token, '^\(-\{0,1}[a-zA-Z]\+\|[a-zA-Z0-9]\++\{0,1}\|([a-zA-Z0-9]\++\{0,1})\)\(\%([0-9.-]\+\%(p\|e\|em\|re\|rem\|%\)\{0,1}-\{0,1}\|-auto\)*\)$') + if len(prop) + let token = substitute(prop[1], '^(\(.*\))', '\1', '') + if token =~# '^-' + let prefix = 1 + let token = token[1:] + endif + let value = '' + for v in split(prop[2], '\d\zs-') + if len(value) > 0 + let value .= ' ' + endif + if token =~# '^[z]' + " TODO + let value .= substitute(v, '[^0-9.]*$', '', '') + elseif v =~# 'p$' + let value .= substitute(v, 'p$', '%', '') + elseif v =~# '%$' + let value .= v + elseif v =~# 'e$' + let value .= substitute(v, 'e$', 'em', '') + elseif v =~# 'em$' + let value .= v + elseif v =~# 're$' + let value .= substitute(v, 're$', 'rem', '') + elseif v =~# 'rem$' + let value .= v + elseif v =~# '\.' + let value .= v . 'em' + elseif v ==# 'auto' + let value .= v + elseif v ==# '0' + let value .= '0' + else + let value .= v . 'px' + endif + endfor + endif + + let tag_name = token + if tag_name =~# '.!$' + let tag_name = tag_name[:-2] + let important = 1 + else + let important = 0 + endif + " make default node + let current = emmet#newNode() + let current.important = important + let current.name = tag_name + + " aliases + if has_key(aliases, tag_name) + let current.name = aliases[tag_name] + endif + + " snippets + if !empty(snippets) + let snippet_name = tag_name + if !has_key(snippets, snippet_name) + let pat = '^' . join(split(tag_name, '\zs'), '\%(\|[^:-]\+-\)') + let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat') + if len(vv) > 0 + let snippet_name = vv[0] + else + let pat = '^' . join(split(tag_name, '\zs'), '\%(\|[^:-]\+-*\)') + let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat') + if len(vv) == 0 + let pat = '^' . join(split(tag_name, '\zs'), '[^:]\{-}') + let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat') + if len(vv) == 0 + let pat = '^' . join(split(tag_name, '\zs'), '.\{-}') + let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat') + endif + endif + let minl = -1 + for vk in vv + let vvs = snippets[vk] + if minl == -1 || len(vvs) < minl + let snippet_name = vk + let minl = len(vvs) + endif + endfor + endif + endif + if has_key(snippets, snippet_name) + let snippet = snippets[snippet_name] + if use_pipe_for_cursor + let snippet = substitute(snippet, '|', '${cursor}', 'g') + endif + let lines = split(snippet, "\n") + call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")') + let current.snippet = join(lines, "\n") + let current.name = '' + let current.snippet = substitute(current.snippet, ';', value . ';', '') + if use_pipe_for_cursor && len(value) > 0 + let current.snippet = substitute(current.snippet, '\${cursor}', '', 'g') + endif + if n < len(tokens) - 1 + let current.snippet .= "\n" + endif + endif + endif + + let current.pos = 0 + let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\S\+\)\s*,\s*\([^,]\+\)\s*,\s*\([^)]\+\)\s*)$') + if len(lg) == 0 + let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\S\+\)\s*,\s*\([^,]\+\)\s*)$') + if len(lg) + let [lg[1], lg[2], lg[3]] = ['linear', lg[1], lg[2]] + endif + endif + if len(lg) + let current.name = '' + let current.snippet = printf("background-image:-webkit-gradient(%s, 0 0, 0 100%, from(%s), to(%s));\n", lg[1], lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image:-webkit-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image:-moz-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image:-o-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image:linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + elseif prefix + let snippet = current.snippet + let current.snippet = '-webkit-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = '-moz-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = '-o-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = '-ms-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = snippet + call add(root.child, current) + elseif token =~# '^c#\([0-9a-fA-F]\{3}\|[0-9a-fA-F]\{6}\)\(\.[0-9]\+\)\?' + let cs = split(token, '\.') + let current.name = '' + let [r,g,b] = [0,0,0] + if len(cs[0]) == 5 + let rgb = matchlist(cs[0], 'c#\(.\)\(.\)\(.\)') + let r = eval('0x'.rgb[1].rgb[1]) + let g = eval('0x'.rgb[2].rgb[2]) + let b = eval('0x'.rgb[3].rgb[3]) + elseif len(cs[0]) == 8 + let rgb = matchlist(cs[0], 'c#\(..\)\(..\)\(..\)') + let r = eval('0x'.rgb[1]) + let g = eval('0x'.rgb[2]) + let b = eval('0x'.rgb[3]) + endif + if len(cs) == 1 + let current.snippet = printf('color:rgb(%d, %d, %d);', r, g, b) + else + let current.snippet = printf('color:rgb(%d, %d, %d, %s);', r, g, b, string(str2float('0.'.cs[1]))) + endif + call add(root.child, current) + elseif token =~# '^c#' + let current.name = '' + let current.snippet = 'color:\${cursor};' + call add(root.child, current) + else + call add(root.child, current) + endif + endfor + endif + return root +endfunction + +function! emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent) abort + let current = a:current + let value = current.value[1:-2] + let tmp = substitute(value, '\${cursor}', '', 'g') + if tmp !~ '.*{[ \t\r\n]*}$' + if emmet#useFilter(a:filters, 'fc') + let value = substitute(value, '\([^:]\+\):\([^;]*\)', '\1: \2', 'g') + else + let value = substitute(value, '\([^:]\+\):\([^;]*\)', '\1:\2', 'g') + endif + if current.important + let value = substitute(value, ';', ' !important;', '') + endif + endif + return value +endfunction + +function! emmet#lang#css#imageSize() abort + let img_region = emmet#util#searchRegion('{', '}') + if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region) + return + endif + let content = emmet#util#getContent(img_region) + let fn = matchstr(content, '\') + if len(node) + exe "normal ciw\='/* '.node.' */'\" + endif + endif + else + if line =~# mx + let space = substitute(matchstr(line, mx), mx, '\1', '') + let line = substitute(matchstr(line, mx), mx, '\2', '') + let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g') + else + let mx = '^\(\s*\)\(.*\)\s*$' + let line = substitute(line, mx, '\1/* \2 */', '') + endif + call setline('.', line) + endif +endfunction + +function! emmet#lang#css#balanceTag(flag) range abort + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let block = emmet#util#getVisualBlock() + if !emmet#util#regionIsValid(block) + if a:flag > 0 + let block = emmet#util#searchRegion('^', ';') + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endif + else + if a:flag > 0 + let content = emmet#util#getContent(block) + if content !~# '^{.*}$' + let block = emmet#util#searchRegion('{', '}') + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endif + else + let pos = searchpos('.*;', 'nW') + if pos[0] != 0 + call setpos('.', [0, pos[0], pos[1], 0]) + let block = emmet#util#searchRegion('^', ';') + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endif + endif + endif + if a:flag == -2 || a:flag == 2 + silent! exe 'normal! gv' + else + call setpos('.', curpos) + endif +endfunction + +function! emmet#lang#css#moveNextPrevItem(flag) abort + return emmet#lang#css#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#css#moveNextPrev(flag) abort + let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp') + if pos == 2 + startinsert! + else + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#css#splitJoinTag() abort + " nothing to do +endfunction + +function! emmet#lang#css#removeTag() abort + " nothing to do +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/elm.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/elm.vim new file mode 100644 index 0000000..2acde53 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/elm.vim @@ -0,0 +1,214 @@ +function! emmet#lang#elm#findTokens(str) abort + return emmet#lang#html#findTokens(a:str) +endfunction + +function! emmet#lang#elm#parseIntoTree(abbr, type) abort + let tree = emmet#lang#html#parseIntoTree(a:abbr, a:type) + if len(tree.child) < 2 | return tree | endif + + " Add ',' nodes between root elements. + let new_children = [] + for child in tree.child[0:-2] + let comma = emmet#newNode() + let comma.name = ',' + call add(new_children, child) + call add(new_children, comma) + endfor + call add(new_children, tree.child[-1]) + let tree.child = new_children + return tree +endfunction + +function! emmet#lang#elm#renderNode(node) + let elm_nodes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6' + \, 'div', 'p', 'hr', 'pre', 'blockquote' + \, 'span', 'a', 'code', 'em', 'strong', 'i', 'b', 'u', 'sub', 'sup', 'br' + \, 'ol', 'ul', 'li', 'dl', 'dt', 'dd' + \, 'img', 'iframe', 'canvas', 'math' + \, 'form', 'input', 'textarea', 'button', 'select', 'option' + \, 'section', 'nav', 'article', 'aside', 'header', 'footer', 'address', 'main_', 'body' + \, 'figure', 'figcaption' + \, 'table', 'caption', 'colgroup', 'col', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th' + \, 'fieldset', 'legend', 'label', 'datalist', 'optgroup', 'keygen', 'output', 'progress', 'meter' + \, 'audio', 'video', 'source', 'track' + \, 'embed', 'object', 'param' + \, 'ins', 'del' + \, 'small', 'cite', 'dfn', 'abbr', 'time', 'var', 'samp', 'kbd', 's', 'q' + \, 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'wbr' + \, 'details', 'summary', 'menuitem', 'menu'] + + if index(elm_nodes, a:node) >= 0 + return a:node + endif + return 'node "' . a:node . '"' +endfunction + +function! emmet#lang#elm#renderParam(param) + let elm_events = ["onClick", "onDoubleClick" + \, "onMouseDown", "onMouseUp" + \, "onMouseEnter", "onMouseLeave" + \, "onMouseOver", "onMouseOut" + \, "onInput", "onCheck", "onSubmit" + \, "onBlur", "onFocus" + \, "on", "onWithOptions", "Options", "defaultOptions" + \, "targetValue", "targetChecked", "keyCode"] + if index(elm_events, a:param) >= 0 + return a:param + endif + let elm_attributes = ["style", "map" , "class", "id", "title", "hidden" + \, "type", "type_", "value", "defaultValue", "checked", "placeholder", "selected" + \, "accept", "acceptCharset", "action", "autocomplete", "autofocus" + \, "disabled", "enctype", "formaction", "list", "maxlength", "minlength", "method", "multiple" + \, "name", "novalidate", "pattern", "readonly", "required", "size", "for", "form" + \, "max", "min", "step" + \, "cols", "rows", "wrap" + \, "href", "target", "download", "downloadAs", "hreflang", "media", "ping", "rel" + \, "ismap", "usemap", "shape", "coords" + \, "src", "height", "width", "alt" + \, "autoplay", "controls", "loop", "preload", "poster", "default", "kind", "srclang" + \, "sandbox", "seamless", "srcdoc" + \, "reversed", "start" + \, "align", "colspan", "rowspan", "headers", "scope" + \, "async", "charset", "content", "defer", "httpEquiv", "language", "scoped" + \, "accesskey", "contenteditable", "contextmenu", "dir", "draggable", "dropzone" + \, "itemprop", "lang", "spellcheck", "tabindex" + \, "challenge", "keytype" + \, "cite", "datetime", "pubdate", "manifest"] + + if index(elm_attributes, a:param) >= 0 + if a:param == 'type' + return 'type_' + endif + return a:param + endif + return 'attribute "' . a:param . '"' +endfunction + +function! emmet#lang#elm#toString(settings, current, type, inline, filters, itemno, indent) abort + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = emmet#getIndentation(type) + let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) + let str = '' + + " comma between items with *, eg. li*3 + if itemno > 0 + let str = ", " + endif + + let current_name = current.name + if dollar_expr + let current_name = substitute(current.name, '\$$', itemno+1, '') + endif + + if len(current.name) > 0 + " inserted root comma nodes + if current_name == ',' + return "\n, " + endif + let str .= emmet#lang#elm#renderNode(current_name) + let tmp = '' + for attr in emmet#util#unique(current.attrs_order + keys(current.attr)) + if !has_key(current.attr, attr) + continue + endif + let Val = current.attr[attr] + + let attr = emmet#lang#elm#renderParam(attr) + + if type(Val) == 2 && Val == function('emmet#types#true') + let tmp .= ', ' . attr . ' True' + else + if dollar_expr + while Val =~# '\$\([^#{]\|$\)' + let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + let valtmp = substitute(Val, '\${cursor}', '', '') + if attr ==# 'id' && len(valtmp) > 0 + let tmp .=', id "' . Val . '"' + elseif attr ==# 'class' && len(valtmp) > 0 + let tmp .= ', class "' . substitute(Val, ' ', '.', 'g') . '"' + else + let tmp .= ', ' . attr . ' "' . Val . '"' + endif + endif + endfor + + if ! len(tmp) + let str .= ' []' + else + let tmp = strpart(tmp, 2) + let str .= ' [ ' . tmp . ' ]' + endif + + " No children quit early + if len(current.child) == 0 && len(current.value) == 0 + "Place cursor in node with no value or children + let str .= ' [${cursor}]' + return str + endif + + let inner = '' + + " Parent contex text + if len(current.value) > 0 + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + " Text node + let text = child.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + let str .= '%' . current_name + let tmp = '' + for attr in emmet#util#unique(current.attrs_order + keys(current.attr)) + if !has_key(current.attr, attr) + continue + endif + let Val = current.attr[attr] + if type(Val) == 2 && Val == function('emmet#types#true') + if attribute_style ==# 'hash' + let tmp .= ' :' . attr . ' => true' + elseif attribute_style ==# 'html' + let tmp .= attr . '=true' + end + else + if dollar_expr + while Val =~# '\$\([^#{]\|$\)' + let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + let valtmp = substitute(Val, '\${cursor}', '', '') + if attr ==# 'id' && len(valtmp) > 0 + let str .= '#' . Val + elseif attr ==# 'class' && len(valtmp) > 0 + let str .= '.' . substitute(Val, ' ', '.', 'g') + else + if len(tmp) > 0 + if attribute_style ==# 'hash' + let tmp .= ',' + elseif attribute_style ==# 'html' + let tmp .= ' ' + endif + endif + if attribute_style ==# 'hash' + let tmp .= ' :' . attr . ' => "' . Val . '"' + elseif attribute_style ==# 'html' + let tmp .= attr . '="' . Val . '"' + end + endif + endif + endfor + if len(tmp) + if attribute_style ==# 'hash' + let str .= '{' . tmp . ' }' + elseif attribute_style ==# 'html' + let str .= '(' . tmp . ')' + end + endif + if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0 + let str .= '/' + endif + + let inner = '' + if len(current.value) > 0 + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for child in current.child + let inner .= emmet#toString(child, type, inline, filters, itemno, indent) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= "\n" . indent . inner + endif + else + let str = current.value[1:-2] + if dollar_expr + let str = substitute(str, '\%(\\\)\@\\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' + while len(attrs) > 0 + let match = matchstr(attrs, mx) + if len(match) ==# 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! emmet#lang#haml#toggleComment() abort + let line = getline('.') + let space = matchstr(line, '^\s*') + if line =~# '^\s*-#' + call setline('.', space . matchstr(line[len(space)+2:], '^\s*\zs.*')) + elseif line =~# '^\s*%[a-z]' + call setline('.', space . '-# ' . line[len(space):]) + endif +endfunction + +function! emmet#lang#haml#balanceTag(flag) range abort + let block = emmet#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !emmet#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze%[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! emmet#lang#haml#moveNextPrevItem(flag) abort + return emmet#lang#haml#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#haml#moveNextPrev(flag) abort + let pos = search('""', a:flag ? 'Wb' : 'W') + if pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#haml#splitJoinTag() abort + let n = line('.') + let sml = len(matchstr(getline(n), '^\s*%[a-z]')) + while n > 0 + if getline(n) =~# '^\s*\ze%[a-z]' + if len(matchstr(getline(n), '^\s*%[a-z]')) < sml + break + endif + let line = getline(n) + call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', '')) + let sn = n + let n += 1 + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + if len(matchstr(getline(n), '^\s*')) > ml + while n <= line('$') + let l = len(matchstr(getline(n), '^\s*')) + if l <= ml + break + endif + exe n 'delete' + endwhile + call setpos('.', [0, sn, 1, 0]) + else + let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)') + let spaces = matchstr(getline(sn), '^\s*') + let settings = emmet#getSettings() + if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1 + call append(sn, spaces . ' ') + call setpos('.', [0, sn+1, 1, 0]) + else + call setpos('.', [0, sn, 1, 0]) + endif + startinsert! + endif + break + endif + let n -= 1 + endwhile +endfunction + +function! emmet#lang#haml#removeTag() abort + let n = line('.') + let ml = 0 + while n > 0 + if getline(n) =~# '^\s*\ze[a-z]' + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + break + endif + let n -= 1 + endwhile + let sn = n + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + if sn == n + exe 'delete' + else + exe sn ',' (n-1) 'delete' + endif +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/html.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/html.vim new file mode 100644 index 0000000..cdf440b --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/html.vim @@ -0,0 +1,954 @@ +let s:bx = '{\%("[^"]*"\|''[^'']*''\|\$#\|\${\w\+}\|\$\+\|{[^{]\+\|[^{}]\)\{-}}' +let s:mx = '\([+>]\|[<^]\+\)\{-}\s*' +\ .'\((*\)\{-}\s*' +\ .'\([@#.]\{-}[a-zA-Z_\!][a-zA-Z0-9:_\!\-$]*\|' . s:bx . '\|\[[^\]]\+\]\)' +\ .'\(' +\ .'\%(' +\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)' +\ .'\|\%(\[\%("[^"]*"\|[^"\]]*\)\+\]\)' +\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)' +\ .'\)*' +\ .'\)' +\ .'\%(\(' . s:bx . '\+\)\)\{0,1}' +\ .'\%(\(@-\{0,1}[0-9]*\)\{0,1}\*\([0-9]\+\)\)\{0,1}' +\ .'\(\%()\%(\(@-\{0,1}[0-9]*\)\{0,1}\*[0-9]\+\)\{0,1}\)*\)' + +function! emmet#lang#html#findTokens(str) abort + let str = a:str + let [pos, last_pos] = [0, 0] + while 1 + let tag = matchstr(str, '<[a-zA-Z].\{-}>', pos) + if len(tag) == 0 + break + endif + let pos = stridx(str, tag, pos) + len(tag) + endwhile + while 1 + let tag = matchstr(str, '{%[^%]\{-}%}', pos) + if len(tag) == 0 + break + endif + let pos = stridx(str, tag, pos) + len(tag) + endwhile + let last_pos = pos + while len(str) > 0 + let token = matchstr(str, s:mx, pos) + if token ==# '' + break + endif + if token =~# '^\s' + let token = matchstr(token, '^\s*\zs.*') + let last_pos = stridx(str, token, pos) + endif + let pos = stridx(str, token, pos) + len(token) + endwhile + let str = a:str[last_pos :-1] + if str =~# '^\w\+="[^"]*$' + return '' + endif + return str +endfunction + +function! emmet#lang#html#parseIntoTree(abbr, type) abort + let abbr = a:abbr + let type = a:type + + let settings = emmet#getSettings() + if !has_key(settings, type) + let type = 'html' + endif + if len(type) == 0 | let type = 'html' | endif + + let indent = emmet#getIndentation(type) + let pmap = { + \'p': 'span', + \'ul': 'li', + \'ol': 'li', + \'table': 'tr', + \'tr': 'td', + \'tbody': 'tr', + \'thead': 'tr', + \'tfoot': 'tr', + \'colgroup': 'col', + \'select': 'option', + \'optgroup': 'option', + \'audio': 'source', + \'video': 'source', + \'object': 'param', + \'map': 'area' + \} + + let inlineLevel = split('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var',',') + + let custom_expands = emmet#getResource(type, 'custom_expands', {}) + if empty(custom_expands) && has_key(settings, 'custom_expands') + let custom_expands = settings['custom_expands'] + endif + + " try 'foo' to (foo-x) + let rabbr = emmet#getExpandos(type, abbr) + if rabbr == abbr + " try 'foo+(' to (foo-x) + let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".emmet#getExpandos(type, submatch(1)).")".submatch(2)', 'i') + endif + let abbr = rabbr + + let root = emmet#newNode() + let parent = root + let last = root + let pos = [] + while len(abbr) + " parse line + let match = matchstr(abbr, s:mx) + let str = substitute(match, s:mx, '\0', 'ig') + let operator = substitute(match, s:mx, '\1', 'ig') + let block_start = substitute(match, s:mx, '\2', 'ig') + let tag_name = substitute(match, s:mx, '\3', 'ig') + let attributes = substitute(match, s:mx, '\4', 'ig') + let value = substitute(match, s:mx, '\5', 'ig') + let basevalue = substitute(match, s:mx, '\6', 'ig') + let multiplier = 0 + substitute(match, s:mx, '\7', 'ig') + let block_end = substitute(match, s:mx, '\8', 'ig') + let custom = '' + let important = 0 + if len(str) == 0 + break + endif + if tag_name =~# '^#' + let attributes = tag_name . attributes + let tag_name = '' + endif + if tag_name =~# '[^!]!$' + let tag_name = tag_name[:-2] + let important = 1 + endif + if tag_name =~# '^\.' + let attributes = tag_name . attributes + let tag_name = '' + endif + if tag_name =~# '^\[.*\]$' + let attributes = tag_name . attributes + let tag_name = '' + endif + + for k in keys(custom_expands) + if tag_name =~ k + let custom = tag_name + let tag_name = '' + break + endif + endfor + + if empty(tag_name) + let pname = len(parent.child) > 0 ? parent.child[0].name : '' + if !empty(pname) && has_key(pmap, pname) + let tag_name = pmap[pname] + elseif !empty(pname) && index(inlineLevel, pname) > -1 + let tag_name = 'span' + elseif len(parent.child) == 0 || len(custom) == 0 + let tag_name = 'div' + else + let tag_name = custom + endif + endif + + let basedirect = basevalue[1] ==# '-' ? -1 : 1 + let basevalue = 0 + abs(basevalue[1:]) + if multiplier <= 0 | let multiplier = 1 | endif + + " make default node + let current = emmet#newNode() + + let current.name = tag_name + let current.important = important + + " aliases + let aliases = emmet#getResource(type, 'aliases', {}) + if has_key(aliases, tag_name) + let current.name = aliases[tag_name] + endif + + let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1) + + " snippets + let snippets = emmet#getResource(type, 'snippets', {}) + if !empty(snippets) + let snippet_name = tag_name + if has_key(snippets, snippet_name) + let snippet = snippet_name + while has_key(snippets, snippet) + let snippet = snippets[snippet] + endwhile + if use_pipe_for_cursor + let snippet = substitute(snippet, '|', '${cursor}', 'g') + endif + " just redirect to expanding + if type == 'html' && snippet !~ '^\s*[{\[<]' + return emmet#lang#html#parseIntoTree(snippet, a:type) + endif + let lines = split(snippet, "\n", 1) + call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")') + let current.snippet = join(lines, "\n") + let current.name = '' + endif + endif + + for k in keys(custom_expands) + if tag_name =~# k + let current.snippet = '${' . (empty(custom) ? tag_name : custom) . '}' + let current.name = '' + break + elseif custom =~# k + let current.snippet = '${' . custom . '}' + let current.name = '' + break + endif + endfor + + " default_attributes + let default_attributes = emmet#getResource(type, 'default_attributes', {}) + if !empty(default_attributes) + for pat in [current.name, tag_name] + if has_key(default_attributes, pat) + if type(default_attributes[pat]) == 4 + let a = default_attributes[pat] + let current.attrs_order += keys(a) + if use_pipe_for_cursor + for k in keys(a) + let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}' + endfor + else + for k in keys(a) + let current.attr[k] = a[k] + endfor + endif + else + for a in default_attributes[pat] + let current.attrs_order += keys(a) + if use_pipe_for_cursor + for k in keys(a) + let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}' + endfor + else + for k in keys(a) + let current.attr[k] = a[k] + endfor + endif + endfor + endif + if has_key(settings.html.default_attributes, current.name) + let current.name = substitute(current.name, ':.*$', '', '') + endif + break + endif + endfor + endif + + " parse attributes + if len(attributes) + let attr = attributes + while len(attr) + let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[\%("[^"]*"\|[^"\]]*\)\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)') + if g:emmet_debug > 1 + echomsg 'attr=' . item + endif + if len(item) == 0 + break + endif + if item[0] ==# '#' + let current.attr.id = item[1:] + endif + if item[0] ==# '.' + let current.attr.class = substitute(item[1:], '\.', ' ', 'g') + endif + if item[0] ==# '[' + let atts = item[1:-2] + if matchstr(atts, '^\s*\zs[0-9a-zA-Z_\-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') ==# '' + let ks = [] + if has_key(default_attributes, current.name) + let dfa = default_attributes[current.name] + let ks = type(dfa) == 3 ? keys(dfa[0]) : keys(dfa) + endif + if len(ks) == 0 && has_key(default_attributes, current.name . ':src') + let ks = keys(default_attributes[current.name . ':src']) + endif + if len(ks) > 0 + let current.attr[ks[0]] = atts + else + let current.attr[atts] = '' + endif + else + while len(atts) + let amat = matchstr(atts, '^\s*\zs\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\|[^ ''"\]]*\)\{0,1}\)') + if len(amat) == 0 + break + endif + let key = split(amat, '=')[0] + let Val = amat[len(key)+1:] + if key =~# '\.$' && Val ==# '' + let key = key[:-2] + unlet Val + let Val = function('emmet#types#true') + elseif Val =~# '^["'']' + let Val = Val[1:-2] + endif + let current.attr[key] = Val + if index(current.attrs_order, key) == -1 + let current.attrs_order += [key] + endif + let atts = atts[stridx(atts, amat) + len(amat):] + unlet Val + endwhile + endif + endif + let attr = substitute(strpart(attr, len(item)), '^\s*', '', '') + endwhile + endif + + " parse text + if tag_name =~# '^{.*}$' + let current.name = '' + let current.value = tag_name + else + let current.value = value + endif + let current.basedirect = basedirect + let current.basevalue = basevalue + let current.multiplier = multiplier + + " parse step inside/outside + if !empty(last) + if operator =~# '>' + unlet! parent + let parent = last + let current.parent = last + let current.pos = last.pos + 1 + else + let current.parent = parent + let current.pos = last.pos + endif + else + let current.parent = parent + let current.pos = 1 + endif + if operator =~# '[<^]' + for c in range(len(operator)) + let tmp = parent.parent + if empty(tmp) + break + endif + let parent = tmp + let current.parent = tmp + endfor + endif + + call add(parent.child, current) + let last = current + + " parse block + if block_start =~# '(' + if operator =~# '>' + let last.pos += 1 + endif + let last.block = 1 + for n in range(len(block_start)) + let pos += [last.pos] + endfor + endif + if block_end =~# ')' + for n in split(substitute(substitute(block_end, ' ', '', 'g'), ')', ',),', 'g'), ',') + if n ==# ')' + if len(pos) > 0 && last.pos >= pos[-1] + for c in range(last.pos - pos[-1]) + let tmp = parent.parent + if !has_key(tmp, 'parent') + break + endif + let parent = tmp + endfor + if len(pos) > 0 + call remove(pos, -1) + endif + let last = parent + let last.pos += 1 + endif + elseif len(n) + let st = 0 + for nc in range(len(last.child)) + if last.child[nc].block + let st = nc + break + endif + endfor + let cl = last.child[st :] + let cls = [] + for c in range(n[1:]) + for cc in cl + if cc.multiplier > 1 + let cc.basedirect = c + 1 + else + let cc.basevalue = c + 1 + endif + endfor + let cls += deepcopy(cl) + endfor + if st > 0 + let last.child = last.child[:st-1] + cls + else + let last.child = cls + endif + endif + endfor + endif + let abbr = abbr[stridx(abbr, match) + len(match):] + if abbr == '/' + let g:hoge = 1 + let current.empty = 1 + endif + + if g:emmet_debug > 1 + echomsg 'str='.str + echomsg 'block_start='.block_start + echomsg 'tag_name='.tag_name + echomsg 'operator='.operator + echomsg 'attributes='.attributes + echomsg 'value='.value + echomsg 'basevalue='.basevalue + echomsg 'multiplier='.multiplier + echomsg 'block_end='.block_end + echomsg 'abbr='.abbr + echomsg 'pos='.string(pos) + echomsg '---' + endif + endwhile + return root +endfunction + +function! s:dollar_add(base,no) abort + if a:base > 0 + return a:base + a:no - 1 + elseif a:base < 0 + return a:base - a:no + 1 + else + return a:no + endif +endfunction + +function! emmet#lang#html#toString(settings, current, type, inline, filters, itemno, indent) abort + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) + let q = emmet#getResource(type, 'quote_char', '"') + let ct = emmet#getResource(type, 'comment_type', 'both') + let an = emmet#getResource(type, 'attribute_name', {}) + let empty_element_suffix = emmet#getResource(type, 'empty_element_suffix', settings.html.empty_element_suffix) + + if emmet#useFilter(filters, 'haml') + return emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent) + endif + if emmet#useFilter(filters, 'slim') + return emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent) + endif + + let comment = '' + let current_name = current.name + if dollar_expr + let current_name = substitute(current_name, '\$$', itemno+1, '') + endif + + let str = '' + if len(current_name) == 0 + let text = current.value[1:-2] + if dollar_expr + " TODO: regexp engine specified + let nr = itemno + 1 + if exists('®expengine') + let text = substitute(text, '\%#=1\%(\\\)\@\ 0 + let str .= '<' . current_name + endif + for attr in emmet#util#unique(current.attrs_order + keys(current.attr)) + if !has_key(current.attr, attr) + continue + endif + let Val = current.attr[attr] + if type(Val) == 2 && Val == function('emmet#types#true') + unlet Val + let Val = 'true' + if g:emmet_html5 + let str .= ' ' . attr + else + let str .= ' ' . attr . '=' . q . attr . q + endif + if emmet#useFilter(filters, 'c') + if attr ==# 'id' | let comment .= '#' . Val | endif + if attr ==# 'class' | let comment .= '.' . Val | endif + endif + else + if dollar_expr + while Val =~# '\$\([^#{]\|$\)' + " TODO: regexp engine specified + if exists('®expengine') + let Val = substitute(Val, '\%#=1\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + else + let Val = substitute(Val, '\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endif + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + if attr ==# 'class' && emmet#useFilter(filters, 'bem') + let vals = split(Val, '\s\+') + let Val = '' + let lead = '' + for _val in vals + if len(Val) > 0 + let Val .= ' ' + endif + if _val =~# '^_' + if has_key(current.parent.attr, 'class') + let lead = current.parent.attr["class"] + if _val =~# '^__' + let Val .= lead . _val + else + let Val .= lead . ' ' . lead . _val + endif + else + let lead = split(vals[0], '_')[0] + let Val .= lead . _val + endif + elseif _val =~# '^-' + for l in split(_val, '_') + if len(Val) > 0 + let Val .= ' ' + endif + let l = substitute(l, '^-', '__', '') + if len(lead) == 0 + let pattr = current.parent.attr + if has_key(pattr, 'class') + let lead = split(pattr['class'], '\s\+')[0] + endif + endif + let Val .= lead . l + let lead .= l . '_' + endfor + else + let Val .= _val + endif + endfor + endif + if has_key(an, attr) + let attr = an[attr] + endif + if emmet#isExtends(type, 'jsx') && Val =~ '^{.*}$' + let str .= ' ' . attr . '=' . Val + else + let str .= ' ' . attr . '=' . q . Val . q + endif + if emmet#useFilter(filters, 'c') + if attr ==# 'id' | let comment .= '#' . Val | endif + if attr ==# 'class' | let comment .= '.' . Val | endif + endif + endif + unlet Val + endfor + if len(comment) > 0 && ct ==# 'both' + let str = '\n" . str + endif + if current.empty + let str .= ' />' + elseif stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 + let str .= empty_element_suffix + else + let str .= '>' + let text = current.value[1:-2] + if dollar_expr + " TODO: regexp engine specified + let nr = itemno + 1 + if exists('®expengine') + let text = substitute(text, '\%#=1\%(\\\)\@\ 0 + for n in range(nc) + let child = current.child[n] + if child.multiplier > 1 + let str .= "\n" . indent + let dr = 1 + elseif len(current_name) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1 + if nc > 1 || (len(child.name) > 0 && stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1) + let str .= "\n" . indent + let dr = 1 + elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0 + let str .= "\n" . indent + let dr = 1 + endif + endif + let inner = emmet#toString(child, type, 0, filters, itemno, indent) + let inner = substitute(inner, "^\n", '', 'g') + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= inner + endfor + else + if settings.html.indent_blockelement && len(current_name) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1 + let str .= "\n" . indent . '${cursor}' . "\n" + else + let str .= '${cursor}' + endif + endif + if dr + let str .= "\n" + endif + let str .= '' + endif + if len(comment) > 0 + if ct ==# 'lastonly' + let str .= '' + else + let str .= "\n' + endif + endif + if len(current_name) > 0 && current.multiplier > 0 || stridx(','.settings.html.block_elements.',', ','.current_name.',') != -1 + let str .= "\n" + endif + return str +endfunction + +function! emmet#lang#html#imageSize() abort + let img_region = emmet#util#searchRegion('') + if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region) + return + endif + let content = emmet#util#getContent(img_region) + if content !~# '^<]\+>$' + return + endif + let current = emmet#lang#html#parseTag(content) + if empty(current) || !has_key(current.attr, 'src') + return + endif + let fn = current.attr.src + if fn =~# '^\s*$' + return + elseif fn !~# '^\(/\|http\)' + let fn = simplify(expand('%:h') . '/' . fn) + endif + + let [width, height] = emmet#util#getImageSize(fn) + if width == -1 && height == -1 + return + endif + let current.attr.width = width + let current.attr.height = height + let current.attrs_order += ['width', 'height'] + let html = substitute(emmet#toString(current, 'html', 1), '\n', '', '') + let html = substitute(html, '\${cursor}', '', '') + call emmet#util#setContent(img_region, html) +endfunction + +function! emmet#lang#html#encodeImage() abort + let img_region = emmet#util#searchRegion('') + if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region) + return + endif + let content = emmet#util#getContent(img_region) + if content !~# '^<]\+>$' + return + endif + let current = emmet#lang#html#parseTag(content) + if empty(current) || !has_key(current.attr, 'src') + return + endif + let fn = current.attr.src + if fn !~# '^\(/\|http\)' + let fn = simplify(expand('%:h') . '/' . fn) + endif + + let [width, height] = emmet#util#getImageSize(fn) + if width == -1 && height == -1 + return + endif + let current.attr.width = width + let current.attr.height = height + let html = emmet#toString(current, 'html', 1) + call emmet#util#setContent(img_region, html) +endfunction + +function! emmet#lang#html#parseTag(tag) abort + let current = emmet#newNode() + let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>' + let match = matchstr(a:tag, mx) + let current.name = substitute(match, mx, '\1', 'i') + let attrs = substitute(match, mx, '\2', 'i') + let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' + while len(attrs) > 0 + let match = matchstr(attrs, mx) + if len(match) == 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! emmet#lang#html#toggleComment() abort + let orgpos = getpos('.') + let curpos = getpos('.') + let mx = '<\%#[^>]*>' + while 1 + let block = emmet#util#searchRegion('') + if emmet#util#regionIsValid(block) + let block[1][1] += 2 + let content = emmet#util#getContent(block) + let content = substitute(content, '^$', '\1', '') + call emmet#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + let block = emmet#util#searchRegion('<[^>]', '>') + if !emmet#util#regionIsValid(block) + let pos1 = searchpos('<', 'bcW') + if pos1[0] == 0 && pos1[1] == 0 + return + endif + let curpos = getpos('.') + continue + endif + let pos1 = block[0] + let pos2 = block[1] + let content = emmet#util#getContent(block) + let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+') + if tag_name[0] ==# '/' + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpairpos('<'. tag_name[1:] . '\>[^>]*>', '', '', 'bnW') + let pos1 = searchpos('>', 'cneW') + let block = [pos2, pos1] + elseif tag_name =~# '/$' + if !emmet#util#pointInRegion(orgpos[1:2], block) + " it's broken tree + call setpos('.', orgpos) + let block = emmet#util#searchRegion('>', '<') + let content = '><' + call emmet#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + else + call setpos('.', [0, pos2[0], pos2[1], 0]) + let pos3 = searchpairpos('<'. tag_name . '\>[^>]*>', '', '', 'nW') + if pos3 == [0, 0] + let block = [pos1, pos2] + else + call setpos('.', [0, pos3[0], pos3[1], 0]) + let pos2 = searchpos('>', 'neW') + let block = [pos1, pos2] + endif + endif + if !emmet#util#regionIsValid(block) + silent! call setpos('.', orgpos) + return + endif + if emmet#util#pointInRegion(curpos[1:2], block) + let content = '' + call emmet#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + endwhile +endfunction + +function! emmet#lang#html#balanceTag(flag) range abort + let vblock = emmet#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let settings = emmet#getSettings() + + if a:flag > 0 + let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*' + let last = curpos[1:2] + while 1 + let pos1 = searchpos(mx, 'bW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze') + if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1 + let pos2 = searchpos('>', 'nW') + else + let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '', 'nW') + endif + let block = [pos1, pos2] + if pos1[0] == 0 && pos1[1] == 0 + break + endif + if emmet#util#pointInRegion(last, block) && emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + if pos1 == last + break + endif + let last = pos1 + endwhile + else + let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + while 1 + let pos1 = searchpos(mx, 'W') + if pos1 == curpos[1:2] + let pos1 = searchpos(mx . '\zs', 'W') + let pos2 = searchpos('.\ze<', 'W') + let block = [pos1, pos2] + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endif + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze') + if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1 + let pos2 = searchpos('>', 'nW') + else + let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '', 'nW') + endif + let block = [pos1, pos2] + if pos1[0] == 0 && pos1[1] == 0 + break + endif + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endwhile + endif + if a:flag == -2 || a:flag == 2 + silent! exe 'normal! gv' + else + call setpos('.', curpos) + endif +endfunction + +function! emmet#lang#html#moveNextPrevItem(flag) abort + silent! exe "normal \" + let mx = '\%([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''">\]]*\)\{0,1}\)' + let pos = searchpos('\s'.mx.'\zs', '') + if pos != [0,0] + call feedkeys('v?\s\zs'.mx."\", '') + endif +endfunction + +function! emmet#lang#html#moveNextPrev(flag) abort + let pos = search('\%(<\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp') + if pos == 3 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#html#splitJoinTag() abort + let curpos = emmet#util#getcurpos() + while 1 + let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + let pos1 = searchpos(mx, 'bcnW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '') + let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]] + if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block) + let content = substitute(content[:-3], '\s*$', '', '') . '>' + call emmet#util#setContent(block, content) + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if tag_name[0] ==# '/' + let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW') + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpos('', 'cneW') + else + let pos2 = searchpos('', 'cneW') + endif + let block = [pos1, pos2] + let content = emmet#util#getContent(block) + if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>' + let content = matchstr(content, mx)[:-2] . ' />' + call emmet#util#setContent(block, content) + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if block[0][0] > 0 + call setpos('.', [0, block[0][0]-1, block[0][1], 0]) + else + call setpos('.', curpos) + return + endif + endif + endif + endwhile +endfunction + +function! emmet#lang#html#removeTag() abort + let curpos = emmet#util#getcurpos() + while 1 + let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*' + let pos1 = searchpos(mx, 'bcnW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = matchstr(content, '^<\zs/\{0,1}[a-zA-Z0-9:_\-]*') + let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]] + if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block) + call emmet#util#setContent(block, '') + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if tag_name[0] ==# '/' + let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW') + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpos('', 'cneW') + else + let pos2 = searchpos('', 'cneW') + endif + let block = [pos1, pos2] + let content = emmet#util#getContent(block) + if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '^<' . tag_name . '[^a-zA-Z0-9]' + call emmet#util#setContent(block, '') + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if block[0][0] > 0 + call setpos('.', [0, block[0][0]-1, block[0][1], 0]) + else + call setpos('.', curpos) + return + endif + endif + endif + endwhile +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/jade.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/jade.vim new file mode 100644 index 0000000..06454a0 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/jade.vim @@ -0,0 +1,331 @@ +function! emmet#lang#jade#findTokens(str) abort + return emmet#lang#html#findTokens(a:str) +endfunction + +function! emmet#lang#jade#parseIntoTree(abbr, type) abort + return emmet#lang#html#parseIntoTree(a:abbr, a:type) +endfunction + +function! emmet#lang#jade#toString(settings, current, type, inline, filters, itemno, indent) abort + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = emmet#getIndentation(type) + let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) + let attribute_style = emmet#getResource('jade', 'attribute_style', 'hash') + let str = '' + + let current_name = current.name + if dollar_expr + let current_name = substitute(current.name, '\$$', itemno+1, '') + endif + if len(current.name) > 0 + let str .= '' . current_name + let tmp = '' + for attr in emmet#util#unique(current.attrs_order + keys(current.attr)) + if !has_key(current.attr, attr) + continue + endif + let Val = current.attr[attr] + if type(Val) == 2 && Val == function('emmet#types#true') + if attribute_style ==# 'hash' + let tmp .= ' ' . attr . ' = true' + elseif attribute_style ==# 'html' + let tmp .= attr . '=true' + end + else + if dollar_expr + while Val =~# '\$\([^#{]\|$\)' + let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + let valtmp = substitute(Val, '\${cursor}', '', '') + if attr ==# 'id' && len(valtmp) > 0 + let str .= '#' . Val + elseif attr ==# 'class' && len(valtmp) > 0 + let str .= '.' . substitute(Val, ' ', '.', 'g') + else + if len(tmp) > 0 + if attribute_style ==# 'hash' + let tmp .= ', ' + elseif attribute_style ==# 'html' + let tmp .= ' ' + endif + endif + if attribute_style ==# 'hash' + let tmp .= '' . attr . '="' . Val . '"' + elseif attribute_style ==# 'html' + let tmp .= attr . '="' . Val . '"' + end + endif + endif + endfor + if len(tmp) + if attribute_style ==# 'hash' + let str .= '(' . tmp . ')' + elseif attribute_style ==# 'html' + let str .= '(' . tmp . ')' + end + endif + + let inner = '' + if len(current.value) > 0 + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for child in current.child + let inner .= emmet#toString(child, type, inline, filters, itemno, indent) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= "\n" . indent . inner + endif + else + let str = current.value[1:-2] + if dollar_expr + let str = substitute(str, '\%(\\\)\@\\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' + while len(attrs) > 0 + let match = matchstr(attrs, mx) + if len(match) ==# 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! emmet#lang#jade#toggleComment() abort + let line = getline('.') + let space = matchstr(line, '^\s*') + if line =~# '^\s*-#' + call setline('.', space . matchstr(line[len(space)+2:], '^\s*\zs.*')) + elseif line =~# '^\s*%[a-z]' + call setline('.', space . '-# ' . line[len(space):]) + endif +endfunction + +function! emmet#lang#jade#balanceTag(flag) range abort + let block = emmet#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !emmet#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze%[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! emmet#lang#jade#moveNextPrevItem(flag) abort + return emmet#lang#jade#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#jade#moveNextPrev(flag) abort + let pos = search('""', a:flag ? 'Wb' : 'W') + if pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#jade#splitJoinTag() abort + let n = line('.') + let sml = len(matchstr(getline(n), '^\s*%[a-z]')) + while n > 0 + if getline(n) =~# '^\s*\ze%[a-z]' + if len(matchstr(getline(n), '^\s*%[a-z]')) < sml + break + endif + let line = getline(n) + call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', '')) + let sn = n + let n += 1 + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + if len(matchstr(getline(n), '^\s*')) > ml + while n <= line('$') + let l = len(matchstr(getline(n), '^\s*')) + if l <= ml + break + endif + exe n 'delete' + endwhile + call setpos('.', [0, sn, 1, 0]) + else + let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)') + let spaces = matchstr(getline(sn), '^\s*') + let settings = emmet#getSettings() + if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1 + call append(sn, spaces . ' ') + call setpos('.', [0, sn+1, 1, 0]) + else + call setpos('.', [0, sn, 1, 0]) + endif + startinsert! + endif + break + endif + let n -= 1 + endwhile +endfunction + +function! emmet#lang#jade#removeTag() abort + let n = line('.') + let ml = 0 + while n > 0 + if getline(n) =~# '^\s*\ze[a-z]' + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + break + endif + let n -= 1 + endwhile + let sn = n + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + if sn == n + exe 'delete' + else + exe sn ',' (n-1) 'delete' + endif +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/less.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/less.vim new file mode 100644 index 0000000..25308a0 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/less.vim @@ -0,0 +1,47 @@ +function! emmet#lang#less#findTokens(str) abort + return emmet#lang#html#findTokens(a:str) +endfunction + +function! emmet#lang#less#parseIntoTree(abbr, type) abort + return emmet#lang#scss#parseIntoTree(a:abbr, a:type) +endfunction + +function! emmet#lang#less#toString(settings, current, type, inline, filters, itemno, indent) abort + return emmet#lang#scss#toString(a:settings, a:current, a:type, a:inline, a:filters, a:itemno, a:indent) +endfunction + +function! emmet#lang#less#imageSize() abort + call emmet#lang#css#imageSize() +endfunction + +function! emmet#lang#less#encodeImage() abort + return emmet#lang#css#encodeImage() +endfunction + +function! emmet#lang#less#parseTag(tag) abort + return emmet#lang#css#parseTag(a:tag) +endfunction + +function! emmet#lang#less#toggleComment() abort + call emmet#lang#css#toggleComment() +endfunction + +function! emmet#lang#less#balanceTag(flag) range abort + call emmet#lang#scss#balanceTag(a:flag) +endfunction + +function! emmet#lang#less#moveNextPrevItem(flag) abort + return emmet#lang#less#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#less#moveNextPrev(flag) abort + call emmet#lang#scss#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#less#splitJoinTag() abort + call emmet#lang#css#splitJoinTag() +endfunction + +function! emmet#lang#less#removeTag() abort + call emmet#lang#css#removeTag() +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/sass.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/sass.vim new file mode 100644 index 0000000..07677cf --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/sass.vim @@ -0,0 +1,160 @@ +function! emmet#lang#sass#findTokens(str) abort + return emmet#lang#css#findTokens(a:str) +endfunction + +function! emmet#lang#sass#parseIntoTree(abbr, type) abort + return emmet#lang#css#parseIntoTree(a:abbr, a:type) +endfunction + +function! emmet#lang#sass#toString(settings, current, type, inline, filters, itemno, indent) abort + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let str = '' + + let current_name = current.name + let current_name = substitute(current.name, '\$$', itemno+1, '') + if len(current.name) > 0 + let str .= current_name + let tmp = '' + for attr in keys(current.attr) + let val = current.attr[attr] + while val =~# '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + if attr ==# 'id' + let str .= '#' . val + elseif attr ==# 'class' + let str .= '.' . val + else + let tmp .= attr . ': ' . val + endif + endfor + if len(tmp) > 0 + let str .= "\n" + for line in split(tmp, "\n") + let str .= indent . line . "\n" + endfor + else + let str .= "\n" + endif + + let inner = '' + for child in current.child + let tmp = emmet#toString(child, type, inline, filters, itemno, indent) + let tmp = substitute(tmp, "\n", "\n" . escape(indent, '\'), 'g') + let tmp = substitute(tmp, "\n" . escape(indent, '\') . '$', '${cursor}\n', 'g') + let inner .= tmp + endfor + if len(inner) > 0 + let str .= indent . inner + endif + else + let text = emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent) + let text = substitute(text, '\s*;\ze\(\${[^}]\+}\)\?\(\n\|$\)', '', 'g') + return text + endif + return str +endfunction + +function! emmet#lang#sass#imageSize() abort +endfunction + +function! emmet#lang#sass#encodeImage() abort +endfunction + +function! emmet#lang#sass#parseTag(tag) abort +endfunction + +function! emmet#lang#sass#toggleComment() abort +endfunction + +function! emmet#lang#sass#balanceTag(flag) range abort + let block = emmet#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !emmet#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! emmet#lang#sass#moveNextPrevItem(flag) abort + return emmet#lang#sass#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#sass#moveNextPrev(flag) abort + let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp') + if pos == 2 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#sass#splitJoinTag() abort +endfunction + +function! emmet#lang#sass#removeTag() abort +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/scss.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/scss.vim new file mode 100644 index 0000000..12a8aeb --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/scss.vim @@ -0,0 +1,125 @@ +function! emmet#lang#scss#findTokens(str) abort + return emmet#lang#css#findTokens(a:str) +endfunction + +function! emmet#lang#scss#parseIntoTree(abbr, type) abort + if a:abbr =~# '>' + return emmet#lang#html#parseIntoTree(a:abbr, a:type) + else + return emmet#lang#css#parseIntoTree(a:abbr, a:type) + endif +endfunction + +function! emmet#lang#scss#toString(settings, current, type, inline, filters, itemno, indent) abort + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let str = '' + + let current_name = substitute(current.name, '\$$', itemno+1, '') + if len(current.name) > 0 + let str .= current_name + let tmp = '' + for attr in keys(current.attr) + let val = current.attr[attr] + while val =~# '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + if attr ==# 'id' + let str .= '#' . val + elseif attr ==# 'class' + let str .= '.' . val + else + let tmp .= attr . ': ' . val . ';' + endif + endfor + if len(tmp) > 0 + let str .= " {\n" + for line in split(tmp, "\n") + let str .= indent . line . "\n" + endfor + else + let str .= " {\n" + endif + + let inner = '' + for child in current.child + let inner .= emmet#toString(child, type, inline, filters, itemno) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= indent . inner . "${cursor}\n}\n" + else + return emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent) + endif + return str +endfunction + +function! emmet#lang#scss#imageSize() abort + call emmet#lang#css#imageSize() +endfunction + +function! emmet#lang#scss#encodeImage() abort + return emmet#lang#css#encodeImage() +endfunction + +function! emmet#lang#scss#parseTag(tag) abort + return emmet#lang#css#parseTag(a:tag) +endfunction + +function! emmet#lang#scss#toggleComment() abort + call emmet#lang#css#toggleComment() +endfunction + +function! emmet#lang#scss#balanceTag(flag) range abort + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + call setpos('.', curpos) + else + let curpos = emmet#util#getcurpos() + endif + if a:flag < 0 + let ret = searchpair('}', '', '.\zs{') + else + let ret = searchpair('{', '', '}', 'bW') + endif + if ret > 0 + let pos1 = emmet#util#getcurpos()[1:2] + if a:flag < 0 + let pos2 = searchpairpos('{', '', '}') + else + let pos2 = searchpairpos('{', '', '}') + endif + let block = [pos1, pos2] + if emmet#util#regionIsValid(block) + call emmet#util#selectRegion(block) + return + endif + endif + if a:flag == -2 || a:flag == 2 + silent! exe 'normal! gv' + else + call setpos('.', curpos) + endif +endfunction + +function! emmet#lang#scss#moveNextPrevItem(flag) abort + return emmet#lang#scss#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#scss#moveNextPrev(flag) abort + call emmet#lang#css#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#scss#splitJoinTag() abort + call emmet#lang#css#splitJoinTag() +endfunction + +function! emmet#lang#scss#removeTag() abort + call emmet#lang#css#removeTag() +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/slim.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/slim.vim new file mode 100644 index 0000000..d57bf1f --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lang/slim.vim @@ -0,0 +1,281 @@ +function! emmet#lang#slim#findTokens(str) abort + return emmet#lang#html#findTokens(a:str) +endfunction + +function! emmet#lang#slim#parseIntoTree(abbr, type) abort + return emmet#lang#html#parseIntoTree(a:abbr, a:type) +endfunction + +function! emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent) abort + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = emmet#getIndentation(type) + let dollar_expr = emmet#getResource(type, 'dollar_expr', 1) + let str = '' + + let current_name = current.name + if dollar_expr + let current_name = substitute(current.name, '\$$', itemno+1, '') + endif + if len(current.name) > 0 + let str .= current_name + for attr in emmet#util#unique(current.attrs_order + keys(current.attr)) + if !has_key(current.attr, attr) + continue + endif + let Val = current.attr[attr] + if type(Val) == 2 && Val == function('emmet#types#true') + let str .= ' ' . attr . '=true' + else + if dollar_expr + while Val =~# '\$\([^#{]\|$\)' + let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + endif + let attr = substitute(attr, '\$$', itemno+1, '') + let str .= ' ' . attr . '="' . Val . '"' + endif + endfor + + let inner = '' + if len(current.value) > 0 + let str .= "\n" + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for child in current.child + let inner .= emmet#toString(child, type, inline, filters, itemno, indent) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= "\n" . indent . inner + endif + else + let str = current.value[1:-2] + if dollar_expr + let str = substitute(str, '\%(\\\)\@\ 0 + let match = matchstr(attrs, mx) + if len(match) == 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! emmet#lang#slim#toggleComment() abort + let line = getline('.') + let space = matchstr(line, '^\s*') + if line =~# '^\s*/' + call setline('.', space . line[len(space)+1:]) + elseif line =~# '^\s*[a-z]' + call setline('.', space . '/' . line[len(space):]) + endif +endfunction + +function! emmet#lang#slim#balanceTag(flag) range abort + let block = emmet#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = emmet#util#getcurpos() + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !emmet#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! emmet#lang#slim#moveNextPrevItem(flag) abort + return emmet#lang#slim#moveNextPrev(a:flag) +endfunction + +function! emmet#lang#slim#moveNextPrev(flag) abort + let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp') + if pos == 2 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! emmet#lang#slim#splitJoinTag() abort + let n = line('.') + while n > 0 + if getline(n) =~# '^\s*\ze[a-z]' + let sn = n + let n += 1 + if getline(n) =~# '^\s*|' + while n <= line('$') + if getline(n) !~# '^\s*|' + break + endif + exe n 'delete' + endwhile + call setpos('.', [0, sn, 1, 0]) + else + let spaces = matchstr(getline(sn), '^\s*') + call append(sn, spaces . ' | ') + call setpos('.', [0, sn+1, 1, 0]) + startinsert! + endif + break + endif + let n -= 1 + endwhile +endfunction + +function! emmet#lang#slim#removeTag() abort + let n = line('.') + let ml = 0 + while n > 0 + if getline(n) =~# '^\s*\ze[a-z]' + let ml = len(matchstr(getline(n), '^\s*[a-z]')) + break + endif + let n -= 1 + endwhile + let sn = n + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + if sn == n + exe 'delete' + else + exe sn ',' (n-1) 'delete' + endif +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/en.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/en.vim new file mode 100644 index 0000000..30713e4 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/en.vim @@ -0,0 +1,65 @@ +function! emmet#lorem#en#expand(command) abort + let wcount = matchstr(a:command, '\(\d*\)$') + let wcount = wcount > 0 ? wcount : 30 + + let common = ['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit'] + let words = ['exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet', + \ 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi', + \ 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi', + \ 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos', + \ 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum', + \ 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus', + \ 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus', + \ 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum', + \ 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem', + \ 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus', + \ 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente', + \ 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet', + \ 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta', + \ 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima', + \ 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim', + \ 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores', + \ 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias', + \ 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea', + \ 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt', + \ 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate', + \ 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius', + \ 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos', + \ 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore', + \ 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo', + \ 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi', + \ 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam', + \ 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique', + \ 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere', + \ 'maxime', 'corrupti'] + let ret = [] + let sentence = 0 + for i in range(wcount) + let arr = common + if sentence > 0 + let arr += words + endif + let r = emmet#util#rand() + let word = arr[r % len(arr)] + if sentence == 0 + let word = substitute(word, '^.', '\U&', '') + endif + let sentence += 1 + call add(ret, word) + if (sentence > 5 && emmet#util#rand() < 10000) || i == wcount - 1 + if i == wcount - 1 + let endc = '?!...'[emmet#util#rand() % 5] + call add(ret, endc) + else + let endc = '?!,...'[emmet#util#rand() % 6] + call add(ret, endc . ' ') + endif + if endc !=# ',' + let sentence = 0 + endif + else + call add(ret, ' ') + endif + endfor + return join(ret, '') +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/ja.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/ja.vim new file mode 100644 index 0000000..f99d8fa --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/lorem/ja.vim @@ -0,0 +1,27 @@ +scriptencoding utf-8 + +function! emmet#lorem#ja#expand(command) abort + let wcount = matchstr(a:command, '^\%(lorem\|lipsum\)\(\d*\)}$', '\1', '') + let wcount = wcount > 0 ? wcount : 30 + + let url = "http://www.aozora.gr.jp/cards/000081/files/470_15407.html" + let content = emmet#util#cache(url) + if len(content) == 0 + let content = emmet#util#getContentFromURL(url) + let content = matchstr(content, ']*>\zs.\{-}

    ') + let content = substitute(content, '[ \r]', '', 'g') + let content = substitute(content, ']*>', "\n", 'g') + let content = substitute(content, '<[^>]\+>', '', 'g') + let content = join(filter(split(content, "\n"), 'len(v:val)>0'), "\n") + call emmet#util#cache(url, content) + endif + + let content = substitute(content, "ã€\n", "ã€", "g") + let clines = split(content, '\n') + let lines = filter(clines, 'len(substitute(v:val,".",".","g"))<=wcount') + if len(lines) == 0 + let lines = clines + endif + let r = emmet#util#rand() + return lines[r % len(lines)] +endfunction diff --git a/vim-plugins/bundle/emmet-vim/autoload/emmet/util.vim b/vim-plugins/bundle/emmet-vim/autoload/emmet/util.vim new file mode 100644 index 0000000..9a5b8d3 --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/autoload/emmet/util.vim @@ -0,0 +1,349 @@ +"============================================================================== +" region utils +"============================================================================== +" deleteContent : delete content in region +" if region make from between '' and '' +" -------------------- +" begin: +" :end +" -------------------- +" this function make the content as following +" -------------------- +" begin::end +" -------------------- +function! emmet#util#deleteContent(region) abort + let lines = getline(a:region[0][0], a:region[1][0]) + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) + silent! exe 'delete '.(a:region[1][0] - a:region[0][0]) + call setline(line('.'), lines[0][:a:region[0][1]-2] . lines[-1][a:region[1][1]]) +endfunction + +" change_content : change content in region +" if region make from between '' and '' +" -------------------- +" begin: +" :end +" -------------------- +" and content is +" -------------------- +" foo +" bar +" baz +" -------------------- +" this function make the content as following +" -------------------- +" begin:foo +" bar +" baz:end +" -------------------- +function! emmet#util#setContent(region, content) abort + let newlines = split(a:content, '\n', 1) + let oldlines = getline(a:region[0][0], a:region[1][0]) + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) + silent! exe 'delete '.(a:region[1][0] - a:region[0][0]) + if len(newlines) == 0 + let tmp = '' + if a:region[0][1] > 1 + let tmp = oldlines[0][:a:region[0][1]-2] + endif + if a:region[1][1] >= 1 + let tmp .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), tmp) + elseif len(newlines) == 1 + if a:region[0][1] > 1 + let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0] + endif + if a:region[1][1] >= 1 + let newlines[0] .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), newlines[0]) + else + if a:region[0][1] > 1 + let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0] + endif + if a:region[1][1] >= 1 + let newlines[-1] .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), newlines[0]) + call append(line('.'), newlines[1:]) + endif +endfunction + +" select_region : select region +" this function make a selection of region +function! emmet#util#selectRegion(region) abort + call setpos('.', [0, a:region[1][0], a:region[1][1], 0]) + normal! v + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) +endfunction + +" point_in_region : check point is in the region +" this function return 0 or 1 +function! emmet#util#pointInRegion(point, region) abort + if !emmet#util#regionIsValid(a:region) | return 0 | endif + if a:region[0][0] > a:point[0] | return 0 | endif + if a:region[1][0] < a:point[0] | return 0 | endif + if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif + if a:region[1][0] == a:point[0] && a:region[1][1] < a:point[1] | return 0 | endif + return 1 +endfunction + +" cursor_in_region : check cursor is in the region +" this function return 0 or 1 +function! emmet#util#cursorInRegion(region) abort + if !emmet#util#regionIsValid(a:region) | return 0 | endif + let cur = emmet#util#getcurpos()[1:2] + return emmet#util#pointInRegion(cur, a:region) +endfunction + +" region_is_valid : check region is valid +" this function return 0 or 1 +function! emmet#util#regionIsValid(region) abort + if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif + return 1 +endfunction + +" search_region : make region from pattern which is composing start/end +" this function return array of position +function! emmet#util#searchRegion(start, end) abort + let b = searchpairpos(a:start, '', a:end, 'bcnW') + if b == [0, 0] + return [searchpairpos(a:start, '', a:end, 'bnW'), searchpairpos(a:start, '\%#', a:end, 'nW')] + else + return [b, searchpairpos(a:start, '', a:end. '', 'nW')] + endif +endfunction + +" get_content : get content in region +" this function return string in region +function! emmet#util#getContent(region) abort + if !emmet#util#regionIsValid(a:region) + return '' + endif + let lines = getline(a:region[0][0], a:region[1][0]) + if a:region[0][0] == a:region[1][0] + let lines[0] = lines[0][a:region[0][1]-1:a:region[1][1]-1] + else + let lines[0] = lines[0][a:region[0][1]-1:] + let lines[-1] = lines[-1][:a:region[1][1]-1] + endif + return join(lines, "\n") +endfunction + +" region_in_region : check region is in the region +" this function return 0 or 1 +function! emmet#util#regionInRegion(outer, inner) abort + if !emmet#util#regionIsValid(a:inner) || !emmet#util#regionIsValid(a:outer) + return 0 + endif + return emmet#util#pointInRegion(a:inner[0], a:outer) && emmet#util#pointInRegion(a:inner[1], a:outer) +endfunction + +" get_visualblock : get region of visual block +" this function return region of visual block +function! emmet#util#getVisualBlock() abort + return [[line("'<"), col("'<")], [line("'>"), col("'>")]] +endfunction + +"============================================================================== +" html utils +"============================================================================== +function! emmet#util#getContentFromURL(url) abort + let res = system(printf('%s -i %s', g:emmet_curl_command, shellescape(substitute(a:url, '#.*', '', '')))) + while res =~# '^HTTP/1.\d 3' || res =~# '^HTTP/1\.\d 200 Connection established' || res =~# '^HTTP/1\.\d 100 Continue' + let pos = stridx(res, "\r\n\r\n") + if pos != -1 + let res = strpart(res, pos+4) + else + let pos = stridx(res, "\n\n") + let res = strpart(res, pos+2) + endif + endwhile + let pos = stridx(res, "\r\n\r\n") + if pos != -1 + let content = strpart(res, pos+4) + else + let pos = stridx(res, "\n\n") + let content = strpart(res, pos+2) + endif + let header = res[:pos-1] + let charset = matchstr(content, ']\+content=["''][^;"'']\+;\s*charset=\zs[^;"'']\+\ze["''][^>]*>') + if len(charset) == 0 + let charset = matchstr(content, ']*>') + endif + if len(charset) == 0 + let charset = matchstr(header, '\nContent-Type:.* charset=[''"]\?\zs[^''";\n]\+\ze') + endif + if len(charset) == 0 + let s1 = len(split(content, '?')) + let utf8 = iconv(content, 'utf-8', &encoding) + let s2 = len(split(utf8, '?')) + return (s2 == s1 || s2 >= s1 * 2) ? utf8 : content + endif + return iconv(content, charset, &encoding) +endfunction + +function! emmet#util#getTextFromHTML(buf) abort + let threshold_len = 100 + let threshold_per = 0.1 + let buf = a:buf + + let buf = strpart(buf, stridx(buf, '')) + let buf = substitute(buf, ']*>.\{-}', '', 'g') + let buf = substitute(buf, ']*>.\{-}', '', 'g') + let res = '' + let max = 0 + let mx = '\(]\{-}>\)\|\(<\/td>\)\|\(]\{-}>\)\|\(<\/div>\)' + let m = split(buf, mx) + for str in m + let c = split(str, '<[^>]*?>') + let str = substitute(str, '<[^>]\{-}>', ' ', 'g') + let str = substitute(str, '>', '>', 'g') + let str = substitute(str, '<', '<', 'g') + let str = substitute(str, '"', '"', 'g') + let str = substitute(str, ''', '''', 'g') + let str = substitute(str, ' ', ' ', 'g') + let str = substitute(str, '¥', '\¥', 'g') + let str = substitute(str, '&', '\&', 'g') + let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '') + let str = substitute(str, '\s\+', ' ', 'g') + let l = len(str) + if l > threshold_len + let per = (l+0.0) / len(c) + if max < l && per > threshold_per + let max = l + let res = str + endif + endif + endfor + let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g') + return res +endfunction + +function! emmet#util#getImageSize(fn) abort + let fn = a:fn + + if emmet#util#isImageMagickInstalled() + return emmet#util#imageSizeWithImageMagick(fn) + endif + + if filereadable(fn) + let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g') + else + if fn !~# '^\w\+://' + let path = fnamemodify(expand('%'), ':p:gs?\\?/?') + if has('win32') || has('win64') | + let path = tolower(path) + endif + for k in keys(g:emmet_docroot) + let root = fnamemodify(k, ':p:gs?\\?/?') + if has('win32') || has('win64') | + let root = tolower(root) + endif + if stridx(path, root) == 0 + let v = g:emmet_docroot[k] + let fn = (len(v) == 0 ? k : v) . fn + break + endif + endfor + endif + let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g') + endif + + let [width, height] = [-1, -1] + if hex =~# '^89504e470d0a1a0a' + let width = eval('0x'.hex[32:39]) + let height = eval('0x'.hex[40:47]) + endif + if hex =~# '^ffd8' + let pos = 4 + while pos < len(hex) + let bs = hex[pos+0:pos+3] + let pos += 4 + if bs ==# 'ffc0' || bs ==# 'ffc2' + let pos += 6 + let height = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) + let pos += 4 + let width = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) + break + elseif bs =~# 'ffd[9a]' + break + elseif bs =~# 'ff\(e[0-9a-e]\|fe\|db\|dd\|c4\)' + let pos += (eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])) * 2 + endif + endwhile + endif + if hex =~# '^47494638' + let width = eval('0x'.hex[14:15].hex[12:13]) + let height = eval('0x'.hex[18:19].hex[16:17]) + endif + + return [width, height] +endfunction + +function! emmet#util#imageSizeWithImageMagick(fn) abort + let img_info = system('identify -format "%wx%h" "'.a:fn.'"') + let img_size = split(substitute(img_info, '\n', '', ''), 'x') + if len(img_size) != 2 + return [-1, -1] + endif + return img_size +endfunction + +function! emmet#util#isImageMagickInstalled() abort + if !get(g:, 'emmet_use_identify', 1) + return 0 + endif + return executable('identify') +endfunction + +function! emmet#util#unique(arr) abort + let m = {} + let r = [] + for i in a:arr + if !has_key(m, i) + let m[i] = 1 + call add(r, i) + endif + endfor + return r +endfunction + +let s:seed = localtime() +function! emmet#util#srand(seed) abort + let s:seed = a:seed +endfunction + +function! emmet#util#rand() abort + let s:seed = s:seed * 214013 + 2531011 + return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000 +endfunction + +function! emmet#util#cache(name, ...) abort + let content = get(a:000, 0, '') + let dir = expand('~/.emmet/cache') + if !isdirectory(dir) + call mkdir(dir, 'p', 0700) + endif + let file = dir . '/' . substitute(a:name, '\W', '_', 'g') + if len(content) == 0 + if !filereadable(file) + return '' + endif + return join(readfile(file), "\n") + endif + call writefile(split(content, "\n"), file) +endfunction + +function! emmet#util#getcurpos() abort + let pos = getpos('.') + if mode(0) ==# 'i' && pos[2] > 0 + let pos[2] -=1 + endif + return pos +endfunction + +function! emmet#util#closePopup() abort + return pumvisible() ? "\" : '' +endfunction diff --git a/vim-plugins/bundle/emmet-vim/doc/emmet.txt b/vim-plugins/bundle/emmet-vim/doc/emmet.txt new file mode 100644 index 0000000..ffa5e0a --- /dev/null +++ b/vim-plugins/bundle/emmet-vim/doc/emmet.txt @@ -0,0 +1,1773 @@ +*emmet.txt* *Emmet* for Vim + + ------------------------------------------------------- + Emmet: vim plugins for HTML and CSS hi-speed coding + ------------------------------------------------------- + +Author: Yasuhiro Matsumoto +WebSite: http://mattn.kaoriya.net/ +Repository: https://github.com/mattn/emmet-vim +Site: https://mattn.github.com/emmet-vim +License: BSD style license + +============================================================================== +CONTENTS *emmet-contents* + +Introduction |emmet-introduction| +Install |emmet-install| +Tutorial |emmet-tutorial| + 1. Expand abbreviation |emmet-expand-abbr| |,| + 2. Expand word |emmet-expand-word| |;| + 3. Update tag |emmet-update-tag| |u| + 4. Wrap with abbreviation |emmet-wrap-with-abbreviation| |v_,| + 5. Balance tag inward |emmet-balance-tag-inward| |d| + 6. Balance tag outward |emmet-balance-tag-outward| |D| + 7. Go to next edit point |emmet-goto-next-point| |n| + 8. Go to previous edit point |emmet-goto-previous-point| |N| + 9. Add and update size |emmet-update-image-size| |i| + 10. Merge lines |emmet-merge-lines| |m| + 11. Remove tag |emmet-remove-tag| |k| + 12. Split/join tag |emmet-split-join-tag| |j| + 13. Toggle comment |emmet-toggle-comment| |/| + 14. Make anchor from URL |emmet-make-anchor-url| |a| + 15. Make quoted text from URL |emmet-quoted-text-url| |A| + 16. Code pretty |emmet-code-pretty| |c| + 17. Lorem ipsum |emmet-lorem-ipsum| +HTML expression syntax |emmet-html-expression-syntax| + 1. Elements |emmet-html-syntax-elements| + 2. Nesting operators |emmet-html-syntax-nesting-operators| + 2.1. Child |emmet->| + 2.2. Sibling |emmet-+| + 2.3. Climb-up |emmet-^| + 2.4. Multiplication |emmet-star| + 2.5. Grouping |emmet-()| + 3. Attribute operators |emmet-html-syntax-attribute-operators| + 3.1. ID and CLASS |emmet-.| |emmet-#| + 3.2. Custom attributes |emmet-[]| + 3.3. Item numbering |emmet-$| + 3.3.1. Changing numbering origin and direction |emmet-@| + 3.4. Quote character |emmet-html-attr-quote-char| + 4. Text |emmet-{}| + 5. Implicit tag names |emmet-html-implicit-tag-names| + 6. Notes on abbreviation formatting |emmet-html-syntax-notes| + 7. Choose position to insert text when wrap abbreviation |emmet-$#| +CSS expression syntax |emmet-css-expression-syntax| + 1. Properties |emmet-css-properties| + 2. Values |emmet-css-values| + 3. Units |emmet-css-units| + 4. Vendor prefixes |emmet-css-vendor-prefixes| +Commands |emmet-commands| + :Emmet |:Emmet| + :EmmetInstall |:EmmetInstall| +Variables |emmet-variables| + g:emmet_html5 |g:emmet_html5| + g:emmet_docroot |g:emmet_docroot| + g:emmet_curl_command |g:emmet_curl_command| + g:user_emmet_complete_tag |g:user_emmet_complete_tag| + g:user_emmet_leader_key |g:user_emmet_leader_key| + g:user_emmet_install_global |g:user_emmet_install_global| + g:user_emmet_install_command |g:user_emmet_install_command| + g:user_emmet_settings |g:user_emmet_settings| + g:user_emmet_mode |g:user_emmet_mode| +Customize |emmet-customize| + 1. Key mappings |emmet-customize-key-mappings| + 2. Indent size |emmet-indent-size| + 3. Define tag's behavior |emmet-define-tags-behavior| + 4. Adding custom snippets |emmet-custom-snippets| +Filters |emmet-filters-list| + Escapes XML-unsafe characters |emmet-filter-e| + Add comments around 'important tags' |emmet-filter-c| + Outputs as a single line |emmet-filter-s| + Trim list markers |emmet-filter-t| +Links |emmet-links| +ToDo |emmet-todo| + +============================================================================== +INTRODUCTION *emmet-introduction* *emmet* + +Emmet is an editor plugin for high-speed HTML, XML, XSL (or any other +structured code format) coding and editing. The core of this plugin is a +powerful abbreviation engine which allows you to expand expressions, +similar to CSS selectors, into HTML code: +> + div#page>div.logo+ul#navigation>li*5>a +< +can be expanded into: +> +
    + + +
    +< +Read more about current Emmet syntax + |emmet-html-expression-syntax| + |emmet-css-expression-syntax| + http://docs.emmet.io/abbreviations/ + +Abbreviation engine has a modular structure which allows you +to expand abbreviations into different languages. +Emmet currently supports CSS, HTML, XML/XSL and HAML, Slim languages +via filters (see |emmet-filter|). + +============================================================================== +INSTALL *emmet-install* + +Install the distributed files into Vim runtime directory which is usually +'~/.vim/', or '$HOME/vimfiles' on Windows. + +If you install pathogen (https://github.com/tpope/vim-pathogen) +that provided by Tim Pope, you should extract the +file into 'bundle' directory. + +============================================================================== +TUTORIAL *emmet-tutorial* + +If you are seeing this file as :help, then you can't edit this file. +You should copy this section and create new buffer, paste and write as +'emmet-tutor.txt'. Formally, open the file to start tutorial. + +1. Expand abbreviation *emmet-expand-abbr* *,* + + Type abbreviation as 'div>p#foo$*3>a' and type ','. +> +
    +

    + +

    +

    + +

    +

    + +

    +
    +< +2. Expand abbreviation *emmet-expand-word* *;* + + When you want to expand word except html tokens like below, use this. +> + foo +< + This will be expanded like: +> + + +3. Update tag *emmet-update-tag* *u* + + The begining of tags '
    ' on below +> +
    foo
    +< + Type 'u' request 'Enter Abbreviation:'. Then type +> + .global +< + This will be expanded like: +> +
    foo
    +< +4. Wrap with abbreviation *emmet-wrap-with-abbreviation* *v_,* + + Write as below. +> + test1 + test2 + test3 +< + Then do visual select (line wise) and type ','. + If you request 'Tag:', then type +> + ul>li* +< + Result: +> +
      +
    • test1
    • +
    • test2
    • +
    • test3
    • +
    +< + If you type tag name, for example +> + blockquote +< + then you'll see as following: +> +
    + test1 + test2 + test3 +
    +< + See also: |emmet-filter-t|, |emmet-$#| + +5. Balance tag inward *emmet-balance-tag-inward* *d* + + To select inward of '
      ' tag, type 'd' in insert mode. +> +
        + *
      • +
      • +
      • +
      +< + If cursor is at '*', 'd' select from begin of '
        ' to end of '
      '. + If cursor is at first of '
    • ', it select '
    • '. + +6. Balance tag outward *emmet-balance-tag-outward* *D* + + To select outward of '
        ' tag type 'D' in insert mode. +> +
          + *
        • +
        • +
        • +
        +< + If cursor is at '*', 'D' select from next letter of '
          ' + to previous letter of '
        '. + If cursor is at first of '
      • ', it select '
      • '. + +7. Go to next edit point *emmet-goto-next-point* *n* + + To jump next point that need to edit, type 'n' in insert mode. +> + *
        foo
        +
        +< + If cursor is at '*', type 'n' to move a cursor + into attribute value of '
        ' specified id as 'foo'. + And type again 'n' to move a cursor + into inner of '
        ' specified id as 'bar'. + +8. Go to previous edit point *emmet-goto-previous-point* *N* + + To jump previous point that need to edit, type 'N' in insert mode. +> +
        foo
        +
        * +< + If cursor is at '*', type 'N' to move a cursor + into '
        ' specified id as 'bar'. + And type again 'N' to move a cursor + into attribute value of 'foo'. + +9. Add and update size *emmet-update-image-size* *i* + + To add or update 'width' and 'height' attributes of image, + type 'i' on '' tag +> + +< + Type 'i' on '' tag +> + +< + If you change image, then type it again. it will be following. +> + +< + Image size retrieved using 'identify' (ImageMagick.org) (if available) + or |xxd|. + +10. Merge lines *emmet-merge-lines* *m* + + To join multi line text like following, type |J|. +> +
          +
        • +
        • +
        • +
        +< + If you select part of line include '
      • ' and type |m|, + it will be following. +> +
          +
        • +
        +< +11. Remove tag *emmet-remove-tag* *k* + + To remove tag in the block, type 'k'. +> + +< + Type 'k' in insert mode, then +> +
        + +
        +< + And type 'k' in there again, then '
        ' will be removed. + +12. Split/join tag *emmet-split-join-tag* *j* + + To join block, type 'j'. +> +
        + cursor is here +
        +< + Type 'j' in insert mode. Then, +> +
        +< + And type 'j' in there again. +> +
        +
        +< +13. Toggle comment *emmet-toggle-comment* */* + + Move cursor to block +> +
        + hello world +
        +< + Type '/' in insert mode. +> + +< + Type '/' in there again. +> +
        + hello world +
        +< +14. Make anchor from URL *emmet-make-anchor-url* *a* + + Move cursor to URL +> + http://www.google.com/ +< + Type 'a' +> + Google +< + Text retrieved using command, specified by |g:emmet_curl_command|. + +15. Make quoted text from URL *emmet-quoted-text-url* *A* + + Move cursor to URL +> + https://github.com/ +< + Type 'A' +> +
        + Secure source code hosting and collaborative development - GitHub
        +

        How does it work? Get up and running in seconds by forking a project, pushing an existing repository...

        + https://github.com/ +
        +< + Text retrieved using command, specified by |g:emmet_curl_command|. + +16. Code pretty *emmet-code-pretty* *c* + + Select code block, for example select following code from 'int main()'. +> +

        Writing in C language

        + + int main() { + puts("hello world"); + } +< + Type 'c' +> + int main() {
        +   puts("hello world");
        + }
        +< + To convert text into html used command |:TOhtml|. + +17. Lorem ipsum *emmet-lorem-ipsum* + + To insert dummy text (30 words by default). +> + div>lorem +< + Type |,| +> +
        Adipisicing asperiores deleniti ipsum fuga deserunt perferendis + molestiae sunt excepturi aut quo nihil! Optio accusantium corporis molestiae + deserunt ab, veritatis commodi. Eius nobis ab deserunt magni iure quo + laboriosam laboriosam.
        +< + For japanese user, put like follow into your |g:user_emmet_settings|: +> + let g:user_emmet_settings = { + ... + + \ 'custom_expands1' : { + \ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#ja#expand'), + \ }, + + ... +< + You will get japanese dummy text. Text retrieved from url + 'http://www.aozora.gr.jp/cards/000081/files/470_15407.html' + using command, specified by |g:emmet_curl_command|. + + To insert 3 words of dummy text. +> + div>lorem3 +< + Type |,| +> +
        + Elit libero id. +
        +< +============================================================================== +HTML EXPRESSION SYNTAX *emmet-html-expression-syntax* + +Emmet uses syntax similar to CSS selectors for describing elements' positions +inside generated tree and elements' attributes. + +1. Elements *emmet-html-syntax-elements* + + You can use elements' names like 'div' or 'p' to generate HTML tags. +> + p ->

        + div ->
        +< + You can write any word and transform it into a tag: +> + foo -> + bar -> +< + Emmet knowns set of empty elements: +> + br ->
        or
        + meta -> or +< + To choose between HTML '>' and XHTML ' />' use |g:emmet_html5| or + |g:user_emmet_settings|: +> + let g:user_emmet_settings = { + \ ... + \ 'html': { + \ ... + \ 'empty_element_suffix': ' />', + \ ... + \ }, + \ ... + \} +< + Emmet will automatically insert some attributes: +> + a -> + link -> +< + Set of inserted attributes can be changed using |g:user_emmet_settings|: +> + let s:emmet_settings = { + \ ... + \ 'html': { + \ ... + \ 'default_attributes': { + \ ... + \ 'a': {'href': ''}, + \ 'ins': {'datetime': '${datetime}'}, + \ 'iframe': [{'src': ''}, {'frameborder': '0'}], + \ 'textarea': [{'name': ''}, {'id': ''}, {'cols': '30'}, {'rows': '10'}], + \ ... + \ }, + \ ... + \ }, + \ ... + \} +< +2. Nesting operators *emmet-html-syntax-nesting-operators* + + Nesting operators are used to position abbreviation elements + inside generated tree: whether it should be placed + inside or near the context element. + + Operator Description Link ~ + > Child |emmet->| + + Sibling |emmet-+| + ^ Climb-up |emmet-^| + * Multiplication |emmet-star| + () Grouping |emmet-()| + +2.1. Child *emmet->* + + You can use '>' operator to nest elements inside each other: +> + div>ul>li +< + will produce +> +
        +
          +
        • +
        +
        +< +2.2. Sibling *emmet-+* + + Use '+' operator to place elements near each other, on the same level: +> + div+p+bq +< + will output +> +
        +

        +
        +< +2.3. Climb-up *emmet-^* + + With '>' operator you're descending down the generated tree and + positions of all sibling elements will be resolved + against the most deepest element: +> + div+div>p>span+em +< + will be expanded to +> +
        +
        +

        + + +

        +
        +< + With '^' operator, you can climb one level up the tree and change context + where following elements should appear: +> + div+div>p>span+em^bq +< + outputs to +> +
        +
        +

        + + +

        +
        +
        +< + You can use as many '^' operators as you like, + each operator will move one level up: +> + div+div>p>span+em^^^bq +< + will output to +> +
        +
        +

        + + +

        +
        +
        +< +2.4. Multiplication *emmet-star* + + With '*' operator you can define how many times element should be outputted: +> + ul>li*5 +< + outputs to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +< + Expression may contain several '*' operators: +> + tr*2>td*3 +< + become +> + + + + + + + + + + +< +2.5. Grouping *emmet-()* + + Parentheses '()' are used by Emmets' power users for grouping subtrees + in complex abbreviations: +> + div>(header>ul>li*2>a)+footer>p +< + expands to +> +
        +
        +
          +
        • +
        • +
        +
        +
        +

        +
        +
        +< + If you're working with browser's DOM, you may think of groups + as Document Fragments: each group contains abbreviation subtree and + all the following elements are inserted at the same level + as the first element of group. + + You can nest groups inside each other and + combine them with multiplication '*' operator: +> + (div>dl>(dt+dd)*3)+footer>p +< + produces +> +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +
        +

        +
        +< + With groups, you can literally write full page mark-up + with a single abbreviation, but please don't do that. + +3. Attribute operators *emmet-html-syntax-attribute-operators* + + Attribute operators are used to modify attributes of outputted elements. + For example, in HTML and XML you can quickly add 'class' attribute + to generated element. + + Operator Description Link ~ + . Attribute 'class' |emmet-.| + # Attribute 'id' |emmet-#| + [] Custom attributes |emmet-[]| + $ Number |emmet-$| + @ Number origin and direction |emmet-@| + +3.1. ID and CLASS *emmet-.* *emmet-#* + + In CSS, you use 'elem#id' and 'elem.class' notation to reach the elements + with specified 'id' or 'class' attributes. + In Emmet, you can use the very same syntax to add these attributes + to specified element: +> + span.class1 -> + span.class1.class2 -> + div#wrapper ->
        + div#wrapper.content ->
        +< + More complex expression: +> + div#header+div.page+div#footer.class1.class2.class3 +< + will output +> + +
        + +< +3.2. Custom attributes *emmet-[]* + + You can use '[attr]' notation (as in CSS) + to add custom attributes to your element: +> + td[title="Hello world!" colspan=3] +< + outputs +> + +< + You can place as many attributes as you like inside square brackets. + + Attribute values may be omitted: +> + td[colspan title] +< + will produce +> + +< + You can use single or double quotes for quoting attribute values. +> + div[a='value1' b="value2"] +< + become +> +
        +< + You don't need to quote values if they don't contain spaces: +> + td[title=hello colspan=3] +< + will output +> + +< +3.3. Item numbering *emmet-$* + + With multiplication '*' operator you can repeat elements, + but with '$' you can number them. + Place '$' operator inside element's name, attribute's name or + attribute's value to output current number of repeated element: +> + ul>li.item_$*5 +< + outputs to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +< + You can use multiple '$' in a row to pad number with zeroes: +> + ul>li.item_$$$*5 +< + outputs to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +< + Also '$' can be used in element name and in text (|emmet-{}|): +> + h$[title=item$]{Header $}*3 +< + transformed to +> +

        Header 1

        +

        Header 2

        +

        Header 3

        +< +3.3.1. Changing numbering origin and direction *emmet-@* + + With '@' modifier, you can change + - numbering direction (ascending or descending) and + - origin (i. e. start value). + + For example, to change direction, add '@-' after '$': +> + ul>li.item_$@-*5 +< + outputs to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +< + To change counter origin value, add '@N' modifier to '$': +> + ul>li.item_$@3*5 +< + transforms to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +< + You can use these modifiers together: +> + ul>li.item_$@-3*5 +< + is transformed to +> +
          +
        • +
        • +
        • +
        • +
        • +
        +> +3.4. Quote character *emmet-html-attr-quote-char* + + |g:user_emmet_settings| may be used to change attribute quote character: +> + let g:user_emmet_settings = { + ... + \ 'html' : { + ... + \ 'quote_char': "'", + ... + \ }, + ... + \} +< + Then abbreviation +> + a[target=_blank] +< + will expand to +> + +< + instead of +> + +< + Default quote is '"'. + +4. Text *emmet-{}* + + You can use curly braces to add text to element: +> + a{Click me} +< + will produce +> + Click me +< + Note that '{text}' is used and parsed as a separate element + (like, 'div', 'p' etc), but has a special meaning + when written right after element. For example, +> + a{click} +< + and +> + a>{click} +< + will produce the same output, but +> + a{click}+b{here} +< + and +> + a>{click}+b{here} +< + won't: +> + + clickhere + + + clickhere +< + In second example the '' element is placed inside '' element. + And that's the difference: when '{text}' is written right after element, + it doesn't change parent context. + Here's more complex example showing why it is important: +> + p>{Click }+a{here}+{ to continue} +< + produces +> +

        Click here to continue

        +< + In this example, to write 'Click here to continue' inside '

        ' element + we have explicitly move down the tree with '>' operator after 'p', + but in case of 'a' element we don't have to, since we need '' element + with here word only, without changing parent context. + + For comparison, here's the same abbreviation + written without child '>' operator: +> + p{Click }+a{here}+{ to continue} +< + produces +> +

        Click

        + here to continue +< +5. Implicit tag names *emmet-html-implicit-tag-names* + + Even with such a powerful abbreviation engine, + which can expand large HTML structures from short abbreviation, + writing tag names may be very tedious. + + In many cases you can skip typing tag names and + Emmet will substitute it for you. + For example, instead of > + div.content +< you can simply write > + .content +< and expand it into > +
        +< + Other examples: +> + .wrapper ->
        + #popup -> +< + When you expand abbreviation, Emmet tries to grab parent context, + e. g. the HTML element, inside which you're expanding the abbreviation. + If the context was grabbed successfully, + Emmet uses its name to resolve implicit names. + Emmet looks at the parent tag name every time + you're expanding the abbreviation with an implicit name. + Here's how it resolves the names for some parent elements: + + Inserted element Parent elements ~ + li ul, ol + tr table, tbody, thead, tfoot + td tr + option select, optgroup + span Inline elements + div Block elements + + Take a look at some abbreviations equivalents + with implicit and explicit tag names: +> + .wrap>.content -> div.wrap>div.content + em>.info -> em>span.info + ul>.item*3 -> ul>li.item*3 + table>.row>.col -> table>tr.row>td.col + table>#row$*4>[colspan=2] -> table>tr#row$*4>td[colspan=2] +< +6. Notes on abbreviation formatting *emmet-html-syntax-notes* + + When you get familiar with Emmet's abbreviations syntax, + you may want to use some formatting to make your abbreviations more readable. + For example, use spaces between elements and operators, like this: +> + (header > ul.nav > li*5) + footer +< + But it won't work, because space is a stop symbol + where Emmet stops abbreviation parsing. + + Many users mistakenly think that each abbreviation + should be written in a new line, but they are wrong: + you can type and expand abbreviation anywhere in the text: + + This is why Emmet needs some indicators (like spaces) + where it should stop parsing to not expand anything that you don't need. + If you're still thinking that such formatting is required + for complex abbreviations to make them more readable: + - abbreviations are not a template language, + they don't have to be "readable", + they have to be "quickly expandable and removable"; + - you don't really need to write complex abbreviations. + Stop thinking that "typing" is the slowest process in web-development. + You'll quickly find out that constructing a single complex abbreviation + is much slower and error-prone than constructing and typing + a few short ones. + +7. Choose position to insert text when wrap abbreviation *emmet-$#* + + When wrap abbreviation (|emmet-wrap-with-abbreviation|) you can choose + position to insert text using '$#' operator. + Operator '$#' may be used only inside |emmet-[]| and/or |emmet-{}|. + + For example, do visual select (line wise) following text: +> + First + Second + Third +< + Then press ',' and type +> + ul>li[ title="[$#]" ]* +< + Result: +> +
          +
        • First
        • +
        • Second
        • +
        • Third
        • +
        +< + You may type +> + input[ type=input value=$# ] +< + to get +> + + + +< + Using '$#' you can type text (|emmet-{}|) only once: +> + a[title=$#]{foo} +< + will be expanded to +> + foo +< +============================================================================== +CSS EXPRESSION SYNTAX *emmet-css-expression-syntax* + +1. Properties *emmet-css-properties* + + Emmet has a lot of predefined snippets for CSS properties. +> + +< + become +> + +< + In above example '|' denotes a cursor (caret) position. + + Other examples: +> + t -> top: ; + d -> display: ; + o -> outline: ; + ov -> overflow: ; + cu -> cursor: ; + bdrs -> border-radius: ; +< + '+' operator may be used to insert number of properties: +> + m1+p2 +< + become +> + margin: 1px; + padding: 2px; +< +2. Values *emmet-css-values* + + Some properties have default values: +> + c -> color: #000; + bgc -> background-color: #FFF; + zoo -> zoom: 1; +< + To insert predefined property value after abbreviation + type colon ':' and first character of predefined keyword: +> + d:n -> display: none; + d:b -> display: block; + d:i -> display: inline; +< + Numerical value can be typed directly after abbreviation: +> + m10 -> margin: 10px; + m2e -> margin: 2em; +< + Use a hyphen '-' to separate some numerical values: +> + m10-20 -> margin: 10px 20px; + p1-2-3 -> padding: 1px 2px 3px; +< + To negative values + precede the first value with hyphen and all the rest with double hyphens: +> + m-10 -> margin: -10px; + m-1--2 -> margin: -1px -2px; + p-2--1-0-1 -> padding: -2px -1px 0 1px; +< + To insert '!important' append '!' to property abbreviation: +> + m! -> margin: !important; + bac! -> background: !important; +< + You can use special abbreviation 'lg(...)' + to insert definition of linear gradient. Example: +> + lg(left, #fc0 30%, red) +< + will expand to +> + background-image: -webkit-gradient(left, 0 0, 0 100, from(#fc0 30%), to(red)); + background-image: -webkit-linear-gradient(#fc0 30%, red); + background-image: -moz-linear-gradient(#fc0 30%, red); + background-image: -o-linear-gradient(#fc0 30%, red); + background-image: linear-gradient(#fc0 30%, red); +< +3. Units *emmet-css-units* + + By default, when you expand an abbreviation with integer value, + Emmet outputs it with a 'px' unit: +> + bor2 -> border: 2px; + fs100 -> font-size: 100px; + miw20 -> min-width: 20px; +< + By default, if you're expanding an abbreviation with a float value, + it is outputted with an 'em' unit: +> + fs1.5 -> font-style: 1.5em; +< + But you can explicitly provide the unit name + by putting one of characters right after value: + + Character Unit ~ + p % + e em + + Examples: +> + fs2e -> font-style: 2em; + w100p -> width: 100%; +< +4. Vendor prefixes *emmet-css-vendor-prefixes* + + To automatically create vendor-prefixed copies of property, + precede abbreviation with a hyphen '-'. For example, abbreviation +> + -bdrs +< + will be expanded into +> + -webkit-border-radius: ; + -moz-border-radius: ; + border-radius: ; +< +============================================================================== +COMMANDS *emmet-commands* + +:Emmet {expression} *:Emmet* + Expand {expression} and insert result under cursor. + {expression} is |emmet-html-expression|. + Also see |g:user_emmet_install_command|. + +:EmmetInstall *:EmmetInstall* + Create Emmet mappings to current buffer + (|mapping|, |:map-|) and, + if set |g:user_emmet_complete_tag|, + change |'omnifunc'| option to emmet#completeTag() + +============================================================================== +VARIABLES *emmet-variables* + +g:emmet_html5 *g:emmet_html5* + If set to 1, enable HTML 5 support: + - use ">" instead of "/>": > + + +< - omit some HTML 4 attributes: > + ', + \ 'skip' : s:skipPattern, + \ }, + \} + +let s:topFT = 'eruby' + +fun! XPT_erubyFiletypeDetect() "{{{ + let pos = [ line( "." ), col( "." ) ] + + let synName = xpt#util#NearestSynName() + + if synName == '' + " top level ft is html + return s:topFT + + else + + for [ name, ftPattern ] in items( s:pattern ) + let pos = searchpairpos( ftPattern.start, ftPattern.mid, ftPattern.end, 'nbW', ftPattern.skip ) + if pos != [0, 0] + return name + endif + endfor + + if synName =~ '^\cjavascript' + return 'javascript' + elseif synName =~ '^\ccss' + return 'css' + endif + + return s:topFT + + endif + +endfunction "}}} + +if exists( 'b:XPTfiletypeDetect' ) + unlet b:XPTfiletypeDetect +endif +let b:XPTfiletypeDetect = function( 'XPT_erubyFiletypeDetect' ) + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/eruby/eruby.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/eruby/eruby.xpt.vim new file mode 100644 index 0000000..81c4581 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/eruby/eruby.xpt.vim @@ -0,0 +1,21 @@ +XPTemplate priority=lang- + +XPTinclude + \ _common/common + \ html/html + \ html/eruby* + +XPTembed + \ ruby/ruby + \ javascript/javascript + \ css/css + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + + + +" ================================= Wrapper =================================== + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/factor/factor.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/factor/factor.xpt.vim new file mode 100644 index 0000000..bcb87e3 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/factor/factor.xpt.vim @@ -0,0 +1,93 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTinclude + \ _common/common + + +" ========================= Function and Variables ============================= +fun! s:f.ModuleName() + let rootfolder = substitute(getcwd(), '^.*[\\/]\([^\\/]\+\)$', '\1', '') + let filename = rootfolder . '/' . expand('%:h:h') . '/' . expand('%:t:r') + let stripped = substitute( filename, '[\\/]', '.', 'g' ) + + return substitute( stripped, "-tests$", ".tests", '' ) +endfunction +" ================================= Snippets =================================== + +XPT alias "ALIAS: ... ... +ALIAS: `newword^ `oldword^ + +XPT const "CONSTANT: ... ... +CONSTANT: `word^ `constantValue^ + +XPT if "... [ ... ] [ ... ] if +`cond^ [ `then^ ] [ `else^ ] if + +XPT times "... [ ... ] times +`count^ [ `what^ ] times + +XPT mod " USING: ... IN: ... +XSET moduleName=ModuleName() +USING: kernel sequences accessors ; +IN: `moduleName^ + +XPT quote " [ ... ] +[ `cursor^ ] + +XPT arr " { ... } +{ `cursor^ } + +XPT vec " V{ ... } +V{ `cursor^ } + +XPT bi " [ ... ] [ ... ] bi +[ `first^ ] [ `cursor^ ] bi + +XPT tri " [ ... ] [ ... ] [ ... ] tri +[ `first^ ] [ `second^ ] [ `cursor^ ] tri + +XPT map " [ ... ] map +[ `cursor^ ] map + +XPT filter " [ ... ] filter +[ `cursor^ ] filter + +XPT dip " [ ... ] dip +[ `cursor^ ] dip + +XPT cleave " { [ ... ] ... } cleave +{ [ `code^ ]`...^ + [ `code^ ]`...^ +} cleave + +XPT when " [ ... ] when +[ `cursor^ ] when + +XPT unless " [ ... ] unless +[ `cursor^ ] unless + +XPT keep " [ ... ] keep +[ `cursor^ ] keep + +XPT cond " { { [ ... ] [ ... ] } } cond +{ { [ `cond^ ] [ `code^ ] }`...^ + { [ `cond^ ] [ `code^ ] }`...^`default...{{^ + [ `cursor^ ]`}}^ +} cond + +XPT case " { { ... [ ... ] } } case +{ { `case^ [ `code^ ] }`...^ + { `case^ [ `code^ ] }`...^`default...{{^ + [ `cursor^ ]`}}^ +} case + +XPT test "[ ... ] [ ... ] unit-test +{ `ret^ } [ `test^ ] unit-test + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/gitconfig/gitconfig.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/gitconfig/gitconfig.xpt.vim new file mode 100644 index 0000000..28920c0 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/gitconfig/gitconfig.xpt.vim @@ -0,0 +1,24 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + + +XPTinclude + \ _common/common + + +XPT branch " [branch "..."] +[branch "`branchName^"]`remote...{{^ + remote = `remote^`}}^`merge...{{^ + merge = refs/heads/`branchName^`}}^ + +XPT remote " [remote "..."] +[remote "`remoteName^"] + url = `fetchUrl^ + fetch = `fetchRef^ + +XPT user " Basic user configuration +[user] + name = `$Author^ + email = `$Email^ + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/gnuplot/gnuplot.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/gnuplot/gnuplot.xpt.vim new file mode 100644 index 0000000..58faed2 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/gnuplot/gnuplot.xpt.vim @@ -0,0 +1,34 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + +XPT skeleton " basic file skeleton +set title "`plotTitle^" +set xlabel "`axisLabel^" +set ylabel "`ordinateLabel^" + +plot "`valueFile^" title "`valueTitle^" `using...{{^using `columns^ `}}^ with linespoint + +XPT label " axis labels +set xlabel "`axisLabel^" +set ylabel "`ordinateLabel^" + +XPT fun " ... ( ... ) = ... +`funName^( `args^ )=`cursor^ + +XPT range " set xrange ...; set yrange ... +set xrange [`xMin^:`xMax^] +set yrange [`yMin^:`yMay^] + +XPT tics " set xtics & ytics +set xtics `xTics^ +set ytics `yTics^ + +XPT term " Change output terminal +XSET termMode=Choose(['svg', 'canvas','latex', 'postscript', 'x11','eps', 'xterm']) +set terminal `termMode^ enhanced`size...{{^ size `width^ `height^`}}^ +set output "`filename^" + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/go/go.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/go/go.xpt.vim new file mode 100644 index 0000000..454cc25 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/go/go.xpt.vim @@ -0,0 +1,179 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +fun! s:f.MakeIntType( n ) + let n = a:n + return matchstr(n, '\v^u') . "int" . matchstr(n, '\v\d+$' ) +endfunction + +XPTvar $TRUE true +XPTvar $FALSE false +XPTvar $NULL nil +XPTvar $UNDEFINED nil + +XPTvar $SParg '' + +XPTinclude + \ _common/common + \ _comment/c.like + + +XPT _dec hidden " $_xSnipName +`$_xSnipName^ + +XPT package alias=_dec +XPT import alias=_dec +XPT type alias=_dec +XPT const alias=_dec +XPT var alias=_dec + +XPT _int " MakeIntType($_xSnipName) +`MakeIntType($_xSnipName)^ + +XPT i8 alias=_int +XPT i16 alias=_int +XPT i32 alias=_int +XPT i64 alias=_int +XPT u8 alias=_int +XPT u16 alias=_int +XPT u32 alias=_int +XPT u64 alias=_int + +XPT struct " struct { +struct { + `cursor^ +} + +XPT func wrap " func () int { +func `n^(`p?^)` `int?^ { + `cursor^ +} +XPT meth wrap " func (*T) () int { +func (`^) `n^(`p?^)` `int?^ { + `cursor^ +} +XPT go " go func (){}() +go func (`p?^) { + `cursor^ +}() +XPT tfunc " func Test +func Test`^(t *testing.T) { + `cursor^ +} +XPT bfunc " func Test +func Benchmark`^(b *testing.B) { + `cursor^ + + for ii := 0; i < b.N; i++ { + } +} +XPT main " func main\() +func main() { + `cursor^ +} + +XPT println " fmt.Println\() +fmt.Println( `^ ) +XPT sprintf " fmt.Sprintf\() +fmt.Sprintf( `^ ) + +XPT forever " for ;; +for ;; { + `cursor^ +} +XPT for wrap " for i=0; i<10; i++ +for `i^ := `0^; `i^ < `10^; `i^++ { + `cursor^ +} +XPT forr wrap " for i=10; i>=0; i-- +for `i^ := `10^; `i^ >= `0^; `i^-- { + `cursor^ +} +XPT forrange wrap " for range +for `_^, `^ := range `^ { + `cursor^ +} +XPT forin wrap alias=forrange + +XPT if wrap " if { +if `^ { + `cursor^ +} +XPT iftype wrap " if _, ok := x.(type); ok { ... } +if _, ok := `x^.( `tp^ ); ok { + `cursor^ +} +XPT _ifeq wrap hidden " if x == $v { +XSET $v=0 +if `^ == `$v^ { + `cursor^ +} +XPT _ifne wrap hidden " if x != $v { +XSET $v=0 +if `x^ != `$v^ { + `cursor^ +} +XPT iferr " if err != nil { +if err != nil { + `cursor^ +} +XPT ifn alias=_ifeq +XSET $v=nil +XPT ifnn alias=_ifne +XSET $v=nil +XPT if0 alias=_ifeq +XSET $v=0 +XPT ifn0 alias=_ifne +XSET $v=0 +XPT else +else { + `cursor^ +} + +XPT mps " map[string] +map[`string^]`T^ +XPT mpi " map[string] +map[`int^]`T^ + +XPT mkc " make\(chan X, n, capa?) +make(chan `bool^, `0^`, `capa?^) +XPT mks " make\([]X, n, capa?) +make([]`bool^, `0^`, `capa?^) +XPT mkm " make\(map[X]Y, n, capa?) +make(map[`string^]`bool^`, `capa?^) +XPT mkms " make\(map[string]Y, n, capa?) +make(map[string]`bool^`, `capa?^) + +XPT sel " select +select { +case `^: + `cursor^ +} +XPT selc " select x <-ch +select { +case ``x?` := ^<-`ch^: + `cursor^ +} + +XPT switch " switch x { +switch `^ { +case `^: + `cursor^ +} +XPT default " default: +default: + `cursor^ + +XPT test " if .. t.Errorf +if `^ {} else { + t.Errorf( `^ ) +} +XPT ttype " if _, ok := x.(type); ok { ... } +if _, ok := `x^.( `tp^ ); ok {} else { + t.Errorf( "Expect `x^ to be `tp^ but: %v", `x^ ) +} +XPT assert " if .. t.Errorf +if `^ {} else { + t.Fatalf( `^ ) +} diff --git a/vim-plugins/bundle/xptemplate/ftplugin/haskell/haskell.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/haskell/haskell.xpt.vim new file mode 100755 index 0000000..9ac532d --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/haskell/haskell.xpt.vim @@ -0,0 +1,164 @@ +XPTemplate priority=lang mark=`~ + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL +XPTvar $VOID_LINE /* void */; +XPTvar $BRif \n + +XPTinclude + \ _common/common + \ _preprocessor/c.like + + +" ========================= Function and Variables ============================= + + +" ================================= Snippets =================================== + + +XPT head " ----------------------------- +-------------------------------------------------- +---- `headName~ +-------------------------------------------------- + +XPT class " class .. where.. +class `context...{{~(`ctxt~) => `}}~`className~ `types~a~ where + `ar~ :: `type~ `...~ + `methodName~ :: `methodType~`...~ +`cursor~ + +XPT classcom " -- | class.. +-- | `classDescr~ +class `context...{{~(`ctxt~) => `}}~`className~ `types~a~ where + -- | `methodDescr~ + `ar~ :: `type~ `...~ + -- | `method_Descr~ + `methodName~ :: `methodType~`...~ +`cursor~ + +XPT datasum " data .. = ..|..|.. +data `context...{{~(`ctxt~) => `}}~`typename~`typeParams~ ~= + `Constructor~ `ctorParams~VOID()~` + `...~ + | `Ctor~ `params~VOID()~ + `...~ + `deriving...{{~deriving (`Eq,Show~)`}}~ +`cursor~ + + +XPT datasumcom " -- | data .. = ..|..|.. +-- | `typeDescr~VOID()~ +data `context...{{~(`ctxt~) => `}}~`typename~` `typeParams~ ~= + -- | `ConstructorDescr~ + `Constructor~ `ctorParams~VOID()~` + `...~ + -- | `Ctor descr~VOID()~ + | `Ctor~ `params~VOID()~` + `...~ + `deriving...{{~deriving (`Eq,Show~)`}}~ +`cursor~ + +XPT parser " .. = .. <|> .. <|> .. +`funName~ = `rule~` + `another_rule...{{~ + <|> `rule~` + `more...{{~ + <|> `rule~` + `more...~`}}~`}}~ + `err...{{~ "`descr~"`}}~ +`cursor~ + +XPT datarecord " data .. ={} +data `context...{{~(`ctxt~) => `}}~`typename~`typeParams~ ~= + `Constructor~ { + `field~ :: `type~` + `...{{~, + `fieldn~ :: `typen~` + `...~`}}~ + } + `deriving...{{~deriving (`Eq, Show~)`}}~ +`cursor~ + +XPT datarecordcom " -- | data .. ={} +-- | `typeDescr~ +data `context...{{~(`ctxt~) => `}}~`typename~`typeParams~ ~= + `Constructor~ { + `field~ :: `type~ -- ^ `fieldDescr~` + `...{{~, + `fieldn~ :: `typen~ -- ^ `fielddescr~` + `...~`}}~ + } + `deriving...{{~deriving (`Eq,Show~)`}}~ +`cursor~ + +XPT instance " instance .. .. where +instance `className~ `instanceTypes~ where + `methodName~ `~ = `decl~ `...~ + `method~ `~ = `declaration~`...~ +`cursor~ + +XPT if " if .. then .. else +if `expr~ + then `thenCode~ + else `cursor~ + +XPT fun " fun pat = .. +`funName~ `pattern~ = `def~` +`...{{~ +`name~R("funName")~ `pattern~ = `def~` +`...~`}}~ + +XPT funcom " -- | fun pat = .. +-- | `function_description~ +`funName~ :: `type~ +`name~R("funName")~ `pattern~ = `def~` +`...{{~ +`name~R("funName")~ `pattern~ = `def~` +`...~`}}~ + +XPT funtype " .. :: .. => .. -> .. -> +`funName~ :: `context...{{~(`ctxt~) + =>`}}~ `type~ -- ^ `is~` + `...{{~ + -> `type~ -- ^ `is~` + `...~`}}~ + +XPT options " {-# OPTIONS_GHC .. #-} +{-# OPTIONS_GHC `options~ #-} + +XPT lang " {-# LANGUAGE .. #-} +{-# LANGUAGE `langName~ #-} + +XPT inline " {-# INLINE .. #-} +{-# INLINE `phase...{{~[`2~] `}}~`funName~ #-} + +XPT noninline " {-# NOINLINE .. #-} +{-# NOINLINE `funName~ #-} + +XPT type " .. -> .. ->.... +`context...{{~(`ctxt~) => `}}~`t1~ -> `t2~`...~ -> `t3~`...~ + +XPT deriving " deriving (...) +deriving (`classname~`...~,`classname~`...~) + +XPT derivingstand " deriving instance ... +deriving instance `context...{{~`ctxt~ => `}}~`class~ `type~ + +XPT module " module .. () where ... +XSET moduleName=S(S(E('%:r'),'^.','\u&', ''), '[\\/]\(.\)', '.\u\1', 'g') +module `moduleName~ `exports...{{~( `cursor~ + ) `}}~where + +XPT foldr " foldr (.... -> ...) +foldr (\ `e~ `acc~ -> `expr~) `init~ `lst~ + +XPT foldl " foldl' (.... -> ...) +foldl' (\ `acc~ `elem~ -> `expr~) `init~ `lst~ + +XPT map " map (... -> ...) +map (`elem~ -> `expr~) `list~ + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/help/help.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/help/help.xpt.vim new file mode 100644 index 0000000..c1eb42e --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/help/help.xpt.vim @@ -0,0 +1,31 @@ +XPTemplate priority=lang + + +" containers +let s:f = g:XPTfuncs() + +" inclusion +XPTinclude + \ _common/common + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + +XPT ln " ========... +============================================================================== + + +XPT fmt " vim: options... +vim:tw=78:ts=8:sw=8:sts=8:noet:ft=help:norl: + + +XPT q " : > ... < +: > + `cursor^ +< + + +XPT r " |...| +|`content^| + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/html/eruby.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/html/eruby.xpt.vim new file mode 100644 index 0000000..5484831 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/html/eruby.xpt.vim @@ -0,0 +1,24 @@ +" These snippets work only in html context of a eruby file +if &filetype != 'eruby' + finish +endif + +XPTemplate priority=lang- + + +XPT ruby " <% ... +<% + `cursor^ +%> + + +XPT r " <% ... %> +<% `cursor^ %> + + +XPT re " <%= ... +<%= `expr^ %> + + +XPT rc " <%# ... +<%# `cursor^ %> diff --git a/vim-plugins/bundle/xptemplate/ftplugin/html/html.ftdetect.vim b/vim-plugins/bundle/xptemplate/ftplugin/html/html.ftdetect.vim new file mode 100644 index 0000000..958a0f6 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/html/html.ftdetect.vim @@ -0,0 +1,63 @@ +if exists("b:__HTML_FTDETECT_VIM__") + finish +endif +let b:__HTML_FTDETECT_VIM__ = 1 + + +" TODO xhtml support + +if &filetype !~ 'html' + finish +endif + + +let s:skipPattern = 'synIDattr(synID(line("."), col("."), 0), "name") =~? "\\vstring|comment"' +let s:pattern = { + \ 'javascript' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \ 'css' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \} + +fun! XPT_htmlFiletypeDetect() "{{{ + let pos = [ line( "." ), col( "." ) ] + let synName = xpt#util#NearestSynName() + + if synName == '' + " no character at current position or before curernt position + return &filetype + + else + + for [ name, ftPattern ] in items( s:pattern ) + let pos = searchpairpos( ftPattern.start, ftPattern.mid, ftPattern.end, 'nbW', ftPattern.skip ) + if pos != [0, 0] + return name + endif + endfor + + if synName =~ '^\cjavascript' + return 'javascript' + elseif synName =~ '^\ccss' + return 'css' + endif + + return &filetype + + endif + +endfunction "}}} + +if exists( 'b:XPTfiletypeDetect' ) + unlet b:XPTfiletypeDetect +endif +let b:XPTfiletypeDetect = function( 'XPT_htmlFiletypeDetect' ) + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/html/html.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/html/html.xpt.vim new file mode 100644 index 0000000..b57f551 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/html/html.xpt.vim @@ -0,0 +1,412 @@ +" TODO entity char +" TODO back at 'base' +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + \ xml/xml + + + +XPTvar $CURSOR_PH + +XPTvar $CL +XPTinclude + \ _comment/doubleSign + +XPTembed + \ javascript/javascript + \ css/css + +" ========================= Function and Variables ============================= + + + +fun! s:f.createTable(...) "{{{ + let nrow_str = inputdialog("num of row:") + let nrow = nrow_str + 0 + + let ncol_str = inputdialog("num of column:") + let ncol = ncol_str + 0 + + let l = "" + let i = 0 | while i < nrow | let i += 1 + let j = 0 | while j < ncol | let j += 1 + let l .= "\n\n\n" + endwhile + endwhile + return "\n".l."
        " +endfunction "}}} + + +let s:doctypes = { + \ 'HTML 3.2 Final' : 'html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"', + \ 'HTML 4.0 Frameset' : 'html PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd"', + \ 'HTML 4.0 Transitional' : 'html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"', + \ 'HTML 4.0' : 'html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"', + \ 'HTML 4.01 Frameset' : 'html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"', + \ 'HTML 4.01 Transitional' : 'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"', + \ 'HTML 4.01' : 'html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"', + \ 'HTML 5' : 'HTML', + \ 'XHTML 1.0 Frameset' : 'html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"', + \ 'XHTML 1.0 Strict' : 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"', + \ 'XHTML 1.0 Transitional' : 'html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"', + \ 'XHTML 1.1' : 'html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"', + \ 'XHTML Basic 1.0' : 'html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"', + \ 'XHTML Basic 1.1' : 'html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"', + \ 'XHTML Mobile 1.0' : 'html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"', + \ 'XHTML Mobile 1.1' : 'html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"', + \ 'XHTML Mobile 1.2' : 'html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd"', + \} + + +fun! s:f.html_doctype_list() + return keys( s:doctypes ) +endfunction + +fun! s:f.html_doctype_post(v) + if has_key( s:doctypes, a:v ) + return s:doctypes[ a:v ] + else + return '' + endif +endfunction + +fun! s:f.html_enc() + return &fenc == '' ? &encoding : &fenc +endfunction + +let s:nIndent = 0 +fun! s:f.html_cont_ontype() + let v = self.V() + if v =~ '\V\n' + let v = matchstr( v, '\V\.\*\ze\n' ) + let s:nIndent = &indentexpr != '' + \ ? eval( substitute( &indentexpr, '\Vv:lnum', 'line(".")', '' ) ) - indent( line( "." ) - 1 ) + \ : self.NIndent() + + return self.Finish( v . "\n" . repeat( ' ', s:nIndent ) ) + else + return v + endif +endfunction + +fun! s:f.html_cont_helper() + let v = self.V() + if v =~ '\V\n' + return self.ResetIndent( -s:nIndent, "\n" ) + else + return '' + endif +endfunction + + +fun! s:f.html_tag_cmpl() + if !exists( 'b:xpt_html_tags' ) + call htmlcomplete#LoadData() + let tagnames = sort( keys( b:html_omni ) ) + let b:xpt_html_tags = [] + let dict = { + \ 'vimxmlattrinfo' : 1, + \ 'vimxmlentities' : 1, + \ 'vimxmlroot' : 1, + \ 'vimxmltaginfo' : 1, + \ } + for t in tagnames + if !has_key( dict, t ) + call add(b:xpt_html_tags, t) + endif + endfor + endif + + return b:xpt_html_tags + +endfunction + +fun! s:f.html_close_tag() + let v = self.V() + if v =~ '\v/\s*$|^!' + return '' + else + return '' + endif +endfunction + +" ================================= Snippets =================================== + + +call XPTdefineSnippet("id", {'syn' : 'tag'}, 'id="`^"') +call XPTdefineSnippet("class", {'syn' : 'tag'}, 'class="`^"') + + + +" TODO map < to tag + + +XPT tag hidden " <$_xSnipName>.. +XSET content|def=Echo( R( 't' ) =~ '\v/\s*$' ? Finish() : '' ) +XSET content|ontype=html_cont_ontype() +<`t^$_xSnipName^>`content^`content^html_cont_helper()^`t^html_close_tag()^ +..XPT + + +XPT _tag wrap=content hidden " <$_xSnipName >.. +XSET content|ontype=html_cont_ontype() +<`$_xSnipName^>`content^^`content^html_cont_helper()^ +..XPT + +" XPT _t hidden " .. +" <`$_xSnipName^>`cont^ + + +XPT _tagAttr wrap=content hidden " <$_xSnipName >.. +XSET content|ontype=html_cont_ontype() +XSET att?=Echo('') +XSET att?|post=Echo(V()=~'\V\^ \$\|att?' ? '' : V()) +<`$_xSnipName^` `att?^>`content^^`content^html_cont_helper()^ +..XPT + + +XPT _tagblock hidden " <$_xSnipName >\n .. \n +<`$_xSnipName^> + `cursor^^ + + + +XPT _tagblockAttr hidden " <$_xSnipName >\n .. \n +<`$_xSnipName^` `attr^> + `cursor^^ + + + +XPT _shorttag hidden " <$_xSnipName /> +<`$_xSnipName^ /> + + +XPT _shorttagAttr hidden " <$_xSnipName /> +XSET att?=Echo('') +XSET att?|post=Echo(V()=~'\V\^ \$\|att?' ? '' : V()) +<`$_xSnipName^` `att?^/> +..XPT + + +XPT doctype " + + +XPT html " ..... + + + `:head:^ + + `cursor^ + + + + +XPT head " .. + + `:contenttype:^ + `:title:^ + + + + +XPT contenttype " + + +XPT title " .. +`title^expand('%:t:r')^ + + +XPT style " + + + +XPT meta " + + + +XPT link " + + + +XPT script " +..XPT + + +XPT scriptsrc " + + +XPT body " .. + + `cursor^ + + + + +XPT table alias=_tag +XPT tr alias=_tag +XPT td alias=_tag +XPT th alias=_tag + + +XPT fulltable hidden " create a full table +`createTable()^ + + +XPT a wrap " `cursor^ +..XPT + + +XPT div alias=_tag +XPT p alias=_tag +XPT ul alias=_tag +XPT ol alias=_tag +XPT li alias=_tag +XPT span alias=_tag + + + +XPT br alias=_shorttag +XPT img alias=_shorttagAttr +XSET att?=Embed( 'src="`where^" alt="`alt^"' ) + + + +XPT h1 alias=_tag +XPT h2 alias=_tag +XPT h3 alias=_tag +XPT h4 alias=_tag +XPT h5 alias=_tag +XPT h6 alias=_tag + +XPT iframe alias=_tagAttr +XSET att?=Embed( 'name="`name^"' ) + + + +" TODO enctype list : application/x-www-form-urlencoded +XPT form wrap "
        ..
        +XSET method=ChooseStr( 'GET', 'POST' ) +
        + `cursor^ +
        + +XPT textarea alias=_tagAttr +XSET att?=Embed( 'name="`name^"' ) + + +XPT input alias=_shorttagAttr +XSET att?=Embed( 'type="`type^" name="`name^" value="`value^"' ) +XSET type=ChooseStr( 'text', 'password', 'checkbox', 'radio', 'submit', 'reset', 'file', 'hidden', 'image', 'button' ) + + +" TODO other optional attribute like "checked", "readonly" +XPT _input_tmpl hidden " + + +XPT itext alias=_input_tmpl +XPT ipassword alias=_input_tmpl +XPT icheckbox alias=_input_tmpl +XPT iradio alias=_input_tmpl +XPT isubmit alias=_input_tmpl +XPT ireset alias=_input_tmpl +XPT ifile alias=_input_tmpl +XPT ihidden alias=_input_tmpl +XPT iimage alias=_input_tmpl +XPT ibutton alias=_input_tmpl + + +XPT label alias=_tagAttr +XSET att?=Embed( 'for="`which^"' ) + + +XPT select alias=_tagAttr +XSET att?=Embed( 'name="`name^"' ) + + +XPT option alias=_tagAttr +XSET att?=Embed( 'value="`value^"' ) + + +XPT fieldset "
        + + `cursor^ +
        +..XPT + +" XPT sdiv alias=_t + +" XPT diva " tips +" `:div( { 'content' : ':a:' } ):^ + + +" html 5 +" http://dev.w3.org/html5/html4-differences/Overview.html#character-encoding + +" XPT section alias=_tag +" XPT article alias=_tag +" XPT aside alias=_tag +" XPT hgroup alias=_tag +" XPT header alias=_tag +" XPT footer alias=_tag +" XPT nav alias=_tag + +" XPT figure alias=_tag +" XPT figcaption alias=_tag + +" XPT video alias=_tag +" XPT audio alias=_tag +" XPT source alias=_tag + +" XPT embed alias=_tag + +" XPT mark alias=_tag +" XPT progress alias=_tag +" XPT meter alias=_tag +" XPT time alias=_tag + + +" XPT canvas alias=_tag +" XPT comand alias=_tag +" XPT details alias=_tag +" XPT datalist alias=_tag + +" XPT keygen alias=_tag +" XPT output alias=_tag + +" XPT ruby alias=_tag + +" input type= +" tel +" search +" url +" email +" datetime +" date +" month +" week +" time +" datetime-local +" number +" range +" color + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/html/php.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/html/php.xpt.vim new file mode 100644 index 0000000..545e62c --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/html/php.xpt.vim @@ -0,0 +1,31 @@ +" These snippets work only in html context of php file +if &filetype != 'php' + finish +endif + +XPTemplate priority=lang-2 + +" this is html-scope variable independent +if exists( 'php_noShortTags' ) + XPTvar $PHP_TAG php +else + XPTvar $PHP_TAG +endif + + +XPT shebang " #!/usr/bin/env php +#!/usr/bin/env php + +..XPT + +XPT sb alias=shebang + + +XPT php " + + +XPT pe " + + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.ftdetect.vim b/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.ftdetect.vim new file mode 100644 index 0000000..52880ed --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.ftdetect.vim @@ -0,0 +1,77 @@ +if exists( "g:__HTMLDJANGO_FTDETECT_VIM__" ) + finish +endif +let g:__HTMLDJANGO_FTDETECT_VIM__ = 1 + + +if &filetype !~ 'htmldjango' + finish +endif + + +" TODO use array instead of dict because of duplicated key could be possible +let s:skipPattern = 'synIDattr(synID(line("."), col("."), 0), "name") =~? "\\vstring|comment"' +let s:pattern = { + \ 'django' : { + \ 'start' : '\V\c{%', + \ 'mid' : '', + \ 'end' : '\V\c%}', + \ 'skip' : s:skipPattern, + \ }, + \ 'django_expr' : { + \ 'start' : '\V\c{{', + \ 'mid' : '', + \ 'end' : '\V\c}}', + \ 'skip' : s:skipPattern, + \ }, + \ 'javascript' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \ 'css' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \} + +let s:topFT = 'htmldjango' + +fun! XPT_htmldjangoFiletypeDetect() "{{{ + let pos = [ line( "." ), col( "." ) ] + + let synName = xpt#util#NearestSynName() + + if synName == '' + + return s:topFT + + else + + for [ name, ftPattern ] in items( s:pattern ) + let pos = searchpairpos( ftPattern.start, ftPattern.mid, ftPattern.end, 'nbW', ftPattern.skip ) + if pos != [0, 0] + return name + endif + endfor + + if synName =~ '\v^\cjavascript' + return 'javascript' + elseif synName =~ '\v^\ccss' + return 'css' + endif + + return s:topFT + + endif + +endfunction "}}} + +if exists( 'b:XPTfiletypeDetect' ) + unlet b:XPTfiletypeDetect +endif +let b:XPTfiletypeDetect = function( 'XPT_htmldjangoFiletypeDetect' ) + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.xpt.vim new file mode 100644 index 0000000..0823d90 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/htmldjango/htmldjango.xpt.vim @@ -0,0 +1,80 @@ +XPTemplate priority=lang- + + +XPTinclude + \ _common/common + \ html/html + + +XPT _simpletag hidden " {% $_xSnipName %} +{% `$_xSnipName^ %} +..XPT + + +XPT _tag hidden " {% $_xSnipName params %} +{% `$_xSnipName^ `params^ %} +..XPT + + +XPT _qtag hidden " {% $_xSnipName "params" %} +{% `$_xSnipName^ "`params^" %} +..XPT + + +XPT _simpleblock hidden " {% $_xSnipName %}..{% end$_xSnipName %} +{% `$_xSnipName^ %}`content^{% end`$_xSnipName^ %} +..XPT + + +XPT _block wrap=content hidden " {% $_xSnipName params %}..{% end$_xSnipName %} +{% `$_xSnipName^ `params^ %} + `content^ +{% end`$_xSnipName^ %} +..XPT + + +XPT _qblock wrap=content hidden " {% $_xSnipName "params" %}..{% end$_xSnipName %} +{% `$_xSnipName^ "`params^" %} + `content^ +{% end`$_xSnipName^ %} +..XPT + + +XPT _if wrap=content " $_xSnipName .. else .. end$_xSnipName +{% `$_xSnipName^ `param^ %} + `content^ +`else...{{^{% else %} + `content^`}}^ +{% end`$_xSnipName^ %} +..XPT + + +XPT var " {{ var }} +{{ `var^ }} +..XPT + + +XPT autoescape alias=_block +XPT block alias=_block +XPT comment alias=_simpleblock +XPT csrf_token alias=_simpletag +XPT cycle alias=_tag +XPT debug alias=_simpletag +XPT extends alias=_qtag +XPT filter alias=_block +XPT firstof alias=_tag +XPT for alias=_block +XPT empty alias=_simpletag +XPT else alias=_simpletag +XPT if alias=_if +XPT ifchanged alias=_if +XPT ifequal alias=_if +XPT ifnotequal alias=_if +XPT include alias=_qtag +XPT load alias=_tag +XPT now alias=_tag +XPT regroup alias=_tag +XPT url alias=_tag +XPT spaceless alias=_simpleblock +XPT ssi alias=_tag +XPT with alias=_block diff --git a/vim-plugins/bundle/xptemplate/ftplugin/java/java.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/java/java.xpt.vim new file mode 100755 index 0000000..e68e39e --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/java/java.xpt.vim @@ -0,0 +1,113 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE true +XPTvar $FALSE false +XPTvar $NULL null +XPTvar $UNDEFINED null + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH /* cursor */ + +XPTvar $BRif ' ' +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + +XPTvar $CL /* +XPTvar $CM * +XPTvar $CR */ +XPTinclude + \ _comment/doubleSign + +XPTinclude + \ _condition/c.like + \ _loops/java.for.like + \ _loops/c.while.like + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + + + +XPT foreach " for \( .. : .. \) +for (`$SParg^`type^ `var^ : `inWhat^`$SParg^)`$BRloop^{ + `cursor^ +} + + +XPT private " private .. .. +private `type^ `varName^; + +XPT public " private .. .. +public `type^ `varName^; + +XPT protected " private .. .. +protected `type^ `varName^; + +XPT class " class .. ctor +public class `className^ { + public `className^(`$SParg^`ctorParam^`$SParg^)`$BRfun^{ + `cursor^ + } +} + + +XPT main " main ( String ) +public static void main(`$SParg^String[] args`$SParg^)`$BRfun^{ + `cursor^ +} + + +XPT enum " public enum { .. } +`public^ enum `enumName^ +{ + `elem^` `...^, + `subElem^` `...^ +}; +`cursor^ + +XPT prop " var getVar () setVar () +`type^ `varName^; + +`get...^ +XSETm get...|post +public `R("type")^ get`S(R("varName"),'.','\u&',"")^() + { return `R("varName")^; } + +XSETm END +`set...^ +XSETm set...|post +public `R("type")^ set`S(R("varName"),'.','\u&',"")^( `R('type')^ val ) + { `R("varName")^ = val; return `R( 'varName' )^; } + +XSETm END + + +XPT try wrap=what " try .. catch (..) .. finally +XSET handler=$CL handling $CR +try +{ + `what^ +}` `catch...^ +XSETm catch...|post + +catch (`Exception^ `e^) +{ + `handler^ +}` `catch...^ +XSETm END +`finally...{{^finally +{ + `cursor^ +}`}}^ + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/javascript/javascript.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/javascript/javascript.xpt.vim new file mode 100644 index 0000000..768fd9c --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/javascript/javascript.xpt.vim @@ -0,0 +1,163 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + + +XPTvar $TRUE true +XPTvar $FALSE false +XPTvar $NULL null +XPTvar $UNDEFINED undefined + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH /* cursor */ + + +XPTvar $CL /* +XPTvar $CM * +XPTvar $CR */ + +XPTinclude + \ _common/common + \ _comment/doubleSign + \ _condition/ecma + + +XPTvar $VAR_PRE +XPTvar $FOR_SCOPE 'var ' +XPTinclude + \ _loops/for + +XPTinclude + \ javascript/jquery + +" ========================= Function and Variables ============================= + + +" ================================= Snippets =================================== + + + +XPT bench " Benchmark +XSET log=console.log +XSET job=$VOID_LINE +XSET jobn=$VOID_LINE +var t0 = new Date().getTime(); +for (var i = 0; i < `times^; ++i){ + `job^ +} +var t1 = new Date().getTime(); +for (var i = 0; i < `times^; ++i){ + `jobn^ +} +var t2 = new Date().getTime(); +`log^(t1-t0, t2-t1); + +..XPT + +XPT asoe " assertObjectEquals +assertObjectEquals(`mess^ + , `arr^ + , `expr^) + + +XPT cmt " /** @auth... */ +XSET author=$author +XSET email=$email +/** +* @author : `author^ | `email^ +* @description +* `cursor^ +* @return {`Object^} `desc^ +*/ + + +XPT cpr " @param +@param {`Object^} `name^ `desc^ + + +" file comment +" 4 back slash represent 1 after rendering. +XPT fcmt " full doxygen comment +/**-------------------------/// `sum^ \\\--------------------------- + * + * `function^ + * @version : `1.0^ + * @since : `date^ + * + * @description : + * `cursor^ + * @usage : + * + * @author : `$author^ | `$email^ + * @copyright : + * @TODO : + * + *--------------------------\\\ `sum^ ///---------------------------*/ + + +XPT fun " function ..( .. ) {..} +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +function` `name^ (`arg*^) { + `cursor^ +} + + +XPT forin " for (var .. in ..) {..} +for ( var `i^ in `array^ )`$BRloop^{ + var `e^ = `array^[`i^]; + `cursor^ +} + + +XPT new " var .. = new ..\(..) +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +var `instant^ = new `Constructor^(`arg*^) + + +XPT proto " ...prototype... = function\(..) { .. } +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +`Class^.prototype.`method^ = function(`arg*^)`$BRfun^{ +`cursor^ +} + + +XPT setTimeout " setTimeout\(function\() { .. }, ..) +XSET job=$VOID_LINE +setTimeout(function() { `job^ }, `milliseconds^) + + +XPT try wrap=job " try {..} catch {..} finally +XSET dealError=/* error handling */ +XSET job=$VOID_LINE +try`$BRif^{ + `job^ +} +catch (`err^)`$BRif^{ + `dealError^ +}`...^ +catch (`err^)`$BRif^{ + `dealError^ +}`...^` +`finally...{{^ +finally`$BRif^{ + `cursor^ +}`}}^ + + +XPT bench_ wraponly=wrapped " Benchmark +XSET log=console.log +var t0 = new Date().getTime(); +for (var i = 0; i < `times^; ++i){ + `wrapped^ +} +var t1 = new Date().getTime(); +`log^(t1-t0); + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/javascript/jquery.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/javascript/jquery.xpt.vim new file mode 100644 index 0000000..ac665dd --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/javascript/jquery.xpt.vim @@ -0,0 +1,558 @@ +" finish " not finished +if !g:XPTloadBundle( 'javascript', 'jquery' ) + finish +endif + +XPTemplate priority=lang-2 + +let s:f = g:XPTfuncs() + +XPTvar $TRUE true +XPTvar $FALSE false +XPTvar $NULL null +XPTvar $UNDEFINED undefined + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +" XPTvar $JQ jQuery +XPTvar $JQ $ + +XPTinclude + \ _common/common + + +" ========================= Function and Variables ============================= +let s:options = { + \'async' : 1, + \'beforeSend' : 1, + \'cache' : 1, + \'complete' : 1, + \'contentType' : 1, + \'data' : 1, + \'dataFilter' : 1, + \'dataType' : 1, + \'error' : 1, + \'global' : 1, + \'ifModified' : 1, + \'jsonp' : 1, + \'password' : 1, + \'processData' : 1, + \'scriptCharset' : 1, + \'success' : 1, + \'timeout' : 1, + \'type' : 1, + \'url' : 1, + \'username' : 1, + \'xhr' : 1, + \} +fun! s:f.jquery_ajaxOptions() + +endfunction + +" ================================= Snippets =================================== + +" =============== +" Snippet Pieces +" =============== + +XPT optionalExpr hidden +(`$SParg^`expr?^`expr?^CmplQuoter_pre()^`$SParg^) + +XPT expr hidden +(`$SParg^`expr^`expr^CmplQuoter_pre()^`$SParg^) + +XPT maybeFunction hidden +(`$SParg^`function...{{^function(`i^`, `e?^) { `cursor^ }`}}^`$SParg^) + +XPT optionalVal hidden +(`$SParg`val?`$SParg^) + +XPT _funExp hidden +`function...{{^function(`i^`, `e?^) { `cursor^ }`}}^ +..XPT + +" ============ +" jQuery Core +" ============ + +XPT $ " $\() +$(`$SParg^`e^`e^CmplQuoter_pre()^`, `context?^`$SParg^) + +XPT jq " jQuery\() +jQuery(`$SParg^`e^`e^CmplQuoter_pre()^`, `context?^`$SParg^) + +XPT each " each\(... +each`:maybeFunction:^ + +XPT sz " size\() +size() + +XPT eq " eq\(...) +eq(`$SParg^`^`$SParg^) + +XPT get " get\(...) +get(`$SParg^`^`$SParg^) + +XPT ind " index\(...) +index(`$SParg^`^`$SParg^) + +XPT da " data\(.., ..) +data(`$SParg^`name^`, `value?^`$SParg^) + +XPT rmd " removeData\(..) +removeData(`$SParg^`name^`$SParg^) + +XPT qu " queue\(.., ..) +queue(`$SParg^`name^`, `toAdd?^`$SParg^) + +XPT dq " dequeue\(...) +dequeue(`$SParg^`name^`$SParg^) +..XPT + + + + +" ================== +" jQuery Attributes +" ================== + +XPT attr " attr\(.. +attr(`$SParg^`name^`$SParg^) + +XPT rma " removeAttr\(.. +removeAttr(`$SParg^`name^`$SParg^) + +XPT ac " addClass\(.. +addClass(`$SParg^`class^`$SParg^) + +XPT hc " hasClass\(.. +hasClass(`$SParg^`class^`$SParg^) + +XPT tc " toggleClass\(.. +toggleClass(`$SParg^`class^`, `switch?^`$SParg^) + +XPT html " html\(.. +html`:optionalVal:^ + +XPT text " text\(.. +text`:optionalVal:^ + +XPT val " val\(.. +val`:optionalVal:^ +..XPT + + + + +" =================== +" CSS +" =================== + +XPT css " css\(.. +css`:optionalVal:^ + +XPT os " offset\() +offset() + +XPT osp " offsetParent\() +offsetParent() + +XPT pos " position\() +position() + +XPT scrt " scrollTop\() +scrollTop`:optionalVal:^ + +XPT scrl " scrollLeft\() +scrollLeft`:optionalVal:^ + +XPT ht " height\(..) +height`:optionalVal:^ + +XPT wth " width\(..) +width`:optionalVal:^ + +XPT ih " innerHeight\() +innerHeight() + +XPT iw " innerWidth\() +innerWidth() + +XPT oh " outerHeight\(..) +outerHeight(`$SParg^`margin^`$SParg^) + +XPT ow " outerWidth\(..) +outerWidth(`$SParg^`margin^`$SParg^) +..XPT + + + + + +" =================== +" Traversing +" =================== + +XPT flt " filter\(.. +filter`:maybeFunction:^ + +XPT is " is\(.. +is`:expr:^ + +XPT map " map\(.. +map`:maybeFunction:^ + +XPT not " not\(..) +not`:expr:^ + +XPT slc " slice\(start, end) +slice(`$SParg^`start^`, `end?^`$SParg^) + +XPT add " add\(..) +add`:expr:^ + +XPT chd " children\(..) +children`:optionalExpr:^ + +XPT cls " closest\(..) +closest`:expr:^ + +XPT con " content\() +content() + +XPT fd " find\(..) +find`:expr:^ + +XPT ne " next\(..) +next`:optionalExpr:^ + +XPT na " nextAll\(..) +nextAll`:optionalExpr:^ + +XPT pr " parent\(..) +parent`:optionalExpr:^ + +XPT prs " parents\(..) +parents`:optionalExpr:^ + +XPT prv " prev\(..) +prev`:optionalExpr:^ + +XPT pra " prevAll\(..) +prevAll`:optionalExpr:^ + +XPT sib " sibling\(..) +sibling`:optionalExpr:^ + +XPT as " andSelf\() +andSelf() + +XPT end " end\() +end() +..XPT + + + +" =================== +" Manipulation +" =================== +XPT ap " append\(..) +append`:expr:^ + +XPT apt " appendTo\(..) +appendTo`:expr:^ + +XPT pp " prepend\(..) +prepend`:expr:^ + +XPT ppt " prependTo\(..) +prependTo`:expr:^ + +XPT af " after\(..) +after`:expr:^ + +XPT bf " before\(..) +before`:expr:^ + +XPT insa " insertAfter\(..) +insertAfter`:expr:^ + +XPT insb " insertBefore\(..) +insertBefore`:expr:^ + +XPT wr " wrap\(..) +wrap`:expr:^ + +XPT wra " wrapAll\(..) +wrapAll`:expr:^ + +XPT wri " wrapInner\(..) +wrapInner`:expr:^ + +XPT rep " replaceWith\(..) +replaceWith`:expr:^ + +XPT repa " replaceAll\(..) +replaceAll`:expr:^ + +XPT emp " empty\() +empty() + +XPT rm " remove\(..) +remove`:optionalExpr:^ + +XPT cl " clone\(..) +cloen`:optionalExpr:^ +..XPT + +" ========================= +" Ajax +" ========================= +" TODO callback +" TODO ajax option +" TODO universial behavior for clearing optional argument + +XPT _ld_callback hidden +function(`$SParg^`resText^`, `textStatus^`, `xhr^`$SParg^) { `cursor^ } + +XPT _aj_type hidden +XSET type=ChooseStr( '"xml"', '"html"', '"script"', '"json"', '"jsonp"', '"text"' ) +`, `type^ + +XPT _fun0 hidden +function() { `cursor^ } + + + +XPT aj " $JQ.ajax\(..) +`$JQ^.ajax(`$SParg^`opt^`$SParg^) + +XPT load " load\(url, ...) +load(`$SParg^`url^`url^CmplQuoter_pre()^`, `data^`data^CmplQuoter_pre()^`, `function...{{^, `:_ld_callback:^`}}^`$SParg^) + +XPT ag " $JQ.get\(url, ...) +`$JQ^.get(`$SParg^`url^`url^CmplQuoter_pre()^`, `data^`data^CmplQuoter_pre()^`, `callback^`:_aj_type:^`$SParg^) + +XPT agj " $JQ.getJSON\(url, ...) +`$JQ^.getJSON(`$SParg^`url^`url^CmplQuoter_pre()^`, `data^`, `callback^`$SParg^) + +XPT ags " $JQ.getScript\(url, ...) +`$JQ^.getScript(`$SParg^`url^`url^CmplQuoter_pre()^`, `callback^`$SParg^) + +XPT apost " $JQ.post\(url, ...) +`$JQ^.post(`$SParg^`url^`url^CmplQuoter_pre()^`, `data^`data^CmplQuoter_pre()^`, `callback^`:_aj_type:^`$SParg^) + + + +XPT ajaxComplete " ajaxComplete\(callback) +ajaxComplete(`$SParg^`fun...{{^function (`$SParg^`event^`, `xhr^`, `ajaxOption^`$SParg^){ `cursor^ }`}}^`$SParg^) + +XPT ajaxError " ajaxError\(callback) +ajaxError(`$SParg^`fun...{{^function (`$SParg^`event^`, `xhr^`, `ajaxOption^`, `err^`$SParg^){ `cursor^ }`}}^`$SParg^) + +XPT ajaxSend " ajaxSend\(callback) +ajaxSend(`$SParg^`fun...{{^function (`$SParg^`event^`, `xhr^`, `ajaxOption^`$SParg^){ `cursor^ }`}}^`$SParg^) + +XPT ajaxStart " ajaxStart\(callback) +ajaxStart(`$SParg^`fun...{{^`:_fun0:^`}}^`$SParg^) + +XPT ajaxStop " ajaxStop\(callback) +ajaxStop(`$SParg^`fun...{{^`:_fun0:^`}}^`$SParg^) + +XPT ajaxSuccess " ajaxSuccess\(callback) +ajaxSuccess(`$SParg^`fun...{{^function (`$SParg^`event^`, `xhr^`, `ajaxOption^`$SParg^){ `cursor^ }`}}^`$SParg^) + + + +XPT asetup " $JQ.ajaxSetup\(opt) +`$JQ^.ajaxSetup(`$SParg^`opt^`$SParg^) + +XPT ser " serialize\() +serialize() + +XPT sera " serializeArray\() +serializeArray() +..XPT + + +" =================== +" Events +" =================== +XPT _ev_fun_a hidden +XSET job=VoidLine() +function (`$SParg^`ev^`$SParg^) { `job^ } + +XPT _ev_fun hidden +function (`$SParg^`ev^`$SParg^) { `cursor^ } + +XPT _ev_arg hidden +(`$SParg^`type^`type^CmplQuoter_pre()^`, `data^`, `fun...{{^, `:_ev_fun:^`}}^`$SParg^) + +XPT _ev_tr_arg hidden +(`$SParg^`ev^`ev^CmplQuoter_pre()^`, `data^`$SParg^) + +XPT _ev_arg_fun hidden +(`$SParg^`fun...{{^`:_ev_fun:^`}}^`$SParg^) + + + +XPT rd " ready\(fun) +ready(`$SParg^`fun...{{^`:_fun0:^`}}^`$SParg^) + +XPT bd " bind\(type, data, fun) +bind`:_ev_arg:^ + +XPT one " one\(type, data, fun) +one`:_ev_arg:^ + +XPT tr " trigger\(ev, data) +trigger`:_ev_tr_arg:^ + +XPT trh " triggerHandler\(ev, data) +triggerHandler`:_ev_tr_arg:^ + +XPT ub " unbind\(type, fun) +unbind(`$SParg^`type^`type^CmplQuoter_pre()^`, `fun^`$SParg^) + +XPT lv " live\(type, fun) +live`:_ev_arg:^ + +XPT die " die\(type, fun) +die(`$SParg^`type^`type^CmplQuoter_pre()^`, `fun^`$SParg^) + +XPT ho " hover\(over, out) +hover(`$SParg^`over...{{^, `:_ev_fun_a:^`}}^`, `out..{{^, `:_ev_fun:^`}}^`$SParg^) + +XPT tg " toggle\(fn1, fn2, ...) +toggle(`$SParg^`fn1...{{^, `:_ev_fun_a:^`}}^`, `fn2...{{^, `:_ev_fun:^`}}^`$SParg^) + + + +XPT bl " blur\(fun) +blur`:_ev_arg_fun:^ + +XPT res " resize\(fun) +resize`:_ev_arg_fun:^ + +XPT scr " scroll\(fun) +scroll`:_ev_arg_fun:^ + +XPT sel " select\(fun) +select`:_ev_arg_fun:^ + +XPT sub " submit\(fun) +submit`:_ev_arg_fun:^ + +XPT unl " unload\(fun) +unload`:_ev_arg_fun:^ + + + +XPT kdown " keydown\(fun) +keydown`:_ev_arg_fun:^ + +XPT kup " keyup\(fun) +keyup`:_ev_arg_fun:^ + +XPT kpress " keypress\(fun) +keypress`:_ev_arg_fun:^ + +XPT clk " click\(fun) +click`:_ev_arg_fun:^ + +XPT dclk " dbclick\(fun) +dbclick`:_ev_arg_fun:^ + + + +XPT foc " focus\(fun) +focus`:_ev_arg_fun:^ + +XPT err " error\(fun) +error`:_ev_arg_fun:^ + + + +XPT mup " mouseup\(fun) +mouseup`:_ev_arg_fun:^ + +XPT mdown " mousedown\(fun) +mousedown`:_ev_arg_fun:^ + +XPT mmove " mousemove\(fun) +mousemove`:_ev_arg_fun:^ + +XPT menter " mouseenter\(fun) +mouseenter`:_ev_arg_fun:^ + +XPT mleave " mouseleave\(fun) +mouseleave`:_ev_arg_fun:^ + +XPT mout " mouseout\(fun) +mouseout`:_ev_arg_fun:^ + + + + +XPT ld " load\(fun) +load`:_ev_arg_fun:^ + +XPT ch " change\(fun) +change`:_ev_arg_fun:^ +..XPT + + + +" =================== +" Effects +" =================== + +XPT _ef_arg hidden +(`$SParg^`speed^`speed^CmplQuoter_pre()^`, `fun...{{^, `:_fun0:^`}}^`$SParg^) + +XPT sh " show\(speed, callback) +show`:_ef_arg:^ + +XPT hd " hide\(speed, callback) +hide`:_ef_arg:^ + +XPT sld " slideDown\(speed, callback) +slideDown`:_ef_arg:^ + +XPT slu " slideUp\(speed, callback) +slideUp`:_ef_arg:^ + +XPT slt " slideToggle\(speed, callback) +slideToggle`:_ef_arg:^ + + + +XPT fi " fadeIn\(speed, callback) +fadeIn`:_ef_arg:^ + +XPT fo " fadeOut\(speed, callback) +fadeOut`:_ef_arg:^ + +XPT ft " fadeTo\(speed, callback) +fadeTo(`$SParg^`speed^`speed^CmplQuoter_pre()^`, `opacity^`opacity^CmplQuoter_pre()^`, `fun...{{^, `:_fun0:^`}}^`$SParg^) + +XPT ani " animate\(params, ...) +animate(`$SParg^`params^`, `param^`$SParg^) + +XPT stop " stop\() +stop() +..XPT + +" =================== +" TODO select helper +" =================== + + + +" ================================= Wrapper =================================== + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/json/json.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/json/json.xpt.vim new file mode 100644 index 0000000..0e49585 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/json/json.xpt.vim @@ -0,0 +1,23 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +" use snippet 'varConst' to generate contant variables +" use snippet 'varFormat' to generate formatting variables +" use snippet 'varSpaces' to generate spacing variables + + +XPTinclude + \ _common/common + +XPT array " [ ..., ... ] +[ `val^`...^, `val^`...^ ] + +XPT obj " { "...":... } +{ "`key^":`val^`...^, "`key^":`val^`...^ } + +XPT dic " { "...":..., ... } +{ "`key^":`val^`...^, + "`key^":`val^`...^ +} + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/lex/lex.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/lex/lex.xpt.vim new file mode 100644 index 0000000..c46496f --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/lex/lex.xpt.vim @@ -0,0 +1,45 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH cursor + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + \ c/c + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + +XPT lex " Basic lex file +%{ +/* includes */ +%} +/* options */ +%% +/* rules */ +%% +/* C code */ + + +XPT ruleList " .. {..} ... +`reg^ { `return^ }`...^ +`reg^ { `return^ }`...^ + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/lua/lua.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/lua/lua.xpt.vim new file mode 100644 index 0000000..d408a7a --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/lua/lua.xpt.vim @@ -0,0 +1,143 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH -- cursor + +XPTvar $BRif \n +XPTvar $BRloop \n +XPTvar $BRloop \n +XPTvar $BRstc \n +XPTvar $BRfun \n + +XPTvar $CS -- + +XPTinclude + \ _common/common + \ _comment/singleSign + + +" ========================= Function and Variables ============================= + +" Remove an item if its value hasn't change +fun! s:f.RemoveIfUnchanged() "{{{ + let v = self.V() + let [lft, rt] = self.ItemEdges() + if v == lft . self.N() . rt + return '' + else + return v + end +endfunction "}}} + +" ================================= Snippets =================================== + + + +XPT do " do ... end +do + `cursor^ +end + + +XPT fn " function \(..) .. end +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +function (`arg*^) `cursor^ end + + +XPT for " for ..=..,.. do ... end +XSET step?|post=EchoIfNoChange('') +for `var^ = `0^, `10^`, `step?^ do + `cursor^ +end + + +XPT forin " for .. in .. do ... end +XSET var*|post=ExpandIfNotEmpty(', ', 'var*') +for `var*^ in `expr^ do + `cursor^ +end + + +XPT forip " for ..,.. in ipairs\(..) do ... end +for `key^, `value^ in ipairs(`table^) do + `cursor^ +end + + +XPT forp " for ..,.. in pairs\(..) do ... end +for `key^, `value^ in pairs(`table^) do + `cursor^ +end + + +XPT fun " function ..\(..) .. end +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +function `name^(`arg*^) + `cursor^ +end + + +XPT if " if .. then .. end +if `cond^ then + `cursor^ +end + + +XPT ife " if .. then .. else .. end +XSET job=$CS job +if `cond^ then + `job^ +else + `cursor^ +end + + +XPT ifei " if .. then .. elseif .. else .. end +XSET job=$CS job +if `cond^ then` + `job^ +``elseif...` +{{^elseif `comparison^ then + `job^ +``elseif...` +^`}}^``else...` +{{^else + `cursor^ +`}}^end + + +XPT locf " local function ..\(..) ... end +XSET arg*|post=ExpandIfNotEmpty(', ', 'arg*') +local function `name^(`arg*^) + `cursor^ +end + + +" !!! snippet ends with a space !!! +XPT locv " local .. = .. +local `var^ = + + +XPT p " print\(..) +print(`cursor^) + + +XPT repeat " repeat .. until .. +repeat + `cursor^ +until + + +XPT while " while .. do ... end +while `cond^ do + `cursor^ +end + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/make/make.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/make/make.xpt.vim new file mode 100644 index 0000000..aa88df7 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/make/make.xpt.vim @@ -0,0 +1,76 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE # void +XPTvar $CURSOR_PH # cursor + +XPTvar $CS # + +XPTinclude + \ _common/common + \ _comment/singleSign + + +" ========================= Function and Variables ============================= + + +" ================================= Snippets =================================== + +XPT addprefix " $(addprefix ...) +$(addprefix `prefix^, `elemList^) + + +XPT addsuffix " $(addsuffix ...) +$(addsuffix `suffix^, `elemList^) + + +XPT filterout " $(filter-out ...) +$(filter-out `toRemove^, `elemList^) + + +XPT patsubst " $(patsubst ...) +$(patsubst `sourcePattern^%.c^, `destPattern^%.o^, `list^) + + +XPT shell " $(shell ...) +$(shell `command^) + + +XPT subst " $(subst ...) +$(subst `sourceString^, `destString^, `string^) + + +XPT wildcard " $(wildcard ...) +$(wildcard `globpattern^) + + +XPT ifneq " ifneq ... else ... endif +ifneq (`what^, `with^) + `job^ +``else...` +{{^else + `cursor^ +`}}^endif + + +XPT ifeq " ifneq ... else ... endif +XSET job=$CS job +ifeq (`what^, `with^) + `job^ +``else...` +{{^else + `cursor^ +`}}^endif + + +XPT basevar " CC ... CFLAG .. +`lang^C^C := `compiler^gcc^ +`lang^C^FLAGS := `switches^-Wall -Wextra^ + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/markdown/markdown.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/markdown/markdown.xpt.vim new file mode 100644 index 0000000..9e79652 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/markdown/markdown.xpt.vim @@ -0,0 +1,95 @@ +XPTemplate priority=lang mark=~^ + +let s:f = g:XPTfuncs() + +fun! s:f.HeaderPref() + let snipname = self.GetVar('$_xSnipName') + let nr = snipname[ 1 : 1 ] * 1 + return repeat('#', nr) +endfunction + +fun! s:f.UnderLine(char) + let v = self.ItemValue() + if v == '' + return '' + else + " line break before "===" and after "===" + return "\n" . repeat(a:char, len(v)) . "\n" + endif +endfunction + +fun! s:f.QuitContition() + let v = self.ItemValue() + if v == '' || v =~ '\V\n' + let q = self.Next(substitute(v, '\V\n', '', 'g')) + return q + endif +endfunction + +fun! s:f.BuildRef() + let title = '' + let id = self.R( 'refId' ) + + let url = s:f[ '_markdown_snipp_url' ] + unlet s:f[ '_markdown_snipp_url' ] + + if has_key( s:f, '_markdown_snipp_title' ) + let title = '"' . s:f[ '_markdown_snipp_title' ] . '"' + unlet s:f[ '_markdown_snipp_title' ] + endif + + call append( line('$'), '[' . id . ']: <' . url . '> ' . title ) + return '\n' +endfunction + +XPTinclude + \ _common/common + +XPT sharp_header hidden " HeaderPref() title +~HeaderPref() ~t^ + +XPT h1 alias=sharp_header +XPT h2 alias=sharp_header +XPT h3 alias=sharp_header +XPT h4 alias=sharp_header +XPT h5 alias=sharp_header +XPT h6 alias=sharp_header + +XPT header_alt hidden " ... repeat($decoration,3) +XSET $decoration== +XSET t|ontype=QuitContition() +~t^~t^UnderLine($decoration)^~^ + +XPT ha1 alias=header_alt +XSET $decoration== + +XPT ha2 alias=header_alt +XSET $decoration=- + +XPT title alias=ha1 +XPT section alias=ha2 +XPT subsection alias=h3 + + +XPT link " [...](...) +[~text^](~url^~ ~title?^) + +XPT img " ![...](...) +![~alt-text^](~url^~ ~title?^) + +XPT ref " [...][...] +[~text^][~refid^] + +XPT def " [name]: url +[~refid^]: ~url^ + +XPT hr " ----- +--- + +XPT ruler alias=hr + +XPT table " | header | ... | +| | | +| :-- | --: | +| | | + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/objc/autoimplem.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/objc/autoimplem.xpt.vim new file mode 100644 index 0000000..6fd16be --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/objc/autoimplem.xpt.vim @@ -0,0 +1,12 @@ +" Steal autoimplem from C snippets. +if !g:XPTloadBundle( 'objc', 'autoimplem' ) + finish +endif +XPTemplate priority=lang-2 + +let g:objcautoimlemneedc = 1 + +XPTinclude + \ _common/common + \ c/autoimplem + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/objc/objc.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/objc/objc.xpt.vim new file mode 100644 index 0000000..db8ebcb --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/objc/objc.xpt.vim @@ -0,0 +1,66 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +" Objective C can reuse all the C snippets, so include +" them by default. +XPTinclude + \ _common/common + \ c/c + +XPT msg " [to ...] +[`to^ `msg^`args...{{^:`arg^`...{{^ `argName^:`argVal^`...^`}}^`}}^] + +XPT forin " for (... in ...) { ... } +for (`type^id^ `var^ in `collection^) +{ + `cursor^ +} + +XPT import " #import "..." +#import "`hfile^" + +XPT #import " #import <...> +#import <`hfile^> + +XPT protocol " @protocol ... @end +@protocol `protocolName^ +`cursor^ +@end + +XPT interface " @interface ... : ... ... +@interface `interfaceName^ `inherit...{{^ : `father^ `}}^{ + // put instances variable here + `cursor^ +} +// put methods here +@end + +XPT implementation " @implementation ... @end +@implementation `className^ +`cursor^ +@end + +XPT categorie " @interface ... (...) ... @end +@interface `existingClass^ (`categorieName^) +`cursor^ +@end + +XPT catimplem " @implementation ... (...) ... @end +@implementation `existingClass^ (`categorieName^) +`cursor^ +@end + +XPT alloc " [[... alloc] ...] +[[`className^ alloc] `cursor^] + +XPT method " - (...) ....: ... +- (`retType^void^) `methodName^`args...{{^`...^ (`type^)name`...^`}}^; + +XPT implmethod " - (...) ... { ... } +- (`retType^) `methodName^ { + `cursor^ +} + +XPT alloc " [[... alloc] ...] +[[`className^ alloc] `cursor^] diff --git a/vim-plugins/bundle/xptemplate/ftplugin/ocaml.revised/ocaml.revised.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/ocaml.revised/ocaml.revised.xpt.vim new file mode 100644 index 0000000..fd3efd3 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/ocaml.revised/ocaml.revised.xpt.vim @@ -0,0 +1,172 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE (* void *) +XPTvar $CURSOR_PH (* cursor *) + +XPTvar $BRif ' ' +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTvar $CL (* +XPTvar $CM * +XPTvar $CR *) + +XPTinclude + \ _common/common + \ _comment/doubleSign + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + +XPT if " if .. then .. else .. +if `cond^ +then `cursor^ + + +XPT match " match .. with [.. -> .. | ..] +match `expr^ with + [ `what0^ -> `with0^`...^ + | `what^ -> `with^`...^ + ] + + +XPT moduletype " module type .. = sig .. end +module type `name^ `^ = sig + `cursor^ +end; + + +XPT module " module .. = struct .. end +XSET name|post=SV( '^\w', '\u&' ) +module `name^ `^ = struct + `cursor^ +end; + +XPT while " while .. do .. done +while `cond^ do + `cursor^ +done + +XPT for " for .. to .. do .. done +XSET side=Choose(['to', 'downto']) +for `var^ = `val^ `side^ `expr^ do + `cursor^ +done + +XPT class " class .. = object .. end +class `_^^ `name^ = +object (self) + `cursor^ +end; + + +XPT classtype " class type .. = object .. end +class type `name^ = +object + method `field^ : `type^` `...^ + method `field^ : `type^` `...^ +end; + + +XPT classtypecom " (** .. *) class type .. = object .. end +(** `class_descr^^ *) +class type `name^ = +object + (** `method_descr^^ *) + method `field^ : `type^` `...^ + (** `method_descr^^ *) + method `field^ : `type^` `...^ +end; + + +XPT typesum " type .. = .. | .. +XSET typeParams?|post=EchoIfNoChange( '' ) +type `typename^` `typeParams?^ = + [ `constructor^`...^ + | `constructor^`...^ + ]; + + +XPT typesumcom " (** .. *) type .. = .. | .. +XSET typeParams?|post=EchoIfNoChange( '' ) +(** `typeDescr^ *) +type `typename^` `typeParams?^ = + [ `constructor^ (** `ctordescr^ *)`...^ + | `constructor^ (** `ctordescr^ *)`...^ + ]; + + +XPT typerecord " type .. = { .. } +XSET typeParams?|post=EchoIfNoChange( '' ) +type `typename^` `typeParams?^ = + { `recordField^ : `fType^` `...^ + ; `recordField^ : `fType^` `...^ + }; + + +XPT typerecordcom " (** .. *)type .. = { .. } +(** `type_descr^ *) +type `typename^ `_^^= + { `recordField^ : `fType^ (** `desc^ *)`...^ + ; `otherfield^ : `othertype^ (** `desc^ *)`...^ + }; + + +XPT try wrap=expr " try .. with .. -> .. +try `expr^ +with [ `exc^ -> `rez^ +` `...` +{{^ | `exc2^ -> `rez2^ +` `...` +^`}}^ ] + +XPT val " value .. : .. +value `thing^ : `cursor^ + +XPT ty " .. -> .. +`t^`...^ -> `t2^`...^ + +XPT do " do { .. } +do { + `cursor^ +} + +XPT begin " begin .. end +begin + `cursor^ +end + +XPT fun " (fun .. -> ..) +(fun `args^ -> `^) + +XPT func " value .. : .. = fun .. -> +value `funName^ : `ty^ = +fun `args^ -> + `cursor^; + + +XPT letin " let .. = .. in +let `name^ `_^^ = + `what^ `...^ +and `subname^ `_^^ = + `subwhat^`...^ +in + + +XPT letrecin " let rec .. = .. in +let rec `name^ `_^^ = + `what^ `...^ +and `subname^ `_^^ = + `subwhat^`...^ +in + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/ocaml/ocaml.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/ocaml/ocaml.xpt.vim new file mode 100755 index 0000000..1765d58 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/ocaml/ocaml.xpt.vim @@ -0,0 +1,181 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE (* void *) +XPTvar $CURSOR_PH (* cursor *) + +XPTvar $BRif ' ' +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTvar $CL (* +XPTvar $CM * +XPTvar $CR *) + +XPTinclude + \ _common/common + \ _comment/doubleSign + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + + + + +XPT if " if .. then .. else .. +if `cond^ + then `cursor^`else...{{^ + else`}}^ + + +" NOTE: the first repetition indent is different from the second one. Thus we +" need two part repetition +XPT match " match .. with .. -> .. | .. +match `expr^ with + `what^ -> `with^` `...{{^ + | `what^ -> `with^` `more...{{^ + | `what^ -> `with^` `more...^`}}^`}}^ + + +XPT moduletype " module type .. = sig .. end +module type `name^ `^ = sig + `cursor^ +end + + +XPT module " module .. = struct .. end +XSET name|post=SV( '^\w', '\u&' ) +module `name^ `^ = struct + `cursor^ +end + +XPT while " while .. do .. done +while `cond^ do + `cursor^ +done + +XPT for " for .. to .. do .. done +XSET side=Choose(['to', 'downto']) +for `var^ = `val^ `side^ `expr^ do + `cursor^ +done + +XPT class " class .. = object .. end +class `_^^ `name^ = +object (self) + `cursor^ +end + + +XPT classtype " class type .. = object .. end +class type `name^ = +object + method `field^ : `type^` `...^ + method `field^ : `type^` `...^ +end + + +XPT classtypecom " (** .. *) class type .. = object .. end +(** `class_descr^^ *) +class type `name^ = +object + (** `method_descr^^ *) + method `field^ : `type^` `...^ + (** `method_descr^^ *) + method `field^ : `type^` `...^ +end + + +" NOTE: the first repetition indent is different from the second one. Thus we +" need two part repetition +XPT typesum " type .. = .. | .. +XSET typeParams?|post=EchoIfNoChange( '' ) +type `typename^` `typeParams?^ = + `constructor^` `...{{^ + | `constructor^` `more...{{^ + | `constructor^` `more...^`}}^`}}^ + + +XPT typesumcom " (** .. *) type .. = .. | .. +XSET typeParams?|post=EchoIfNoChange( '' ) +(** `typeDescr^ *) +type `typename^` `typeParams?^ = + `constructor^ (** `ctordescr^ *)` `...{{^ + | `constructor^ (** `ctordescr^ *)` `more...{{^ + | `constructor^ (** `ctordescr^ *)` `more...^`}}^`}}^ + + +XPT typerecord " type .. = { .. } +XSET typeParams?|post=EchoIfNoChange( '' ) +type `typename^` `typeParams?^ = + { `recordField^ : `fType^` `...^ + ; `recordField^ : `fType^` `...^ + } + + +XPT typerecordcom " (** .. *)type .. = { .. } +(** `type_descr^ *) +type `typename^ `_^^= + { `recordField^ : `fType^ (** `desc^ *)` `...^ + ; `otherfield^ : `othertype^ (** `desc^ *)` `...^ + } + + +XPT try wrap=expr " try .. with .. -> .. +try `expr^ +with `exc^ -> `rez^ +` `...` +{{^ | `exc2^ -> `rez2^ +` `...` +^`}}^ + +XPT val " value .. : .. +value `thing^ : `cursor^ + +XPT ty " .. -> .. +`t^`...^ -> `t2^`...^ + +XPT do " do { .. } +do { + `cursor^ +} + +XPT begin " begin .. end +begin + `cursor^ +end + +XPT fun " (fun .. -> ..) +(fun `args^ -> `^) + +XPT func " value .. : .. = fun .. -> +let `funName^ : `ty^ = +fun `args^ -> + `cursor^ + + +XPT letin " let .. = .. in +let `name^ `_^^ = + `what^` `...^ +and `subname^ `_^^ = + `subwhat^` `...^ +in + + +XPT letrecin " let rec .. = .. in +let rec `name^ `_^^ = + `what^` `...^ +and `subname^ `_^^ = + `subwhat^` `...^ +in + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/perl/perl.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/perl/perl.xpt.vim new file mode 100644 index 0000000..9e708e7 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/perl/perl.xpt.vim @@ -0,0 +1,151 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL +XPTvar $UNDEFINED + +XPTvar $VOID_LINE # void; +XPTvar $CURSOR_PH # cursor + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + +XPTvar $CS # +XPTinclude + \ _comment/singleSign + +XPTvar $VAR_PRE $ +XPTvar $FOR_SCOPE 'my ' +XPTinclude + \ _loops/for + +XPTinclude + \ _loops/c.while.like + + +" ========================= Function and Variables ============================= + + +" ================================= Snippets =================================== + + +" perl has no NULL value +XPT fornn hidden=1 + +XPT whilenn hidden=1 + + +XPT perl " #!/usr/bin/env perl +#!/usr/bin/env perl + +..XPT + + +XPT xif " .. if ..; +`expr^ if `cond^; + + +XPT xwhile " .. while ..; +`expr^ while `cond^; + + +XPT xunless " .. unless ..; +`expr^ unless `cond^; + + +XPT xforeach " .. foreach ..; +`expr^ foreach @`array^; + + +XPT sub " sub .. { .. } +sub `fun_name^`$BRfun^{ + `cursor^ +} + + +XPT unless " unless ( .. ) { .. } +unless`$SPcmd^(`$SParg^`cond^`$SParg^)`$BRif^{ + `cursor^ +} + + +XPT eval wrap=risky " eval { .. };if... +eval`$BRif^{ + `risky^ +}; +if`$SPcmd^(`$SParg^$@`$SParg^)`$BRif^{ + `handle^ +} + +XPT try alias=eval " eval { .. }; if ... + + +XPT whileeach " while \( \( key, val ) = each\( %** ) ) +while`$SPcmd^(`$SParg^(`$SParg^$`key^,`$SPop^$`val^`$SParg^) = each(`$SParg^%`array^`$SParg^)`$SParg^)`$BRloop^{ + `cursor^ +} + +XPT whileline " while \( defined\( \$line = ) ) +while`$SPcmd^(`$SParg^defined(`$SParg^$`line^`$SPop^=`$SPop^<`STDIN^>`$SParg^)`$SParg^)`$BRloop^{ + `cursor^ +} + + +XPT foreach " foreach my .. (..){} +foreach`$SPcmd^my $`var^ (`$SParg^@`array^`$SParg^)`$BRloop^{ + `cursor^ +} + + +XPT forkeys " foreach my var \( keys %** ) +foreach`$SPcmd^my $`var^ (`$SParg^keys @`array^`$SParg^)`$BRloop^{ + `cursor^ +} + + +XPT forvalues " foreach my var \( keys %** ) +foreach`$SPcmd^my $`var^ (`$SParg^values @`array^`$SParg^)`$BRloop^{ + `cursor^ +} + + +XPT if wrap=job " if ( .. ) { .. } ... +XSET job=$CS job +if`$SPcmd^(`$SParg^`cond^`$SParg^)`$BRif^{ + `job^ +}` +`elsif...^`$BRel^elsif`$SPcmd^(`$SParg^`cond2^`$SParg^)`$BRif^{ + `job^ +}` +`elsif...^` +`else...{{^`$BRel^else`$BRif^{ + `cursor^ +}`}}^ + +XPT package " +package `className^; + +use base qw(`parent^); + +sub new`$BRfun^{ + my $class = shift; + $class = ref $class if ref $class; + my $self = bless {}, $class; + $self; +} + +1; + +..XPT + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/php/php.ftdetect.vim b/vim-plugins/bundle/xptemplate/ftplugin/php/php.ftdetect.vim new file mode 100644 index 0000000..5a437cd --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/php/php.ftdetect.vim @@ -0,0 +1,75 @@ +if exists("b:__PHP_FTDETECT_VIM__") + finish +endif +let b:__PHP_FTDETECT_VIM__ = 1 + + +if &filetype !~ 'php' + finish +endif + + + +let s:skipPattern = 'synIDattr(synID(line("."), col("."), 0), "name") =~? "\\vstring|comment"' +let s:pattern = { + \ 'php' : { + \ 'start' : '\V\c\)\?', + \ 'mid' : '', + \ 'end' : '\V\c?>', + \ 'skip' : s:skipPattern, + \ }, + \ 'javascript' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \ 'css' : { + \ 'start' : '\V\c]\*>', + \ 'mid' : '', + \ 'end' : '\V\c', + \ 'skip' : s:skipPattern, + \ }, + \} + +if exists( 'php_noShortTags' ) + let s:pattern.php.start = '\V\c' +endif + +let s:topFT = 'html' + +fun! XPT_phpFiletypeDetect() "{{{ + let pos = [ line( "." ), col( "." ) ] + + let synName = xpt#util#NearestSynName() + + if synName == '' + " top level ft is html + return s:topFT + + else + + for [ name, ftPattern ] in items( s:pattern ) + let pos = searchpairpos( ftPattern.start, ftPattern.mid, ftPattern.end, 'nbW', ftPattern.skip ) + if pos != [0, 0] + return name + endif + endfor + + if synName =~ '^\cjavascript' + return 'javascript' + elseif synName =~ '^\ccss' + return 'css' + endif + + return s:topFT + + endif + +endfunction "}}} + +if exists( 'b:XPTfiletypeDetect' ) + unlet b:XPTfiletypeDetect +endif +let b:XPTfiletypeDetect = function( 'XPT_phpFiletypeDetect' ) + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/php/php.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/php/php.xpt.vim new file mode 100644 index 0000000..a417ad6 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/php/php.xpt.vim @@ -0,0 +1,81 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE true +XPTvar $FALSE false +XPTvar $NULL null +XPTvar $UNDEFINED null + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH /* cursor */ + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + +XPTvar $CL /* +XPTvar $CM * +XPTvar $CR */ +XPTinclude + \ _comment/doubleSign + +XPTvar $VAR_PRE $ +XPTvar $FOR_SCOPE +XPTinclude + \ _loops/for + +XPTinclude + \ _condition/c.like + \ _loops/c.while.like + +XPTembed + \ html/html + \ html/php* + + + +if exists( 'php_noShortTags' ) + XPTvar $PHP_TAG php +else + XPTvar $PHP_TAG +endif + +XPT html " +?>`html^', 'bWcn' ) + if defIndent == [0, 0] + return a:default + endif + + let di = indent( defIndent[ 0 ] ) + + let clsPos = searchpos( '\V\^\s\*\%<' . di . 'vclass\s\+\zs\w\+', 'bWcn' ) + if clsPos == [0, 0] + return a:default + endif + + return matchstr( getline( clsPos[0] ), '\Vclass\s\+\zs\w\+' ) + +endfunction + +fun! s:f.python_find_func( default ) + let indentNr = indent( line( "." ) ) + let defIndent = searchpos( '\V\^\s\*\%<' . indentNr . 'vdef\>', 'bWcn' ) + if defIndent == [0, 0] + return a:default + endif + + return matchstr( getline( defIndent[0] ), '\Vdef\s\+\zs\w\+' ) + +endfunction + +" ================================= Snippets =================================== + + +XPT _if hidden +if `cond^: + `pass^ + + +XPT _generator hidden " generator +XSET ComeFirst=elem seq func +`func^`func^python_genexpr_cmpl('elem')^ for `elem^ in `seq^` if `condition?^ + + +XPT _args hidden " expandable arguments +XSET arg*|post=ExpandInsideEdge( ',$SPop', '' ) +`$SParg`arg*`$SParg^ + +XPT _args2 hidden " expandable arguments +XSET arg*|post=ExpandInsideEdge( ',$SPop', '' ) +`,$SPop`arg*^ + + + + +XPT python " #!$PYTHON_EXC +XSET encoding=Echo(&fenc != '' ? &fenc : &enc) +#!`$PYTHON_EXC^ +# coding: `encoding^ + +..XPT + +XPT shebang alias=python + +XPT sb alias=python + + +XPT p " pass +pass + + +XPT s " self. +self. + + +XPT filehead " file description +`$PYTHON_DOC_MARK^ +File : `file()^ +Author : `$author^ +Contact : `$email^ +Date : `date()^ + +Description : `cursor^ +`$PYTHON_DOC_MARK^ + + +XPT if " if ..: .. else... +`:_if:^ + + +XPT else " else: +else: + `cursor^ + + +XPT elif " else: +elif `cond^: + `cursor^ + + +XPT range " range\( .. ) +range(`$SParg^``0?`,$SPop^`end^`$SParg^) + + +XPT forrange " for var in range\( .. ) +for `i^ in `:range:^: + `cursor^ + + +XPT for " for .. in ..: .. +XSET seq|post=Build( V() =~ '\V\^r\%[ange(]\$' ? '`:range:^' : ItemValueStripped() ) +for `var^ in `seq^`seq^python_seq_cmpl()^: + `cursor^ + + +XPT while " while ..: +while `condition^: + `cursor^ + + +XPT def " def ..( .. ): ... +XSET a=arg* +XSET a|post=Build( V() == 'arg*' ? '' : VS() . AutoCmpl( 1, 'self' ) . '`:_args2:^' ) +def `name^`$SPfun^(`a^python_sp_arg()^``a^`a^AutoCmpl(0,'self')^`a^python_sp_arg()^): + `cursor^ + + +" TODO use ontype/map instead +XPT lambda " (lambda .. : ..) +XSET arg*|post=ExpandInsideEdge( ',$SPop', '' ) +lambda `arg*^: `expr^ + + +XPT try wrap=job " try: .. except: ... +try: + `job^ +`:except:^ + + +XPT except " except .. +except `Exception^`$PYTHON_EXP_SYM`e^: + `cursor^ + + +XPT finally " finally: +finally: + `cursor^ + + +XPT class " class .. : def __init__ ... +class `ClassName^`$SPfun^(`$SParg`object`$SParg^): + `pass^ + + +XPT init " def __init__ +XSET arg*|post=ExpandInsideEdge( ',$SPop', '' ) +def __init__`$SPfun^(`$SParg^self`,$SPop`arg*^`$SParg^): + `cursor^ + + +" TODO guess method name for example __init__ +XPT super " super\( Clz, self ). +super(`$SParg^`clz^python_find_class('Me')^,`$SPop^self`$SParg^).`method^python_find_func('what')^(`:_args:^) + + +XPT ifmain " if __name__ == __main__ +if __name__`$SPop^==`$SPop^"__main__": + `cursor^ + +XPT with " with .. as .. : +with `opener^` as `name?^: + `cursor^ + + +XPT import " import .. +import `mod^` as `name?^ + + +XPT from " from .. import .. +from `module^ import `item^` as `name?^ + + +XPT fromfuture " from __future__ import .. +from __future__ import `name^ + + +XPT str wrap=s " str\( .. ) +str(`$SParg^`s^`$SParg^) + + +XPT genExp " \(func\(x) for x in seq) +(`$SParg^`:_generator:^`$SParg^) + + +XPT listComp " \[func\(x) for x in seq] +[`$SParg^`:_generator:^`$SParg^] diff --git a/vim-plugins/bundle/xptemplate/ftplugin/r/r.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/r/r.xpt.vim new file mode 100644 index 0000000..899506d --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/r/r.xpt.vim @@ -0,0 +1,36 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + \ _condition/c.like + + +XPT for " for (... in ...) { ... } +for (`name^ in `vec^) +{ + `cursor^ +} + +XPT while " while ( ... ) { ... } +while ( `cond^ ) +{ + `cursor^ +} + +XPT fun " ... <- function ( ... , ... ) { ... } +`funName^ <- function( `args^ ) +{ + `cursor^ +} + +XPT operator " %...% <- function ( ... , ... ) { ... } +%`funName^% <- function( `args^ ) +{ + `cursor^ +} + +XPT head " #! /usr/bin/env/Rscript +#! /usr/bin/env Rscript + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/rst/rst.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/rst/rst.xpt.vim new file mode 100644 index 0000000..4e2a710 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/rst/rst.xpt.vim @@ -0,0 +1,70 @@ +" snippets for reStructuredText (.rst) +XPTemplate priority=lang mark=~^ + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + +fun! s:f.ExpandRstTitle() + let txt = self.R( 'title' ) + let bar = repeat( '=', len( txt ) ) + return bar . "\n" . txt . "\n" . bar . "\n" +endfunction + +fun! s:f.ExpandRstSection( char ) + let txt = self.R( 'sectionName' ) + let bar = repeat( a:char, len( txt ) ) + return txt . "\n" . bar . "\n" +endfunction + +XPT index " all stuff to create basic index +XSET sectionName|post=ExpandRstSection('=') +~sectionName^ + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + ~cursor^ + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + +XPT title synonym=h1 " === ... === +XSET title|post=ExpandRstTitle() +~title^ + + +XPT section synonym=h2 " ... ==== +XSET sectionName|post=ExpandRstSection('=') +~sectionName^ + +XPT subsection synonym=h3 " .... ------- +XSET sectionName|post=ExpandRstSection('-') +~sectionName^ + + +XPT code " ```...``` +``~cursor^`` + +XPT italic " *...* +*~cursor^* + +XPT bold " **...** +**~cursor^** + +XPT link " .. _a link: ... +.. _a link: ~url^ + +XPT func " .. function:: ... +.. function:: ~funDesc^ + + ~cursor^ + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/ruby/ruby.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/ruby/ruby.xpt.vim new file mode 100644 index 0000000..273da97 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/ruby/ruby.xpt.vim @@ -0,0 +1,821 @@ +XPTemplate priority=lang keyword=:%# + +" containers +let s:f = g:XPTfuncs() + +" inclusion +XPTinclude + \ _common/common + +" ========================= Function and Variables ============================= + +fun! s:f.RubyCamelCase(...) "{{{ + let str = a:0 == 0 ? self.V() : a:1 + let r = substitute(substitute(str, "[\/ _]", ' ', 'g'), '\<.', '\u&', 'g') + return substitute(r, " ", '', 'g') +endfunction "}}} + +fun! s:f.RubySnakeCase(...) "{{{ + let str = a:0 == 0 ? self.V() : a:1 + return substitute(str," ",'_','g') +endfunction "}}} + +" Multiple each snippet {{{ +"{{{ s:each_list +let s:each_list = [ 'byte', 'char', 'cons', 'index', 'key', + \'line', 'pair', 'slice', 'value' ] +"}}} + +fun! s:f.RubyEachPopup() "{{{ + let l = [] + for i in s:each_list + let l += [{'word': i, 'menu': 'each_' . i . '{ |..| ... }'}] + endfor + return l +endfunction "}}} + +fun! s:f.RubyEachBrace() "{{{ + let v = self.SV('^_','','') + if v == '' + return '' + elseif v =~# 'slice\|cons' + return '_' . v.'(`val^3^)' + else + return '_' . v + endif +endfunction "}}} + +fun! s:f.RubyEachPair() "{{{ + let v = self.R('what') + if v =~# 'pair' + return '`el1^, `el2^' + elseif v == '' + return '`el^' + else + if v =~ 'slice\|cons' + let v = substitute(v,'val','','') + endif + return '`' . substitute(v,'[^a-z]','','g') . '^' + endif +endfunction "}}} +" End multiple each snippet }}} + +" Multiple assert snippet {{{ +"{{{ s:assert_map +let s:assert_map = { + \'block' : '' . ' { `cursor^ }', + \'equals' : '(`expected^, `actual^`, `message^)' . '', + \'in_delta' : '(`expected float^, `actual float^, `delta^`, `message^)' . '', + \'instance_of' : '(`klass^, `object to compare^`, `message^)' . '', + \'kind_of' : '(`klass^, `object to compare^`, `message^)' . '', + \'match' : '(/`regexp^/`^, `string^`, `message^)' . '', + \'not_equal' : '(`expected^, `actual^`, `message^)' . '', + \'nil' : '(`object^`, `message^)' . '', + \'no_match' : '(/`regexp^/`^, `string^`, `message^)' . '', + \'not_nil' : '(`object^`, `message^)' . '', + \'nothing_raised' : '(`exception^)' . ' { `cursor^ }', + \'not_same' : '(`expected^, `actual^`, `message^)' . '', + \'nothing_thrown' : '`(`message`)^' . ' { `cursor^ }', + \'operator' : '(`obj1^, `operator^, `obj2^`, `message^)' . '', + \'raise' : '(`exception^)' . ' { `cursor^ }', + \'respond_to' : '(`object^, `respond to this message^`, `message^)' . '', + \'same' : '(`expected^, `actual^`, `message^)' . '', + \'send' : '([`receiver^, `method^, `args^]`, `message^)' . '', + \'throws' : '(`expected symbol^`, `message^)' . ' { `cursor^ }', + \} +"}}} + +fun! s:RubyAssertPopupSort(a, b) "{{{ + return a:a.word == a:b.word ? 0 : a:a.word > a:b.word ? 1 : -1 +endfunction "}}} + +fun! s:f.RubyAssertPopup() "{{{ + let list = [] + for [k, v] in items(s:assert_map) + let list += [{ 'word' : k, 'menu' : 'assert_' . k . substitute(v, '`.\{-}^', '..', 'g') }] + endfor + return sort(list, 's:RubyAssertPopupSort') +endfunction "}}} + +fun! s:f.RubyAssertMethod() "{{{ + let v = self.SV('^_', '', '') + if v == '' + return v . '(`^`, `message^)' + endif + if has_key(s:assert_map, v) + return '_' . v . s:assert_map[v] + else + return '' + endif +endfunction "}}} +" End multiple assert snippet }}} + +" Repeat an item inside its edges. +" Behave like ExpandIfNotEmpty() but within edges +fun! s:f.RepeatInsideEdges(sep) "{{{ + let [edgeLeft, edgeRight] = self.ItemEdges() + let v = self.V() + let n = self.N() + if v == '' || v == self.ItemFullname() + return '' + endif + + + let v = self.ItemStrippedValue() + let [ markLeft, markRight ] = XPTmark() + + let newName = 'n' . n + let res = edgeLeft . v + let res .= markLeft . a:sep . markLeft . newName . markRight + let res .= 'ExpandIfNotEmpty("' . a:sep . '", "' . newName . '")' . markRight . markRight + let res .= edgeRight + + + return res +endfunction "}}} + +" Remove an item if its value hasn't change +fun! s:f.RemoveIfUnchanged() "{{{ + let v = self.V() + let [lft, rt] = self.ItemEdges() + if v == lft . self.N() . rt + return '' + else + return v + end +endfunction "}}} + + + +" ================================= Snippets =================================== + +XPT # syn=string " #{..} +#{`^} + + +XPT : " :... => ... +:`key^ => `value^ + + +XPT % " %**[..] +XSET _=Choose(['w', 'W', 'q', 'Q']) +%`_^[`^] + + +XPT BEG " BEGIN { .. } +BEGIN { + `cursor^ +} + + +XPT Comp " include Comparable def <=> ... +include Comparable + +def <=>(other) + `cursor^ +end + + +XPT END " END { .. } +END { + `cursor^ +} + + +XPT Enum " include Enumerable def each ... +include Enumerable + +def each(&block) + `cursor^ +end + + +XPT Forw " extend Forwardable +extend Forwardable + + +XPT Md " Marshall Dump +File.open(`filename^, "wb") { |`file^| Marshal.dump(`obj^, `file^) } + + +XPT Ml " Marshall Load +File.open(`filename^, "rb") { |`file^| Marshal.load(`file^) } + + +XPT Pn " PStore.new\(..) +PStore.new(`filename^) + + +XPT Yd " YAML dump +File.open("`filename^.yaml", "wb") { |`file^| YAML.dump(`obj^,`file^) } + + +XPT Yl " YAML load +File.open("`filename^.yaml") { |`file^| YAML.load(`file^) } + + +XPT _d " __DATA__ +__DATA__ + + +XPT _e " __END__ +__END__ + + +XPT _f " __FILE__ +__FILE__ + + +XPT ali " alias : .. : .. +XSET new.post=RubySnakeCase() +XSET old=old_{R("new")} +XSET old.post=RubySnakeCase() +alias :`new^ :`old^ + + +XPT all " all? { .. } +all? { |`element^| `cursor^ } + + +XPT amm " alias_method : .. : .. +XSET new.post=RubySnakeCase() +XSET old=old_{R("new")} +XSET old.post=RubySnakeCase() +alias_method :`new^, :`old^ + + +XPT any " any? { |..| .. } +any? { |`element^| `cursor^ } + + +XPT app " if __FILE__ == $PROGRAM_NAME ... +if __FILE__ == $PROGRAM_NAME + `cursor^ +end + + +XPT array " Array.new\(..) { ... } +Array.new(`size^) { |`i^| `cursor^ } + +XPT ass " assert**\(..) ... +XSET what=RubyAssertPopup() +XSET what|post=RubyAssertMethod() +XSET message|post=RemoveIfUnchanged() +assert`_`what^ + + +XPT attr " attr_** :... +XSET what=Choose(["accessor", "reader", "writer"]) +XSET what|post=SV("^_$",'','') +XSET attr*|post=ExpandIfNotEmpty(', :', 'attr*') +attr`_`what^ :`attr*^ + +XPT begin " begin .. rescue .. else .. end +XSET block=# block +XSET Exception|post=RubyCamelCase() +begin + `expr^ +``rescue...` +{{^rescue `Exception^` => `e^ + `block^ +``rescue...` +^`}}^``else...` +{{^else + `block^ +`}}^``ensure...` +{{^ensure + `cursor^ +`}}^end + +XPT bm " Benchmark.bmbm do ... end +XSET times=10_000 +TESTS = `times^ + +Benchmark.bmbm do |result| + `cursor^ +end + + +XPT case " case .. when .. end +XSET block=# block +case `target^` +when `comparison^ + `block^ +``when...` +{{^when `comparison^ + `block^ +``when...` +^`}}^``else...` +{{^else + `cursor^ +`}}^end + + +XPT cfy " classify { |..| .. } +classify { |`element^| `cursor^ } + + +XPT cl " class .. end +XSET ClassName.post=RubyCamelCase() +class `ClassName^ + `cursor^ +end + + +XPT cld " class .. < DelegateClass .. end +XSET ClassName.post=RubyCamelCase() +XSET ParentClass.post=RubyCamelCase() +XSET arg*|post=RepeatInsideEdges(', ') +class `ClassName^ < DelegateClass(`ParentClass^) + def initialize`(`arg*`)^ + super(`delegate object^) + + `cursor^ + end +end + + +XPT cli " class .. def initialize\(..) ... +XSET ClassName|post=RubyCamelCase() +XSET name|post=RubySnakeCase() +XSET init=Trigger('defi') +XSET def=Trigger('def') +class `ClassName^ + `init^` + `def...^ + + `def^` + `def...^ +end + + +XPT cls " class << .. end +XSET self=self +class << `self^ + `cursor^ +end + + +XPT clstr " .. = Struct.new ... +XSETm do...|post + do + `cursor^ +end +XSETm END +XSET ClassName|post=RubyCamelCase() +XSET attr*|post=RepeatInsideEdges(', :') +`ClassName^ = Struct.new`(:`attr*`)^` `do...^ + + +XPT col " collect { .. } +collect { |`obj^| `cursor^ } + + +XPT deec " Deep copy +Marshal.load(Marshal.dump(`obj^)) + + +XPT def " def .. end +XSET method|post=RubySnakeCase() +XSET arg*|post=RepeatInsideEdges(', ') +def `method^`(`arg*`)^ + `cursor^ +end + + +XPT defd " def_delegator : ... +def_delegator :`del obj^, :`del meth^, :`new name^ + + +XPT defds " def_delegators : ... +def_delegators :`del obj^, :`del methods^ + + +XPT defi " def initialize .. end +XSET arg*|post=RepeatInsideEdges(', ') +def initialize`(`arg*`)^ + `cursor^ +end + + +XPT defmm " def method_missing\(..) .. end +def method_missing(meth, *args, &block) + `cursor^ +end + + +XPT defs " def self... end +XSET method.post=RubySnakeCase() +XSET arg*|post=RepeatInsideEdges(', ') +def self.`method^`(`arg*`)^ + `cursor^ +end + + +XPT deft " def test_.. .. end +XSET name|post=RubySnakeCase() +XSET arg*|post=RepeatInsideEdges(', ') +def test_`name^ + `cursor^ +end + + +XPT deli " delete_if { |..| .. } +delete_if { |`arg^| `cursor^ } + + +XPT det " detect { .. } +detect { |`obj^| `cursor^ } + + +XPT dir " Dir[..] +XSET _='/**/*' +Dir[`_^] + + +XPT dirg " Dir.glob\(..) { |..| .. } +Dir.glob(`dir^) { |`file^| `cursor^ } + + +XPT do " do |..| .. end +XSET arg*|post=RepeatInsideEdges(', ') +do` |`arg*`|^ + `cursor^ +end + + +XPT dow " downto\(..) { .. } +XSET arg=i +XSET lbound=0 +downto(`lbound^) { |`arg^| `cursor^ } + + +XPT each " each_** { .. } +XSET what=RubyEachPopup() +XSET what|post=RubyEachBrace() +XSET vars=RubyEachPair() +each`_`what^ { |`vars^| `cursor^ } + + +XPT fdir " File.dirname\(..) +File.dirname(`^) + + +XPT fet " fetch\(..) { |..| .. } +fetch(`name^) { |`key^| `cursor^ } + + +XPT file " File.foreach\(..) ... +File.foreach('`filename^') { |`line^| `cursor^ } + + +XPT fin " find { |..| .. } +find { |`element^| `cursor^ } + + +XPT fina " find_all { |..| .. } +find_all { |`element^| `cursor^ } + + +XPT fjoin " File.join\(..) +File.join(`dir^, `path^) + + +XPT fla " flatten_once +inject(Array.new) { |`arr^, `a^| `arr^.push(*`a^) } + + +XPT fread " File.read\(..) +File.read(`filename^) + + +XPT grep " grep\(..) { |..| .. } +grep(/`pattern^/) { |`match^| `cursor^ } + + +XPT gsub " gsub\(..) { |..| .. } +gsub(/`pattern^/) { |`match^| `cursor^ } + + +XPT hash " Hash.new { ... } +Hash.new { |`hash^,`key^| `hash^[`key^] = `cursor^ } + +XPT if " if .. end +if `boolean exp^ + `cursor^ +end + +XPT ife " if .. else .. end +XSET block=# block +if `boolean exp^ + `block^ +else + `cursor^ +end + +XPT ifei " if .. elsif .. else .. end +XSET block=# block +if `boolean exp^` + `block^ +``elsif...` +{{^elsif `comparison^ + `block^ +``elsif...` +^`}}^``else...` +{{^else + `cursor^ +`}}^end + + +XPT inj " inject\(..) { |..| .. } +inject`(`arg`)^ { |`accumulator^, `element^| `cursor^ } + + +XPT lam " lambda { .. } +XSET arg*|post=RepeatInsideEdges(', ') +lambda {` |`arg*`|^ `cursor^ } + + +XPT loop " loop do ... end +loop do + `cursor^ +end + +XPT map " map { |..| .. } +map { |`arg^| `cursor^ } + + +XPT max " max { |..| .. } +max { |`element1^, `element2^| `cursor^ } + + +XPT min " min { |..| .. } +min { |`element1^, `element2^| `cursor^ } + + +XPT mod " module .. .. end +XSET module name|post=RubyCamelCase() +module `module name^ + `cursor^ +end + + +XPT modf " module .. module_function .. end +XSET module name|post=RubyCamelCase() +module `module name^ + module_function + + `cursor^ +end + + +XPT nam " Rake Namespace +XSET ns=fileRoot() +namespace :`ns^ do + `cursor^ +end + + +XPT new " Instanciate new object +XSET Object|post=RubyCamelCase() +XSET arg*|post=RepeatInsideEdges(', ') +`var^ = `Object^.new`(`arg*`)^ + + +XPT open " open\(..) { |..| .. } +XSET mode...|post=, '`wb^' +open(`filename^`, `mode...^) { |`io^| `cursor^ } + + +XPT par " partition { |..| .. } +partition { |`element^| `cursor^ } + + +XPT pathf " Path from here +XSET path=../lib +File.join(File.dirname(__FILE__), "`path^") + + +XPT rdoc syn=comment " RDoc description +=begin rdoc +# `cursor^ +#=end + + +XPT rej " reject { |..| .. } +reject { |`element^| `cursor^ } + + +XPT rep " Benchmark report +result.report("`name^: ") { TESTS.times { `cursor^ } } + + +XPT req " require .. +require '`lib^' + + +XPT reqs " %w[..].map { |lib| require lib } +XSET lib*|post=ExpandIfNotEmpty(' ', 'lib*') +%w[`lib*^].map { |lib| require lib } + +..XPT + + +XPT reve " reverse_each { .. } +reverse_each { |`element^| `cursor^ } + + +XPT ruby " #!/usr/bin/env ruby +XSET enc=Echo(&fenc ? &fenc : &enc) +#!/usr/bin/env ruby +# -*- encoding: `enc^ -*- + +XPT shebang alias=ruby + +XPT sb alias=ruby + + + +XPT scan " scan\(..) { |..| .. } +scan(/`pattern^/) { |`match^| `cursor^ } + + +XPT sel " select { |..| .. } +select { |`element^| `cursor^ } + + +XPT sinc " class << self; self; end +class << self; self; end + + +XPT sor " sort { |..| .. } +sort { |`element1^, `element2^| `element1^ <=> `element2^ } + + +XPT sorb " sort_by { |..| .. } +sort_by {` |`arg`|^ `cursor^ } + + +XPT ste " step\(..) { .. } +step(`count^`, `step^) { |`i^| `cursor^ } + + +XPT sub " sub\(..) { |..| .. } +sub(/`pattern^/) { |`match^| `cursor^ } + + +XPT subcl " class .. < .. end +XSET ClassName.post=RubyCamelCase() +XSET Parent.post=RubyCamelCase() +class `ClassName^ < `Parent^ + `cursor^ +end + + +XPT tas " Rake Task +XSET task name|post=RubySnakeCase() +XSET dep*|post=RepeatInsideEdges(', :') +desc "`task description^" +task :`task name^` => [:`dep*`]^ do + `cursor^ +end + + +XPT tc " require 'test/unit' ... class Test.. < Test::Unit:TestCase ... +XSET ClassName=RubyCamelCase(R("module")) +XSET ClassName.post=RubyCamelCase() +XSET deft=Trigger('deft') +require "test/unit" +require "`module^" + +class Test`ClassName^ < Test::Unit::TestCase + `deft^` + + `deft...`{{^ + + `deft^` + + `deft...`^`}}^ +end + + +XPT tif " .. ? .. : .. +(`boolean exp^) ? `exp if true^ : `exp if false^ + + +XPT tim " times { .. } +times {` |`i`|^ `cursor^ } + + +XPT tra " transaction\(..) { ... } +transaction(`true^) { `cursor^ } + + +XPT unif " Unix Filter +ARGF.each_line do |`line^| + `cursor^ +end + + +XPT unless " unless .. end +unless `boolean cond^ + `cursor^ +end + + +XPT until " until .. end +until `boolean cond^ + `cursor^ +end + + +XPT upt " upto\(..) { .. } +upto(`ubound^) { |`i^| `cursor^ } + + +XPT usai " if ARGV.. abort\("Usage... +XSET args=[options] +if ARGV`^ + abort "Usage: #{$PROGRAM_NAME} `args^" +end + + +XPT usau " unless ARGV.. abort\("Usage... +XSET args=[options] +unless ARGV`^ + abort "Usage: #{$PROGRAM_NAME} `args^" +end + + +XPT while " while .. end +while `boolean cond^ + `cursor^ +end + + +XPT wid " with_index { .. } +with_index { |`element^, `index^| `cursor^ } + + +XPT xml " REXML::Document.new\(..) +REXML::Document.new(File.read(`filename^)) + + +XPT y syn=comment " :yields: +:yields: + + +XPT zip " zip\(..) { |..| .. } +zip(`enum^) { |`row^| `cursor^ } + + + + +" ================================= Wrapper =================================== + + + +XPT invoke_ wraponly=wrapped " ..(SEL) +XSET name|post=RubySnakeCase() +`name^(`wrapped^) + + +XPT def_ wraponly=wrapped " def ..() SEL end +XSET method_name|post=RubySnakeCase() +XSET arg*|post=RepeatInsideEdges(', ') +def `method_name^`(`arg*`)^ + `wrapped^ +end + + +XPT class_ wraponly=wrapped " class .. SEL end +XSET _|post=RubyCamelCase() +class `_^ + `wrapped^ +end + + +XPT module_ wraponly=wrapped " module .. SEL end +XSET _|post=RubyCamelCase() +module `_^ + `wrapped^ +end + + +XPT begin_ wraponly=wrapped " begin SEL rescue .. else .. end +XSET Exception|post=RubyCamelCase() +XSET block=# block +begin + `wrapped^ +``rescue...` +{{^rescue `Exception^` => `e^ + `block^ +``rescue...` +^`}}^``else...` +{{^else + `block^ +`}}^``ensure...` +{{^ensure + `cursor^ +`}}^end + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/scheme/scheme.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/scheme/scheme.xpt.vim new file mode 100755 index 0000000..8233984 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/scheme/scheme.xpt.vim @@ -0,0 +1,71 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL +XPTvar $VOID_LINE /* void */; +XPTvar $BRif \n + +XPTinclude + \ _common/common + \ _condition/lisp.like + + +XPT begin " (begin .. ) +(begin + (`todo0^)` `...^ + (`todon^)` `...^) + + +XPT case " (case (of) ((match) (expr)) ..) +(case (`of^) + ({`match^} `expr1^)` `...^ + ({`matchn^} `exprn^)` `...^ + `else...^\(else \`cursor\^)^^) + + +XPT cond " (cond ([condi] (expr)) ..) +(cond ([`condition^] `expr1^)` `...^ +` ([`condition^] `exprn^)` `...^ + `else...^\(else \`cursor\^)^^) + + +XPT let " (let [(var (val)) ..] (body)) +(let [(`newVar^ `value^` `...^) +` (`newVarn^ `valuen^` `...^)] + (`cursor^)) + + +XPT letrec " (letrec [(var (val)) ..] (body)) +(letrec [(`newVar^ `value^` `...^) +` (`newVarn^ `valuen^` `...^)] + (`cursor^)) + + +XPT lambda " (lambda [params] (body)) +(lambda [`params^] + (`cursor^)) + + +XPT defun " (define var (lambda ..)) +(define `funName^ + (lambda [`params^] + (`cursor^)) + ) + + +XPT def " (define var (ex)) +(define `varName^ `cursor^) + + +XPT do " (do ..) +(do {(`var^ `init^ `step^)` `...0^ +` (`var^ `init^ `step^)` `...0^} + ([`test^] `exprs^) + (`command^)` `...2^ + (`command^)` `...2^) + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/sh/sh.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/sh/sh.xpt.vim new file mode 100644 index 0000000..ad29c6b --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/sh/sh.xpt.vim @@ -0,0 +1,179 @@ +XPTemplate priority=lang mark=~^ + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE # void +XPTvar $CURSOR_PH # cursor + + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTvar $SPop '' +XPTvar $SParg '' + +XPTinclude + \ _common/common + \ _printf/c.like + +XPTvar $CS # +XPTinclude + \ _comment/singleSign + + +" ========================= Function and Variables ============================= + +let s:braceMap = { + \ '`' : '`', + \ '{' : '}', + \ '[' : ']', + \ '(' : ')', + \ '{{' : '}}', + \ '[[' : ']]', + \ '((' : '))', + \ '{ ' : ' }', + \ '[ ' : ' ]', + \ '( ' : ' )', + \ '{{ ' : ' }}', + \ '[[ ' : ' ]]', + \ '(( ' : ' ))', + \} + +fun! s:f.sh_complete_brace() + + let v = self.V() + let br = matchstr( v, '\V\^\[\[({`]\{1,2} \?' ) + if br == '' + return '' + elseif br == '`' + return s:braceMap[ br ] + else + try + let cmpl = s:braceMap[ br ] + let cmplEsc = substitute( cmpl, ']', '\\[]]', 'g' ) + let tail = matchstr( v, '\V\%[' . cmplEsc . ']\$' ) + if tail == ' ' && br =~ ' ' + let tail = '' + endif + return cmpl[ len( tail ) : ] + catch /.*/ + echom v:exception + endtry + endif + +endfunction + +" ================================= Snippets =================================== + + + + +XPT shebang " #!/bin/[ba|z|c]sh +XSET sh=ChooseStr( 'sh', 'bash', 'zsh', 'csh' ) +#!/bin/~sh^ + +..XPT + +XPT sb alias=shebang + +XPT _shebang hidden " #!/bin/$_xSnipName +#!/bin/~$_xSnipName^ + +..XPT + + +XPT sh alias=_shebang +XPT bash alias=_shebang +XPT zsh alias=_shebang +XPT csh alias=_shebang + + +XPT echodate " echo `date +%...` +echo `date~ +~fmt^` + +XPT _cond hidden +XSET condition|map=[ [ +XSET condition|map=( ( +~condition^~condition^sh_complete_brace()^ + + +XPT printf " printf\(...) +XSET elts|pre=Echo('') +XSET elts=c_printf_elts( R( 'pattern' ), ' '[ len( $SPop ) : ] ) +printf "~pattern^"~elts^ + + + +XPT forin wrap " for .. in ..; do +for ~i^ in ~list^;~$BRloop^do + ~cursor^ +done + +XPT for wrap " for (( i=0; i=start; i++ )); do +for ((~i^ = ~n^; ~i^ >~=^ ~start^0^; ~i^--));~$BRloop^do + ~cursor^ +done + +XPT here wrap " << END .. +<<~-~END^ +~cursor^ +~END^substitute( V(), '\v\^-', '', '' )^ + +XPT until wrap " until ..; do +until ~:_cond:^;~$BRloop^;do + ~cursor^ +done + +XPT while wrap " while ..; do +while ~:_cond:^;~$BRloop^do + ~cursor^ +done + +XPT while1 alias=while " while [ 1 ]; do +XSET condition=Next( '[ ~$TRUE^ ]' ) + +XPT case wrap " case .. in .. +case ~$~var^ in + ~pattern^) + ~cursor^ + ;; + +esac + +XPT if wrap " if ..; then +if ~:_cond:^;~$BRif^then + ~cursor^ +fi + +XPT else wrap " else .. +else + ~cursor^ + +XPT ife wrap=job " if ..; then .. else .. +if ~:_cond:^;~$BRif^then + ~job^ +else + ~cursor^ +fi + +XPT elif wrap " elif .. ; then +elif ~:_cond:^;~$BRif^then + ~cursor^ + +XPT fun wrap " .. () { .. } +~name^ ()~$BRfun^{ + ~cursor^ +} diff --git a/vim-plugins/bundle/xptemplate/ftplugin/sql/sql.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/sql/sql.xpt.vim new file mode 100644 index 0000000..8462d79 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/sql/sql.xpt.vim @@ -0,0 +1,80 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +" if () ** { +" else ** { +XPTvar $BRif ' ' + +" } ** else { +XPTvar $BRel \n + +" for () ** { +" while () ** { +" do ** { +XPTvar $BRloop ' ' + +" struct name ** { +XPTvar $BRstc ' ' + +" int fun() ** { +" class name ** { +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + + + + +" ============================================================================ +" cursor - CURSOR logic +" ============================================================================ +XPT cursor hint=CURSOR\ logic +DECLARE @iFetchCount INT +DECLARE `^ CURSOR STATIC + FOR SELECT `^` + `Expression2...^ + ` ,`^` + `Expression2...^ + FROM `^ WITH (NOLOCK) + WHERE (`^)` + `Expression4...^ + ` AND (`^)` + `Expression4...^ + ORDER BY `^` + `Expression6...^ + ` ,`^` + `Expression6...^ +SET @iFetchCount = 0 +OPEN `^ +FETCH NEXT + FROM `^ + INTO `^` + `Variable2...^ + ` ,`^` + `Variable2...^ +WHILE (@@FETCH_STATUS = 0) +BEGIN + SET @iFetchCount = @iFetchCount + 1 + IF ((@iFetchCount % 1000) = 0) + BEGIN + SET @sMsg = '@iFetchCount = ' + ltrim(dbo.udfFormatNumber(@iFetchCount,18,0)) + EXEC dbadb.dbo.uspLogMessage @sJob, @sMsg + END + FETCH NEXT + FROM `^ + INTO `^` + `Variable4...^ + ` ,`^` + `Variable4...^ +END +CLOSE `^ +DEALLOCATE `^ +..XPT + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/svg/svg.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/svg/svg.xpt.vim new file mode 100644 index 0000000..8644443 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/svg/svg.xpt.vim @@ -0,0 +1,65 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTinclude + \ _common/common + \ xml/xml + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + +XPT svg " Start an svg document + + + + `cursor^ + +..XPT + +XPT line " Create an svg line + +XSET style...|post= style="`cursor^" +..XPT + +XPT circle " Create an svg circle + +XSET style...|post= style="`cursor^" +..XPT + +XPT ellipse " Create an svg ellipse + +XSET style...|post= style="`cursor^" +..XPT + +XPT rect " Create an svg rectangle + +XSET style...|post= style="`cursor^" +..XPT + +XPT polygon " Create an svg polygon + +XSET style...|post= style="`cursor^" +..XPT + +XPT polyline " Create an svg polyline + +XSET style...|post= style="`cursor^" +..XPT + +XPT line " Create an svg line + + `cursor^ + +XSET style...|post= style="`style^" +..XPT + +" ================================= Wrapper =================================== + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/tcl/tcl.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/tcl/tcl.xpt.vim new file mode 100644 index 0000000..9aa73d0 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/tcl/tcl.xpt.vim @@ -0,0 +1,93 @@ +XPTemplate priority=lang mark=~^ + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH + +XPTvar $BRif \n + +XPTinclude + \ _common/common + + +" ========================= Function and Variables ============================= + + +" ================================= Snippets =================================== + + + +XPT shebang " #!/bin/sh .. exec tclsh.. +#!/bin/sh +#\ +exec tclsh "$0" "$@"" + +..XPT + +XPT sb alias=shebang + + +XPT for " for {...} +for {set ~i^ ~x^} {$~i^ <= ~len^} {incr ~i^} { + ~cursor^ +} + + +XPT foreach " foreach i var {... +foreach ~i^ ~var^ { + ~cursor^ +} + + +XPT while " while {i <= ?} {... +while {~i^ <= ~len^} { + ~cursor^ +} + + +XPT if " if { ... } { ... +if {~a^} { + ~cursor^ +} + + +XPT elseif " elseif {... +elseif {~a^} { + ~cursor^ +} + + +XPT else " else {... +else { + ~cursor^ +} + + +XPT switch " switch ... {... +switch ~var^ { + ~1^ { ~body1^ } + ~2^ { ~body2^ } + ~3^ { ~body3^ } + default { ~body4^ } +} + + +XPT proc " proc *** {... +proc ~name^ {~args^} { + ~cursor^ +} + + +XPT regexp " regexp ... match +regexp ~r^ ~str^ match ~vars^ + + +XPT regsub " regsub ... +regsub ~in^ ~str^ ~out^ + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/tex/tex.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/tex/tex.xpt.vim new file mode 100644 index 0000000..45d89e5 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/tex/tex.xpt.vim @@ -0,0 +1,137 @@ +XPTemplate priority=lang mark=`~ + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + +XPT _arg1 hidden " \\$_xSnipName\{..} +\\`$_xSnipName~{`cursor~} + +XPT _arg2 hidden " \\$_xSnipName\{..}\{..} +\\`$_xSnipName~{`a~}{`b~} + +XPT _sub hidden " \\{$_xSnipName}_.. +\\`$_xSnipName~_`sub~ + +XPT _sub_super hidden " \\{$_xSnipName}_..^.. +\\`$_xSnipName~_`sub~^`super~ + +XPT _begin wrap hidden " \begin{..} .. end{..} +\begin{`sth~}`{`what?`}~ + `cursor~ +\end{`sth~} + +XPT _block wrap hidden " \begin\{$_xSnipName} .. \end\{$_xSnipName} +\begin{`$_xSnipName~} + `cursor~ +\end{`$_xSnipName~} + +XPT _block_t wrap hidden " \begin\{$_xSnipName} .. \end\{$_xSnipName} +\begin{`$_xSnipName~}{`title~} + `cursor~ +\end{`$_xSnipName~} + +XPT section alias=_arg1 +XPT label alias=_arg1 +XPT ref alias=_arg1 + +XPT frac alias=_arg2 + +XPT abstract alias=_block +XPT document alias=_block +XPT equation alias=_block +XPT slide alias=_block + +XPT frame alias=_block_t +XPT block alias=_block_t + +XPT lim alias=_sub + +XPT int alias=_sub_super + +XPT info " title author date +\title{`title~} +\author{`$author~} +\date{`date()~} + +XPT array " begin{array}{..}... end{array} +\begin{array}{`kind~rcl~} +`what~` `...0~ & `what~` `...0~ \\\\` `...1~ +`what~` `...2~ & `what~` `...2~ \\\\` `...1~ +\end{array} + +XPT table " begin{tabular}{..}... end{tabular} +XSET hline..|post=\hline +XSET what*|post=ExpandIfNotEmpty( ' & ', 'what*' ) +\begin{tabular}{`kind~|r|c|l|~} +`hline..~ +`what*~ \\\\` `...1~ +`hline..~ +`what*~ \\\\` `...1~ +\end{tabular} + + +" backward compatible +XPT lbl " label{..} +\label{`cursor~} + +" backward compatible +XPT integral " int_..^.. +\int_`begin~^`end~{`cursor~} + +XPT itemize " begin{itemize} ... end{itemize} +\begin{itemize} + \item `what~~`...~ + \item `what~~`...~ +\end{itemize} + +XPT enumerate " begin{enumerate} ... end{enumerate} +\begin{enumerate} + \item `what~~`...~ + \item `what~~`...~ +\end{enumerate} + +XPT description " begin{description} ... end{description} +\begin{description} + \item[`what~] `content~~`...~ + \item[`what~] `content~~`...~ +\end{description} + +XPT sqrt " sqrt[..]{..} +\sqrt`[`nth?`]~{`cursor~} + +XPT sum " sum{..}~..{} +\sum_{`init~}^`end~{`cursor~} + +XPT documentclass " documentclass[..]{..} +XSET kind=Choose(['article','book','report', 'letter','slides']) +\documentclass[`11~pt]{`kind~} + +XPT toc " \tableofcontents +\tableofcontents + +" backward compatible +XPT beg alias=_begin + +XPT columns " \begin{columns}... +\begin{columns} + \begin{column}[l]{`size~5cm~} + \end{column}`...~ + + \begin{column}[l]{`size~5cm~} + \end{column}`...~ + `cursor~ +\end{columns} + +XPT enclose_ wraponly=wrapped " \begin{..} SEL \end{..} +\begin{`something~} + `wrapped~ +\end{`something~} + +XPT as_ wraponly=wrapped " SEL{..} +\\`wrapped~{`cursor~} + +XPT with_ wraponly=wrapped " \\.. {SEL} +\\`cursor~{`wrapped~} + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/unknown/unknown.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/unknown/unknown.xpt.vim new file mode 100644 index 0000000..2bd0722 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/unknown/unknown.xpt.vim @@ -0,0 +1,8 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + + +XPTinclude + \ _common/common + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/vim/autoload.vim.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/vim/autoload.vim.xpt.vim new file mode 100644 index 0000000..da00a43 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/vim/autoload.vim.xpt.vim @@ -0,0 +1,30 @@ +if expand( "%:p:h" ) . '/' !~# '\V\[\\/]autoload\[\\/]' + finish +endif + +XPTemplate priority=lang- + +let s:f = g:XPTfuncs() + +fun! s:f.vim_autoload_pre() + let path = expand( "%:p" ) + let path = substitute( path, '\V\\', '/', 'g' ) + let path = matchstr( path, '\V/autoload/\zs\.\+\ze.vim\$' ) + let path = substitute( path, '\V/', '#', 'g' ) + return path +endfunction + + + +XPTinclude + \ _common/common + \ vim/vim + +" TODO fix it +" XSET name|repl=vim_autoload_pre()#`name +XPT fun alias=_fun " fun! vim_autoload_pre()#** +XSET name=Build( '`' . vim_autoload_pre() . '#`n^' ) + + +XPT ## " vim_autoload_pre\()# +`vim_autoload_pre()^# diff --git a/vim-plugins/bundle/xptemplate/ftplugin/vim/vim.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/vim/vim.xpt.vim new file mode 100644 index 0000000..a1cb5a7 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/vim/vim.xpt.vim @@ -0,0 +1,182 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 + +" int fun ** ( +" class name ** ( +XPTvar $SPfun '' + +" int fun( ** arg ** ) +" if ( ** condition ** ) +" for ( ** statement ** ) +" [ ** a, b ** ] +" { ** 'k' : 'v' ** } +XPTvar $SParg ' ' + +" if ** ( +" while ** ( +" for ** ( +XPTvar $SPcmd ' ' + +" a ** = ** a ** + ** 1 +" (a, ** b, ** ) +XPTvar $SPop ' ' + +XPTinclude + \ _common/common + \ _printf/c.like + +XPTvar $CS " +XPTinclude + \ _comment/singleSign + +fun! s:f.vim_call() + " Note: do not use [ * - 2 ] which may be -1 + return getline( '.' )[ : self.ItemPos()[0][1] - 1 ] =~ '\v^\s*\w$' ? 'call ' : '' +endfunction + +call XPTdefineSnippet('vimformat', {}, [ '" vim:tw=78:ts=8:sw=4:sts=4:et:norl:fdm=marker:fmr={{{,}}}' ]) + + + +XPT lncol " [ line\( "." ), col\( "." ) ] +[ line( '.' ), col( '.' ) ] + +XPT printf " printf\(..) +XSET elts|pre=Echo('') +XSET elts=c_printf_elts( R( 'pattern' ), "," ) +printf(`$SParg^"`pattern^"`elts^`$SParg^) + +XPT _args hidden " expandable arguments +XSET arg*|post=ExpandInsideEdge( ',$SPop', '' ) +`$SParg`arg*`$SParg^ + +XPT self " self. +self. + +XPT once " if exists.. finish +XSET i|pre=headerSymbol() +if exists(`$SParg^"`g^:`i^"`$SParg^) + finish +endif +let `g^:`i^`$SPop^=`$SPop^1 +`cursor^ + +XPT version " if exists && larger than +XSET i|pre=headerSymbol() +XSET ver=1 +if exists(`$SParg^"`g^:`i^"`$SParg^) && `g^:`i^`$SPop^>=`$SPop^`ver^ + finish +endif +let ``g^:``i^`$SPop^=`$SPop^``ver^ +`cursor^ + +XPT varconf " if !exists ".." let .. = .. endif +if !exists(`$SParg^"`g^:`varname^"`$SParg^) + let `g^:`varname^`$SPop^=`$SPop^`val^ +endif + +XPT _fun hidden wrap " fun! ..(..) .. endfunction +fun! `name^`$SPfun^(`:_args:^) "{{{ + `cursor^ +endfunction "}}} + +XPT fun alias=_fun + +XPT member wrap " tips +fun! `name^`$SPfun^(`:_args:^) dict "{{{ + `cursor^ +endfunction "}}} + +XPT while wrap " while .. .. endwhile +while `cond^ + `cursor^ +endwhile + +XPT while1 alias=while +XSET cond=Embed( $TRUE ) + +XPT whilei wrap " while i | let i += 1 +let [`$SParg^`i^,`$SPop^`len^`$SParg^] = [`$SParg^`0^`$SPop^-`$SPop^1,`$SPop^`len_expr^`$SPop^-`$SPop^1`$SParg^] +while `i^`$SPop^<`$SPop^`len^ | let `i^`$SPop^+=`$SPop^1 + `cursor^ +endwhile + +XPT forin wrap " for .. in .. +for `value^ in `list^ + `cursor^ +endfor + +XPT try wrap=job " try .. catch .. +try + `job^ +`:catch:^ +endtry + +XPT catch " catch / .. / +XSET exception=.* +catch /`exception^/ + `cursor^ + +XPT finally " finally .. +finally + `cursor^ + +XPT if wrap " if .. else .. +if `cond^ + `cursor^ +endif + +XPT else " else .. +else + `cursor^ + +XPT filehead " description of file +" File Description {{{ +" ============================================================================= +" `cursor^ +" by `$author^ +" `$email^ +" Usage : +" +" ============================================================================= +" }}} +..XPT + +XPT savecpo " save &cpo +let s:oldcpo = &cpo +set cpo-=< cpo+=B +`cursor^ +let &cpo = s:oldcpo + +" The first placeholder wrapping 'com' keyword that causes ctags halt +XPT sid " generate s:sid variable +exe 'map xsid |let s:sid=matchstr(maparg("xsid"), "\\d\\+_")|unmap xsid' + +..XPT + +XPT bench " while 1000.. doit.. +let n = `100000^ +let i = 0 +let `t^_0 = reltime() + +while i < n + let i += 1 + `cursor^ +endwhile + +let `t^ = reltime( `t^_0 ) +let us = `t^[0] * 1000*1000 + `t^[1] +echo 'spent:' reltimestr( `t^ ) +echo 'per-call(us):' us/n + +XPT call wraponly=param " ..\( .. ) +`vim_call()`name^(`$SParg^`param^`$SParg^) + +XPT _call hidden wrap=param? " $_xSnipName( .. ) +`$_xSnipName^(`$SParg`param?`$SParg^) + +XPT string alias=_call diff --git a/vim-plugins/bundle/xptemplate/ftplugin/xhtml/xhtml.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/xhtml/xhtml.xpt.vim new file mode 100644 index 0000000..cfb7695 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/xhtml/xhtml.xpt.vim @@ -0,0 +1,6 @@ +XPTemplate priority=lang- + +XPTinclude + \ html/html + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/xml/xml.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/xml/xml.xpt.vim new file mode 100644 index 0000000..297c897 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/xml/xml.xpt.vim @@ -0,0 +1,155 @@ +XPTemplate priority=spec + +let s:f = g:XPTfuncs() + +XPTvar $CURSOR_PH + +XPTinclude + \ _common/common + +XPTvar $CL +XPTinclude + \ _comment/doubleSign + + +" ========================= Function and Variables ============================= + +fun! s:f.xml_att_val() + if self.Phase()=='post' + return '' + endif + + let name = self.ItemName() + return self.Vmatch('\V' . name, '\V\^\s\*\$') + \ ? '' + \ : '="val" ' . name +endfunction + +fun! s:f.xml_tag_ontype() + let v = self.V() + if v =~ '\V\s\$' + let v = substitute( v, '\V\s\*\$', '', 'g' ) + return self.Next( v ) + endif + return v +endfunction + +fun! s:f.xml_attr_ontype() + let v = self.V() + if v =~ '\V=\$' + return self.Next() + elseif len( v ) > 2 && v =~ '\V""\$' + return self.Next( v[ 0 : -2 ] ) + else + return v + endif + +endfunction + +fun! s:f.xml_create_attr_ph() + " let prev = self.PrevItem( -1 ) + if !self.HasStep( 'x' ) + return self.Embed('` `x^' . '`att*^') + endif + + let prev = self.Reference( 'x' ) + + if prev =~ '=$' + return self.Embed('`"`x`"^' . '`att*^') + elseif prev =~ '"$' + return self.Embed('` `x^' . '`att*^') + else + return self.Next( '' ) + endif +endfunction + +fun! s:f.xml_close_tag() + let v = self.V() + if v[ 0 : 0 ] != '<' || v[ -1:-1 ] != '>' + return '' + endif + + let v = v[ 1: -2 ] + + if v =~ '\v/\s*$|^!' + return '' + else + return '' + endif +endfunction + +fun! s:f.xml_cont_helper() + let v = self.V() + if v =~ '\V\n' + return self.ResetIndent( -s:nIndent, "\n" ) + else + return '' + endif +endfunction + +let s:nIndent = 0 +fun! s:f.xml_cont_ontype() + let v = self.V() + if v =~ '\V\n' + let v = matchstr( v, '\V\.\*\ze\n' ) + let s:nIndent = &indentexpr != '' + \ ? eval( substitute( &indentexpr, '\Vv:lnum', 'line(".")', '' ) ) - indent( line( "." ) - 1 ) + \ : self.NIndent() + + return self.Finish( v . "\n" . repeat( ' ', s:nIndent ) ) + else + return v + endif +endfunction + + +" inoremap < =XPTtgr('__tag',{'syn':'','k':'<'}) + +" ================================= Snippets =================================== + +XPT _tag hidden " <$_xSnipName>.. +XSET content|def=Echo( R( 't' ) =~ '\v/\s*$' ? Finish() : '' ) +XSET content|ontype=xml_cont_ontype() +<`t^$_xSnipName^>`content^`content^xml_cont_helper()^`t^xml_close_tag()^ +..XPT + +XPT __tag hidden " .. +XSET content|def=Echo( R( 't' ) =~ '\v/\s*$' ? Finish() : '' ) +XSET content|ontype=xml_cont_ontype() +`<`t`>^^`content^^`content^xml_cont_helper()^`t^xml_close_tag()^ +..XPT + +" NOTE: use Embed in default value phase to prevent post filter ruin place +" holder +" XPT < " .. +" XSET tag|ontype=xml_tag_ontype() +" XSET att*|pre=Echo('') +" XSET att*|def=Embed( '` `^' ) +" <`tag^`att*^>`content^ +" ..XPT + + +" " auto attributes completion +" XPT < " .. +" XSET tag|ontype=xml_tag_ontype() +" XSET att*|pre=Echo('') +" XSET att*|def=xml_create_attr_ph() +" XSET x|def=Echo( '' ) +" XSET x|ontype=xml_attr_ontype() +" XSET x|post=SV( '\v^\s*$', '' ) +" <`tag^`att*^>`content^ +" ..XPT + + +XPT ver " + + +XPT style " + + +XPT cdata wrap " diff --git a/vim-plugins/bundle/xptemplate/ftplugin/xpt/xpt.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/xpt/xpt.xpt.vim new file mode 100644 index 0000000..0d19ded --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/xpt/xpt.xpt.vim @@ -0,0 +1,223 @@ +XPTemplate priority=sub + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + \ vim/vim + + +fun! s:f.xpt_vim_hint_escape() + let v = substitute( self.V(), '\(\\*\)\([(]\)', '\1\1\\\2', 'g' ) + return v +endfunction + + +" TODO lazy load +let s:xpt_snip = split( globpath( &rtp, "ftplugin/**/*.xpt.vim" ), "\n" ) +call map( s:xpt_snip, 'substitute(v:val, ''\V\'', ''/'', ''g'')' ) +call map( s:xpt_snip, 'matchstr(v:val, ''\Vftplugin/\zs\.\*\ze.xpt.vim'')' ) + +fun! s:f.xpt_ftp_pum() + return self.Choose( s:xpt_snip ) +endfunction + +let s:xpts = {} +for v in s:xpt_snip + if v == '' + continue + endif + + let [ ft, snip ] = split( v, '/' ) + if !has_key( s:xpts, ft ) + let s:xpts[ ft ] = [] + endif + + let s:xpts[ ft ] += [ snip ] +endfor + + +fun! s:f.xpt_vim_path() + return keys( s:xpts ) +endfunction + +fun! s:f.xpt_vim_name(path) + let path = matchstr( a:path, '\w\+' ) + if has_key( s:xpts, path ) + return s:xpts[ path ] + else + return '' + endif +endfunction + + + + +XPT ftpfile " xpt ftplugin snippet file +XSET path=xpt_vim_path() +XSET name=xpt_vim_name( R( 'path' ) ) +`path^/`name^ + +XPT incfile " XPTinclude ... +XPTinclude + \ _common/common + \ `:ftpfile:^ + + +XPT container " let s:f = .. +let s:f = g:XPTfuncs() + + +XPT tmpl " XPT name ... +XSET tips|post=xpt_vim_hint_escape() +\XPT `name^` " `tips^ +`cursor^ + + +XPT snip alias=tmpl + + +XPT var " XPTvar $*** *** +XPTvar $`name^ `cursor^ + + +XPT varLang " variables to define language properties +" variable prefix +XPTvar $VAR_PRE + + +XPT varFormat " variables to define format +" if () ** { +" else ** { +XPTvar $BRif ' ' + +" } ** else { +XPTvar $BRel \n + +" for () ** { +" while () ** { +" do ** { +XPTvar $BRloop ' ' + +" struct name ** { +XPTvar $BRstc ' ' + +" int fun() ** { +" class name ** { +XPTvar $BRfun ' ' + + +XPT varSpaces " variable to define spacing +" int fun ** ( +" class name ** ( +XPTvar $SPfun '' + +" int fun( ** arg ** ) +" if ( ** condition ** ) +" for ( ** statement ** ) +" [ ** a, b ** ] +" { ** 'k' : 'v' ** } +XPTvar $SParg ' ' + +" if ** ( +" while ** ( +" for ** ( +XPTvar $SPcmd ' ' + +" a ** = ** a ** + ** 1 +" (a, ** b, ** ) +XPTvar $SPop ' ' + + +XPT varConst " variables to define constants +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + + +XPT varHelper " variables to define helper place holders +XPTvar $VOID_LINE +XPTvar $CURSOR_PH + + +XPT varComment1 " variables to define single sign comments +XPTvar $CS `cursor^ + + +XPT varComment2 " variables to define double sign comments +XPTvar $CL `left sign^ +XPTvar $CM `cursor^ +XPTvar $CR `right sign^ + +XPT spfun " `\$SPfun^ +\`$SPfun\^ + +XPT sparg " `\$SParg^ +\`$SParg\^ + +XPT spcmd " `\$SPcmd^ +\`$SPcmd\^ + +XPT spop " `\$SPop^ +\`$SPop\^ + + +XPT buildifeq " {{}} +\``name^{{\^`cursor^\`}}\^ + +XPT inc " `::^ +\`:`name^:\^ + +XPT include " `Include:^ +\`Include:`name^\^ + + +XPT fun wrap " fun! s:f.** +fun! `s:f.`name^(`$SParg`param?`$SParg^) + `cursor^ +endfunction + + +XPT skeleton " very simple snippet file skeleton +" Save this file as ~/.vim/ftplugin/c/hello.xpt.vim(or +" ~/vimfiles/ftplugin/c/hello.xpt.vim). +" Then you can use it in C language file: +" vim xpt.c +" And type: +" helloxpt +" +XPTemplate priority=personal+ + +\XPT helloxpt " tips about what this snippet do +Say hello to \`xpt^. +\`xpt^ says hello. + + + + + +XPT xpt " start template to write template +XPTemplate priority=`prio^ +XSET prio=ChooseStr( 'all', 'spec', 'like', 'lang', 'sub', 'personal' ) + +let s:f = g:XPTfuncs() + +" use snippet 'varConst' to generate contant variables +" use snippet 'varFormat' to generate formatting variables +" use snippet 'varSpaces' to generate spacing variables + + +XPTinclude + \ _common/common + + +\XPT helloxpt " tips about what this snippet does +Say hello to \`xpt\^. +\`xpt\^ says hello. + +`cursor^ + +..XPT + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/xptest/xptest.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/xptest/xptest.xpt.vim new file mode 100644 index 0000000..975361b --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/xptest/xptest.xpt.vim @@ -0,0 +1,64 @@ +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + + +XPTinclude + \ _common/common + + +fun! s:f.fff() + let v = self.V() + if v == 'aa' + return '' + else + return ', another' + endif +endfunction + + + + + +XPT aa syn=43w +fjdkls +\XPT +fdskl +..XPT + +XPT table alias=_tag +XPT tr alias=_tag + +XPT e " tips +#{ `^ } + +XPT bb " tips +XSET cursor=123 +what `a^ `cursor^ +\XPT +..XPT + +" XPT jkldsjfksl + +XPT q " tips +XSET $a=3 +`p`{$a}`p^-`p^ + +XPT x " tips +XSET $a=3 +`p`p`p^-`$a^ + +XPT t " tips +`:x:^fjkdls +fjksl + + +fd +..XPT +" XPT aa " paste at end test +" `f^`aa...{{^pp`}}^`l^Echo( Context().history[-1].item.name )^ + +XPT pp " tips +`...^ +- Let's repeat `this^ +`...^ diff --git a/vim-plugins/bundle/xptemplate/ftplugin/xslt/xslt.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/xslt/xslt.xpt.vim new file mode 100644 index 0000000..b4acb3c --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/xslt/xslt.xpt.vim @@ -0,0 +1,110 @@ +XPTemplate priority=lang- keyword=< + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH cursor + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + +XPTinclude + \ _common/common + \ html/html + \ xml/xml + +XPTvar $CL +XPTinclude + \ _comment/doubleSign + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + + + +XPT sort " + + +XPT valueof " + + +XPT apply " + + +XPT param " + + +XPT import " + + +XPT include " + + +XPT stylesheet " + + + + + + + + +XPT template " + `cursor^ + + + +XPT foreach " + `cursor^ + + + +XPT if " + `cursor^ + + + +XPT choose " + + `job^ + `...^ + + `job^ + `...^ + `otherwise...{{^ + `cursor^ + `}}^ + + + +XPT when " + `what^ + + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/yacc/yacc.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/yacc/yacc.xpt.vim new file mode 100644 index 0000000..ca774ab --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/yacc/yacc.xpt.vim @@ -0,0 +1,55 @@ +XPTemplate priority=lang- + +let s:f = g:XPTfuncs() + +XPTvar $TRUE 1 +XPTvar $FALSE 0 +XPTvar $NULL NULL +XPTvar $UNDEFINED NULL + +XPTvar $VOID_LINE /* void */; +XPTvar $CURSOR_PH /* cursor */ + +XPTvar $BRif ' ' +XPTvar $BRel \n +XPTvar $BRloop ' ' +XPTvar $BRstc ' ' +XPTvar $BRfun ' ' + + +XPTinclude + \ _common/common + \ c/c + + +" ========================= Function and Variables ============================= + +" ================================= Snippets =================================== + + +XPT yacc " Basic yacc file +%{ +/* includes */ +%} +/* options */ +%% +/* grammar rules */ +%% +/* C code */ + +XPT rule " ..: .. | .. | ... +`ruleName^: `pattern^ { `action^ } +` `...` +{{^ | `pattern^ { `action^ } +` `...` +^`}}^ ; + +XPT tok " %token ... +%token + +XPT prio " %left ... %right ... +XSET op*|post=ExpandIfNotEmpty( "' '", 'op*', "" ) +%left '`op*^'` `...^ +%left '`op*^'` `...^ + + diff --git a/vim-plugins/bundle/xptemplate/ftplugin/zsh/zsh.xpt.vim b/vim-plugins/bundle/xptemplate/ftplugin/zsh/zsh.xpt.vim new file mode 100644 index 0000000..2efc27c --- /dev/null +++ b/vim-plugins/bundle/xptemplate/ftplugin/zsh/zsh.xpt.vim @@ -0,0 +1,8 @@ +" got basic sh snippets for zsh files +" (like ~/.zshrc) +XPTemplate priority=lang + +XPTinclude + \ _common/common + \ sh/sh + diff --git a/vim-plugins/bundle/xptemplate/personal/Readme.txt b/vim-plugins/bundle/xptemplate/personal/Readme.txt new file mode 100644 index 0000000..5ede980 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/personal/Readme.txt @@ -0,0 +1,25 @@ + +This is the folder where you add your personal snippets. + +This fold is one of 'runtimepath'. You can imagine this is another ~/.vim +folder( in Unix ) or ~/vimfiles( in windows ). + +============================================================================== + +To add your own snippets, just create a snippet file like what XPT does. For +example to create a C language snippet you need to create: > + personal/ftplugin/c/some_name.xpt.vim +< And then add snippets in this file. +See |xpt-snippet-syntax| |xpt-write-snippet| and |xpt-snippet-tutorial|. + +NOTE: personal snippets in this file should have high priority which is set +with |xpt-snippet-priority|, for example the "personal" priority: > + XPTemplate priority=personal +< This is the highest priority thus no other snippets overrides yours. See +|xpt-snippet-priority| + + +You can also create snippets in some other folders and specify them as snippet +folder with |g:xptemplate_snippet_folders| + +" vim:tw=78:ts=8:sw=8:sts=8:noet:ft=help:norl:spell: diff --git a/vim-plugins/bundle/xptemplate/personal/ftplugin/_common/personal_example.xpt.vim b/vim-plugins/bundle/xptemplate/personal/ftplugin/_common/personal_example.xpt.vim new file mode 100644 index 0000000..adbab62 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/personal/ftplugin/_common/personal_example.xpt.vim @@ -0,0 +1,15 @@ +" Move me to your own fptlugin/_common and config your personal information. +" +" Here is the place to set personal preferences; "priority=personal" is the +" highest which overrides any other XPTvar setting. +" +" You can also set personal variables with 'g:xptemplate_vars' in your .vimrc. +XPTemplate priority=personal + + +" XPTvar $author you have not yet set $author variable +" XPTvar $email you have not yet set $email variable + +XPT yoursnippet " tips here +bla bla + diff --git a/vim-plugins/bundle/xptemplate/plugin/debug.vim b/vim-plugins/bundle/xptemplate/plugin/debug.vim new file mode 100644 index 0000000..706635f --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/debug.vim @@ -0,0 +1,133 @@ +if exists( "g:__DEBUG_VIM__" ) && g:__DEBUG_VIM__ >= XPT#ver + finish +endif +let g:__DEBUG_VIM__ = XPT#ver + +let s:oldcpo = &cpo +set cpo-=< +set cpo+=B + +let s:globalLogLevel = 'warn' +" let s:globalLogLevel = 'debug' + +com! DebugGetSID let s:sid = matchstr("", '\zs\d\+_\ze') +DebugGetSID +delc DebugGetSID + +fun! CreateLogger( level ) "{{{ + + let level = s:logLevels[ a:level ] + let level = min( [ level, s:logLevels[ s:globalLogLevel ] ] ) + + let logger = copy( s:loggerPrototype ) + + if level < s:logLevels.fatal | let logger.Fatal = s:loggerPrototype.LogNothing | endif + if level < s:logLevels.error | let logger.Error = s:loggerPrototype.LogNothing | endif + if level < s:logLevels.warn | let logger.Warn = s:loggerPrototype.LogNothing | endif + if level < s:logLevels.info | let logger.Info = s:loggerPrototype.LogNothing | endif + if level < s:logLevels.log | let logger.Log = s:loggerPrototype.LogNothing | endif + if level < s:logLevels.debug | let logger.Debug = s:loggerPrototype.LogNothing | endif + + return logger +endfunction "}}} + +fun! Assert( shouldBeTrue, msg ) "{{{ + if !a:shouldBeTrue + throw a:msg + end +endfunction "}}} + +com! -nargs=+ Assert call Assert( , ) + + +let s:logLevels = { + \ 'fatal' : 1, + \ 'error' : 2, + \ 'warn' : 3, + \ 'info' : 4, + \ 'log' : 5, + \ 'debug' : 6, + \ } + +let s:loggerPrototype = {} +fun! s:Fatal(...) dict "{{{ + return call('Log_core', ['Fatal'] + a:000) +endfunction "}}} + +fun! s:Error(...) dict "{{{ + return call('Log_core', ['Error'] + a:000) +endfunction "}}} + +fun! s:Warn(...) dict "{{{ + return call('Log_core', ['Warn'] + a:000) +endfunction "}}} + +fun! s:Info(...) dict "{{{ + return call('Log_core', ['Info'] + a:000) +endfunction "}}} + +fun! s:Log(...) dict "{{{ + return call('Log_core', ['Log'] + a:000) +endfunction "}}} + +fun! s:Debug(...) dict "{{{ + return call('Log_core', ['Debug'] + a:000) +endfunction "}}} + +fun! s:LogNothing(...) "{{{ +endfunction "}}} + + + +let s:loggerPrototype.Fatal = function( "" . s:sid . "Fatal" ) +let s:loggerPrototype.Error = function( "" . s:sid . "Error" ) +let s:loggerPrototype.Warn = function( "" . s:sid . "Warn" ) +let s:loggerPrototype.Info = function( "" . s:sid . "Info" ) +let s:loggerPrototype.Log = function( "" . s:sid . "Log" ) +let s:loggerPrototype.Debug = function( "" . s:sid . "Debug" ) +let s:loggerPrototype.LogNothing = function( "" . s:sid . "LogNothing" ) + + +if len( finddir( $HOME . '/tmp' ) ) > 0 + let s:logLocation = finddir( $HOME . '/tmp' ) +else + let s:logLocation = $HOME +endif + +let s:logLocation .= '/vim.log' + + +call delete(s:logLocation) + +fun! Log_core(level, ...) "{{{ + " call stack printing + try + throw '' + catch /.*/ + let stack = matchstr( v:throwpoint, 'function\s\+\zs.\{-}\ze\.\.\%(Fatal\|Error\|Warn\|Info\|Log\|Debug\).*' ) + let stack = substitute( stack, '\d\+_', '', 'g' ) + endtry + + + exe 'redir! >> '.s:logLocation + + + silent echom a:level . ':::' . stack . ' cursor at=' . string( [ line("."), col(".") ] ) + + for msg in a:000 + let l = split(';' . msg . ';', "\n") + let l[0] = l[0][1:] + let l[ -1 ] = l[ -1 ][ :-2 ] + for v in l + silent! echom v + endfor + endfor + redir END + + if a:level =~ 'Fatal\|Error\|Warn' + echoerr string( a:000 ) + endif +endfunction "}}} + + +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xpmark.vim b/vim-plugins/bundle/xptemplate/plugin/xpmark.vim new file mode 100644 index 0000000..a8b3c62 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xpmark.vim @@ -0,0 +1,695 @@ +if exists( "g:__XPMARK_VIM__" ) && g:__XPMARK_VIM__ >= XPT#ver + finish +endif +let g:__XPMARK_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +com! XPMgetSID let s:sid = matchstr("", '\zs\d\+_\ze') +XPMgetSID +delc XPMgetSID +runtime plugin/xptemplate.conf.vim +runtime plugin/debug.vim +let s:log = xpt#debug#Logger( 'warn' ) +let g:xpm_mark = 'p' +let g:xpm_mark_nextline = 'l' +let g:xpm_changenr_level = 1000 +let s:insertPattern = '[i]' +let g:XPM_RET = { 'likely_matched':{'likely_matched' : 1}, 'no_updated_made':{'no_updated_made' : 1}, 'undo_redo':{'undo_redo' : 1}, 'updated':{'updated' : 1}, } +let s:emptyHistoryElt = {'list':[], 'dict' :{}, 'likely' : { 'start' : '', 'end' : '' }} +let g:XPMpreferLeft = 'l' +let g:XPMpreferRight = 'r' +augroup XPM + au! + au BufEnter * call InitBuf() +augroup END +fun! XPMcheckStatusline() + if stridx( &l:statusline, 'XPMautoUpdate' ) >= 0 + return + else + call s:SetupStatusline() + endif +endfunction +fun! s:SetupStatusline() + if &statusline == "" + if &l:statusline == '' + setlocal statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + else + endif + else + if &l:statusline == '' + setlocal statusline< + else + endif + endif + if stridx( &l:statusline, 'XPMautoUpdate' ) < 0 + if &l:statusline =~ '\V\^%!' + let &l:statusline .= '.XPMautoUpdate("statusline")' + else + let &l:statusline .= '%{XPMautoUpdate("statusline")}' + endif + endif +endfunction +fun! XPMadd(name,pos,prefer,...) + call XPMcheckStatusline() + let d = s:BufData() + let prefer = a:prefer == 'l' ? 0 : 1 + if has_key(d.marks,a:name) + call d.removeMark(a:name) + endif + let d.marks[a:name] = a:pos + [len(getline(a:pos[0])),prefer] + call d.addMarkOrder(a:name,get(a:000,0,0)) +endfunction +fun! XPMhere(name,prefer) + call XPMadd( a:name, [ line( "." ), col( "." ) ], a:prefer ) +endfunction +fun! XPMremove(name) + let d = s:BufData() + call d.removeMark(a:name) +endfunction +fun! XPMremoveStartEnd(dict) + let d = s:BufData() + call d.removeMark(a:dict.start) + call d.removeMark(a:dict.end) +endfunction +fun! XPMremoveMarkStartWith(prefix) + let d = s:BufData() + for key in keys(d.marks) + if key =~# '^\V' . a:prefix + call d.removeMark(key) + endif + endfor +endfunction +fun! XPMflush() + let d = s:BufData() + let d.marks = {} + let d.orderedMarks = [] + let d.changeLikelyBetween = { 'start' : '', 'end' : '' } + let d.markHistory[ changenr() ] = { 'dict' : d.marks, 'list': d.orderedMarks, 'likely' : d.changeLikelyBetween } +endfunction +fun! XPMflushWithHistory() + call XPMflush() + let d = s:BufData() + let d.markHistory = {} +endfunction +fun! XPMgoto(name) + let d = s:BufData() + if has_key(d.marks,a:name) + let pos = d.marks[a:name][: 1] + call cursor(pos) + endif +endfunction +fun! XPMpos(name) + let d = s:BufData() + if has_key(d.marks,a:name) + return d.marks[a:name][: 1] + endif + return [0,0] +endfunction +fun! XPMhas(...) + let d = s:BufData() + for name in a:000 + if !has_key(d.marks,name) + return 0 + endif + endfor + return 1 +endfunction +fun! XPMposStartEnd(dict) + let d = s:BufData() + return [has_key(d.marks,a:dict.start) ? d.marks[a:dict.start][0:1] : [0,0], has_key(d.marks,a:dict.end) ? d.marks[a:dict.end][0:1] : [0,0],] +endfunction +fun! XPMposList(...) + let d = b:_xpmark + let list = [] + for name in a:000 + call add(list,get(d.marks,name,[0,0])[0:1]) + endfor + return list +endfunction +fun! XPMmarkAfter(pos) + let d = b:_xpmark + for name in d.orderedMarks + if d.marks[name][0] >= a:pos[0] && d.marks[name][1] >= a:pos[1] + return { 'name' : name, 'pos' : copy( d.marks[ name ] ) } + endif + endfor + return 0 +endfunction +fun! XPMsetLikelyBetween(start,end) + let d = s:BufData() + let d.changeLikelyBetween = { 'start' : a:start, 'end' : a:end } +endfunction +fun! XPMsetUpdateStrategy(mode) + let d = s:BufData() + if a:mode == 'manual' + let d.updateStrategy = a:mode + elseif a:mode == 'normalMode' + let d.updateStrategy = a:mode + elseif a:mode == 'insertMode' + let d.updateStrategy = a:mode + else + let d.updateStrategy = 'auto' + endif +endfunction +fun! XPMupdateSpecificChangedRange(start,end) + let d = s:BufData() + let nr = changenr() + if nr != d.lastChangenr + call d.snapshot() + endif + call d.initCurrentStat() + let rc = d.updateWithNewChangeRange(a:start,a:end) + call d.saveCurrentStat() + return rc +endfunction +fun! XPMautoUpdate(msg) + if !exists( 'b:_xpmark' ) + return '' + endif + let d = s:BufData() + let isInsertMode = (d.lastMode == 'i' && mode() == 'i') + if d.updateStrategy == 'manual' || d.updateStrategy == 'normalMode' && isInsertMode || d.updateStrategy == 'insertMode' && !isInsertMode + return '' + endif + call XPMupdate('auto') + return '' +endfunction +fun! XPMupdate(...) + if !exists( 'b:_xpmark' ) + return '' + endif + let d = s:BufData() + let mode = a:0 > 0 ? a:000[0] : 'auto' + if mode == 'force' + let needUpdate = 1 + else + let needUpdate = d.isUpdateNeeded() + endif + if !needUpdate + call d.snapshot() + call d.saveCurrentStat() + return g:XPM_RET.no_updated_made + endif + call d.initCurrentStat() + if d.lastMode =~ s:insertPattern && d.stat.mode =~ s:insertPattern + let rc = d.insertModeUpdate() + else + let rc = d.normalModeUpdate() + endif + call d.saveCurrentStat() + return rc +endfunction +fun! XPMupdateStat() + let d = s:BufData() + call d.saveCurrentStat() +endfunction +fun! XPMupdateCursorStat(...) + let d = s:BufData() + call d.saveCurrentCursorStat() +endfunction +fun! XPMsetBufSortFunction(funcRef) + if !exists('b:_xpm_compare') + let b:_xpm_compare = a:funcRef + endif +endfunction +fun! XPMallMark() + let d = s:BufData() + let msg = '' + let i = 0 + for name in d.orderedMarks + let msg .= printf( '%3d', i ) . ' ' . name . repeat( '-', 30-len( name ) ) . substitute( string( d.marks[ name ] ), '\<\d\>', ' &', 'g' ) . "\n" + let i += 1 + endfor + return msg +endfunction +fun! s:isUpdateNeeded() dict + if empty(self.marks) && changenr() == self.lastChangenr + return 0 + endif + return 1 +endfunction +fun! s:initCurrentStat() dict + let self.stat = { 'currentPosition':[ line( '.' ), col( '.' ) ], 'totalLine':line( "$" ), 'currentLineLength':len( getline( "." ) ), 'mode':mode(), 'positionOfMarkP':[ line( "'" . g:xpm_mark ), col( "'" . g:xpm_mark ) ] } +endfunction +fun! s:snapshot() dict + let nr = changenr() + if nr == self.lastChangenr + return + endif + let n = self.lastChangenr + 1 + if !has_key(self.markHistory,n-1) + if has_key(self.markHistory,n-2) + let self.markHistory[n-1] = self.markHistory[n-2] + else + let self.markHistory[n-1] = deepcopy(s:emptyHistoryElt) + endif + endif + while n < nr + let self.markHistory[n] = self.markHistory[n - 1] + if has_key(self.markHistory,n - g:xpm_changenr_level) + unlet self.markHistory[n - g:xpm_changenr_level] + endif + let n += 1 + endwhile + let self.marks = copy(self.marks) + let self.orderedMarks = copy(self.orderedMarks) + let self.changeLikelyBetween = deepcopy(self.changeLikelyBetween) + let self.markHistory[ nr ] = { 'dict' : self.marks, 'list': self.orderedMarks, 'likely' : self.changeLikelyBetween } +endfunction +fun! s:handleUndoRedo() dict + let nr = changenr() + if nr < self.lastChangenr + call self.ToChangeNr(nr) + return 1 + elseif nr > self.lastChangenr && nr <= self.changenrRange[1] + call self.ToChangeNr(nr) + return 1 + else + return 0 + endif +endfunction +fun! s:ToChangeNr(nr) dict + if has_key(self.markHistory,a:nr) + let self.marks = self.markHistory[a:nr].dict + let self.orderedMarks = self.markHistory[a:nr].list + let self.changeLikelyBetween = self.markHistory[a:nr].likely + else + call s:log.Info( "No " . a:nr . ' in markHistory, create new mark set' ) + let self.marks = {} + let self.orderedMarks = [] + let self.changeLikelyBetween = { 'start' : '', 'end' : '' } + endif +endfunction +fun! s:insertModeUpdate() dict + if self.handleUndoRedo() + return g:XPM_RET.undo_redo + endif + let stat = self.stat + if changenr() != self.lastChangenr + call self.snapshot() + endif + if stat.totalLine == self.lastTotalLine + if stat.currentPosition[0] == self.lastPositionAndLength[0] && stat.currentLineLength == self.lastPositionAndLength[2] + return g:XPM_RET.no_updated_made + endif + if self.lastPositionAndLength[2] == len(getline(self.lastPositionAndLength[0])) + return g:XPM_RET.no_updated_made + endif + endif + let lastPos = self.lastPositionAndLength[: 1] + let bLastPos = [self.lastPositionAndLength[0] + stat.totalLine - self.lastTotalLine,0] + let bLastPos[1] = self.lastPositionAndLength[1] - self.lastPositionAndLength[2] + len(getline(bLastPos[0])) + if bLastPos[0] * 10000 + bLastPos[1] >= lastPos[0] * 10000 + lastPos[1] + return self.updateWithNewChangeRange(self.lastPositionAndLength[:1],stat.currentPosition) + else + return self.updateWithNewChangeRange(stat.currentPosition,stat.currentPosition) + endif +endfunction +fun! s:normalModeUpdate() dict + let stat = self.stat + let nr = changenr() + if nr == self.lastChangenr + return g:XPM_RET.no_updated_made + endif + if self.handleUndoRedo() + return g:XPM_RET.undo_redo + endif + let cs = [ line( "'[" ), col( "'[" ) ] + let ce = [ line( "']" ), col( "']" ) ] + call self.snapshot() + let diffOfLine = stat.totalLine - self.lastTotalLine + if stat.mode =~ s:insertPattern + if diffOfLine > 0 + if self.lastPositionAndLength[0] < stat.positionOfMarkP[0] + call self.updateMarksAfterLine(self.lastPositionAndLength[0] - 1) + else + call self.updateMarksAfterLine(stat.currentPosition[0] - 1) + endif + elseif self.lastMode =~ 's' || self.lastMode == "\" + return self.updateWithNewChangeRange([ line( "'<" ), col( "'<" ) ], stat.currentPosition) + else + return self.updateWithNewChangeRange(stat.currentPosition,stat.currentPosition) + endif + elseif self.lastMode =~ s:insertPattern + return g:XPM_RET.no_updated_made + else + let linewiseDeletion = stat.positionOfMarkP[0] == 0 + let lineNrOfChangeEndInLastStat = ce[0] - diffOfLine + if linewiseDeletion + if cs == ce + call self.updateForLinewiseDeletion(cs[0],lineNrOfChangeEndInLastStat) + return g:XPM_RET.updated + else + endif + elseif stat.positionOfMarkP[0] == line( "'" . g:xpm_mark_nextline ) && stat.totalLine < self.lastTotalLine + let endPos = [self.lastPositionAndLength[0],self.lastPositionAndLength[2]] + return self.updateWithNewChangeRange(endPos,endPos) + elseif self.lastMode =~ '[vVsS]' + elseif diffOfLine == -1 + let cs = [self.lastPositionAndLength[0],self.lastPositionAndLength[2] + 1] + let ce = [self.lastPositionAndLength[0],self.lastPositionAndLength[2] + 2] + return self.updateWithNewChangeRange(cs,ce) + elseif cs == [1,1] && ce == [stat.totalLine,1] || diffOfLine < -1 + call XPMflush() + return g:XPM_RET.updated + endif + return self.updateWithNewChangeRange(cs,ce) + endif + return g:XPM_RET.updated +endfunction +fun! s:updateMarksAfterLine(line) dict + let diffOfLine = self.stat.totalLine - self.lastTotalLine + for [n,v] in items(self.marks) + if v[0] > a:line + let self.marks[n] = [v[0] + diffOfLine,v[1],v[2],v[3]] + endif + endfor +endfunction +fun! s:updateForLinewiseDeletion(fromLine,toLine) dict + for [n,mark] in items(self.marks) + if mark[0] >= a:toLine + let self.marks[n] = [mark[0] + self.stat.totalLine - self.lastTotalLine,mark[1],mark[2],mark[3]] + elseif mark[0] >= a:fromLine && mark[0] < a:toLine + call self.removeMark(n) + endif + endfor +endfunction +fun! s:updateWithNewChangeRange(changeStart,changeEnd) dict + let bChangeEnd = [a:changeEnd[0] - self.stat.totalLine, a:changeEnd[1] - len(getline(a:changeEnd[0]))] + let likelyIndexes = self.findLikelyRange(a:changeStart,bChangeEnd) + if likelyIndexes == [-1,-1] + let indexes = [0,len(self.orderedMarks)] + call self.updateMarks(indexes,a:changeStart,a:changeEnd) + return g:XPM_RET.updated + else + let len = len(self.orderedMarks) + let i = likelyIndexes[0] + let j = likelyIndexes[1] + call self.updateMarksBefore([0,i + 1],a:changeStart,a:changeEnd) + call self.updateMarks([i+1,j],a:changeStart,a:changeEnd) + let len2 = len(self.orderedMarks) + let j += len2 - len + call self.updateMarksAfter([j,len2],a:changeStart,a:changeEnd) + return [self.orderedMarks[i],self.orderedMarks[j]] + endif +endfunction +fun! s:updateMarksBefore(indexRange,changeStart,changeEnd) dict + let lineLengthCS = len(getline(a:changeStart[0])) + let [iStart,iEnd] = [a:indexRange[0] - 1,a:indexRange[1] - 1] + while iStart < iEnd + let iStart += 1 + let name = self.orderedMarks[iStart] + let mark = self.marks[name] + let bMark = [mark[0] - self.lastTotalLine,mark[1] - mark[2]] + if mark[0] < a:changeStart[0] + continue + elseif mark[0] == a:changeStart[0] && mark[1] - 1 < a:changeStart[1] + let self.marks[name] = [mark[0],mark[1],lineLengthCS,mark[3]] + else + call s:log.Error( 'mark should be before, but it is after start of change:' . string( [ mark, a:changeStart ] ) ) + endif + endwhile +endfunction +fun! s:updateMarksAfter(indexRange,changeStart,changeEnd) dict + let bChangeEnd = [a:changeEnd[0] - self.stat.totalLine, a:changeEnd[1] - len(getline(a:changeEnd[0]))] + let diffOfLine = self.stat.totalLine - self.lastTotalLine + let lineLengthCS = len(getline(a:changeStart[0])) + let lineLengthCE = len(getline(a:changeEnd[0])) + let lineNrOfChangeEndInLastStat = a:changeEnd[0] - diffOfLine + let [iStart,iEnd] = [a:indexRange[0] - 1,a:indexRange[1] - 1] + while iStart < iEnd + let iStart += 1 + let name = self.orderedMarks[iStart] + let mark = self.marks[name] + let bMark = [mark[0] - self.lastTotalLine,mark[1] - mark[2]] + if mark[0] > lineNrOfChangeEndInLastStat + if diffOfLine == 0 + break + endif + let self.marks[name] = [mark[0] + diffOfLine,mark[1],mark[2],mark[3]] + elseif bMark[0] == bChangeEnd[0] && bMark[1] >= bChangeEnd[1] + let self.marks[name] = [a:changeEnd[0],bMark[1] + lineLengthCE,lineLengthCE,mark[3]] + else + call s:log.Error( 'mark should be after changes, but it is before them:' . string( [ bMark, bChangeEnd ] )) + endif + endwhile +endfunction +fun! s:updateMarks(indexRange,changeStart,changeEnd) dict + let bChangeEnd = [a:changeEnd[0] - self.stat.totalLine, a:changeEnd[1] - len(getline(a:changeEnd[0]))] + let diffOfLine = self.stat.totalLine - self.lastTotalLine + let lineLengthCS = len(getline(a:changeStart[0])) + let lineLengthCE = len(getline(a:changeEnd[0])) + let lineNrOfChangeEndInLastStat = a:changeEnd[0] - diffOfLine + let [iStart,iEnd] = [a:indexRange[0] - 1,a:indexRange[1] - 1] + while iStart < iEnd + let iStart += 1 + let name = self.orderedMarks[iStart] + let mark = self.marks[name] + let bMark = [mark[0] - self.lastTotalLine,mark[1] - mark[2]] + if mark[0] < a:changeStart[0] + continue + elseif mark[0] > lineNrOfChangeEndInLastStat + let self.marks[name] = [mark[0] + diffOfLine,mark[1],mark[2],mark[3]] + elseif mark[0 : 1] == a:changeStart && bMark == bChangeEnd + if mark[3] == 0 + let self.marks[name] = [mark[0],mark[1],lineLengthCS,0] + else + let self.marks[name] = [a:changeEnd[0],bMark[1] + lineLengthCE,lineLengthCE,1] + endif + elseif mark[0] == a:changeStart[0] && mark[1] - 1 < a:changeStart[1] + let self.marks[name] = [mark[0],mark[1],lineLengthCS,mark[3]] + elseif bMark[0] == bChangeEnd[0] && bMark[1] >= bChangeEnd[1] + let self.marks[name] = [a:changeEnd[0],bMark[1] + lineLengthCE,lineLengthCE,mark[3]] + else + call self.removeMark(name) + let iStart -= 1 + let iEnd -= 1 + endif + endwhile +endfunction +fun! XPMupdateWithMarkRangeChanging(startMark,endMark,changeStart,changeEnd) + let d = s:BufData() + call d.initCurrentStat() + if changenr() != d.lastChangenr + call d.snapshot() + endif + let startIndex = index(d.orderedMarks,a:startMark) + let endIndex = index(d.orderedMarks,a:endMark,startIndex + 1) + call d.updateMarksAfter([endIndex,len(d.orderedMarks)],a:changeStart,a:changeEnd) + let [i,len] = [startIndex + 1 ,endIndex] + while i < len + let len -= 1 + let mark = d.orderedMarks[i] + endwhile + let lineLength = len(getline(a:changeStart[0])) + let [i] = [startIndex + 1] + while i > 0 + let i -= 1 + let mark = d.orderedMarks[i] + if d.marks[mark][0] < a:changeStart[0] + break + else + let d.marks[mark][2] = len(getline(d.marks[mark][0])) + endif + endwhile + call d.saveCurrentStat() +endfunction +fun! s:findLikelyRange2(changeStart,bChangeEnd) dict + if self.changeLikelyBetween.start == '' || self.changeLikelyBetween.end == '' + return [-1,-1] + elseif !has_key(self.marks,self.changeLikelyBetween.start) || !has_key(self.marks,self.changeLikelyBetween.end) + return [-1,-1] + endif + let [likelyStart,likelyEnd] = [self.marks[self.changeLikelyBetween.start], self.marks[self.changeLikelyBetween.end]] + let bLikelyEnd = [likelyEnd[0] - self.lastTotalLine, likelyEnd[1] - likelyEnd[2]] + let nChangeStart = a:changeStart[0] * 10000 + a:changeStart[1] + let nLikelyStart = likelyStart[0] * 10000 + likelyStart[1] + let nbChangeEnd = a:bChangeEnd[0] * 10000 + a:bChangeEnd[1] + let nbLikelyEnd = bLikelyEnd[0] * 10000 + bLikelyEnd[1] + if nChangeStart >= nLikelyStart && nbChangeEnd <= nbLikelyEnd + let re = [] + let [i,len] = [0,len(self.orderedMarks)] + while i < len + if self.orderedMarks[i] == self.changeLikelyBetween.start + call add(re,i) + elseif self.orderedMarks[i] == self.changeLikelyBetween.end + call add(re,i) + return re + endif + let i += 1 + endwhile + call s:log.Error( string( self.changeLikelyBetween ) . ' : end mark is not found!' ) + else + return [-1,-1] + endif +endfunction +fun! s:findLikelyRange(changeStart,bChangeEnd) dict + if self.changeLikelyBetween.start == '' || self.changeLikelyBetween.end == '' + return [-1,-1] + elseif !has_key(self.marks,self.changeLikelyBetween.start) || !has_key(self.marks,self.changeLikelyBetween.end) + return [-1,-1] + endif + let nChangeStart = a:changeStart[0] * 10000 + a:changeStart[1] + let nbChangeEnd = a:bChangeEnd[0] * 10000 + a:bChangeEnd[1] + let iLikelyStart = -1 + let iLikelyEnd = -1 + let [i,len] = [0,len(self.orderedMarks)] + while i < len + if self.orderedMarks[i] == self.changeLikelyBetween.start + let iLikelyStart = i + elseif self.orderedMarks[i] == self.changeLikelyBetween.end + let iLikelyEnd = i + break + endif + let i += 1 + endwhile + if iLikelyStart == -1 || iLikelyEnd == -1 + return [-1,-1] + endif + while iLikelyStart >= 0 + let likelyStart = self.marks[self.orderedMarks[iLikelyStart]] + let nLikelyStart = likelyStart[0] * 10000 + likelyStart[1] + if nChangeStart >= nLikelyStart + break + endif + let iLikelyStart -= 1 + endwhile + if iLikelyStart == -1 + return [-1,-1] + endif + while iLikelyEnd < len(self.orderedMarks) + let likelyEnd = self.marks[self.orderedMarks[iLikelyEnd]] + let bLikelyEnd = [likelyEnd[0] - self.lastTotalLine, likelyEnd[1] - likelyEnd[2]] + let nbLikelyEnd = bLikelyEnd[0] * 10000 + bLikelyEnd[1] + if nbChangeEnd <= nbLikelyEnd + break + endif + let iLikelyEnd += 1 + endwhile + if iLikelyEnd == len(self.orderedMarks) + return [-1,-1] + endif + return [iLikelyStart,iLikelyEnd] +endfunction +fun! s:saveCurrentCursorStat() dict + if self.marks == {} + return + endif + let p = [ line( '.' ), col( '.' ) ] + exe 'k'.g:xpm_mark + if p[0] < line( '$' ) + exe '+1k' . g:xpm_mark_nextline + else + exe 'delmarks ' . g:xpm_mark_nextline + endif + let self.lastPositionAndLength = p + [ len( getline( "." ) ) ] + let self.lastMode = mode() +endfunction +fun! s:saveCurrentStat() dict + call self.saveCurrentCursorStat() + let self.lastChangenr = changenr() + let self.changenrRange[0] = min([self.lastChangenr,self.changenrRange[0]]) + let self.changenrRange[1] = max([self.lastChangenr,self.changenrRange[1]]) + let self.lastTotalLine = line( "$" ) +endfunction +fun! s:removeMark(name) dict + if !has_key(self.marks,a:name) + return + endif + if self.changeLikelyBetween.start == a:name || self.changeLikelyBetween.end == a:name + let self.changeLikelyBetween = { 'start' : '', 'end' : '' } + endif + call filter( self.orderedMarks, 'v:val != ' . string( a:name ) ) + call remove(self.marks,a:name) +endfunction +fun! s:addMarkOrder(name,beforeWhich) dict + let markToAdd = self.marks[a:name] + let nPos = markToAdd[0] * 10000 + markToAdd[1] + let i = -1 + for n in self.orderedMarks + let i += 1 + let mark = self.marks[n] + let nMark = mark[0] * 10000 + mark[1] + if nMark == nPos + if a:beforeWhich isnot 0 && n =~ a:beforeWhich + call insert(self.orderedMarks,a:name,i) + return + else + let cmp = self.compare(a:name,n) + if cmp == 0 + throw 'XPM : overlapped mark:' . a:name . '=' . string(markToAdd) . ' and ' . n . '=' . string( mark ) + elseif cmp > 0 + continue + else + call insert(self.orderedMarks,a:name,i) + return + endif + endif + elseif nPos < nMark + call insert(self.orderedMarks,a:name,i) + return + endif + endfor + call add (self.orderedMarks,a:name) +endfunction +fun! s:compare(a,b) dict + if exists( 'b:_xpm_compare' ) + return b:_xpm_compare(self,a:a,a:b) + else + return s:defaultCompare(self,a:a,a:b) + endif +endfunction +fun! s:ClassPrototype(...) + let p = {} + for name in a:000 + let p[ name ] = function( '' . s:sid . name ) + endfor + return p +endfunction +let s:prototype = s:ClassPrototype( 'ToChangeNr', 'addMarkOrder', 'compare', 'findLikelyRange', 'handleUndoRedo', 'initCurrentStat', 'insertModeUpdate', 'isUpdateNeeded', 'normalModeUpdate', 'removeMark', 'saveCurrentCursorStat', 'saveCurrentStat', 'snapshot', 'updateForLinewiseDeletion', 'updateMarks', 'updateMarksAfter', 'updateMarksAfterLine', 'updateMarksBefore', 'updateWithNewChangeRange', ) +fun! s:initBufData() + let nr = changenr() + let b:_xpmark = { 'updateStrategy':'auto', 'stat':{}, 'orderedMarks':[], 'marks':{}, 'markHistory':{}, 'changeLikelyBetween':{ 'start' : '', 'end' : '' }, 'lastMode':'n', 'lastPositionAndLength':[ line( '.' ), col( '.' ), len( getline( '.' ) ) ], 'lastTotalLine':line( '$' ), 'lastChangenr':nr, 'changenrRange':[nr, nr], } + let b:_xpmark.markHistory[ nr ] = { 'dict' : b:_xpmark.marks, 'list' : b:_xpmark.orderedMarks, 'likely' : b:_xpmark.changeLikelyBetween } + call extend( b:_xpmark, s:prototype, 'force' ) + exe 'k' . g:xpm_mark + if line( '.' ) < line( '$' ) + exe '+1k' . g:xpm_mark_nextline + else + exe 'delmarks ' . g:xpm_mark_nextline + endif +endfunction +fun! s:BufData() + if !exists('b:_xpmark') + call s:initBufData() + endif + return b:_xpmark +endfunction +fun! s:InitBuf() + if !exists('b:_xpmark') + call s:initBufData() + endif +endfunction +fun! s:defaultCompare(d,markA,markB) + let [ma,mb] = [a:d.marks[a:markA],a:d.marks[a:markB]] + let nMarkA = ma[0] * 10000 + ma[1] + let nMarkB = mb[0] * 10000 + mb[1] + return (nMarkA - nMarkB) != 0 ? (nMarkA - nMarkB) : (a:d.marks[a:markA][3] - a:d.marks[a:markB][3]) +endfunction +if &ruler && &rulerformat == "" + set rulerformat=%-14.(%l,%c%V%)%=%P +elseif !&ruler + set rulerformat= +endif +set ruler +let &rulerformat .= '%{XPMautoUpdate("ruler")}' +fun! PrintDebug() + let d = s:BufData() + let debugString = changenr() + let debugString .= ' p:' . string( getpos( "'" . g:xpm_mark )[ 1 : 2 ] ) + let debugString .= ' ' . string( [[ line( "'[" ), col( "'[" ) ], [ line( "']" ), col( "']" ) ]] ) . " " + let debugString .= " " . mode() . string( [line( "." ), col( "." )] ) . ' last:' .string( d.lastPositionAndLength ) + let debugString .= " ll:" . d.lastTotalLine + return substitute( debugString, '\s', '' , 'g' ) +endfunction +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xpopup.vim b/vim-plugins/bundle/xptemplate/plugin/xpopup.vim new file mode 100644 index 0000000..72ff30e --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xpopup.vim @@ -0,0 +1,637 @@ +if exists( "g:__XPOPUP_VIM__" ) && g:__XPOPUP_VIM__ >= XPT#ver + finish +endif +let g:__XPOPUP_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +runtime plugin/debug.vim +exe XPT#let_sid +let s:log = CreateLogger( 'warn' ) +let s:log = CreateLogger( 'debug' ) +fun! s:SetIfNotExist(k,v) + if !exists(a:k) + exe "let ".a:k."=".string(a:v) + endif +endfunction +let s:opt = { 'doCallback':'doCallback', 'enlarge':'enlarge', 'acceptEmpty':'acceptEmpty', 'tabNav':'tabNav', } +let s:CHECK_PUM = 1 +let s:errorTolerance = 3 +let s:sessionPrototype = { 'callback':{}, 'list':[], 'key':'', 'prefixIndex':{}, 'popupCount':0, 'sessCount':0, 'errorInputCount':0, 'line':0, 'col':0, 'prefix':'', 'ignoreCase':0, 'acceptEmpty':0, 'matchWholeName':0, 'matchPrefix':0, 'strictInput':0, 'tabNav':0, 'last':'', 'currentText':'', 'longest':'', 'matched':'', 'matchedCallback':'', 'currentList':[], } +fun! XPPopupNew(callback,data,...) + let sess = deepcopy(s:sessionPrototype) + let sess.callback = a:callback + let sess.data = a:data + call sess.createPrefixIndex([]) + if a:0 > 0 + let items = a:1 + if type( items ) == type( '' ) + call sess.SetTriggerKey(items) + elseif type(items) == type([]) + call sess.addList(items) + else + call s:log.Error( 'unsupported items type as pum items:' . str( items ) ) + endif + endif + return sess +endfunction +fun! s:popup(start_col,opt) dict + let doCallback = get(a:opt,s:opt.doCallback,1) + let ifEnlarge = get(a:opt,s:opt.enlarge,1) + let self.popupCount += 1 + let cursorIndex = col(".") - 1 - 1 + let self.line = line(".") + let self.col = a:start_col + let self.prefix = s:GetTextBeforeCursor(self) + let self.ignoreCase = self.prefix !~# '\u' + if self.key != '' + let self.longest = self.prefix + let actions = self.KeyPopup(doCallback,ifEnlarge) + else + let self.currentList = s:filterCompleteList(self) + if ifEnlarge + let self.longest = s:LongestPrefix(self) + else + let self.longest = self.prefix + endif + let actions = self.ListPopup(doCallback,ifEnlarge) + endif + let actions = s:CreateSession(self) . actions + call s:ApplyMapAndSetting() + return actions +endfunction +fun PUMclear() + return "\\\" +endfunction +fun! s:CreateSession(sess) + if !exists( 'b:__xpp_sess_count' ) + let b:__xpp_sess_count = 0 + endif + let action = '' + let b:__xpp_sess_count += 1 + let a:sess.sessCount = b:__xpp_sess_count + if exists( 'b:__xpp_current_session' ) + call s:End() + if pumvisible() + let action .= PUMclear() + endif + endif + let b:__xpp_current_session = a:sess + return action +endfunction +fun! s:SetAcceptEmpty(acc) dict + let self.acceptEmpty = !!a:acc + return self +endfunction +fun! s:SetMatchWholeName(mwn) dict + let self.matchWholeName = !!a:mwn + return self +endfunction +fun! s:SetOption(opt) dict + if type(a:opt) == type([]) + for optname in a:opt + let self[optname] = 1 + endfor + elseif type(a:opt) == type({}) + for [key,value] in items(a:opt) + let self[key] = value + endfor + endif +endfunction +fun! s:KeyPopup(doCallback,ifEnlarge) dict + let actionList = [] + if a:ifEnlarge + let actionList = [ 'clearPum', 'clearPrefix', 'typeLongest', 'triggerKey', 'setLongest' ] + if a:doCallback + let actionList += [ 'checkAndCallback' ] + endif + else + let actionList = [ 'clearPum', 'clearPrefix', 'typeLongest', 'triggerKey', 'removeTrailing', 'forcePumShow' ] + endif + return "\=XPPprocess(" . string( actionList ) . ")\" +endfunction +fun! s:ListPopup(doCallback,ifEnlarge) dict + let actionClosePum = '' + let actionList = [] + if self.longest !=# self.prefix + let actionList += ['clearPum', 'clearPrefix', 'clearPum', 'typeLongest' ] + endif + if 0 + else + if self.popupCount > 1 && a:ifEnlarge && self.acceptEmpty && self.prefix == '' + let self.matched = '' + let self.matchedCallback = 'onOneMatch' + let actionList = [] + let actionList += [ 'clearPum', 'clearPrefix', 'clearPum', 'callback' ] + elseif len(self.currentList) == 0 + let self.matched = '' + let self.matchedCallback = 'onEmpty' + let actionList += ['callback'] + elseif len(self.currentList) == 1 && a:doCallback + if self.matchPrefix + let self.matched = type(self.currentList[0]) == type({}) ? self.currentList[0].word : self.currentList[0] + let self.matchedCallback = 'onOneMatch' + let actionList += ['clearPum', 'clearPrefix', 'clearPum', 'typeMatched', 'callback'] + else + let actionClosePum = PUMclear() + let actionList += [ 'popup', 'fixPopup' ] + endif + elseif self.prefix != "" && self.longest ==? self.prefix + if self.matchPrefix && a:doCallback + let self.matched = '' + for item in self.currentList + let key = type(item) == type({}) ? item.word : item + if key ==? self.prefix + let self.matched = key + let self.matchedCallback = 'onOneMatch' + let actionList += ['clearPum', 'clearPrefix', 'clearPum', 'typeLongest', 'callback'] + break + endif + endfor + if self.matched == '' + let actionClosePum = PUMclear() + let actionList += [ 'popup', 'fixPopup' ] + endif + else + let actionClosePum = PUMclear() + let actionList += [ 'popup', 'fixPopup' ] + endif + else + let actionClosePum = PUMclear() + let actionList += [ 'popup', 'fixPopup' ] + endif + endif + let self.matchPrefix = 1 + return actionClosePum . "\=XPPprocess(" . string( actionList ) . ")\" +endfunction +fun! s:SetTriggerKey(key) dict + let self.key = a:key +endfunction +fun! s:sessionPrototype.addList(list) + let list = a:list + if list == [] + return + endif + if type( list[0] ) == type( '' ) + call map( list, '{"word" : v:val, "icase" : 1 }' ) + else + call map( list, '{"word" : v:val["word"],' . '"info": get(v:val, "info", ""),' . '"menu": get(v:val, "menu", ""),' . '"icase": 1 }' ) + endif + let self.list += list + call self.updatePrefixIndex(list) +endfunction +fun! s:sessionPrototype.createPrefixIndex(list) + let self.prefixIndex = { 'keys' : {}, 'lowerkeys' : {}, 'ori' : {}, 'lower' : {} } + call self.updatePrefixIndex(a:list) +endfunction +fun! s:sessionPrototype.updatePrefixIndex(list) + if g:xptemplate_pum_quick_back == 0 + return + endif + for item in a:list + let key = (type(item) == type({})) ?item.word : item + if !has_key(self.prefixIndex.keys,key) + let self.prefixIndex.keys[key] = 1 + call s:UpdateIndex(self.prefixIndex.ori,key) + endif + let lowerKey = substitute(key, '.', '\l&', 'g') + if !has_key(self.prefixIndex.lowerkeys,lowerKey) + let self.prefixIndex.lowerkeys[lowerKey] = 1 + call s:UpdateIndex(self.prefixIndex.lower,lowerKey) + endif + endfor +endfunction +fun! s:_InitBuffer() + if exists( 'b:__xpp_buffer_init' ) + return + endif + let b:_xpp_map_saver = xpt#msvr#New(1) + call xpt#msvr#AddList(b:_xpp_map_saver, 'i_', 'i_', 'i_', 'i_', 'i_', 'i_', 'i_', 'i_', ) + let b:_xpp_setting_switch = xpt#settingswitch#New() + let co = {"menu":1, "menuone":1, "longest":1} + for k in split(&completeopt, ',') + let co[k] = 1 + endfor + let new_completeopt = join( keys(co), ',' ) + call xpt#settingswitch#AddList(b:_xpp_setting_switch, [ '&l:cinkeys', '' ], [ '&l:indentkeys', '' ], [ '&completeopt', new_completeopt ], ) + let b:__xpp_buffer_init = 1 +endfunction +fun! XPPprocess(list) + if !exists("b:__xpp_current_session") + call s:log.Error("session does not exist!") + return "" + endif + let sess = b:__xpp_current_session + if len(a:list) == 0 + return "\\" + endif + let actionName = a:list[0] + let nextList = a:list[1 :] + let postAction = "" + if actionName == 'clearPrefix' + let n = col(".") - sess.col + let postAction = repeat( "\", n ) + elseif actionName == 'clearPum' + if pumvisible() + let postAction = "\" + endif + elseif actionName == 'triggerKey' + let postAction = sess.key + elseif actionName == 'setLongest' + let current = s:GetTextBeforeCursor(sess) + if len(current) > len(sess.longest) + let postAction = repeat( "\", len( current ) - len( sess.longest ) ) . current[len(sess.longest) :] + let sess.longest = s:GetTextBeforeCursor(sess) + if pumvisible() + let nextList = [ 'clearPum', 'clearPrefix', 'typeLongest', 'triggerKey' ] + nextList + else + let nextList = [ 'clearPrefix', 'clearPum', 'typeLongest' ] + nextList + endif + endif + elseif actionName == 'removeTrailing' + let current = s:GetTextBeforeCursor(sess) + if len(current) > len(sess.longest) + let postAction = repeat( "\", len( current ) - len( sess.longest ) ) + endif + elseif actionName == 'forcePumShow' + let postAction = "\\" + elseif actionName == 'checkAndCallback' + if pumvisible() + return "\\" + else + let current = s:GetTextBeforeCursor(sess) + let sess.matched = current + let sess.matchedCallback = 'onOneMatch' + call s:End() + let postAction = "" + if has_key(sess.callback,sess.matchedCallback) + let postAction = sess.callback[sess.matchedCallback](sess) + return postAction + else + return '' + endif + endif + elseif actionName == 'keymodeEnlarge' + let current = s:GetTextBeforeCursor(sess) + if sess.acceptEmpty && current == '' + let sess.longest = '' + let sess.matched = '' + let sess.matchedCallback = 'onOneMatch' + let nextList = [ 'callback' ] + elseif current !=# sess.currentText + let sess.longest = sess.currentText + let sess.matched = sess.currentText + let sess.matchedCallback = 'onOneMatch' + let nextList = [ 'clearPrefix', 'typeLongest', 'callback' ] + else + return sess.popup(sess.col, { 'doCallback' : 1, 'enlarge':1 } ) + endif + elseif actionName == 'enlarge' + let current = s:GetTextBeforeCursor(sess) + if current !=# sess.currentText + let sess.longest = sess.currentText + let sess.matched = sess.currentText + let sess.matchedCallback = 'onOneMatch' + let nextList = [ 'clearPrefix', 'typeLongest', 'callback' ] + else + return sess.popup(sess.col, { 'doCallback' : 1, 'enlarge':1 } ) + endif + elseif actionName == 'typeMatched' + let postAction = sess.matched + elseif actionName == 'typeLongest' + let postAction = sess.longest + elseif actionName == 'type' + let postAction = remove(nextList,0) + elseif actionName == 'popup' + call complete(sess.col,sess.currentList) + elseif actionName == 'fixPopup' + let current = s:GetTextBeforeCursor(sess) + let i = 0 + let j = -1 + for v in sess.currentList + let key = type(v) == type({}) ? v.word : v + if key ==# current + let j = i + break + endif + let i += 1 + endfor + if j != -1 + let postAction .= repeat( "\", j + 1 ) + endif + elseif actionName == 'callback' + call s:End() + let postAction = "" + if has_key(sess.callback,sess.matchedCallback) + let postAction = sess.callback[sess.matchedCallback](sess) + return postAction + endif + elseif actionName == 'end' + call s:End() + let postAction = '' + else + endif + if !empty(nextList) + let postAction .= "\=XPPprocess(" . string( nextList ) . ")\" + else + let postAction .= g:xpt_post_action + endif + return postAction +endfunction +fun! s:GetTextBeforeCursor(sess) + let c = col( "." ) + if c == 1 + return '' + endif + return getline(".")[ a:sess.col - 1 : c - 2 ] +endfunction +fun! XPPcomplete(col,list) + let oldcfu = &completefunc + set completefunc=XPPcompleteFunc + return "\\" +endfunction +fun! XPPcr() + if !s:PopupCheck(s:CHECK_PUM) + call feedkeys("\", 'mt') + return "" + endif + return "\=XPPaccept()\" +endfunction +fun! XPPup(key) + if !s:PopupCheck(s:CHECK_PUM) + call feedkeys( a:key, 'mt' ) + return "" + endif + return "\" +endfunction +fun! XPPdown(key) + if !s:PopupCheck(s:CHECK_PUM) + call feedkeys( a:key, 'mt' ) + return "" + endif + return "\" +endfunction +fun! XPPcallback() + if !exists("b:__xpp_current_session") + return "" + endif + let sess = b:__xpp_current_session + call s:End() + if has_key(sess.callback,sess.matchedCallback) + let post = sess.callback[sess.matchedCallback](sess) + else + let post = "" + endif + return post +endfunction +fun! XPPshorten() + if !s:PopupCheck(! s:CHECK_PUM) + let s:pos = getpos(".")[ 1 : 2 ] + return "\\=XPPcorrectPos()\\" + endif + if !pumvisible() + return "\" + endif + let sess = b:__xpp_current_session + let current = s:GetTextBeforeCursor(sess) + if sess.key != '' + return "\" + endif + if current == '' + call s:End() + return "\" + endif + let actions = "\" + let actions = "" + if g:xptemplate_pum_quick_back == 1 + let prefixMap = (sess.ignoreCase) ? sess.prefixIndex.lower : sess.prefixIndex.ori + let shorterKey = s:FindShorter(prefixMap, ( sess.ignoreCase ? substitute(current, '.', '\l&', 'g') : current )) + else + let shorterKey = current[0 : -2] + endif + let action = actions . repeat( "\", len(current) - len(shorterKey) ) . "\=XPPrepopup(0, 'noenlarge')\" + return action +endfunction +fun! XPPenlarge(key) + if !s:PopupCheck(s:CHECK_PUM) + call feedkeys( a:key, 'm' ) + return "" + endif + return "\=XPPrepopup(1, 'enlarge')\" +endfunction +fun! XPPcancel(key) + if !s:PopupCheck() + call feedkeys( a:key, 'mt' ) + return "" + endif + return "\=XPPprocess(" . string( [ 'clearPum', 'clearPrefix', 'typeLongest', 'end' ] ) . ")\" +endfunction +fun! XPPaccept() + if !s:PopupCheck() + call feedkeys("\", 'mt') + return "" + endif + let sess = b:__xpp_current_session + let beforeCursor = col( "." ) - 2 + let beforeCursor = beforeCursor == -1 ? 0 : beforeCursor + let toType = getline(sess.line)[sess.col - 1 : beforeCursor] + return "\=XPPprocess(" . string( [ 'clearPum', 'clearPrefix', 'type', toType, 'end' ] ) . ")\" +endfunction +fun! XPPrepopup(doCallback,ifEnlarge) + if !exists("b:__xpp_current_session") + return "" + endif + let sess = b:__xpp_current_session + if sess.key != '' + let sess.currentText = s:GetTextBeforeCursor(sess) + let action = "\" . "\=XPPprocess(" . string( [ 'keymodeEnlarge' ] ) . ")\" + return action + else + let action = sess.popup(sess.col, { 'doCallback' : a:doCallback, 'enlarge':a:ifEnlarge == 'enlarge' } ) + return action + endif +endfunction +fun! XPPcorrectPos() + let p = getpos(".")[1:2] + if p != s:pos + unlet s:pos + return "\" + else + unlet s:pos + return "" + endif +endfunction +fun! s:ApplyMapAndSetting() + call s:_InitBuffer() + if exists( 'b:__xpp_pushed' ) + return + endif + let b:__xpp_pushed = 1 + call xpt#msvr#Save(b:_xpp_map_saver) + let sess = b:__xpp_current_session + exe 'inoremap ' '=XPPup("\UP>")' + exe 'inoremap ' '=XPPdown("\DOWN>")' + exe 'inoremap ' '=XPPshorten()' + exe 'inoremap ' '=XPPcancel("\C-e>")' + if sess.tabNav + exe 'inoremap ' '=XPPup("\S-Tab>")' + exe 'inoremap ' '=XPPdown("\TAB>")' + exe 'inoremap ' '=XPPenlarge("\CR>")' + exe 'inoremap ' '=XPPenlarge("\C-y>")' + else + exe 'inoremap ' '=XPPenlarge("\TAB>")' + exe 'inoremap ' '=XPPenlarge("\CR>")' + exe 'inoremap ' '=XPPenlarge("\C-y>")' + endif + augroup XPpopup + au! + au CursorMovedI * call s:CheckAndFinish() + au InsertEnter * call XPPend() + augroup END + call xpt#settingswitch#Switch(b:_xpp_setting_switch) + if exists( ':AcpLock' ) + AcpLock + endif +endfunction +fun! s:ClearMapAndSetting() + call s:_InitBuffer() + if !exists( 'b:__xpp_pushed' ) + return + endif + unlet b:__xpp_pushed + augroup XPpopup + au! + augroup END + call xpt#msvr#Restore(b:_xpp_map_saver) + call xpt#settingswitch#Restore(b:_xpp_setting_switch) + if exists( ':AcpUnlock' ) + try + AcpUnlock + catch /.*/ + endtry + endif +endfunction +fun! s:CheckAndFinish() + if !exists( 'b:__xpp_current_session' ) + call s:End() + return '' + endif + let sess = b:__xpp_current_session + if !pumvisible() + if line( "." ) == sess.line + if sess.strictInput + if col(".") > sess.col + call feedkeys( "\", 'n' ) + endif + else + return s:MistakeTypeEnd() + endif + else + return s:MistakeTypeEnd() + endif + endif + return '' +endfunction +fun! s:MistakeTypeEnd() + call s:End() + return PUMclear() +endfunction +fun! XPPhasSession() + return exists("b:__xpp_current_session") +endfunction +fun! XPPend() + call s:End() + if pumvisible() + return PUMclear() + endif + return '' +endfunction +fun! s:End() + call s:ClearMapAndSetting() + if exists("b:__xpp_current_session") + unlet b:__xpp_current_session + endif +endfunction +fun! s:PopupCheck(...) + let checkPum = (a:0 == 0 || a:1) + if !exists("b:__xpp_current_session") + call s:End() + return 0 + endif + let sess = b:__xpp_current_session + if sess.line != line(".") || col(".") < sess.col || (checkPum && !pumvisible()) + call s:End() + return 0 + endif + return 1 +endfunction +fun! s:UpdateIndex(map,key) + let [i,len] = [0,len(a:key)] + while i < len + let prefix = a:key[0 : i - 1] + if !has_key(a:map,prefix) + let a:map[prefix] = 1 + else + let a:map[prefix] += 1 + endif + let i += 1 + endwhile +endfunction +fun! s:LongestPrefix(sess) + let longest = ".*" + for e in a:sess.currentList + let key = (type(e) == type({})) ? e.word : e + if longest == ".*" + let longest = a:sess.ignoreCase ? substitute(key, '.', '\l&', 'g') : key + else + while key !~ '^\V' . ( a:sess.ignoreCase ? '\c' : '\C' ) . escape(longest, '\') && len(longest) > 0 + let longest = longest[ : -2 ] " remove one char + endwhile + endif + endfor + let longest = ( longest == '.*' ) ? '' : longest + if a:sess.prefix !=# longest[: len(a:sess.prefix) - 1] + let longest = a:sess.prefix . longest[len(a:sess.prefix) :] + endif + return longest +endfunction +fun! s:filterCompleteList(sess) + let list = [] + let caseOption = a:sess.ignoreCase ? '\c' : '\C' + if a:sess.matchWholeName + let pattern = '\V\^' . caseOption . a:sess.prefix . '\$' + else + let pattern = '\V\^' . caseOption . a:sess.prefix + endif + for item in a:sess.list + let key = (type(item) == type({})) ? item.word : item + if key =~ pattern + let list += [item] + endif + endfor + return list +endfunction +fun! s:FindShorter(map,key) + let key = a:key + if len(key) == 1 + return '' + endif + let nmatch = has_key(a:map,key) ? a:map[key] : 1 + if !has_key(a:map,key[: -2]) + return key[: -2] + endif + let key = key[: -2] + while key != '' && a:map[key] == nmatch + let key = key[: -2] + endwhile + return key +endfunction +fun! s:ClassPrototype(...) + let p = {} + for name in a:000 + let p[ name ] = function( '' . s:sid . name ) + endfor + return p +endfunction +let s:sessionPrototype2 = s:ClassPrototype( 'popup', 'SetAcceptEmpty', 'SetMatchWholeName', 'SetTriggerKey', 'SetOption', 'KeyPopup', 'ListPopup', ) +call extend( s:sessionPrototype, s:sessionPrototype2, 'force' ) +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xpreplace.vim b/vim-plugins/bundle/xptemplate/plugin/xpreplace.vim new file mode 100644 index 0000000..b1bb03b --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xpreplace.vim @@ -0,0 +1,197 @@ +if exists( "g:__XPREPLACE_VIM__" ) && g:__XPREPLACE_VIM__ >= XPT#ver + finish +endif +let g:__XPREPLACE_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +runtime plugin/debug.vim +runtime plugin/xpmark.vim +let s:log = CreateLogger( 'warn' ) +let s:log = CreateLogger( 'debug' ) +fun! s:InitBuffer() + if exists( 'b:__xpr_init' ) + return + endif + let b:__xpr_init = { 'settingSwitch' : xpt#settingswitch#New() } + call xpt#settingswitch#AddList(b:__xpr_init.settingSwitch, [ '&l:textwidth', '0' ], [ '&l:virtualedit', 'onemore' ], [ '&l:whichwrap' , 'b,s,h,l,<,>,~,[,]' ], [ '&l:selection' , 'exclusive' ], [ '&l:selectmode' , '' ], ) +endfunction +fun! XPRstartSession() + call s:InitBuffer() + if exists( 'b:_xpr_session' ) + throw "xpreplace session already pushed" + return + endif + let b:_xpr_session = {} + call xpt#settingswitch#Switch(b:__xpr_init.settingSwitch) + let b:_xpr_session.savedReg = @" + let @" = 'XPreplaceInited' +endfunction +fun! XPRendSession() + if !exists( 'b:_xpr_session' ) + throw "no setting pushed" + return + endif + let @" = b:_xpr_session.savedReg + call xpt#settingswitch#Restore(b:__xpr_init.settingSwitch) + unlet b:_xpr_session +endfunction +fun! XPreplaceByMarkInternal(startMark,endMark,replacement) + let [start,end] = [XPMpos(a:startMark),XPMpos(a:endMark)] + if start == [0,0] || end == [0,0] + throw 'XPM:' . ' ' . a:startMark . ' or ' . a:endMark . 'is invalid' + endif + let pos = XPreplaceInternal( start, end, a:replacement, { 'doJobs' : 0 } ) + call XPMupdateWithMarkRangeChanging(a:startMark,a:endMark,start,pos) + return pos +endfunction +fun! XPreplaceInternal(start,end,replacement,...) + let option = { 'doJobs' : 1, 'saveHoriScroll' : 0 } + if a:0 == 1 + call extend( option, a:1, 'force' ) + endif + let replacement = a:replacement + let repLines = split( a:replacement, '\n', 1 ) + if option.doJobs + call s:doPreJob(a:start,a:end,replacement) + endif + if 0 + let [curNrLines,finalNrLines] = [a:end[0] - a:start[0] + 1,len(repLines)] + let [ s, e ] = [ 1, col( [ a:end[ 0 ], '$' ] ) ] + let repLines[0] = XPT#TextInLine(a:start[0],s,a:start[1]) . repLines[0] + let repLines[-1] .= XPT#TextInLine(a:end[0],a:end[1],e) + let positionAfterReplacement = [a:end[0] + (finalNrLines - curNrLines),a:end[1] - len(getline(a:end[0]))] + if curNrLines > finalNrLines + call cursor(a:start) + if curNrLines > finalNrLines + 1 + exe 'silent!' 'normal!' 'zOd' ( finalNrLines - curNrLines - 1 ) 'j' + else + silent! normal! zOdd + endif + elseif curNrLines < finalNrLines + call append( a:start[ 0 ], repeat( [ '' ], finalNrLines - curNrLines ) ) + endif + call setline(a:start[0],repLines) + let positionAfterReplacement[1] += len(getline(positionAfterReplacement[0])) + call cursor(positionAfterReplacement) + silent! normal! zO + else + call cursor(a:start) + silent! normal! zO + call cursor(a:start) + if a:start != a:end + silent! normal! v + call cursor(a:end) + silent! normal! dzO + call cursor(a:start) + endif + if replacement != '' + let positionAfterReplacement = s:Replace_standard(a:start,a:end,replacement) + else + let positionAfterReplacement = [ line("."), col(".") ] + endif + endif + if option.doJobs + call s:doPostJob(a:start,positionAfterReplacement,replacement) + endif + return positionAfterReplacement +endfunction +fun! s:Replace_standard(start,end,replacement) + let replacement = a:replacement + let bStart = [a:start[0] - line( '$' ), a:start[1] - len(getline(a:start[0]))] + call cursor(a:start) + let ifPasteAtEnd = ( col( [ a:start[0], '$' ] ) == a:start[1] && a:start[1] > 1 ) + let @" = replacement . ';' + if ifPasteAtEnd + call cursor(a:start[0],a:start[1] - 1) + let char = matchstr( getline( '.' ), '\v.$' ) + let @" = char . replacement . ';' + silent! normal! ""P + else + if col( "." ) == len( getline( line( "." ) ) ) + 1 + silent! normal! ""p + else + silent! normal! ""P + endif + endif + let positionAfterReplacement = [ bStart[0] + line( '$' ), 0 ] + let positionAfterReplacement[1] = bStart[1] + len(getline(positionAfterReplacement[0])) + call cursor(a:start) + k' + call cursor(positionAfterReplacement) + silent! '',.foldopen! + if ifPasteAtEnd + call cursor(positionAfterReplacement[0],positionAfterReplacement[1] - 1 - len(char)) + silent! normal! DzO + else + call cursor(positionAfterReplacement) + if positionAfterReplacement[1] == len(getline(positionAfterReplacement[0])) + 1 && positionAfterReplacement[1] > 1 + call cursor(positionAfterReplacement[0],positionAfterReplacement[1] - 1) + silent! normal! xzO + else + silent! normal! XzO + endif + endif + let positionAfterReplacement = [ bStart[0] + line( '$' ), 0 ] + let positionAfterReplacement[1] = bStart[1] + len(getline(positionAfterReplacement[0])) + return positionAfterReplacement +endfunction +fun! s:Replace_gp(start,end,replacement) + let replacement = a:replacement + let bStart = [a:start[0] - line( '$' ), a:start[1] - len(getline(a:start[0]))] + call cursor(a:start) + let ifPasteAtEnd = ( col( [ a:start[0], '$' ] ) == a:start[1] && a:start[1] > 1 ) + let @" = replacement . ';' + call cursor(a:start) + silent! normal! ""gPzOXzO + let positionAfterReplacement = [ line( "." ), col( "." ) ] + return positionAfterReplacement +endfunction +fun! XPreplace(start,end,replacement,...) + let option = { 'doJobs' : 1 } + if a:0 == 1 + call extend(option, a:1, 'force') + endif + call XPRstartSession() + let positionAfterReplacement = a:end + try + let positionAfterReplacement = XPreplaceInternal(a:start,a:end,a:replacement,option) + catch /.*/ + call XPT#warn(v:exception) + call XPT#warn(v:throwpoint) + finally + call XPRendSession() + endtry + return positionAfterReplacement +endfunction +let s:_xpreplace = { 'post' : {}, 'pre' : {} } +fun! XPRaddPreJob(functionName) + let s:_xpreplace.pre[a:functionName] = function(a:functionName) +endfunction +fun! XPRaddPostJob(functionName) + let s:_xpreplace.post[a:functionName] = function(a:functionName) +endfunction +fun! XPRremovePreJob(functionName) + let d = s:_xpreplace.pre + if has_key(d,a:functionName) + unlet d[a:functionName] + endif +endfunction +fun! XPRremovePostJob(functionName) + let d = s:_xpreplace.post + if has_key(d,a:functionName) + unlet d[a:functionName] + endif +endfunction +fun! s:doPreJob(start,end,replacement) + let d = { 'f' : '' } + for d.f in values(s:_xpreplace.pre) + call d.f(a:start,a:end) + endfor +endfunction +fun! s:doPostJob(start,end,replacement) + let d = { 'f' : '' } + for d.f in values(s:_xpreplace.post) + call d.f(a:start,a:end) + endfor +endfunction +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xpt.plugin.highlight.vim b/vim-plugins/bundle/xptemplate/plugin/xpt.plugin.highlight.vim new file mode 100644 index 0000000..164b673 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xpt.plugin.highlight.vim @@ -0,0 +1,136 @@ +if exists( "g:__XPT_PLUGIN_HIGHLIGHT_VIM__" ) && g:__XPT_PLUGIN_HIGHLIGHT_VIM__ >= XPT#ver + finish +endif +let g:__XPT_PLUGIN_HIGHLIGHT_VIM__ = XPT#ver +runtime plugin/xptemplate.vim +if '' == g:xptemplate_highlight + finish +endif +if !hlID( 'XPTcurrentPH' ) + hi def link XPTcurrentPH DiffChange +endif +if !hlID( 'XPTfollowingPH' ) + hi def link XPTfollowingPH CursorLine +endif +if !hlID( 'XPTnextItem' ) + hi def link XPTnextItem IncSearch +endif +fun! s:UpdateHL(x,ctx) + if !a:ctx.processing + return 1 + endif + call s:ClearHL(a:x,a:ctx) + if pumvisible() + return 1 + endif + if g:xptemplate_highlight =~ 'current' && a:ctx.phase == 'fillin' + let r = s:MarkRange(a:ctx.leadingPlaceHolder.mark) + call s:HL( 'XPTcurrentPH', r[2:] ) + endif + if g:xptemplate_highlight =~ 'following' && a:ctx.phase == 'fillin' + let r = '' + for ph in a:ctx.item.placeHolders + let r .= '\|' . s:MarkRange( ph.mark ) + endfor + call s:HL( 'XPTfollowingPH', r[2:] ) + endif + if g:xptemplate_highlight =~ 'next' + let r = s:PatternOfNext(a:ctx) + if g:xptemplate_highlight_nested + for octx in a:x.stack + let r .= s:PatternOfNext(octx) + endfor + endif + call s:HL( 'XPTnextItem', r[2:] ) + endif + return 1 +endfunction +fun! s:PatternOfNext(ctx) + let r = '' + for item in a:ctx.itemList + if item.keyPH != {} + let r .= '\|' . s:MarkRange( item.keyPH.innerMarks ) + else + let r .= '\|' . s:MarkRange( item.placeHolders[0].mark ) + endif + endfor + if a:ctx.itemList == [] || 'cursor' != item.name + let pos = XPMposList(a:ctx.marks.tmpl.end,a:ctx.marks.tmpl.end) + let r .= '\|' . XPTgetStaticRange( pos[0], [ pos[1][0], pos[1][1] + 1 ] ) + endif + return r +endfunction +fun! s:MarkRange(marks) + let pos = XPMposList(a:marks.start,a:marks.end) + if pos[0] == pos[1] + let pos[1][1] += 1 + endif + return XPTgetStaticRange(pos[0],pos[1]) +endfunction +fun! XPTgetStaticRange(p,q) + let posStart = a:p + let posEnd = a:q + if posStart[0] == posEnd[0] && posStart[1] + 1 == posEnd[1] + return '\%' . posStart[0] . 'l' . '\%' . posStart[1] . 'c' + endif + let r = '' + if posStart[0] == posEnd[0] + let r = r . '\%' . posStart[0] . 'l' + if posStart[1] > 1 + let r = r . '\%>' . (posStart[1]-1) .'c' + endif + let r = r . '\%<' . posEnd[1] . 'c' + else + if posStart[0] < posEnd[0] - 1 + let r = r . '\%>' . posStart[0] .'l' . '\%<' . posEnd[0] . 'l' + else + let r = r . '\%' . ( posStart[0] + 1 ) .'l' + endif + let r = r . '\|' . '\%(' . '\%' . posStart[0] . 'l\%>' . (posStart[1]-1) . 'c\)' . '\|' . '\%(' . '\%' . posEnd[0] . 'l\%<' . (posEnd[1]+0) . 'c\)' + endif + let r = '\%(' . r . '\)' + return '\V'.r +endfunction +if exists( '*matchadd' ) + fun! s:HLinit() + if !exists( 'b:__xptHLids' ) + let b:__xptHLids = [] + endif + endfunction + fun! s:ClearHL(x,ctx) + call s:HLinit() + for id in b:__xptHLids + try + call matchdelete(id) + catch /.*/ + endtry + endfor + let b:__xptHLids = [] + endfunction + fun! s:HL(grp,ptn) + call s:HLinit() + call add(b:__xptHLids,matchadd(a:grp,a:ptn,30)) + endfunction +else + let s:matchingCmd = { 'XPTcurrentPH':'3match', 'XPTfollowingPH':'match', 'XPTnextItem':'2match', } + fun! s:ClearHL(x,ctx) + for cmd in values(s:matchingCmd) + exe cmd 'none' + endfor + endfunction + fun! s:HL(grp,ptn) + let cmd = get( s:matchingCmd, a:grp, '' ) + if '' != cmd + exe cmd a:grp '/' . a:ptn . '/' + endif + endfunction +endif +exe XPT#let_sid +let s:FuncUpdate = function( '' . s:sid . "UpdateHL" ) +let s:FuncClear = function( '' . s:sid . "ClearHL" ) +call g:XPTaddPlugin("insertenter" , 'after' , s:FuncUpdate ) +call g:XPTaddPlugin("start" , 'after' , s:FuncUpdate ) +call g:XPTaddPlugin("update" , 'after' , s:FuncUpdate ) +call g:XPTaddPlugin("finishSnippet", 'after' , s:FuncUpdate ) +call g:XPTaddPlugin("ph_pum" , 'before', s:FuncClear ) +call g:XPTaddPlugin("finishAll" , 'after' , s:FuncClear ) diff --git a/vim-plugins/bundle/xptemplate/plugin/xptemplate.conf.vim b/vim-plugins/bundle/xptemplate/plugin/xptemplate.conf.vim new file mode 100644 index 0000000..7c163a8 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xptemplate.conf.vim @@ -0,0 +1,234 @@ +if exists( "g:__XPTEMPLATE_CONF_VIM__" ) && g:__XPTEMPLATE_CONF_VIM__ >= XPT#ver + finish +endif +let g:__XPTEMPLATE_CONF_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +exe XPT#importConst +let s:def = function( "XPT#default" ) +call s:def('g:xptemplate_key' , '' ) +call s:def('g:xptemplate_key_force_pum' , '' . g:xptemplate_key ) +call s:def('g:xptemplate_key_pum_only' , '' . g:xptemplate_key ) +call s:def('g:xptemplate_key_visual' , g:xptemplate_key ) +call s:def('g:xptemplate_nav_next' , '' ) +call s:def('g:xptemplate_nav_prev' , '' ) +call s:def('g:xptemplate_nav_cancel' , '' ) +call s:def('g:xptemplate_goback' , '' ) +call s:def('g:xptemplate_to_right' , '' ) +call s:def('g:xptemplate_key_2' , g:xptemplate_key ) +call s:def('g:xptemplate_nav_next_2' , g:xptemplate_nav_next ) +call s:def('g:xptemplate_fallback' , 'XPTrawKey' ) +call s:def('g:xptemplate_key_visual_2' , g:xptemplate_key_visual ) +call s:def('g:xptemplate_fallback_condition' , '\V\c' ) +call s:def('g:xptemplate_move_even_with_pum' , g:xptemplate_nav_next !=? '' ) +call s:def('g:xptemplate_close_pum' , 0 ) +call s:def('g:xptemplate_break_undo' , 0 ) +call s:def('g:xptemplate_always_show_pum' , 0 ) +call s:def('g:xptemplate_minimal_prefix' , 1 ) +call s:def('g:xptemplate_pum_tab_nav' , 0 ) +call s:def('g:xptemplate_pum_quick_back' , 1 ) +call s:def('g:xptemplate_strict' , 2 ) +call s:def('g:xptemplate_highlight' , 'next' ) +call s:def('g:xptemplate_highlight_nested' , 0 ) +call s:def('g:xptemplate_brace_complete' , 0 ) +call s:def('g:xptemplate_strip_left' , 1 ) +call s:def('g:xptemplate_ph_pum_accept_empty' , 1 ) +call s:def('g:xptemplate_hook_before_cr' , '' ) +call s:def('g:xptemplate_debug_log' , '' ) +call s:def('g:xptemplate_vars' , '' ) +call s:def('g:xptemplate_bundle' , '' ) +call s:def('g:xptemplate_snippet_folders' , [] ) +runtime! autoload/xpt/option/* +call s:def('g:xpt_post_action', '') +fun! s:ParseXPTVars() + let var_strings = split(g:xptemplate_vars . '&', '\V'.s:nonEscaped.'&\zs') + let vars = {} + for v in var_strings + let key = matchstr(v, '\V\^\[^=]\*\ze=') + if key == '' + continue + endif + if key !~ '^\$' + let key = '$'.key + endif + let val = matchstr(v, '\V\^\[^=]\*=\zs\.\*') + let escaped_val = xpt#util#UnescapeChar(val, '&') + let vars[key] = strpart(escaped_val,0,len(escaped_val)-1) + endfor + return vars +endfunction +if type( g:xptemplate_minimal_prefix ) == type( '' ) + if g:xptemplate_minimal_prefix =~ ',' + let [ outer, inner ] = split( g:xptemplate_minimal_prefix, ',' ) + if outer =~ '\d' + let g:xptemplate_minimal_prefix = outer + 0 + else + let g:xptemplate_minimal_prefix = outer + endif + if inner =~ '\d' + let g:xptemplate_minimal_prefix_nested = inner + 0 + else + let g:xptemplate_minimal_prefix_nested = inner + endif + endif +endif +call s:def( 'g:xptemplate_minimal_prefix_nested', g:xptemplate_minimal_prefix ) +if g:xptemplate_fallback == '' + let g:xptemplate_fallback = '' +endif +if g:xptemplate_fallback == g:xptemplate_key || g:xptemplate_fallback == g:xptemplate_key_force_pum + let g:xptemplate_fallback = 'nore:' . g:xptemplate_fallback +endif +if g:xptemplate_brace_complete is 1 + let g:xptemplate_brace_complete = '([{"''' +endif +let s:path = expand( "" ) +let s:filename = 'xptemplate.conf.vim' +let s:path = substitute( s:path, '\', '/', 'g' ) +let s:path = matchstr( s:path, '\V\.\*\ze/plugin/' . s:filename ) +let &runtimepath .= ',' . s:path . '/personal' +for s:path in g:xptemplate_snippet_folders + let &runtimepath .= ',' . s:path +endfor +unlet s:path +unlet s:filename +let g:XPTmappings = { 'popup_old':"=XPTemplateStart(0,{'popupOnly':1})", 'trigger_old':"=XPTemplateStart(0)", 'popup':"=XPTemplateStart(0,{'k':'%s','popupOnly':1})", 'force_pum':"=XPTemplateStart(0,{'k':'%s','forcePum':1})", 'trigger':"=XPTemplateStart(0,{'k':'%s'})", 'wrapTrigger':"\"0s=XPTemplatePreWrap(@0)", 'incSelTrigger':"`>a=XPTemplateStart(0)", 'excSelTrigger':"`>i=XPTemplateStart(0)", 'selTrigger':(&selection == 'inclusive') ? "`>a=XPTemplateStart(0,{'k':'%s'})" : "`>i=XPTemplateStart(0,{'k':'%s'})", } +if g:xptemplate_break_undo + let g:XPTmappings.trigger = "u" . g:XPTmappings.trigger +endif +if g:xptemplate_close_pum + for k in split('popup,force_pum,trigger', ',') + let g:XPTmappings[k] = "" . g:XPTmappings[k] + endfor +end +if g:xptemplate_fallback =~ '\V\^nore:' + let g:xptemplate_fallback = g:xptemplate_fallback[5:] + exe "inoremap XPTfallback" g:xptemplate_fallback +else + exe "imap XPTfallback" g:xptemplate_fallback +endif +exe "inoremap XPTrawKey" g:xptemplate_key +fun! s:EscapeMap(s) + return substitute( a:s, '\V>', '++', 'g' ) +endfunction +exe "inoremap " g:xptemplate_key printf( g:XPTmappings.trigger , s:EscapeMap( g:xptemplate_key ) ) +exe "xnoremap " g:xptemplate_key_visual g:XPTmappings.wrapTrigger +exe "snoremap " g:xptemplate_key printf( g:XPTmappings.selTrigger , s:EscapeMap( g:xptemplate_key ) ) +exe "inoremap " g:xptemplate_key_pum_only printf( g:XPTmappings.popup , s:EscapeMap( g:xptemplate_key_pum_only ) ) +exe "inoremap " g:xptemplate_key_force_pum printf( g:XPTmappings.force_pum , s:EscapeMap( g:xptemplate_key_force_pum )) +if g:xptemplate_key_2 != g:xptemplate_key + exe "inoremap " g:xptemplate_key_2 g:XPTmappings.trigger + exe "snoremap " g:xptemplate_key_2 g:XPTmappings.selTrigger +endif +if g:xptemplate_key_visual_2 != g:xptemplate_key_visual + exe "xnoremap " g:xptemplate_key_visual_2 g:XPTmappings.wrapTrigger +endif +let g:XPTpvs = s:ParseXPTVars() +if type( g:xptemplate_bundle ) == type( '' ) + let s:bundle = split( g:xptemplate_bundle, ',' ) +else + let s:bundle = g:xptemplate_bundle +endif +let g:xptBundle = {} +for ftAndBundle in s:bundle + let [ ft; bundle_list ] = split( ftAndBundle, '_' ) + let bundle = join( bundle_list, '_' ) + if !has_key(g:xptBundle,ft) + let g:xptBundle[ft] = {} + endif + let g:xptBundle[ft][bundle] = 1 +endfor +fun! g:XPTaddBundle(ft,bundle) + call XPTemplateInit() + let g:xptBundle[a:ft] = get(g:xptBundle,a:ft,{}) + let g:xptBundle[a:ft][a:bundle] = 1 + call XPTembed( a:ft . '/' . a:bundle ) +endfunction +fun! g:XPTloadBundle(ft,bundle) + if !has_key(g:xptBundle,a:ft) + return 0 + elseif !has_key( g:xptBundle[ a:ft ], a:bundle ) && !has_key( g:xptBundle[ a:ft ], '*' ) + return 0 + else + return 1 + endif +endfunction +fun! XPTfiletypeInit() + if !exists( 'b:xptemplateData' ) + call XPTemplateInit() + endif + let x = b:xptemplateData + let fts = x.filetypes + for [ft,ftScope] in items(fts) + let f = ftScope.funcs + for [k,v] in items(g:XPTpvs) + let f[k] = v + endfor + if &l:commentstring != '' + let cms = split( &l:commentstring, '\V%s', 1 ) + if cms[1] == '' + let f[ '$CS' ] = get( f, '$CS', cms[0] ) + else + if !has_key( f, '$CL' ) && !has_key( f, '$CR' ) + let [ f[ '$CL' ], f[ '$CR' ] ] = cms + endif + endif + endif + endfor +endfunction +augroup XPTftInit + au! + au FileType * call XPTfiletypeInit() +augroup END +if stridx( g:xptemplate_brace_complete, '(' ) >= 0 + inoremap ( =XPTtgr('(',{'noliteral':1,'k':'('}) +endif +if stridx( g:xptemplate_brace_complete, '[' ) >= 0 + inoremap [ =XPTtgr('[',{'noliteral':1,'k':'['}) +endif +if stridx( g:xptemplate_brace_complete, '{' ) >= 0 + inoremap { =XPTtgr('{',{'noliteral':1,'k':'{'}) +endif +if stridx( g:xptemplate_brace_complete, '''' ) >= 0 + inoremap ' =XPTtgr('''',{'noliteral':1,'k':''''}) +endif +if stridx( g:xptemplate_brace_complete, '"' ) >= 0 + inoremap " =XPTtgr('"',{'noliteral':1,'k':'"'}) +endif +fun! XPTinfo() + if !exists( 'b:xptemplateData' ) + return 0 + endif + let x = b:xptemplateData + if !x.renderContext.processing + return 0 + endif + let st = x.stack + let st = st + [x.renderContext] + call map( st, '{"$snipname":v:val.snipObject.name, "$phname":v:val.item.name}' ) + return st +endfunction +fun! XPTinfoStr(...) + let data = XPTinfo() + if data is 0 + return '' + endif + let fmt = a:000 + if len(fmt) == 0 + let fmt = [ "$snipname.$phname", " > " ] + elseif len(fmt) == 1 + call add( fmt, " > " ) + else + let fmt = fmt[0 : 1] + endif + let rst = [] + for e in data + let elt = fmt[0] + for k in [ "$snipname", "$phname" ] + let elt = substitute( elt, '\V' . k, e[ k ], 'g' ) + endfor + call add(rst,elt) + endfor + return join(rst,fmt[1]) +endfunction +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xptemplate.parser.vim b/vim-plugins/bundle/xptemplate/plugin/xptemplate.parser.vim new file mode 100644 index 0000000..bc426ea --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xptemplate.parser.vim @@ -0,0 +1,22 @@ +if exists( "g:__XPTEMPLATE_PARSER_VIM__" ) && g:__XPTEMPLATE_PARSER_VIM__ >= XPT#ver + finish +endif +let g:__XPTEMPLATE_PARSER_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +runtime plugin/xptemplate.conf.vim +exec XPT#importConst +com! -nargs=* XPTemplate if xpt#parser#InitSnippetFile( expand( "" ), ) == 'finish' | finish | endif +com! -nargs=* XPTemplateDef call xpt#parser#LoadSnippetToParseList(expand("")) | finish +com! -nargs=* XPT call xpt#parser#LoadSnippetToParseList(expand("")) | finish +com! -nargs=* XPTvar call xpt#parser#SetVar() +com! -nargs=* XPTsnipSet call xpt#parser#SnipSet() +com! -nargs=+ XPTinclude call xpt#parser#Include() +com! -nargs=+ XPTembed call xpt#parser#Embed() +fun! XPTinclude(...) + call xpt#parser#Load(a:000,1) +endfunction +fun! XPTembed(...) + call xpt#parser#Load(a:000,0) +endfunction +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/plugin/xptemplate.vim b/vim-plugins/bundle/xptemplate/plugin/xptemplate.vim new file mode 100644 index 0000000..6b32940 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/plugin/xptemplate.vim @@ -0,0 +1,2286 @@ +" GetLatestVimScripts: 2611 1 :AutoInstall: xpt.tgz +" VERSION: 0.4.9.161024-8f2c6c5 +if exists( "g:__XPTEMPLATE_VIM__" ) && g:__XPTEMPLATE_VIM__ >= XPT#ver + finish +endif +let g:__XPTEMPLATE_VIM__ = XPT#ver +let s:oldcpo = &cpo +set cpo-=< cpo+=B +exe XPT#let_sid +runtime plugin/xptemplate.conf.vim +runtime plugin/xpreplace.vim +runtime plugin/xpmark.vim +runtime plugin/xpopup.vim +exec XPT#importConst +let s:log = xpt#debug#Logger( 'warn' ) +let s:log = xpt#debug#Logger( 'debug' ) +let s:close_pum = "\\\" +let s:renderPhase = xpt#rctx#phase +call XPRaddPreJob( 'XPMupdateCursorStat' ) +call XPRaddPostJob( 'XPMupdateSpecificChangedRange' ) +call XPMsetUpdateStrategy( 'normalMode' ) +fun! XPTmarkCompare(o,markToAdd,existedMark) + let renderContext = b:xptemplateData.renderContext + if renderContext.phase == 'rendering' + let [lm,rm] = [a:o.changeLikelyBetween.start,a:o.changeLikelyBetween.end] + if a:existedMark ==# rm + return -1 + endif + elseif renderContext.action == 'build' && has_key( renderContext, 'buildingMarkRange' ) && renderContext.buildingMarkRange.end == a:existedMark + return -1 + endif + return 1 +endfunction +let s:repetitionPattern = '\w\*...\w\*' +let s:expandablePattern = '\V\S\+...\$' +let s:nullDict = {} +let s:nullList = [] +let s:nonEscaped = '\%(' . '\%(\[^\\]\|\^\)' . '\%(\\\\\)\*' . '\)' . '\@<=' +let g:XPTemplateSettingPrototype = { 'hidden':0, 'variables':{}, 'preValues':{ 'cursor' : xpt#flt#New( 0, '$CURSOR_PH' ) }, 'defaultValues':{}, 'mappings':{}, 'ontypeFilters':{}, 'postFilters':{}, 'comeFirst':[], 'comeLast':[], } +fun! g:XPTapplyTemplateSettingDefaultValue(setting) + let s = a:setting + let s.postQuoter = get( s, 'postQuoter', { 'start' : '{{', 'end' : '}}' } ) + let s.preValues.cursor = get( s.preValues, 'cursor', '$CURSOR_PH' ) +endfunction +let g:XPT_RC = { 'ok':{}, 'canceled':{}, } +let s:buildingSeqNr = 0 +let s:anonymouseIndex = 0 +let s:pumCB = {} +fun! s:pumCB.onEmpty(sess) + if g:xptemplate_fallback ==? '' + call XPT#warn( "XPT: No snippet matches" ) + return '' + else + let x = b:xptemplateData + let x.fallbacks = [ [ "\XPTfallback", 'feed' ] ] + x.fallbacks + return XPT#fallback(x.fallbacks) + endif +endfunction +fun! s:pumCB.onOneMatch(sess) + if a:sess.matched == '' + call feedkeys( eval('"\' . g:xptemplate_key . '"' ), 'nt') + return '' + else + return s:DoStart(a:sess) + endif +endfunction +let s:ItemPumCB = {} +fun! s:ItemPumCB.onOneMatch(sess) + if 0 == s:XPTupdate() + return s:ShiftForward( '' ) + else + return "" + endif +endfunction +fun! s:FallbackKey() + call feedkeys( "\XPTfallback", 'mt' ) + return '' +endfunction +fun! XPTemplateKeyword(val) + let x = b:xptemplateData + let ftScope = x.filetypes[x.snipFileScope.filetype] + let ftkeyword = ftScope.ftkeyword + let val = substitute(a:val, '\w', '', 'g') + let val = string(val)[1 : -2] + let needEscape = '^\]-' + let ftkeyword.list += split( val, '\v\s*' ) + call sort(ftkeyword.list) + let ftkeyword.list = split( substitute( join( ftkeyword.list, '' ), '\v(.)\1+', '\1', 'g' ), '\v\s*' ) + let ftkeyword.regexp = '\[0-9A-Za-z_' . escape( join( ftkeyword.list, '' ), needEscape ) . ']' +endfunction +fun! XPTemplatePriority(...) + let x = b:xptemplateData + let p = get( a:000, 0, '' ) + if p == '' + let p = 'lang' + endif + let x.snipFileScope.priority = xpt#priority#Parse(p) +endfunction +fun! XPTemplateMark(sl,sr) + let b:xptemplateData.snipFileScope.ptn = xpt#snipfile#GenPattern({'l':a:sl, 'r':a:sr}) +endfunction +fun! XPTmark() + let renderContext = b:xptemplateData.renderContext + let xp = renderContext.snipObject.ptn + return [xp.l,xp.r] +endfunction +fun! g:XPTfuncs() + return g:GetSnipFileFtScope().funcs +endfunction +fun! XPTemplateAlias(name,toWhich,setting) + let name = a:name + let xptObj = b:xptemplateData + let xt = xptObj.filetypes[g:GetSnipFileFT()].allTemplates + let toSnip = get(xt,a:toWhich) + if toSnip is 0 + return + endif + let setting = deepcopy(toSnip.setting) + call xpt#util#DeepExtend(setting,a:setting) + let prio = xptObj.snipFileScope.priority + let existed = get( xt, a:name, { 'priority': xpt#priority#Get( 'lowest' ) } ) + if existed.priority < prio + return + endif + if has_key(xt,a:toWhich) + let xt[a:name] = { 'name':a:name, 'parsed':0, 'ftScope':toSnip.ftScope, 'snipText':toSnip.snipText, 'priority':prio, 'setting':setting, 'ptn':deepcopy(toSnip.ptn), } + call s:UpdateNamePrefixDict(toSnip.ftScope,a:name) + call s:ParseTemplateSetting(xt[a:name]) + if get( xt[ name ].setting, 'abbr', 0 ) + call s:Abbr(name) + endif + endif +endfunction +fun! g:GetSnipFileFT() + let x = b:xptemplateData + return x.snipFileScope.filetype +endfunction +fun! g:GetSnipFileFtScope() + let x = b:xptemplateData + return x.filetypes[x.snipFileScope.filetype] +endfunction +fun! s:GetTempSnipScope(x,ft) + if !has_key( a:x, '__tmp_snip_scope' ) + let sc = xpt#snipfile#New('') + let b:xptemplateData.snipFileScope = sc + let sc.priority = 0 + let a:x.__tmp_snip_scope = sc + endif + let a:x.__tmp_snip_scope.filetype = '' == a:ft ? 'unknown' : a:ft + return a:x.__tmp_snip_scope +endfunction +fun! XPTemplate(name,str_or_ctx,...) + let x = b:xptemplateData + if a:0 == 0 + let snip = a:str_or_ctx + let setting = {} + else + let snip = a:1 + let setting = a:str_or_ctx + endif + let ft = get( setting, 'filetype', &filetype ) + let ft = '' == ft ? 'unknown' : ft + call xpt#parser#loadSpecialFiletype(ft) + call xpt#snipfile#Push() + let x.snipFileScope = s:GetTempSnipScope(x,ft) + call XPTdefineSnippet(a:name,setting,snip) + call xpt#snipfile#Pop() +endfunction +fun! XPTdefineSnippet(name,setting,snip) + let name = a:name + let x = b:xptemplateData + let ftScope = x.filetypes[x.snipFileScope.filetype] + let templates = ftScope.allTemplates + let xp = x.snipFileScope.ptn + let templateSetting = deepcopy(g:XPTemplateSettingPrototype) + call extend( templateSetting, a:setting, 'force' ) + call g:XPTapplyTemplateSettingDefaultValue(templateSetting) + let prio = x.snipFileScope.priority + if has_key(templates,a:name) && templates[a:name].priority < prio + return + endif + call s:UpdateNamePrefixDict(ftScope,a:name) + if type(a:snip) == type([]) + let snip = join(a:snip, "\n") + else + let snip = a:snip + endif + let templates[a:name] = { 'name':a:name, 'parsed':0, 'ftScope':ftScope, 'snipText':snip, 'priority':prio, 'setting':templateSetting, 'ptn':deepcopy(b:xptemplateData.snipFileScope.ptn), } + call s:InitTemplateObject(x,templates[a:name]) + if get( templates[ name ].setting, 'abbr', 0 ) + call s:Abbr(name) + endif +endfunction +fun! s:UpdateNamePrefixDict(ftScope,name) + if !has_key( a:ftScope, 'namePrefix' ) + let a:ftScope.namePrefix = {} + endif + let [n,pre] = [a:name,a:ftScope.namePrefix] + while n != '' && !has_key( pre, n ) + let pre[n] = 1 + let n = n[: -2] + endwhile +endfunction +fun! s:Abbr(name) + let name = a:name + try + exe 'inoreabbr ' name '' . "\=XPTtgr(" . string( name ) . ",{'k':''})\" + catch /.*/ + let n = matchstr( name, '\v\w+$' ) + let pre = name[: -len(n) - 1] + let x.abbrPrefix[n] = get(x.abbrPrefix,n,{}) + let x.abbrPrefix[n][pre] = 1 + exe 'inoreabbr ' n printf( "\=XPTabbr(%s)\", string( n ) ) + endtry +endfunction +fun! s:InitTemplateObject(xptObj,tmplObj) + call s:ParseTemplateSetting(a:tmplObj) + call s:AddCursorToComeLast(a:tmplObj.setting) + call s:InitItemOrderList(a:tmplObj.setting) + if !has_key( a:tmplObj.setting.defaultValues, 'cursor' ) + let a:tmplObj.setting.defaultValues.cursor = xpt#flt#New( 0, 'Finish("")' ) + endif + if len(a:tmplObj.name) == 1 && 0 " diabled + else + let nonWordChar = substitute( a:tmplObj.name, '\w', '', 'g' ) + if nonWordChar != '' + if !(a:tmplObj.setting.wraponly || a:tmplObj.setting.hidden) + call XPTemplateKeyword(nonWordChar) + endif + endif + endif +endfunction +fun! s:ParseInclusion(tmplDict,tmplObject) + if type( a:tmplObject.snipText ) == type( function( 'tr' ) ) + return + endif + let xp = a:tmplObject.ptn + let phPattern = '\V' . xp.lft . 'Include:\(\.\{-}\)' . xp.rt + let linePattern = '\V' . '\n\(\s\*\)\.\{-}' . phPattern + call s:DoInclude( a:tmplDict, a:tmplObject, { 'ph' : phPattern, 'line' : linePattern }, 1 ) + let phPattern = '\V' . xp.lft . ':\(\.\{-}\):' . xp.rt + let linePattern = '\V' . '\n\(\s\*\)\.\{-}' . phPattern + call s:DoInclude( a:tmplDict, a:tmplObject, { 'ph' : phPattern, 'line' : linePattern }, 0 ) +endfunction +fun! s:DoInclude(tmplDict,tmplObject,pattern,keepCursor) + let snip = "\n" . a:tmplObject.snipText + let xp = a:tmplObject.ptn + let included = {a:tmplObject.name : 1} + let pos = 0 + while 1 + let pos = match(snip,a:pattern.line,pos) + if -1 == pos + break + endif + let [matching,indent,incName] = matchlist(snip,a:pattern.line,pos)[: 2] + let indent = matchstr( split( matching, '\n' )[ -1 ], '^\s*' ) + let [incName,params] = s:ParseInclusionStatement(a:tmplObject,incName) + if has_key(a:tmplDict,incName) + if has_key(included,incName) && included[incName] > 20 + throw "XPT : include too many snippet:" . incName . ' in ' . a:tmplObject.name + endif + let included[incName] = get(included,incName,0) + 1 + let ph = matchstr(matching,a:pattern.ph) + let incTmplObject = a:tmplDict[incName] + call s:ParseSnippet(incTmplObject,incTmplObject.ftScope) + call s:MergeSetting(a:tmplObject.setting,incTmplObject.setting) + let incSnip = s:ReplacePHInSubSnip(a:tmplObject,incTmplObject,params) + let incSnip = substitute( incSnip, '\n', '&' . indent, 'g' ) + if !a:keepCursor + let incSnip = substitute( incSnip, xp.lft . 'cursor' . xp.rt, xp.l . xp.r, 'g' ) + endif + let leftEnd = pos + len(matching) - len(ph) + let rightStart = pos + len(matching) + let left = snip[: leftEnd - 1] + let right = snip[rightStart :] + let snip = left . incSnip . right + else + throw "XPT : include inexistent snippet:" . incName . ' in ' . a:tmplObject.name + endif + endwhile + let a:tmplObject.snipText = snip[1:] +endfunction +fun! s:ReplacePHInSubSnip(snipObject,subSnipObject,params) + let xp = a:snipObject.ptn + let incSnip = a:subSnipObject.snipText + let incSnipPieces = split( incSnip, '\V' . xp.rt, 1 ) + for [k,v] in items(a:params) + let [i,len] = [0 - 1,len(incSnipPieces) - 1] + while i < len | let i += 1 + let piece = incSnipPieces[i] + if piece =~# '\V' . k + let parts = split( piece, '\V' . xp.lft, 1 ) + let iName = len(parts) == 4 ? 2 : len(parts) - 1 + if parts[iName] ==# k + let parts[iName] = v + endif + let incSnipPieces[i] = join(parts,xp.l) + endif + endwhile + endfor + let incSnip = join(incSnipPieces,xp.r) + return incSnip +endfunction +fun! s:ParseInclusionStatement(snipObject,st) + let xp = a:snipObject.ptn + let ptn = '\V\^\[^(]\{-}(' + let st = a:st + if st =~ ptn && st[ -1 : -1 ] == ')' + let name = matchstr(st,ptn)[: -2] + let paramStr = st[len(name) + 1 : -2] + let paramStr = xpt#util#UnescapeChar(paramStr,xp.l . xp.r) + let params = {} + try + let params = eval(paramStr) + catch /.*/ + XPT#warn( 'XPT: Invalid parameter: ' . string( paramStr ) . ' Error=' . v:exception ) + endtry + return [name,params] + else + return [st,{}] + endif +endfunction +fun! s:MergeSetting(toSettings,fromSettings) + let a:toSettings.comeFirst += a:fromSettings.comeFirst + let a:toSettings.comeLast = a:fromSettings.comeLast + a:toSettings.comeLast + call s:InitItemOrderList(a:toSettings) + call extend( a:toSettings.preValues, a:fromSettings.preValues, 'keep' ) + call extend( a:toSettings.defaultValues, a:fromSettings.defaultValues, 'keep' ) + call extend( a:toSettings.postFilters, a:fromSettings.postFilters, 'keep' ) + call extend( a:toSettings.variables, a:fromSettings.variables, 'keep' ) + for key in keys(a:fromSettings.mappings) + if !has_key(a:toSettings.mappings,key) + let a:toSettings.mappings[key] = { 'saver' : xpt#msvr#New(1), 'keys' : {} } + endif + for keystroke in keys(a:fromSettings.mappings[key].keys) + let a:toSettings.mappings[key].keys[keystroke] = a:fromSettings.mappings[key].keys[keystroke] + call xpt#msvr#Add( a:toSettings.mappings[ key ].saver, 'i', keystroke ) + endfor + endfor +endfunction +fun! s:ParseTemplateSetting(tmpl) + let x = b:xptemplateData + let setting = a:tmpl.setting + if type( get( setting, 'wraponly', 0 ) ) == type( '' ) + let setting.wrap = setting.wraponly + let setting.wraponly = 1 + endif + let setting.iswrap = has_key( setting, 'wrap' ) + let setting.wraponly = get( setting, 'wraponly', 0 ) + if has_key( setting, 'wrap' ) && setting.wrap is 1 + let setting.wrap = 'cursor' + endif + let x.renderContext.snipObject = a:tmpl + if has_key(setting, 'rawHint') + let hint = xpt#eval#Eval(setting.rawHint, [x.filetypes[x.snipFileScope.filetype].funcs, setting.variables, ]) + if type(hint) == type({}) + if get(hint, 'action', '') == 'pum' + let pum = get(hint, 'pum', []) + let setting.hint = join( pum[ : 3 ], ' ' ) . ' ..' + else + let setting.hint = get(hint, 'text', '') + endif + elseif type(hint) == type([]) + let setting.hint = join( hint[ : 3 ], ' ' ) . ' ..' + elseif type(hint) == type(1) + let setting.hint = string(hint) + elseif type(hint) == 2 + let setting.hint = string(hint) + else + let setting.hint = hint + endif + endif + call s:ParsePostQuoter(setting) +endfunction +fun! s:ParsePostQuoter(setting) + if !has_key( a:setting, 'postQuoter' ) || type(a:setting.postQuoter) == type({}) + return + endif + let quoters = split( a:setting.postQuoter, ',' ) + if len(quoters) < 2 + throw 'postQuoter must be separated with ","! :' . a:setting.postQuoter + endif + let a:setting.postQuoter = { 'start' : quoters[0], 'end' : quoters[1] } +endfunction +fun! s:AddCursorToComeLast(setting) + if match( a:setting.comeLast, 'cursor' ) < 0 + call add( a:setting.comeLast, 'cursor' ) + endif +endfunction +fun! s:InitItemOrderList(setting) + let a:setting.comeFirst = xpt#util#RemoveDuplicate(a:setting.comeFirst) + let a:setting.comeLast = xpt#util#RemoveDuplicate(a:setting.comeLast) +endfunction +fun! XPTreload() + try + call s:Crash() + catch /.*/ + endtry + try + unlet b:xptemplateData + catch /.*/ + endtry + e +endfunction +fun! XPTgetAllTemplates() + call s:GetContextFTObj() " force initializing + return copy(b:xptemplateData.filetypes[&filetype].allTemplates) +endfunction +fun! XPTemplatePreWrap(wrap) + let x = b:xptemplateData + let x.wrap = a:wrap + let x.wrap = substitute( x.wrap, '\V\n\$', '', '' ) + let x.wrap = xpt#indent#ToSpace(x.wrap) + if ( g:xptemplate_strip_left || x.wrap =~ '\n' ) && visualmode() ==# 'V' + let x.wrapStartPos = virtcol(".") + let indent = matchstr( x.wrap, '^\s*' ) + let indentNr = len(indent) + let x.wrap = x.wrap[indentNr :] + else + let x.wrapStartPos = col(".") + let indentNr = min( [ indent( line( "." ) ), virtcol('.') - 1 ] ) + endif + let maxIndent = indentNr + let x.wrap = substitute( x.wrap, '\V\n \{0,' . maxIndent . '\}', "\n", 'g' ) + let lines = split( x.wrap, '\V\\r\n\|\r\|\n', 1 ) + let maxlen = 0 + for l in lines + let maxlen = maxlen < len(l) ? len(l) : maxlen + endfor + let indentNr -= maxIndent + let x.wrap = { 'indent' : -indentNr, 'text':x.wrap, 'lines':lines, 'max':maxlen, 'curline':lines[ 0 ], } + let leftSpaces = s:ConcreteSpace() + if leftSpaces != '' + let x.wrapStartPos = len(leftSpaces) + 1 + endif + let leftSpaces = substitute( leftSpaces, ' ', ' ', 'g' ) + return leftSpaces . "\=XPTemplateDoWrap()\" +endfunction +fun! s:ConcreteSpace() + if getline( line( '.' ) ) =~ '^\s*$' + let pos = virtcol( '.' ) + normal! d0 + let leftSpaces = XPT#convertSpaceToTab( repeat( ' ', pos - 1 ) ) + else + let leftSpaces = '' + endif + return leftSpaces +endfunction +fun! XPTemplateDoWrap() + call XPTparseSnippets() + let x = b:xptemplateData + let ppr = s:Popup("", x.wrapStartPos, {}) + return ppr +endfunction +fun! XPTabbr(name) + let x = b:xptemplateData + let line = getline( "." ) + let pre = matchstr( line, '\v\S+$' ) + if pre == '' + return printf( "\=XPTtgr(%s, {'k':''})\", string( a:name ) ) + else + if has_key(x.abbrPrefix,a:name) + if has_key(x.abbrPrefix[a:name],pre) + return repeat( "\", len( pre ) ) . printf( "\=XPTtgr(%s, {'k':''})\", string( pre . a:name ) ) + else + return printf( "\=XPTtgr(%s, {'k':''})\", string( a:name ) ) + endif + else + return printf( "\=XPTtgr(%s, {'k':''})\", string( a:name ) ) + endif + endif +endfunction +fun! XPTtgr(snippetName,...) + let opt = a:0 == 1 ? a:1 : {} + if pumvisible() || XPPhasSession() + return XPPend() . "\=XPTtgr(" . string( a:snippetName ) . ', ' . string(opt) . ")\" + endif + if opt != {} + if get( opt, 'noliteral', 0 ) + let opt.nosyn = '\V\cstring\|comment' + elseif get( opt, 'literal', 0 ) + let opt.syn = '\V\cstring\|comment' + endif + if has_key( opt, 'nopum' ) + let opt.pum = !opt.nopum + endif + let syn = synIDattr( synID( line("."), col("."), 0 ), "name" ) + if has_key( opt, 'nosyn' ) && syn =~ opt.nosyn || has_key( opt, 'syn' ) && syn !~ opt.syn + return opt.k + endif + if has_key( opt, 'pum' ) + if opt.pum && !pumvisible() || !opt.pum && pumvisible() + return opt.k + endif + endif + endif + let action = XPTemplateStart( 0, { 'startPos' : [ line( "." ), col( "." ) ], 'tmplName' : a:snippetName } ) + return action +endfunction +fun! XPTemplateTrigger(snippetName,...) + let opt = a:0 == 1 ? a:1 : {} + return XPTtgr(a:snippetName,opt) +endfunction +fun! XPTparseSnippets() + let x = b:xptemplateData + for p in x.snippetToParse + call xpt#parser#ParseSnippet(p) + endfor + let x.snippetToParse = [] +endfunction +fun! XPTemplateStart(pos_unused_any_more,...) + let action = '' + call XPTparseSnippets() + let x = b:xptemplateData + let opt = a:0 == 1 ? a:1 : {} + if has_key( opt, 'tmplName' ) + let startColumn = opt.startPos[1] + let templateName = opt.tmplName + call cursor(opt.startPos) + return action . s:DoStart({ 'line':opt.startPos[0], 'col':startColumn, 'matched':templateName, 'data':{ 'ftScope' : s:GetContextFTObj() } } ) + endif + if get( opt, 'concrete', 0 ) == 0 + let opt.concrete = 1 + let leftSpaces = s:ConcreteSpace() + if leftSpaces != '' + let leftSpaces = substitute( leftSpaces, ' ', ' ', 'g' ) + return leftSpaces . "\=XPTemplateStart(0," . string( opt ) . ")\" + endif + endif + let keypressed = get( opt, 'k', g:xptemplate_key ) + let keypressed = substitute( keypressed, '\V++', '>', 'g' ) + if pumvisible() + if XPPhasSession() + return XPPend() . "\=XPTemplateStart(0," . string( opt ) . ")\" + else + if x.fallbacks == [] + if keypressed =~ g:xptemplate_fallback_condition + let x.fallbacks = [ [ "\XPTfallback", 'feed' ] ] + x.fallbacks + return XPT#fallback(x.fallbacks) + else + endif + else + if g:xptemplate_fallback =~? '\VXPTrawKey\|' || g:xptemplate_fallback ==? keypressed + return XPT#fallback(x.fallbacks) + else + let x.fallbacks = [ [ "\XPTfallback", 'feed' ] ] + x.fallbacks + return XPT#fallback(x.fallbacks) + endif + endif + endif + else + if XPPhasSession() + call XPPend() + endif + endif + let forcePum = get( opt, 'forcePum', g:xptemplate_always_show_pum ) + if x.renderContext.processing + let miniPrefix = g:xptemplate_minimal_prefix_nested + else + let miniPrefix = g:xptemplate_minimal_prefix + endif + let isFullMaatching = miniPrefix is 'full' + let cursorColumn = col(".") + let startLineNr = line(".") + let accEmp = 0 + if g:xptemplate_key ==? '' + let accEmp = 1 + endif + if has_key( opt, 'popupOnly' ) + let startColumn = cursorColumn + elseif x.wrapStartPos + let startColumn = x.wrapStartPos + else + let ftScope = s:GetContextFTObj() + let ftkeyword = ftScope.ftkeyword + let columnBeforeCursor = col( "." ) - 2 + if columnBeforeCursor >= 0 + let lineToCursor = getline(startLineNr)[0 : columnBeforeCursor] + else + let lineToCursor = '' + endif + let pre = ftScope.namePrefix + let n = split( lineToCursor, '\s', 1 )[ -1 ] + let snpt_name_ptn = '\V\^\(' . ftkeyword.regexp . '\|\k\)\k\*' + while n != '' && !has_key( pre, n ) + let shorter = substitute( n, snpt_name_ptn, '', '' ) + if shorter == n + let n = n[1 :] + else + let n = shorter + endif + endwhile + let matched = n + if !has_key( opt, 'popupOnly' ) + if !isFullMaatching && len(matched) < miniPrefix + let x.fallbacks = [ [ "\XPTfallback", 'feed' ] ] + x.fallbacks + return XPT#fallback(x.fallbacks) + endif + endif + let startColumn = col( "." ) - len( matched ) + if matched == '' + let [startLineNr, startColumn] = [line("."), col(".")] + endif + endif + let templateName = strpart(getline(startLineNr),startColumn - 1,cursorColumn - startColumn) + let action = action . s:Popup(templateName,startColumn, { 'acceptEmpty' : accEmp, 'forcePum':forcePum, 'matchWholeName':get( opt, 'popupOnly', 0 ) ? 0 : isFullMaatching } ) + return action +endfunction +fun! s:NewRenderContext(ftScope,tmplName) + let x = b:xptemplateData + if x.renderContext.processing + call xpt#buf#Pushrctx() + endif + let renderContext = xpt#rctx#New(x) + let x.renderContext = renderContext + let renderContext.phase = 'inited' + let renderContext.snipObject = s:GetContextFTObj().allTemplates[a:tmplName] + let renderContext.ftScope = a:ftScope + call s:ParseSnippet(renderContext.snipObject,renderContext.ftScope) + let renderContext.snipSetting = copy(renderContext.snipObject.setting) + let setting = renderContext.snipSetting + for k in [ 'variables', 'preValues', 'defaultValues' , 'ontypeFilters', 'postFilters', 'comeFirst', 'comeLast' ] + let setting[k] = copy(setting[k]) + endfor + return renderContext +endfunction +fun! s:ParseSnippet(snippet,ftScope) + if !a:snippet.parsed + let a:snippet.snipText = xpt#indent#IndentToTabStr(a:snippet.snipText) + call s:ParseInclusion(a:ftScope.allTemplates,a:snippet) + let a:snippet.snipText = s:ParseQuotedPostFilter(a:snippet) + let a:snippet.snipText = s:ParseRepetition(a:snippet) + let a:snippet.parsed = 1 + endif +endfunction +fun! s:DoStart(sess) + let x = b:xptemplateData + if !has_key(s:GetContextFTObj().allTemplates,a:sess.matched) + return '' + endif + let b:__xpt_snip_sess__ = a:sess + return "\" . s:RenderSnippet() +endfunction +fun! s:RenderSnippet() + let x = b:xptemplateData + let sess = b:__xpt_snip_sess__ + let x.savedReg = @" + let [lineNr,column] = [sess.line,sess.col] + let cursorColumn = col(".") + let tmplname = sess.matched + let ctx = s:NewRenderContext(sess.data.ftScope,tmplname) + call s:BuildSnippet([lineNr,column],[lineNr,cursorColumn]) + let ctx.phase = 'rendered' + let ctx.processing = 1 + call s:CallPlugin( 'render', 'after' ) + if empty(x.stack) + call s:SaveNavKey() + call s:ApplyMap() + endif + let x.wrap = '' + let x.wrapStartPos = 0 + let action = s:GotoNextItem() + call s:CallPlugin( 'start', 'after' ) + return action +endfunction +fun! s:SaveNavKey() + let x = b:xptemplateData + let navKey = g:xptemplate_nav_next + let mapInfo = xpt#msvr#MapInfo( navKey, 'i' ) + if mapInfo.cont == '' + let x.canNavFallback = 0 + exe 'inoremap XPTnavFallback ' navKey + else + let x.canNavFallback = 1 + let mapInfo.key = 'XPTnavFallback' + exe xpt#msvr#MapCommand(mapInfo) + endif +endfunction +fun! s:FinishRendering(...) + let x = b:xptemplateData + let renderContext = x.renderContext + let xp = renderContext.snipObject.ptn + let isCursor = get( renderContext.item, 'name', 0 ) is 'cursor' + call XPMremoveMarkStartWith(renderContext.markNamePre) + if empty(x.stack) + let x.fallbacks = [] + let renderContext.processing = 0 + let renderContext.phase = 'finished' + call s:ClearMap() + call XPMflushWithHistory() + let @" = x.savedReg + call s:CallPlugin( 'finishAll', 'after' ) + else + call xpt#buf#Poprctx() + call s:CallPlugin( 'finishSnippet', 'after' ) + let renderContext = x.renderContext + endif + return '' +endfunction +fun! s:Popup(pref,coln,opt) + let x = b:xptemplateData + let renderContext = x.renderContext + if renderContext.phase == 'finished' + let renderContext.phase = 'popup' + endif + let cmpl=[] + let cmpl2 = [] + let ftScope = s:GetContextFTObj() + if ftScope == {} + return '' + endif + let forcePum = get( a:opt, 'forcePum', g:xptemplate_always_show_pum ) + let snipDict = ftScope.allTemplates + let synNames = s:SynNameStack(line("."), a:coln) + if has_key(snipDict,a:pref) && !forcePum + let snipObj = snipDict[a:pref] + if s:IfSnippetShow(snipObj,synNames) + return s:DoStart({ 'line':line( "." ), 'col':a:coln, 'matched':a:pref, 'data':{ 'ftScope' : s:GetContextFTObj() } } ) + endif + endif + for [key,snipObj] in items(snipDict) + if !s:IfSnippetShow(snipObj,synNames) + continue + endif + let hint = get( snipObj.setting, 'hint', '' ) + if key =~# '\V\^\[A-Z]' + call add( cmpl2, {'word' : key, 'menu' : hint } ) + else + call add( cmpl, {'word' : key, 'menu' : hint } ) + endif + endfor + call sort(cmpl) + call sort(cmpl2) + let cmpl = cmpl + cmpl2 + let pumsess = XPPopupNew(s:pumCB, { 'ftScope' : ftScope }, cmpl) + call pumsess.SetAcceptEmpty( get( a:opt, 'acceptEmpty', 0 ) ) + call pumsess.SetMatchWholeName( get( a:opt, 'matchWholeName', 0 ) ) + call pumsess.SetOption({ 'matchPrefix':! forcePum, 'tabNav':g:xptemplate_pum_tab_nav } ) + return pumsess.popup(a:coln,{}) +endfunction +fun! s:IfSnippetShow(snipObj,synNames) + let x = b:xptemplateData + let snipObj = a:snipObj + let synNames = a:synNames + if snipObj.setting.wraponly && x.wrap is '' || !snipObj.setting.iswrap && x.wrap isnot '' + return 0 + endif + if has_key(snipObj.setting, "syn") && snipObj.setting.syn != '' && match(synNames, '\c' . snipObj.setting.syn) == -1 + return 0 + endif + if get( snipObj.setting, 'hidden', 0 ) == 1 + return 0 + endif + return 1 +endfunction +fun! s:AddIndent(text,nIndent) + let baseIndent = repeat( " ", a:nIndent ) + return substitute(a:text, '\n', '&' . baseIndent, 'g') +endfunction +fun! s:ParseRepetition(snipObject) + let tmplObj = a:snipObject + let xp = a:snipObject.ptn + let tmpl = a:snipObject.snipText + let bef = "" + let rest = "" + let rp = xp.lft . s:repetitionPattern . xp.rt + let repPtn = '\V\(' . rp . '\)\_.\{-}' . '\1' + let repContPtn = '\V\(' . rp . '\)\zs\_.\{-}' . '\1' + let stack = [] + let from = 0 + while 1 + let startOfMatch = match(tmpl,repPtn,from) + if startOfMatch == -1 + break + endif + let stack += [startOfMatch] + let from = startOfMatch + 1 + endwhile + while stack != [] + let matchpos = stack[-1] + unlet stack[-1] + if matchpos == 0 + let bef = '' + else + let bef = tmpl[: matchpos-1] + endif + let rest = tmpl[matchpos :] + let indentNr = s:GetIndentBeforeEdge(tmplObj,bef) + let repeatPart = matchstr(rest,repContPtn) + let repeatPart = 'BuildIfNoChange(' . string( repeatPart ) . ')' + let symbol = matchstr(rest,rp) + let name = substitute( symbol, '\V' . xp.lft . '\|' . xp.rt, '', 'g' ) + let tmplObj.setting.postFilters[name] = xpt#flt#New(-indentNr,repeatPart) + let bef .= symbol + let rest = substitute(rest, repPtn, '', '') + let tmpl = bef . rest + endwhile + return tmpl +endfunction +fun! s:GetIndentBeforeEdge(tmplObj,textBeforeLeftMark) + let xp = a:tmplObj.ptn + if a:textBeforeLeftMark =~ '\V' . xp.lft . '\_[^' . xp.r . ']\*\%$' + let tmpBef = substitute( a:textBeforeLeftMark, '\V' . xp.lft . '\_[^' . xp.r . ']\*\%$', '', '' ) + let indentOfFirstLine = matchstr( tmpBef, '.*\n\zs\s*' ) + else + let indentOfFirstLine = matchstr( a:textBeforeLeftMark, '.*\n\zs\s*' ) + endif + return len(indentOfFirstLine) +endfunction +fun! s:ParseQuotedPostFilter(tmplObj) + let xp = a:tmplObj.ptn + let postFilters = a:tmplObj.setting.postFilters + let quoter = a:tmplObj.setting.postQuoter + let flagPattern = '\V\[!]\$' + let startPattern = '\V\_.\{-}\zs' . xp.lft . '\_[^' . xp.r . ']\*' . quoter.start . xp.rt + let endPattern = '\V' . xp.lft . quoter.end . xp.rt + let snip = a:tmplObj.snipText + let stack = [] + let startPos = 0 + while startPos != -1 + let startPos = match(snip,startPattern,startPos) + if startPos != -1 + call add(stack,startPos) + let startPos += len(matchstr(snip,startPattern,startPos)) + endif + endwhile + while 1 + if empty(stack) + break + endif + let startPos = remove(stack,-1) + let endPos = match(snip,endPattern,startPos + 1) + if endPos == -1 + break + endif + let startText = matchstr(snip,startPattern,startPos) + let endText = matchstr(snip,endPattern,endPos) + let name = startText[1 : -1 - len(quoter.start) - 1] + let flag = matchstr(name,flagPattern) + if flag != '' + let name = name[: -1 - len(flag)] + endif + if name =~ xp.lft + let name = matchstr( name, '\V' . xp.lft . '\zs\_.\*' ) + if name =~ xp.lft + let name = matchstr( name, '\V\_.\*\ze' . xp.lft ) + endif + endif + let plainPostFilter = snip[startPos + len(startText) : endPos - 1] + let firstLineIndentNr = s:GetIndentBeforeEdge(a:tmplObj,snip[: startPos - 1]) + if flag == '!' + let plainPostFilter = 'BuildIfChanged(' . string( plainPostFilter ) . ')' + else + let plainPostFilter = 'BuildIfNoChange(' . string( plainPostFilter ) . ')' + endif + let postFilters[name] = xpt#flt#New(-firstLineIndentNr,plainPostFilter) + let snip = snip[: startPos + len(startText) - 1 - 1 - len(quoter.start) - len(flag)] . snip[endPos + len(endText) - 1 :] + endwhile + return snip +endfunction +fun! s:BuildSnippet(nameStartPosition,nameEndPosition) + call getchar(0) + let x = b:xptemplateData + let ctx = b:xptemplateData.renderContext + let xp = ctx.snipObject.ptn + let curline = getline(a:nameStartPosition[0]) + let nIndent = -1 + if len( matchstr( curline, '\V\^\s\*' ) ) == a:nameStartPosition[ 1 ] - 1 + if has_key(ctx.oriIndentkeys,ctx.snipObject.name) || has_key(ctx.leadingCharToReindent,ctx.snipObject.name) + if a:nameStartPosition == a:nameEndPosition + call XPreplace(a:nameStartPosition,a:nameEndPosition, ctx.snipObject.name, { 'doJobs' : 0 } ) + endif + let nIndent = XPT#getPreferedIndentNr(a:nameStartPosition[0]) + if a:nameStartPosition == a:nameEndPosition + call XPreplace(a:nameStartPosition,[a:nameEndPosition[0], a:nameEndPosition[1] + len(ctx.snipObject.name)], '', { 'doJobs' : 0 } ) + endif + endif + endif + let ctx.phase = 'rendering' + if ctx.snipSetting.iswrap && x.wrap isnot '' + let setting = ctx.snipSetting + let setting.preValues[ setting.wrap ] = xpt#flt#New( 0, 'GetWrappedText()' ) + let setting.defaultValues[ setting.wrap ] = xpt#flt#New( 0, "Next()", 1 ) + call insert(setting.comeFirst,setting.wrap,0) + endif + if x.wrap isnot '' + let ctx.wrap = copy(x.wrap) + endif + let snippetText = ctx.snipObject.snipText + let currentNIndent = XPT#getIndentNr(a:nameStartPosition[0],a:nameStartPosition[1]) + let nIndentToAdd = currentNIndent + if nIndent >= 0 + if nIndent > currentNIndent + let snippetText = repeat( ' ', nIndent - currentNIndent ) . snippetText + let nIndentToAdd = nIndent + elseif nIndent < currentNIndent + let snippetText = repeat( ' ', nIndent ) . snippetText + let nIndentToAdd = nIndent + let a:nameStartPosition[1] = 1 + endif + endif + let snippetText = xpt#indent#ToActualIndentStr(snippetText,nIndentToAdd) + call XPMupdate() + call XPMadd( ctx.marks.tmpl.start, a:nameStartPosition, g:XPMpreferLeft, '\Ve\$' ) + call XPMadd( ctx.marks.tmpl.end, a:nameEndPosition, g:XPMpreferRight, '\Ve\$' ) + call xpt#settingswitch#Switch(b:xptemplateData.settingWrap) + call XPMsetLikelyBetween(ctx.marks.tmpl.start,ctx.marks.tmpl.end) + call XPreplace(a:nameStartPosition,a:nameEndPosition,snippetText) + let ctx.firstList = [] + let ctx.itemList = [] + let ctx.lastList = [] + if 0 > s:BuildPlaceHolders(ctx.marks.tmpl) + return s:Crash() + endif + let ctx = empty(x.stack) ? x.renderContext : x.stack[0] + let rg = XPMposList(ctx.marks.tmpl.start,ctx.marks.tmpl.end) + exe 'silent! ' . rg[0][0] . ',' . rg[1][0] . 'foldopen!' +endfunction +fun! s:GetNameInfo(end) + let x = b:xptemplateData + let xp = x.renderContext.snipObject.ptn + if getline(".")[col(".") - 1] != xp.l + throw "cursor is not at item start position:".string(getpos(".")[1:2]) + endif + let endn = a:end[0] * 10000 + a:end[1] + let l0 = getpos(".")[1:2] + let r0 = searchpos(xp.rt, 'nW') + let r0n = r0[0] * 10000 + r0[1] + if r0 == [0,0] || r0n >= endn + return [[0,0],[0,0],[0,0],[0,0]] + endif + let l1 = searchpos(xp.lft, 'W') + let l2 = searchpos(xp.lft, 'W') + let l1n = l1[0] * 10000 + l1[1] + let l2n = l2[0] * 10000 + l2[1] + if l1n > r0n || l1n >= endn + let l1 = [0,0] + endif + if l2n > r0n || l1n >= endn + let l2 = [0,0] + endif + if l1 != [0,0] && l2 != [0,0] + return [l0,l1,l2,r0] + elseif l1 == [0,0] && l2 == [0,0] + return [l0,l0,r0,r0] + else + return [l0,l1,r0,r0] + endif +endfunction +fun! s:GetValueInfo(end) + let x = b:xptemplateData + let xp = x.renderContext.snipObject.ptn + if getline(".")[col(".") - 1] != xp.r + throw "cursor is not at item end position:".string(getpos(".")[1:2]) + endif + let nEnd = a:end[0] * 10000 + a:end[1] + let r0 = [ line( "." ), col( "." ) ] + let l0 = searchpos(xp.lft, 'nW', a:end[0]) + if l0 == [0,0] + let l0n = nEnd + else + let l0n = min([l0[0] * 10000 + l0[1],nEnd]) + endif + let r1 = searchpos(xp.rt, 'W', a:end[0]) + if r1 == [0,0] || r1[0] * 10000 + r1[1] >= l0n + return [r0,copy(r0),copy(r0)] + endif + let r2 = searchpos(xp.rt, 'W', a:end[0]) + if r2 == [0,0] || r2[0] * 10000 + r2[1] >= l0n + return [r0,r1,copy(r1)] + endif + return [r0,r1,r2] +endfunction +fun! s:TextWithoutIndent(posRange) + let [s,e] = a:posRange + let text = xpt#util#TextBetween([s,e]) + let text = xpt#indent#ToSpace(text) + let nIndent = xpt#indent#IndentBefore(s) + let text = xpt#indent#RemoveIndentStr(text,nIndent) + return text +endfunction +fun! s:CreatePlaceHolder(ctx,nameInfo,valueInfo) + let xp = a:ctx.snipObject.ptn + let toescape = xp.l . xp.r + let leftEdge = s:TextWithoutIndent(a:nameInfo[0 : 1]) + let name = s:TextWithoutIndent(a:nameInfo[1 : 2]) + let rightEdge = s:TextWithoutIndent(a:nameInfo[2 : 3]) + let [leftEdge,name,rightEdge] = [leftEdge[1 :],name[1 :],rightEdge[1 :]] + let leftEdge = xpt#util#UnescapeChar(leftEdge,toescape) + let name = xpt#util#UnescapeChar(name,toescape) + let rightEdge = xpt#util#UnescapeChar(rightEdge,toescape) + let fullname = leftEdge . name . rightEdge + let incPattern = '\V\^:\zs\.\*\ze:\$\|\^Include:\zs\.\*\$' + if name =~ incPattern + return { 'include' : matchstr( name, incPattern ) } + endif + if name =~ '\V' . xp.item_var . '\|' . xp.item_func + return { 'value' : fullname, 'leftEdge':leftEdge, 'name':name, 'rightEdge':rightEdge, } + endif + let placeHolder = { 'name':name, 'isKey':(a:nameInfo[0] != a:nameInfo[1]), } + if placeHolder.isKey + call extend(placeHolder,{ 'leftEdge':leftEdge, 'rightEdge':rightEdge, 'fullname':fullname, }, 'force' ) + endif + if a:valueInfo[1] != a:valueInfo[0] + let isPostFilter = a:valueInfo[1][0] == a:valueInfo[2][0] && a:valueInfo[1][1] + 1 == a:valueInfo[2][1] + let val = xpt#util#TextBetween(a:valueInfo[0 : 1]) + let val = val[1:] + let val = xpt#util#UnescapeChar(val,xp.l . xp.r) + let nIndent = indent(a:valueInfo[0][0]) + if isPostFilter + if name =~ s:expandablePattern + let val = xpt#util#UnescapeChar( val, '{$( ' ) + let val = 'BuildIfNoChange(' . string( val ) . ')' + endif + let placeHolder.postFilter = xpt#flt#New(-nIndent,val) + else + let placeHolder.ontimeFilter = xpt#flt#New(-nIndent,val) + endif + endif + return placeHolder +endfunction +fun! s:BuildMarksOfPlaceHolder(item,placeHolder,nameInfo,valueInfo) + let renderContext = b:xptemplateData.renderContext + let [item,placeHolder,nameInfo,valueInfo] = [a:item,a:placeHolder,a:nameInfo,a:valueInfo] + if item.name == '' + let markName = '``' . s:anonymouseIndex + let s:anonymouseIndex += 1 + else + let markName = item.name . s:buildingSeqNr . '`' . ( placeHolder.isKey ? 'k' : (len(item.placeHolders)-1) ) + endif + let markPre = renderContext.markNamePre . markName . '`' + call extend(placeHolder,{ 'mark':{ 'start':markPre . 'os', 'end':markPre . 'oe', }, }, 'force' ) + if placeHolder.isKey + call extend(placeHolder,{ 'editMark':{ 'start':markPre . 'is', 'end':markPre . 'ie', }, }, 'force' ) + let placeHolder.innerMarks = placeHolder.editMark + else + let placeHolder.innerMarks = placeHolder.mark + endif + let valueInfo[2][1] += 1 + if placeHolder.isKey + let shift = (nameInfo[0] != nameInfo[1] && nameInfo[0][0] == nameInfo[1][0]) + let nameInfo[1][1] -= shift + let shift = (nameInfo[1][0] == nameInfo[2][0]) * (shift + 1) + let nameInfo[2][1] -= shift + if nameInfo[2] != nameInfo[3] + let shift = (nameInfo[2][0] == nameInfo[3][0]) * (shift + 1) + let nameInfo[3][1] -= shift + endif + call XPreplaceInternal(nameInfo[0],valueInfo[2],placeHolder.fullname) + else + if nameInfo[0][0] == nameInfo[3][0] + let nameInfo[3][1] -= 1 + endif + call XPreplaceInternal(nameInfo[0],valueInfo[2],placeHolder.name) + endif + call XPMadd( placeHolder.mark.start, nameInfo[0], 'l' ) + if placeHolder.isKey + call XPMadd( placeHolder.editMark.start, nameInfo[1], 'l' ) + call XPMadd( placeHolder.editMark.end, nameInfo[2], 'r' ) + endif + call XPMadd( placeHolder.mark.end, nameInfo[3], 'r' ) +endfunction +fun! s:AddItemToRenderContext(ctx,item) + let [ctx,item] = [a:ctx,a:item] + let exist = has_key(ctx.itemDict,item.name) + if item.name != '' + let ctx.itemDict[item.name] = item + endif + if exist + return + endif + if ctx.phase != 'rendering' + if ! s:AddToOrderList(ctx.firstList,item) + call add(ctx.firstList,item) + endif + call filter( ctx.itemList, 'v:val isnot item' ) + return + endif + if item.name == '' + call add(ctx.itemList,item) + elseif s:AddToOrderList(ctx.firstList,item) || s:AddToOrderList(ctx.lastList,item) + return + else + call add(ctx.itemList,item) + endif +endfunction +fun! s:AddToOrderList(list,item) + let i = index(a:list,a:item.name) + if i != -1 + let a:list[i] = a:item + return 1 + else + return 0 + endif +endfunction +fun! s:BuildPlaceHolders(markRange) + let s:buildingSeqNr += 1 + let rc = 0 + let x = b:xptemplateData + let renderContext = b:xptemplateData.renderContext + let snipObj = renderContext.snipObject + let setting = snipObj.setting + let xp = renderContext.snipObject.ptn + let renderContext.itemDict = {} + let current = [renderContext.item,renderContext.leadingPlaceHolder] + let renderContext.action = 'build' + if renderContext.firstList == [] + let renderContext.firstList = copy(renderContext.snipSetting.comeFirst) + endif + if renderContext.lastList == [] + let renderContext.lastList = copy(renderContext.snipSetting.comeLast) + endif + let renderContext.buildingMarkRange = copy(a:markRange) + call XPRstartSession() + call XPMgoto(a:markRange.start) + let i = 0 + while i < 10000 + let i += 1 + let markPos = s:NextLeftMark(a:markRange) + let end = XPMpos(a:markRange.end) + let nEnd = end[0] * 10000 + end[1] + if markPos == [0,0] || markPos[0] * 10000 + markPos[1] >= nEnd + break + endif + let nameInfo = s:GetNameInfo(end) + if nameInfo[0] == [0,0] + break + endif + call cursor(nameInfo[3]) + let valueInfo = s:GetValueInfo(end) + if valueInfo[0] == [0,0] + break + endif + let placeHolder = s:CreatePlaceHolder(renderContext,nameInfo,valueInfo) + let rc = 1 + if renderContext.wrap != {} && setting.iswrap && get( placeHolder, 'name', 0 ) is setting.wrap && get( placeHolder, 'isKey', 0 ) + let n = len(renderContext.wrap.lines) - 1 + let indent = repeat( ' ', virtcol( nameInfo[ 0 ] ) - 1 ) + let line = "\n" . indent . xp.l . placeHolder.leftEdge . xp.l . 'GetWrappedText()' . xp.l . placeHolder.rightEdge . xp.r + let lines = repeat(line,n) + let pos = copy(valueInfo[-1]) + let pos[1] += 1 + call XPreplaceInternal(pos,pos,lines) + endif + if has_key( placeHolder, 'include' ) + call s:ApplyBuildTimeInclusion(placeHolder,nameInfo,valueInfo) + call cursor(nameInfo[0]) + elseif has_key( placeHolder, 'value' ) + let to_build = s:ApplyInstantValue(placeHolder,nameInfo,valueInfo) + if to_build + call cursor(nameInfo[0]) + endif + else + let item = s:BuildItemForPlaceHolder(placeHolder) + call s:BuildMarksOfPlaceHolder(item,placeHolder,nameInfo,valueInfo) + let renderContext.item = item + let renderContext.leadingPlaceHolder = item.keyPH == s:nullDict ? placeHolder : item.keyPH + call s:EvaluateEdge(xp,item,placeHolder) + call s:ApplyPreValues(placeHolder) + call xpt#rctx#AddDefaultPHFilters(renderContext,placeHolder) + call cursor(XPMpos(placeHolder.mark.end)) + endif + endwhile + let renderContext.itemList = renderContext.firstList + renderContext.itemList + renderContext.lastList + call filter( renderContext.itemList, 'type(v:val) != 1' ) + let renderContext.firstList = [] + let renderContext.lastList = [] + let end = XPMpos(a:markRange.end) + call cursor(end) + let [renderContext.item,renderContext.leadingPlaceHolder] = current + let renderContext.action = '' + call XPRendSession() + return rc +endfunction +fun! s:NextLeftMark(markRange) + let x = b:xptemplateData + let renderContext = x.renderContext + let xp = renderContext.snipObject.ptn + let curline = getline( line(".") ) + let c = col(".") + if len(curline) > 1 && curline[c - 1] == xp.l + return [ line("."), c ] + endif + while 1 + let end = XPMpos(a:markRange.end) + let nEnd = end[0] * 10000 + end[1] + let ptn = xpt#util#CharsPattern(xp.l . xp.r) + let markPos = searchpos( '\V\\\*' . ptn, 'cW' ) + if markPos == [0,0] || markPos[0] * 10000 + markPos[1] >= nEnd + break + endif + let content = getline(markPos[0])[markPos[1] - 1 :] + let char = matchstr( content, '\V' . ptn ) + let content = matchstr( content, '^\\*' ) + let newEsc = repeat( '\', len( content ) / 2 ) + call XPreplaceInternal( markPos, [ markPos[0], markPos[1] + len( content ) ], newEsc, { 'doPostJob' : 1 } ) + if len(content) % 2 == 0 && char == xp.l + call cursor([markPos[0],markPos[1] + len(newEsc)]) + break + endif + call cursor([markPos[0],markPos[1] + len(newEsc) + 1]) + endwhile + return markPos +endfunction +fun! s:EvaluateEdge(xp,item,ph) + if !a:ph.isKey + return + endif + let eval_ptn = '\V' . a:xp.item_var . '\|' . a:xp.item_func + if a:ph.leftEdge =~ eval_ptn + let a:ph.leftEdge = s:EvalAsFilter(a:ph.leftEdge, XPMpos(a:ph.mark.start)) + call XPreplaceByMarkInternal(a:ph.mark.start,a:ph.editMark.start, a:ph.leftEdge) + endif + if a:ph.rightEdge =~ eval_ptn + let a:ph.rightEdge = s:EvalAsFilter(a:ph.rightEdge, XPMpos(a:ph.editMark.end)) + call XPreplaceByMarkInternal(a:ph.editMark.end,a:ph.mark.end, a:ph.rightEdge) + endif + let a:ph.fullname = a:ph.leftEdge . a:item.name . a:ph.rightEdge + let a:item.fullname = a:ph.fullname +endfunction +fun! s:EvalAsFilter(raw,start_pos) + let x = b:xptemplateData + let rctx = x.renderContext + let flt = xpt#flt#New(0,a:raw) + let flt_rst = s:EvalFilter(flt,[ rctx.ftScope.funcs, rctx.snipSetting.variables, ]) + return s:IndentFilterText(flt_rst,a:start_pos) +endfunction +fun! s:IndentFilterText(flt_rst,start) + let lines = split( a:flt_rst.text, '\n', 1 ) + if get(a:flt_rst, 'parseIndent', 1) + call xpt#indent#IndentToTab(lines) + endif + let indent = s:IndentAt(a:start,a:flt_rst) + call xpt#indent#ToActualIndent(lines,indent) + return join(lines, "\n") +endfunction +fun! s:ApplyBuildTimeInclusion(placeHolder,nameInfo,valueInfo) + let renderContext = b:xptemplateData.renderContext + let tmplDict = renderContext.ftScope.allTemplates + let placeHolder = a:placeHolder + let nameInfo = a:nameInfo + let valueInfo = a:valueInfo + let [incName,params] = s:ParseInclusionStatement(renderContext.snipObject,placeHolder.include) + if !has_key(tmplDict,incName) + call XPT#warn( "unknown inclusion :" . incName ) + return + endif + let incTmplObject = tmplDict[incName] + call s:ParseSnippet(incTmplObject,renderContext.ftScope) + call s:MergeSetting(renderContext.snipSetting,incTmplObject.setting) + let incSnip = s:ReplacePHInSubSnip(renderContext.snipObject,incTmplObject,params) + let incSnip = s:AddIndent(incSnip,nameInfo[0][1]-1) + let valueInfo[-1][1] += 1 + call XPreplaceInternal(nameInfo[0],valueInfo[-1],incSnip) +endfunction +fun! s:ApplyInstantValue(placeHolder,nameInfo,valueInfo) + let rctx = b:xptemplateData.renderContext + let ph = a:placeHolder + let nameInfo = a:nameInfo + let valueInfo = a:valueInfo + let start = a:nameInfo[0] + let combined_flt_rst = {} + let text = '' + let to_build = 0 + for k in [ 'leftEdge', 'name', 'rightEdge' ] + if ph[k] != '' + let flt = xpt#flt#New(0,ph[k]) + let flt_rst = s:EvalFilter(flt,[ rctx.ftScope.funcs, rctx.snipSetting.variables, ]) + if flt_rst.rc == 0 + continue + endif + let text .= get( flt_rst, 'text', '' ) + if get(flt_rst, 'nIndent', 0) != 0 + let combined_flt_rst.nIndent = flt_rst.nIndent + endif + if flt_rst.action == 'build' + let to_build = 1 + endif + endif + endfor + let valueInfo[-1][1] += 1 + let combined_flt_rst.text = text + let text = s:IndentFilterText(combined_flt_rst,start) + call XPreplaceInternal( nameInfo[0], valueInfo[-1], text, { 'doJobs' : 1 } ) + return to_build +endfunction +fun! s:IndentAt(start,flt_rst) + let filter_indent_offset = get(a:flt_rst, 'nIndent', 0) + let indent = xpt#indent#IndentBefore(a:start) + let indent += filter_indent_offset + let indent = max([0,indent]) + return indent +endfunction +fun! s:ApplyPreValues(placeHolder) + let rctx = b:xptemplateData.renderContext + let setting = rctx.snipSetting + let name = a:placeHolder.name + let preValue = name == '' ? g:EmptyFilter : get(setting.preValues,name,g:EmptyFilter) + if preValue is g:EmptyFilter + let preValue = get( a:placeHolder, 'ontimeFilter', get(setting.defaultValues,name,g:EmptyFilter)) + endif + if preValue is g:EmptyFilter + return + endif + let flt_rst = s:EvalFilter(preValue,[ rctx.ftScope.funcs, rctx.snipSetting.variables, ]) + if flt_rst.rc is 0 || ! has_key(flt_rst, 'text') + return + endif + let mark_name = s:GetPHReplacingMarkName(flt_rst) + let marks = a:placeHolder[mark_name] + let s = XPMpos(marks.start) + let text = s:IndentFilterText(flt_rst,s) + try + call XPreplaceByMarkInternal(marks.start,marks.end,text) + catch /.*/ + call s:Crash( v:exception . " while update preset text" ) + endtry +endfunction +fun! s:BuildItemForPlaceHolder(placeHolder) + let renderContext = b:xptemplateData.renderContext + if has_key(renderContext.itemDict,a:placeHolder.name) + let item = renderContext.itemDict[a:placeHolder.name] + else + let item = { 'name' : a:placeHolder.name, 'fullname':a:placeHolder.name, 'initValue':a:placeHolder.name, 'processed':0, 'placeHolders':[], 'keyPH':s:nullDict, 'behavior':{}, } + endif + let inPrevBuild = (index(renderContext.itemList,item) >= 0) + call s:AddItemToRenderContext(renderContext,item) + if a:placeHolder.isKey + let item.keyPH = a:placeHolder + let item.fullname = a:placeHolder.fullname + else + if renderContext.phase != 'rendering' && inPrevBuild + call insert(item.placeHolders,a:placeHolder) + else + call add(item.placeHolders,a:placeHolder) + endif + endif + return item +endfunction +fun! s:XPTvisual() + if &selectmode =~ 'cmd' + normal! v\ + else + normal! v + endif +endfunction +fun! s:CleanupCurrentItem() + let renderContext = b:xptemplateData.renderContext + call s:ClearItemMapping(renderContext) +endfunction +fun! s:ShiftBackward() + let renderContext = b:xptemplateData.renderContext + if empty(renderContext.history) + return '' + endif + call s:CleanupCurrentItem() + let his = remove(renderContext.history,-1) + call s:PushBackItem() + let renderContext.item = his.item + let renderContext.leadingPlaceHolder = his.leadingPlaceHolder + let leader = renderContext.leadingPlaceHolder + call XPMsetLikelyBetween(leader.mark.start,leader.mark.end) + return s:SelectCurrent() +endfunction +fun! s:PushBackItem() + let renderContext = b:xptemplateData.renderContext + let item = renderContext.item + if !renderContext.leadingPlaceHolder.isKey + call insert(item.placeHolders,renderContext.leadingPlaceHolder,0) + endif + call insert(renderContext.itemList,item,0) + let item.processed = 1 +endfunction +fun! s:ShiftForward(action) + let x = b:xptemplateData + let renderContext = x.renderContext + if pumvisible() + if XPPhasSession() + return XPPend() . "\=" . s:sid . 'ShiftForward(' . string( a:action ) . ")\" + else + if g:xptemplate_move_even_with_pum + return s:close_pum . "\" . '=XPTforceForward(' . string( a:action ) . ")\" + else + if x.canNavFallback + let x.fallbacks = [ [ "\XPTnavFallback", 'feed' ], [ "\=XPTforceForward(" . string( a:action ) . ")\", 'expr' ], ] + return XPT#fallback(x.fallbacks) + else + return XPPend() . "\=" . s:sid . 'ShiftForward(' . string( a:action ) . ")\" + endif + endif + endif + else + if XPPhasSession() + call XPPend() + endif + return s:close_pum . "\" . '=XPTforceForward(' . string( a:action ) . ")\" + endif +endfunction +fun! XPTforceForward(action) + call XPMupdate('force') + if s:XPTupdate() < 0 + return '' + endif + if s:FinishCurrent(a:action) < 0 + return '' + endif + let postaction = s:GotoNextItem() + return postaction +endfunction +fun! s:FinishCurrent(action) + let renderContext = b:xptemplateData.renderContext + let marks = renderContext.leadingPlaceHolder.mark + call s:CleanupCurrentItem() + let rc = s:XPTupdate() + if rc == -1 + return -1 + endif + let name = renderContext.item.name + if a:action ==# 'clear' + call XPreplace(XPMpos( marks.start ),XPMpos( marks.end ), '') + endif + let [post,built] = s:ApplyPostFilter() + if name != '' + let renderContext.namedStep[name] = post + endif + if built || a:action ==# 'clear' + call s:RemoveCurrentMarks() + else + let renderContext.history += [{ 'item':renderContext.item, 'leadingPlaceHolder':renderContext.leadingPlaceHolder } ] + endif + return 0 +endfunction +fun! s:RemoveCurrentMarks() + let renderContext = b:xptemplateData.renderContext + let item = renderContext.item + let leader = renderContext.leadingPlaceHolder + call XPMremoveStartEnd(leader.mark) + if has_key( leader, 'editMark' ) + call XPMremoveStartEnd(leader.editMark) + endif + for ph in item.placeHolders + call XPMremoveStartEnd(ph.mark) + endfor +endfunction +fun! s:ApplyPostFilter() + let rctx = b:xptemplateData.renderContext + let rctx.activeLeaderMarks = 'mark' + let posts = rctx.snipSetting.postFilters + let name = rctx.item.name + let leader = rctx.leadingPlaceHolder + let marks = rctx.leadingPlaceHolder[rctx.activeLeaderMarks] + let rctx.phase = 'post' + let typed = xpt#util#TextBetween(XPMposStartEnd(marks)) + if rctx.item.name != '' + let rctx.namedStep[rctx.item.name] = typed + endif + let groupPostFilter = get(posts,name,g:EmptyFilter) + let leaderPostFilter = get( leader, 'postFilter', g:EmptyFilter ) + let filter = groupPostFilter is g:EmptyFilter ? leaderPostFilter : groupPostFilter + let hadBuilt = 0 + if filter isnot g:EmptyFilter + let flt_rst = s:EvalPostFilter(filter,typed,leader) + let mark_name = s:GetPHReplacingMarkName(flt_rst) + let marks = rctx.leadingPlaceHolder[mark_name] + let ori_flt_rst = copy(flt_rst) + call XPMsetLikelyBetween(marks.start,marks.end) + if flt_rst.rc != 0 + if has_key( flt_rst, 'text' ) + if flt_rst.text !=# typed + let [start,end] = XPMposStartEnd(marks) + if mark_name == 'mark' + call s:RemoveEditMark(leader) + endif + call xpt#settingswitch#Switch(b:xptemplateData.settingWrap) + let text = s:IndentFilterText(flt_rst,start) + call XPreplace(start,end,text) + endif + endif + if flt_rst.action == 'build' + let rctx.firstList = [] + let buildrc = s:BuildPlaceHolders(marks) + if 0 > buildrc + return [s:Crash(),1] + endif + let hadBuilt = 0 < buildrc + let rctx.phase = 'post' + endif + endif + endif + if groupPostFilter is g:EmptyFilter + call s:UpdateFollowingPlaceHoldersWith(typed,{}) + return [typed,hadBuilt] + else + call s:UpdateFollowingPlaceHoldersWith( typed, { 'post' : ori_flt_rst } ) + if hadBuilt + return [typed,hadBuilt] + else + return [ get(flt_rst, 'text', typed), hadBuilt ] + endif + endif +endfunction +fun! s:RemoveEditMark(ph) + if has_key( a:ph, 'editMark' ) + call XPMremoveStartEnd(a:ph.editMark) + let a:ph.innerMarks = a:ph.mark + unlet a:ph.editMark + endif +endfunction +fun! s:EvalPostFilter(filter,typed,leader) + let renderContext = b:xptemplateData.renderContext + let pos = XPMpos(a:leader.mark.start) + let pos[1] = 1 + let startMark = XPMmarkAfter(pos) + let flt_rst = s:EvalFilter(a:filter,[ renderContext.ftScope.funcs, renderContext.snipSetting.variables, { '$UserInput' : a:typed } ] ) + return flt_rst +endfunction +fun! s:GotoNextItem() + let action = s:DoGotoNextItem() + call xpt#settingswitch#Restore(b:xptemplateData.settingWrap) + return action +endfunction +fun! s:DoGotoNextItem() + let renderContext = b:xptemplateData.renderContext + let placeHolder = s:ExtractOneItem() + if placeHolder == s:nullDict + call cursor(XPMpos(renderContext.marks.tmpl.end)) + return s:FinishRendering(1) + endif + let phPos = XPMpos(placeHolder.mark.start) + if phPos == [0,0] + return s:Crash('failed to find position of mark:' . placeHolder.mark.start) + endif + let leader = renderContext.leadingPlaceHolder + let leaderMark = leader.innerMarks + call XPMsetLikelyBetween(leaderMark.start,leaderMark.end) + if renderContext.item.processed + let renderContext.phase = 'fillin' + return s:SelectCurrent() + endif + let oldRenderContext = renderContext + let postaction = s:InitItem() + let renderContext = b:xptemplateData.renderContext + let leader = renderContext.leadingPlaceHolder + if renderContext.processing && empty(renderContext.itemList) && !has_key(renderContext.snipSetting.postFilters,renderContext.item.name) && !has_key( leader, 'postFilter' ) && empty(renderContext.item.placeHolders) && XPMpos(leader.mark.end) == XPMpos(renderContext.marks.tmpl.end) && postaction !~ '' + let pp = s:FinishRendering() + return postaction + endif + if !renderContext.processing + return postaction + endif + try + call XPMsetLikelyBetween(leader.mark.start,leader.mark.end) + catch /.*/ + return s:Crash() + endtry + if postaction == '' + if oldRenderContext == renderContext || oldRenderContext.level < renderContext.level + call cursor(XPMpos(renderContext.leadingPlaceHolder.innerMarks.end)) + endif + return '' + else + return postaction + endif +endfunction +fun! s:ExtractOneItem() + let renderContext = b:xptemplateData.renderContext + let itemList = renderContext.itemList + let [renderContext.item,renderContext.leadingPlaceHolder] = [{},{}] + if empty(itemList) + return s:nullDict + endif + let item = itemList[0] + let renderContext.itemList = renderContext.itemList[1 :] + let renderContext.item = item + if empty(item.placeHolders) && item.keyPH == s:nullDict + call XPT#warn( "item without placeholders!" ) + return s:nullDict + endif + if item.keyPH == s:nullDict + let renderContext.leadingPlaceHolder = item.placeHolders[0] + let item.placeHolders = item.placeHolders[1:] + else + let renderContext.leadingPlaceHolder = item.keyPH + endif + return renderContext.leadingPlaceHolder +endfunction +fun! s:HandleDefaultValueAction(flt_rst) + let x = b:xptemplateData + let rctx = x.renderContext + let leader = rctx.leadingPlaceHolder + if a:flt_rst.action ==# 'expandTmpl' + let marks = leader.mark + call XPreplace(XPMpos( marks.start ), XPMpos( marks.end ), '') + call XPMsetLikelyBetween(marks.start,marks.end) + return XPTemplateStart(0, {'startPos' : getpos(".")[1:2], 'tmplName' : a:flt_rst.tmplName}) + elseif a:flt_rst.action ==# 'pum' + return s:DefaultValuePumHandler(rctx,a:flt_rst) + elseif a:flt_rst.action ==# 'finishTemplate' + return s:ActionFinish(rctx,a:flt_rst) + elseif a:flt_rst.action ==# 'build' + if s:FillinLeader(a:flt_rst) is s:BROKEN || s:BuildLeaderText(a:flt_rst) is s:BROKEN + return s:BROKEN + endif + return s:GotoNextItem() + elseif a:flt_rst.action ==# 'text' + if s:FillinLeader(a:flt_rst) is s:BROKEN + return s:BROKEN + endif + else + if s:FillinLeader(a:flt_rst) is s:BROKEN + return s:BROKEN + endif + endif + if a:flt_rst.nav == 'next' + if x.renderContext.processing + let postaction = s:ShiftForward( '' ) + return postaction + else + return '' + endif + endif + return s:SelectCurrent() +endfunction +fun! s:GetLeaderOpPos(flt_rst) + let marks = s:GetLeaderOpMarks(a:flt_rst) + let [s,e] = XPMposStartEnd(marks) + return [s,e] +endfunction +fun! s:GetLeaderOpMarks(flt_rst) + let rctx = b:xptemplateData.renderContext + let mark_name = s:GetPHReplacingMarkName(a:flt_rst) + return rctx.leadingPlaceHolder[mark_name] +endfunction +fun! s:GetPHReplacingMarkName(flt_rst) + let rctx = b:xptemplateData.renderContext + let mark_name = get(a:flt_rst, 'marks') + if mark_name is 0 + let mark_name = xpt#rctx#DefaultMarks(rctx) + endif + return mark_name +endfunction +fun! s:ActionFinish(renderContext,flt_rst) + let rctx = b:xptemplateData.renderContext + let [start,end] = s:GetLeaderOpPos(a:flt_rst) + if start[0] != 0 && end[0] != 0 + if a:flt_rst.rc isnot 0 + if has_key( a:flt_rst, 'text' ) + let text = s:IndentFilterText(a:flt_rst,start) + call XPreplace(start,end,text) + endif + endif + endif + if s:FinishCurrent( '' ) < 0 + return '' + endif + call cursor(XPMpos(rctx.leadingPlaceHolder.mark.end)) + let xptObj = b:xptemplateData + if empty(xptObj.stack) || 1 + return s:FinishRendering() + else + return '' + endif +endfunction +fun! s:FillinLeader(flt_rst) + let x = b:xptemplateData + let rctx = x.renderContext + let mark_name = s:GetPHReplacingMarkName(a:flt_rst) + let marks = rctx.leadingPlaceHolder[mark_name] + let [s,e] = XPMposStartEnd(marks) + if s[0] == 0 || e[0] == 0 + call s:Crash('leader marks not found:' . string(mark_name)) + return s:BROKEN + endif + if a:flt_rst.rc is 0 + return s:NONE + endif + if has_key( a:flt_rst, 'text' ) + call xpt#settingswitch#Switch(b:xptemplateData.settingWrap) + let text = s:IndentFilterText(a:flt_rst,s) + call XPreplace(s,e,text) + endif + call s:XPTupdate() + return s:DONE +endfunction +fun! s:BuildLeaderText(flt_rst) + let rctx = b:xptemplateData.renderContext + let mark_name = s:GetPHReplacingMarkName(a:flt_rst) + let marks = rctx.leadingPlaceHolder[mark_name] + if a:flt_rst.action == 'build' + let build_rc = s:BuildPlaceHolders(marks) + if build_rc is s:BROKEN + call s:Crash('building place holder failed') + elseif build_rc is s:BUILT + call s:RemoveCurrentMarks() + end + return build_rc + end + return s:NONE +endfunction +fun! s:DefaultValuePumHandler(renderContext,flt_rst) + let pumlen = len(a:flt_rst.pum) + if pumlen > 1 + return s:DefaultValueShowPum(a:renderContext,a:flt_rst) + endif + if pumlen == 0 + let a:flt_rst.text = '' + elseif pumlen == 1 + let a:flt_rst.text = a:flt_rst.pum[0] + endif + if s:FillinLeader(a:flt_rst) is s:BROKEN + return s:BROKEN + endif + return s:SelectCurrent() +endfunction +fun! s:DefaultValueShowPum(renderContext,flt_rst) + let leader = a:renderContext.leadingPlaceHolder + let [start,end] = XPMposStartEnd(leader.innerMarks) + call XPreplace( start, end, '') + call cursor(start) + call s:CallPlugin( 'ph_pum', 'before' ) + let pumsess = XPPopupNew(s:ItemPumCB,{},a:flt_rst.pum) + call pumsess.SetAcceptEmpty( get( a:flt_rst, 'acceptEmpty', g:xptemplate_ph_pum_accept_empty ) ) + call pumsess.SetOption({ 'tabNav':g:xptemplate_pum_tab_nav } ) + return pumsess.popup( col("."), { 'doCallback' : 1, 'enlarge' : 0 } ) +endfunction +fun! s:InitItem() + let renderContext = b:xptemplateData.renderContext + let currentItem = renderContext.item + let leaderMark = renderContext.leadingPlaceHolder.innerMarks + let currentItem.initValue = xpt#util#TextBetween(XPMposStartEnd(leaderMark)) + call xpt#rctx#SwitchPhase(renderContext,s:renderPhase.iteminit) + let postaction = s:ApplyDefaultValue() + let renderContext = b:xptemplateData.renderContext + if renderContext.processing && currentItem == renderContext.item + let renderContext.item.initValue = xpt#util#TextBetween(XPMposStartEnd(leaderMark)) + endif + if renderContext.phase == s:renderPhase.iteminit + call s:InitItemMapping() + call s:InitItemTempMapping() + call xpt#rctx#SwitchPhase(renderContext,s:renderPhase.fillin) + endif + return postaction +endfunction +fun! s:ApplyDefaultValue() + let rctx = b:xptemplateData.renderContext + let leader = rctx.leadingPlaceHolder + let defs = rctx.snipSetting.defaultValues + if has_key(defs,leader.name) && defs[leader.name].force + let filter = defs[leader.name] + else + let filter = get( leader, 'ontimeFilter', get(defs,leader.name, g:EmptyFilter)) + endif + if filter is g:EmptyFilter + call s:XPTupdate() + return s:SelectCurrent() + endif + let rctx.activeLeaderMarks = 'innerMarks' + let typed = xpt#util#TextBetween(XPMposStartEnd(leader.innerMarks)) + let flt_rst = s:EvalFilter(filter,[ rctx.ftScope.funcs, rctx.snipSetting.variables, { '$UserInput': typed } ] ) + if flt_rst.rc is 0 + return s:SelectCurrent() + endif + return s:HandleDefaultValueAction(flt_rst) +endfunction +fun! XPTmappingEval(str) + if pumvisible() + if XPPhasSession() + return XPPend() . "\=XPTmappingEval(" . string(a:str) . ")\" + else + return "\\\\=XPTmappingEval(" . string(a:str) . ")\" + endif + endif + let rc = s:XPTupdate() + if rc != 0 + return '' + endif + let x = b:xptemplateData + let typed = xpt#util#TextBetween( XPMposStartEnd( x.renderContext.leadingPlaceHolder.mark)) + let filter = xpt#flt#New(0,a:str) + let flt_rst = s:EvalFilter(filter,[ x.renderContext.ftScope.funcs, x.renderContext.snipSetting.variables, { '$UserInput' : typed } ] ) + if flt_rst.rc is 0 + return '' + endif + let postAction = s:HandleMapAction(flt_rst) + return postAction +endfunction +fun! s:InitItemMapping() + let renderContext = b:xptemplateData.renderContext + let mappings = renderContext.snipObject.setting.mappings + let item = renderContext.item + if has_key(mappings,item.name) + call xpt#msvr#Save(mappings[item.name].saver) + for [key,mapping] in items(mappings[item.name].keys) + exe 'inoremap ' key '=XPTmappingEval(' string( mapping.text ) ')' + endfor + endif +endfunction +fun! s:InitItemTempMapping() + let renderContext = b:xptemplateData.renderContext + let mappings = renderContext.tmpmappings + if !has_key( mappings, 'saver' ) + return + endif + for keys in mappings.keys + call xpt#msvr#Add( mappings.saver, 'i', keys[0] ) + endfor + call xpt#msvr#Save(mappings.saver) + for keys in mappings.keys + exe 'inoremap ' keys[0] '=XPTmappingEval(' string( keys[1] ) ')' + endfor +endfunction +fun! XPTmapKey(left,right) + let renderContext = b:xptemplateData.renderContext + let mappings = renderContext.tmpmappings + if renderContext.phase != s:renderPhase.iteminit + call s:log.Warn( "Not in [iteminit] phase, mapping ingored" ) + return + endif + if !has_key( mappings, 'saver' ) + let mappings.saver = xpt#msvr#New(1) + let mappings.keys = [] + endif + call add(mappings.keys,[a:left,a:right]) +endfunction +fun! s:ClearItemMapping(rctx) + let renderContext = a:rctx + let mappings = renderContext.tmpmappings + if has_key( mappings, 'saver' ) + call xpt#msvr#Restore(mappings.saver) + endif + let mappings = renderContext.snipObject.setting.mappings + let item = renderContext.item + if has_key(mappings,item.name) + call xpt#msvr#Restore(mappings[item.name].saver) + endif +endfunction +fun! s:SelectCurrent() + let ph = b:xptemplateData.renderContext.leadingPlaceHolder + let marks = ph.innerMarks + let [ctl,cbr] = XPMposStartEnd(marks) + if ctl == cbr + call cursor(ctl) + call XPMupdateStat() + return '' + else + call cursor(ctl) + call s:XPTvisual() + if &l:selection == 'exclusive' + call cursor(cbr) + else + if cbr[1] == 1 + call cursor( cbr[0] - 1, col( [ cbr[0] - 1, '$' ] ) ) + else + call cursor(cbr[0],cbr[1] - 1) + endif + endif + normal! v + if &selectmode =~ 'cmd' + call feedkeys( "\gv", 'nt' ) + else + call feedkeys( "\gv\", 'nt' ) + endif + call XPMupdateStat() + return '' + endif +endfunction +fun! s:EvalFilter(filter,closures) + let rctx = b:xptemplateData.renderContext + let snip = rctx.snipObject + let r = xpt#flt#Eval(snip,a:filter,a:closures) + call s:LoadFilterActionSnippet(r) + return r +endfunction +fun! s:LoadFilterActionSnippet(flt_rst) + let renderContext = b:xptemplateData.renderContext + if has_key( a:flt_rst, 'snippet' ) + let allsnip = renderContext.ftScope.allTemplates + let snipname = a:flt_rst.snippet + if has_key(allsnip,snipname) + let snip = allsnip[snipname] + call s:ParseSnippet(snip,renderContext.ftScope) + call s:MergeSetting(renderContext.snipSetting, snip.setting) + let a:flt_rst.text = snip.snipText + else + call XPT#warn( 'snippet "' . snipname . '" not found' ) + end + end +endfunction +fun! s:Goback() + let renderContext = b:xptemplateData.renderContext + return s:SelectCurrent() +endfunction +fun! s:XPTinitMapping() + let literal_chars = '' . 'abcdefghijklmnopqrstuvwxyz' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . '1234567890' . '!@#$%^&*()' . '`~-_=+[{]}\;:"'',<.>/?' + let literalKeys = split( literal_chars, '\V\s\*' ) + let literalKeys = map( literalKeys, '"s_".v:val' ) + [ 's_', 's_\|', ] + let b:mapSaver = xpt#msvr#New(1) + call xpt#msvr#AddList(b:mapSaver, 'i_' . g:xptemplate_nav_next, 's_' . g:xptemplate_nav_next, 'i_' . g:xptemplate_nav_prev, 's_' . g:xptemplate_nav_prev, 's_' . g:xptemplate_nav_cancel, 's_' . g:xptemplate_to_right, 'n_' . g:xptemplate_goback, 'i_' . g:xptemplate_goback, 'i_', 's_', 's_', ) + if g:xptemplate_nav_next_2 != g:xptemplate_nav_next + call xpt#msvr#AddList(b:mapSaver, 'i_' . g:xptemplate_nav_next_2, 's_' . g:xptemplate_nav_next_2, ) + endif + let b:mapLiteral = xpt#msvr#New(1) + call xpt#msvr#AddList(b:mapLiteral,literalKeys) + let b:xptemplateData.settingSwitch = xpt#settingswitch#New() + call xpt#settingswitch#AddList(b:xptemplateData.settingSwitch, [ '&l:textwidth', '0' ], [ '&l:lazyredraw', '1' ], [ '&l:indentkeys', { 'exe' : 'setl indentkeys-=*' } ], [ '&l:cinkeys', { 'exe' : 'setl cinkeys-=*' } ], ) + let b:xptemplateData.settingWrap = xpt#settingswitch#New() + call xpt#settingswitch#Add(b:xptemplateData.settingWrap, '&l:wrap', '1') +endfunction +fun! s:XPTCR() + let [ l, c ] = [ line( "." ), col( "." ) ] + let textFollowing = getline(l)[c - 1 :] + if textFollowing !~ '\V\^\s' || !&autoindent + return "\" + else + let spaces = matchstr( textFollowing, '\V\^\s\+' ) + return "\" . spaces . repeat( "\", len( spaces ) ) + endif +endfunction +fun! s:ApplyMap() + let x = b:xptemplateData + let renderContext = x.renderContext + call xpt#settingswitch#Switch(b:xptemplateData.settingSwitch) + call xpt#msvr#Save(b:mapSaver) + call xpt#msvr#Save(b:mapLiteral) + call xpt#msvr#UnmapAll(b:mapSaver) + call xpt#msvr#Literalize( b:mapLiteral, { 'insertAsSelect' : 1 } ) + exe 'inoremap ' g:xptemplate_nav_prev '=ShiftBackward()' + exe 'inoremap ' g:xptemplate_nav_next '=ShiftForward("")' + exe 'snoremap ' g:xptemplate_nav_cancel 'i=ShiftForward("clear")' + exe 'nnoremap ' g:xptemplate_goback 'i=Goback()' + exe 'inoremap ' g:xptemplate_goback ' =Goback()' + exe 'imap ' g:xptemplate_hook_before_cr . 'XPT_map_CR' + snoremap i + snoremap d + if g:xptemplate_nav_next_2 != g:xptemplate_nav_next + exe 'inoremap ' g:xptemplate_nav_next_2 '=ShiftForward("")' + exe 'snoremap ' g:xptemplate_nav_next_2 '`>a=ShiftForward("")' + endif + if &selection == 'inclusive' + exe 'snoremap ' g:xptemplate_nav_prev '`>a=ShiftBackward()' + exe 'snoremap ' g:xptemplate_nav_next '`>a=ShiftForward("")' + exe "snoremap ".g:xptemplate_to_right." `>a" + else + exe 'snoremap ' g:xptemplate_nav_prev '`>i=ShiftBackward()' + exe 'snoremap ' g:xptemplate_nav_next '`>i=ShiftForward("")' + exe "snoremap ".g:xptemplate_to_right." `>i" + endif +endfunction +fun! s:ClearMap() + call xpt#settingswitch#Restore(b:xptemplateData.settingSwitch) + call xpt#msvr#Restore(b:mapLiteral) + call xpt#msvr#Restore(b:mapSaver) +endfunction +fun! XPTbufData() + if !exists( 'b:xptemplateData' ) + call XPTemplateInit() + endif + return b:xptemplateData +endfunction +fun! XPTnewSnipScope(filename) + let sf = xpt#snipfile#New(a:filename) + let b:xptemplateData.snipFileScope = sf + return sf +endfunction +fun! XPTsnipScope() + return b:xptemplateData.snipFileScope +endfunction +fun! XPTemplateInit() + if exists( 'b:xptemplateData' ) + return + endif + call xpt#buf#New() + call XPMsetBufSortFunction( function( 'XPTmarkCompare' ) ) + call s:XPTinitMapping() +endfunction +fun! s:SynNameStack(l,c) + if exists( '*synstack' ) + let ids = synstack(a:l,a:c) + if empty(ids) + return [] + endif + let names = [] + for id in ids + let names = names + [synIDattr(id, "name")] + endfor + return names + else + return [synIDattr( synID( a:l, a:c, 0 ), "name" )] + endif +endfunction +fun! s:UpdateFollowingPlaceHoldersWith(contentTyped,option) + let renderContext = b:xptemplateData.renderContext + let useGroupPost = renderContext.phase == 'post' && has_key( a:option, 'post' ) + if useGroupPost + let group_flt_rst = a:option.post + endif + call XPRstartSession() + let phList = renderContext.item.placeHolders + try + for ph in phList + let flt = renderContext.phase == 'post' ? get( ph, 'postFilter', get( ph, 'ontimeFilter', g:EmptyFilter ) ) : get( ph, 'ontimeFilter', g:EmptyFilter ) + let phStartPos = XPMpos(ph.mark.start) + let [phln,phcol] = phStartPos + if flt isnot g:EmptyFilter + let flt_rst = s:EvalFilter(flt,[ renderContext.ftScope.funcs, renderContext.snipSetting.variables, { '$UserInput' : a:contentTyped } ] ) + elseif useGroupPost + let flt_rst = copy(group_flt_rst) + else + let flt_rst = { 'nIndent': -XPT#getIndentNr( phln, phcol ), 'text':a:contentTyped } + endif + let flttext = s:IndentFilterText(flt_rst,phStartPos) + let text = xpt#util#TextBetween(XPMposStartEnd(ph.mark)) + if text !=# flttext + call XPreplaceByMarkInternal(ph.mark.start,ph.mark.end,flttext) + endif + endfor + catch /.*/ + call XPT#error(v:exception) + finally + call XPRendSession() + endtry +endfunction +fun! s:Crash(...) + let msg = "XPTemplate session ends: " . join( a:000, "\n" ) + call XPPend() + let x = b:xptemplateData + call s:ClearItemMapping(x.renderContext) + while !empty(x.stack) + let rctx = remove(x.stack,-1) + call s:ClearItemMapping(rctx) + endwhile + call s:ClearMap() + let x.stack = [] + let x.renderContext = xpt#rctx#New(x) + call XPMflushWithHistory() + call XPT#warn(msg) + call s:CallPlugin( 'finishAll', 'after' ) + return '' +endfunction +fun! s:XPTupdateTyping() + let rc = s:XPTupdate() + if rc != 0 + return rc + endif + let renderContext = b:xptemplateData.renderContext + if 'fillin' != renderContext.phase + return rc + endif + let leader = renderContext.leadingPlaceHolder + let ontypeFilters = renderContext.snipSetting.ontypeFilters + let flt = get(ontypeFilters,leader.name,g:EmptyFilter) + if flt isnot g:EmptyFilter + call s:HandleOntypeFilter(flt) + endif + return rc +endfunction +fun! s:HandleOntypeFilter(filter) + let renderContext = b:xptemplateData.renderContext + let leader = renderContext.leadingPlaceHolder + let [start,end] = XPMposStartEnd(leader.mark) + let contentTyped = xpt#util#TextBetween([start,end]) + let flt_rst = s:EvalFilter(a:filter,[ renderContext.ftScope.funcs, renderContext.snipSetting.variables, { '$UserInput' : contentTyped } ] ) + if 0 is flt_rst.rc + return + endif + if has_key( flt_rst, 'action' ) + call s:HandleOntypeAction(renderContext,flt_rst) + endif +endfunction +fun! s:HandleOntypeAction(renderContext,flt_rst) + let postaction = s:HandleAction(a:flt_rst) + if '' != postaction + call feedkeys( postaction, 'n' ) + endif +endfunction +fun! s:HandleMapAction(flt_rst) + let rctx = b:xptemplateData.renderContext + if a:flt_rst.action == 'finishTemplate' + let postaction = s:ActionFinish(rctx,a:flt_rst) + return postaction + elseif a:flt_rst.action == '' + endif + let postaction = get(a:flt_rst, 'text', '') + if a:flt_rst.nav == 'next' + if rctx.processing + let postaction .= s:ShiftForward( '' ) + return postaction + else + return '' + endif + endif + return postaction +endfunction +fun! s:HandleAction(flt_rst) + let rctx = b:xptemplateData.renderContext + let [s,e] = s:GetLeaderOpPos(a:flt_rst) + let postaction = '' + if a:flt_rst.action == 'text' + if has_key( a:flt_rst, 'text' ) + call XPreplace(s,e,a:flt_rst.text) + endif + elseif a:flt_rst.action == 'finishTemplate' + let postaction = s:ActionFinish(rctx,a:flt_rst) + return postaction + elseif a:flt_rst.action == '' + endif + if a:flt_rst.nav == 'next' + if rctx.processing + let postaction = s:ShiftForward( '' ) + return postaction + else + return '' + endif + endif + return postaction +endfunction +fun! s:IsUpdateCondition(renderContext) + if a:renderContext.phase == 'uninit' + call XPMflushWithHistory() + return 0 + endif + if !a:renderContext.processing + call XPMupdate() + return 0 + endif + return 1 +endfunction +fun! s:UpdateMarksAccordingToLeaderChanges(renderContext) + let leaderMark = a:renderContext.leadingPlaceHolder.mark + let innerMarks = a:renderContext.leadingPlaceHolder.innerMarks + let [start,end] = XPMposList(leaderMark.start,leaderMark.end) + if start[0] == 0 || end[0] == 0 + throw 'XPM:mark_lost:' . string( start[0] == 0 ? leaderMark.start : leaderMark.end ) + endif + if XPMhas(innerMarks.start,innerMarks.end) + call XPMsetLikelyBetween(innerMarks.start,innerMarks.end) + else + call XPMsetLikelyBetween(leaderMark.start,leaderMark.end) + endif + let rc = XPMupdate() + if a:renderContext.phase == 'fillin' + if rc is g:XPM_RET.updated || (type(rc) == type([]) && (rc[0] != leaderMark.start && rc[0] != innerMarks.start || rc[1] != leaderMark.end && rc[1] != innerMarks.end)) + if g:xptemplate_strict == 2 + throw 'XPT:changes outside of place holder' + elseif g:xptemplate_strict == 1 + undo + call XPMupdate() + call XPT#warn( "editing OUTSIDE place holder is not allowed whne g:xptemplate_strict=1, use " . g:xptemplate_goback . " to go back" ) + return g:XPT_RC.canceled + else + endif + endif + endif + return rc +endfunction +fun! s:XPTupdate() + call XPTemplateInit() + let renderContext = b:xptemplateData.renderContext + if !s:IsUpdateCondition(renderContext) + return 0 + endif + try + let rc = s:UpdateMarksAccordingToLeaderChanges(renderContext) + if g:XPT_RC.canceled is rc + return 0 + endif + call s:DoUpdate(renderContext,rc) + return 0 + catch /^XP.*/ + call s:Crash(v:exception) + return -1 + finally + call XPMupdateStat() + endtry +endfunction +fun! s:DoUpdate(renderContext,changeType) + let renderContext = a:renderContext + let contentTyped = xpt#util#TextBetween(XPMposStartEnd(renderContext.leadingPlaceHolder.mark)) + call s:CallPlugin("update", 'before') + if type(a:changeType) == type([]) || a:changeType is g:XPM_RET.likely_matched || a:changeType is g:XPM_RET.no_updated_made + let relPos = s:RecordRelativePosToMark( [ line( '.' ), col( '.' ) ], renderContext.leadingPlaceHolder.mark.start ) + call s:UpdateFollowingPlaceHoldersWith(contentTyped,{}) + call s:GotoRelativePosToMark(relPos,renderContext.leadingPlaceHolder.mark.start) + else + endif + call s:CallPlugin('update', 'after') + let renderContext.lastContent = contentTyped +endfunction +fun! s:DoBreakUndo() + if pumvisible() + return "\\" + endif + return "\u" +endfunction +inoremap XPTdoBreakUndo =DoBreakUndo() +inoremap XPT_map_CR =XPTCR() +fun! s:BreakUndo() + if mode() != 'i' || pumvisible() + return + endif + let x = b:xptemplateData + if x.renderContext.processing + call feedkeys( "\XPTdoBreakUndo", 'm' ) + endif +endfunction +fun! s:RecordRelativePosToMark(pos,mark) + let p = XPMpos(a:mark) + if a:pos[0] == p[0] + return [0,a:pos[1] - p[1]] + else + return [a:pos[0] - p[0],a:pos[1]] + endif +endfunction +fun! s:GotoRelativePosToMark(rPos,mark) + let p = XPMpos(a:mark) + if a:rPos[0] == 0 + call cursor(p[0],a:rPos[1] + p[1]) + else + call cursor(p[0] + a:rPos[0],a:rPos[1]) + endif +endfunction +fun! s:XPTcheck() + if !exists( 'b:xptemplateData' ) + call XPTemplateInit() + endif + let x = b:xptemplateData + if x.wrap isnot '' + let x.wrapStartPos = 0 + let x.wrap = '' + endif + call s:CallPlugin( 'insertenter', 'after' ) +endfunction +fun! s:GetContextFT() + if exists( 'b:XPTfiletypeDetect' ) + return b:XPTfiletypeDetect() + elseif &filetype == '' + return 'unknown' + else + return &filetype + endif +endfunction +fun! s:GetContextFTObj() + let x = b:xptemplateData + let ft = s:GetContextFT() + call xpt#parser#loadSpecialFiletype(ft) + let ftScope = get(x.filetypes,ft,{}) + return ftScope +endfunction +augroup XPT + au! + au BufEnter * call XPTemplateInit() + au InsertEnter * call XPTcheck() + au CursorMoved,CursorMovedI * call XPTupdateTyping() + if g:xptemplate_strict == 1 + au CursorMovedI * call BreakUndo() + endif +augroup END +fun! g:XPTaddPlugin(event,when,func) + if has_key(s:plugins,a:event) + call add(s:plugins[a:event][a:when],a:func) + else + throw "XPT does NOT support event:".a:event + endif +endfunction +let s:plugins = {} +fun! s:CreatePluginContainer(...) + for evt in a:000 + let s:plugins[evt] = { 'before' : [], 'after' : []} + endfor +endfunction +call s:CreatePluginContainer( 'start', 'render', 'build', 'finishSnippet', 'finishAll', 'preValue', 'defaultValue', 'ph_pum', 'postFilter', 'initItem', 'nextItem', 'prevItem', 'update', 'insertenter', ) +delfunc s:CreatePluginContainer +fun! s:CallPlugin(ev,when) + let cnt = get(s:plugins,a:ev,{}) + let evs = get(cnt,a:when,[]) + if evs == [] + return + endif + let x = b:xptemplateData + for XPTplug in evs + call XPTplug(x,x.renderContext) + endfor +endfunction +com! XPTreload call XPTreload() +com! XPTcrash call Crash() +let &cpo = s:oldcpo diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/browse-and-basic.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/browse-and-basic.gif new file mode 100644 index 0000000..c57e530 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/browse-and-basic.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/c-ifee.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/c-ifee.gif new file mode 100644 index 0000000..175ed16 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/c-ifee.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/c-loop-and-wrapper.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/c-loop-and-wrapper.gif new file mode 100644 index 0000000..ed0214a Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/c-loop-and-wrapper.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/c-macro.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/c-macro.gif new file mode 100644 index 0000000..3364b97 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/c-macro.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/c-outline.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/c-outline.gif new file mode 100644 index 0000000..3f611c9 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/c-outline.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/py-class-def.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/py-class-def.gif new file mode 100644 index 0000000..a52d821 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/py-class-def.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/py-for-inline-cmpl.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/py-for-inline-cmpl.gif new file mode 100644 index 0000000..6576c03 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/py-for-inline-cmpl.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/py-optional-ph.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/py-optional-ph.gif new file mode 100644 index 0000000..b26e11d Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/py-optional-ph.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/py-quick-add.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/py-quick-add.gif new file mode 100644 index 0000000..2aacad7 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/py-quick-add.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/400x/py-try.gif b/vim-plugins/bundle/xptemplate/readme-img/400x/py-try.gif new file mode 100644 index 0000000..6069747 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/400x/py-try.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/browse-and-basic.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/browse-and-basic.gif new file mode 100644 index 0000000..3c6acff Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/browse-and-basic.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/c-ifee.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/c-ifee.gif new file mode 100644 index 0000000..1319685 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/c-ifee.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/c-loop-and-wrapper.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/c-loop-and-wrapper.gif new file mode 100644 index 0000000..585ba53 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/c-loop-and-wrapper.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/c-macro.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/c-macro.gif new file mode 100644 index 0000000..8f45948 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/c-macro.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/c-outline.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/c-outline.gif new file mode 100644 index 0000000..3665938 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/c-outline.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/py-class-def.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/py-class-def.gif new file mode 100644 index 0000000..9df3fde Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/py-class-def.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/py-for-inline-cmpl.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/py-for-inline-cmpl.gif new file mode 100644 index 0000000..eb18fbb Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/py-for-inline-cmpl.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/py-optional-ph.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/py-optional-ph.gif new file mode 100644 index 0000000..f0418b0 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/py-optional-ph.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/py-quick-add.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/py-quick-add.gif new file mode 100644 index 0000000..65c2d2b Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/py-quick-add.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/600x/py-try.gif b/vim-plugins/bundle/xptemplate/readme-img/600x/py-try.gif new file mode 100644 index 0000000..d1f5794 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/600x/py-try.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/c-pum-starts-with-f.png b/vim-plugins/bundle/xptemplate/readme-img/c-pum-starts-with-f.png new file mode 100644 index 0000000..082ecaf Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/c-pum-starts-with-f.png differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-box.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-box.gif new file mode 100644 index 0000000..49a5461 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-box.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-catrom.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-catrom.gif new file mode 100644 index 0000000..5c32fe7 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-catrom.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos2.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos2.gif new file mode 100644 index 0000000..8c14a99 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos2.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos3.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos3.gif new file mode 100644 index 0000000..3c6acff Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-lanczos3.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-mitchell.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-mitchell.gif new file mode 100644 index 0000000..4c3f1e9 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-mitchell.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-mix.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-mix.gif new file mode 100644 index 0000000..b73c0b7 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-mix.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/b-sample.gif b/vim-plugins/bundle/xptemplate/readme-img/samples/b-sample.gif new file mode 100644 index 0000000..49a5461 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/readme-img/samples/b-sample.gif differ diff --git a/vim-plugins/bundle/xptemplate/readme-img/samples/x.md b/vim-plugins/bundle/xptemplate/readme-img/samples/x.md new file mode 100644 index 0000000..133c55b --- /dev/null +++ b/vim-plugins/bundle/xptemplate/readme-img/samples/x.md @@ -0,0 +1,14 @@ +## b-box.gif +![](b-box.gif) +## b-catrom.gif +![](b-catrom.gif) +## b-lanczos2.gif +![](b-lanczos2.gif) +## b-lanczos3.gif +![](b-lanczos3.gif) +## b-mitchell.gif +![](b-mitchell.gif) +## b-mix.gif +![](b-mix.gif) +## b-sample.gif +![](b-sample.gif) diff --git a/vim-plugins/bundle/xptemplate/resource/xptLogo.gif b/vim-plugins/bundle/xptemplate/resource/xptLogo.gif new file mode 100644 index 0000000..3d1e548 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/resource/xptLogo.gif differ diff --git a/vim-plugins/bundle/xptemplate/resource/xptLogo.png b/vim-plugins/bundle/xptemplate/resource/xptLogo.png new file mode 100644 index 0000000..4fafc08 Binary files /dev/null and b/vim-plugins/bundle/xptemplate/resource/xptLogo.png differ diff --git a/vim-plugins/bundle/xptemplate/resource/xptLogo.svg b/vim-plugins/bundle/xptemplate/resource/xptLogo.svg new file mode 100644 index 0000000..c9ce167 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/resource/xptLogo.svg @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + XPTemplate + + + + + + T + + diff --git a/vim-plugins/bundle/xptemplate/syntax/xpt.vim b/vim-plugins/bundle/xptemplate/syntax/xpt.vim new file mode 100644 index 0000000..9575df8 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/syntax/xpt.vim @@ -0,0 +1,231 @@ +fun! s:GetMark() + + let cur = [ line( '.' ), col( '.' ) ] + + + call cursor( 0, 0 ) + let lnr = search( '^XPTemplate .*mark=..', 'c' ) + + if lnr == 0 + call cursor ( cur ) + return ['`', '^', '`^'] + endif + + let line = getline( lnr ) + + let marks = matchstr( line, '\Vmark=\zs\.\.' ) + + call cursor ( cur ) + return [ marks[0:0], marks[1:1], marks ] + +endfunction + +let s:m = s:GetMark() + +let s:escaped = '\%(\\\\\)\*\\' +let s:nonEscaped = + \ '\%(' + \ . '\%(\[^\\]\|\^\)' + \ . '\%(\\\\\)\*' + \ . '\)' + \ . '\@<=' + +let s:lr_chars = escape(s:m[2], '\]-^') + +let s:l = s:nonEscaped . s:m[0] +let s:r = s:nonEscaped . s:m[1] +let s:lr = s:nonEscaped . '\[' . s:lr_chars . ']' +let s:lq = '\%(' . s:l . '\)' +let s:rq = '\%(' . s:r . '\)' + +let s:non_lr_chars = '\[^' . s:lr_chars . ']' + +let s:l_escaped = s:escaped . s:m[0] +let s:r_escaped = s:escaped . s:m[1] +let s:lr_escaped = s:escaped . '\[' . s:lr_chars . ']' + +let s:non_mark_any = '\%(' . s:lr_escaped . '\|' . s:non_lr_chars . '\)\*' + + +setlocal foldmethod=syntax + + +syntax keyword XPTemplateSnippetKey XPTemplate nextgroup=XPTfileMeta skipwhite + +syntax region XPTfileMeta start=/./ end=/$/ contained +syntax match XPTfileMetaPair /\w\+=\S*/ containedin=XPTfileMeta + +" meta data values +syntax match XPTfileMetaValue_mark /=\S\{2}/ containedin=XPTfileMetaPair +syntax match XPTfileMetaValue_priority /=\%(all\|spec\|like\|lang\|sub\|personal\)\?\%([+-]\d*\)\?/ containedin=XPTfileMetaPair + +" meta data keys +syntax keyword XPTfileMetaKey_priority prio[rity] containedin=XPTfileMetaPair nextgroup=XPTfileMetaValue_priority +syntax keyword XPTfileMetaKey_mark mark containedin=XPTfileMetaPair nextgroup=XPTfileMetaValue_mark + + +" ================================== +" XPTvar command to define variables +" ================================== +syntax match XptVarValue /.*$/ containedin=XptVarBody +syntax region XptVarBody matchgroup=XptVarName start=/\$\w\+/ end=/$/ keepend skipwhite nextgroup=XptVarValue +syntax keyword XPTSnippetVar XPTvar nextgroup=XptVarBody skipwhite + + +" ================== +" XPTinclude command +" ================== +syntax match XptSnippetIncludeItemDir /\%(\w\+\/\)\+/ containedin=XptSnippetIncludeItem +syntax match XptSnippetIncludeItemFile /[a-zA-Z0-9_.*]\+\s*$/ containedin=XptSnippetIncludeItem +syntax match XptSnippetIncludeItem /[a-zA-Z0-9_.]\+\/.*/ containedin=XptSnippetIncludeBody +syntax region XptSnippetIncludeBody start=/^\s*\\/ end=/^\ze\s*[^\\ ]/ keepend skipwhite +syntax keyword XptSnippetInclude XPTinclude nextgroup=XptSnippetIncludeBody skipnl skipwhite +syntax keyword XptSnippetInclude XPTembed nextgroup=XptSnippetIncludeBody skipnl skipwhite + + + +" TODO escaping +syntax match XPTvariable /\$\w\+/ containedin=XPTmeta_value,XPTmeta_simpleHint,XPTxset_value +syntax match XPTvariable_quote /{\$\w\+}/ containedin=XPTmeta_value,XPTmeta_simpleHint,XPTxset_value + +" TODO escaping, quoted +syntax region XPTfunction start=/\w\+(/ end=/)/ containedin=XPTmeta_value,XPTmeta_simpleHint,XPTxset_value + + +exe 'syntax match XPTitemPost /\V' . s:non_mark_any . s:rq . '\{1,2}/ contains=XPTmark contained containedin=XPTsnippetBody' +" XPTitemB for distinguish coherent item +exe 'syntax match XPTitemB /\V' . s:l . '\_.\{-}' . s:r . '/ contains=XPTmark containedin=XPTsnippetBody nextgroup=XPTitemPost,XPTitem' +exe 'syntax match XPTitem /\V' . s:l . '\_.\{-}' . s:r . '/ contains=XPTmark containedin=XPTsnippetBody nextgroup=XPTitemPost,XPTitemB' +exe 'syntax match XPTinclusion /\VInclude:\zs\.\{-}\ze' . s:r . '/ contained containedin=XPTitem,XPTitemB' +exe 'syntax match XPTinclusion /\V:\zs\.\{-}\ze:' . s:r . '/ contained containedin=XPTitem,XPTitemB' +exe 'syntax match XPTcursor /\V' . s:l . 'cursor' . s:r . '/ contained containedin=XPTitem,XPTitemB' +exe 'syntax match XPTvariable /\V' . '$\w\+' . '/ contained containedin=XPTitem,XPTitemB' +exe 'syntax match XPTvariable_quote /\V{' . '$\w\+' . '}/ contained containedin=XPTitem,XPTitemB' +exe 'syntax match XPTmark /\V' . s:r . '/ contains=XPTmark containedin=XPTitem,XPTitemB' + +" the end pattern is weird. +" \%(^$)^XPT\s does not work. +syntax match XPTxset /^XSET\s\+\%(\w\|[.?*]\)\+\([|.]\%(pre\|def\|post\|ontype\)\)\?=.*/ containedin=XPTsnippetBody +syntax region XPTxsetm start=/^XSETm\s\+/ end=/XSETm END$/ containedin=XPTsnippetBody fold +syntax keyword XPTkeyword_XSET XSET containedin=XPTxset nextgroup=XPTxset_name1,XPTxset_name2,XPTxset_name3 skipwhite transparent +" priorities are low to high +syntax match XPTxset_value /.*/ containedin=XPTxset transparent +syntax match XPTxset_eq /=/ containedin=XPTxset nextgroup=XPTxset_value transparent +syntax match XPTxset_type /[|.]\%(pre\|def\|post\|ontype\)\|\ze=/ containedin=XPTxset nextgroup=XPTxset_eq transparent +syntax match XPTxset_name3 /\%(\w\|\.\)*/ containedin=XPTxset nextgroup=XPTxset_type transparent +syntax match XPTxset_name2 /\%(\w\|\.\)*\ze\./ containedin=XPTxset nextgroup=XPTxset_type transparent +syntax match XPTxset_name1 /\%(\w\|\.\)*\ze|/ containedin=XPTxset nextgroup=XPTxset_type transparent + +syntax keyword XPTkeyword_XPT XPT nextgroup=XPTsnippetName skipwhite +syntax match XPTsnippetTitle /.*$/ contained nextgroup=XPTsnippetBody,XPTkeyword_XPT skipwhite skipnl skipempty +syntax match XPTsnippetName /\S\+/ contained nextgroup=XPTmeta,XPTmetaAlias,XPTsnippetTitle,XPTsnippetBody skipwhite skipempty +syntax match XPTend /\.\.XPT/ contained containedin=XPTsnippetBody +syntax match XPTnotKey /\\XPT/ contained containedin=XPTsnippetBody + + +" escaped white space or non-space +syntax match XPTmeta /\w\(\\\s\|\S\)\+/ containedin=XPTsnippetTitle nextgroup=XPTmeta,XPTmetaAlias,XPTmeta_simpleHint skipwhite skipnl skipempty + +syntax match XPTmeta_simpleHint /\V\(\\\*\)\1"\.\*/ contained containedin=XPTsnippetTitle + +syntax match XPTmetaAlias /alias=\S\+/ nextgroup=XPTmeta,XPTsnippetBody,XPTkeyword_XPT skipwhite skipnl skipempty +syntax match XPTmetaAlias_name /\S\+\ze=/ contained containedin=XPTmetaAlias +syntax match XPTmetaAlias_value /=\zs\S\+/ contained containedin=XPTmetaAlias + +syntax match XPTmeta_name /\w\+\ze=\?/ containedin=XPTmeta nextgroup=XPTmeta_value +syntax keyword XPTmeta_name_key hint alias synonym hidden wrap wraponly abbr syn contained containedin=XPTmeta_name +syntax match XPTmeta_value /=\zs\(\\\s\|\S\)*/ containedin=XPTmeta + +syntax region XPTsnippetBody start=/^/ end=/\ze\%(^$\n\)*\%$\|\ze\%(^$\n\)*XPT\s\|^\.\.XPT\|\ze\(^".*\n\|^\s*\n\)*\(^XPT\s\|\%$\|^".*\%$\|^\s*\%$\)/ contained containedin=XPTsnippetTitle contains=XPTxset excludenl fold + +syntax match XPThintMark /\V \zs**\ze / contained containedin=vimLineComment +syntax match vimLineComment /^".*$/ containedin=XPTregion contains=@vimCommentGroup,vimCommentString,vimCommentTitle + + +syntax match XPTbadIndent /^\( \)*\zs \{1,3}\ze\%(\S\|$\)/ contained containedin=XPTsnippetBody +syntax match XPTbadIndent /^\s*\zs\t/ contained containedin=XPTsnippetBody + + + + + +" syntax keyword TemplateKey XSETm indent hint syn priority containedin=XPTsnippetTitle + + + + +" ======================= +" Xpt snippets definition +" ======================= +syntax region XPTregion start=/^/ end=/\%$/ contained contains=XPTsnippetTitle + + +hi def link XPTfileMetaPair Normal +hi def link XPTfileMetaKey_priority Identifier +hi def link XPTfileMetaValue_priority Constant +hi def link XPTfileMetaKey_mark Identifier +hi def link XPTfileMetaValue_mark Constant + +hi def link XptVarBody Error +hi def link XptVarName Constant +hi def link XptVarValue Normal + +hi def link XptSnippetIncludeItemFile String +hi def link XptSnippetIncludeItemDir Directory +hi def link XptSnippetIncludeItem Directory +hi def link XptSnippetIncludeBody Normal +hi def link XptSnippetInclude Statement + + +hi def link XPTsnippetTitle Statement +hi def link XPTsnippetName Label +hi def link XPTmeta Normal +hi def link XPTmeta_name Error +hi def link XPTmeta_name_key Identifier +hi def link XPTmeta_value String +hi def link XPTmetaAlias_name XPTmeta_name_key +hi def link XPTmetaAlias_value XPTsnippetName +hi def link XPTmeta_simpleHint Comment +hi def link XPTsnippetBody Normal +hi def link XPTcomment Comment +hi def link XPT_END Folded +hi def link XPTxset Comment +hi def link XPTxsetm Comment +" hi def link XPTxset_name1 Function +" hi def link XPTxset_name2 Function +" hi def link XPTxset_name3 Function +hi def link XPTxset_type Constant +hi def link XPTxset_eq Operator +hi def link XPTxset_value Normal +hi def link XPTregion SpecialKey +hi def link XPTitem CursorLine +if has('gui_running') + hi def link XPTitemB CursorColumn +else + hi def link XPTitemB XPTitem +endif +hi def link XPTinclusion XPTsnippetName +" hi def link XPTcursor TabLineSel +hi def link XPTcursor StatusLine +hi def link XPTitemPost WildMenu +hi def link XPTvariable Constant +hi def link XPTvariable_quote Constant +hi def link XPTfunction Function + +hi def link XPTbadIndent Error + +" not implemented +hi def link XPTmark NonText +hi def link TemplateKey Title + +hi def link XPThintMark Label + +hi def link XPTemplateSnippetKey Statement +hi def link XPTSnippetVar Statement +hi def link XPTkeyword_XPT Statement +" hi def link XPTkeyword_XSET Comment +" hi def link XPTkeyword_XSET Preproc +hi def link XPTkeyword_hint Statement + + +" vim: set ts=8 sw=4 sts=4: diff --git a/vim-plugins/bundle/xptemplate/syntax/xptlog.vim b/vim-plugins/bundle/xptemplate/syntax/xptlog.vim new file mode 100644 index 0000000..c1b16d6 --- /dev/null +++ b/vim-plugins/bundle/xptemplate/syntax/xptlog.vim @@ -0,0 +1,9 @@ +syn match xptlogStack /^\w\+:::.*/ contains=xptlogFunctionName,xptlogLevel +syn match xptlogLevel /^\w\+\ze:::/ contained +syn match xptlogFunctionName /[^:.]\+\ze\%(\.\.\|$\)/ contained contains=xptlogFunctionSID +syn match xptlogFunctionSID /\d\+_/ + +hi def link xptlogStack Statement +hi def link xptlogLevel Label +hi def link xptlogFunctionName Function +hi def link xptlogFunctionSID Title diff --git a/vim-plugins/bundle/xptemplate/xpt-err b/vim-plugins/bundle/xptemplate/xpt-err new file mode 100644 index 0000000..27bb21e --- /dev/null +++ b/vim-plugins/bundle/xptemplate/xpt-err @@ -0,0 +1,14 @@ +vim nginx.conf +press ' +Messages maintainer: Bram Moolenaar +Error detected while processing function XPTtgr..XPTemplateStart..156_DoStart..156_RenderSnippet..156_BuildSnippet..156_BuildPlaceHolders..156_NextLeftM +ark: +line 40: +E121: Undefined variable: content +Error detected while processing function XPTtgr..XPTemplateStart..156_DoStart..156_RenderSnippet..156_BuildSnippet..156_BuildPlaceHolders..156_NextLeftM +ark: +line 40: +E116: Invalid arguments for function len( content ) / 2 ) +Error detected while processing function XPTtgr..XPTemplateStart..156_DoStart..156_RenderSnippet..156_BuildSnippet..156_BuildPlaceHolders..156_NextLeftM +ark: +line 40: diff --git a/vim-plugins/colors/mayansmoke.vim b/vim-plugins/colors/mayansmoke.vim new file mode 100644 index 0000000..6d146f8 --- /dev/null +++ b/vim-plugins/colors/mayansmoke.vim @@ -0,0 +1,343 @@ +" ============================================================================= +" +" File: mayansmoke.vim +" Description: Vim color scheme file +" Maintainer: Jeet Sukumaran (GUI colors); Clayton Parker (cterm colors) +" +" ============================================================================= + +" Initialization and Setup {{{1 +" ============================================================================= +set background=light +highlight clear +if exists("syntax_on") + syntax reset +endif +let colors_name = "mayansmoke" +" }}} + +" Normal Color {{{1 +" ============================================================================= +hi Normal gui=NONE guifg=Black guibg=#F4F4E8 +" }}} + +" Highlight Groups {{{1 +" ============================================================================= +" Groups (see ':help highlight-groups'): +" ColorColumn highlight to use with ':set colorcolumn' +" Cursor the character under the cursor +" CursorIM like Cursor, but used when in IME mode |CursorIM| +" CursorColumn the screen column that the cursor is in when 'cursorcolumn' is set +" CursorLine the screen line that the cursor is in when 'cursorline' is set +" Directory directory names (and other special names in listings) +" DiffAdd diff mode: Added line |diff.txt| +" DiffChange diff mode: Changed line |diff.txt| +" DiffDelete diff mode: Deleted line |diff.txt| +" DiffText diff mode: Changed text within a changed line |diff.txt| +" ErrorMsg error messages on the command line +" VertSplit the column separating vertically split windows +" Folded line used for closed folds +" FoldColumn 'foldcolumn' +" SignColumn column where |signs| are displayed +" IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c" +" LineNr Line number for ":number" and ":#" commands, and when 'number' option is set. +" MatchParen The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| +" ModeMsg 'showmode' message (e.g., "-- INSERT --") +" MoreMsg |more-prompt| +" NonText '~' and '@' at the end of the window, etc. +" Normal normal text +" Pmenu Popup menu: normal item. +" PmenuSel Popup menu: selected item. +" PmenuSbar Popup menu: scrollbar. +" PmenuThumb Popup menu: Thumb of the scrollbar. +" Question |hit-enter| prompt and yes/no questions +" Search Last search pattern highlighting (see 'hlsearch'). +" SpecialKey Meta and special keys listed with ":map", text that is displayed differently from what it really is (such as tabs, spaces in listchars etc.). +" SpellBad Word that is not recognized by the spellchecker. |spell| +" SpellCap Word that should start with a capital. |spell| +" SpellLocal Word that is recognized by the spellchecker as one that is +" SpellRare Word that is recognized by the spellchecker as one that is hardly ever used. |spell| +" StatusLine status line of current window +" StatusLineNC status lines of not-current windows +" TabLine tab pages line, not active tab page label +" TabLineFill tab pages line, where there are no labels +" TabLineSel tab pages line, active tab page label +" Title titles for output from ":set all", ":autocmd" etc. +" Visual Visual mode selection +" VisualNOS Visual mode selection when vim is "Not Owning the Selection". +" WarningMsg warning messages +" WildMenu current match in 'wildmenu' completion +hi ColorColumn guifg=NONE guibg=#EEEEDD +hi Cursor guifg=bg guibg=fg gui=NONE +if hlexists('MayanSmokeCursorLine') + hi link CursorColumn MayanSmokeCursorLine + hi link CursorLine MayanSmokeCursorLine +elseif exists('g:mayansmoke_cursor_line_visibility') && g:mayansmoke_cursor_line_visibility >= 2 + hi CursorColumn guifg=NONE guibg=NavajoWhite gui=NONE + hi CursorLine guifg=NONE guibg=NavajoWhite gui=NONE +elseif exists('g:mayansmoke_cursor_line_visibility') && g:mayansmoke_cursor_line_visibility >= 1 + hi CursorColumn guifg=NONE guibg=white gui=NONE + hi CursorLine guifg=NONE guibg=white gui=NONE +else + hi CursorColumn guifg=NONE guibg=#FFFDD0 gui=NONE + hi CursorLine guifg=NONE guibg=#FFFDD0 gui=NONE +endif +hi CursorIM guifg=bg guibg=fg gui=NONE +hi lCursor guifg=bg guibg=fg gui=NONE +hi DiffAdd guifg=NONE guibg=SeaGreen1 gui=NONE +hi DiffChange guifg=NONE guibg=LightSkyBlue1 gui=NONE +hi DiffDelete guifg=NONE guibg=LightCoral gui=NONE +hi DiffText guifg=black guibg=LightCyan1 gui=NONE +hi Directory guifg=#1600FF guibg=bg gui=NONE +hi ErrorMsg guifg=Red2 guibg=NONE gui=NONE +hi FoldColumn guifg=SteelBlue4 guibg=LightYellow2 gui=bold +hi Folded guifg=SteelBlue4 guibg=Gainsboro gui=italic +if hlexists('MayanSmokeSearch') + hi link IncSearch MayanSmokeSearch + hi link Search MayanSmokeSearch +elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility >= 4 + hi IncSearch guifg=white guibg=red gui=NONE + hi Search guifg=white guibg=red gui=NONE +elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 3 + hi IncSearch guifg=black guibg=gold gui=NONE + hi Search guifg=black guibg=gold gui=NONE +elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 2 + hi IncSearch guifg=white guibg=darkorange gui=NONE + hi Search guifg=white guibg=darkorange gui=NONE +elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 0 + hi IncSearch guifg=black guibg=tan gui=NONE + hi Search guifg=black guibg=tan gui=NONE +else + hi IncSearch guifg=black guibg=khaki gui=NONE + hi Search guifg=black guibg=khaki gui=NONE +endif +hi LineNr guifg=#666677 guibg=#cccfbf gui=NONE +hi MatchParen guifg=black guibg=LemonChiffon3 gui=bold +hi ModeMsg guifg=White guibg=tomato1 gui=bold +hi MoreMsg guifg=SeaGreen4 guibg=bg gui=bold +hi NonText guifg=LightCyan3 guibg=bg gui=bold + +hi Pmenu guifg=Orange4 guibg=LightYellow3 gui=NONE +hi PmenuSel guifg=ivory2 guibg=NavajoWhite4 gui=bold +hi PmenuSbar guifg=White guibg=#999666 gui=NONE +hi PmenuThumb guifg=White guibg=#7B7939 gui=NONE + +hi Question guifg=Chartreuse4 guibg=bg gui=bold +hi SignColumn guifg=white guibg=LightYellow3 gui=NONE +if hlexists('MayanSmokeSpecialKey') + hi link SpecialKey MayanSmokeSpecialKey +elseif exists('g:mayansmoke_special_key_visibility') && g:mayansmoke_special_key_visibility >= 2 + hi SpecialKey guifg=black guibg=NavajoWhite gui=NONE +elseif exists('g:mayansmoke_special_key_visibility') && g:mayansmoke_special_key_visibility == 0 + hi SpecialKey guifg=bisque3 guibg=NONE gui=NONE +else + hi SpecialKey guifg=white guibg=ivory3 gui=NONE +endif +hi SpellBad guisp=Firebrick2 gui=undercurl +hi SpellCap guisp=Blue gui=undercurl +hi SpellLocal guisp=DarkCyan gui=undercurl +hi SpellRare guisp=Magenta gui=undercurl +hi StatusLine guifg=#FFFEEE guibg=#557788 gui=NONE +" hi StatusLineNC guifg=#EAE6E2 guibg=LightSteelBlue3 gui=italic +hi StatusLineNC guifg=#F4F4EE guibg=#99aabb gui=italic +hi TabLine guifg=fg guibg=LightGrey gui=underline +hi TabLineFill guifg=fg guibg=bg gui=reverse +hi TabLineSel guifg=fg guibg=bg gui=bold +hi Title guifg=DeepSkyBlue3 guibg=bg gui=bold +hi VertSplit guifg=#99aabb guibg=#99aabb +hi Visual guifg=white guibg=DeepSkyBlue1 gui=NONE +hi WarningMsg guifg=Firebrick2 guibg=bg gui=NONE +hi WildMenu guifg=Black guibg=SkyBlue gui=NONE +" }}} + +" 256-Color Terminal Colors, by Clayton Parker {{{1 +" ============================================================================= +hi Normal cterm=NONE ctermfg=16 ctermbg=255 +hi Comment ctermfg=110 +hi Constant ctermfg=214 + hi String ctermfg=30 + hi Boolean ctermfg=88 +hi Identifier ctermfg=160 +hi Function ctermfg=132 +hi Statement ctermfg=21 +hi Keyword ctermfg=45 +hi PreProc ctermfg=27 +hi Type ctermfg=147 +hi Special ctermfg=64 +hi Ignore ctermfg=255 +hi Error ctermfg=196 ctermbg=255 term=none +hi Todo ctermfg=136 ctermbg=255 cterm=NONE +hi VimError ctermfg=160 ctermbg=16 +hi VimCommentTitle ctermfg=110 +hi qfLineNr ctermfg=16 ctermbg=46 cterm=NONE +hi pythonDecorator ctermfg=208 ctermbg=255 cterm=NONE +hi Cursor ctermfg=255 ctermbg=16 cterm=NONE +hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE +hi CursorIM ctermfg=255 ctermbg=16 cterm=NONE +hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE +hi lCursor ctermfg=255 ctermbg=16 cterm=NONE +hi DiffAdd ctermfg=16 ctermbg=48 cterm=NONE +hi DiffChange ctermfg=16 ctermbg=153 cterm=NONE +hi DiffDelete ctermfg=16 ctermbg=203 cterm=NONE +hi DiffText ctermfg=16 ctermbg=226 cterm=NONE +hi Directory ctermfg=21 ctermbg=255 cterm=NONE +hi ErrorMsg ctermfg=160 ctermbg=NONE cterm=NONE +hi FoldColumn ctermfg=24 ctermbg=252 cterm=NONE +hi Folded ctermfg=24 ctermbg=252 cterm=NONE +hi IncSearch ctermfg=255 ctermbg=160 cterm=NONE +hi LineNr ctermfg=253 ctermbg=110 cterm=NONE +hi NonText ctermfg=110 ctermbg=255 cterm=NONE +hi Pmenu ctermfg=fg ctermbg=195 cterm=NONE +hi PmenuSbar ctermfg=255 ctermbg=153 cterm=NONE +hi PmenuSel ctermfg=255 ctermbg=21 cterm=NONE +hi PmenuThumb ctermfg=111 ctermbg=255 cterm=NONE +hi SignColumn ctermfg=110 ctermbg=254 cterm=NONE +hi Search ctermfg=255 ctermbg=160 cterm=NONE +hi SpecialKey ctermfg=255 ctermbg=144 cterm=NONE +hi SpellBad ctermfg=16 ctermbg=229 cterm=NONE +hi SpellCap ctermfg=16 ctermbg=231 cterm=NONE +hi SpellLocal ctermfg=16 ctermbg=231 cterm=NONE +hi SpellRare ctermfg=16 ctermbg=226 cterm=NONE +hi StatusLine ctermfg=255 ctermbg=24 cterm=NONE +hi StatusLineNC ctermfg=253 ctermbg=110 cterm=NONE +hi Title ctermfg=75 ctermbg=255 cterm=NONE +hi VertSplit ctermfg=255 ctermbg=24 cterm=NONE +hi Visual ctermfg=255 ctermbg=153 cterm=NONE +hi WildMenu ctermfg=16 ctermbg=117 cterm=NONE + +" 1}}} + +" Syntax {{{1 +" ============================================================================= + +" General {{{2 +" ----------------------------------------------------------------------------- +" Groups ('*' = major; see 'help group-name'): +" *Comment any comment +" *Constant any constant +" String a string constant: "this is a string" +" Character a character constant: 'c', '\n' +" Number a number constant: 234, 0xff +" Boolean a boolean constant: TRUE, false +" Float a floating point constant: 2.3e10 +" *Identifier any variable name +" Function function name (also: methods for classes) +" *Statement any statement +" Conditional if, then, else, endif, switch, etc. +" Repeat for, do, while, etc. +" Label case, default, etc. +" Operator "sizeof", "+", "*", etc. +" Keyword any other keyword +" Exception try, catch, throw +" *PreProc generic Preprocessor +" Include preprocessor #include +" Define preprocessor #define +" Macro same as Define +" PreCondit preprocessor #if, #else, #endif, etc. +" *Type int, long, char, etc. +" StorageClass static, register, volatile, etc. +" Structure struct, union, enum, etc. +" Typedef A typedef +" *Special any special symbol +" SpecialChar special character in a constant +" Tag you can use CTRL-] on this +" Delimiter character that needs attention +" SpecialComment special things inside a comment +" Debug debugging statements +" *Error any erroneous construct +" *Todo anything that needs extra attention +" hi Comment guifg=#A2B5CD guibg=NONE gui=italic +hi Comment guifg=#96AAC2 guibg=NONE gui=italic +hi Constant guifg=DarkOrange guibg=NONE gui=NONE + hi String guifg=Aquamarine4 guibg=NONE gui=NONE + hi Boolean guifg=IndianRed4 guibg=NONE gui=NONE +hi Identifier guifg=brown3 guibg=NONE gui=NONE +hi Function guifg=VioletRed4 guibg=NONE gui=NONE +hi Statement guifg=blue1 guibg=NONE gui=NONE +hi Keyword guifg=DodgerBlue guibg=NONE gui=NONE +hi PreProc guifg=blue1 guibg=NONE gui=NONE +hi Type guifg=LightSlateBlue guibg=NONE gui=NONE +hi Special guifg=DarkOliveGreen4 guibg=NONE gui=NONE +hi Ignore guifg=bg guibg=NONE gui=NONE +hi Error guifg=Red guibg=NONE gui=underline +hi Todo guifg=tan4 guibg=NONE gui=underline +" 2}}} + +" Vim {{{2 +" ----------------------------------------------------------------------------- +hi VimError guifg=red guibg=Black gui=bold +hi VimCommentTitle guifg=DarkSlateGray4 guibg=bg gui=bold,italic +" 2}}} + +" QuickFix {{{2 +" ----------------------------------------------------------------------------- + +" syn match qfFileName "^[^|]*" nextgroup=qfSeparator +" syn match qfSeparator "|" nextgroup=qfLineNr contained +" syn match qfLineNr "[^|]*" contained contains=qfError +" syn match qfError "error" contained +hi qfFileName guifg=LightSkyBlue4 guibg=NONE gui=italic +hi qfLineNr guifg=coral guibg=NONE gui=bold +hi qfError guifg=red guibg=NONE gui=bold +" 2}}} + +" Python {{{2 +" ----------------------------------------------------------------------------- +hi pythonDecorator guifg=orange3 guibg=NONE gui=bold +hi link pythonDecoratorFunction pythonDecorator +" 2}}} + +" Diff {{{2 +" ----------------------------------------------------------------------------- +hi diffOldFile guifg=#006666 guibg=NONE gui=NONE +hi diffNewFile guifg=#0088FF guibg=NONE gui=bold +hi diffFile guifg=#0000FF guibg=NONE gui=NONE +hi link diffOnly Constant +hi link diffIdentical Constant +hi link diffDiffer Constant +hi link diffBDiffer Constant +hi link diffIsA Constant +hi link diffNoEOL Constant +hi link diffCommon Constant +hi diffRemoved guifg=#BB0000 guibg=NONE gui=NONE +hi diffChanged guifg=DarkSeaGreen guibg=NONE gui=NONE +hi diffAdded guifg=#00AA00 guibg=NONE gui=NONE +hi diffLine guifg=thistle4 guibg=NONE gui=italic +hi link diffSubname diffLine +hi link diffComment Comment +" 2}}} + +" PHP (contributed by Ryan Kulla) {{{2 +" ----------------------------------------------------------------------------- +" Ryan Kulla's addition for PHP syntax highlighting (for regular/terminal vim) +hi phpConditional ctermfg=21 cterm=NONE guifg=black +hi phpIdentifier ctermfg=0 cterm=NONE guifg=black +hi phpOperator ctermfg=black cterm=NONE guifg=black +hi phpRegion ctermfg=132 cterm=NONE guifg=VioletRed4 +hi phpComparison ctermfg=black cterm=NONE guifg=black +hi phpType ctermfg=darkgreen cterm=NONE guifg=darkgreen +hi phpParent ctermfg=black cterm=NONE guifg=black +hi phpMethodsVar ctermfg=132 cterm=NONE guifg=VioletRed4 +hi phpStatement ctermfg=21 cterm=NONE guifg=blue +hi phpStorageClass ctermfg=21 cterm=NONE guifg=blue +hi phpStringSingle ctermfg=30 cterm=NONE guifg=Aquamarine4 +hi phpStringDouble ctermfg=30 cterm=NONE guifg=Aquamarine4 +hi phpFunctions ctermfg=21 cterm=NONE guifg=blue +hi phpSpecialFunction ctermfg=21 cterm=NONE guifg=blue +hi phpRepeat ctermfg=21 cterm=NONE guifg=blue +hi phpNumber ctermfg=214 cterm=bold guifg=brown +hi phpTodo ctermfg=red cterm=bold guifg=red gui=bold +hi phpDefine ctermfg=21 cterm=NONE guifg=blue +hi phpConstant ctermfg=21 cterm=NONE guifg=black +hi phpCoreConstant ctermfg=21 cterm=NONE guifg=black +hi phpMemberSelector ctermfg=black cterm=NONE guifg=black +hi phpLabel ctermfg=21 cterm=NONE guifg=blue +hi phpStructure ctermfg=black cterm=NONE guifg=black +hi phpRelation ctermfg=black cterm=NONE guifg=black +hi phpEnvVar ctermfg=black cterm=NONE guifg=black +hi phpIntVar ctermfg=0 cterm=bold guifg=black gui=bold +hi phpBoolean ctermfg=58 cterm=NONE guifg=brown +" 2}}} + +" 1}}} + diff --git a/vim-plugins/colors/wombat256mod.vim b/vim-plugins/colors/wombat256mod.vim new file mode 100644 index 0000000..1137eb8 --- /dev/null +++ b/vim-plugins/colors/wombat256mod.vim @@ -0,0 +1,96 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Modified version of wombat for 256-color terminals by +" David Liang (bmdavll@gmail.com) +" based on version by +" Danila Bespalov (danila.bespalov@gmail.com) + +set background=dark + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let colors_name = "wombat256mod" + + +" General colors +hi Normal ctermfg=252 ctermbg=234 cterm=none guifg=#e3e0d7 guibg=#242424 gui=none +hi Cursor ctermfg=234 ctermbg=228 cterm=none guifg=#242424 guibg=#eae788 gui=none +hi Visual ctermfg=251 ctermbg=239 cterm=none guifg=#c3c6ca guibg=#554d4b gui=none +hi VisualNOS ctermfg=251 ctermbg=236 cterm=none guifg=#c3c6ca guibg=#303030 gui=none +hi Search ctermfg=177 ctermbg=241 cterm=none guifg=#d787ff guibg=#636066 gui=none +hi Folded ctermfg=103 ctermbg=237 cterm=none guifg=#a0a8b0 guibg=#3a4046 gui=none +hi Title ctermfg=230 cterm=bold guifg=#ffffd7 gui=bold +hi StatusLine ctermfg=230 ctermbg=238 cterm=none guifg=#ffffd7 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=241 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=241 ctermbg=232 cterm=none guifg=#857b6f guibg=#080808 gui=none +hi SpecialKey ctermfg=241 ctermbg=235 cterm=none guifg=#626262 guibg=#2b2b2b gui=none +hi WarningMsg ctermfg=203 guifg=#ff5f55 +hi ErrorMsg ctermfg=196 ctermbg=236 cterm=bold guifg=#ff2026 guibg=#3a3a3a gui=bold + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#32322f +hi MatchParen ctermfg=228 ctermbg=101 cterm=bold guifg=#eae788 guibg=#857b6f gui=bold +hi Pmenu ctermfg=230 ctermbg=238 guifg=#ffffd7 guibg=#444444 +hi PmenuSel ctermfg=232 ctermbg=192 guifg=#080808 guibg=#cae982 +endif + +" Diff highlighting +hi DiffAdd ctermbg=17 guibg=#2a0d6a +hi DiffDelete ctermfg=234 ctermbg=60 cterm=none guifg=#242424 guibg=#3e3969 gui=none +hi DiffText ctermbg=53 cterm=none guibg=#73186e gui=none +hi DiffChange ctermbg=237 guibg=#382a37 + +"hi CursorIM +"hi Directory +"hi IncSearch +"hi Menu +"hi ModeMsg +"hi MoreMsg +"hi PmenuSbar +"hi PmenuThumb +"hi Question +"hi Scrollbar +"hi SignColumn +"hi SpellBad +"hi SpellCap +"hi SpellLocal +"hi SpellRare +"hi TabLine +"hi TabLineFill +"hi TabLineSel +"hi Tooltip +"hi User1 +"hi User9 +"hi WildMenu + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Statement ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Type ctermfg=186 cterm=none guifg=#d4d987 gui=none +hi Special ctermfg=229 cterm=none guifg=#eadead gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#9c998e gui=italic +hi Todo ctermfg=101 cterm=none guifg=#857b6f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine +hi! link NonText LineNr + +" vim:set ts=4 sw=4 noet: diff --git a/vim-plugins/filetype.vim b/vim-plugins/filetype.vim new file mode 100644 index 0000000..1e90db3 --- /dev/null +++ b/vim-plugins/filetype.vim @@ -0,0 +1,7 @@ +au BufRead,BufNewFile *.inc,*.ihtml,*.tpl,*.class set filetype=php + \ | let Comment="" +au BufRead,BufNewFile *.py,*.sh,*.pl,*.tcl let Comment="#" | let EndComment="" +au BufRead,BufNewFile *.js set filetype=html | let Comment="//" | let EndComment="" +au BufRead,BufNewFile *.cc,*.php,*.cxx let Comment="//" | let EndComment="" +au BufRead,BufNewFile *.c,*.h let Comment="/*" | let EndComment="*/" +au BufRead,BufNewFile *.html let Comment="{#" | let EndComment="%}" | set filetype=htmldjango diff --git a/vim-plugins/ftplugin/.python_editing.vim.un~ b/vim-plugins/ftplugin/.python_editing.vim.un~ new file mode 100644 index 0000000..b8d4494 Binary files /dev/null and b/vim-plugins/ftplugin/.python_editing.vim.un~ differ diff --git a/vim-plugins/ftplugin/instant-markdown.vim b/vim-plugins/ftplugin/instant-markdown.vim new file mode 100644 index 0000000..c34c1a6 --- /dev/null +++ b/vim-plugins/ftplugin/instant-markdown.vim @@ -0,0 +1,188 @@ +" # Configuration +if !exists('g:instant_markdown_slow') + let g:instant_markdown_slow = 0 +endif + +if !exists('g:instant_markdown_autostart') + let g:instant_markdown_autostart = 1 +endif + +if !exists('g:instant_markdown_open_to_the_world') + let g:instant_markdown_open_to_the_world = 0 +endif + +if !exists('g:instant_markdown_allow_unsafe_content') + let g:instant_markdown_allow_unsafe_content = 0 +endif + +if !exists('g:instant_markdown_allow_external_content') + let g:instant_markdown_allow_external_content = 1 +endif + +" # Utility Functions +" Simple system wrapper that ignores empty second args +function! s:system(cmd, stdin) + if strlen(a:stdin) == 0 + call system(a:cmd) + else + call system(a:cmd, a:stdin) + endif +endfu + +" Wrapper function to automatically execute the command asynchronously and +" redirect output in a cross-platform way. Note that stdin must be passed as a +" List of lines. +function! s:systemasync(cmd, stdinLines) + if has('win32') || has('win64') + call s:winasync(a:cmd, a:stdinLines) + else + let cmd = a:cmd . '&>/dev/null &' + call s:system(cmd, join(a:stdinLines, "\n")) + endif +endfu + +" Executes a system command asynchronously on Windows. The List stdinLines will +" be concatenated and passed as stdin to the command. If the List is empty, +" stdin will also be empty. +function! s:winasync(cmd, stdinLines) + " To execute a command asynchronously on windows, the script must use the + " "!start" command. However, stdin can't be passed to this command like + " system(). Instead, the lines are saved to a file and then piped into the + " command. + if len(a:stdinLines) + let tmpfile = tempname() + call writefile(a:stdinLines, tmpfile) + let command = 'type ' . tmpfile . ' | ' . a:cmd + else + let command = a:cmd + endif + exec 'silent !start /b cmd /c ' . command . ' > NUL' +endfu + +function! s:refreshView() + let bufnr = expand('') + call s:systemasync("curl -X PUT -T - http://localhost:8090", + \ s:bufGetLines(bufnr)) +endfu + +function! s:startDaemon(initialMDLines) + let env = '' + if g:instant_markdown_open_to_the_world + let env .= 'INSTANT_MARKDOWN_OPEN_TO_THE_WORLD=1 ' + endif + if g:instant_markdown_allow_unsafe_content + let env .= 'INSTANT_MARKDOWN_ALLOW_UNSAFE_CONTENT=1 ' + endif + if !g:instant_markdown_allow_external_content + let env .= 'INSTANT_MARKDOWN_BLOCK_EXTERNAL=1 ' + endif + + call s:systemasync('instant-markdown-d', a:initialMDLines) +endfu + +function! s:initDict() + if !exists('s:buffers') + let s:buffers = {} + endif +endfu + +function! s:pushBuffer(bufnr) + call s:initDict() + let s:buffers[a:bufnr] = 1 +endfu + +function! s:popBuffer(bufnr) + call s:initDict() + call remove(s:buffers, a:bufnr) +endfu + +function! s:killDaemon() + call s:systemasync("curl -s -X DELETE http://localhost:8090", []) +endfu + +function! s:bufGetLines(bufnr) + return getbufline(a:bufnr, 1, "$") +endfu + +" I really, really hope there's a better way to do this. +fu! s:myBufNr() + return str2nr(expand('')) +endfu + +" # Functions called by autocmds +" +" ## push a new Markdown buffer into the system. +" +" 1. Track it so we know when to garbage collect the daemon +" 2. Start daemon if we're on the first MD buffer. +" 3. Initialize changedtickLast, possibly needlessly(?) +fu! s:pushMarkdown() + let bufnr = s:myBufNr() + call s:initDict() + if len(s:buffers) == 0 + call s:startDaemon(s:bufGetLines(bufnr)) + endif + call s:pushBuffer(bufnr) + let b:changedtickLast = b:changedtick +endfu + +" ## pop a Markdown buffer +" +" 1. Pop the buffer reference +" 2. Garbage collection +" * daemon +" * autocmds +fu! s:popMarkdown() + let bufnr = s:myBufNr() + silent au! instant-markdown * + call s:popBuffer(bufnr) + if len(s:buffers) == 0 + call s:killDaemon() + endif +endfu + +" ## Refresh if there's something new worth showing +" +" 'All things in moderation' +fu! s:temperedRefresh() + if !exists('b:changedtickLast') + let b:changedtickLast = b:changedtick + elseif b:changedtickLast != b:changedtick + let b:changedtickLast = b:changedtick + call s:refreshView() + endif +endfu + +fu! s:previewMarkdown() + call s:startDaemon(getline(1, '$')) + aug instant-markdown + if g:instant_markdown_slow + au CursorHold,BufWrite,InsertLeave call s:temperedRefresh() + else + au CursorHold,CursorHoldI,CursorMoved,CursorMovedI call s:temperedRefresh() + endif + au BufWinLeave call s:cleanUp() + aug END +endfu + +fu! s:cleanUp() + call s:killDaemon() + au! instant-markdown * +endfu + +if g:instant_markdown_autostart + " # Define the autocmds " + aug instant-markdown + au! * + au BufEnter call s:refreshView() + if g:instant_markdown_slow + au CursorHold,BufWrite,InsertLeave call s:temperedRefresh() + else + au CursorHold,CursorHoldI,CursorMoved,CursorMovedI call s:temperedRefresh() + endif + au BufWinLeave call s:popMarkdown() + au BufwinEnter call s:pushMarkdown() + aug END +else + command! -buffer InstantMarkdownPreview call s:previewMarkdown() +endif diff --git a/vim-plugins/ftplugin/python_editing.vim b/vim-plugins/ftplugin/python_editing.vim new file mode 100644 index 0000000..eabcc98 --- /dev/null +++ b/vim-plugins/ftplugin/python_editing.vim @@ -0,0 +1,91 @@ +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") +finish +endif +let b:did_ftplugin = 1 + +map :w:!/usr/bin/env python % +map gd /def + +set foldmethod=indent +set foldexpr=PythonFoldExpr(v:lnum) +set foldtext=PythonFoldText() + +map f za +map F :call ToggleFold() +let b:folded = 1 + +function! ToggleFold() + if( b:folded == 0 ) + exec "normal! zM" + let b:folded = 1 + else + exec "normal! zR" + let b:folded = 0 + endif +endfunction + +function! PythonFoldText() + + let size = 1 + v:foldend - v:foldstart + if size < 10 + let size = " " . size + endif + if size < 100 + let size = " " . size + endif + if size < 1000 + let size = " " . size + endif + + if match(getline(v:foldstart), '"""') >= 0 + let text = substitute(getline(v:foldstart), '"""', '', 'g' ) . ' ' + elseif match(getline(v:foldstart), "'''") >= 0 + let text = substitute(getline(v:foldstart), "'''", '', 'g' ) . ' ' + else + let text = getline(v:foldstart) + endif + + return size . ' lines:'. text . ' ' + +endfunction + +function! PythonFoldExpr(lnum) + + if indent( nextnonblank(a:lnum) ) == 0 + return 0 + endif + + if getline(a:lnum-1) =~ '^\(class\|def\)\s' + return 1 + endif + + if getline(a:lnum) =~ '^\s*$' + return "=" + endif + + if indent(a:lnum) == 0 + return 0 + endif + + return '=' + +endfunction + +" In case folding breaks down +function! ReFold() + set foldmethod=expr + set foldexpr=0 + set foldnestmax=1 + set foldmethod=expr + set foldexpr=PythonFoldExpr(v:lnum) + set foldtext=PythonFoldText() + echo +endfunction + +"inoremap ; : +"inoremap : ; + +" Django template completion +let g:htmldjangocomplete_html_flavour = 'html401s' +au FileType htmldjango set omnifunc=htmldjangocomplete#CompleteDjango diff --git a/vim-plugins/templates/.skeleton.py.un~ b/vim-plugins/templates/.skeleton.py.un~ new file mode 100644 index 0000000..52d281e Binary files /dev/null and b/vim-plugins/templates/.skeleton.py.un~ differ diff --git a/vim-plugins/templates/.skeleton.sh.un~ b/vim-plugins/templates/.skeleton.sh.un~ new file mode 100644 index 0000000..f55788a Binary files /dev/null and b/vim-plugins/templates/.skeleton.sh.un~ differ diff --git a/vim-plugins/templates/skeleton.py b/vim-plugins/templates/skeleton.py new file mode 100644 index 0000000..cd9ac48 --- /dev/null +++ b/vim-plugins/templates/skeleton.py @@ -0,0 +1,6 @@ +def main(): + pass + + +if __name__ == "__main__": + main() diff --git a/vim-plugins/templates/skeleton.sh b/vim-plugins/templates/skeleton.sh new file mode 100644 index 0000000..7a693aa --- /dev/null +++ b/vim-plugins/templates/skeleton.sh @@ -0,0 +1,3 @@ +#!/bin/bash + + diff --git a/vim-plugins/tmp/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md.swp b/vim-plugins/tmp/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md.swp new file mode 100644 index 0000000..c5c6582 Binary files /dev/null and b/vim-plugins/tmp/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md.swp differ diff --git a/vim-plugins/tmp/undo/%etc%apt%sources.list b/vim-plugins/tmp/undo/%etc%apt%sources.list new file mode 100644 index 0000000..306afdf Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%apt%sources.list differ diff --git a/vim-plugins/tmp/undo/%etc%default%locale b/vim-plugins/tmp/undo/%etc%default%locale new file mode 100644 index 0000000..6fa30e0 Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%default%locale differ diff --git a/vim-plugins/tmp/undo/%etc%fstab b/vim-plugins/tmp/undo/%etc%fstab new file mode 100644 index 0000000..475c658 Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%fstab differ diff --git a/vim-plugins/tmp/undo/%etc%hosts b/vim-plugins/tmp/undo/%etc%hosts new file mode 100644 index 0000000..ebea187 Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%hosts differ diff --git a/vim-plugins/tmp/undo/%etc%init%docker.conf b/vim-plugins/tmp/undo/%etc%init%docker.conf new file mode 100644 index 0000000..08bdb8b Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%init%docker.conf differ diff --git a/vim-plugins/tmp/undo/%etc%inputrc b/vim-plugins/tmp/undo/%etc%inputrc new file mode 100644 index 0000000..197a570 Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%inputrc differ diff --git a/vim-plugins/tmp/undo/%etc%ssh%ssh_config b/vim-plugins/tmp/undo/%etc%ssh%ssh_config new file mode 100644 index 0000000..40c17da Binary files /dev/null and b/vim-plugins/tmp/undo/%etc%ssh%ssh_config differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.bash_aliases b/vim-plugins/tmp/undo/%home%viktor%.bash_aliases new file mode 100644 index 0000000..99d1103 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.bash_aliases differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.bash_completion b/vim-plugins/tmp/undo/%home%viktor%.bash_completion new file mode 100644 index 0000000..1428e6d Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.bash_completion differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.bashrc b/vim-plugins/tmp/undo/%home%viktor%.bashrc new file mode 100644 index 0000000..3d6c5d9 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.bashrc differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.config%plasma-locale-settings.sh b/vim-plugins/tmp/undo/%home%viktor%.config%plasma-locale-settings.sh new file mode 100644 index 0000000..a9291ef Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.config%plasma-locale-settings.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.inputrc b/vim-plugins/tmp/undo/%home%viktor%.inputrc new file mode 100644 index 0000000..bbac3d0 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.inputrc differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%oh-my-zsh.sh b/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%oh-my-zsh.sh new file mode 100644 index 0000000..33a3188 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%oh-my-zsh.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%themes%bira.zsh-theme b/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%themes%bira.zsh-theme new file mode 100644 index 0000000..71f7722 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.oh-my-zsh%themes%bira.zsh-theme differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.profile b/vim-plugins/tmp/undo/%home%viktor%.profile new file mode 100644 index 0000000..6d449c0 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.profile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.ssh%config b/vim-plugins/tmp/undo/%home%viktor%.ssh%config new file mode 100755 index 0000000..585ed58 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.ssh%config differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.tmux%.tmux.conf b/vim-plugins/tmp/undo/%home%viktor%.tmux%.tmux.conf new file mode 100644 index 0000000..f652dda Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.tmux%.tmux.conf differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.tmux.conf b/vim-plugins/tmp/undo/%home%viktor%.tmux.conf new file mode 100644 index 0000000..f490bf5 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.tmux.conf differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.tmux.conf.local b/vim-plugins/tmp/undo/%home%viktor%.tmux.conf.local new file mode 100644 index 0000000..0cafaad Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.tmux.conf.local differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.vimrc b/vim-plugins/tmp/undo/%home%viktor%.vimrc new file mode 100644 index 0000000..56ddc16 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.vimrc differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%django%bin%activate b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%django%bin%activate new file mode 100644 index 0000000..ac84e77 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%django%bin%activate differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%reqs.txt b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%reqs.txt new file mode 100644 index 0000000..0f75110 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%reqs.txt differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%venv.sh b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%venv.sh new file mode 100755 index 0000000..7f71923 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.virtualenvs%venv.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%.zshrc b/vim-plugins/tmp/undo/%home%viktor%.zshrc new file mode 100644 index 0000000..27a8545 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%.zshrc differ diff --git a/vim-plugins/tmp/undo/%home%viktor%CLIENTNAME.ovpn b/vim-plugins/tmp/undo/%home%viktor%CLIENTNAME.ovpn new file mode 100644 index 0000000..455c915 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%CLIENTNAME.ovpn differ diff --git a/vim-plugins/tmp/undo/%home%viktor%Software_Development%python%techfest%TechFest%techfest%config%settings%base.py b/vim-plugins/tmp/undo/%home%viktor%Software_Development%python%techfest%TechFest%techfest%config%settings%base.py new file mode 100644 index 0000000..4fab25b Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%Software_Development%python%techfest%TechFest%techfest%config%settings%base.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%auto%update_vim_and_zsh.sh b/vim-plugins/tmp/undo/%home%viktor%auto%update_vim_and_zsh.sh new file mode 100755 index 0000000..b48f81f Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%auto%update_vim_and_zsh.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%bobi-rd-links b/vim-plugins/tmp/undo/%home%viktor%bobi-rd-links new file mode 100644 index 0000000..b2fd3b4 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%bobi-rd-links differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%dot_files%setup-vim.sh b/vim-plugins/tmp/undo/%home%viktor%code%dot_files%setup-vim.sh new file mode 100755 index 0000000..8981ded Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%dot_files%setup-vim.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%config%settings%base.py b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%config%settings%base.py new file mode 100644 index 0000000..b8d0f5e Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%config%settings%base.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%env.example b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%env.example new file mode 100644 index 0000000..93978ba Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%env.example differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%odin%dashboard%views.py b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%odin%dashboard%views.py new file mode 100644 index 0000000..7ea0fb8 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%Odin%odin%dashboard%views.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%models.py b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%models.py new file mode 100644 index 0000000..c219bc7 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%models.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%urls.py b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%urls.py new file mode 100644 index 0000000..b9d7dee Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%urls.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%views.py b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%views.py new file mode 100644 index 0000000..4c17e5a Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%myapp%views.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%settings.py b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%settings.py new file mode 100644 index 0000000..f07322f Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%minimal-django-file-upload-example%src%for_django_1-9%myproject%myproject%settings.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%Dockerfile new file mode 100644 index 0000000..4111f05 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%docker-compose.yml new file mode 100644 index 0000000..5a90a9f Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%postgres%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%postgres%Dockerfile new file mode 100644 index 0000000..fb7effe Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%postgres%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Dockerfile new file mode 100644 index 0000000..d8ef3c6 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%settings%base.py b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%settings%base.py new file mode 100644 index 0000000..d2f69bf Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%settings%base.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%urls.py b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%urls.py new file mode 100644 index 0000000..a8c53cd Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%config%urls.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%odin%dashboard%views.py b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%odin%dashboard%views.py new file mode 100644 index 0000000..0e600b3 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%Odin%odin%dashboard%views.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%entrypoint.sh b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%entrypoint.sh new file mode 100644 index 0000000..4ca6701 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%deploy%webapp%entrypoint.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%docker-compose.yml new file mode 100644 index 0000000..e5c05e7 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Dockerfile new file mode 100644 index 0000000..8360e30 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%Dockerfile new file mode 100644 index 0000000..b74755e Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md new file mode 100644 index 0000000..d482120 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%README.md differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%settings%base.py b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%settings%base.py new file mode 100644 index 0000000..a7843ca Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%settings%base.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%urls.py b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%urls.py new file mode 100644 index 0000000..382475a Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%config%urls.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%docker-compose.yml new file mode 100644 index 0000000..6a1ce1f Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%entrypoint.sh b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%entrypoint.sh new file mode 100644 index 0000000..224260b Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%deploy%dev%entrypoint.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%docker-compose.yml new file mode 100644 index 0000000..35a0e40 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%odin%templates%authentication%login.html b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%odin%templates%authentication%login.html new file mode 100644 index 0000000..e9ab1c7 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%Odin%odin%templates%authentication%login.html differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%entrypoint.sh b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%entrypoint.sh new file mode 100644 index 0000000..8cca8f0 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%odin-proj%dev%webapp%entrypoint.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%projects%fbchat%timeCost.txt b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%fbchat%timeCost.txt new file mode 100644 index 0000000..4e8d180 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%fbchat%timeCost.txt differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%asd b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%asd new file mode 100644 index 0000000..12ec51d Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%asd differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%manage.py b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%manage.py new file mode 100755 index 0000000..b37c87b Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%projects%techfest%TechFest%techfest%manage.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%code%python%refactorer%readme b/vim-plugins/tmp/undo/%home%viktor%code%python%refactorer%readme new file mode 100644 index 0000000..d8d61d2 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%code%python%refactorer%readme differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockercoins%docker-compose.logging.yml b/vim-plugins/tmp/undo/%home%viktor%docker%dockercoins%docker-compose.logging.yml new file mode 100644 index 0000000..51d020e Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockercoins%docker-compose.logging.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%Dockerfile new file mode 100644 index 0000000..068d6eb Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%docker-compose.yml new file mode 100644 index 0000000..27c181a Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%esx-vpn%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%esx-vpn%Dockerfile new file mode 100644 index 0000000..6942242 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%esx-vpn%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%Dockerfile new file mode 100644 index 0000000..fac1462 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%docker-compose.yml b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%docker-compose.yml new file mode 100644 index 0000000..66b948a Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%postgres%docker-compose.yml differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%redis%Dockerfile b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%redis%Dockerfile new file mode 100644 index 0000000..273ffa4 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%redis%Dockerfile differ diff --git a/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%techfest%config%settings%base.py b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%techfest%config%settings%base.py new file mode 100644 index 0000000..9601fd2 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%docker%dockerfile-tut%techfest%config%settings%base.py differ diff --git a/vim-plugins/tmp/undo/%home%viktor%q b/vim-plugins/tmp/undo/%home%viktor%q new file mode 100644 index 0000000..332baf9 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%q differ diff --git a/vim-plugins/tmp/undo/%home%viktor%test.css b/vim-plugins/tmp/undo/%home%viktor%test.css new file mode 100644 index 0000000..3e442c3 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%test.css differ diff --git a/vim-plugins/tmp/undo/%home%viktor%todo.txt b/vim-plugins/tmp/undo/%home%viktor%todo.txt new file mode 100644 index 0000000..14494ef Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%todo.txt differ diff --git a/vim-plugins/tmp/undo/%home%viktor%venv.sh b/vim-plugins/tmp/undo/%home%viktor%venv.sh new file mode 100755 index 0000000..974c82b Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%venv.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%venvs%install-reqs.sh b/vim-plugins/tmp/undo/%home%viktor%venvs%install-reqs.sh new file mode 100755 index 0000000..a9be5db Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%venvs%install-reqs.sh differ diff --git a/vim-plugins/tmp/undo/%home%viktor%viktor b/vim-plugins/tmp/undo/%home%viktor%viktor new file mode 100644 index 0000000..d628ea4 Binary files /dev/null and b/vim-plugins/tmp/undo/%home%viktor%viktor differ diff --git a/vim-plugins/tmp/undo/%mnt%home%viktor%auto-commit.sh b/vim-plugins/tmp/undo/%mnt%home%viktor%auto-commit.sh new file mode 100755 index 0000000..f6661ea Binary files /dev/null and b/vim-plugins/tmp/undo/%mnt%home%viktor%auto-commit.sh differ diff --git a/vim-plugins/tmp/undo/%tmp%crontab.LH6Lsq%crontab b/vim-plugins/tmp/undo/%tmp%crontab.LH6Lsq%crontab new file mode 100644 index 0000000..f9d6baf Binary files /dev/null and b/vim-plugins/tmp/undo/%tmp%crontab.LH6Lsq%crontab differ diff --git a/vim-plugins/tmp/undo/%tmp%crontab.Wlpq8x%crontab b/vim-plugins/tmp/undo/%tmp%crontab.Wlpq8x%crontab new file mode 100644 index 0000000..5c2cffe Binary files /dev/null and b/vim-plugins/tmp/undo/%tmp%crontab.Wlpq8x%crontab differ diff --git a/vim-plugins/tmp/undo/%tmp%crontab.ZwLCPA%crontab b/vim-plugins/tmp/undo/%tmp%crontab.ZwLCPA%crontab new file mode 100644 index 0000000..4bbe959 Binary files /dev/null and b/vim-plugins/tmp/undo/%tmp%crontab.ZwLCPA%crontab differ diff --git a/vim-plugins/tmp/undo/%tmp%zsh5bn4yf b/vim-plugins/tmp/undo/%tmp%zsh5bn4yf new file mode 100644 index 0000000..a35e743 Binary files /dev/null and b/vim-plugins/tmp/undo/%tmp%zsh5bn4yf differ diff --git a/vim-plugins/tmp/undo/%usr%bin%pip3 b/vim-plugins/tmp/undo/%usr%bin%pip3 new file mode 100755 index 0000000..88b42c0 Binary files /dev/null and b/vim-plugins/tmp/undo/%usr%bin%pip3 differ