diff --git a/vim/.VimballRecord b/vim/.VimballRecord deleted file mode 100644 index 810d46b..0000000 --- a/vim/.VimballRecord +++ /dev/null @@ -1,7 +0,0 @@ -conque_2.0.vba: call delete('/Users/andre/.vim/doc/conque_term.txt')|call delete('/Users/andre/.vim/syntax/conque_term.vim')|call delete('/Users/andre/.vim/autoload/conque_term/conque_screen.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_win32_util.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_shared_memory.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_wrapper.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_communicator.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_globals.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_subprocess.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_subprocess.py')|call delete('/Users/andre/.vim/autoload/conque_term.vim')|call delete('/Users/andre/.vim/plugin/conque_term.vim') -conqueterm_2.2.vmb: call delete('/Users/andre/.vim/autoload/conque_term.vim')|call delete('/Users/andre/.vim/autoload/conque_term/conque_globals.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_screen.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_communicator.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_shared_memory.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_subprocess.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_sole_wrapper.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_subprocess.py')|call delete('/Users/andre/.vim/autoload/conque_term/conque_win32_util.py')|call delete('/Users/andre/.vim/doc/conque_term.txt')|call delete('/Users/andre/.vim/plugin/conque_term.vim')|call delete('/Users/andre/.vim/syntax/conque_term.vim') -cecutil.vba: call delete('/Users/andre/.vim/plugin/cecutil.vim')|call delete('/Users/andre/.vim/doc/cecutil.txt') -getscript.vba: call delete('/Users/andre/.vim/plugin/getscriptPlugin.vim')|call delete('/Users/andre/.vim/autoload/getscript.vim')|call delete('/Users/andre/.vim/GetLatest/GetLatestVimScripts.dist')|call delete('/Users/andre/.vim/doc/pi_getscript.txt') -textformat.vba: call delete('/Users/andre/.vim/autoload/textformat.vim')|call delete('/Users/andre/.vim/doc/textformat.txt')|call delete('/Users/andre/.vim/plugin/textformat.vim') -open_terminal.vba: call delete('/Users/andre/.vim/plugin/open_terminal.vim')|call delete('/Users/andre/.vim/doc/open_terminal.txt') -Align.vba: call delete('/Users/andre/.vim/plugin/AlignPlugin.vim')|call delete('/Users/andre/.vim/plugin/AlignMapsPlugin.vim')|call delete('/Users/andre/.vim/plugin/cecutil.vim')|call delete('/Users/andre/.vim/doc/Align.txt')|call delete('/Users/andre/.vim/autoload/Align.vim')|call delete('/Users/andre/.vim/autoload/AlignMaps.vim') diff --git a/vim/autoload/Align.vim b/vim/autoload/Align.vim deleted file mode 100644 index 714421e..0000000 --- a/vim/autoload/Align.vim +++ /dev/null @@ -1,1140 +0,0 @@ -" Align: tool to align multiple fields based on one or more separators -" Author: Charles E. Campbell -" Date: Mar 12, 2013 -" Version: 37 -" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim -" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" Align.vim is provided *as is* and comes with no warranty -" of any kind, either expressed or implied. By using this -" plugin, you agree that in no event will the copyright -" holder be liable for any damages resulting from the use -" of this software. -" -" Romans 1:16,17a : For I am not ashamed of the gospel of Christ, for it is {{{1 -" the power of God for salvation for everyone who believes; for the Jew first, -" and also for the Greek. For in it is revealed God's righteousness from -" faith to faith. -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() - -" --------------------------------------------------------------------- -" Load Once: {{{1 -if exists("g:loaded_Align") || &cp - finish -endif -let g:loaded_Align = "v37" -if v:version < 700 - echohl WarningMsg - echo "***warning*** this version of Align needs vim 7.0" - echohl Normal - finish -endif -let s:keepcpo= &cpo -set cpo&vim -"DechoTabOn - -" --------------------------------------------------------------------- -" Debugging Support: {{{1 -"if !exists("g:loaded_Decho") | runtime plugin/Decho.vim | endif - -" --------------------------------------------------------------------- -" Options: {{{1 -if !exists("g:Align_xstrlen") - if exists("g:drawit_xstrlen") - let g:Align_xstrlen= g:drawit_xstrlen - elseif exists("g:netrw_xstrlen") - let g:Align_xstrlen= g:netrw_xstrlen - elseif &enc == "latin1" || !has("multi_byte") - let g:Align_xstrlen= 0 - else - let g:Align_xstrlen= 1 - endif -endif - -" --------------------------------------------------------------------- -" Align#AlignCtrl: enter alignment patterns here {{{1 -" -" Styles = all alignment-break patterns are equivalent -" C cycle through alignment-break pattern(s) -" l left-justified alignment -" r right-justified alignment -" c center alignment -" - skip separator, treat as part of field -" : treat rest of line as field -" + repeat previous [lrc] style -" < left justify separators -" > right justify separators -" | center separators -" -" Builds = s:AlignPat s:AlignCtrl s:AlignPatQty -" C s:AlignPat s:AlignCtrl s:AlignPatQty -" p s:AlignPrePad -" P s:AlignPostPad -" w s:AlignLeadKeep -" W s:AlignLeadKeep -" I s:AlignLeadKeep -" l s:AlignStyle -" r s:AlignStyle -" - s:AlignStyle -" + s:AlignStyle -" : s:AlignStyle -" c s:AlignStyle -" g s:AlignGPat -" v s:AlignVPat -" < s:AlignSep -" > s:AlignSep -" | s:AlignSep -fun! Align#AlignCtrl(...) - -" call Dfunc("Align#AlignCtrl(...) a:0=".a:0) - - " save options that may be changed later - call s:SaveUserOptions() - - " turn ignorecase off - setlocal noic - - " clear visual mode so that old visual-mode selections don't - " get applied to new invocations of Align(). - if v:version < 602 - if !exists("s:Align_gavemsg") - let s:Align_gavemsg= 1 - echomsg "Align needs at least Vim version 6.2 to clear visual-mode selection" - endif - elseif exists("s:dovisclear") -" call Decho("clearing visual mode a:0=".a:0." a:1<".a:1.">") - let clearvmode= visualmode(1) - endif - - " set up a list akin to an argument list - if a:0 > 0 - let A= s:QArgSplitter(a:1) - else - let A=[0] - endif - - if A[0] > 0 - let style = A[1] - - " Check for bad separator patterns (zero-length matches) - " (but zero-length patterns for g/v is ok) - if style !~# '[gv]' - let ipat= 2 - while ipat <= A[0] - if "" =~ A[ipat] - echoerr "(AlignCtrl) separator<".A[ipat]."> matches zero-length string" - call s:RestoreUserOptions() -" call Dret("Align#AlignCtrl") - return - endif - let ipat= ipat + 1 - endwhile - endif - endif -" call Decho("(AlignCtrl) passed bad-separator pattern check (no zero-length matches)") - -" call Decho("(AlignCtrl) A[0]=".A[0]) - if !exists("s:AlignStyle") - let s:AlignStyle= 'l' - endif - if !exists("s:AlignPrePad") - let s:AlignPrePad= 0 - endif - if !exists("s:AlignPostPad") - let s:AlignPostPad= 0 - endif - if !exists("s:AlignLeadKeep") - let s:AlignLeadKeep= 'w' - endif - - if A[0] == 0 - " ---------------------- - " List current selection - " ---------------------- - if !exists("s:AlignPatQty") - let s:AlignPatQty= 0 - endif - echo "AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep -" call Decho("(AlignCtrl) AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep) - if exists("s:AlignGPat") && !exists("s:AlignVPat") - echo "AlignGPat<".s:AlignGPat.">" - elseif !exists("s:AlignGPat") && exists("s:AlignVPat") - echo "AlignVPat<".s:AlignVPat.">" - elseif exists("s:AlignGPat") && exists("s:AlignVPat") - echo "AlignGPat<".s:AlignGPat."> AlignVPat<".s:AlignVPat.">" - endif - let ipat= 1 - while ipat <= s:AlignPatQty - echo "Pat".ipat."<".s:AlignPat_{ipat}.">" -" call Decho("(AlignCtrl) Pat".ipat."<".s:AlignPat_{ipat}.">") - let ipat= ipat + 1 - endwhile - - else - " ---------------------------------- - " Process alignment control settings - " ---------------------------------- -" call Decho("process the alignctrl settings") -" call Decho("style<".style.">") - - if style ==? "default" - " Default: preserve initial leading whitespace, left-justified, - " alignment on '=', one space padding on both sides - if exists("s:AlignCtrlStackQty") - " clear AlignCtrl stack - while s:AlignCtrlStackQty > 0 - call Align#AlignPop() - endwhile - unlet s:AlignCtrlStackQty - endif - " Set AlignCtrl to its default value - call Align#AlignCtrl("Ilp1P1=<",'=') - call Align#AlignCtrl("g") - call Align#AlignCtrl("v") - let s:dovisclear = 1 - call s:RestoreUserOptions() -" call Dret("Align#AlignCtrl") - return - endif - - if style =~# 'm' - " map support: Do an AlignPush now and the next call to Align() - " will do an AlignPop at exit -" call Decho("style case m: do AlignPush") - call Align#AlignPush() - let s:DoAlignPop= 1 - endif - - " = : record a list of alignment patterns that are equivalent - if style =~# "=" || (A[0] >= 2 && style !~# "C" && s:AlignCtrl =~# '=') -" call Decho("style case =: record list of equiv alignment patterns") - let s:AlignCtrl = '=' - if A[0] >= 2 - let s:AlignPatQty= 1 - let s:AlignPat_1 = A[2] - let ipat = 3 - while ipat <= A[0] - let s:AlignPat_1 = s:AlignPat_1.'\|'.A[ipat] - let ipat = ipat + 1 - endwhile - let s:AlignPat_1= '\('.s:AlignPat_1.'\)' -" call Decho("AlignCtrl<".s:AlignCtrl."> AlignPat<".s:AlignPat_1.">") - endif - - "c : cycle through alignment pattern(s) - elseif style =~# 'C' || (A[0] >= 2 && s:AlignCtrl =~# '=') -" call Decho("style case C: cycle through alignment pattern(s)") - let s:AlignCtrl = 'C' - if A[0] >= 2 - let s:AlignPatQty= A[0] - 1 - let ipat = 1 - while ipat < A[0] - let s:AlignPat_{ipat}= A[ipat+1] -" call Decho("AlignCtrl<".s:AlignCtrl."> AlignQty=".s:AlignPatQty." AlignPat_".ipat."<".s:AlignPat_{ipat}.">") - let ipat= ipat + 1 - endwhile - endif - endif - - if style =~# 'p' - let s:AlignPrePad= substitute(style,'^.*p\(\d\+\).*$','\1','') -" call Decho("style case p".s:AlignPrePad.": pre-separator padding") - if s:AlignPrePad == "" - echoerr "(AlignCtrl) 'p' needs to be followed by a numeric argument'" - call s:RestoreUserOptions() -" call Dret("Align#AlignCtrl") - return - endif - endif - - if style =~# 'P' - let s:AlignPostPad= substitute(style,'^.*P\(\d\+\).*$','\1','') -" call Decho("style case P".s:AlignPostPad.": post-separator padding") - if s:AlignPostPad == "" - echoerr "(AlignCtrl) 'P' needs to be followed by a numeric argument'" - call s:RestoreUserOptions() -" call Dret("Align#AlignCtrl") - return - endif - endif - - if style =~# 'w' -" call Decho("style case w: ignore leading whitespace") - let s:AlignLeadKeep= 'w' - elseif style =~# 'W' -" call Decho("style case W: keep leading whitespace") - let s:AlignLeadKeep= 'W' - elseif style =~# 'I' -" call Decho("style case I: retain initial leading whitespace") - let s:AlignLeadKeep= 'I' - endif - - if style =~# 'g' - " first list item is a "g" selector pattern -" call Decho("style case g: global selector pattern") - if A[0] < 2 - if exists("s:AlignVPat") - unlet s:AlignVPat -" call Decho("unlet s:AlignGPat") - endif - else - let s:AlignGPat= A[2] -" call Decho("s:AlignGPat<".s:AlignGPat.">") - endif - elseif style =~# 'v' - " first list item is a "v" selector pattern -" call Decho("style case v: global selector anti-pattern") - if A[0] < 2 - if exists("s:AlignGPat") - unlet s:AlignGPat -" call Decho("unlet s:AlignVPat") - endif - else - let s:AlignVPat= A[2] -" call Decho("s:AlignVPat<".s:AlignVPat.">") - endif - endif - - "[-lrc+:] : set up s:AlignStyle - if style =~# '[-lrc+:*]' -" call Decho("style case [-lrc+:]: field justification") - let s:AlignStyle= substitute(style,'[^-lrc:+*]','','g') -" call Decho("AlignStyle<".s:AlignStyle.">") - endif - - "[<>|] : set up s:AlignSep - if style =~# '[<>|]' -" call Decho("style case [-lrc+:]: separator justification") - let s:AlignSep= substitute(style,'[^<>|]','','g') -" call Decho("AlignSep ".s:AlignSep) - endif - endif - - " sanity - if !exists("s:AlignCtrl") - let s:AlignCtrl= '=' - endif - - " restore options and return - call s:RestoreUserOptions() -" call Dret("Align#AlignCtrl ".s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle) - return s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle -endfun - -" --------------------------------------------------------------------- -" s:MakeSpace: returns a string with spacecnt blanks {{{1 -fun! s:MakeSpace(spacecnt) -" call Dfunc("MakeSpace(spacecnt=".a:spacecnt.")") - let str = "" - let spacecnt = a:spacecnt - while spacecnt > 0 - let str = str . " " - let spacecnt = spacecnt - 1 - endwhile -" call Dret("MakeSpace <".str.">") - return str -endfun - -" --------------------------------------------------------------------- -" Align#Align: align selected text based on alignment pattern(s) {{{1 -fun! Align#Align(hasctrl,...) range -" call Dfunc("Align#Align(hasctrl=".a:hasctrl.",...) a:0=".a:0) - - " sanity checks - if string(a:hasctrl) != "0" && string(a:hasctrl) != "1" - echohl Error|echo 'usage: Align#Align(hasctrl<'.a:hasctrl.'> (should be 0 or 1),"separator(s)" (you have '.a:0.') )'|echohl None -" call Dret("Align#Align") - return - endif - if exists("s:AlignStyle") && s:AlignStyle == ":" - echohl Error |echo '(Align#Align) your AlignStyle is ":", which implies "do-no-alignment"!'|echohl None -" call Dret("Align#Align") - return - endif - - " save user options - call s:SaveUserOptions() - - " set up a list akin to an argument list - if a:0 > 0 - let A= s:QArgSplitter(a:1) - else - let A=[0] - endif - - " if :Align! was used, then the first argument is (should be!) an AlignCtrl string - " Note that any alignment control set this way will be temporary. - let hasctrl= a:hasctrl -" call Decho("hasctrl=".hasctrl) - if a:hasctrl && A[0] >= 1 -" call Decho("Align! : using A[1]<".A[1]."> for AlignCtrl") - if A[1] =~ '[gv]' - let hasctrl= hasctrl + 1 - call Align#AlignCtrl('m') - call Align#AlignCtrl(A[1],A[2]) -" call Decho("Align! : also using A[2]<".A[2]."> for AlignCtrl") - elseif A[1] !~ 'm' - call Align#AlignCtrl(A[1]."m") - else - call Align#AlignCtrl(A[1]) - endif - endif - - " Check for bad separator patterns (zero-length matches) - let ipat= 1 + hasctrl - while ipat <= A[0] - if "" =~ A[ipat] - echoerr "(Align) separator<".A[ipat]."> matches zero-length string" - call s:RestoreUserOptions() -" call Dret("Align#Align") - return - endif - let ipat= ipat + 1 - endwhile - - " record current search pattern for subsequent restoration - " (these are all global-only options) - set noic report=10000 nohls - - if A[0] > hasctrl - " Align will accept a list of separator regexps -" call Decho("A[0]=".A[0].": accepting list of separator regexp") - - if s:AlignCtrl =~# "=" - "= : consider all separators to be equivalent -" call Decho("AlignCtrl: record list of equivalent alignment patterns") - let s:AlignCtrl = '=' - let s:AlignPat_1 = A[1 + hasctrl] - let s:AlignPatQty= 1 - let ipat = 2 + hasctrl - while ipat <= A[0] - let s:AlignPat_1 = s:AlignPat_1.'\|'.A[ipat] - let ipat = ipat + 1 - endwhile - let s:AlignPat_1= '\('.s:AlignPat_1.'\)' -" call Decho("AlignCtrl<".s:AlignCtrl."> AlignPat<".s:AlignPat_1.">") - - elseif s:AlignCtrl =~# 'C' - "c : cycle through alignment pattern(s) -" call Decho("AlignCtrl: cycle through alignment pattern(s)") - let s:AlignCtrl = 'C' - let s:AlignPatQty= A[0] - hasctrl - let ipat = 1 - while ipat <= s:AlignPatQty - let s:AlignPat_{ipat}= A[(ipat + hasctrl)] -" call Decho("AlignCtrl<".s:AlignCtrl."> AlignQty=".s:AlignPatQty." AlignPat_".ipat."<".s:AlignPat_{ipat}.">") - let ipat= ipat + 1 - endwhile - endif - endif - - " Initialize so that begline - " is greater than the line's string length -> ragged right. - " Have to be careful about visualmode() -- it returns the last visual - " mode used whether or not it was used currently. - let begcol = virtcol("'<")-1 - let endcol = virtcol("'>")-1 - if begcol > endcol - let begcol = virtcol("'>")-1 - let endcol = virtcol("'<")-1 - endif -" call Decho("begcol=".begcol." endcol=".endcol) - let begline = a:firstline - let endline = a:lastline - if begline > endline - let begline = a:lastline - let endline = a:firstline - endif - - " Expand range to cover align-able lines when the given range is only the current line. - " Look for the first line above the current line that matches the first separator pattern, and - " look for the last line below the current line that matches the first separator pattern. - if begline == endline -" call Decho("case begline == endline") - if !exists("s:AlignPat_{1}") - echohl Error|echo "(Align) no separators specified!"|echohl None - call s:RestoreUserOptions() -" call Dret("Align#Align") - return - endif - let seppat = s:AlignPat_{1} - let begline= search('^\%(\%('.seppat.'\)\@!.\)*$',"bnW") - if begline == 0|let begline= 1|else|let begline= begline + 1|endif - let endline= search('^\%(\%('.seppat.'\)\@!.\)*$',"nW") - if endline == 0|let endline= line("$")|else|let endline= endline - 1|endif -" call Decho("begline=".begline." endline=".endline." curline#".line(".")) - endif -" call Decho("begline=".begline." endline=".endline) - let fieldcnt = 0 - if (begline == line("'>") && endline == line("'<")) || (begline == line("'<") && endline == line("'>")) - let vmode= visualmode() -" call Decho("vmode=".vmode) - if vmode == "\" - let ragged = ( col("'>") > s:Strlen(getline("'>")) || col("'<") > s:Strlen(getline("'<")) ) - else - let ragged= 1 - endif - else - let ragged= 1 - endif - if ragged - let begcol= 0 - endif -" call Decho("lines[".begline.",".endline."] col[".begcol.",".endcol."] ragged=".ragged." AlignCtrl<".s:AlignCtrl.">") - - " record initial whitespace - if s:AlignLeadKeep == 'W' - let wskeep = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')") - endif - - " Align needs these options - setl et - set paste - - " convert selected range of lines to use spaces instead of tabs - " but if first line's initial white spaces are to be retained - " then use 'em - if begcol <= 0 && s:AlignLeadKeep == 'I' - " retain first leading whitespace for all subsequent lines - let bgntxt= substitute(getline(begline),'^\(\s*\).\{-}$','\1','') - - " exception: retain first leading whitespace predicated on g and v patterns - " if such a selected line exists - if exists("s:AlignGPat") - let firstgline= search(s:AlignGPat,"cnW",endline) - if firstgline > 0 - let bgntxt= substitute(getline(firstgline),'^\(\s*\).\{-}$','\1','') - endif - elseif exists("s:AlignVPat") - let firstvline= search(s:AlignVPat,"cnW",endline) - if firstvline > 0 - let bgntxt= substitute('^\%(\%('.getline(firstvline).')\@!\)*$','^\(\s*\).\{-}$','\1','') - endif - endif -" call Decho("retaining 1st leading whitespace: bgntxt<".bgntxt.">") - let &l:et= s:keep_et - endif - exe begline.",".endline."ret" - - " record transformed to spaces leading whitespace - if s:AlignLeadKeep == 'W' - let wsblanks = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')") - endif - - " Execute two passes - " First pass: collect alignment data (max field sizes) - " Second pass: perform alignment - let pass= 1 - while pass <= 2 -" call Decho(" ") -" call Decho("---- Pass ".pass.": ----") - - let curline= begline - while curline <= endline - " Process each line - let txt = getline(curline) -" call Decho(" ") -" call Decho("Pass".pass.": Line ".curline." <".txt.">") - - " AlignGPat support: allows a selector pattern (akin to g/selector/cmd ) - if exists("s:AlignGPat") -" call Decho("Pass".pass.": AlignGPat<".s:AlignGPat.">") - if match(txt,s:AlignGPat) == -1 -" call Decho("Pass".pass.": skipping") - let curline= curline + 1 - continue - endif - endif - - " AlignVPat support: allows a selector pattern (akin to v/selector/cmd ) - if exists("s:AlignVPat") -" call Decho("Pass".pass.": AlignVPat<".s:AlignVPat.">") - if match(txt,s:AlignVPat) != -1 -" call Decho("Pass".pass.": skipping") - let curline= curline + 1 - continue - endif - endif - - " Always skip blank lines - if match(txt,'^\s*$') != -1 -" call Decho("Pass".pass.": skipping") - let curline= curline + 1 - continue - endif - - " Extract visual-block selected text (init bgntxt, endtxt) - let txtlen= s:Strlen(txt) - if begcol > 0 - " Record text to left of selected area - let bgntxt= strpart(txt,0,begcol) -" call Decho("Pass".pass.": record text to left: bgntxt<".bgntxt.">") - elseif s:AlignLeadKeep == 'W' - let bgntxt= substitute(txt,'^\(\s*\).\{-}$','\1','') -" call Decho("Pass".pass.": retaining all leading ws: bgntxt<".bgntxt.">") - elseif s:AlignLeadKeep == 'w' || !exists("bgntxt") - " No beginning text - let bgntxt= "" -" call Decho("Pass".pass.": no beginning text") - endif - if ragged - let endtxt= "" - else - " Elide any text lying outside selected columnar region - let endtxt= strpart(txt,endcol+1,txtlen-endcol) - let txt = strpart(txt,begcol,endcol-begcol+1) - endif -" call Decho(" ") -" call Decho("Pass".pass.": bgntxt<".bgntxt.">") -" call Decho("Pass".pass.": txt<". txt .">") -" call Decho("Pass".pass.": endtxt<".endtxt.">") - if !exists("s:AlignPat_{1}") - echohl Error|echo "(Align) no separators specified!"|echohl None - call s:RestoreUserOptions() -" call Dret("Align#Align") - return - endif - - " Initialize for both passes - let seppat = s:AlignPat_{1} - let ifield = 1 - let ipat = 1 - let bgnfield = 0 - let endfield = 0 - let alignstyle = s:AlignStyle - let doend = 1 - let newtxt = "" - let alignprepad = s:AlignPrePad - let alignpostpad= s:AlignPostPad - let alignsep = s:AlignSep - let alignophold = " " - let alignop = 'l' -" call Decho("Pass".pass.": initial alignstyle<".alignstyle."> seppat<".seppat.">") - - " Process each field on the line - while doend > 0 - - " C-style: cycle through pattern(s) - if s:AlignCtrl == 'C' && doend == 1 - let seppat = s:AlignPat_{ipat} -" call Decho("Pass".pass.": processing field: AlignCtrl=".s:AlignCtrl." ipat=".ipat." seppat<".seppat.">") - let ipat = ipat + 1 - if ipat > s:AlignPatQty - let ipat = 1 - endif - endif - - " cyclic alignment/justification operator handling - let alignophold = alignop - let alignop = strpart(alignstyle,0,1) - if alignop == '+' || doend == 2 - let alignop= alignophold - else - let alignstyle = strpart(alignstyle,1).strpart(alignstyle,0,1) - let alignopnxt = strpart(alignstyle,0,1) - if alignop == ':' - let seppat = '$' - let doend = 2 -" call Decho("Pass".pass.": alignop<:> case: setting seppat<$> doend==2") - endif - endif - - " cyclic separator alignment specification handling - let alignsepop= strpart(alignsep,0,1) - let alignsep = strpart(alignsep,1).alignsepop - - " ------------------------------------------------------ - " mark end-of-field and the subsequent end-of-separator. - " ------------------------------------------------------ - let endfield = match(txt,seppat,bgnfield) - let sepfield = matchend(txt,seppat,bgnfield) - let skipfield= sepfield -" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop) - - " Mark eof: Extend field if alignop is '*' and AlignSkip() is true. - if alignop == '*' && exists("g:AlignSkip") && type(g:AlignSkip) == 2 -" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop) - " a '*' acts like a '-' while the g:AlignSkip function reference is true except that alignop doesn't advance - while g:AlignSkip(curline,endfield) && endfield != -1 - let endfield = match(txt,seppat,skipfield) - let sepfield = matchend(txt,seppat,skipfield) - let skipfield = sepfield -" call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">") - endwhile - let alignop = strpart(alignstyle,0,1) - let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1) -" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop." (after *)") - endif - - " Mark eof: Extend field if alignop is '-' - while alignop == '-' && endfield != -1 - let endfield = match(txt,seppat,skipfield) - let sepfield = matchend(txt,seppat,skipfield) - let skipfield = sepfield - let alignop = strpart(alignstyle,0,1) - let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1) -" call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">") - endwhile - let seplen= sepfield - endfield -" call Decho("Pass".pass.": seplen=[sepfield=".sepfield."] - [endfield=".endfield."]=".seplen) - - if endfield != -1 - if pass == 1 - " --------------------------------------------------------------------- - " Pass 1: Update FieldSize to max -" call Decho("Pass".pass.": before lead/trail remove: field<".strpart(txt,bgnfield,endfield-bgnfield).">") - let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\1','') - if s:AlignLeadKeep == 'W' - let field = bgntxt.field - let bgntxt= "" - endif - let fieldlen= s:Strlen(field) - if !exists("FieldSize_{ifield}") - let FieldSize_{ifield}= fieldlen -" call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (init)") - elseif fieldlen > FieldSize_{ifield} - let FieldSize_{ifield}= fieldlen -" call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (fieldlen>FieldSize_".ifield.")") - endif - if !exists("SepSize_{ifield}") - let SepSize_{ifield}= seplen -" call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (init)") - elseif seplen > SepSize_{ifield} - let SepSize_{ifield}= seplen -" call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (seplen>SepSize_".ifield.")") - endif - - else - " --------------------------------------------------------------------- - " Pass 2: Perform Alignment - let prepad = strpart(alignprepad,0,1) - let postpad = strpart(alignpostpad,0,1) - let alignprepad = strpart(alignprepad,1).strpart(alignprepad,0,1) - let alignpostpad = strpart(alignpostpad,1).strpart(alignpostpad,0,1) - let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\1','') -" call Decho("Pass".pass.": alignprepad <".alignprepad."> prepad =".prepad) -" call Decho("Pass".pass.": alignpostpad<".alignpostpad."> postpad=".postpad) - if s:AlignLeadKeep == 'W' - let field = bgntxt.field - let bgntxt= "" - endif - if doend == 2 - let prepad = 0 - let postpad= 0 - endif - let fieldlen = s:Strlen(field) - let sep = s:MakeSpace(prepad).strpart(txt,endfield,sepfield-endfield).s:MakeSpace(postpad) -" call Decho("Pass".pass.": sep<".sep."> (after prepad, sepfield-endfield,postpad)") - if seplen < SepSize_{ifield} - if alignsepop == "<" - " left-justify separators - let sep = sep.s:MakeSpace(SepSize_{ifield}-seplen) -" call Decho("Pass".pass.": sep<".sep."> (left-justified)") - elseif alignsepop == ">" - " right-justify separators - let sep = s:MakeSpace(SepSize_{ifield}-seplen).sep -" call Decho("Pass".pass.": sep<".sep."> (right-justified)") - else - " center-justify separators - let sepleft = (SepSize_{ifield} - seplen)/2 - let sepright = SepSize_{ifield} - seplen - sepleft - let sep = s:MakeSpace(sepleft).sep.s:MakeSpace(sepright) -" call Decho("Pass".pass.": sep<".sep."> (center-justified)") - endif - endif - let spaces = FieldSize_{ifield} - fieldlen -" call Decho("Pass".pass.": spaces=[FieldSize_".ifield."=".FieldSize_{ifield}."] - [fieldlen=".fieldlen."]=".spaces) -" call Decho("Pass".pass.": Field #".ifield."<".field."> spaces=".spaces." be[".bgnfield.",".endfield."] pad=".prepad.','.postpad." FS_".ifield."<".FieldSize_{ifield}."> sep<".sep."> ragged=".ragged." doend=".doend." alignop<".alignop.">") - - " Perform alignment according to alignment style justification - if spaces > 0 - if alignop == 'c' - " center the field - let spaceleft = spaces/2 - let spaceright= FieldSize_{ifield} - spaceleft - fieldlen - let newtxt = newtxt.s:MakeSpace(spaceleft).field.s:MakeSpace(spaceright).sep - elseif alignop == 'r' - " right justify the field - let newtxt= newtxt.s:MakeSpace(spaces).field.sep - elseif ragged && doend == 2 - " left justify rightmost field (no trailing blanks needed) - let newtxt= newtxt.field - else - " left justfiy the field - let newtxt= newtxt.field.s:MakeSpace(spaces).sep - endif - elseif ragged && doend == 2 - " field at maximum field size and no trailing blanks needed - let newtxt= newtxt.field - else - " field is at maximum field size already - let newtxt= newtxt.field.sep - endif -" call Decho("Pass".pass.": newtxt<".newtxt.">") - endif " pass 1/2 - - " bgnfield indexes to end of separator at right of current field - " Update field counter - let bgnfield= sepfield - let ifield = ifield + 1 - if doend == 2 - let doend= 0 - endif - " handle end-of-text as end-of-field - elseif doend == 1 - let seppat = '$' - let doend = 2 - else - let doend = 0 - endif " endfield != -1 - endwhile " doend loop (as well as regularly separated fields) - - if pass == 2 - " Write altered line to buffer -" call Decho("Pass".pass.": bgntxt<".bgntxt."> curline=".curline) -" call Decho("Pass".pass.": newtxt<".newtxt.">") -" call Decho("Pass".pass.": endtxt<".endtxt.">") - keepj call setline(curline,bgntxt.newtxt.endtxt) - endif -" call Decho("Pass".pass.": line#".curline."<".getline(".")."> (end-of-while)") - - let curline = curline + 1 - endwhile " curline loop - - let pass= pass + 1 - endwhile " pass loop -" call Decho("end of two pass loop") -" call Decho("ENDWHILE: cursor at (".line(".").",".col(".").") curline#".curline) - - " restore original leading whitespace - if s:AlignLeadKeep == 'W' - let iline= begline - let i = 0 -" call Decho("restore original leading whitespace") - while iline <= endline -" call Decho("exe ".iline."s/^".wsblanks[i]."/".wskeep[i]."/") - exe "keepj ".iline."s/^".wsblanks[i]."/".wskeep[i]."/" - let iline= iline + 1 - let i = i + 1 - endwhile - endif - - if exists("s:DoAlignPop") - " AlignCtrl Map support - call Align#AlignPop() - unlet s:DoAlignPop - endif - - " restore user options and return - call s:RestoreUserOptions() -" call Dret("Align#Align") - return -endfun - -" --------------------------------------------------------------------- -" Align#AlignPush: this command/function pushes an alignment control string onto a stack {{{1 -fun! Align#AlignPush() -" call Dfunc("Align#AlignPush()") - - " initialize the stack - if !exists("s:AlignCtrlStackQty") - let s:AlignCtrlStackQty= 1 - else - let s:AlignCtrlStackQty= s:AlignCtrlStackQty + 1 - endif - - " construct an AlignCtrlStack entry - if !exists("s:AlignSep") - let s:AlignSep= '' - endif - let s:AlignCtrlStack_{s:AlignCtrlStackQty}= s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle.s:AlignSep -" call Decho("AlignPush: AlignCtrlStack_".s:AlignCtrlStackQty."<".s:AlignCtrlStack_{s:AlignCtrlStackQty}.">") - - " push [GV] patterns onto their own stack - if exists("s:AlignGPat") - let s:AlignGPat_{s:AlignCtrlStackQty}= s:AlignGPat - else - let s:AlignGPat_{s:AlignCtrlStackQty}= "" - endif - if exists("s:AlignVPat") - let s:AlignVPat_{s:AlignCtrlStackQty}= s:AlignVPat - else - let s:AlignVPat_{s:AlignCtrlStackQty}= "" - endif - -" call Dret("Align#AlignPush") -endfun - -" --------------------------------------------------------------------- -" Align#AlignPop: this command/function pops an alignment pattern from a stack {{{1 -" and into the AlignCtrl variables. -fun! Align#AlignPop() -" call Dfunc("Align#AlignPop()") - - " sanity checks - if !exists("s:AlignCtrlStackQty") - echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop" -" call Dret("Align#AlignPop <> : AlignPush needs to have been called first") - return "" - endif - if s:AlignCtrlStackQty <= 0 - unlet s:AlignCtrlStackQty - echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop" -" call Dret("Align#AlignPop <> : AlignPop needs to have been called first") - return "" - endif - - " pop top of AlignCtrlStack and pass value to AlignCtrl - let retval=s:AlignCtrlStack_{s:AlignCtrlStackQty} - unlet s:AlignCtrlStack_{s:AlignCtrlStackQty} - call Align#AlignCtrl(retval) - - " pop G pattern stack - if s:AlignGPat_{s:AlignCtrlStackQty} != "" - call Align#AlignCtrl('g',s:AlignGPat_{s:AlignCtrlStackQty}) - else - call Align#AlignCtrl('g') - endif - unlet s:AlignGPat_{s:AlignCtrlStackQty} - - " pop V pattern stack - if s:AlignVPat_{s:AlignCtrlStackQty} != "" - call Align#AlignCtrl('v',s:AlignVPat_{s:AlignCtrlStackQty}) - else - call Align#AlignCtrl('v') - endif - - unlet s:AlignVPat_{s:AlignCtrlStackQty} - let s:AlignCtrlStackQty= s:AlignCtrlStackQty - 1 - -" call Dret("Align#AlignPop <".retval."> : AlignCtrlStackQty=".s:AlignCtrlStackQty) - return retval -endfun - -" --------------------------------------------------------------------- -" Align#AlignReplaceQuotedSpaces: {{{1 -fun! Align#AlignReplaceQuotedSpaces() -" call Dfunc("Align#AlignReplaceQuotedSpaces()") - - let l:line = getline(line(".")) - let l:linelen = s:Strlen(l:line) - let l:startingPos = 0 - let l:startQuotePos = 0 - let l:endQuotePos = 0 - let l:spacePos = 0 - let l:quoteRe = '\\\@, is needed. {{{1 -" However, doesn't split at all, so this function returns a list -" of arguments which has been: -" * split at whitespace -" * unless inside "..."s. One may escape characters with a backslash inside double quotes. -" along with a leading length-of-list. -" -" Examples: %Align "\"" will align on "s -" %Align " " will align on spaces -" -" The resulting list: qarglist[0] corresponds to a:0 -" qarglist[i] corresponds to a:{i} -fun! s:QArgSplitter(qarg) -" call Dfunc("s:QArgSplitter(qarg<".a:qarg.">)") - - if a:qarg =~ '".*"' - " handle "..." args, which may include whitespace - let qarglist = [] - let args = a:qarg -" call Decho("handle quoted arguments: args<".args.">") - while args != "" - let iarg = 0 - let arglen = strlen(args) -" call Decho(".args[".iarg."]<".args[iarg]."> arglen=".arglen) - " find index to first not-escaped '"' -" call Decho("find index to first not-escaped \"") - while args[iarg] != '"' && iarg < arglen - if args[iarg] == '\' - let args= strpart(args,1) - endif - let iarg= iarg + 1 - endwhile -" call Decho(".args<".args."> iarg=".iarg." arglen=".arglen) - - if iarg > 0 - " handle left of quote or remaining section -" call Decho(".handle left of quote or remaining section") - if args[iarg] == '"' - let qarglist= qarglist + split(strpart(args,0,iarg-1)) - else - let qarglist= qarglist + split(strpart(args,0,iarg)) - endif - let args = strpart(args,iarg) - let arglen = strlen(args) - - elseif iarg < arglen && args[0] == '"' - " handle "quoted" section -" call Decho(".handle quoted section") - let iarg= 1 - while args[iarg] != '"' && iarg < arglen - if args[iarg] == '\' - let args= strpart(args,1) - endif - let iarg= iarg + 1 - endwhile -" call Decho(".args<".args."> iarg=".iarg." arglen=".arglen) - if args[iarg] == '"' - call add(qarglist,strpart(args,1,iarg-1)) - let args= strpart(args,iarg+1) - else - let qarglist = qarglist + split(args) - let args = "" - endif - endif -" call Decho(".qarglist".string(qarglist)." iarg=".iarg." args<".args.">") - endwhile -" call Decho("end of loop (handling quoted arguments)") - - else - " split at all whitespace -" call Decho("split at all whitespace") - let qarglist= split(a:qarg,"[ \t]") - endif - - let qarglistlen= len(qarglist) - let qarglist = insert(qarglist,qarglistlen) -" call Dret("s:QArgSplitter ".string(qarglist)) - return qarglist -endfun - -" --------------------------------------------------------------------- -" s:Strlen: this function returns the length of a string, even if its {{{1 -" using two-byte etc characters. -" Currently, its only used if g:Align_xstrlen is set to a -" nonzero value. Solution from Nicolai Weibull, vim docs -" (:help strlen()), Tony Mechelynck, and my own invention. -fun! s:Strlen(x) -" call Dfunc("s:Strlen(x<".a:x."> g:Align_xstrlen=".g:Align_xstrlen) - - if type(g:Align_xstrlen) == 1 - " allow user to specify a function to compute the string length - exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" - - elseif g:Align_xstrlen == 1 - " number of codepoints (Latin a + combining circumflex is two codepoints) - " (comment from TM, solution from NW) - let ret= strlen(substitute(a:x,'.','c','g')) - - elseif g:Align_xstrlen == 2 - " number of spacing codepoints (Latin a + combining circumflex is one spacing - " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) - " (comment from TM, solution from TM) - let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) - - elseif g:Align_xstrlen == 3 - " virtual length (counting, for instance, tabs as anything between 1 and - " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately - " preceded by lam, one otherwise, etc.) - " (comment from TM, solution from me) - let modkeep= &l:mod - exe "norm! o\" - call setline(line("."),a:x) - let ret= virtcol("$") - 1 - d - keepj norm! k - let &l:mod= modkeep - - else - " at least give a decent default - if v:version >= 703 - let ret= strdisplaywidth(a:x) - else - let ret= strlen(a:x) - endif - endif -" call Dret("s:Strlen ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:SaveUserOptions: {{{1 -fun! s:SaveUserOptions() -" call Dfunc("s:SaveUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) - if !exists("s:saved_user_options") - let s:saved_user_options = 1 - let s:keep_search = @/ - let s:keep_et = &l:et - let s:keep_hls = &hls - let s:keep_ic = &ic - let s:keep_paste = &paste - let s:keep_report = &report - else - let s:saved_user_options = s:saved_user_options + 1 - endif -" call Dret("s:SaveUserOptions : s:saved_user_options=".s:saved_user_options) -endfun - -" --------------------------------------------------------------------- -" s:RestoreUserOptions: {{{1 -fun! s:RestoreUserOptions() -" call Dfunc("s:RestoreUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) - if exists("s:saved_user_options") && s:saved_user_options == 1 - let @/ = s:keep_search - let &l:et = s:keep_et - let &hls = s:keep_hls - let &ic = s:keep_ic - let &paste = s:keep_paste - let &report = s:keep_report - unlet s:keep_search - unlet s:keep_et - unlet s:keep_hls - unlet s:keep_ic - unlet s:keep_paste - unlet s:keep_report - unlet s:saved_user_options - elseif exists("s:saved_user_options") - let s:saved_user_options= s:saved_user_options - 1 - endif -" call Dret("s:RestoreUserOptions : s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a')) -endfun - -" --------------------------------------------------------------------- -" Set up default values: {{{1 -"call Decho("-- Begin AlignCtrl Initialization --") -call Align#AlignCtrl("default") -"call Decho("-- End AlignCtrl Initialization --") - -" --------------------------------------------------------------------- -" Restore: {{{1 -let &cpo= s:keepcpo -unlet s:keepcpo -" vim: ts=4 fdm=marker diff --git a/vim/autoload/AlignMaps.vim b/vim/autoload/AlignMaps.vim deleted file mode 100644 index 9d20513..0000000 --- a/vim/autoload/AlignMaps.vim +++ /dev/null @@ -1,401 +0,0 @@ -" AlignMaps.vim : support functions for AlignMaps -" Author: Charles E. Campbell -" Date: Mar 12, 2013 -" Version: 43 -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" Align.vim is provided *as is* and comes with no warranty -" of any kind, either expressed or implied. By using this -" plugin, you agree that in no event will the copyright -" holder be liable for any damages resulting from the use -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() -" --------------------------------------------------------------------- -" Load Once: {{{1 -if &cp || exists("g:loaded_AlignMaps") - finish -endif -let g:loaded_AlignMaps= "v43" -let s:keepcpo = &cpo -set cpo&vim -"DechoTabOn - -" ===================================================================== -" Functions: {{{1 - -" --------------------------------------------------------------------- -" AlignMaps#WrapperStart: {{{2 -fun! AlignMaps#WrapperStart(vis) range -" call Dfunc("AlignMaps#WrapperStart(vis=".a:vis.")") - - if a:vis - keepj norm! ' - endif - - if line("'y") == 0 || line("'z") == 0 || !exists("s:alignmaps_wrapcnt") || s:alignmaps_wrapcnt <= 0 -" call Decho("wrapper initialization") - let s:alignmaps_wrapcnt = 1 - let s:alignmaps_keepgd = &gdefault - let s:alignmaps_keepsearch = @/ - let s:alignmaps_keepch = &ch - let s:alignmaps_keepmy = SaveMark("'y") - let s:alignmaps_keepmz = SaveMark("'z") - let s:alignmaps_posn = SaveWinPosn(0) - " set up fencepost blank lines - put ='' - keepj norm! mz'a - put! ='' - ky - let s:alignmaps_zline = line("'z") - exe "keepj 'y,'zs/@/\177/ge" - else -" call Decho("embedded wrapper") - let s:alignmaps_wrapcnt = s:alignmaps_wrapcnt + 1 - keepj norm! 'yjma'zk - endif - - " change some settings to align-standard values - set nogd - set ch=2 - AlignPush - keepj norm! 'zk -" call Dret("AlignMaps#WrapperStart : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) -endfun - -" --------------------------------------------------------------------- -" AlignMaps#WrapperEnd: {{{2 -fun! AlignMaps#WrapperEnd() range -" call Dfunc("AlignMaps#WrapperEnd() alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) - - " remove trailing white space introduced by whatever in the modification zone - keepj 'y,'zs/ \+$//e - - " restore AlignCtrl settings - AlignPop - - let s:alignmaps_wrapcnt= s:alignmaps_wrapcnt - 1 - if s:alignmaps_wrapcnt <= 0 - " initial wrapper ending - exe "keepj 'y,'zs/\177/@/ge" - - " if the 'z line hasn't moved, then go ahead and restore window position - let zstationary= s:alignmaps_zline == line("'z") - - " remove fencepost blank lines. - " restore 'a - keepj norm! 'yjmakdd'zdd - - " restore original 'y, 'z, and window positioning - call RestoreMark(s:alignmaps_keepmy) - call RestoreMark(s:alignmaps_keepmz) - if zstationary > 0 - call RestoreWinPosn(s:alignmaps_posn) -" call Decho("restored window positioning") - endif - - " restoration of options - let &gd= s:alignmaps_keepgd - let &ch= s:alignmaps_keepch - let @/ = s:alignmaps_keepsearch - - " remove script variables - unlet s:alignmaps_keepch - unlet s:alignmaps_keepsearch - unlet s:alignmaps_keepmy - unlet s:alignmaps_keepmz - unlet s:alignmaps_keepgd - unlet s:alignmaps_posn - endif - -" call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) -endfun - -" --------------------------------------------------------------------- -" AlignMaps#MakeMap: make both a normal-mode and a visual mode map for mapname {{{2 -fun! AlignMaps#MakeMap(mapname) - if exists("g:maplocalleader") - let maplead= g:maplocalleader - elseif exists("g:mapleader") - let maplead= g:mapleader - else - let maplead= '\' - endif - exe "nmap ".maplead.a:mapname." AM_".a:mapname - exe "vmap ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."" -endfun - -" --------------------------------------------------------------------- -" AlignMaps#StdAlign: some semi-standard align calls {{{2 -fun! AlignMaps#StdAlign(mode) range -" call Dfunc("AlignMaps#StdAlign(mode=".a:mode.")") - if a:mode == 1 - " align on @ -" call Decho("align on @") - AlignCtrl mIp1P1=l @ - 'a,.Align - elseif a:mode == 2 - " align on @, retaining all initial white space on each line -" call Decho("align on @, retaining all initial white space on each line") - AlignCtrl mWp1P1=l @ - 'a,.Align - elseif a:mode == 3 - " like mode 2, but ignore /* */-style comments -" call Decho("like mode 2, but ignore /* */-style comments") - AlignCtrl v ^\s*/[/*] - AlignCtrl mWp1P1=l @ - 'a,.Align - else - echoerr "(AlignMaps) AlignMaps#StdAlign doesn't support mode#".a:mode - endif -" call Dret("AlignMaps#StdAlign") -endfun - -" --------------------------------------------------------------------- -" AlignMaps#CharJoiner: joins lines which end in the given character (spaces {{{2 -" at end are ignored) -fun! AlignMaps#CharJoiner(chr) -" call Dfunc("AlignMaps#CharJoiner(chr=".a:chr.")") - let aline = line("'a") - let rep = line(".") - aline - while rep > 0 - keepj norm! 'a - while match(getline(aline),a:chr . "\s*$") != -1 && rep >= 0 - " while = at end-of-line, delete it and join with next - keepj norm! 'a$ - j! - let rep = rep - 1 - endwhile - " update rep(eat) count - let rep = rep - 1 - if rep <= 0 - " terminate loop if at end-of-block - break - endif - " prepare for next line - keepj norm! jma - let aline = line("'a") - endwhile -" call Dret("AlignMaps#CharJoiner") -endfun - -" --------------------------------------------------------------------- -" AlignMaps#Equals: supports \t= and \T= {{{2 -fun! AlignMaps#Equals() range -" call Dfunc("AlignMaps#Equals()") - keepj 'a,'zs/\s\+\([.*/+\-%|&\~^]\==\)/ \1/e - keepj 'a,'zs@ \+\([.*/+\-%|&\~^]\)=@\1=@ge - keepj 'a,'zs/==/\="\\"/ge - keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\"/ge - keepj norm g'zk - AlignCtrl mIp1P1=l = - AlignCtrl g = - keepj 'a,'z-1Align - keepj 'a,'z-1s@\([.*/%|&\~^!=]\)\( \+\)=@\2\1=@ge - keepj 'a,'z-1s@[^+\-]\zs\([+\-]\)\( \+\)=@\2\1=@ge - keepj 'a,'z-1s/\( \+\);/;\1/ge - if &ft == "c" || &ft == "cpp" -" call Decho("exception for ".&ft) - keepj 'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e - keepj 'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e - if exists("g:mapleader") - exe "keepj norm 'zk" - call AlignMaps#StdAlign(1) - else - exe "keepj norm 'zk" - call AlignMaps#StdAlign(1) - endif - keepj 'y,'zs/^\(\s*\) @/\1/e - endif - keepj 'a,'z-1s/\%x0f/=/ge - keepj 'y,'zs/ @//eg -" call Dret("AlignMaps#Equals") -endfun - -" --------------------------------------------------------------------- -" AlignMaps#Afnc: useful for splitting one-line function beginnings {{{2 -" into one line per argument format -fun! AlignMaps#Afnc() -" call Dfunc("AlignMaps#Afnc()") - - " keep display quiet - let chkeep = &l:ch - let gdkeep = &l:gd - let wwkeep = &l:ww - let vekeep = &l:ve - setlocal ch=2 nogd ve= ww=b,s,<,>,[,] - - " will use marks y,z ; save current values - let mykeep = SaveMark("'y") - let mzkeep = SaveMark("'z") - - " Find beginning of function -- be careful to skip over comments - let cmmntid = synIDtrans(hlID("Comment")) - let stringid = synIDtrans(hlID("String")) - exe "keepj norm! ]]" - while search(")","bW") != 0 -" call Decho("line=".line(".")." col=".col(".")) - let parenid= synIDtrans(synID(line("."),col("."),1)) - if parenid != cmmntid && parenid != stringid - break - endif - endwhile - keepj norm! %my - keepj s/(\s*\(\S\)/(\r \1/e - exe "keepj norm! `y%" - keepj s/)\s*\(\/[*/]\)/)\r\1/e - exe "keepj norm! `y%mz" - keepj 'y,'zs/\s\+$//e - keepj 'y,'zs/^\s\+//e - keepj 'y+1,'zs/^/ / - - " insert newline after every comma only one parenthesis deep - exe "sil! keepj norm! `y\h" - let parens = 1 - let cmmnt = 0 - let cmmntline= -1 - while parens >= 1 - exe 'keepj norm! ma "ay`a ' -" call Decho("parens=".parens." cmmnt=".cmmnt." cmmntline=".cmmntline." line(.)=".line(".")." @a<".@a."> line<".getline(".").">") - if @a == "(" - let parens= parens + 1 - elseif @a == ")" - let parens= parens - 1 - - " comment bypass: /* ... */ or //... - elseif cmmnt == 0 && @a == '/' - let cmmnt= 1 - elseif cmmnt == 1 - if @a == '/' - let cmmnt = 2 " //... - let cmmntline= line(".") - elseif @a == '*' - let cmmnt= 3 " /*... - else - let cmmnt= 0 - endif - elseif cmmnt == 2 && line(".") != cmmntline - let cmmnt = 0 - let cmmntline= -1 - elseif cmmnt == 3 && @a == '*' - let cmmnt= 4 - elseif cmmnt == 4 - if @a == '/' - let cmmnt= 0 " ...*/ - elseif @a != '*' - let cmmnt= 3 - endif - - elseif @a == "," && parens == 1 && cmmnt == 0 - exe "keepj norm! i\\" - endif - endwhile - sil! keepj norm! `y%mz% - sil! keepj 'y,'zg/^\s*$/d - - " perform substitutes to mark fields for Align - sil! keepj 'y+1,'zv/^\//s/^\s\+\(\S\)/ \1/e - sil! keepj 'y+1,'zv/^\//s/\(\S\)\s\+/\1 /eg - sil! keepj 'y+1,'zv/^\//s/\* \+/*/ge - sil! keepj 'y+1,'zv/^\//s/\w\zs\s*\*/ */ge - " func - " ws <- declaration -> <-ptr -> <-var-> <-[array][] -> <-glop-> <-end-> - sil! keepj 'y+1,'zv/^\//s/^\s*\(\(\K\k*\s*\)\+\)\s\+\([(*]*\)\s*\(\K\k*\)\s*\(\(\[.\{-}]\)*\)\s*\(.\{-}\)\=\s*\([,)]\)\s*$/ \1@#\3@\4\5@\7\8/e - sil! keepj 'y+1,'z+1g/^\s*\/[*/]/norm! kJ - sil! keepj 'y+1,'z+1s%/[*/]%@&@%ge - sil! keepj 'y+1,'z+1s%*/%@&%ge - AlignCtrl mIp0P0=l @ - sil! keepj 'y+1,'zAlign - sil! keepj 'y,'zs%@\(/[*/]\)@%\t\1 %e - sil! keepj 'y,'zs%@\*/% */%e - sil! keepj 'y,'zs/@\([,)]\)/\1/ - sil! keepj 'y,'zs/@/ / - AlignCtrl mIlrp0P0= # @ - sil! keepj 'y+1,'zAlign - sil! keepj 'y+1,'zs/#/ / - sil! keepj 'y+1,'zs/@// - sil! keepj 'y+1,'zs/\(\s\+\)\([,)]\)/\2\1/e - - " Restore - call RestoreMark(mykeep) - call RestoreMark(mzkeep) - let &l:ch= chkeep - let &l:gd= gdkeep - let &l:ww= wwkeep - let &l:ve= vekeep - -" call Dret("AlignMaps#Afnc") -endfun - -" --------------------------------------------------------------------- -" AlignMaps#FixMultiDec: converts a type arg,arg,arg; line to multiple lines {{{2 -fun! AlignMaps#FixMultiDec() -" call Dfunc("AlignMaps#FixMultiDec()") - - " save register x - let xkeep = @x - let curline = getline(".") -" call Decho("curline<".curline.">") - - let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+[(*]*\h.*$','\1','') -" call Decho("@x<".@x.">") - - " transform line - exe 'keepj s/,/;\r'.@x.' /ge' - - "restore register x - let @x= xkeep - -" call Dret("AlignMaps#FixMultiDec : my=".line("'y")." mz=".line("'z")) -endfun - -" --------------------------------------------------------------------- -" AlignMaps#AlignMapsClean: this function removes the AlignMaps plugin {{{2 -fun! AlignMaps#AlignMapsClean() -" call Dfunc("AlignMaps#AlignMapsClean()") - for home in split(&rtp,',') + [''] -" call Decho("considering home<".home.">") - if isdirectory(home) - if filereadable(home."/autoload/AlignMaps.vim") -" call Decho("deleting ".home."/autoload/AlignMaps.vim") - call delete(home."/autoload/AlignMaps.vim") - endif - if filereadable(home."/plugin/AlignMapsPlugin.vim") -" call Decho("deleting ".home."/plugin/AlignMapsPlugin.vim") - call delete(home."/plugin/AlignMapsPlugin.vim") - endif - endif - endfor -" call Dret("AlignMaps#AlignMapsClean") -endfun - -" --------------------------------------------------------------------- -" AlignMaps#Vis: interfaces with visual maps {{{2 -fun! AlignMaps#Vis(plugmap) range -" call Dfunc("AlignMaps#VisCall(plugmap<".a:plugmap.">) ".a:firstline.",".a:lastline) - - let amark= SaveMark("a") - exe a:firstline - ka - exe a:lastline - - if exists("g:maplocalleader") - let maplead= g:maplocalleader - elseif exists("g:mapleader") - let maplead= g:mapleader - else - let maplead= '\' - endif - -" call Decho("exe norm ".maplead.a:plugmap) - exe " norm ".maplead.a:plugmap - - call RestoreMark(amark) -" call Dret("AlignMaps#VisCall") -endfun - -" --------------------------------------------------------------------- -" Restore: {{{1 -let &cpo= s:keepcpo -unlet s:keepcpo -" vim: ts=4 fdm=marker diff --git a/vim/autoload/conque_term.vim b/vim/autoload/conque_term.vim deleted file mode 100644 index 856b97b..0000000 --- a/vim/autoload/conque_term.vim +++ /dev/null @@ -1,1504 +0,0 @@ -" FILE: autoload/conque_term.vim {{{ -" AUTHOR: Nico Raffo -" WEBSITE: http://conque.googlecode.com -" MODIFIED: 2011-08-12 -" VERSION: 2.2, for Vim 7.0 -" LICENSE: -" Conque - Vim terminal/console emulator -" Copyright (C) 2009-__YEAR__ Nico Raffo -" -" MIT License -" -" Permission is hereby granted, free of charge, to any person obtaining a copy -" of this software and associated documentation files (the "Software"), to deal -" in the Software without restriction, including without limitation the rights -" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -" copies of the Software, and to permit persons to whom the Software is -" furnished to do so, subject to the following conditions: -" -" The above copyright notice and this permission notice shall be included in -" all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -" THE SOFTWARE. -" }}} - -" ********************************************************************************************************** -" **** GLOBAL INITIALIZATION ******************************************************************************* -" ********************************************************************************************************** - -" {{{ - -" load plugin file if it hasn't already been loaded (e.g. conque_term#foo() is used in .vimrc) -if !exists('g:ConqueTerm_Loaded') - runtime! plugin/conque_term.vim -endif - -" path to conque install directories -let s:scriptdir = expand(":h") . '/' -let s:scriptdirpy = expand(":h") . '/conque_term/' - -" global list of terminal instances -let s:term_obj = {'idx': 1, 'var': '', 'is_buffer': 1, 'active': 1, 'buffer_name': '', 'command': ''} -let g:ConqueTerm_Terminals = {} - -" global lists of registered functions -let s:hooks = { 'after_startup': [], 'buffer_enter': [], 'buffer_leave': [], 'after_keymap': [] } - -" required for session support -if g:ConqueTerm_SessionSupport == 1 - set sessionoptions+=globals - try - sil! let s:saved_terminals = eval(g:ConqueTerm_TerminalsString) - catch - let s:saved_terminals = {} - endtry -endif - -" more session support -let g:ConqueTerm_TerminalsString = '' - -" init terminal counter -let g:ConqueTerm_Idx = 0 - -" we clobber this value later -let s:save_updatetime = &updatetime - -" have we called the init() function yet? -let s:initialized = 0 - - -" }}} - -" ********************************************************************************************************** -" **** SYSTEM DETECTION ************************************************************************************ -" ********************************************************************************************************** - -" {{{ - -" Display various error messages -function! conque_term#fail(feature) " {{{ - - " create a new buffer - new - setlocal buftype=nofile - setlocal nonumber - setlocal foldcolumn=0 - setlocal wrap - setlocal noswapfile - - " missing vim features - if a:feature == 'python' - - call append('$', 'Conque ERROR: Python interface cannot be loaded') - call append('$', '') - - if !executable("python") - call append('$', 'Your version of Vim appears to be installed without the Python interface. In ') - call append('$', 'addition, you may need to install Python.') - else - call append('$', 'Your version of Vim appears to be installed without the Python interface.') - endif - - call append('$', '') - - if has('unix') == 1 - call append('$', "You are using a Unix-like operating system. Most, if not all, of the popular ") - call append('$', "Linux package managers have Python-enabled Vim available. For example ") - call append('$', "vim-gnome or vim-gtk on Ubuntu will get you everything you need.") - call append('$', "") - call append('$', "If you are compiling Vim from source, make sure you use the --enable-pythoninterp ") - call append('$', "configure option. You will also need to install Python and the Python headers.") - call append('$', "") - call append('$', "If you are using OS X, MacVim will give you Python support by default.") - else - call append('$', "You appear to be using Windows. The official Vim 7.3 installer available at ") - call append('$', "http://www.vim.org comes with the required Python interfaces. You will also ") - call append('$', "need to install Python 2.7 and/or Python 3.1, both available at http://www.python.org") - endif - - elseif a:feature == 'python_exe' - - call append('$', "Conque ERROR: Can't find Python executable") - call append('$', "") - call append('$', "Conque needs to know the full path to python.exe on Windows systems. By default, ") - call append('$', "Conque will check your system path as well as the most common installation path ") - call append('$', "C:\\PythonXX\\python.exe. To fix this error either:") - call append('$', "") - call append('$', "Set the g:ConqueTerm_PyExe option in your .vimrc. E.g.") - call append('$', " let g:ConqueTerm_PyExe = 'C:\Program Files\Python27\python.exe'") - call append('$', "") - call append('$', "Add the directory where you installed python to your system path. This isn't a bad ") - call append('$', "idea in general.") - - elseif a:feature == 'ctypes' - - call append('$', 'Conque ERROR: Python cannot load the ctypes module') - call append('$', "") - call append('$', "Conque requires the 'ctypes' python module. This has been a standard module since Python 2.5.") - call append('$', "") - call append('$', "The recommended fix is to make sure you're using the latest official GVim version 7.3, ") - call append('$', "and have at least one of the two compatible versions of Python installed, ") - call append('$', "2.7 or 3.1. You can download the GVim 7.3 installer from http://www.vim.org. You ") - call append('$', "can download the Python 2.7 or 3.1 installer from http://www.python.org") - - endif - -endfunction " }}} - -" Go through various system checks before attempting to launch conque -function! conque_term#dependency_check() " {{{ - - " don't recheck the second time 'round - if s:initialized == 1 - return 1 - endif - - " choose a python version - let s:py = '' - if g:ConqueTerm_PyVersion == 3 - let pytest = 'python3' - else - let pytest = 'python' - let g:ConqueTerm_PyVersion = 2 - endif - - " first test the requested version - if has(pytest) - if pytest == 'python3' - let s:py = 'py3' - else - let s:py = 'py' - endif - - " otherwise use the other version - else - let py_alternate = 5 - g:ConqueTerm_PyVersion - if py_alternate == 3 - let pytest = 'python3' - else - let pytest = 'python' - endif - if has(pytest) - echohl WarningMsg | echomsg "Python " . g:ConqueTerm_PyVersion . " interface is not installed, using Python " . py_alternate . " instead" | echohl None - let g:ConqueTerm_PyVersion = py_alternate - if pytest == 'python3' - let s:py = 'py3' - else - let s:py = 'py' - endif - endif - endif - - " test if we actually found a python version - if s:py == '' - call conque_term#fail('python') - return 0 - endif - - " quick and dirty platform declaration - if has('unix') == 1 - let s:platform = 'unix' - sil exe s:py . " CONQUE_PLATFORM = 'unix'" - else - let s:platform = 'windows' - sil exe s:py . " CONQUE_PLATFORM = 'windows'" - endif - - " if we're using Windows, make sure ctypes is available - if s:platform == 'windows' - try - sil exe s:py . " import ctypes" - catch - call conque_term#fail('ctypes') - return 0 - endtry - endif - - " if we're using Windows, make sure we can finde python executable - if s:platform == 'windows' && conque_term#find_python_exe() == '' - call conque_term#fail('python_exe') - return 0 - endif - - " check for global cursorhold/cursormove events - let o = '' - silent redir => o - silent autocmd CursorHoldI,CursorMovedI - redir END - for line in split(o, "\n") - if line =~ '^ ' || line =~ '^--' || line =~ 'matchparen' - continue - endif - if g:ConqueTerm_StartMessages - echohl WarningMsg | echomsg "Warning: Global CursorHoldI and CursorMovedI autocommands may cause ConqueTerm to run slowly." | echohl None - endif - endfor - - " check for compatible mode - if &compatible == 1 - echohl WarningMsg | echomsg "Warning: Conque may not function normally in 'compatible' mode." | echohl None - endif - - " check for fast mode - if g:ConqueTerm_FastMode - sil exe s:py . " CONQUE_FAST_MODE = True" - else - sil exe s:py . " CONQUE_FAST_MODE = False" - endif - - " if we're all good, load python files - call conque_term#load_python() - - return 1 - -endfunction " }}} - -" }}} - -" ********************************************************************************************************** -" **** STARTUP MESSAGES ************************************************************************************ -" ********************************************************************************************************** - -" {{{ -"if g:ConqueTerm_StartMessages -" let msg_file = s:scriptdirpy . 'version.vim' -" let msg_show = 1 -" let msg_ct = 1 -" -" " we can write to conque_term directory -" if filewritable(s:scriptdirpy) == 2 -" -" if filewritable(msg_file) -" -" " read current message file -" try -" silent execute "source " . msg_file -" if exists('g:ConqueTerm_MsgCt') && exists('g:ConqueTerm_MsgVer') -" if g:ConqueTerm_MsgVer == g:ConqueTerm_Version && g:ConqueTerm_MsgCt > 2 -" let msg_show = 0 -" else -" let msg_ct = g:ConqueTerm_MsgCt + 1 -" endif -" endif -" catch -" endtry -" endif -" -" " update message file -" if msg_show -" let file_contents = ['let g:ConqueTerm_MsgCt = ' . msg_ct, 'let g:ConqueTerm_MsgVer = ' . g:ConqueTerm_Version] -" call writefile(file_contents, msg_file) -" endif -" endif -" -" " save our final decision -" let g:ConqueTerm_StartMessages = msg_show -"endif -" }}} - -" ********************************************************************************************************** -" **** WINDOWS VK CODES ************************************************************************************ -" ********************************************************************************************************** - -" Windows Virtual Key Codes {{{ -let s:windows_vk = { -\ 'VK_ADD' : 107, -\ 'VK_APPS' : 93, -\ 'VK_ATTN' : 246, -\ 'VK_BACK' : 8, -\ 'VK_BROWSER_BACK' : 166, -\ 'VK_BROWSER_FORWARD' : 167, -\ 'VK_CANCEL' : 3, -\ 'VK_CAPITAL' : 20, -\ 'VK_CLEAR' : 12, -\ 'VK_CONTROL' : 17, -\ 'VK_CONVERT' : 28, -\ 'VK_CRSEL' : 247, -\ 'VK_DECIMAL' : 110, -\ 'VK_DELETE' : 46, -\ 'VK_DIVIDE' : 111, -\ 'VK_DOWN' : 40, -\ 'VK_DOWN_CTL' : '40;1024', -\ 'VK_END' : 35, -\ 'VK_EREOF' : 249, -\ 'VK_ESCAPE' : 27, -\ 'VK_EXECUTE' : 43, -\ 'VK_EXSEL' : 248, -\ 'VK_F1' : 112, -\ 'VK_F10' : 121, -\ 'VK_F11' : 122, -\ 'VK_F12' : 123, -\ 'VK_F13' : 124, -\ 'VK_F14' : 125, -\ 'VK_F15' : 126, -\ 'VK_F16' : 127, -\ 'VK_F17' : 128, -\ 'VK_F18' : 129, -\ 'VK_F19' : 130, -\ 'VK_F2' : 113, -\ 'VK_F20' : 131, -\ 'VK_F21' : 132, -\ 'VK_F22' : 133, -\ 'VK_F23' : 134, -\ 'VK_F24' : 135, -\ 'VK_F3' : 114, -\ 'VK_F4' : 115, -\ 'VK_F5' : 116, -\ 'VK_F6' : 117, -\ 'VK_F7' : 118, -\ 'VK_F8' : 119, -\ 'VK_F9' : 120, -\ 'VK_FINAL' : 24, -\ 'VK_HANGEUL' : 21, -\ 'VK_HANGUL' : 21, -\ 'VK_HANJA' : 25, -\ 'VK_HELP' : 47, -\ 'VK_HOME' : 36, -\ 'VK_INSERT' : 45, -\ 'VK_JUNJA' : 23, -\ 'VK_KANA' : 21, -\ 'VK_KANJI' : 25, -\ 'VK_LBUTTON' : 1, -\ 'VK_LCONTROL' : 162, -\ 'VK_LEFT' : 37, -\ 'VK_LEFT_CTL' : '37;1024', -\ 'VK_LMENU' : 164, -\ 'VK_LSHIFT' : 160, -\ 'VK_LWIN' : 91, -\ 'VK_MBUTTON' : 4, -\ 'VK_MEDIA_NEXT_TRACK' : 176, -\ 'VK_MEDIA_PLAY_PAUSE' : 179, -\ 'VK_MEDIA_PREV_TRACK' : 177, -\ 'VK_MENU' : 18, -\ 'VK_MODECHANGE' : 31, -\ 'VK_MULTIPLY' : 106, -\ 'VK_NEXT' : 34, -\ 'VK_NONAME' : 252, -\ 'VK_NONCONVERT' : 29, -\ 'VK_NUMLOCK' : 144, -\ 'VK_NUMPAD0' : 96, -\ 'VK_NUMPAD1' : 97, -\ 'VK_NUMPAD2' : 98, -\ 'VK_NUMPAD3' : 99, -\ 'VK_NUMPAD4' : 100, -\ 'VK_NUMPAD5' : 101, -\ 'VK_NUMPAD6' : 102, -\ 'VK_NUMPAD7' : 103, -\ 'VK_NUMPAD8' : 104, -\ 'VK_NUMPAD9' : 105, -\ 'VK_OEM_CLEAR' : 254, -\ 'VK_PA1' : 253, -\ 'VK_PAUSE' : 19, -\ 'VK_PLAY' : 250, -\ 'VK_PRINT' : 42, -\ 'VK_PRIOR' : 33, -\ 'VK_PROCESSKEY' : 229, -\ 'VK_RBUTTON' : 2, -\ 'VK_RCONTROL' : 163, -\ 'VK_RETURN' : 13, -\ 'VK_RIGHT' : 39, -\ 'VK_RIGHT_CTL' : '39;1024', -\ 'VK_RMENU' : 165, -\ 'VK_RSHIFT' : 161, -\ 'VK_RWIN' : 92, -\ 'VK_SCROLL' : 145, -\ 'VK_SELECT' : 41, -\ 'VK_SEPARATOR' : 108, -\ 'VK_SHIFT' : 16, -\ 'VK_SNAPSHOT' : 44, -\ 'VK_SPACE' : 32, -\ 'VK_SUBTRACT' : 109, -\ 'VK_TAB' : 9, -\ 'VK_UP' : 38, -\ 'VK_UP_CTL' : '38;1024', -\ 'VK_VOLUME_DOWN' : 174, -\ 'VK_VOLUME_MUTE' : 173, -\ 'VK_VOLUME_UP' : 175, -\ 'VK_XBUTTON1' : 5, -\ 'VK_XBUTTON2' : 6, -\ 'VK_ZOOM' : 251 -\ } -" }}} - -" ********************************************************************************************************** -" **** ACTUAL CONQUE FUNCTIONS! *************************************************************************** -" ********************************************************************************************************** - -" {{{ - -" launch conque -function! conque_term#open(...) "{{{ - let command = get(a:000, 0, '') - let vim_startup_commands = get(a:000, 1, []) - let return_to_current = get(a:000, 2, 0) - let is_buffer = get(a:000, 3, 1) - - " dependency check - if !conque_term#dependency_check() - return 0 - endif - - " switch to buffer if needed - if is_buffer && return_to_current - let save_sb = &switchbuf - sil set switchbuf=usetab - let current_buffer = bufname("%") - endif - - " bare minimum validation - if s:py == '' - echohl WarningMsg | echomsg "Conque requires the Python interface to be installed. See :help ConqueTerm for more information." | echohl None - return 0 - endif - if empty(command) - echohl WarningMsg | echomsg "Invalid usage: no program path given. Use :ConqueTerm YOUR PROGRAM, e.g. :ConqueTerm ipython" | echohl None - return 0 - else - let cmd_args = split(command, '[^\\]\@<=\s') - let cmd_args[0] = substitute(cmd_args[0], '\\ ', ' ', 'g') - if !executable(cmd_args[0]) - echohl WarningMsg | echomsg "Not an executable: " . cmd_args[0] | echohl None - return 0 - endif - endif - - " initialize global identifiers - let g:ConqueTerm_Idx += 1 - let g:ConqueTerm_Var = 'ConqueTerm_' . g:ConqueTerm_Idx - let g:ConqueTerm_BufName = substitute(command, ' ', '\\ ', 'g') . "\\ -\\ " . g:ConqueTerm_Idx - - " initialize global mappings if needed - call conque_term#init() - - " set Vim buffer window options - if is_buffer - call conque_term#set_buffer_settings(command, vim_startup_commands) - - let b:ConqueTerm_Idx = g:ConqueTerm_Idx - let b:ConqueTerm_Var = g:ConqueTerm_Var - endif - - " save terminal instance - let t_obj = conque_term#create_terminal_object(g:ConqueTerm_Idx, is_buffer, g:ConqueTerm_BufName, command) - let g:ConqueTerm_Terminals[g:ConqueTerm_Idx] = t_obj - - " required for session support - let g:ConqueTerm_TerminalsString = string(g:ConqueTerm_Terminals) - - " open command - try - let options = {} - let options["TERM"] = g:ConqueTerm_TERM - let options["CODE_PAGE"] = g:ConqueTerm_CodePage - let options["color"] = g:ConqueTerm_Color - let options["offset"] = 0 " g:ConqueTerm_StartMessages * 10 - - if s:platform == 'unix' - execute s:py . ' ' . g:ConqueTerm_Var . ' = Conque()' - execute s:py . ' ' . g:ConqueTerm_Var . ".open()" - else - " find python.exe and communicator - let py_exe = conque_term#find_python_exe() - let py_vim = s:scriptdirpy . 'conque_sole_communicator.py' - execute s:py . ' ' . g:ConqueTerm_Var . ' = ConqueSole()' - execute s:py . ' ' . g:ConqueTerm_Var . ".open()" - - if g:ConqueTerm_ColorMode == 'conceal' - call conque_term#init_conceal_color() - endif - endif - catch - echohl WarningMsg | echomsg "An error occurred: " . command | echohl None - return 0 - endtry - - " set key mappings and auto commands - if is_buffer - call conque_term#set_mappings('start') - endif - - " call user defined functions - call conque_term#call_hooks('after_startup', t_obj) - - " switch to buffer if needed - if is_buffer && return_to_current - sil exe ":sb " . current_buffer - sil exe ":set switchbuf=" . save_sb - elseif is_buffer - startinsert! - endif - - return t_obj - -endfunction "}}} - -" open(), but no buffer -function! conque_term#subprocess(command) " {{{ - - let t_obj = conque_term#open(a:command, [], 0, 0) - if !exists('b:ConqueTerm_Var') - call conque_term#on_blur() - sil exe s:py . ' ' . g:ConqueTerm_Var . '.idle()' - endif - return t_obj - -endfunction " }}} - -" set buffer options -function! conque_term#set_buffer_settings(command, vim_startup_commands) "{{{ - - " optional hooks to execute, e.g. 'split' - for h in a:vim_startup_commands - sil exe h - endfor - sil exe 'edit ++enc=utf-8 ' . g:ConqueTerm_BufName - - " buffer settings - setlocal fileencoding=utf-8 " file encoding, even tho there's no file - setlocal nopaste " conque won't work in paste mode - setlocal buftype=nofile " this buffer is not a file, you can't save it - setlocal nonumber " hide line numbers - if v:version >= 703 - setlocal norelativenumber " hide relative line numbers (VIM >= 7.3) - endif - setlocal foldcolumn=0 " reasonable left margin - setlocal nowrap " default to no wrap (esp with MySQL) - setlocal noswapfile " don't bother creating a .swp file - setlocal scrolloff=0 " don't use buffer lines. it makes the 'clear' command not work as expected - setlocal sidescrolloff=0 " don't use buffer lines. it makes the 'clear' command not work as expected - setlocal sidescroll=1 " don't use buffer lines. it makes the 'clear' command not work as expected - setlocal foldmethod=manual " don't fold on {{{}}} and stuff - setlocal bufhidden=hide " when buffer is no longer displayed, don't wipe it out - setlocal noreadonly " this is not actually a readonly buffer - if v:version >= 703 - setlocal conceallevel=3 - setlocal concealcursor=nic - endif - if g:ConqueTerm_ReadUnfocused - set cpoptions+=I " Don't remove autoindent when moving cursor up and down - endif - setfiletype conque_term " useful - sil exe "setlocal syntax=" . g:ConqueTerm_Syntax - - " temporary global settings go in here - call conque_term#on_focus(1) - -endfunction " }}} - -" send normal character key press to terminal -function! conque_term#key_press() "{{{ - sil exe s:py . ' ' . b:ConqueTerm_Var . ".write_buffered_ord(" . char2nr(v:char) . ")" - sil let v:char = '' -endfunction " }}} - -" set key mappings and auto commands -function! conque_term#set_mappings(action) "{{{ - - " set action {{{ - if a:action == 'toggle' - if exists('b:conque_on') && b:conque_on == 1 - let l:action = 'stop' - echohl WarningMsg | echomsg "Terminal is paused" | echohl None - else - let l:action = 'start' - echohl WarningMsg | echomsg "Terminal is resumed" | echohl None - endif - else - let l:action = a:action - endif - - " if mappings are being removed, add 'un' - let map_modifier = 'nore' - if l:action == 'stop' - let map_modifier = 'un' - endif - " }}} - - " auto commands {{{ - if l:action == 'stop' - sil exe 'autocmd! ' . b:ConqueTerm_Var - - else - sil exe 'augroup ' . b:ConqueTerm_Var - - " handle unexpected closing of shell, passes HUP to parent and all child processes - sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufUnload ' . s:py . ' ' . b:ConqueTerm_Var . '.close()' - - " check for resized/scrolled buffer when entering buffer - sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufEnter ' . s:py . ' ' . b:ConqueTerm_Var . '.update_window_size()' - sil exe 'autocmd ' . b:ConqueTerm_Var . ' VimResized ' . s:py . ' ' . b:ConqueTerm_Var . '.update_window_size()' - - " set/reset updatetime on entering/exiting buffer - sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufEnter call conque_term#on_focus()' - sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufLeave call conque_term#on_blur()' - - " reposition cursor when going into insert mode - sil exe 'autocmd ' . b:ConqueTerm_Var . ' InsertEnter ' . s:py . ' ' . b:ConqueTerm_Var . '.insert_enter()' - - " poll for more output - sil exe 'autocmd ' . b:ConqueTerm_Var . ' CursorHoldI ' . s:py . ' ' . b:ConqueTerm_Var . '.auto_read()' - endif - " }}} - - " map ASCII 1-31 {{{ - for c in range(1, 31) - " - if c == 27 || c == 3 - continue - endif - if l:action == 'start' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(' . c . ')' - else - sil exe 'i' . map_modifier . 'map ' - endif - endfor - " bonus mapping: send in normal mode to terminal as well for panic interrupts - if l:action == 'start' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(3)' - sil exe 'n' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(3)' - else - sil exe 'i' . map_modifier . 'map ' - sil exe 'n' . map_modifier . 'map ' - endif - - " leave insert mode - if !exists('g:ConqueTerm_EscKey') || g:ConqueTerm_EscKey == '' - " use to send to terminal - if l:action == 'start' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(27)' - else - sil exe 'i' . map_modifier . 'map ' - endif - else - " use to send to terminal - if l:action == 'start' - sil exe 'i' . map_modifier . 'map ' . g:ConqueTerm_EscKey . ' ' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(27)' - else - sil exe 'i' . map_modifier . 'map ' . g:ConqueTerm_EscKey - sil exe 'i' . map_modifier . 'map ' - endif - endif - - " Map in insert mode - if exists('g:ConqueTerm_CWInsert') && g:ConqueTerm_CWInsert == 1 - inoremap - endif - " }}} - - " map 33 and beyond {{{ - if exists('##InsertCharPre') && g:ConqueTerm_InsertCharPre == 1 - if l:action == 'start' - autocmd InsertCharPre call conque_term#key_press() - else - autocmd! InsertCharPre - endif - else - for i in range(33, 127) - " - if i == 124 - if l:action == 'start' - sil exe "i" . map_modifier . "map :" . s:py . ' ' . b:ConqueTerm_Var . ".write_ord(124)" - else - sil exe "i" . map_modifier . "map " - endif - continue - endif - if l:action == 'start' - sil exe "i" . map_modifier . "map " . nr2char(i) . " :" . s:py . ' ' . b:ConqueTerm_Var . ".write_ord(" . i . ")" - else - sil exe "i" . map_modifier . "map " . nr2char(i) - endif - endfor - endif - " }}} - - " Special keys {{{ - if l:action == 'start' - if s:platform == 'unix' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[A"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[B"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[C"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[D"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1bOH"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1bOF"))' - else - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))' - - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))' - - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_UP . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_DOWN . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_RIGHT . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_LEFT . ')' - - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_UP_CTL . '")' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_DOWN_CTL . '")' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_RIGHT_CTL . '")' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_LEFT_CTL . '")' - - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_DELETE . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_HOME . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_END . ')' - endif - else - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - endif - " }}} - - " keys {{{ - if g:ConqueTerm_SendFunctionKeys - if l:action == 'start' - if s:platform == 'unix' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[11~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[12~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("1b[13~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[14~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[15~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[17~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[18~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[19~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[20~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[21~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[23~"))' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[24~"))' - else - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F1 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F2 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F3 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F4 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F5 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F6 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F7 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F8 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F9 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F10 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F11 . ')' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_F12 . ')' - endif - else - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - endif - endif - " }}} - - " various global mappings {{{ - " don't overwrite existing mappings - if l:action == 'start' - if maparg(g:ConqueTerm_SendVisKey, 'v') == '' - sil exe 'v' . map_modifier . 'map ' . g:ConqueTerm_SendVisKey . ' :call conque_term#send_selected(visualmode())' - endif - if maparg(g:ConqueTerm_SendFileKey, 'n') == '' - sil exe 'n' . map_modifier . 'map ' . g:ConqueTerm_SendFileKey . ' :call conque_term#send_file()' - endif - endif - " }}} - - " remap paste keys {{{ - if l:action == 'start' - sil exe 'n' . map_modifier . 'map p :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@@")a' - sil exe 'n' . map_modifier . 'map P :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@@")a' - sil exe 'n' . map_modifier . 'map ]p :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@@")a' - sil exe 'n' . map_modifier . 'map [p :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@@")a' - else - sil exe 'n' . map_modifier . 'map p' - sil exe 'n' . map_modifier . 'map P' - sil exe 'n' . map_modifier . 'map ]p' - sil exe 'n' . map_modifier . 'map [p' - endif - if has('gui_running') == 1 - if l:action == 'start' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@+")a' - sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_expr("@+")a' - else - sil exe 'i' . map_modifier . 'map ' - sil exe 'i' . map_modifier . 'map ' - endif - endif - " }}} - - " disable other normal mode keys which insert text {{{ - if l:action == 'start' - sil exe 'n' . map_modifier . 'map r :echo "Replace mode disabled in shell."' - sil exe 'n' . map_modifier . 'map R :echo "Replace mode disabled in shell."' - sil exe 'n' . map_modifier . 'map c :echo "Change mode disabled in shell."' - sil exe 'n' . map_modifier . 'map C :echo "Change mode disabled in shell."' - sil exe 'n' . map_modifier . 'map s :echo "Change mode disabled in shell."' - sil exe 'n' . map_modifier . 'map S :echo "Change mode disabled in shell."' - else - sil exe 'n' . map_modifier . 'map r' - sil exe 'n' . map_modifier . 'map R' - sil exe 'n' . map_modifier . 'map c' - sil exe 'n' . map_modifier . 'map C' - sil exe 'n' . map_modifier . 'map s' - sil exe 'n' . map_modifier . 'map S' - endif - " }}} - - " set conque as on or off {{{ - if l:action == 'start' - let b:conque_on = 1 - else - let b:conque_on = 0 - endif - " }}} - - " map command to toggle terminal key mappings {{{ - if a:action == 'start' - sil exe 'nnoremap ' . g:ConqueTerm_ToggleKey . ' :call conque_term#set_mappings("toggle")' - endif - " }}} - - " call user defined functions - if l:action == 'start' - call conque_term#call_hooks('after_keymap', conque_term#get_instance()) - endif - -endfunction " }}} - -" Initialize global mappings. Should only be called once per Vim session -function! conque_term#init() " {{{ - - if s:initialized == 1 - return - endif - - augroup ConqueTerm - - " abort any remaining running terminals when Vim exits - autocmd ConqueTerm VimLeave * call conque_term#close_all() - - " read more output when this isn't the current buffer - if g:ConqueTerm_ReadUnfocused == 1 - autocmd ConqueTerm CursorHold * call conque_term#read_all(0) - endif - - let s:initialized = 1 - -endfunction " }}} - -" read from all known conque buffers -function! conque_term#read_all(insert_mode) "{{{ - - for i in range(1, g:ConqueTerm_Idx) - try - if !g:ConqueTerm_Terminals[i].active - continue - endif - - let output = g:ConqueTerm_Terminals[i].read(1) - - if !g:ConqueTerm_Terminals[i].is_buffer && exists('*g:ConqueTerm_Terminals[i].callback') - call g:ConqueTerm_Terminals[i].callback(output) - endif - catch - " probably a deleted buffer - endtry - endfor - - " restart updatetime - if a:insert_mode - "call feedkeys("\f\e", "n") - let p = getpos('.') - if p[1] == 1 - sil exe 'call feedkeys("\\", "n")' - else - sil exe 'call feedkeys("\\", "n")' - endif - call setpos('.', p) - else - call feedkeys("f\e", "n") - endif - -endfunction "}}} - -" close all subprocesses -function! conque_term#close_all() "{{{ - - for i in range(1, g:ConqueTerm_Idx) - try - call g:ConqueTerm_Terminals[i].close() - catch - " probably a deleted buffer - endtry - endfor - -endfunction "}}} - -" gets called when user enters conque buffer. -" Useful for making temp changes to global config -function! conque_term#on_focus(...) " {{{ - - let startup = get(a:000, 0, 0) - - " Disable NeoComplCache. It has global hooks on CursorHold and CursorMoved :-/ - let s:NeoComplCache_WasEnabled = exists(':NeoComplCacheLock') - if s:NeoComplCache_WasEnabled == 2 - NeoComplCacheLock - endif - - if g:ConqueTerm_ReadUnfocused == 1 - autocmd! ConqueTerm CursorHoldI * - autocmd! ConqueTerm CursorHold * - endif - - " set poll interval to 50ms - set updatetime=50 - - " resume subprocess fast polling - if startup == 0 && exists('b:ConqueTerm_Var') - sil exe s:py . ' ' . g:ConqueTerm_Var . '.resume()' - endif - - " call user defined functions - if startup == 0 - call conque_term#call_hooks('buffer_enter', conque_term#get_instance()) - endif - - " if configured, go into insert mode - if g:ConqueTerm_InsertOnEnter == 1 - startinsert! - endif - -endfunction " }}} - -" gets called when user exits conque buffer. -" Useful for resetting changes to global config -function! conque_term#on_blur() " {{{ - " re-enable NeoComplCache if needed - if exists('s:NeoComplCache_WasEnabled') && exists(':NeoComplCacheUnlock') && s:NeoComplCache_WasEnabled == 2 - NeoComplCacheUnlock - endif - - " turn off subprocess fast polling - if exists('b:ConqueTerm_Var') - sil exe s:py . ' ' . b:ConqueTerm_Var . '.idle()' - endif - - " reset poll interval - if g:ConqueTerm_ReadUnfocused == 1 - set updatetime=1000 - autocmd ConqueTerm CursorHoldI * call conque_term#read_all(1) - autocmd ConqueTerm CursorHold * call conque_term#read_all(0) - elseif exists('s:save_updatetime') - exe 'set updatetime=' . s:save_updatetime - else - set updatetime=2000 - endif - - " call user defined functions - call conque_term#call_hooks('buffer_leave', conque_term#get_instance()) - -endfunction " }}} - -" bell event (^G) -function! conque_term#bell() " {{{ - echohl WarningMsg | echomsg "BELL!" | echohl None -endfunction " }}} - -" register function to be called at conque events -function! conque_term#register_function(event, function_name) " {{{ - - if !has_key(s:hooks, a:event) - echomsg 'No such event: ' . a:event - return - endif - - if !exists('*' . a:function_name) - echomsg 'No such function: ' . a:function_name) - return - endif - - " register the function - call add(s:hooks[a:event], function(a:function_name)) - -endfunction " }}} - -" call hooks for an event -function! conque_term#call_hooks(event, t_obj) " {{{ - - for Fu in s:hooks[a:event] - call Fu(a:t_obj) - endfor - -endfunction " }}} - -" }}} - -" ********************************************************************************************************** -" **** Windows only functions ****************************************************************************** -" ********************************************************************************************************** - -" {{{ - -" find python.exe in windows -function! conque_term#find_python_exe() " {{{ - - " first check configuration for custom value - if g:ConqueTerm_PyExe != '' && executable(g:ConqueTerm_PyExe) - return g:ConqueTerm_PyExe - endif - - let sys_paths = split($PATH, ';') - - " get exact python version - sil exe ':' . s:py . ' import sys, vim' - sil exe ':' . s:py . ' vim.command("let g:ConqueTerm_PyVersion = " + str(sys.version_info[0]) + str(sys.version_info[1]))' - - " ... and add to path list - call add(sys_paths, 'C:\Python' . g:ConqueTerm_PyVersion) - call reverse(sys_paths) - - " check if python.exe is in paths - for path in sys_paths - let cand = path . '\' . 'python.exe' - if executable(cand) - return cand - endif - endfor - - echohl WarningMsg | echomsg "Unable to find python.exe, see :help ConqueTerm_PythonExe for more information" | echohl None - - return '' - -endfunction " }}} - -" initialize concealed colors -function! conque_term#init_conceal_color() " {{{ - - highlight link ConqueCCBG Normal - - " foreground colors, low intensity - syn region ConqueCCF000 matchgroup=ConqueConceal start="\esf000;" end="\eef000;" concealends contains=ConqueCCBG - syn region ConqueCCF00c matchgroup=ConqueConceal start="\esf00c;" end="\eef00c;" concealends contains=ConqueCCBG - syn region ConqueCCF0c0 matchgroup=ConqueConceal start="\esf0c0;" end="\eef0c0;" concealends contains=ConqueCCBG - syn region ConqueCCF0cc matchgroup=ConqueConceal start="\esf0cc;" end="\eef0cc;" concealends contains=ConqueCCBG - syn region ConqueCCFc00 matchgroup=ConqueConceal start="\esfc00;" end="\eefc00;" concealends contains=ConqueCCBG - syn region ConqueCCFc0c matchgroup=ConqueConceal start="\esfc0c;" end="\eefc0c;" concealends contains=ConqueCCBG - syn region ConqueCCFcc0 matchgroup=ConqueConceal start="\esfcc0;" end="\eefcc0;" concealends contains=ConqueCCBG - syn region ConqueCCFccc matchgroup=ConqueConceal start="\esfccc;" end="\eefccc;" concealends contains=ConqueCCBG - - " foreground colors, high intensity - syn region ConqueCCF000 matchgroup=ConqueConceal start="\esf000;" end="\eef000;" concealends contains=ConqueCCBG - syn region ConqueCCF00f matchgroup=ConqueConceal start="\esf00f;" end="\eef00f;" concealends contains=ConqueCCBG - syn region ConqueCCF0f0 matchgroup=ConqueConceal start="\esf0f0;" end="\eef0f0;" concealends contains=ConqueCCBG - syn region ConqueCCF0ff matchgroup=ConqueConceal start="\esf0ff;" end="\eef0ff;" concealends contains=ConqueCCBG - syn region ConqueCCFf00 matchgroup=ConqueConceal start="\esff00;" end="\eeff00;" concealends contains=ConqueCCBG - syn region ConqueCCFf0f matchgroup=ConqueConceal start="\esff0f;" end="\eeff0f;" concealends contains=ConqueCCBG - syn region ConqueCCFff0 matchgroup=ConqueConceal start="\esfff0;" end="\eefff0;" concealends contains=ConqueCCBG - syn region ConqueCCFfff matchgroup=ConqueConceal start="\esffff;" end="\eeffff;" concealends contains=ConqueCCBG - - " background colors, low intensity - syn region ConqueCCB000 matchgroup=ConqueCCBG start="\esb000;" end="\eeb000;" concealends - syn region ConqueCCB00c matchgroup=ConqueCCBG start="\esb00c;" end="\eeb00c;" concealends - syn region ConqueCCB0c0 matchgroup=ConqueCCBG start="\esb0c0;" end="\eeb0c0;" concealends - syn region ConqueCCB0cc matchgroup=ConqueCCBG start="\esb0cc;" end="\eeb0cc;" concealends - syn region ConqueCCBc00 matchgroup=ConqueCCBG start="\esbc00;" end="\eebc00;" concealends - syn region ConqueCCBc0c matchgroup=ConqueCCBG start="\esbc0c;" end="\eebc0c;" concealends - syn region ConqueCCBcc0 matchgroup=ConqueCCBG start="\esbcc0;" end="\eebcc0;" concealends - syn region ConqueCCBccc matchgroup=ConqueCCBG start="\esbccc;" end="\eebccc;" concealends - - " background colors, high intensity - syn region ConqueCCB000 matchgroup=ConqueCCBG start="\esb000;" end="\eeb000;" concealends - syn region ConqueCCB00f matchgroup=ConqueCCBG start="\esb00f;" end="\eeb00f;" concealends - syn region ConqueCCB0f0 matchgroup=ConqueCCBG start="\esb0f0;" end="\eeb0f0;" concealends - syn region ConqueCCB0ff matchgroup=ConqueCCBG start="\esb0ff;" end="\eeb0ff;" concealends - syn region ConqueCCBf00 matchgroup=ConqueCCBG start="\esbf00;" end="\eebf00;" concealends - syn region ConqueCCBf0f matchgroup=ConqueCCBG start="\esbf0f;" end="\eebf0f;" concealends - syn region ConqueCCBff0 matchgroup=ConqueCCBG start="\esbff0;" end="\eebff0;" concealends - syn region ConqueCCBfff matchgroup=ConqueCCBG start="\esbfff;" end="\eebfff;" concealends - - - """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - - "highlight link ConqueCCConceal Error - - " foreground colors, low intensity - highlight ConqueCCF000 guifg=#000000 - highlight ConqueCCF00c guifg=#0000cc - highlight ConqueCCF0c0 guifg=#00cc00 - highlight ConqueCCF0cc guifg=#00cccc - highlight ConqueCCFc00 guifg=#cc0000 - highlight ConqueCCFc0c guifg=#cc00cc - highlight ConqueCCFcc0 guifg=#cccc00 - highlight ConqueCCFccc guifg=#cccccc - - " foreground colors, high intensity - highlight ConqueCCF000 guifg=#000000 - highlight ConqueCCF00f guifg=#0000ff - highlight ConqueCCF0f0 guifg=#00ff00 - highlight ConqueCCF0ff guifg=#00ffff - highlight ConqueCCFf00 guifg=#ff0000 - highlight ConqueCCFf0f guifg=#ff00ff - highlight ConqueCCFff0 guifg=#ffff00 - highlight ConqueCCFfff guifg=#ffffff - - " background colors, low intensity - highlight ConqueCCB000 guibg=#000000 - highlight ConqueCCB00c guibg=#0000cc - highlight ConqueCCB0c0 guibg=#00cc00 - highlight ConqueCCB0cc guibg=#00cccc - highlight ConqueCCBc00 guibg=#cc0000 - highlight ConqueCCBc0c guibg=#cc00cc - highlight ConqueCCBcc0 guibg=#cccc00 - highlight ConqueCCBccc guibg=#cccccc - - " background colors, high intensity - highlight ConqueCCB000 guibg=#000000 - highlight ConqueCCB00f guibg=#0000ff - highlight ConqueCCB0f0 guibg=#00ff00 - highlight ConqueCCB0ff guibg=#00ffff - highlight ConqueCCBf00 guibg=#ff0000 - highlight ConqueCCBf0f guibg=#ff00ff - highlight ConqueCCBff0 guibg=#ffff00 - highlight ConqueCCBfff guibg=#ffffff - - " background colors, low intensity - highlight link ConqueCCB000 ConqueCCBG - highlight link ConqueCCB00c ConqueCCBG - highlight link ConqueCCB0c0 ConqueCCBG - highlight link ConqueCCB0cc ConqueCCBG - highlight link ConqueCCBc00 ConqueCCBG - highlight link ConqueCCBc0c ConqueCCBG - highlight link ConqueCCBcc0 ConqueCCBG - highlight link ConqueCCBccc ConqueCCBG - - " background colors, high intensity - highlight link ConqueCCB000 ConqueCCBG - highlight link ConqueCCB00f ConqueCCBG - highlight link ConqueCCB0f0 ConqueCCBG - highlight link ConqueCCB0ff ConqueCCBG - highlight link ConqueCCBf00 ConqueCCBG - highlight link ConqueCCBf0f ConqueCCBG - highlight link ConqueCCBff0 ConqueCCBG - highlight link ConqueCCBfff ConqueCCBG - -endfunction " }}} - -" }}} - -" ********************************************************************************************************** -" **** Add-on features ************************************************************************************* -" ********************************************************************************************************** - -" {{{ - -" send selected text from another buffer -function! conque_term#send_selected(type) "{{{ - - " get most recent/relevant terminal - let term = conque_term#get_instance() - - " shove visual text into @@ register - let reg_save = @@ - sil exe "normal! `<" . a:type . "`>y" - let @@ = substitute(@@, '^[\r\n]*', '', '') - let @@ = substitute(@@, '[\r\n]*$', '', '') - - " go to terminal buffer - call term.focus() - - " execute yanked text - call term.write(@@) - - " reset original values - let @@ = reg_save - - " scroll buffer left - startinsert! - normal! 0zH - -endfunction "}}} - -function! conque_term#send_file() "{{{ - - let file_lines = readfile(expand('%:p')) - if type(file_lines) == 3 && len(file_lines) > 0 - let term = conque_term#get_instance() - call term.focus() - - for line in file_lines - call term.writeln(line) - endfor - else - echomsg 'Could not read file: ' . expand('%:p') - endif - -endfunction "}}} - - -function! conque_term#exec_file() "{{{ - - let current_file = expand('%:p') - if !executable(current_file) - echomsg "Could not run " . current_file . ". Not an executable." - return - endif - exe ':ConqueTermSplit ' . current_file - -endfunction "}}} - - -" called on SessionLoadPost event -function! conque_term#resume_session() " {{{ - if g:ConqueTerm_SessionSupport == 1 - - " make sure terminals exist - if !exists('s:saved_terminals') || type(s:saved_terminals) != 4 - return - endif - - " rebuild terminals - for idx in keys(s:saved_terminals) - - " don't recreate inactive terminals - if s:saved_terminals[idx].active == 0 - continue - endif - - " check we're in the right buffer - let bufname = substitute(s:saved_terminals[idx].buffer_name, '\', '', 'g') - if bufname != bufname("%") - continue - endif - - " reopen command - call conque_term#open(s:saved_terminals[idx].command) - - return - endfor - - endif -endfunction " }}} - -" }}} - -" ********************************************************************************************************** -" **** "API" functions ************************************************************************************* -" ********************************************************************************************************** - -" See doc/conque_term.txt for full documentation {{{ - -" Write to a conque terminal buffer -function! s:term_obj.write(...) dict " {{{ - - let text = get(a:000, 0, '') - let jump_to_buffer = get(a:000, 1, 0) - - " if we're not in terminal buffer, pass flag to not position the cursor - sil exe s:py . ' ' . self.var . '.write_expr("text", False, False)' - - " move cursor to conque buffer - if jump_to_buffer - call self.focus() - endif - -endfunction " }}} - -" same as write() but adds a newline -function! s:term_obj.writeln(...) dict " {{{ - - let text = get(a:000, 0, '') - let jump_to_buffer = get(a:000, 1, 0) - - call self.write(text . "\r", jump_to_buffer) - -endfunction " }}} - -" move cursor to terminal buffer -function! s:term_obj.focus() dict " {{{ - - let save_sb = &switchbuf - sil set switchbuf=usetab - exe 'sb ' . self.buffer_name - sil exe ":set switchbuf=" . save_sb - startinsert! - -endfunction " }}} - -" read from terminal buffer and return string -function! s:term_obj.read(...) dict " {{{ - - let read_time = get(a:000, 0, 1) - let update_buffer = get(a:000, 1, self.is_buffer) - - if update_buffer - let up_py = 'True' - else - let up_py = 'False' - endif - - " figure out if we're in the buffer we're updating - if exists('b:ConqueTerm_Var') && b:ConqueTerm_Var == self.var - let in_buffer = 1 - else - let in_buffer = 0 - endif - - let output = '' - - " read! - sil exec s:py . " conque_tmp = " . self.var . ".read(timeout = " . read_time . ", set_cursor = False, return_output = True, update_buffer = " . up_py . ")" - - " ftw! - try - let pycode = "\nif conque_tmp:\n conque_tmp = re.sub('\\\\\\\\', '\\\\\\\\\\\\\\\\', conque_tmp)\n conque_tmp = re.sub('\"', '\\\\\\\\\"', conque_tmp)\n vim.command('let output = \"' + conque_tmp + '\"')\n" - sil exec s:py . pycode - catch - " d'oh - endtry - - return output - -endfunction " }}} - -" set output callback -function! s:term_obj.set_callback(callback_func) dict " {{{ - - let g:ConqueTerm_Terminals[self.idx].callback = function(a:callback_func) - -endfunction " }}} - -" close subprocess with ABORT signal -function! s:term_obj.close() dict " {{{ - - " kill process - try - sil exe s:py . ' ' . self.var . '.abort()' - catch - " probably already dead - endtry - - " delete buffer if option is set - if self.is_buffer - call conque_term#set_mappings('stop') - if exists('g:ConqueTerm_CloseOnEnd') && g:ConqueTerm_CloseOnEnd - sil exe 'bwipeout! ' . self.buffer_name - stopinsert! - endif - endif - - " mark ourselves as inactive - let self.active = 0 - - " rebuild session options - let g:ConqueTerm_TerminalsString = string(g:ConqueTerm_Terminals) - -endfunction " }}} - -" create a new terminal object -function! conque_term#create_terminal_object(...) " {{{ - - " find conque buffer to update - let buf_num = get(a:000, 0, 0) - if buf_num > 0 - let pvar = 'ConqueTerm_' . buf_num - elseif exists('b:ConqueTerm_Var') - let pvar = b:ConqueTerm_Var - let buf_num = b:ConqueTerm_Idx - else - let pvar = g:ConqueTerm_Var - let buf_num = g:ConqueTerm_Idx - endif - - " is ther a buffer? - let is_buffer = get(a:000, 1, 1) - - " the buffer name - let bname = get(a:000, 2, '') - - " the command - let command = get(a:000, 3, '') - - " parse out the program name (not perfect) - let arg_split = split(command, '[^\\]\@<=\s') - let arg_split[0] = substitute(arg_split[0], '\\ ', ' ', 'g') - let slash_split = split(arg_split[0], '[/\\]') - let prg_name = substitute(slash_split[-1], '\(.*\)\..*', '\1', '') - - let l:t_obj = copy(s:term_obj) - let l:t_obj.is_buffer = is_buffer - let l:t_obj.idx = buf_num - let l:t_obj.buffer_name = bname - let l:t_obj.var = pvar - let l:t_obj.command = command - let l:t_obj.program_name = prg_name - - return l:t_obj - -endfunction " }}} - -" get an existing terminal instance -function! conque_term#get_instance(...) " {{{ - - " find conque buffer to update - let buf_num = get(a:000, 0, 0) - - if exists('g:ConqueTerm_Terminals[buf_num]') - - elseif exists('b:ConqueTerm_Var') - let buf_num = b:ConqueTerm_Idx - else - let buf_num = g:ConqueTerm_Idx - endif - - return g:ConqueTerm_Terminals[buf_num] - -endfunction " }}} - -" }}} - -" ********************************************************************************************************** -" **** PYTHON ********************************************************************************************** -" ********************************************************************************************************** - -function! conque_term#load_python() " {{{ - - exec s:py . "file " . s:scriptdirpy . "conque_globals.py" - exec s:py . "file " . s:scriptdirpy . "conque.py" - if s:platform == 'windows' - exec s:py . "file " . s:scriptdirpy . "conque_win32_util.py" - exec s:py . "file " . s:scriptdirpy . "conque_sole_shared_memory.py" - exec s:py . "file " . s:scriptdirpy . "conque_sole.py" - exec s:py . "file " . s:scriptdirpy . "conque_sole_wrapper.py" - else - exec s:py . "file " . s:scriptdirpy . "conque_screen.py" - exec s:py . "file " . s:scriptdirpy . "conque_subprocess.py" - endif - -endfunction " }}} - -" vim:foldmethod=marker diff --git a/vim/autoload/conque_term/conque.py b/vim/autoload/conque_term/conque.py deleted file mode 100644 index 08c92e4..0000000 --- a/vim/autoload/conque_term/conque.py +++ /dev/null @@ -1,1154 +0,0 @@ -# FILE: autoload/conque_term/conque.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" -Vim terminal emulator. - -This class is the main interface between Vim and the terminal application. It -handles both updating the Vim buffer with new output and accepting new keyboard -input from the Vim user. - -Although this class was originally designed for a Unix terminal environment, it -has been extended by the ConqueSole class for Windows. - -Usage: - term = Conque() - term.open('/bin/bash', {'TERM': 'vt100'}) - term.write("ls -lha\r") - term.read() - term.close() -""" - -import vim -import re -import math -import time # DEBUG - -class Conque: - - # screen object - screen = None - - # subprocess object - proc = None - - # terminal dimensions and scrolling region - columns = 80 # same as $COLUMNS - lines = 24 # same as $LINES - working_columns = 80 # can be changed by CSI ? 3 l/h - working_lines = 24 # can be changed by CSI r - - # top/bottom of the scroll region - top = 1 # relative to top of screen - bottom = 24 # relative to top of screen - - # cursor position - l = 1 # current cursor line - c = 1 # current cursor column - - # autowrap mode - autowrap = True - - # absolute coordinate mode - absolute_coords = True - - # tabstop positions - tabstops = [] - - # enable colors - enable_colors = True - - # color changes - color_changes = {} - - # color history - color_history = {} - - # color highlight cache - highlight_groups = {} - - # prune terminal colors - color_pruning = True - - # don't wrap table output - unwrap_tables = True - - # wrap CUF/CUB around line breaks - wrap_cursor = False - - # do we need to move the cursor? - cursor_set = False - - # current character set, ascii or graphics - character_set = 'ascii' - - # used for auto_read actions - read_count = 0 - - # input buffer, array of ordinals - input_buffer = [] - - def open(self): - """ Start program and initialize this instance. - - Arguments: - command -- Command string to execute, e.g. '/bin/bash --login' - options -- Dictionary of environment vars to set and other options. - - """ - # get arguments - command = vim.eval('command') - options = vim.eval('options') - - # create terminal screen instance - self.screen = ConqueScreen() - - # int vars - self.columns = vim.current.window.width - self.lines = vim.current.window.height - self.working_columns = vim.current.window.width - self.working_lines = vim.current.window.height - self.bottom = vim.current.window.height - - # offset first line to make room for startup messages - if int(options['offset']) > 0: - self.l = int(options['offset']) - - # init color - self.enable_colors = options['color'] and not CONQUE_FAST_MODE - - # init tabstops - self.init_tabstops() - - # open command - self.proc = ConqueSubprocess() - self.proc.open(command, {'TERM': options['TERM'], 'CONQUE': '1', 'LINES': str(self.lines), 'COLUMNS': str(self.columns)}) - - # send window size signal, in case LINES/COLUMNS is ignored - self.update_window_size(True) - - - def write(self, input, set_cursor=True, read=True): - """ Write a unicode string to the subprocess. - - set_cursor -- Position the cursor in the current buffer when finished - read -- Check program for new output when finished - - """ - # check if window size has changed - if read: - self.update_window_size() - - # write and read - self.proc.write(input) - - # read output immediately - if read: - self.read(1, set_cursor) - - - - def write_ord(self, input, set_cursor=True, read=True): - """ Write a single character to the subprocess, using an unicode ordinal. """ - - if CONQUE_PYTHON_VERSION == 2: - self.write(unichr(input), set_cursor, read) - else: - self.write(chr(input), set_cursor, read) - - - - def write_expr(self, expr, set_cursor=True, read=True): - """ Write the value of a Vim expression to the subprocess. """ - - if CONQUE_PYTHON_VERSION == 2: - try: - val = vim.eval(expr) - self.write(unicode(val, CONQUE_VIM_ENCODING, 'ignore'), set_cursor, read) - except: - - pass - else: - try: - # XXX - Depending on Vim to deal with encoding, sadly - self.write(vim.eval(expr), set_cursor, read) - except: - - pass - - - def write_latin1(self, input, set_cursor=True, read=True): - """ Write latin-1 string to conque. Very ugly, shood be removed. """ - # XXX - this whole method is a hack, to be removed soon - - if CONQUE_PYTHON_VERSION == 2: - try: - input_unicode = input.decode('latin-1', 'ignore') - self.write(input_unicode.encode('utf-8', 'ignore'), set_cursor, read) - except: - return - else: - self.write(input, set_cursor, read) - - - def write_buffered_ord(self, chr): - """ Add character ordinal to input buffer. In case we're not allowed to modify buffer a time of input. """ - self.input_buffer.append(chr) - - - def read(self, timeout=1, set_cursor=True, return_output=False, update_buffer=True): - """ Read new output from the subprocess and update the Vim buffer. - - Arguments: - timeout -- Milliseconds to wait before reading input - set_cursor -- Set the cursor position in the current buffer when finished - return_output -- Return new subprocess STDOUT + STDERR as a string - update_buffer -- Update the current Vim buffer with the new output - - This method goes through the following rough steps: - 1. Get new output from subprocess - 2. Split output string into control codes, escape sequences, or plain text - 3. Loop over and process each chunk, updating the Vim buffer as we go - - """ - output = '' - - # this may not actually work - try: - - # read from subprocess and strip null characters - output = self.proc.read(timeout) - - if output == '': - return - - # for bufferless terminals - if not update_buffer: - return output - - - - # strip null characters. I'm still not sure why they appear - output = output.replace(chr(0), '') - - # split input into individual escape sequences, control codes, and text output - chunks = CONQUE_SEQ_REGEX.split(output) - - - - # if there were no escape sequences, skip processing and treat entire string as plain text - if len(chunks) == 1: - self.plain_text(chunks[0]) - - # loop through and process escape sequences - else: - for s in chunks: - if s == '': - continue - - - - - # Check for control character match - if CONQUE_SEQ_REGEX_CTL.match(s[0]): - - nr = ord(s[0]) - if nr in CONQUE_CTL: - getattr(self, 'ctl_' + CONQUE_CTL[nr])() - else: - - pass - - # check for escape sequence match - elif CONQUE_SEQ_REGEX_CSI.match(s): - - if s[-1] in CONQUE_ESCAPE: - csi = self.parse_csi(s[2:]) - - getattr(self, 'csi_' + CONQUE_ESCAPE[s[-1]])(csi) - else: - - pass - - # check for title match - elif CONQUE_SEQ_REGEX_TITLE.match(s): - - self.change_title(s[2], s[4:-1]) - - # check for hash match - elif CONQUE_SEQ_REGEX_HASH.match(s): - - if s[-1] in CONQUE_ESCAPE_HASH: - getattr(self, 'hash_' + CONQUE_ESCAPE_HASH[s[-1]])() - else: - - pass - - # check for charset match - elif CONQUE_SEQ_REGEX_CHAR.match(s): - - if s[-1] in CONQUE_ESCAPE_CHARSET: - getattr(self, 'charset_' + CONQUE_ESCAPE_CHARSET[s[-1]])() - else: - - pass - - # check for other escape match - elif CONQUE_SEQ_REGEX_ESC.match(s): - - if s[-1] in CONQUE_ESCAPE_PLAIN: - getattr(self, 'esc_' + CONQUE_ESCAPE_PLAIN[s[-1]])() - else: - - pass - - # else process plain text - else: - self.plain_text(s) - - # set cusor position - if set_cursor: - self.screen.set_cursor(self.l, self.c) - - # we need to set the cursor position - self.cursor_set = False - - # redraw screen for immediate feedback - #if not CONQUE_FAST_MODE: - # vim.command('redraw') - - except: - - - pass - - if return_output: - if CONQUE_PYTHON_VERSION == 3: - return output - else: - return output.encode(CONQUE_VIM_ENCODING, 'replace') - - - def auto_read(self): - """ Poll program for more output. - - Since Vim doesn't have a reliable event system that can be triggered when new - output is available, we have to continually poll the subprocess instead. This - method is called many times a second when the terminal buffer is active, so it - needs to be very fast and efficient. - - The feedkeys portion is required to reset Vim's timer system. The timer is used - to execute this command, typically set to go off after 50 ms of inactivity. - - """ - # process buffered input if any - if len(self.input_buffer): - for chr in self.input_buffer: - self.write_ord(chr, set_cursor=False, read=False) - self.input_buffer = [] - self.read(1) - - # check subprocess status, but not every time since it's CPU expensive - if self.read_count % 32 == 0: - if not self.proc.is_alive(): - vim.command('call conque_term#get_instance().close()') - return - - if self.read_count > 512: - self.read_count = 0 - - # trim color history occasionally if desired - if self.enable_colors and self.color_pruning: - self.prune_colors() - - # ++ - self.read_count += 1 - - # read output - self.read(1) - - # reset timer - if self.c == 1: - vim.command('call feedkeys("\\", "n")') - else: - vim.command('call feedkeys("\\", "n")') - - # stop here if cursor doesn't need to be moved - if self.cursor_set: - return - - # otherwise set cursor position - try: - self.set_cursor(self.l, self.c) - except: - - - pass - self.cursor_set = True - - - def plain_text(self, input): - """ Write text output to Vim buffer. - - - This method writes a string of characters without any control characters or escape sequences - to the Vim buffer. In simple terms, it writes the input string to the buffer starting at the - current cursor position, wrapping the text to a new line if needed. It also triggers the - terminal coloring methods if needed. - - - """ - # translate input into graphics character set if needed - if self.character_set == 'graphics': - old_input = input - input = u('') - for i in range(0, len(old_input)): - chrd = ord(old_input[i]) - - - try: - if chrd > 255: - - input = input + old_input[i] - else: - input = input + uchr(CONQUE_GRAPHICS_SET[chrd]) - except: - - pass - - - - # get current line from Vim buffer - current_line = self.screen[self.l] - - # pad current line with spaces, if it's shorter than cursor position - if len(current_line) < self.c: - current_line = current_line + ' ' * (self.c - len(current_line)) - - # if line is wider than screen - if self.c + len(input) - 1 > self.working_columns: - - # Table formatting hack - if self.unwrap_tables and CONQUE_TABLE_OUTPUT.match(input): - self.screen[self.l] = current_line[:self.c - 1] + input + current_line[self.c + len(input) - 1:] - self.apply_color(self.c, self.c + len(input)) - self.c += len(input) - return - - - diff = self.c + len(input) - self.working_columns - 1 - - # if autowrap is enabled - if self.autowrap: - self.screen[self.l] = current_line[:self.c - 1] + input[:-1 * diff] - self.apply_color(self.c, self.working_columns) - self.ctl_nl() - self.ctl_cr() - remaining = input[-1 * diff:] - - self.plain_text(remaining) - else: - self.screen[self.l] = current_line[:self.c - 1] + input[:-1 * diff - 1] + input[-1] - self.apply_color(self.c, self.working_columns) - self.c = self.working_columns - - # no autowrap - else: - self.screen[self.l] = current_line[:self.c - 1] + input + current_line[self.c + len(input) - 1:] - self.apply_color(self.c, self.c + len(input)) - self.c += len(input) - - - - def apply_color(self, start, end, line=0): - """ Apply terminal colors to buffer for a range of characters in a single line. - - When a text attribute escape sequence is encountered during input processing, the - attributes are recorded in the dictionary self.color_changes. After those attributes - have been applied, the changes are recorded in a second dictionary self.color_history. - - - This method inspects both dictionaries to calculate any syntax highlighting - that needs to be executed to render the text attributes in the Vim buffer. - - - """ - - - # stop here if coloration is disabled - if not self.enable_colors: - return - - # allow custom line nr to be passed - if line: - buffer_line = line - else: - buffer_line = self.get_buffer_line(self.l) - - # check for previous overlapping coloration - - to_del = [] - if buffer_line in self.color_history: - for i in range(len(self.color_history[buffer_line])): - syn = self.color_history[buffer_line][i] - - if syn['start'] >= start and syn['start'] < end: - - vim.command('syn clear ' + syn['name']) - to_del.append(i) - # outside - if syn['end'] > end: - - self.exec_highlight(buffer_line, end, syn['end'], syn['highlight']) - elif syn['end'] > start and syn['end'] <= end: - - vim.command('syn clear ' + syn['name']) - to_del.append(i) - # outside - if syn['start'] < start: - - self.exec_highlight(buffer_line, syn['start'], start, syn['highlight']) - - # remove overlapped colors - if len(to_del) > 0: - to_del.reverse() - for di in to_del: - del self.color_history[buffer_line][di] - - # if there are no new colors - if len(self.color_changes) == 0: - return - - # build the color attribute string - highlight = '' - for attr in self.color_changes.keys(): - highlight = highlight + ' ' + attr + '=' + self.color_changes[attr] - - # execute the highlight - self.exec_highlight(buffer_line, start, end, highlight) - - - def exec_highlight(self, buffer_line, start, end, highlight): - """ Execute the Vim commands for a single syntax highlight """ - - syntax_name = 'ConqueHighLightAt_%d_%d_%d_%d' % (self.proc.pid, self.l, start, len(self.color_history) + 1) - syntax_options = 'contains=ALLBUT,ConqueString,MySQLString,MySQLKeyword oneline' - syntax_region = 'syntax match %s /\%%%dl\%%>%dc.\{%d}\%%<%dc/ %s' % (syntax_name, buffer_line, start - 1, end - start, end + 1, syntax_options) - - # check for cached highlight group - hgroup = 'ConqueHL_%d' % (abs(hash(highlight))) - if hgroup not in self.highlight_groups: - syntax_group = 'highlight %s %s' % (hgroup, highlight) - self.highlight_groups[hgroup] = hgroup - vim.command(syntax_group) - - # link this syntax match to existing highlight group - syntax_highlight = 'highlight link %s %s' % (syntax_name, self.highlight_groups[hgroup]) - - - - vim.command(syntax_region) - vim.command(syntax_highlight) - - # add syntax name to history - if not buffer_line in self.color_history: - self.color_history[buffer_line] = [] - - self.color_history[buffer_line].append({'name': syntax_name, 'start': start, 'end': end, 'highlight': highlight}) - - - def prune_colors(self): - """ Remove old syntax highlighting from the Vim buffer - - The kind of syntax highlighting required for terminal colors can make - Conque run slowly. The prune_colors() method will remove old highlight definitions - to keep the maximum number of highlight rules within a reasonable range. - - """ - - - buffer_line = self.get_buffer_line(self.l) - ks = list(self.color_history.keys()) - - for line in ks: - if line < buffer_line - CONQUE_MAX_SYNTAX_LINES: - for syn in self.color_history[line]: - vim.command('syn clear ' + syn['name']) - del self.color_history[line] - - - - - ############################################################################################### - # Control functions - - def ctl_nl(self): - """ Process the newline control character. """ - # if we're in a scrolling region, scroll instead of moving cursor down - if self.lines != self.working_lines and self.l == self.bottom: - del self.screen[self.top] - self.screen.insert(self.bottom, '') - elif self.l == self.bottom: - self.screen.append('') - else: - self.l += 1 - - self.color_changes = {} - - def ctl_cr(self): - """ Process the carriage return control character. """ - self.c = 1 - - self.color_changes = {} - - def ctl_bs(self): - """ Process the backspace control character. """ - if self.c > 1: - self.c += -1 - - def ctl_soh(self): - """ Process the start of heading control character. """ - pass - - def ctl_stx(self): - pass - - def ctl_bel(self): - """ Process the bell control character. """ - vim.command('call conque_term#bell()') - - def ctl_tab(self): - """ Process the tab control character. """ - # default tabstop location - ts = self.working_columns - - # check set tabstops - for i in range(self.c, len(self.tabstops)): - if self.tabstops[i]: - ts = i + 1 - break - - - - self.c = ts - - def ctl_so(self): - """ Process the shift out control character. """ - self.character_set = 'graphics' - - def ctl_si(self): - """ Process the shift in control character. """ - self.character_set = 'ascii' - - - - ############################################################################################### - # CSI functions - - def csi_font(self, csi): - """ Process the text attribute escape sequence. """ - if not self.enable_colors: - return - - # defaults to 0 - if len(csi['vals']) == 0: - csi['vals'] = [0] - - # 256 xterm color foreground - if len(csi['vals']) == 3 and csi['vals'][0] == 38 and csi['vals'][1] == 5: - self.color_changes['ctermfg'] = str(csi['vals'][2]) - self.color_changes['guifg'] = '#' + self.xterm_to_rgb(csi['vals'][2]) - - # 256 xterm color background - elif len(csi['vals']) == 3 and csi['vals'][0] == 48 and csi['vals'][1] == 5: - self.color_changes['ctermbg'] = str(csi['vals'][2]) - self.color_changes['guibg'] = '#' + self.xterm_to_rgb(csi['vals'][2]) - - # 16 colors - else: - for val in csi['vals']: - if val in CONQUE_FONT: - - # ignore starting normal colors - if CONQUE_FONT[val]['normal'] and len(self.color_changes) == 0: - - continue - # clear color changes - elif CONQUE_FONT[val]['normal']: - - self.color_changes = {} - # save these color attributes for next plain_text() call - else: - - for attr in CONQUE_FONT[val]['attributes'].keys(): - if attr in self.color_changes and (attr == 'cterm' or attr == 'gui'): - self.color_changes[attr] += ',' + CONQUE_FONT[val]['attributes'][attr] - else: - self.color_changes[attr] = CONQUE_FONT[val]['attributes'][attr] - - - def csi_clear_line(self, csi): - """ Process the line clear escape sequence. """ - - - # this escape defaults to 0 - if len(csi['vals']) == 0: - csi['val'] = 0 - - - - - # 0 means cursor right - if csi['val'] == 0: - self.screen[self.l] = self.screen[self.l][0:self.c - 1] - - # 1 means cursor left - elif csi['val'] == 1: - self.screen[self.l] = ' ' * (self.c) + self.screen[self.l][self.c:] - - # clear entire line - elif csi['val'] == 2: - self.screen[self.l] = '' - - # clear colors - if csi['val'] == 2 or (csi['val'] == 0 and self.c == 1): - buffer_line = self.get_buffer_line(self.l) - if buffer_line in self.color_history: - for syn in self.color_history[buffer_line]: - vim.command('syn clear ' + syn['name']) - - - - - - def csi_cursor_right(self, csi): - """ Process the move cursor right escape sequence. """ - # we use 1 even if escape explicitly specifies 0 - if csi['val'] == 0: - csi['val'] = 1 - - - - - if self.wrap_cursor and self.c + csi['val'] > self.working_columns: - self.l += int(math.floor((self.c + csi['val']) / self.working_columns)) - self.c = (self.c + csi['val']) % self.working_columns - return - - self.c = self.bound(self.c + csi['val'], 1, self.working_columns) - - - def csi_cursor_left(self, csi): - """ Process the move cursor left escape sequence. """ - # we use 1 even if escape explicitly specifies 0 - if csi['val'] == 0: - csi['val'] = 1 - - if self.wrap_cursor and csi['val'] >= self.c: - self.l += int(math.floor((self.c - csi['val']) / self.working_columns)) - self.c = self.working_columns - (csi['val'] - self.c) % self.working_columns - return - - self.c = self.bound(self.c - csi['val'], 1, self.working_columns) - - - def csi_cursor_to_column(self, csi): - """ Process the move cursor to column escape sequence. """ - self.c = self.bound(csi['val'], 1, self.working_columns) - - - def csi_cursor_up(self, csi): - """ Process the move cursor up escape sequence. """ - self.l = self.bound(self.l - csi['val'], self.top, self.bottom) - - self.color_changes = {} - - - def csi_cursor_down(self, csi): - """ Process the move cursor down escape sequence. """ - self.l = self.bound(self.l + csi['val'], self.top, self.bottom) - - self.color_changes = {} - - - def csi_clear_screen(self, csi): - """ Process the clear screen escape sequence. """ - # default to 0 - if len(csi['vals']) == 0: - csi['val'] = 0 - - # 2 == clear entire screen - if csi['val'] == 2: - self.l = 1 - self.c = 1 - self.screen.clear() - - # 0 == clear down - elif csi['val'] == 0: - for l in range(self.bound(self.l + 1, 1, self.lines), self.lines + 1): - self.screen[l] = '' - - # clear end of current line - self.csi_clear_line(self.parse_csi('K')) - - # 1 == clear up - elif csi['val'] == 1: - for l in range(1, self.bound(self.l, 1, self.lines + 1)): - self.screen[l] = '' - - # clear beginning of current line - self.csi_clear_line(self.parse_csi('1K')) - - # clear coloration - if csi['val'] == 2 or csi['val'] == 0: - buffer_line = self.get_buffer_line(self.l) - for line in self.color_history.keys(): - if line >= buffer_line: - for syn in self.color_history[line]: - vim.command('syn clear ' + syn['name']) - - self.color_changes = {} - - - def csi_delete_chars(self, csi): - self.screen[self.l] = self.screen[self.l][:self.c] + self.screen[self.l][self.c + csi['val']:] - - - def csi_add_spaces(self, csi): - self.screen[self.l] = self.screen[self.l][: self.c - 1] + ' ' * csi['val'] + self.screen[self.l][self.c:] - - - def csi_cursor(self, csi): - if len(csi['vals']) == 2: - new_line = csi['vals'][0] - new_col = csi['vals'][1] - else: - new_line = 1 - new_col = 1 - - if self.absolute_coords: - self.l = self.bound(new_line, 1, self.lines) - else: - self.l = self.bound(self.top + new_line - 1, self.top, self.bottom) - - self.c = self.bound(new_col, 1, self.working_columns) - if self.c > len(self.screen[self.l]): - self.screen[self.l] = self.screen[self.l] + ' ' * (self.c - len(self.screen[self.l])) - - - - def csi_set_coords(self, csi): - if len(csi['vals']) == 2: - new_start = csi['vals'][0] - new_end = csi['vals'][1] - else: - new_start = 1 - new_end = vim.current.window.height - - self.top = new_start - self.bottom = new_end - self.working_lines = new_end - new_start + 1 - - # if cursor is outside scrolling region, reset it - if self.l < self.top: - self.l = self.top - elif self.l > self.bottom: - self.l = self.bottom - - self.color_changes = {} - - - def csi_tab_clear(self, csi): - # this escape defaults to 0 - if len(csi['vals']) == 0: - csi['val'] = 0 - - - - if csi['val'] == 0: - self.tabstops[self.c - 1] = False - elif csi['val'] == 3: - for i in range(0, self.columns + 1): - self.tabstops[i] = False - - - def csi_set(self, csi): - # 132 cols - if csi['val'] == 3: - self.csi_clear_screen(self.parse_csi('2J')) - self.working_columns = 132 - - # relative_origin - elif csi['val'] == 6: - self.absolute_coords = False - - # set auto wrap - elif csi['val'] == 7: - self.autowrap = True - - - self.color_changes = {} - - - def csi_reset(self, csi): - # 80 cols - if csi['val'] == 3: - self.csi_clear_screen(self.parse_csi('2J')) - self.working_columns = 80 - - # absolute origin - elif csi['val'] == 6: - self.absolute_coords = True - - # reset auto wrap - elif csi['val'] == 7: - self.autowrap = False - - - self.color_changes = {} - - - - - ############################################################################################### - # ESC functions - - def esc_scroll_up(self): - self.ctl_nl() - - self.color_changes = {} - - - def esc_next_line(self): - self.ctl_nl() - self.c = 1 - - - def esc_set_tab(self): - - if self.c <= len(self.tabstops): - self.tabstops[self.c - 1] = True - - - def esc_scroll_down(self): - if self.l == self.top: - del self.screen[self.bottom] - self.screen.insert(self.top, '') - else: - self.l += -1 - - self.color_changes = {} - - - - - ############################################################################################### - # HASH functions - - def hash_screen_alignment_test(self): - self.csi_clear_screen(self.parse_csi('2J')) - self.working_lines = self.lines - for l in range(1, self.lines + 1): - self.screen[l] = 'E' * self.working_columns - - - - ############################################################################################### - # CHARSET functions - - def charset_us(self): - self.character_set = 'ascii' - - def charset_uk(self): - self.character_set = 'ascii' - - def charset_graphics(self): - self.character_set = 'graphics' - - - - ############################################################################################### - # Random stuff - - def set_cursor(self, line, col): - """ Set cursor position in the Vim buffer. - - Note: the line and column numbers are relative to the top left corner of the - visible screen. Not the line number in the Vim buffer. - - """ - self.screen.set_cursor(line, col) - - def change_title(self, key, val): - """ Change the Vim window title. """ - - - if key == '0' or key == '2': - - vim.command('setlocal statusline=' + re.escape(val)) - try: - vim.command('set titlestring=' + re.escape(val)) - except: - pass - - def update_window_size(self, force=False): - """ Check and save the current buffer dimensions. - - If the buffer size has changed, the update_window_size() method both updates - the Conque buffer size attributes as well as sending the new dimensions to the - subprocess pty. - - """ - # resize if needed - if force or vim.current.window.width != self.columns or vim.current.window.height != self.lines: - - # reset all window size attributes to default - self.columns = vim.current.window.width - self.lines = vim.current.window.height - self.working_columns = vim.current.window.width - self.working_lines = vim.current.window.height - self.bottom = vim.current.window.height - - # reset screen object attributes - self.l = self.screen.reset_size(self.l) - - # reset tabstops - self.init_tabstops() - - - - # signal process that screen size has changed - self.proc.window_resize(self.lines, self.columns) - - def insert_enter(self): - """ Run commands when user enters insert mode. """ - - # check window size - self.update_window_size() - - # we need to set the cursor position - self.cursor_set = False - - def init_tabstops(self): - """ Intitialize terminal tabstop positions. """ - for i in range(0, self.columns + 1): - if i % 8 == 0: - self.tabstops.append(True) - else: - self.tabstops.append(False) - - def idle(self): - """ Called when this terminal becomes idle. """ - pass - - def resume(self): - """ Called when this terminal is no longer idle. """ - pass - pass - - def close(self): - """ End the process running in the terminal. """ - self.proc.close() - - def abort(self): - """ Forcefully end the process running in the terminal. """ - self.proc.signal(1) - - - - ############################################################################################### - # Utility - - def parse_csi(self, s): - """ Parse an escape sequence into it's meaningful values. """ - - attr = {'key': s[-1], 'flag': '', 'val': 1, 'vals': []} - - if len(s) == 1: - return attr - - full = s[0:-1] - - if full[0] == '?': - full = full[1:] - attr['flag'] = '?' - - if full != '': - vals = full.split(';') - for val in vals: - - val = re.sub("\D", "", val) - - if val != '': - attr['vals'].append(int(val)) - - if len(attr['vals']) == 1: - attr['val'] = int(attr['vals'][0]) - - return attr - - - def bound(self, val, min, max): - """ TODO: This probably exists as a builtin function. """ - if val > max: - return max - - if val < min: - return min - - return val - - - def xterm_to_rgb(self, color_code): - """ Translate a terminal color number into a RGB string. """ - if color_code < 16: - ascii_colors = ['000000', 'CD0000', '00CD00', 'CDCD00', '0000EE', 'CD00CD', '00CDCD', 'E5E5E5', - '7F7F7F', 'FF0000', '00FF00', 'FFFF00', '5C5CFF', 'FF00FF', '00FFFF', 'FFFFFF'] - return ascii_colors[color_code] - - elif color_code < 232: - cc = int(color_code) - 16 - - p1 = "%02x" % (math.floor(cc / 36) * (255 / 5)) - p2 = "%02x" % (math.floor((cc % 36) / 6) * (255 / 5)) - p3 = "%02x" % (math.floor(cc % 6) * (255 / 5)) - - return p1 + p2 + p3 - else: - grey_tone = "%02x" % math.floor((255 / 24) * (color_code - 232)) - return grey_tone + grey_tone + grey_tone - - - - - def get_buffer_line(self, line): - """ Get the buffer line number corresponding to the supplied screen line number. """ - return self.screen.get_buffer_line(line) - - diff --git a/vim/autoload/conque_term/conque_globals.py b/vim/autoload/conque_term/conque_globals.py deleted file mode 100644 index d7a8c8f..0000000 --- a/vim/autoload/conque_term/conque_globals.py +++ /dev/null @@ -1,319 +0,0 @@ -# FILE: autoload/conque_term/conque_globals.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -"""Common global constants and functions for Conque.""" - -import sys -import re -import os # DEBUG - -import traceback # DEBUG - -# PYTHON VERSION -CONQUE_PYTHON_VERSION = sys.version_info[0] - -# Encoding - -try: - # Vim's character encoding - import vim - CONQUE_VIM_ENCODING = vim.eval('&encoding') - -except: - CONQUE_VIM_ENCODING = 'utf-8' - - -def u(str_val, str_encoding='utf-8', errors='strict'): - """ Foolhardy attempt to make unicode string syntax compatible with both python 2 and 3. """ - - if not str_val: - str_val = '' - - if CONQUE_PYTHON_VERSION == 3: - return str_val - - else: - return unicode(str_val, str_encoding, errors) - -def uchr(str): - """ Foolhardy attempt to make unicode string syntax compatible with both python 2 and 3. """ - - if CONQUE_PYTHON_VERSION == 3: - return chr(str) - - else: - return unichr(str) - - - - - - - - - - - - - - - - - - - -# Unix escape sequence settings - -CONQUE_CTL = { - 1: 'soh', # start of heading - 2: 'stx', # start of text - 7: 'bel', # bell - 8: 'bs', # backspace - 9: 'tab', # tab - 10: 'nl', # new line - 13: 'cr', # carriage return - 14: 'so', # shift out - 15: 'si' # shift in -} -# 11 : 'vt', # vertical tab -# 12 : 'ff', # form feed - -# Escape sequences -CONQUE_ESCAPE = { - 'm': 'font', - 'J': 'clear_screen', - 'K': 'clear_line', - '@': 'add_spaces', - 'A': 'cursor_up', - 'B': 'cursor_down', - 'C': 'cursor_right', - 'D': 'cursor_left', - 'G': 'cursor_to_column', - 'H': 'cursor', - 'P': 'delete_chars', - 'f': 'cursor', - 'g': 'tab_clear', - 'r': 'set_coords', - 'h': 'set', - 'l': 'reset' -} -# 'L': 'insert_lines', -# 'M': 'delete_lines', -# 'd': 'cusor_vpos', - -# Alternate escape sequences, no [ -CONQUE_ESCAPE_PLAIN = { - 'D': 'scroll_up', - 'E': 'next_line', - 'H': 'set_tab', - 'M': 'scroll_down' -} -# 'N': 'single_shift_2', -# 'O': 'single_shift_3', -# '=': 'alternate_keypad', -# '>': 'numeric_keypad', -# '7': 'save_cursor', -# '8': 'restore_cursor', - -# Character set escape sequences, with "(" -CONQUE_ESCAPE_CHARSET = { - 'A': 'uk', - 'B': 'us', - '0': 'graphics' -} - -# Uber alternate escape sequences, with # or ? -CONQUE_ESCAPE_QUESTION = { - '1h': 'new_line_mode', - '3h': '132_cols', - '4h': 'smooth_scrolling', - '5h': 'reverse_video', - '6h': 'relative_origin', - '7h': 'set_auto_wrap', - '8h': 'set_auto_repeat', - '9h': 'set_interlacing_mode', - '1l': 'set_cursor_key', - '2l': 'set_vt52', - '3l': '80_cols', - '4l': 'set_jump_scrolling', - '5l': 'normal_video', - '6l': 'absolute_origin', - '7l': 'reset_auto_wrap', - '8l': 'reset_auto_repeat', - '9l': 'reset_interlacing_mode' -} - -CONQUE_ESCAPE_HASH = { - '8': 'screen_alignment_test' -} -# '3': 'double_height_top', -# '4': 'double_height_bottom', -# '5': 'single_height_single_width', -# '6': 'single_height_double_width', - -CONQUE_GRAPHICS_SET = [ - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002A, 0x2192, 0x2190, 0x2191, 0x2193, 0x002F, - 0x2588, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x00A0, - 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x00B0, 0x00B1, - 0x2591, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0xF800, - 0xF801, 0x2500, 0xF803, 0xF804, 0x251C, 0x2524, 0x2534, 0x252C, - 0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00B7, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF -] - -# Font codes -CONQUE_FONT = { - 0: {'description': 'Normal (default)', 'attributes': {'cterm': 'NONE', 'ctermfg': 'NONE', 'ctermbg': 'NONE', 'gui': 'NONE', 'guifg': 'NONE', 'guibg': 'NONE'}, 'normal': True}, - 1: {'description': 'Bold', 'attributes': {'cterm': 'BOLD', 'gui': 'BOLD'}, 'normal': False}, - 4: {'description': 'Underlined', 'attributes': {'cterm': 'UNDERLINE', 'gui': 'UNDERLINE'}, 'normal': False}, - 5: {'description': 'Blink (appears as Bold)', 'attributes': {'cterm': 'BOLD', 'gui': 'BOLD'}, 'normal': False}, - 7: {'description': 'Inverse', 'attributes': {'cterm': 'REVERSE', 'gui': 'REVERSE'}, 'normal': False}, - 8: {'description': 'Invisible (hidden)', 'attributes': {'ctermfg': '0', 'ctermbg': '0', 'guifg': '#000000', 'guibg': '#000000'}, 'normal': False}, - 22: {'description': 'Normal (neither bold nor faint)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True}, - 24: {'description': 'Not underlined', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True}, - 25: {'description': 'Steady (not blinking)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True}, - 27: {'description': 'Positive (not inverse)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True}, - 28: {'description': 'Visible (not hidden)', 'attributes': {'ctermfg': 'NONE', 'ctermbg': 'NONE', 'guifg': 'NONE', 'guibg': 'NONE'}, 'normal': True}, - 30: {'description': 'Set foreground color to Black', 'attributes': {'ctermfg': '16', 'guifg': '#000000'}, 'normal': False}, - 31: {'description': 'Set foreground color to Red', 'attributes': {'ctermfg': '1', 'guifg': '#ff0000'}, 'normal': False}, - 32: {'description': 'Set foreground color to Green', 'attributes': {'ctermfg': '2', 'guifg': '#00ff00'}, 'normal': False}, - 33: {'description': 'Set foreground color to Yellow', 'attributes': {'ctermfg': '3', 'guifg': '#ffff00'}, 'normal': False}, - 34: {'description': 'Set foreground color to Blue', 'attributes': {'ctermfg': '4', 'guifg': '#0000ff'}, 'normal': False}, - 35: {'description': 'Set foreground color to Magenta', 'attributes': {'ctermfg': '5', 'guifg': '#990099'}, 'normal': False}, - 36: {'description': 'Set foreground color to Cyan', 'attributes': {'ctermfg': '6', 'guifg': '#009999'}, 'normal': False}, - 37: {'description': 'Set foreground color to White', 'attributes': {'ctermfg': '7', 'guifg': '#ffffff'}, 'normal': False}, - 39: {'description': 'Set foreground color to default (original)', 'attributes': {'ctermfg': 'NONE', 'guifg': 'NONE'}, 'normal': True}, - 40: {'description': 'Set background color to Black', 'attributes': {'ctermbg': '16', 'guibg': '#000000'}, 'normal': False}, - 41: {'description': 'Set background color to Red', 'attributes': {'ctermbg': '1', 'guibg': '#ff0000'}, 'normal': False}, - 42: {'description': 'Set background color to Green', 'attributes': {'ctermbg': '2', 'guibg': '#00ff00'}, 'normal': False}, - 43: {'description': 'Set background color to Yellow', 'attributes': {'ctermbg': '3', 'guibg': '#ffff00'}, 'normal': False}, - 44: {'description': 'Set background color to Blue', 'attributes': {'ctermbg': '4', 'guibg': '#0000ff'}, 'normal': False}, - 45: {'description': 'Set background color to Magenta', 'attributes': {'ctermbg': '5', 'guibg': '#990099'}, 'normal': False}, - 46: {'description': 'Set background color to Cyan', 'attributes': {'ctermbg': '6', 'guibg': '#009999'}, 'normal': False}, - 47: {'description': 'Set background color to White', 'attributes': {'ctermbg': '7', 'guibg': '#ffffff'}, 'normal': False}, - 49: {'description': 'Set background color to default (original).', 'attributes': {'ctermbg': 'NONE', 'guibg': 'NONE'}, 'normal': True}, - 90: {'description': 'Set foreground color to Black', 'attributes': {'ctermfg': '8', 'guifg': '#000000'}, 'normal': False}, - 91: {'description': 'Set foreground color to Red', 'attributes': {'ctermfg': '9', 'guifg': '#ff0000'}, 'normal': False}, - 92: {'description': 'Set foreground color to Green', 'attributes': {'ctermfg': '10', 'guifg': '#00ff00'}, 'normal': False}, - 93: {'description': 'Set foreground color to Yellow', 'attributes': {'ctermfg': '11', 'guifg': '#ffff00'}, 'normal': False}, - 94: {'description': 'Set foreground color to Blue', 'attributes': {'ctermfg': '12', 'guifg': '#0000ff'}, 'normal': False}, - 95: {'description': 'Set foreground color to Magenta', 'attributes': {'ctermfg': '13', 'guifg': '#990099'}, 'normal': False}, - 96: {'description': 'Set foreground color to Cyan', 'attributes': {'ctermfg': '14', 'guifg': '#009999'}, 'normal': False}, - 97: {'description': 'Set foreground color to White', 'attributes': {'ctermfg': '15', 'guifg': '#ffffff'}, 'normal': False}, - 100: {'description': 'Set background color to Black', 'attributes': {'ctermbg': '8', 'guibg': '#000000'}, 'normal': False}, - 101: {'description': 'Set background color to Red', 'attributes': {'ctermbg': '9', 'guibg': '#ff0000'}, 'normal': False}, - 102: {'description': 'Set background color to Green', 'attributes': {'ctermbg': '10', 'guibg': '#00ff00'}, 'normal': False}, - 103: {'description': 'Set background color to Yellow', 'attributes': {'ctermbg': '11', 'guibg': '#ffff00'}, 'normal': False}, - 104: {'description': 'Set background color to Blue', 'attributes': {'ctermbg': '12', 'guibg': '#0000ff'}, 'normal': False}, - 105: {'description': 'Set background color to Magenta', 'attributes': {'ctermbg': '13', 'guibg': '#990099'}, 'normal': False}, - 106: {'description': 'Set background color to Cyan', 'attributes': {'ctermbg': '14', 'guibg': '#009999'}, 'normal': False}, - 107: {'description': 'Set background color to White', 'attributes': {'ctermbg': '15', 'guibg': '#ffffff'}, 'normal': False} -} - - -# regular expression matching (almost) all control sequences -CONQUE_SEQ_REGEX = re.compile("(\x1b\[?\??#?[0-9;]*[a-zA-Z0-9@=>]|\x1b\][0-9];.*?\x07|[\x01-\x0f]|\x1b\([AB0])") -CONQUE_SEQ_REGEX_CTL = re.compile("^[\x01-\x0f]$") -CONQUE_SEQ_REGEX_CSI = re.compile("^\x1b\[") -CONQUE_SEQ_REGEX_TITLE = re.compile("^\x1b\]") -CONQUE_SEQ_REGEX_HASH = re.compile("^\x1b#") -CONQUE_SEQ_REGEX_ESC = re.compile("^\x1b.$") -CONQUE_SEQ_REGEX_CHAR = re.compile("^\x1b[()]") - -# match table output -CONQUE_TABLE_OUTPUT = re.compile("^\s*\|\s.*\s\|\s*$|^\s*\+[=+-]+\+\s*$") - -# basic terminal colors -CONQUE_COLOR_SEQUENCE = ( - '000', '009', '090', '099', '900', '909', '990', '999', - '000', '00f', '0f0', '0ff', 'f00', 'f0f', 'ff0', 'fff' -) - - -# Windows subprocess constants - -# shared memory size -CONQUE_SOLE_BUFFER_LENGTH = 1000 -CONQUE_SOLE_INPUT_SIZE = 1000 -CONQUE_SOLE_STATS_SIZE = 1000 -CONQUE_SOLE_COMMANDS_SIZE = 255 -CONQUE_SOLE_RESCROLL_SIZE = 255 -CONQUE_SOLE_RESIZE_SIZE = 255 - -# interval of screen redraw -# larger number means less frequent -CONQUE_SOLE_SCREEN_REDRAW = 50 - -# interval of full buffer redraw -# larger number means less frequent -CONQUE_SOLE_BUFFER_REDRAW = 500 - -# interval of full output bucket replacement -# larger number means less frequent, 1 = every time -CONQUE_SOLE_MEM_REDRAW = 1000 - -# maximum number of lines with terminal colors -# ignored if g:ConqueTerm_Color = 2 -CONQUE_MAX_SYNTAX_LINES = 200 - -# windows input splitting on special keys -CONQUE_WIN32_REGEX_VK = re.compile("(\x1b\[[0-9;]+VK)") - -# windows attribute string splitting -CONQUE_WIN32_REGEX_ATTR = re.compile("((.)\\2*)", re.DOTALL) - -# special key attributes -CONQUE_VK_ATTR_CTRL_PRESSED = u('1024') - - diff --git a/vim/autoload/conque_term/conque_screen.py b/vim/autoload/conque_term/conque_screen.py deleted file mode 100644 index 40db616..0000000 --- a/vim/autoload/conque_term/conque_screen.py +++ /dev/null @@ -1,230 +0,0 @@ -# FILE: autoload/conque_term/conque_screen.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" -ConqueScreen is an extention of the vim.current.buffer object - -Unix terminal escape sequences usually reference line numbers relative to the -top of the visible screen. However the visible portion of the Vim buffer -representing the terminal probably doesn't start at the first line of the -buffer. - -The ConqueScreen class allows access to the Vim buffer with screen-relative -line numbering. And handles a few other related tasks, such as setting the -correct cursor position. - - E.g.: - s = ConqueScreen() - ... - s[5] = 'Set 5th line in terminal to this line' - s.append('Add new line to terminal') - s[5] = 'Since previous append() command scrolled the terminal down, this is a different line than first cb[5] call' - -""" - -import vim - - -class ConqueScreen(object): - - # the buffer - buffer = None - - # screen and scrolling regions - screen_top = 1 - - # screen width - screen_width = 80 - screen_height = 80 - - # char encoding for vim buffer - screen_encoding = 'utf-8' - - - def __init__(self): - """ Initialize screen size and character encoding. """ - - self.buffer = vim.current.buffer - - # initialize screen size - self.screen_top = 1 - self.screen_width = vim.current.window.width - self.screen_height = vim.current.window.height - - # save screen character encoding type - self.screen_encoding = vim.eval('&fileencoding') - - - def __len__(self): - """ Define the len() function for ConqueScreen objects. """ - return len(self.buffer) - - - def __getitem__(self, key): - """ Define value access for ConqueScreen objects. """ - buffer_line = self.get_real_idx(key) - - # if line is past buffer end, add lines to buffer - if buffer_line >= len(self.buffer): - for i in range(len(self.buffer), buffer_line + 1): - self.append(' ') - - return u(self.buffer[buffer_line], 'utf-8') - - - def __setitem__(self, key, value): - """ Define value assignments for ConqueScreen objects. """ - buffer_line = self.get_real_idx(key) - - if CONQUE_PYTHON_VERSION == 2: - val = value.encode(self.screen_encoding) - else: - # XXX / Vim's python3 interface doesn't accept bytes object - val = str(value) - - # if line is past end of screen, append - if buffer_line == len(self.buffer): - self.buffer.append(val) - else: - self.buffer[buffer_line] = val - - - def __delitem__(self, key): - """ Define value deletion for ConqueScreen objects. """ - del self.buffer[self.screen_top + key - 2] - - - def append(self, value): - """ Define value appending for ConqueScreen objects. """ - - if len(self.buffer) > self.screen_top + self.screen_height - 1: - self.buffer[len(self.buffer) - 1] = value - else: - self.buffer.append(value) - - if len(self.buffer) > self.screen_top + self.screen_height - 1: - self.screen_top += 1 - - if vim.current.buffer.number == self.buffer.number: - vim.command('normal! G') - - - def insert(self, line, value): - """ Define value insertion for ConqueScreen objects. """ - - l = self.screen_top + line - 2 - self.buffer.append(value, l) - - - def get_top(self): - """ Get the Vim line number representing the top of the visible terminal. """ - return self.screen_top - - - def get_real_idx(self, line): - """ Get the zero index Vim line number corresponding to the provided screen line. """ - return (self.screen_top + line - 2) - - - def get_buffer_line(self, line): - """ Get the Vim line number corresponding to the provided screen line. """ - return (self.screen_top + line - 1) - - - def set_screen_width(self, width): - """ Set the screen width. """ - self.screen_width = width - - - def clear(self): - """ Clear the screen. Does not clear the buffer, just scrolls down past all text. """ - - self.screen_width = width - self.buffer.append(' ') - vim.command('normal! Gzt') - self.screen_top = len(self.buffer) - - - def set_cursor(self, line, column): - """ Set cursor position. """ - - # figure out line - buffer_line = self.screen_top + line - 1 - if buffer_line > len(self.buffer): - for l in range(len(self.buffer) - 1, buffer_line): - self.buffer.append('') - - # figure out column - real_column = column - if len(self.buffer[buffer_line - 1]) < real_column: - self.buffer[buffer_line - 1] = self.buffer[buffer_line - 1] + ' ' * (real_column - len(self.buffer[buffer_line - 1])) - - if not CONQUE_FAST_MODE: - # set cursor at byte index of real_column'th character - vim.command('call cursor(' + str(buffer_line) + ', byteidx(getline(' + str(buffer_line) + '), ' + str(real_column) + '))') - - else: - # old version - # python version is occasionally grumpy - try: - vim.current.window.cursor = (buffer_line, real_column - 1) - except: - vim.command('call cursor(' + str(buffer_line) + ', ' + str(real_column) + ')') - - - def reset_size(self, line): - """ Change screen size """ - - - - - - # save cursor line number - buffer_line = self.screen_top + line - - # reset screen size - self.screen_width = vim.current.window.width - self.screen_height = vim.current.window.height - self.screen_top = len(self.buffer) - vim.current.window.height + 1 - if self.screen_top < 1: - self.screen_top = 1 - - - # align bottom of buffer to bottom of screen - vim.command('normal! ' + str(self.screen_height) + 'kG') - - # return new relative line number - return (buffer_line - self.screen_top) - - - def align(self): - """ align bottom of buffer to bottom of screen """ - vim.command('normal! ' + str(self.screen_height) + 'kG') - - diff --git a/vim/autoload/conque_term/conque_sole.py b/vim/autoload/conque_term/conque_sole.py deleted file mode 100644 index 556aee9..0000000 --- a/vim/autoload/conque_term/conque_sole.py +++ /dev/null @@ -1,458 +0,0 @@ -# FILE: autoload/conque_term/conque_sole.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" -Windows Console Emulator - -This is the main interface to the Windows emulator. It reads new output from the background console -and updates the Vim buffer. -""" - -import vim - - -class ConqueSole(Conque): - - window_top = None - window_bottom = None - - color_cache = {} - attribute_cache = {} - color_mode = None - color_conceals = {} - - buffer = None - encoding = None - - # counters for periodic rendering - buffer_redraw_ct = 1 - screen_redraw_ct = 1 - - # line offset, shifts output down - offset = 0 - - - def open(self): - """ Start command and initialize this instance - - Arguments: - command - Command string, e.g. "Powershell.exe" - options - Dictionary of config options - python_exe - Path to the python.exe executable. Usually C:\PythonXX\python.exe - communicator_py - Path to subprocess controller script in user's vimfiles directory - - """ - # get arguments - command = vim.eval('command') - options = vim.eval('options') - python_exe = vim.eval('py_exe') - communicator_py = vim.eval('py_vim') - - # init size - self.columns = vim.current.window.width - self.lines = vim.current.window.height - self.window_top = 0 - self.window_bottom = vim.current.window.height - 1 - - # color mode - self.color_mode = vim.eval('g:ConqueTerm_ColorMode') - - # line offset - self.offset = int(options['offset']) - - # init color - self.enable_colors = options['color'] and not CONQUE_FAST_MODE - - # open command - self.proc = ConqueSoleWrapper() - self.proc.open(command, self.lines, self.columns, python_exe, communicator_py, options) - - self.buffer = vim.current.buffer - self.screen_encoding = vim.eval('&fileencoding') - - - def read(self, timeout=1, set_cursor=True, return_output=False, update_buffer=True): - """ Read from console and update Vim buffer. """ - - try: - stats = self.proc.get_stats() - - if not stats: - return - - # disable screen and buffer redraws in fast mode - if not CONQUE_FAST_MODE: - self.buffer_redraw_ct += 1 - self.screen_redraw_ct += 1 - - update_top = 0 - update_bottom = 0 - lines = [] - - # full buffer redraw, our favorite! - #if self.buffer_redraw_ct == CONQUE_SOLE_BUFFER_REDRAW: - # self.buffer_redraw_ct = 0 - # update_top = 0 - # update_bottom = stats['top_offset'] + self.lines - # (lines, attributes) = self.proc.read(update_top, update_bottom) - # if return_output: - # output = self.get_new_output(lines, update_top, stats) - # if update_buffer: - # for i in range(update_top, update_bottom + 1): - # if CONQUE_FAST_MODE: - # self.plain_text(i, lines[i], None, stats) - # else: - # self.plain_text(i, lines[i], attributes[i], stats) - - # full screen redraw - if stats['cursor_y'] + 1 != self.l or stats['top_offset'] != self.window_top or self.screen_redraw_ct >= CONQUE_SOLE_SCREEN_REDRAW: - - self.screen_redraw_ct = 0 - update_top = self.window_top - update_bottom = max([stats['top_offset'] + self.lines + 1, stats['cursor_y']]) - (lines, attributes) = self.proc.read(update_top, update_bottom - update_top + 1) - if return_output: - output = self.get_new_output(lines, update_top, stats) - if update_buffer: - for i in range(update_top, update_bottom + 1): - if CONQUE_FAST_MODE: - self.plain_text(i, lines[i - update_top], None, stats) - else: - self.plain_text(i, lines[i - update_top], attributes[i - update_top], stats) - - - # single line redraw - else: - update_top = stats['cursor_y'] - (lines, attributes) = self.proc.read(update_top, 1) - if return_output: - output = self.get_new_output(lines, update_top, stats) - if update_buffer: - if lines[0].rstrip() != u(self.buffer[update_top].rstrip()): - if CONQUE_FAST_MODE: - self.plain_text(update_top, lines[0], None, stats) - else: - self.plain_text(update_top, lines[0], attributes[0], stats) - - - # reset current position - self.window_top = stats['top_offset'] - self.l = stats['cursor_y'] + 1 - self.c = stats['cursor_x'] + 1 - - # reposition cursor if this seems plausible - if set_cursor: - self.set_cursor(self.l, self.c) - - if return_output: - return output - - except: - - pass - - - def get_new_output(self, lines, update_top, stats): - """ Calculate the "new" output from this read. Fake but useful """ - - if not (stats['cursor_y'] + 1 > self.l or (stats['cursor_y'] + 1 == self.l and stats['cursor_x'] + 1 > self.c)): - return "" - - - - - - - try: - num_to_return = stats['cursor_y'] - self.l + 2 - - lines = lines[self.l - update_top - 1:] - - - new_output = [] - - # first line - new_output.append(lines[0][self.c - 1:].rstrip()) - - # the rest - for i in range(1, num_to_return): - new_output.append(lines[i].rstrip()) - - except: - - pass - - - - return "\n".join(new_output) - - - def plain_text(self, line_nr, text, attributes, stats): - """ Write plain text to Vim buffer. """ - - - - - - # handle line offset - line_nr += self.offset - - self.l = line_nr + 1 - - # remove trailing whitespace - text = text.rstrip() - - # if we're using concealed text for color, then s- is weird - if self.color_mode == 'conceal': - - text = self.add_conceal_color(text, attributes, stats, line_nr) - - - # deal with character encoding - if CONQUE_PYTHON_VERSION == 2: - val = text.encode(self.screen_encoding) - else: - # XXX / Vim's python3 interface doesn't accept bytes object - val = str(text) - - # update vim buffer - if len(self.buffer) <= line_nr: - self.buffer.append(val) - else: - self.buffer[line_nr] = val - - if self.enable_colors and not self.color_mode == 'conceal' and line_nr > self.l - CONQUE_MAX_SYNTAX_LINES: - relevant = attributes[0:len(text)] - if line_nr not in self.attribute_cache or self.attribute_cache[line_nr] != relevant: - self.do_color(attributes=relevant, stats=stats) - self.attribute_cache[line_nr] = relevant - - - def add_conceal_color(self, text, attributes, stats, line_nr): - """ Add 'conceal' color strings to output text """ - - # stop here if coloration is disabled - if not self.enable_colors: - return text - - # if no colors for this line, clear everything out - if len(attributes) == 0 or attributes == u(chr(stats['default_attribute'])) * len(attributes): - return text - - new_text = '' - self.color_conceals[line_nr] = [] - - attribute_chunks = CONQUE_WIN32_REGEX_ATTR.findall(attributes) - offset = 0 - ends = [] - for attr in attribute_chunks: - attr_num = ord(attr[1]) - ends = [] - if attr_num != stats['default_attribute']: - - color = self.translate_color(attr_num) - - new_text += chr(27) + 'sf' + color['fg_code'] + ';' - ends.append(chr(27) + 'ef' + color['fg_code'] + ';') - self.color_conceals[line_nr].append(offset) - - if attr_num > 15: - new_text += chr(27) + 'sb' + color['bg_code'] + ';' - ends.append(chr(27) + 'eb' + color['bg_code'] + ';') - self.color_conceals[line_nr].append(offset) - - new_text += text[offset:offset + len(attr[0])] - - # close color regions - ends.reverse() - for i in range(0, len(ends)): - self.color_conceals[line_nr].append(len(new_text)) - new_text += ends[i] - - offset += len(attr[0]) - - return new_text - - - def do_color(self, start=0, end=0, attributes='', stats=None): - """ Convert Windows console attributes into Vim syntax highlighting """ - - # if no colors for this line, clear everything out - if len(attributes) == 0 or attributes == u(chr(stats['default_attribute'])) * len(attributes): - self.color_changes = {} - self.apply_color(1, len(attributes), self.l) - return - - attribute_chunks = CONQUE_WIN32_REGEX_ATTR.findall(attributes) - offset = 0 - for attr in attribute_chunks: - attr_num = ord(attr[1]) - if attr_num != stats['default_attribute']: - self.color_changes = self.translate_color(attr_num) - self.apply_color(offset + 1, offset + len(attr[0]) + 1, self.l) - offset += len(attr[0]) - - - def translate_color(self, attr): - """ Convert Windows console attributes into RGB colors """ - - # check for cached color - if attr in self.color_cache: - return self.color_cache[attr] - - - - - - - # convert attribute integer to bit string - bit_str = bin(attr) - bit_str = bit_str.replace('0b', '') - - # slice foreground and background portions of bit string - fg = bit_str[-4:].rjust(4, '0') - bg = bit_str[-8:-4].rjust(4, '0') - - # ok, first create foreground #rbg - red = int(fg[1]) * 204 + int(fg[0]) * int(fg[1]) * 51 - green = int(fg[2]) * 204 + int(fg[0]) * int(fg[2]) * 51 - blue = int(fg[3]) * 204 + int(fg[0]) * int(fg[3]) * 51 - fg_str = "#%02x%02x%02x" % (red, green, blue) - fg_code = "%02x%02x%02x" % (red, green, blue) - fg_code = fg_code[0] + fg_code[2] + fg_code[4] - - # ok, first create foreground #rbg - red = int(bg[1]) * 204 + int(bg[0]) * int(bg[1]) * 51 - green = int(bg[2]) * 204 + int(bg[0]) * int(bg[2]) * 51 - blue = int(bg[3]) * 204 + int(bg[0]) * int(bg[3]) * 51 - bg_str = "#%02x%02x%02x" % (red, green, blue) - bg_code = "%02x%02x%02x" % (red, green, blue) - bg_code = bg_code[0] + bg_code[2] + bg_code[4] - - # build value for color_changes - - color = {'guifg': fg_str, 'guibg': bg_str} - - if self.color_mode == 'conceal': - color['fg_code'] = fg_code - color['bg_code'] = bg_code - - self.color_cache[attr] = color - - return color - - - def write_vk(self, vk_code): - """ write virtual key code to shared memory using proprietary escape seq """ - - self.proc.write_vk(vk_code) - - - def update_window_size(self): - """ Resize underlying console if Vim buffer size has changed """ - - if vim.current.window.width != self.columns or vim.current.window.height != self.lines: - - - - # reset all window size attributes to default - self.columns = vim.current.window.width - self.lines = vim.current.window.height - self.working_columns = vim.current.window.width - self.working_lines = vim.current.window.height - self.bottom = vim.current.window.height - - self.proc.window_resize(vim.current.window.height, vim.current.window.width) - - - def set_cursor(self, line, column): - """ Update cursor position in Vim buffer """ - - - - # handle offset - line += self.offset - - # shift cursor position to handle concealed text - if self.enable_colors and self.color_mode == 'conceal': - if line - 1 in self.color_conceals: - for c in self.color_conceals[line - 1]: - if c < column: - column += 7 - else: - break - - - - # figure out line - buffer_line = line - if buffer_line > len(self.buffer): - for l in range(len(self.buffer) - 1, buffer_line): - self.buffer.append('') - - # figure out column - real_column = column - if len(self.buffer[buffer_line - 1]) < real_column: - self.buffer[buffer_line - 1] = self.buffer[buffer_line - 1] + ' ' * (real_column - len(self.buffer[buffer_line - 1])) - - # python version is occasionally grumpy - try: - vim.current.window.cursor = (buffer_line, real_column - 1) - except: - vim.command('call cursor(' + str(buffer_line) + ', ' + str(real_column) + ')') - - - def idle(self): - """ go into idle mode """ - - self.proc.idle() - - - def resume(self): - """ resume from idle mode """ - - self.proc.resume() - - - def close(self): - """ end console subprocess """ - self.proc.close() - - - def abort(self): - """ end subprocess forcefully """ - self.proc.close() - - - def get_buffer_line(self, line): - """ get buffer line """ - return line - - -# vim:foldmethod=marker diff --git a/vim/autoload/conque_term/conque_sole_communicator.py b/vim/autoload/conque_term/conque_sole_communicator.py deleted file mode 100644 index e3f7db3..0000000 --- a/vim/autoload/conque_term/conque_sole_communicator.py +++ /dev/null @@ -1,183 +0,0 @@ -# FILE: autoload/conque_term/conque_sole_communicator.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" - -ConqueSoleCommunicator - -This script will create a new Windows console and start the requested program -inside of it. This process is launched independently from the parent Vim -program, so it has no access to the vim module. - -The main loop in this script reads data from the console and syncs it onto -blocks of memory shared with the Vim process. In this way the Vim process -and this script can communicate with each other. - -""" - -import time -import sys - -from conque_globals import * -from conque_win32_util import * -from conque_sole_subprocess import * -from conque_sole_shared_memory import * - -############################################################## -# only run if this file was run directly - -if __name__ == '__main__': - - # attempt to catch ALL exceptions to fend of zombies - try: - - # simple arg validation - - if len(sys.argv) < 5: - - exit() - - # maximum time this thing reads. 0 means no limit. Only for testing. - max_loops = 0 - - # read interval, in seconds - sleep_time = 0.01 - - # idle read interval, in seconds - idle_sleep_time = 0.10 - - # are we idled? - is_idle = False - - # mem key - mem_key = sys.argv[1] - - # console width - console_width = int(sys.argv[2]) - - # console height - console_height = int(sys.argv[3]) - - # code page - code_page = int(sys.argv[4]) - - # code page - fast_mode = int(sys.argv[5]) - - # the actual subprocess to run - cmd_line = " ".join(sys.argv[6:]) - - - # width and height - options = {'LINES': console_height, 'COLUMNS': console_width, 'CODE_PAGE': code_page, 'FAST_MODE': fast_mode} - - - - # set initial idle status - shm_command = ConqueSoleSharedMemory(CONQUE_SOLE_COMMANDS_SIZE, 'command', mem_key, serialize=True) - shm_command.create('write') - - cmd = shm_command.read() - if cmd: - - if cmd['cmd'] == 'idle': - is_idle = True - shm_command.clear() - - - ############################################################## - # Create the subprocess - - proc = ConqueSoleSubprocess() - res = proc.open(cmd_line, mem_key, options) - - if not res: - - exit() - - ############################################################## - # main loop! - - loops = 0 - - while True: - - # check for idle/resume - if is_idle or loops % 25 == 0: - - # check process health - if not proc.is_alive(): - - proc.close() - break - - # check for change in buffer focus - cmd = shm_command.read() - if cmd: - - if cmd['cmd'] == 'idle': - is_idle = True - shm_command.clear() - - elif cmd['cmd'] == 'resume': - is_idle = False - shm_command.clear() - - - # sleep between loops if moderation is requested - if sleep_time > 0: - if is_idle: - time.sleep(idle_sleep_time) - else: - time.sleep(sleep_time) - - # write, read, etc - proc.write() - proc.read() - - # increment loops, and exit if max has been reached - loops += 1 - if max_loops and loops >= max_loops: - - break - - ############################################################## - # all done! - - - - proc.close() - - # if an exception was thrown, croak - except: - - proc.close() - - -# vim:foldmethod=marker diff --git a/vim/autoload/conque_term/conque_sole_shared_memory.py b/vim/autoload/conque_term/conque_sole_shared_memory.py deleted file mode 100644 index 1d4ed3a..0000000 --- a/vim/autoload/conque_term/conque_sole_shared_memory.py +++ /dev/null @@ -1,210 +0,0 @@ -# FILE: autoload/conque_term/conque_sole_shared_memory.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" -Wrapper class for shared memory between Windows python processes - -Adds a small amount of functionality to the standard mmap module. - -""" - -import mmap -import sys - -# PYTHON VERSION -CONQUE_PYTHON_VERSION = sys.version_info[0] - -if CONQUE_PYTHON_VERSION == 2: - import cPickle as pickle -else: - import pickle - - -class ConqueSoleSharedMemory(): - - # is the data being stored not fixed length - fixed_length = False - - # maximum number of bytes per character, for fixed width blocks - char_width = 1 - - # fill memory with this character when clearing and fixed_length is true - FILL_CHAR = None - - # serialize and unserialize data automatically - serialize = False - - # size of shared memory, in bytes / chars - mem_size = None - - # size of shared memory, in bytes / chars - mem_type = None - - # unique key, so multiple console instances are possible - mem_key = None - - # mmap instance - shm = None - - # character encoding, dammit - encoding = 'utf-8' - - # pickle terminator - TERMINATOR = None - - - def __init__(self, mem_size, mem_type, mem_key, fixed_length=False, fill_char=' ', serialize=False, encoding='utf-8'): - """ Initialize new shared memory block instance - - Arguments: - mem_size -- Memory size in characters, depends on encoding argument to calcuate byte size - mem_type -- Label to identify what will be stored - mem_key -- Unique, probably random key to identify this block - fixed_length -- If set to true, assume the data stored will always fill the memory size - fill_char -- Initialize memory block with this character, only really helpful with fixed_length blocks - serialize -- Automatically serialize data passed to write. Allows storing non-byte data - encoding -- Character encoding to use when storing character data - - """ - self.mem_size = mem_size - self.mem_type = mem_type - self.mem_key = mem_key - self.fixed_length = fixed_length - self.fill_char = fill_char - self.serialize = serialize - self.encoding = encoding - self.TERMINATOR = str(chr(0)).encode(self.encoding) - - if CONQUE_PYTHON_VERSION == 3: - self.FILL_CHAR = fill_char - else: - self.FILL_CHAR = unicode(fill_char) - - if fixed_length and encoding == 'utf-8': - self.char_width = 4 - - - def create(self, access='write'): - """ Create a new block of shared memory using the mmap module. """ - - if access == 'write': - mmap_access = mmap.ACCESS_WRITE - else: - mmap_access = mmap.ACCESS_READ - - name = "conque_%s_%s" % (self.mem_type, self.mem_key) - - self.shm = mmap.mmap(0, self.mem_size * self.char_width, name, mmap_access) - - if not self.shm: - return False - else: - return True - - - def read(self, chars=1, start=0): - """ Read data from shared memory. - - If this is a fixed length block, read 'chars' characters from memory. - Otherwise read up until the TERMINATOR character (null byte). - If this memory is serialized, unserialize it automatically. - - """ - # go to start position - self.shm.seek(start * self.char_width) - - if self.fixed_length: - chars = chars * self.char_width - else: - chars = self.shm.find(self.TERMINATOR) - - if chars == 0: - return '' - - shm_str = self.shm.read(chars) - - # return unpickled byte object - if self.serialize: - return pickle.loads(shm_str) - - # decode byes in python 3 - if CONQUE_PYTHON_VERSION == 3: - return str(shm_str, self.encoding) - - # encoding - if self.encoding != 'ascii': - shm_str = unicode(shm_str, self.encoding) - - return shm_str - - - def write(self, text, start=0): - """ Write data to memory. - - If memory is fixed length, simply write the 'text' characters at 'start' position. - Otherwise write 'text' characters and append a null character. - If memory is serializable, do so first. - - """ - # simple scenario, let pickle create bytes - if self.serialize: - if CONQUE_PYTHON_VERSION == 3: - tb = pickle.dumps(text, 0) - else: - tb = pickle.dumps(text, 0).encode(self.encoding) - - else: - tb = text.encode(self.encoding, 'replace') - - # write to memory - self.shm.seek(start * self.char_width) - - if self.fixed_length: - self.shm.write(tb) - else: - self.shm.write(tb + self.TERMINATOR) - - - def clear(self, start=0): - """ Clear memory block using self.fill_char. """ - - self.shm.seek(start) - - if self.fixed_length: - self.shm.write(str(self.fill_char * self.mem_size * self.char_width).encode(self.encoding)) - else: - self.shm.write(self.TERMINATOR) - - - def close(self): - """ Close/destroy memory block. """ - - self.shm.close() - - diff --git a/vim/autoload/conque_term/conque_sole_subprocess.py b/vim/autoload/conque_term/conque_sole_subprocess.py deleted file mode 100644 index 0f205b6..0000000 --- a/vim/autoload/conque_term/conque_sole_subprocess.py +++ /dev/null @@ -1,762 +0,0 @@ -# FILE: autoload/conque_term/conque_sole_subprocess.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" ConqueSoleSubprocess - -Creates a new subprocess with it's own (hidden) console window. - -Mirrors console window text onto a block of shared memory (mmap), along with -text attribute data. Also handles translation of text input into the format -Windows console expects. - -Sample Usage: - - sh = ConqueSoleSubprocess() - sh.open("cmd.exe", "unique_str") - - shm_in = ConqueSoleSharedMemory(mem_key = "unique_str", mem_type = "input", ...) - shm_out = ConqueSoleSharedMemory(mem_key = "unique_str", mem_type = "output", ...) - - output = shm_out.read(...) - shm_in.write("dir\r") - output = shm_out.read(...) - -""" - -import time -import re -import os -import ctypes - -from conque_globals import * -from conque_win32_util import * -from conque_sole_shared_memory import * - - -class ConqueSoleSubprocess(): - - # subprocess handle and pid - handle = None - pid = None - - # input / output handles - stdin = None - stdout = None - - # size of console window - window_width = 160 - window_height = 40 - - # max lines for the console buffer - buffer_width = 160 - buffer_height = 100 - - # keep track of the buffer number at the top of the window - top = 0 - line_offset = 0 - - # buffer height is CONQUE_SOLE_BUFFER_LENGTH * output_blocks - output_blocks = 1 - - # cursor position - cursor_line = 0 - cursor_col = 0 - - # console data, array of lines - data = [] - - # console attribute data, array of array of int - attributes = [] - attribute_cache = {} - - # default attribute - default_attribute = 7 - - # shared memory objects - shm_input = None - shm_output = None - shm_attributes = None - shm_stats = None - shm_command = None - shm_rescroll = None - shm_resize = None - - # are we still a valid process? - is_alive = True - - # running in fast mode - fast_mode = 0 - - # used for periodic execution of screen and memory redrawing - screen_redraw_ct = 0 - mem_redraw_ct = 0 - - - def open(self, cmd, mem_key, options={}): - """ Create subproccess running in hidden console window. """ - - - - self.reset = True - - try: - # if we're already attached to a console, then unattach - try: - ctypes.windll.kernel32.FreeConsole() - except: - pass - - # set buffer height - self.buffer_height = CONQUE_SOLE_BUFFER_LENGTH - - if 'LINES' in options and 'COLUMNS' in options: - self.window_width = options['COLUMNS'] - self.window_height = options['LINES'] - self.buffer_width = options['COLUMNS'] - - # fast mode - self.fast_mode = options['FAST_MODE'] - - # console window options - si = STARTUPINFO() - - # hide window - si.dwFlags |= STARTF_USESHOWWINDOW - si.wShowWindow = SW_HIDE - #si.wShowWindow = SW_MINIMIZE - - # process options - flags = NORMAL_PRIORITY_CLASS | CREATE_NEW_PROCESS_GROUP | CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE - - # created process info - pi = PROCESS_INFORMATION() - - - - # create the process! - res = ctypes.windll.kernel32.CreateProcessW(None, u(cmd), None, None, 0, flags, None, u('.'), ctypes.byref(si), ctypes.byref(pi)) - - - - - - # process info - self.pid = pi.dwProcessId - self.handle = pi.hProcess - - - - - # attach ourselves to the new console - # console is not immediately available - for i in range(10): - time.sleep(0.25) - try: - - res = ctypes.windll.kernel32.AttachConsole(self.pid) - - - - - - - break - except: - - pass - - # get input / output handles - self.stdout = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) - self.stdin = ctypes.windll.kernel32.GetStdHandle(STD_INPUT_HANDLE) - - # set buffer size - size = COORD(self.buffer_width, self.buffer_height) - res = ctypes.windll.kernel32.SetConsoleScreenBufferSize(self.stdout, size) - - - - - - - - # prev set size call needs to process - time.sleep(0.2) - - # set window size - self.set_window_size(self.window_width, self.window_height) - - # set utf-8 code page - if 'CODE_PAGE' in options and options['CODE_PAGE'] > 0: - if ctypes.windll.kernel32.IsValidCodePage(ctypes.c_uint(options['CODE_PAGE'])): - - ctypes.windll.kernel32.SetConsoleCP(ctypes.c_uint(options['CODE_PAGE'])) - ctypes.windll.kernel32.SetConsoleOutputCP(ctypes.c_uint(options['CODE_PAGE'])) - - # init shared memory - self.init_shared_memory(mem_key) - - # init read buffers - self.tc = ctypes.create_unicode_buffer(self.buffer_width) - self.ac = ctypes.create_unicode_buffer(self.buffer_width) - - return True - - except: - - return False - - - def init_shared_memory(self, mem_key): - """ Create shared memory objects. """ - - self.shm_input = ConqueSoleSharedMemory(CONQUE_SOLE_INPUT_SIZE, 'input', mem_key) - self.shm_input.create('write') - self.shm_input.clear() - - self.shm_output = ConqueSoleSharedMemory(self.buffer_height * self.buffer_width, 'output', mem_key, True) - self.shm_output.create('write') - self.shm_output.clear() - - if not self.fast_mode: - buf_info = self.get_buffer_info() - self.shm_attributes = ConqueSoleSharedMemory(self.buffer_height * self.buffer_width, 'attributes', mem_key, True, chr(buf_info.wAttributes), encoding='latin-1') - self.shm_attributes.create('write') - self.shm_attributes.clear() - - self.shm_stats = ConqueSoleSharedMemory(CONQUE_SOLE_STATS_SIZE, 'stats', mem_key, serialize=True) - self.shm_stats.create('write') - self.shm_stats.clear() - - self.shm_command = ConqueSoleSharedMemory(CONQUE_SOLE_COMMANDS_SIZE, 'command', mem_key, serialize=True) - self.shm_command.create('write') - self.shm_command.clear() - - self.shm_resize = ConqueSoleSharedMemory(CONQUE_SOLE_RESIZE_SIZE, 'resize', mem_key, serialize=True) - self.shm_resize.create('write') - self.shm_resize.clear() - - self.shm_rescroll = ConqueSoleSharedMemory(CONQUE_SOLE_RESCROLL_SIZE, 'rescroll', mem_key, serialize=True) - self.shm_rescroll.create('write') - self.shm_rescroll.clear() - - return True - - - def check_commands(self): - """ Check for and process commands from Vim. """ - - cmd = self.shm_command.read() - - if cmd: - - # shut it all down - if cmd['cmd'] == 'close': - - # clear command - self.shm_command.clear() - - self.close() - return - - cmd = self.shm_resize.read() - - if cmd: - - # clear command - self.shm_resize.clear() - - # resize console - if cmd['cmd'] == 'resize': - - - - # only change buffer width if it's larger - if cmd['data']['width'] > self.buffer_width: - self.buffer_width = cmd['data']['width'] - - # always change console width and height - self.window_width = cmd['data']['width'] - self.window_height = cmd['data']['height'] - - # reset the console - buf_info = self.get_buffer_info() - self.reset_console(buf_info, add_block=False) - - - def read(self): - """ Read from windows console and update shared memory blocks. """ - - # no point really - if self.screen_redraw_ct == 0 and not self.is_alive(): - stats = {'top_offset': 0, 'default_attribute': 0, 'cursor_x': 0, 'cursor_y': self.cursor_line, 'is_alive': 0} - - self.shm_stats.write(stats) - return - - # check for commands - self.check_commands() - - # get cursor position - buf_info = self.get_buffer_info() - curs_line = buf_info.dwCursorPosition.Y - curs_col = buf_info.dwCursorPosition.X - - # set update range - if curs_line != self.cursor_line or self.top != buf_info.srWindow.Top or self.screen_redraw_ct == CONQUE_SOLE_SCREEN_REDRAW: - self.screen_redraw_ct = 0 - - read_start = self.top - read_end = max([buf_info.srWindow.Bottom + 1, curs_line + 1]) - else: - - read_start = curs_line - read_end = curs_line + 1 - - - - - # vars used in for loop - coord = COORD(0, 0) - chars_read = ctypes.c_int(0) - - # read new data - for i in range(read_start, read_end): - - coord.Y = i - - res = ctypes.windll.kernel32.ReadConsoleOutputCharacterW(self.stdout, ctypes.byref(self.tc), self.buffer_width, coord, ctypes.byref(chars_read)) - if not self.fast_mode: - ctypes.windll.kernel32.ReadConsoleOutputAttribute(self.stdout, ctypes.byref(self.ac), self.buffer_width, coord, ctypes.byref(chars_read)) - - t = self.tc.value - if not self.fast_mode: - a = self.ac.value - - # add data - if i >= len(self.data): - for j in range(len(self.data), i + 1): - self.data.append('') - if not self.fast_mode: - self.attributes.append('') - - self.data[i] = t - if not self.fast_mode: - self.attributes[i] = a - - - - - #for i in range(0, len(t)): - - - - - # write new output to shared memory - try: - if self.mem_redraw_ct == CONQUE_SOLE_MEM_REDRAW: - self.mem_redraw_ct = 0 - - for i in range(0, len(self.data)): - self.shm_output.write(text=self.data[i], start=self.buffer_width * i) - if not self.fast_mode: - self.shm_attributes.write(text=self.attributes[i], start=self.buffer_width * i) - else: - - for i in range(read_start, read_end): - self.shm_output.write(text=self.data[i], start=self.buffer_width * i) - if not self.fast_mode: - self.shm_attributes.write(text=self.attributes[i], start=self.buffer_width * i) - #self.shm_output.write(text=''.join(self.data[read_start:read_end]), start=read_start * self.buffer_width) - #self.shm_attributes.write(text=''.join(self.attributes[read_start:read_end]), start=read_start * self.buffer_width) - - # write cursor position to shared memory - stats = {'top_offset': buf_info.srWindow.Top, 'default_attribute': buf_info.wAttributes, 'cursor_x': curs_col, 'cursor_y': curs_line, 'is_alive': 1} - self.shm_stats.write(stats) - - # adjust screen position - self.top = buf_info.srWindow.Top - self.cursor_line = curs_line - - # check for reset - if curs_line > buf_info.dwSize.Y - 200: - self.reset_console(buf_info) - - except: - - - - - pass - - # increment redraw counters - self.screen_redraw_ct += 1 - self.mem_redraw_ct += 1 - - return None - - - def reset_console(self, buf_info, add_block=True): - """ Extend the height of the current console if the cursor postion gets within 200 lines of the current size. """ - - # sometimes we just want to change the buffer width, - # in which case no need to add another block - if add_block: - self.output_blocks += 1 - - # close down old memory - self.shm_output.close() - self.shm_output = None - - if not self.fast_mode: - self.shm_attributes.close() - self.shm_attributes = None - - # new shared memory key - mem_key = 'mk' + str(time.time()) - - # reallocate memory - self.shm_output = ConqueSoleSharedMemory(self.buffer_height * self.buffer_width * self.output_blocks, 'output', mem_key, True) - self.shm_output.create('write') - self.shm_output.clear() - - # backfill data - if len(self.data[0]) < self.buffer_width: - for i in range(0, len(self.data)): - self.data[i] = self.data[i] + ' ' * (self.buffer_width - len(self.data[i])) - self.shm_output.write(''.join(self.data)) - - if not self.fast_mode: - self.shm_attributes = ConqueSoleSharedMemory(self.buffer_height * self.buffer_width * self.output_blocks, 'attributes', mem_key, True, chr(buf_info.wAttributes), encoding='latin-1') - self.shm_attributes.create('write') - self.shm_attributes.clear() - - # backfill attributes - if len(self.attributes[0]) < self.buffer_width: - for i in range(0, len(self.attributes)): - self.attributes[i] = self.attributes[i] + chr(buf_info.wAttributes) * (self.buffer_width - len(self.attributes[i])) - if not self.fast_mode: - self.shm_attributes.write(''.join(self.attributes)) - - # notify wrapper of new output block - self.shm_rescroll.write({'cmd': 'new_output', 'data': {'blocks': self.output_blocks, 'mem_key': mem_key}}) - - # set buffer size - size = COORD(X=self.buffer_width, Y=self.buffer_height * self.output_blocks) - - res = ctypes.windll.kernel32.SetConsoleScreenBufferSize(self.stdout, size) - - - - - - - # prev set size call needs to process - time.sleep(0.2) - - # set window size - self.set_window_size(self.window_width, self.window_height) - - # init read buffers - self.tc = ctypes.create_unicode_buffer(self.buffer_width) - self.ac = ctypes.create_unicode_buffer(self.buffer_width) - - - - def write(self): - """ Write text to console. - - This function just parses out special sequences for special key events - and passes on the text to the plain or virtual key functions. - - """ - # get input from shared mem - text = self.shm_input.read() - - # nothing to do here - if text == u(''): - return - - - - # clear input queue - self.shm_input.clear() - - # split on VK codes - chunks = CONQUE_WIN32_REGEX_VK.split(text) - - # if len() is one then no vks - if len(chunks) == 1: - self.write_plain(text) - return - - - - # loop over chunks and delegate - for t in chunks: - - if t == '': - continue - - if CONQUE_WIN32_REGEX_VK.match(t): - - self.write_vk(t[2:-2]) - else: - self.write_plain(t) - - - def write_plain(self, text): - """ Write simple text to subprocess. """ - - li = INPUT_RECORD * len(text) - list_input = li() - - for i in range(0, len(text)): - - # create keyboard input - ke = KEY_EVENT_RECORD() - ke.bKeyDown = ctypes.c_byte(1) - ke.wRepeatCount = ctypes.c_short(1) - - cnum = ord(text[i]) - - ke.wVirtualKeyCode = ctypes.windll.user32.VkKeyScanW(cnum) - ke.wVirtualScanCode = ctypes.c_short(ctypes.windll.user32.MapVirtualKeyW(int(cnum), 0)) - - if cnum > 31: - ke.uChar.UnicodeChar = uchr(cnum) - elif cnum == 3: - ctypes.windll.kernel32.GenerateConsoleCtrlEvent(0, self.pid) - ke.uChar.UnicodeChar = uchr(cnum) - ke.wVirtualKeyCode = ctypes.windll.user32.VkKeyScanW(cnum + 96) - ke.dwControlKeyState |= LEFT_CTRL_PRESSED - else: - ke.uChar.UnicodeChar = uchr(cnum) - if cnum in CONQUE_WINDOWS_VK_INV: - ke.wVirtualKeyCode = cnum - else: - ke.wVirtualKeyCode = ctypes.windll.user32.VkKeyScanW(cnum + 96) - ke.dwControlKeyState |= LEFT_CTRL_PRESSED - - - - - kc = INPUT_RECORD(KEY_EVENT) - kc.Event.KeyEvent = ke - list_input[i] = kc - - - - # write input array - events_written = ctypes.c_int() - res = ctypes.windll.kernel32.WriteConsoleInputW(self.stdin, list_input, len(text), ctypes.byref(events_written)) - - - - - - - - - def write_vk(self, vk_code): - """ Write special characters to console subprocess. """ - - - - code = None - ctrl_pressed = False - - # this could be made more generic when more attributes - # other than ctrl_pressed are available - vk_attributes = vk_code.split(';') - - for attr in vk_attributes: - if attr == CONQUE_VK_ATTR_CTRL_PRESSED: - ctrl_pressed = True - else: - code = attr - - li = INPUT_RECORD * 1 - - # create keyboard input - ke = KEY_EVENT_RECORD() - ke.uChar.UnicodeChar = uchr(0) - ke.wVirtualKeyCode = ctypes.c_short(int(code)) - ke.wVirtualScanCode = ctypes.c_short(ctypes.windll.user32.MapVirtualKeyW(int(code), 0)) - ke.bKeyDown = ctypes.c_byte(1) - ke.wRepeatCount = ctypes.c_short(1) - - # set enhanced key mode for arrow keys - if code in CONQUE_WINDOWS_VK_ENHANCED: - - ke.dwControlKeyState |= ENHANCED_KEY - - if ctrl_pressed: - ke.dwControlKeyState |= LEFT_CTRL_PRESSED - - kc = INPUT_RECORD(KEY_EVENT) - kc.Event.KeyEvent = ke - list_input = li(kc) - - # write input array - events_written = ctypes.c_int() - res = ctypes.windll.kernel32.WriteConsoleInputW(self.stdin, list_input, 1, ctypes.byref(events_written)) - - - - - - - - def close(self): - """ Close all running subproccesses """ - - # record status - self.is_alive = False - try: - stats = {'top_offset': 0, 'default_attribute': 0, 'cursor_x': 0, 'cursor_y': self.cursor_line, 'is_alive': 0} - self.shm_stats.write(stats) - except: - pass - - pid_list = (ctypes.c_int * 10)() - num = ctypes.windll.kernel32.GetConsoleProcessList(pid_list, 10) - - - - current_pid = os.getpid() - - - - - - # kill subprocess pids - for pid in pid_list[0:num]: - if not pid: - break - - # kill current pid last - if pid == current_pid: - continue - try: - self.close_pid(pid) - except: - - pass - - # kill this process - try: - self.close_pid(current_pid) - except: - - pass - - - def close_pid(self, pid): - """ Terminate a single process. """ - - - handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid) - ctypes.windll.kernel32.TerminateProcess(handle, -1) - ctypes.windll.kernel32.CloseHandle(handle) - - - def is_alive(self): - """ Check process health. """ - - status = ctypes.windll.kernel32.WaitForSingleObject(self.handle, 1) - - if status == 0: - - self.is_alive = False - - return self.is_alive - - - def get_screen_text(self): - """ Return screen data as string. """ - - return "\n".join(self.data) - - - def set_window_size(self, width, height): - """ Change Windows console size. """ - - - - # get current window size object - window_size = SMALL_RECT(0, 0, 0, 0) - - # buffer info has maximum window size data - buf_info = self.get_buffer_info() - - - # set top left corner - window_size.Top = 0 - window_size.Left = 0 - - # set bottom right corner - if buf_info.dwMaximumWindowSize.X < width: - - window_size.Right = buf_info.dwMaximumWindowSize.X - 1 - else: - window_size.Right = width - 1 - - if buf_info.dwMaximumWindowSize.Y < height: - - window_size.Bottom = buf_info.dwMaximumWindowSize.Y - 1 - else: - window_size.Bottom = height - 1 - - - - # set the window size! - res = ctypes.windll.kernel32.SetConsoleWindowInfo(self.stdout, ctypes.c_bool(True), ctypes.byref(window_size)) - - - - - - - # reread buffer info to get final console max lines - buf_info = self.get_buffer_info() - - self.window_width = buf_info.srWindow.Right + 1 - self.window_height = buf_info.srWindow.Bottom + 1 - - - def get_buffer_info(self): - """ Retrieve commonly-used buffer information. """ - - buf_info = CONSOLE_SCREEN_BUFFER_INFO() - ctypes.windll.kernel32.GetConsoleScreenBufferInfo(self.stdout, ctypes.byref(buf_info)) - - return buf_info - - - diff --git a/vim/autoload/conque_term/conque_sole_wrapper.py b/vim/autoload/conque_term/conque_sole_wrapper.py deleted file mode 100644 index 4e4816f..0000000 --- a/vim/autoload/conque_term/conque_sole_wrapper.py +++ /dev/null @@ -1,278 +0,0 @@ -# FILE: autoload/conque_term/conque_sole_wrapper.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" - -ConqueSoleSubprocessWrapper - -Subprocess wrapper to deal with Windows insanity. Launches console based python, -which in turn launches originally requested command. Communicates with cosole -python through shared memory objects. - -""" - -import ctypes -import time - - -class ConqueSoleWrapper(): - - # unique key used for shared memory block names - shm_key = '' - - # process info - handle = None - pid = None - - # queue input in this bucket - bucket = None - - # console size - lines = 24 - columns = 80 - - # shared memory objects - shm_input = None - shm_output = None - shm_attributes = None - shm_stats = None - shm_command = None - shm_rescroll = None - shm_resize = None - - # console python process - proc = None - - - def open(self, cmd, lines, columns, python_exe='python.exe', communicator_py='conque_sole_communicator.py', options={}): - """ Launch python.exe subprocess which will in turn launch the user's program. - - Arguments: - cmd -- The user's command to run. E.g. "Powershell.exe" or "C:\Python27\Scripts\ipython.bat" - lines, columns -- The size of the console, also the size of the Vim buffer - python.exe -- The path to the python executable, typically C:\PythonXX\python.exe - communicator_py -- The path to the subprocess controller script in the user's vimfiles directory - options -- optional configuration - - """ - self.lines = lines - self.columns = columns - self.bucket = u('') - - # create a shm key - self.shm_key = 'mk' + str(time.time()) - - # python command - cmd_line = '%s "%s" %s %d %d %d %d %s' % (python_exe, communicator_py, self.shm_key, int(self.columns), int(self.lines), int(options['CODE_PAGE']), int(CONQUE_FAST_MODE), cmd) - - - # console window attributes - flags = NORMAL_PRIORITY_CLASS | DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT - si = STARTUPINFO() - pi = PROCESS_INFORMATION() - - # start the stupid process already - try: - res = ctypes.windll.kernel32.CreateProcessW(None, u(cmd_line), None, None, 0, flags, None, u('.'), ctypes.byref(si), ctypes.byref(pi)) - except: - - raise - - # handle - self.pid = pi.dwProcessId - - - - # init shared memory objects - self.init_shared_memory(self.shm_key) - - - def read(self, start_line, num_lines, timeout=0): - """ Read a range of console lines from shared memory. - - Returns a pair of lists containing the console text and console text attributes. - - """ - # emulate timeout by sleeping timeout time - if timeout > 0: - read_timeout = float(timeout) / 1000 - - time.sleep(read_timeout) - - output = [] - attributes = [] - - # get output - for i in range(start_line, start_line + num_lines + 1): - output.append(self.shm_output.read(self.columns, i * self.columns)) - if not CONQUE_FAST_MODE: - attributes.append(self.shm_attributes.read(self.columns, i * self.columns)) - - return (output, attributes) - - - def get_stats(self): - """ Return a dictionary with current console cursor and scrolling information. """ - - try: - rescroll = self.shm_rescroll.read() - if rescroll != '' and rescroll != None: - - - - self.shm_rescroll.clear() - - # close down old memory - self.shm_output.close() - self.shm_output = None - - if not CONQUE_FAST_MODE: - self.shm_attributes.close() - self.shm_attributes = None - - # reallocate memory - - self.shm_output = ConqueSoleSharedMemory(CONQUE_SOLE_BUFFER_LENGTH * self.columns * rescroll['data']['blocks'], 'output', rescroll['data']['mem_key'], True) - self.shm_output.create('read') - - if not CONQUE_FAST_MODE: - self.shm_attributes = ConqueSoleSharedMemory(CONQUE_SOLE_BUFFER_LENGTH * self.columns * rescroll['data']['blocks'], 'attributes', rescroll['data']['mem_key'], True, encoding='latin-1') - self.shm_attributes.create('read') - - stats_str = self.shm_stats.read() - if stats_str != '': - self.stats = stats_str - else: - return False - except: - - return False - - return self.stats - - - def is_alive(self): - """ Get process status. """ - - if not self.shm_stats: - return True - - stats_str = self.shm_stats.read() - if stats_str: - return (stats_str['is_alive']) - else: - return True - - - def write(self, text): - """ Write input to shared memory. """ - - self.bucket += text - - istr = self.shm_input.read() - - if istr == '': - - self.shm_input.write(self.bucket[:500]) - self.bucket = self.bucket[500:] - - - def write_vk(self, vk_code): - """ Write virtual key code to shared memory using proprietary escape sequences. """ - - seq = u("\x1b[") + u(str(vk_code)) + u("VK") - self.write(seq) - - - def idle(self): - """ Write idle command to shared memory block, so subprocess controller can hibernate. """ - - - self.shm_command.write({'cmd': 'idle', 'data': {}}) - - - def resume(self): - """ Write resume command to shared memory block, so subprocess controller can wake up. """ - - self.shm_command.write({'cmd': 'resume', 'data': {}}) - - - def close(self): - """ Shut it all down. """ - - self.shm_command.write({'cmd': 'close', 'data': {}}) - time.sleep(0.2) - - - def window_resize(self, lines, columns): - """ Resize console window. """ - - self.lines = lines - - # we don't shrink buffer width - if columns > self.columns: - self.columns = columns - - self.shm_resize.write({'cmd': 'resize', 'data': {'width': columns, 'height': lines}}) - - - def init_shared_memory(self, mem_key): - """ Create shared memory objects. """ - - self.shm_input = ConqueSoleSharedMemory(CONQUE_SOLE_INPUT_SIZE, 'input', mem_key) - self.shm_input.create('write') - self.shm_input.clear() - - self.shm_output = ConqueSoleSharedMemory(CONQUE_SOLE_BUFFER_LENGTH * self.columns, 'output', mem_key, True) - self.shm_output.create('write') - - if not CONQUE_FAST_MODE: - self.shm_attributes = ConqueSoleSharedMemory(CONQUE_SOLE_BUFFER_LENGTH * self.columns, 'attributes', mem_key, True, encoding='latin-1') - self.shm_attributes.create('write') - - self.shm_stats = ConqueSoleSharedMemory(CONQUE_SOLE_STATS_SIZE, 'stats', mem_key, serialize=True) - self.shm_stats.create('write') - self.shm_stats.clear() - - self.shm_command = ConqueSoleSharedMemory(CONQUE_SOLE_COMMANDS_SIZE, 'command', mem_key, serialize=True) - self.shm_command.create('write') - self.shm_command.clear() - - self.shm_resize = ConqueSoleSharedMemory(CONQUE_SOLE_RESIZE_SIZE, 'resize', mem_key, serialize=True) - self.shm_resize.create('write') - self.shm_resize.clear() - - self.shm_rescroll = ConqueSoleSharedMemory(CONQUE_SOLE_RESCROLL_SIZE, 'rescroll', mem_key, serialize=True) - self.shm_rescroll.create('write') - self.shm_rescroll.clear() - - return True - - -# vim:foldmethod=marker diff --git a/vim/autoload/conque_term/conque_subprocess.py b/vim/autoload/conque_term/conque_subprocess.py deleted file mode 100644 index 87d93c3..0000000 --- a/vim/autoload/conque_term/conque_subprocess.py +++ /dev/null @@ -1,198 +0,0 @@ -# FILE: autoload/conque_term/conque_subprocess.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" -ConqueSubprocess - -Create and interact with a subprocess through a pty. - -Usage: - - p = ConqueSubprocess() - p.open('bash', {'TERM':'vt100'}) - output = p.read() - p.write('cd ~/vim' + "\r") - p.write('ls -lha' + "\r") - output += p.read(timeout = 500) - p.close() -""" - -import os -import signal -import pty -import tty -import select -import fcntl -import termios -import struct -import shlex - - -class ConqueSubprocess: - - # process id - pid = 0 - - # stdout+stderr file descriptor - fd = None - - - def open(self, command, env={}): - """ Create subprocess using forkpty() """ - - # parse command - command_arr = shlex.split(command) - executable = command_arr[0] - args = command_arr - - # try to fork a new pty - try: - self.pid, self.fd = pty.fork() - - except: - - return False - - # child proc, replace with command after altering terminal attributes - if self.pid == 0: - - # set requested environment variables - for k in env.keys(): - os.environ[k] = env[k] - - # set tty attributes - try: - attrs = tty.tcgetattr(1) - attrs[0] = attrs[0] ^ tty.IGNBRK - attrs[0] = attrs[0] | tty.BRKINT | tty.IXANY | tty.IMAXBEL - attrs[2] = attrs[2] | tty.HUPCL - attrs[3] = attrs[3] | tty.ICANON | tty.ECHO | tty.ISIG | tty.ECHOKE - attrs[6][tty.VMIN] = 1 - attrs[6][tty.VTIME] = 0 - tty.tcsetattr(1, tty.TCSANOW, attrs) - except: - - pass - - # replace this process with the subprocess - os.execvp(executable, args) - - # else master, do nothing - else: - pass - - - def read(self, timeout=1): - """ Read from subprocess and return new output """ - - output = '' - read_timeout = float(timeout) / 1000 - read_ct = 0 - - try: - # read from fd until no more output - while 1: - s_read, s_write, s_error = select.select([self.fd], [], [], read_timeout) - - lines = '' - for s_fd in s_read: - try: - # increase read buffer so huge reads don't slow down - if read_ct < 10: - lines = os.read(self.fd, 32) - elif read_ct < 50: - lines = os.read(self.fd, 512) - else: - lines = os.read(self.fd, 2048) - read_ct += 1 - except: - pass - output = output + lines.decode('utf-8') - - if lines == '' or read_ct > 100: - break - except: - - pass - - return output - - - def write(self, input): - """ Write new input to subprocess """ - - try: - if CONQUE_PYTHON_VERSION == 2: - os.write(self.fd, input.encode('utf-8', 'ignore')) - else: - os.write(self.fd, bytes(input, 'utf-8')) - except: - - pass - - - def signal(self, signum): - """ signal process """ - - try: - os.kill(self.pid, signum) - except: - pass - - - def close(self): - """ close process with sigterm signal """ - - self.signal(15) - - - def is_alive(self): - """ get process status """ - - p_status = True - try: - if os.waitpid(self.pid, os.WNOHANG)[0]: - p_status = False - except: - p_status = False - - return p_status - - - def window_resize(self, lines, columns): - """ update window size in kernel, then send SIGWINCH to fg process """ - - try: - fcntl.ioctl(self.fd, termios.TIOCSWINSZ, struct.pack("HHHH", lines, columns, 0, 0)) - os.kill(self.pid, signal.SIGWINCH) - except: - pass - - -# vim:foldmethod=marker diff --git a/vim/autoload/conque_term/conque_win32_util.py b/vim/autoload/conque_term/conque_win32_util.py deleted file mode 100644 index 6ae7652..0000000 --- a/vim/autoload/conque_term/conque_win32_util.py +++ /dev/null @@ -1,448 +0,0 @@ -# FILE: autoload/conque_term/conque_win32_util.py -# AUTHOR: Nico Raffo -# WEBSITE: http://conque.googlecode.com -# MODIFIED: 2011-08-12 -# VERSION: 2.2, for Vim 7.0 -# LICENSE: -# Conque - Vim terminal/console emulator -# Copyright (C) 2009-__YEAR__ Nico Raffo -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -""" Python constants and structures used for ctypes interaction. """ - -from ctypes import * - -# Constants - -# create process flag constants - -CREATE_BREAKAWAY_FROM_JOB = 0x01000000 -CREATE_DEFAULT_ERROR_MODE = 0x04000000 -CREATE_NEW_CONSOLE = 0x00000010 -CREATE_NEW_PROCESS_GROUP = 0x00000200 -CREATE_NO_WINDOW = 0x08000000 -CREATE_PROTECTED_PROCESS = 0x00040000 -CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 -CREATE_SEPARATE_WOW_VDM = 0x00000800 -CREATE_SHARED_WOW_VDM = 0x00001000 -CREATE_SUSPENDED = 0x00000004 -CREATE_UNICODE_ENVIRONMENT = 0x00000400 -DEBUG_ONLY_THIS_PROCESS = 0x00000002 -DEBUG_PROCESS = 0x00000001 -DETACHED_PROCESS = 0x00000008 -EXTENDED_STARTUPINFO_PRESENT = 0x00080000 -INHERIT_PARENT_AFFINITY = 0x00010000 - - -# process priority constants - -ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 -BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 -HIGH_PRIORITY_CLASS = 0x00000080 -IDLE_PRIORITY_CLASS = 0x00000040 -NORMAL_PRIORITY_CLASS = 0x00000020 -REALTIME_PRIORITY_CLASS = 0x00000100 - - -# startup info constants - -STARTF_FORCEONFEEDBACK = 0x00000040 -STARTF_FORCEOFFFEEDBACK = 0x00000080 -STARTF_PREVENTPINNING = 0x00002000 -STARTF_RUNFULLSCREEN = 0x00000020 -STARTF_TITLEISAPPID = 0x00001000 -STARTF_TITLEISLINKNAME = 0x00000800 -STARTF_USECOUNTCHARS = 0x00000008 -STARTF_USEFILLATTRIBUTE = 0x00000010 -STARTF_USEHOTKEY = 0x00000200 -STARTF_USEPOSITION = 0x00000004 -STARTF_USESHOWWINDOW = 0x00000001 -STARTF_USESIZE = 0x00000002 -STARTF_USESTDHANDLES = 0x00000100 - - -# show window constants - -SW_FORCEMINIMIZE = 11 -SW_HIDE = 0 -SW_MAXIMIZE = 3 -SW_MINIMIZE = 6 -SW_RESTORE = 9 -SW_SHOW = 5 -SW_SHOWDEFAULT = 10 -SW_SHOWMAXIMIZED = 3 -SW_SHOWMINIMIZED = 2 -SW_SHOWMINNOACTIVE = 7 -SW_SHOWNA = 8 -SW_SHOWNOACTIVATE = 4 -SW_SHOWNORMAL = 1 - - -# input event types - -FOCUS_EVENT = 0x0010 -KEY_EVENT = 0x0001 -MENU_EVENT = 0x0008 -MOUSE_EVENT = 0x0002 -WINDOW_BUFFER_SIZE_EVENT = 0x0004 - - -# key event modifiers - -CAPSLOCK_ON = 0x0080 -ENHANCED_KEY = 0x0100 -LEFT_ALT_PRESSED = 0x0002 -LEFT_CTRL_PRESSED = 0x0008 -NUMLOCK_ON = 0x0020 -RIGHT_ALT_PRESSED = 0x0001 -RIGHT_CTRL_PRESSED = 0x0004 -SCROLLLOCK_ON = 0x0040 -SHIFT_PRESSED = 0x0010 - - -# process access - -PROCESS_CREATE_PROCESS = 0x0080 -PROCESS_CREATE_THREAD = 0x0002 -PROCESS_DUP_HANDLE = 0x0040 -PROCESS_QUERY_INFORMATION = 0x0400 -PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 -PROCESS_SET_INFORMATION = 0x0200 -PROCESS_SET_QUOTA = 0x0100 -PROCESS_SUSPEND_RESUME = 0x0800 -PROCESS_TERMINATE = 0x0001 -PROCESS_VM_OPERATION = 0x0008 -PROCESS_VM_READ = 0x0010 -PROCESS_VM_WRITE = 0x0020 - - -# input / output handles - -STD_INPUT_HANDLE = c_ulong(-10) -STD_OUTPUT_HANDLE = c_ulong(-11) -STD_ERROR_HANDLE = c_ulong(-12) - - -CONQUE_WINDOWS_VK = { - 'VK_LBUTTON': 0x0001, - 'VK_RBUTTON': 0x0002, - 'VK_CANCEL': 0x0003, - 'VK_BACK': 0x0008, - 'VK_TAB': 0x0009, - 'VK_CLEAR': 0x000C, - 'VK_RETURN': 0x0D, - 'VK_SHIFT': 0x10, - 'VK_CONTROL': 0x11, - 'VK_MENU': 0x12, - 'VK_PAUSE': 0x0013, - 'VK_CAPITAL': 0x0014, - 'VK_ESCAPE': 0x001B, - 'VK_SPACE': 0x0020, - 'VK_PRIOR': 0x0021, - 'VK_NEXT': 0x0022, - 'VK_END': 0x0023, - 'VK_HOME': 0x0024, - 'VK_LEFT': 0x0025, - 'VK_UP': 0x0026, - 'VK_RIGHT': 0x0027, - 'VK_DOWN': 0x0028, - 'VK_SELECT': 0x0029, - 'VK_PRINT': 0x002A, - 'VK_EXECUTE': 0x002B, - 'VK_SNAPSHOT': 0x002C, - 'VK_INSERT': 0x002D, - 'VK_DELETE': 0x002E, - 'VK_HELP': 0x002F, - 'VK_0': 0x0030, - 'VK_1': 0x0031, - 'VK_2': 0x0032, - 'VK_3': 0x0033, - 'VK_4': 0x0034, - 'VK_5': 0x0035, - 'VK_6': 0x0036, - 'VK_7': 0x0037, - 'VK_8': 0x0038, - 'VK_9': 0x0039, - 'VK_A': 0x0041, - 'VK_B': 0x0042, - 'VK_C': 0x0043, - 'VK_D': 0x0044, - 'VK_E': 0x0045, - 'VK_F': 0x0046, - 'VK_G': 0x0047, - 'VK_H': 0x0048, - 'VK_I': 0x0049, - 'VK_J': 0x004A, - 'VK_K': 0x004B, - 'VK_L': 0x004C, - 'VK_M': 0x004D, - 'VK_N': 0x004E, - 'VK_O': 0x004F, - 'VK_P': 0x0050, - 'VK_Q': 0x0051, - 'VK_R': 0x0052, - 'VK_S': 0x0053, - 'VK_T': 0x0054, - 'VK_U': 0x0055, - 'VK_V': 0x0056, - 'VK_W': 0x0057, - 'VK_X': 0x0058, - 'VK_Y': 0x0059, - 'VK_Z': 0x005A, - 'VK_LWIN': 0x005B, - 'VK_RWIN': 0x005C, - 'VK_APPS': 0x005D, - 'VK_SLEEP': 0x005F, - 'VK_NUMPAD0': 0x0060, - 'VK_NUMPAD1': 0x0061, - 'VK_NUMPAD2': 0x0062, - 'VK_NUMPAD3': 0x0063, - 'VK_NUMPAD4': 0x0064, - 'VK_NUMPAD5': 0x0065, - 'VK_NUMPAD6': 0x0066, - 'VK_NUMPAD7': 0x0067, - 'VK_NUMPAD8': 0x0068, - 'VK_MULTIPLY': 0x006A, - 'VK_ADD': 0x006B, - 'VK_SEPARATOR': 0x006C, - 'VK_SUBTRACT': 0x006D, - 'VK_DECIMAL': 0x006E, - 'VK_DIVIDE': 0x006F, - 'VK_F1': 0x0070, - 'VK_F2': 0x0071, - 'VK_F3': 0x0072, - 'VK_F4': 0x0073, - 'VK_F5': 0x0074, - 'VK_F6': 0x0075, - 'VK_F7': 0x0076, - 'VK_F8': 0x0077, - 'VK_F9': 0x0078, - 'VK_F10': 0x0079, - 'VK_F11': 0x007A, - 'VK_F12': 0x007B, - 'VK_F13': 0x007C, - 'VK_F14': 0x007D, - 'VK_F15': 0x007E, - 'VK_F16': 0x007F, - 'VK_F17': 0x0080, - 'VK_F18': 0x0081, - 'VK_F19': 0x0082, - 'VK_F20': 0x0083, - 'VK_F21': 0x0084, - 'VK_F22': 0x0085, - 'VK_F23': 0x0086, - 'VK_F24': 0x0087, - 'VK_NUMLOCK': 0x0090, - 'VK_SCROLL': 0x0091, - 'VK_LSHIFT': 0x00A0, - 'VK_RSHIFT': 0x00A1, - 'VK_LCONTROL': 0x00A2, - 'VK_RCONTROL': 0x00A3, - 'VK_LMENU': 0x00A4, - 'VK_RMENU': 0x00A5 -} - -CONQUE_WINDOWS_VK_INV = dict([v, k] for k, v in CONQUE_WINDOWS_VK.items()) - -CONQUE_WINDOWS_VK_ENHANCED = { - str(int(CONQUE_WINDOWS_VK['VK_UP'])): 1, - str(int(CONQUE_WINDOWS_VK['VK_DOWN'])): 1, - str(int(CONQUE_WINDOWS_VK['VK_LEFT'])): 1, - str(int(CONQUE_WINDOWS_VK['VK_RIGHT'])): 1, - str(int(CONQUE_WINDOWS_VK['VK_HOME'])): 1, - str(int(CONQUE_WINDOWS_VK['VK_END'])): 1 -} - - -# structures used for CreateProcess - -# Odd types - -LPBYTE = POINTER(c_ubyte) -LPTSTR = POINTER(c_char) - - -class STARTUPINFO(Structure): - _fields_ = [("cb", c_ulong), - ("lpReserved", LPTSTR), - ("lpDesktop", LPTSTR), - ("lpTitle", LPTSTR), - ("dwX", c_ulong), - ("dwY", c_ulong), - ("dwXSize", c_ulong), - ("dwYSize", c_ulong), - ("dwXCountChars", c_ulong), - ("dwYCountChars", c_ulong), - ("dwFillAttribute", c_ulong), - ("dwFlags", c_ulong), - ("wShowWindow", c_short), - ("cbReserved2", c_short), - ("lpReserved2", LPBYTE), - ("hStdInput", c_void_p), - ("hStdOutput", c_void_p), - ("hStdError", c_void_p),] - - def to_str(self): - return '' - - -class PROCESS_INFORMATION(Structure): - _fields_ = [("hProcess", c_void_p), - ("hThread", c_void_p), - ("dwProcessId", c_ulong), - ("dwThreadId", c_ulong),] - - def to_str(self): - return '' - - -class MEMORY_BASIC_INFORMATION(Structure): - _fields_ = [("BaseAddress", c_void_p), - ("AllocationBase", c_void_p), - ("AllocationProtect", c_ulong), - ("RegionSize", c_ulong), - ("State", c_ulong), - ("Protect", c_ulong), - ("Type", c_ulong),] - - def to_str(self): - return '' - - -class SECURITY_ATTRIBUTES(Structure): - _fields_ = [("Length", c_ulong), - ("SecDescriptor", c_void_p), - ("InheritHandle", c_bool)] - - def to_str(self): - return '' - - -class COORD(Structure): - _fields_ = [("X", c_short), - ("Y", c_short)] - - def to_str(self): - return '' - - -class SMALL_RECT(Structure): - _fields_ = [("Left", c_short), - ("Top", c_short), - ("Right", c_short), - ("Bottom", c_short)] - - def to_str(self): - return '' - - -class CONSOLE_SCREEN_BUFFER_INFO(Structure): - _fields_ = [("dwSize", COORD), - ("dwCursorPosition", COORD), - ("wAttributes", c_short), - ("srWindow", SMALL_RECT), - ("dwMaximumWindowSize", COORD)] - - def to_str(self): - return '' - - -class CHAR_UNION(Union): - _fields_ = [("UnicodeChar", c_wchar), - ("AsciiChar", c_char)] - - def to_str(self): - return '' - - -class CHAR_INFO(Structure): - _fields_ = [("Char", CHAR_UNION), - ("Attributes", c_short)] - - def to_str(self): - return '' - - -class KEY_EVENT_RECORD(Structure): - _fields_ = [("bKeyDown", c_byte), - ("pad2", c_byte), - ('pad1', c_short), - ("wRepeatCount", c_short), - ("wVirtualKeyCode", c_short), - ("wVirtualScanCode", c_short), - ("uChar", CHAR_UNION), - ("dwControlKeyState", c_int)] - - def to_str(self): - return '' - - -class MOUSE_EVENT_RECORD(Structure): - _fields_ = [("dwMousePosition", COORD), - ("dwButtonState", c_int), - ("dwControlKeyState", c_int), - ("dwEventFlags", c_int)] - - def to_str(self): - return '' - - -class WINDOW_BUFFER_SIZE_RECORD(Structure): - _fields_ = [("dwSize", COORD)] - - def to_str(self): - return '' - - -class MENU_EVENT_RECORD(Structure): - _fields_ = [("dwCommandId", c_uint)] - - def to_str(self): - return '' - - -class FOCUS_EVENT_RECORD(Structure): - _fields_ = [("bSetFocus", c_byte)] - - def to_str(self): - return '' - - -class INPUT_UNION(Union): - _fields_ = [("KeyEvent", KEY_EVENT_RECORD), - ("MouseEvent", MOUSE_EVENT_RECORD), - ("WindowBufferSizeEvent", WINDOW_BUFFER_SIZE_RECORD), - ("MenuEvent", MENU_EVENT_RECORD), - ("FocusEvent", FOCUS_EVENT_RECORD)] - - def to_str(self): - return '' - - -class INPUT_RECORD(Structure): - _fields_ = [("EventType", c_short), - ("Event", INPUT_UNION)] - - def to_str(self): - return '' - - diff --git a/vim/autoload/getscript.vim b/vim/autoload/getscript.vim deleted file mode 100644 index 9e2a196..0000000 --- a/vim/autoload/getscript.vim +++ /dev/null @@ -1,650 +0,0 @@ -" --------------------------------------------------------------------- -" getscript.vim -" Author: Charles E. Campbell, Jr. -" Date: May 31, 2011 -" Version: 33 -" Installing: :help glvs-install -" Usage: :help glvs -" -" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim -"redraw!|call inputsave()|call input("Press to continue")|call inputrestore() -" --------------------------------------------------------------------- -" Initialization: {{{1 -" if you're sourcing this file, surely you can't be -" expecting vim to be in its vi-compatible mode! -if exists("g:loaded_getscript") - finish -endif -let g:loaded_getscript= "v33" -if &cp - echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" - finish -endif -if v:version < 702 - echohl WarningMsg - echo "***warning*** this version of getscript needs vim 7.2" - echohl Normal - finish -endif -let s:keepcpo = &cpo -set cpo&vim -"DechoTabOn - -" --------------------------- -" Global Variables: {{{1 -" --------------------------- -" Cygwin Detection ------- {{{2 -if !exists("g:getscript_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' - let g:getscript_cygwin= 1 - else - let g:getscript_cygwin= 0 - endif - else - let g:getscript_cygwin= 0 - endif -endif - -" wget vs curl {{{2 -if !exists("g:GetLatestVimScripts_wget") - if executable("wget") - let g:GetLatestVimScripts_wget= "wget" - elseif executable("curl") - let g:GetLatestVimScripts_wget= "curl" - else - let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"' - let g:GetLatestVimScripts_options = "" - endif -endif - -" options that wget and curl require: -if !exists("g:GetLatestVimScripts_options") - if g:GetLatestVimScripts_wget == "wget" - let g:GetLatestVimScripts_options= "-q -O" - elseif g:GetLatestVimScripts_wget == "curl" - let g:GetLatestVimScripts_options= "-s -O" - else - let g:GetLatestVimScripts_options= "" - endif -endif - -" by default, allow autoinstall lines to work -if !exists("g:GetLatestVimScripts_allowautoinstall") - let g:GetLatestVimScripts_allowautoinstall= 1 -endif - -"" For debugging: -"let g:GetLatestVimScripts_wget = "echo" -"let g:GetLatestVimScripts_options = "options" - -" --------------------------------------------------------------------- -" Check If AutoInstall Capable: {{{1 -let s:autoinstall= "" -if g:GetLatestVimScripts_allowautoinstall - - if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" - " windows (but not cygwin/bash) - let s:dotvim= "vimfiles" - if !exists("g:GetLatestVimScripts_mv") - let g:GetLatestVimScripts_mv= "ren" - endif - - else - " unix - let s:dotvim= ".vim" - if !exists("g:GetLatestVimScripts_mv") - let g:GetLatestVimScripts_mv= "mv" - endif - endif - - if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir) - let s:autoinstall= g:GetLatestVimScripts_autoinstalldir" - elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) - let s:autoinstall= $HOME."/".s:dotvim - endif -" call Decho("s:autoinstall<".s:autoinstall.">") -"else "Decho -" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled") -endif - -" --------------------------------------------------------------------- -" Public Interface: {{{1 -com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() -com! -nargs=0 GetScript call getscript#GetLatestVimScripts() -silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts() - -" --------------------------------------------------------------------- -" GetLatestVimScripts: this function gets the latest versions of {{{1 -" scripts based on the list in -" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat -fun! getscript#GetLatestVimScripts() -" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">") - -" insure that wget is executable - if executable(g:GetLatestVimScripts_wget) != 1 - echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system" -" call Dret("GetLatestVimScripts : wget not executable/availble") - return - endif - - " insure that fnameescape() is available - if !exists("*fnameescape") - echoerr "GetLatestVimScripts needs fnameescape() (provided by 7.1.299 or later)" - return - endif - - " Find the .../GetLatest subdirectory under the runtimepath - for datadir in split(&rtp,',') + [''] - if isdirectory(datadir."/GetLatest") -" call Decho("found directory<".datadir.">") - let datadir= datadir . "/GetLatest" - break - endif - if filereadable(datadir."GetLatestVimScripts.dat") -" call Decho("found ".datadir."/GetLatestVimScripts.dat") - break - endif - endfor - - " Sanity checks: readability and writability - if datadir == "" - echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install' -" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory") - return - endif - if filewritable(datadir) != 2 - echoerr "(getLatestVimScripts) Your ".datadir." isn't writable" -" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">") - return - endif - let datafile= datadir."/GetLatestVimScripts.dat" - if !filereadable(datafile) - echoerr "Your data file<".datafile."> isn't readable" -" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">") - return - endif - if !filewritable(datafile) - echoerr "Your data file<".datafile."> isn't writable" -" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") - return - endif - " -------------------- - " Passed sanity checks - " -------------------- - -" call Decho("datadir <".datadir.">") -" call Decho("datafile <".datafile.">") - - " don't let any event handlers interfere (like winmanager's, taglist's, etc) - let eikeep = &ei - let hlskeep = &hls - let acdkeep = &acd - set ei=all hls&vim noacd - - " Edit the datafile (ie. GetLatestVimScripts.dat): - " 1. record current directory (origdir), - " 2. change directory to datadir, - " 3. split window - " 4. edit datafile - let origdir= getcwd() -" call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge'))) - exe "cd ".fnameescape(substitute(datadir,'\','/','ge')) - split -" call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge'))) - exe "e ".fnameescape(substitute(datafile,'\','/','ge')) - res 1000 - let s:downloads = 0 - let s:downerrors= 0 - - " Check on dependencies mentioned in plugins -" call Decho(" ") -" call Decho("searching plugins for GetLatestVimScripts dependencies") - let lastline = line("$") -" call Decho("lastline#".lastline) - let firstdir = substitute(&rtp,',.*$','','') - let plugins = split(globpath(firstdir,"plugin/*.vim"),'\n') - let plugins = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n') - let foundscript = 0 - - " this loop updates the GetLatestVimScripts.dat file - " with dependencies explicitly mentioned in the plugins - " via GetLatestVimScripts: ... lines - " It reads the plugin script at the end of the GetLatestVimScripts.dat - " file, examines it, and then removes it. - for plugin in plugins -" call Decho(" ") -" call Decho("plugin<".plugin.">") - - " read plugin in - " evidently a :r creates a new buffer (the "#" buffer) that is subsequently unused -- bwiping it - $ -" call Decho(".dependency checking<".plugin."> line$=".line("$")) -" call Decho("..exe silent r ".fnameescape(plugin)) - exe "silent r ".fnameescape(plugin) - exe "silent bwipe ".bufnr("#") - - while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0 - let depscript = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') - let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','') - let llp1 = lastline+1 -" call Decho("..depscript<".depscript.">") - - " found a "GetLatestVimScripts: # #" line in the script; - " check if its already in the datafile by searching backwards from llp1, - " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file, - " for the script-id with no wrapping allowed. - let curline = line(".") - let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e') - exe llp1 - let srchline = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW') - if srchline == 0 - " this second search is taken when, for example, a 0 0 scriptname is to be skipped over - let srchline= search('\<'.noai_script.'\>','bW') - endif -" call Decho("..noai_script<".noai_script."> depscriptid#".depscriptid." srchline#".srchline." curline#".line(".")." lastline#".lastline) - - if srchline == 0 - " found a new script to permanently include in the datafile - let keep_rega = @a - let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','') - echomsg "Appending <".@a."> to ".datafile." for ".depscript -" call Decho("..Appending <".@a."> to ".datafile." for ".depscript) - exe lastline."put a" - let @a = keep_rega - let lastline = llp1 - let curline = curline + 1 - let foundscript = foundscript + 1 -" else " Decho -" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")") - endif - - let curline = curline + 1 - exe curline - endwhile - - " llp1: last line plus one - let llp1= lastline + 1 -" call Decho(".deleting lines: ".llp1.",$d") - exe "silent! ".llp1.",$d" - endfor -" call Decho("--- end dependency checking loop --- foundscript=".foundscript) -" call Decho(" ") -" call Dredir("BUFFER TEST (GetLatestVimScripts 1)","ls!") - - if foundscript == 0 - setlocal nomod - endif - - " -------------------------------------------------------------------- - " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat - " -------------------------------------------------------------------- -" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">") - setlocal lz - 1 -" /^-----/,$g/^\s*\d/call Decho(getline(".")) - 1 - /^-----/,$g/^\s*\d/call s:GetOneScript() -" call Decho("--- end out-of-date checking --- ") - - " Final report (an echomsg) - try - silent! ?^-------? - catch /^Vim\%((\a\+)\)\=:E114/ -" call Dret("GetLatestVimScripts : nothing done!") - return - endtry - exe "norm! kz\" - redraw! - let s:msg = "" - if s:downloads == 1 - let s:msg = "Downloaded one updated script to <".datadir.">" - elseif s:downloads == 2 - let s:msg= "Downloaded two updated scripts to <".datadir.">" - elseif s:downloads > 1 - let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">" - else - let s:msg= "Everything was already current" - endif - if s:downerrors > 0 - let s:msg= s:msg." (".s:downerrors." downloading errors)" - endif - echomsg s:msg - " save the file - if &mod - silent! w! - endif - q - - " restore events and current directory - exe "cd ".fnameescape(substitute(origdir,'\','/','ge')) - let &ei = eikeep - let &hls = hlskeep - let &acd = acdkeep - setlocal nolz -" call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!") -" call Dret("GetLatestVimScripts : did ".s:downloads." downloads") -endfun - -" --------------------------------------------------------------------- -" GetOneScript: (Get Latest Vim Script) this function operates {{{1 -" on the current line, interpreting two numbers and text as -" ScriptID, SourceID, and Filename. -" It downloads any scripts that have newer versions from vim.sourceforge.net. -fun! s:GetOneScript(...) -" call Dfunc("GetOneScript()") - - " set options to allow progress to be shown on screen - let rega= @a - let t_ti= &t_ti - let t_te= &t_te - let rs = &rs - set t_ti= t_te= nors - - " put current line on top-of-screen and interpret it into - " a script identifer : used to obtain webpage - " source identifier : used to identify current version - " and an associated comment: used to report on what's being considered - if a:0 >= 3 - let scriptid = a:1 - let srcid = a:2 - let fname = a:3 - let cmmnt = "" -" call Decho("scriptid<".scriptid.">") -" call Decho("srcid <".srcid.">") -" call Decho("fname <".fname.">") - else - let curline = getline(".") - if curline =~ '^\s*#' - let @a= rega -" call Dret("GetOneScript : skipping a pure comment line") - return - endif - let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$' - try - let scriptid = substitute(curline,parsepat,'\1','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let scriptid= 0 - endtry - try - let srcid = substitute(curline,parsepat,'\2','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let srcid= 0 - endtry - try - let fname= substitute(curline,parsepat,'\3','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let fname= "" - endtry - try - let cmmnt= substitute(curline,parsepat,'\4','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let cmmnt= "" - endtry -" call Decho("curline <".curline.">") -" call Decho("parsepat<".parsepat.">") -" call Decho("scriptid<".scriptid.">") -" call Decho("srcid <".srcid.">") -" call Decho("fname <".fname.">") - endif - - " plugin author protection from downloading his/her own scripts atop their latest work - if scriptid == 0 || srcid == 0 - " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname - let @a= rega -" call Dret("GetOneScript : skipping a scriptid==srcid==0 line") - return - endif - - let doautoinstall= 0 - if fname =~ ":AutoInstall:" -" call Decho("case AutoInstall: fname<".fname.">") - let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','') -" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall) - if s:autoinstall != "" - let doautoinstall = g:GetLatestVimScripts_allowautoinstall - endif - else - let aicmmnt= fname - endif -" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall) - - exe "norm z\" - redraw! -" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) - echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid - - " grab a copy of the plugin's vim.sourceforge.net webpage - let scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='.scriptid - let tmpfile = tempname() - let v:errmsg = "" - - " make up to three tries at downloading the description - let itry= 1 - while itry <= 3 -" call Decho(".try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr) - if has("win32") || has("win16") || has("win95") -" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)."|bw!") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)|bw! - else -" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr) - endif - if itry == 1 - exe "silent vsplit ".fnameescape(tmpfile) - else - silent! e % - endif - setlocal bh=wipe - - " find the latest source-id in the plugin's webpage - silent! 1 - let findpkg= search('Click on the package to download','W') - if findpkg > 0 - break - endif - let itry= itry + 1 - endwhile -" call Decho(" --- end downloading tries while loop --- itry=".itry) - - " testing: did finding "Click on the package..." fail? - if findpkg == 0 || itry >= 4 - silent q! - call delete(tmpfile) - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let s:downerrors = s:downerrors + 1 -" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">") - echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">" -" call Dret("GetOneScript : srch for /Click on the package/ failed") - let @a= rega - return - endif -" call Decho('found "Click on the package to download"') - - let findsrcid= search('src_id=','W') - if findsrcid == 0 - silent q! - call delete(tmpfile) - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let s:downerrors = s:downerrors + 1 -" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">") - echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">" - let @a= rega -" call Dret("GetOneScript : srch for /src_id/ failed") - return - endif -" call Decho('found "src_id=" in description page') - - let srcidpat = '^\s*\([^<]\+\)<.*$' - let latestsrcid= substitute(getline("."),srcidpat,'\1','') - let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded -" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">") - silent q! - call delete(tmpfile) - - " convert the strings-of-numbers into numbers - let srcid = srcid + 0 - let latestsrcid = latestsrcid + 0 -" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">") - - " has the plugin's most-recent srcid increased, which indicates that it has been updated - if latestsrcid > srcid -" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">") - - let s:downloads= s:downloads + 1 - if sname == bufname("%") - " GetLatestVimScript has to be careful about downloading itself - let sname= "NEW_".sname - endif - - " ----------------------------------------------------------------------------- - " the plugin has been updated since we last obtained it, so download a new copy - " ----------------------------------------------------------------------------- -" call Decho(".downloading new <".sname.">") - echomsg ".downloading new <".sname.">" - if has("win32") || has("win16") || has("win95") -" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q - else -" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=')) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid - endif - - " -------------------------------------------------------------------------- - " AutoInstall: only if doautoinstall has been requested by the plugin itself - " -------------------------------------------------------------------------- -" call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall) - if doautoinstall -" call Decho(" ") -" call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname)) - if filereadable(sname) -" call Decho("<".sname."> is readable") -" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)) - exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall) - let curdir = fnameescape(substitute(getcwd(),'\','/','ge')) - let installdir= curdir."/Installed" - if !isdirectory(installdir) - call mkdir(installdir) - endif -" call Decho("curdir<".curdir."> installdir<".installdir.">") -" call Decho("exe cd ".fnameescape(s:autoinstall)) - exe "cd ".fnameescape(s:autoinstall) - - " determine target directory for moves - let firstdir= substitute(&rtp,',.*$','','') - let pname = substitute(sname,'\..*','.vim','') -" call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?") - if filereadable(firstdir.'/AsNeeded/'.pname) - let tgtdir= "AsNeeded" - else - let tgtdir= "plugin" - endif -" call Decho("tgtdir<".tgtdir."> pname<".pname.">") - - " decompress - if sname =~ '\.bz2$' -" call Decho("decompress: attempt to bunzip2 ".sname) - exe "silent !bunzip2 ".shellescape(sname) - let sname= substitute(sname,'\.bz2$','','') -" call Decho("decompress: new sname<".sname."> after bunzip2") - elseif sname =~ '\.gz$' -" call Decho("decompress: attempt to gunzip ".sname) - exe "silent !gunzip ".shellescape(sname) - let sname= substitute(sname,'\.gz$','','') -" call Decho("decompress: new sname<".sname."> after gunzip") - elseif sname =~ '\.xz$' -" call Decho("decompress: attempt to unxz ".sname) - exe "silent !unxz ".shellescape(sname) - let sname= substitute(sname,'\.xz$','','') -" call Decho("decompress: new sname<".sname."> after unxz") - else -" call Decho("no decompression needed") - endif - - " distribute archive(.zip, .tar, .vba) contents - if sname =~ '\.zip$' -" call Decho("dearchive: attempt to unzip ".sname) - exe "silent !unzip -o ".shellescape(sname) - elseif sname =~ '\.tar$' -" call Decho("dearchive: attempt to untar ".sname) - exe "silent !tar -xvf ".shellescape(sname) - elseif sname =~ '\.vba$' -" call Decho("dearchive: attempt to handle a vimball: ".sname) - silent 1split - if exists("g:vimball_home") - let oldvimballhome= g:vimball_home - endif - let g:vimball_home= s:autoinstall - exe "silent e ".fnameescape(sname) - silent so % - silent q - if exists("oldvimballhome") - let g:vimball_home= oldvimballhome - else - unlet g:vimball_home - endif - else -" call Decho("no dearchiving needed") - endif - - " --------------------------------------------- - " move plugin to plugin/ or AsNeeded/ directory - " --------------------------------------------- - if sname =~ '.vim$' -" call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir) - exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir - else -" call Decho("dearchive: move <".sname."> to installdir<".installdir.">") - exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir - endif - if tgtdir != "plugin" -" call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir) - exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir - endif - - " helptags step - let docdir= substitute(&rtp,',.*','','e')."/doc" -" call Decho("helptags: docdir<".docdir.">") - exe "helptags ".fnameescape(docdir) - exe "cd ".fnameescape(curdir) - endif - if fname !~ ':AutoInstall:' - let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt - else - let modline=scriptid." ".latestsrcid." ".fname.cmmnt - endif - else - let modline=scriptid." ".latestsrcid." ".fname.cmmnt - endif - - " update the data in the file - call setline(line("."),modline) -" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">") -" else " Decho -" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update") - endif - - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let @a = rega -" call Dredir("BUFFER TEST (GetOneScript)","ls!") - -" call Dret("GetOneScript") -endfun - -" --------------------------------------------------------------------- -" Restore Options: {{{1 -let &cpo= s:keepcpo -unlet s:keepcpo - -" --------------------------------------------------------------------- -" Modelines: {{{1 -" vim: ts=8 sts=2 fdm=marker nowrap diff --git a/vim/autoload/textformat.vim b/vim/autoload/textformat.vim deleted file mode 100644 index 67d9335..0000000 --- a/vim/autoload/textformat.vim +++ /dev/null @@ -1,610 +0,0 @@ -" Text formatter plugin for Vim text editor -" -" Version: 2.1 -" Last Change: 2008-09-13 -" Maintainer: Teemu Likonen -" License: This file is placed in the public domain. -" GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat - -"{{{1 The beginning stuff -if &compatible - finish -endif -let s:save_cpo = &cpo -set cpo&vim - -" Constant variables(s) {{{1 -let s:default_width = 80 - -function! s:Align_Range_Left(...) range "{{{1 - " The optional parameter is the left indent. If it is not given we - " detect the indent used in the buffer. - if a:0 && a:1 >= 0 - " The parameter was given so we just use that as the left - " indent. - let l:leading_ws = s:Retab_Indent(a:1) - for l:line in range(a:firstline,a:lastline) - let l:line_string = getline(l:line) - let l:line_replace = s:Align_String_Left(l:line_string) - if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' - " Preserve trailing whitespace because fo=~w - let l:line_replace .= ' ' - endif - if l:line_replace =~ '\m^\s*$' - call setline(l:line,'') - else - call setline(l:line,l:leading_ws.l:line_replace) - endif - endfor - else - " The parameter was not given so we detect each paragraph's - " indent. - let l:line = a:firstline - while l:line <= a:lastline - let l:line_string = getline(l:line) - if l:line_string =~ '\m^\s*$' - " The line is empty or contains only - " whitespaces so print empty line and - " continue. - call setline(l:line,'') - let l:line += 1 - continue - endif - - " Paragraph (or the whole line range) begins here so - " get the indent of the first line and print the line. - let l:leading_ws = s:Retab_Indent(indent(l:line)) - let l:line_replace = s:Align_String_Left(l:line_string) - if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' - let l:line_replace .= ' ' - endif - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - - " If fo=~w, does the paragraph end here? If yes, - " continue to next round and find a new first line. - if &formatoptions =~ 'w' && l:line_string =~ '\m\S$' - continue - endif - - " If fo=~2 get the indent of the second line - if &formatoptions =~ '2' - let l:leading_ws = s:Retab_Indent(indent(l:line)) - endif - - " This loop will go through all the lines in the - " paragraph (or till the a:lastline) - starting from - " the second line. - while l:line <= a:lastline && getline(l:line) !~ '\m^\s*$' - let l:line_string = getline(l:line) - let l:line_replace = s:Align_String_Left(l:line_string) - if &formatoptions =~ 'w' - if l:line_string =~ '\m\s$' - call setline(l:line,l:leading_ws.l:line_replace.' ') - let l:line += 1 - continue - else - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - " fo=~w and paragraph ends - " here so we break the loop. - " The next line is new first - " line. - break - endif - else - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - endif - endwhile - endwhile - endif -endfunction - -function! s:Align_Range_Right(width) "{{{1 - let l:line_replace = s:Align_String_Right(getline('.'),a:width) - if &formatoptions =~ 'w' && getline('.') =~ '\m\s$' - let l:line_replace .= ' ' - endif - if l:line_replace =~ '\m^\s*$' - " If line would be full of spaces just print empty line. - call setline(line('.'),'') - else - " Retab leading whitespaces - let l:leading_ws = s:Retab_Indent(strlen(substitute(l:line_replace,'\v^( *).*$','\1',''))) - " Get the rest of the line - let l:line_replace = substitute(l:line_replace,'^ *','','') - call setline(line('.'),l:leading_ws.l:line_replace) - endif -endfunction - -function! s:Align_Range_Justify(width, ...) range "{{{1 - " If the optional second argument is given (and is non-zero) each - " paragraph's last line and range's last line is left-aligned. - if a:0 && a:1 - let l:paragraph = 1 - else - let l:paragraph = 0 - endif - let l:line = a:firstline - while l:line <= a:lastline - let l:line_string = getline(l:line) - if l:line_string =~ '\m^\s*$' - " The line is empty or contains only - " whitespaces so print empty line and - " continue. - call setline(l:line,'') - let l:line += 1 - continue - endif - - " Paragraph (or the whole line range) begins here so - " get the indent of the first line and print the line. - let l:indent = indent(l:line) - let l:width = a:width - l:indent - let l:leading_ws = s:Retab_Indent(l:indent) - - if l:paragraph && (l:line == a:lastline || getline(l:line+1) =~ '\m^\s*$' || (&formatoptions =~ 'w' && l:line_string =~ '\m\S$')) - let l:line_replace = s:Align_String_Left(l:line_string) - else - let l:line_replace = s:Align_String_Justify(l:line_string,l:width) - endif - if &formatoptions =~ 'w' && l:line_string =~ '\m\s$' - let l:line_replace .= ' ' - endif - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - - " If fo=~w, does the paragraph end here? If yes, - " continue to next round and find a new first line. - if &formatoptions =~ 'w' && l:line_string =~ '\m\S$' - continue - endif - - " If fo=~2 get the indent of the second line - if &formatoptions =~ '2' - let l:indent = indent(l:line) - let l:width = a:width - l:indent - let l:leading_ws = s:Retab_Indent(l:indent) - endif - - " This loop will go through all the lines in the - " paragraph (or till the a:lastline) - starting from - " paragraph's second line. - while l:line <= a:lastline && getline(l:line) !~ '\m^\s*$' - let l:line_string = getline(l:line) - if l:paragraph && (l:line == a:lastline || getline(l:line+1) =~ '\m^\s*$' || (&formatoptions =~ 'w' && l:line_string =~ '\m\S$')) - let l:line_replace = s:Align_String_Left(l:line_string) - else - let l:line_replace = s:Align_String_Justify(l:line_string,l:width) - endif - if &formatoptions =~ 'w' - if l:line_string =~ '\m\s$' - call setline(l:line,l:leading_ws.l:line_replace.' ') - let l:line += 1 - continue - else - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - " fo=~w and paragraph ends - " here so we break the loop. - " The next line is new first - " line. - break - endif - else - call setline(l:line,l:leading_ws.l:line_replace) - let l:line += 1 - endif - endwhile - endwhile -endfunction - -function! s:Align_Range_Center(width) "{{{1 - let l:line_replace = s:Truncate_Spaces(getline('.')) - let l:line_replace = s:Add_Double_Spacing(l:line_replace) - if &formatoptions =~ 'w' && getline('.') =~ '\m\s$' - let l:line_replace .= ' ' - endif - call setline(line('.'),l:line_replace) - execute '.center '.a:width -endfunction - -function! s:Align_String_Left(string) "{{{1 - let l:string_replace = s:Truncate_Spaces(a:string) - let l:string_replace = s:Add_Double_Spacing(l:string_replace) - return l:string_replace -endfunction - -function! s:Align_String_Right(string, width) "{{{1 - let l:string_replace = s:Truncate_Spaces(a:string) - let l:string_replace = s:Add_Double_Spacing(l:string_replace) - let l:string_width = s:String_Width(l:string_replace) - let l:more_spaces = a:width-l:string_width - return repeat(' ',l:more_spaces).l:string_replace -endfunction - -function! s:Align_String_Justify(string, width) "{{{1 - let l:string = s:Truncate_Spaces(a:string) - " If the parameter string is empty we can just return a line full of - " spaces. No need to go further. - if l:string =~ '\m^ *$' - return repeat(' ',a:width) - endif - if s:String_Width(s:Add_Double_Spacing(l:string)) >= a:width - " The original string is longer than width so we can just - " return the string. No need to go further. - return s:Add_Double_Spacing(l:string) - endif - let l:string_width = s:String_Width(l:string) - - " This many extra spaces we need. - let l:more_spaces = a:width-l:string_width - " Convert the string to a list of words. - let l:word_list = split(l:string) - " This is the amount of spaces available in the original string (word - " count minus one). - let l:string_spaces = len(l:word_list)-1 - " If there are no spaces there is only one word. We can just return - " the string with padded spaces. No need to go further. - if l:string_spaces == 0 - return l:string.repeat(' ',l:more_spaces) - endif - " Ok, there are more than one word in the string so we get to do some - " real work... - - " Make a list of which each item represent a space available in the - " string. The value means how many spaces there are. At the moment set - " every list item to one: [1, 1, 1, 1, ...] - let l:space_list = [] - for l:item in range(l:string_spaces) - let l:space_list += [1] - endfor - - " Repeat while there are no more need to add any spaces. - while l:more_spaces > 0 - if l:more_spaces >= l:string_spaces - " More extra spaces are needed than there are spaces - " available in the string so we add one more space - " after every word (add 1 to items of space list). - for l:i in range(l:string_spaces) - let l:space_list[l:i] += 1 - endfor - let l:more_spaces -= l:string_spaces - " And then another round... and a check if more spaces - " are needed. - else " l:more_spaces < l:string_spaces - " This list tells where .?! characters are. - let l:space_sentence_full = [] - " This list tells where ,:; characters are. - let l:space_sentence_semi = [] - " And this is for the rest of spaces. - let l:space_other = [] - " Now, find those things: - for l:i in range(l:string_spaces) - if l:word_list[l:i] =~ '\m\S[.?!]$' - let l:space_sentence_full += [l:i] - elseif l:word_list[l:i] =~ '\m\S[,:;]$' - let l:space_sentence_semi += [l:i] - else - let l:space_other += [l:i] - endif - endfor - - " First distribute spaces after .?! - if l:more_spaces >= len(l:space_sentence_full) - " If we need more extra spaces than there are - " .?! spaces, just add one after every item. - for l:i in l:space_sentence_full - let l:space_list[l:i] += 1 - endfor - let l:more_spaces -= len(l:space_sentence_full) - if l:more_spaces == 0 | break | endif - else - " Distribute the rest of spaces evenly and - " break the loop. All the spaces have been - " added. - for l:i in s:Distributed_Selection(l:space_sentence_full,l:more_spaces) - let l:space_list[l:i] +=1 - endfor - break - endif - - " Then distribute spaces after ,:; - if l:more_spaces >= len(l:space_sentence_semi) - " If we need more extra spaces than there are - " ,:; spaces available, just add one after - " every item. - for l:i in l:space_sentence_semi - let l:space_list[l:i] += 1 - endfor - let l:more_spaces -= len(l:space_sentence_semi) - if l:more_spaces == 0 | break | endif - else - " Distribute the rest of spaces evenly and - " break the loop. All the spaces have been - " added. - for l:i in s:Distributed_Selection(l:space_sentence_semi,l:more_spaces) - let l:space_list[l:i] +=1 - endfor - break - endif - - " Finally distribute spaces to other available - " positions and exit the loop. - for l:i in s:Distributed_Selection(l:space_other,l:more_spaces) - let l:space_list[l:i] +=1 - endfor - break - endif - endwhile - - " Now we now where all the extra spaces will go. We have to construct - " the string again. - let l:string = '' - for l:item in range(l:string_spaces) - let l:string .= l:word_list[l:item].repeat(' ',l:space_list[l:item]) - endfor - " Add the last word to the end and return the string. - return l:string.l:word_list[-1] -endfunction - -function! s:Truncate_Spaces(string) "{{{1 - let l:string = substitute(a:string,'\v\s+',' ','g') - let l:string = substitute(l:string,'\m^\s*','','') - let l:string = substitute(l:string,'\m\s*$','','') - return l:string -endfunction - -function! s:String_Width(string) "{{{1 - " This counts the string width in characters. Combining diacritical - " marks do not count so the base character with all the combined - " diacritics is just one character (which is good for our purposes). - " Double-wide characters will not get double width so unfortunately - " they don't work in our algorithm. - return strlen(substitute(a:string,'\m.','x','g')) -endfunction - -function! s:Add_Double_Spacing(string) "{{{1 - if &joinspaces - return substitute(a:string,'\m\S[.?!] ','& ','g') - else - return a:string - endif -endfunction - -function! s:Distributed_Selection(list, pick) "{{{1 - " 'list' is a list-type variable [ item1, item2, ... ] - " 'pick' is a number how many of the list's items we want to choose - " - " This function returns a list which has 'pick' number of items from - " the original list. Items are chosen in distributed manner. For - " example, if 'pick' is 1 then the algorithm chooses an item near the - " center of the 'list'. If 'pick' is 2 then the first one is about 1/3 - " from the beginning and the another one about 2/3 from the beginning. - - " l:pick_list is a list of 0's and 1's and its length will be the - " same as original list's. Number 1 means that this list item will be - " picked and 0 means that the item will be dropped. Finally - " l:pick_list could look like this: [0, 1, 0, 1, 0] - " (i.e., two items evenly picked from a list of five items) - let l:pick_list = [] - - " First pick items evenly from the beginning of the list. This also - " actually constructs the list. - let l:div1 = len(a:list) / a:pick - let l:mod1 = len(a:list) % a:pick - for l:i in range(len(a:list)-l:mod1) - if !eval(l:i%l:div1) - let l:pick_list += [1] - else - let l:pick_list += [0] - endif - endfor - - if l:mod1 > 0 - " The division wasn't even so we get the remaining items and - " distribute them evenly again to the list. - let l:div2 = len(l:pick_list) / l:mod1 - let l:mod2 = len(l:pick_list) % l:mod1 - for l:i in range(len(l:pick_list)-l:mod2) - if !eval(l:i%l:div2) - call insert(l:pick_list,0,l:i) - endif - endfor - endif - - " There may be very different number of zeros in the beginning and the - " end of the list. We count them. - let l:zeros_begin = 0 - for l:i in l:pick_list - if l:i == 0 - let l:zeros_begin += 1 - else - break - endif - endfor - let l:zeros_end = 0 - for l:i in reverse(copy(l:pick_list)) - if l:i == 0 - let l:zeros_end += 1 - else - break - endif - endfor - - " Then we remove them. - if l:zeros_end - " Remove "0" items from the end. We need to remove them first - " from the end because list items' index number will change - " when items are removed from the beginning. Then it would be - " more difficult to remove trailing zeros. - call remove(l:pick_list,len(l:pick_list)-l:zeros_end,-1) - endif - if l:zeros_begin - " Remove zero items from the beginning. - call remove(l:pick_list,0,l:zeros_begin-1) - endif - let l:zeros_both = l:zeros_begin + l:zeros_end - - " Put even amount of zeros to beginning and end - for l:i in range(l:zeros_both/2) - call insert(l:pick_list,0,0) - endfor - for l:i in range((l:zeros_both/2)+(l:zeros_both%2)) - call add(l:pick_list,0) - endfor - - " Finally construct and return a new list which has only the items we - " have chosen. - let l:new_list = [] - for l:i in range(len(l:pick_list)) - if l:pick_list[l:i] == 1 - let l:new_list += [a:list[l:i]] - endif - endfor - return l:new_list -endfunction - -function! s:Retab_Indent(column) "{{{1 - " column = the left indent column starting from 0 Function returns - " a string of whitespaces, a mixture of tabs and spaces depending on - " the 'expandtab' and 'tabstop' options. - if &expandtab - " Only spaces - return repeat(' ',a:column) - else - " Tabs and spaces - let l:tabs = a:column / &tabstop - let l:spaces = a:column % &tabstop - return repeat("\",l:tabs).repeat(' ',l:spaces) - endif -endfunction - -function! s:Reformat_Range(...) range "{{{1 - if a:0 == 2 - let l:first = a:1 - let l:last = a:2 - else - let l:first = a:firstline - let l:last = a:lastline - endif - let l:autoindent = &autoindent - setlocal autoindent - execute l:first - normal! 0 - execute 'normal! V'.l:last.'G$gw' - let &l:autoindent = l:autoindent - " The formatting may change the last line of the range so we return - " it. - return line("'>") -endfunction - -function! textformat#Visual_Align_Left() range "{{{1 - execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' - call s:Reformat_Range(a:firstline,a:lastline) -endfunction - -function! textformat#Visual_Align_Right() range "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - - execute a:firstline.','.a:lastline.'call s:Align_Range_Right('.l:width.')' - normal! '>$ -endfunction - -function! textformat#Visual_Align_Justify() range "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - - execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' - - let l:last = s:Reformat_Range(a:firstline,a:lastline) - let l:pos = getpos('.') - execute a:firstline.','.l:last.'call s:Align_Range_Justify('.l:width.',1)' - call setpos('.',l:pos) -endfunction - -function! textformat#Visual_Align_Center() range "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - - execute a:firstline.','.a:lastline.'call s:Align_Range_Center('.l:width.')' - normal! '>$ -endfunction - -function! textformat#Quick_Align_Left() "{{{1 - let l:autoindent = &autoindent - setlocal autoindent - let l:pos = getpos('.') - silent normal! vip:call s:Align_Range_Left() - call setpos('.',l:pos) - silent normal! gwip - let &l:autoindent = l:autoindent -endfunction - -function! textformat#Quick_Align_Right() "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - let l:pos = getpos('.') - silent normal! vip:call s:Align_Range_Right(l:width) - call setpos('.',l:pos) -endfunction - -function! textformat#Quick_Align_Justify() "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - let l:autoindent = &autoindent - setlocal autoindent - let l:pos = getpos('.') - silent normal! vip:call s:Align_Range_Left() - call setpos('.',l:pos) - silent normal! gwip - let l:pos = getpos('.') - silent normal! vip:call s:Align_Range_Justify(l:width,1) - call setpos('.',l:pos) - let &l:autoindent = l:autoindent -endfunction - -function! textformat#Quick_Align_Center() "{{{1 - let l:width = &textwidth - if l:width == 0 | let l:width = s:default_width | endif - let l:pos = getpos('.') - silent normal! vip:call s:Align_Range_Center(l:width) - call setpos('.',l:pos) -endfunction - -function! textformat#Align_Command(align, ...) range "{{{1 - " For left align the optional parameter a:1 is [indent]. For others - " it's [width]. - let l:pos = getpos('.') - if a:align ==? 'left' - if a:0 && a:1 >= 0 - execute a:firstline.','.a:lastline.'call s:Align_Range_Left('.a:1.')' - else - execute a:firstline.','.a:lastline.'call s:Align_Range_Left()' - endif - else - if a:0 && a:1 > 0 - let l:width = a:1 - elseif &textwidth - let l:width = &textwidth - else - let l:width = s:default_width - endif - - if a:align ==? 'right' - execute a:firstline.','.a:lastline.'call s:Align_Range_Right('.l:width.')' - elseif a:align ==? 'justify' - execute a:firstline.','.a:lastline.'call s:Align_Range_Justify('.l:width.')' - elseif a:align ==? 'center' - execute a:firstline.','.a:lastline.'call s:Align_Range_Center('.l:width.')' - endif - endif - call setpos('.',l:pos) -endfunction - -"{{{1 The ending stuff -let &cpo = s:save_cpo - -" vim600: fdm=marker diff --git a/vim/colors/Tomorrow-Night-Eighties.vim b/vim/colors/Tomorrow-Night-Eighties.vim deleted file mode 100644 index 6199cba..0000000 --- a/vim/colors/Tomorrow-Night-Eighties.vim +++ /dev/null @@ -1,472 +0,0 @@ -" Tomorrow Night Eighties - Full Colour and 256 Colour -" http://chriskempson.com -" -" Hex colour conversion functions borrowed from the theme "Desert256"" - -" Default GUI Colours -let s:foreground = "cccccc" -let s:background = "2d2d2d" -let s:selection = "515151" -let s:line = "393939" -let s:comment = "999999" -let s:red = "f2777a" -let s:orange = "f99157" -let s:yellow = "ffcc66" -let s:green = "99cc99" -let s:aqua = "66cccc" -let s:blue = "6699cc" -let s:purple = "cc99cc" -let s:window = "4d5057" - -hi clear -syntax reset - -let g:colors_name = "Tomorrow-Night-Eighties" - -if has("gui_running") || &t_Co == 88 || &t_Co == 256 - " Returns an approximate grey index for the given grey level - fun grey_number(x) - if &t_Co == 88 - if a:x < 23 - return 0 - elseif a:x < 69 - return 1 - elseif a:x < 103 - return 2 - elseif a:x < 127 - return 3 - elseif a:x < 150 - return 4 - elseif a:x < 173 - return 5 - elseif a:x < 196 - return 6 - elseif a:x < 219 - return 7 - elseif a:x < 243 - return 8 - else - return 9 - endif - else - if a:x < 14 - return 0 - else - let l:n = (a:x - 8) / 10 - let l:m = (a:x - 8) % 10 - if l:m < 5 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " Returns the actual grey level represented by the grey index - fun grey_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 46 - elseif a:n == 2 - return 92 - elseif a:n == 3 - return 115 - elseif a:n == 4 - return 139 - elseif a:n == 5 - return 162 - elseif a:n == 6 - return 185 - elseif a:n == 7 - return 208 - elseif a:n == 8 - return 231 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 8 + (a:n * 10) - endif - endif - endfun - - " Returns the palette index for the given grey index - fun grey_colour(n) - if &t_Co == 88 - if a:n == 0 - return 16 - elseif a:n == 9 - return 79 - else - return 79 + a:n - endif - else - if a:n == 0 - return 16 - elseif a:n == 25 - return 231 - else - return 231 + a:n - endif - endif - endfun - - " Returns an approximate colour index for the given colour level - fun rgb_number(x) - if &t_Co == 88 - if a:x < 69 - return 0 - elseif a:x < 172 - return 1 - elseif a:x < 230 - return 2 - else - return 3 - endif - else - if a:x < 75 - return 0 - else - let l:n = (a:x - 55) / 40 - let l:m = (a:x - 55) % 40 - if l:m < 20 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " Returns the actual colour level for the given colour index - fun rgb_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 139 - elseif a:n == 2 - return 205 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 55 + (a:n * 40) - endif - endif - endfun - - " Returns the palette index for the given R/G/B colour indices - fun rgb_colour(x, y, z) - if &t_Co == 88 - return 16 + (a:x * 16) + (a:y * 4) + a:z - else - return 16 + (a:x * 36) + (a:y * 6) + a:z - endif - endfun - - " Returns the palette index to approximate the given R/G/B colour levels - fun colour(r, g, b) - " Get the closest grey - let l:gx = grey_number(a:r) - let l:gy = grey_number(a:g) - let l:gz = grey_number(a:b) - - " Get the closest colour - let l:x = rgb_number(a:r) - let l:y = rgb_number(a:g) - let l:z = rgb_number(a:b) - - if l:gx == l:gy && l:gy == l:gz - " There are two possibilities - let l:dgr = grey_level(l:gx) - a:r - let l:dgg = grey_level(l:gy) - a:g - let l:dgb = grey_level(l:gz) - a:b - let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) - let l:dr = rgb_level(l:gx) - a:r - let l:dg = rgb_level(l:gy) - a:g - let l:db = rgb_level(l:gz) - a:b - let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) - if l:dgrey < l:drgb - " Use the grey - return grey_colour(l:gx) - else - " Use the colour - return rgb_colour(l:x, l:y, l:z) - endif - else - " Only one possibility - return rgb_colour(l:x, l:y, l:z) - endif - endfun - - " Returns the palette index to approximate the 'rrggbb' hex string - fun rgb(rgb) - let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 - let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 - let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 - - return colour(l:r, l:g, l:b) - endfun - - " Sets the highlighting for the given group - fun X(group, fg, bg, attr) - if a:fg != "" - exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) - endif - if a:bg != "" - exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) - endif - if a:attr != "" - exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr - endif - endfun - - " Vim Highlighting - call X("Normal", s:foreground, s:background, "") - call X("LineNr", s:selection, "", "") - call X("NonText", s:selection, "", "") - call X("SpecialKey", s:selection, "", "") - call X("Search", s:background, s:yellow, "") - call X("TabLine", s:window, s:foreground, "reverse") - call X("TabLineFill", s:window, s:foreground, "reverse") - call X("StatusLine", s:window, s:yellow, "reverse") - call X("StatusLineNC", s:window, s:foreground, "reverse") - call X("VertSplit", s:window, s:window, "none") - call X("Visual", "", s:selection, "") - call X("Directory", s:blue, "", "") - call X("ModeMsg", s:green, "", "") - call X("MoreMsg", s:green, "", "") - call X("Question", s:green, "", "") - call X("WarningMsg", s:red, "", "") - call X("MatchParen", "", s:selection, "") - call X("Folded", s:comment, s:background, "") - call X("FoldColumn", "", s:background, "") - if version >= 700 - call X("CursorLine", "", s:line, "none") - call X("CursorColumn", "", s:line, "none") - call X("PMenu", s:foreground, s:selection, "none") - call X("PMenuSel", s:foreground, s:selection, "reverse") - call X("SignColumn", "", s:background, "none") - end - if version >= 703 - call X("ColorColumn", "", s:line, "none") - end - - " Standard Highlighting - call X("Comment", s:comment, "", "") - call X("Todo", s:comment, s:background, "") - call X("Title", s:comment, "", "") - call X("Identifier", s:red, "", "none") - call X("Statement", s:foreground, "", "") - call X("Conditional", s:foreground, "", "") - call X("Repeat", s:foreground, "", "") - call X("Structure", s:purple, "", "") - call X("Function", s:blue, "", "") - call X("Constant", s:orange, "", "") - call X("Keyword", s:orange, "", "") - call X("String", s:green, "", "") - call X("Special", s:foreground, "", "") - call X("PreProc", s:purple, "", "") - call X("Operator", s:aqua, "", "none") - call X("Type", s:blue, "", "none") - call X("Define", s:purple, "", "none") - call X("Include", s:blue, "", "") - "call X("Ignore", "666666", "", "") - - " Vim Highlighting - call X("vimCommand", s:red, "", "none") - - " C Highlighting - call X("cType", s:yellow, "", "") - call X("cStorageClass", s:purple, "", "") - call X("cConditional", s:purple, "", "") - call X("cRepeat", s:purple, "", "") - - " PHP Highlighting - call X("phpVarSelector", s:red, "", "") - call X("phpKeyword", s:purple, "", "") - call X("phpRepeat", s:purple, "", "") - call X("phpConditional", s:purple, "", "") - call X("phpStatement", s:purple, "", "") - call X("phpMemberSelector", s:foreground, "", "") - - " Ruby Highlighting - call X("rubySymbol", s:green, "", "") - call X("rubyConstant", s:yellow, "", "") - call X("rubyAccess", s:yellow, "", "") - call X("rubyAttribute", s:blue, "", "") - call X("rubyInclude", s:blue, "", "") - call X("rubyLocalVariableOrMethod", s:orange, "", "") - call X("rubyCurlyBlock", s:orange, "", "") - call X("rubyStringDelimiter", s:green, "", "") - call X("rubyInterpolationDelimiter", s:orange, "", "") - call X("rubyConditional", s:purple, "", "") - call X("rubyRepeat", s:purple, "", "") - call X("rubyControl", s:purple, "", "") - call X("rubyException", s:purple, "", "") - - " Python Highlighting - call X("pythonInclude", s:purple, "", "") - call X("pythonStatement", s:purple, "", "") - call X("pythonConditional", s:purple, "", "") - call X("pythonRepeat", s:purple, "", "") - call X("pythonException", s:purple, "", "") - call X("pythonFunction", s:blue, "", "") - call X("pythonPreCondit", s:purple, "", "") - call X("pythonRepeat", s:aqua, "", "") - call X("pythonExClass", s:orange, "", "") - - " JavaScript Highlighting - call X("javaScriptBraces", s:foreground, "", "") - call X("javaScriptFunction", s:purple, "", "") - call X("javaScriptConditional", s:purple, "", "") - call X("javaScriptRepeat", s:purple, "", "") - call X("javaScriptNumber", s:orange, "", "") - call X("javaScriptMember", s:orange, "", "") - call X("javascriptNull", s:orange, "", "") - call X("javascriptGlobal", s:blue, "", "") - call X("javascriptStatement", s:red, "", "") - - " CoffeeScript Highlighting - call X("coffeeRepeat", s:purple, "", "") - call X("coffeeConditional", s:purple, "", "") - call X("coffeeKeyword", s:purple, "", "") - call X("coffeeObject", s:yellow, "", "") - - " HTML Highlighting - call X("htmlTag", s:red, "", "") - call X("htmlTagName", s:red, "", "") - call X("htmlArg", s:red, "", "") - call X("htmlScriptTag", s:red, "", "") - - " Diff Highlighting - call X("diffAdd", "", "4c4e39", "") - call X("diffDelete", s:background, s:red, "") - call X("diffChange", "", "2B5B77", "") - call X("diffText", s:line, s:blue, "") - - " ShowMarks Highlighting - call X("ShowMarksHLl", s:orange, s:background, "none") - call X("ShowMarksHLo", s:purple, s:background, "none") - call X("ShowMarksHLu", s:yellow, s:background, "none") - call X("ShowMarksHLm", s:aqua, s:background, "none") - - " Lua Highlighting - call X("luaStatement", s:purple, "", "") - call X("luaRepeat", s:purple, "", "") - call X("luaCondStart", s:purple, "", "") - call X("luaCondElseif", s:purple, "", "") - call X("luaCond", s:purple, "", "") - call X("luaCondEnd", s:purple, "", "") - - " Cucumber Highlighting - call X("cucumberGiven", s:blue, "", "") - call X("cucumberGivenAnd", s:blue, "", "") - - " Go Highlighting - call X("goDirective", s:purple, "", "") - call X("goDeclaration", s:purple, "", "") - call X("goStatement", s:purple, "", "") - call X("goConditional", s:purple, "", "") - call X("goConstants", s:orange, "", "") - call X("goTodo", s:yellow, "", "") - call X("goDeclType", s:blue, "", "") - call X("goBuiltins", s:purple, "", "") - - " Clojure "highlighting - call X("clojureConstant", s:orange, "", "") - call X("clojureBoolean", s:orange, "", "") - call X("clojureCharacter", s:orange, "", "") - call X("clojureKeyword", s:green, "", "") - call X("clojureNumber", s:orange, "", "") - call X("clojureString", s:green, "", "") - call X("clojureRegexp", s:green, "", "") - call X("clojureParen", s:aqua, "", "") - call X("clojureVariable", s:yellow, "", "") - call X("clojureCond", s:blue, "", "") - call X("clojureDefine", s:purple, "", "") - call X("clojureException", s:red, "", "") - call X("clojureFunc", s:blue, "", "") - call X("clojureMacro", s:blue, "", "") - call X("clojureRepeat", s:blue, "", "") - call X("clojureSpecial", s:purple, "", "") - call X("clojureQuote", s:blue, "", "") - call X("clojureUnquote", s:blue, "", "") - call X("clojureMeta", s:blue, "", "") - call X("clojureDeref", s:blue, "", "") - call X("clojureAnonArg", s:blue, "", "") - call X("clojureRepeat", s:blue, "", "") - call X("clojureDispatch", s:blue, "", "") - - " Scala "highlighting - call X("scalaKeyword", s:purple, "", "") - call X("scalaKeywordModifier", s:purple, "", "") - call X("scalaOperator", s:blue, "", "") - call X("scalaPackage", s:red, "", "") - call X("scalaFqn", s:foreground, "", "") - call X("scalaFqnSet", s:foreground, "", "") - call X("scalaImport", s:purple, "", "") - call X("scalaBoolean", s:orange, "", "") - call X("scalaDef", s:purple, "", "") - call X("scalaVal", s:purple, "", "") - call X("scalaVar", s:aqua, "", "") - call X("scalaClass", s:purple, "", "") - call X("scalaObject", s:purple, "", "") - call X("scalaTrait", s:purple, "", "") - call X("scalaDefName", s:blue, "", "") - call X("scalaValName", s:foreground, "", "") - call X("scalaVarName", s:foreground, "", "") - call X("scalaClassName", s:foreground, "", "") - call X("scalaType", s:yellow, "", "") - call X("scalaTypeSpecializer", s:yellow, "", "") - call X("scalaAnnotation", s:orange, "", "") - call X("scalaNumber", s:orange, "", "") - call X("scalaDefSpecializer", s:yellow, "", "") - call X("scalaClassSpecializer", s:yellow, "", "") - call X("scalaBackTick", s:green, "", "") - call X("scalaRoot", s:foreground, "", "") - call X("scalaMethodCall", s:blue, "", "") - call X("scalaCaseType", s:yellow, "", "") - call X("scalaLineComment", s:comment, "", "") - call X("scalaComment", s:comment, "", "") - call X("scalaDocComment", s:comment, "", "") - call X("scalaDocTags", s:comment, "", "") - call X("scalaEmptyString", s:green, "", "") - call X("scalaMultiLineString", s:green, "", "") - call X("scalaUnicode", s:orange, "", "") - call X("scalaString", s:green, "", "") - call X("scalaStringEscape", s:green, "", "") - call X("scalaSymbol", s:orange, "", "") - call X("scalaChar", s:orange, "", "") - call X("scalaXml", s:green, "", "") - call X("scalaConstructorSpecializer", s:yellow, "", "") - call X("scalaBackTick", s:blue, "", "") - - " Git - call X("diffAdded", s:green, "", "") - call X("diffRemoved", s:red, "", "") - call X("gitcommitSummary", "", "", "bold") - - " Delete Functions - delf X - delf rgb - delf colour - delf rgb_colour - delf rgb_level - delf rgb_number - delf grey_colour - delf grey_level - delf grey_number -endif - -set background=dark diff --git a/vim/colors/camo.vim b/vim/colors/camo.vim deleted file mode 100644 index 059af42..0000000 --- a/vim/colors/camo.vim +++ /dev/null @@ -1,76 +0,0 @@ -" Vim color file -" Maintainer: Tim Aldrich -" Last Change: 19 January 2002 - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name="camo" -hi Normal guifg=bisque guibg=grey15 -hi Cursor guifg=snow guibg=bisque3 -hi CursorIM guifg=OliveDrab4 guibg=bisque -hi Directory guifg=OliveDrab4 guibg=grey15 -hi DiffAdd guifg=DarkOliveGreen1 guibg=grey15 -hi DiffChange guifg=PaleGreen guibg=grey15 -hi DiffDelete guifg=red guibg=grey15 -hi DiffText guifg=grey15 guibg=red -hi ErrorMsg guifg=snow guibg=red -hi VertSplit guifg=bisque4 guibg=DarkOliveGreen1 -hi Folded guifg=DarkOliveGreen2 guibg=grey30 -hi FoldColumn guifg=DarkOliveGreen2 guibg=grey30 -hi IncSearch guifg=bisque guibg=red -hi LineNr guifg=OliveDrab4 guibg=grey15 -hi ModeMsg guifg=khaki3 guibg=grey15 -hi MoreMsg guifg=khaki3 guibg=grey15 -hi NonText guifg=DarkSalmon guibg=grey10 -hi Question guifg=IndianRed guibg=grey10 -hi Search guifg=DarkSalmon guibg=grey15 -hi SpecialKey guifg=yellow guibg=grey15 -hi StatusLine guifg=bisque4 guibg=DarkOliveGreen1 -hi StatusLineNC guifg=bisque4 guibg=DarkOliveGreen3 -hi Title guifg=IndianRed guibg=grey15 -hi Visual guifg=OliveDrab4 guibg=bisque1 -hi WarningMsg guifg=bisque guibg=red -hi WildMenu guifg=LightBlue guibg=DarkViolet - - -"Syntax hilight groups - -hi Comment guifg=tan -hi Constant guifg=khaki -hi String guifg=moccasin -hi Character guifg=chocolate -hi Number guifg=chocolate -hi Boolean guifg=OliveDrab3 -hi Float guifg=chocolate -hi Identifier guifg=khaki4 -hi Function guifg=OliveDrab4 -hi Statement guifg=khaki -hi Conditional guifg=khaki -hi Repeat guifg=khaki -hi Label guifg=khaki -hi Operator guifg=DarkKhaki -hi Keyword guifg=DarkKhaki -hi Exception guifg=khaki -hi PreProc guifg=khaki4 -hi Include guifg=khaki4 -hi Define guifg=khaki1 -hi Macro guifg=khaki2 -hi PreCondit guifg=khaki3 -hi Type guifg=khaki3 -hi StorageClass guifg=tan -hi Structure guifg=DarkGoldenrod -hi Typedef guifg=khaki3 -hi Special guifg=IndianRed -hi SpecialChar guifg=DarkGoldenrod -hi Tag guifg=DarkKhaki -hi Delimiter guifg=DarkGoldenrod -hi SpecialComment guifg=cornsilk -hi Debug guifg=brown -hi Underlined guifg=IndianRed -hi Ignore guifg=grey30 -hi Error guifg=bisque guibg=red -hi Todo guifg=red guibg=bisque - diff --git a/vim/colors/earendel.vim b/vim/colors/earendel.vim deleted file mode 100644 index e49aefe..0000000 --- a/vim/colors/earendel.vim +++ /dev/null @@ -1,161 +0,0 @@ -hi clear - -if exists("syntax_on") - syntax reset -endif - -let colors_name = "earendel" - -execute "command! -nargs=1 Colo set background=" - -if &background == "light" - hi Normal ctermbg=15 ctermfg=0 guibg=#f0f0f0 guifg=#000000 gui=none - - hi ColorColumn ctermbg=7 ctermfg=fg guibg=#d5d5d5 gui=none - hi Cursor guibg=#000000 guifg=#ffffff gui=none - hi CursorColumn ctermbg=7 ctermfg=fg guibg=#e0e0e0 gui=none - hi CursorLine ctermbg=7 ctermfg=fg guibg=#e0e0e0 gui=none - hi DiffAdd guibg=#bae981 guifg=fg gui=none - hi DiffChange guibg=#8495e6 guifg=fg gui=none - hi DiffDelete guibg=#ff95a5 guifg=fg gui=none - hi DiffText guibg=#b9c2f0 guifg=fg gui=bold - hi Directory guibg=bg guifg=#272fc2 gui=none - hi ErrorMsg guibg=#ca001f guifg=#ffffff gui=bold - hi FoldColumn ctermbg=bg guibg=bg guifg=#656565 gui=none - hi Folded guibg=#cacaca guifg=#324263 gui=bold - hi IncSearch guibg=#f7b69d gui=none - hi LineNr guibg=bg guifg=#656565 gui=none - hi ModeMsg ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold - hi MoreMsg guibg=bg guifg=#4a4a4a gui=bold - hi NonText ctermfg=8 guibg=bg guifg=#656565 gui=bold - hi Pmenu guibg=#aab8d5 guifg=fg gui=none - hi PmenuSbar guibg=#6a83b5 guifg=fg gui=none - hi PmenuSel guibg=#fee06b guifg=fg gui=none - hi PmenuThumb guibg=#c7cfe2 guifg=fg gui=none - hi Question guibg=bg guifg=#4a4a4a gui=bold - hi Search guibg=#fee481 gui=none - hi SignColumn ctermbg=bg guibg=bg guifg=#656565 gui=none - hi SpecialKey guibg=bg guifg=#844631 gui=none - hi StatusLine ctermbg=0 ctermfg=15 guibg=#96aad3 guifg=fg gui=bold - hi StatusLineNC ctermbg=7 ctermfg=fg guibg=#bcc7de guifg=#384547 gui=none - if has("spell") - hi SpellBad guisp=#ca001f gui=undercurl - hi SpellCap guisp=#272fc2 gui=undercurl - hi SpellLocal guisp=#0f8674 gui=undercurl - hi SpellRare guisp=#d16c7a gui=undercurl - endif - hi TabLine guibg=#d4d4d4 guifg=fg gui=underline - hi TabLineFill guibg=#d4d4d4 guifg=fg gui=underline - hi TabLineSel guibg=bg guifg=fg gui=bold - hi Title guifg=fg gui=bold - hi VertSplit ctermbg=7 ctermfg=fg guibg=#bcc7de guifg=#384547 gui=none - if version >= 700 - hi Visual ctermbg=7 ctermfg=fg guibg=#bfbfbf gui=none - else - hi Visual ctermbg=7 ctermfg=fg guibg=#bfbfbf guifg=fg gui=none - endif - hi VisualNOS ctermbg=8 ctermfg=fg guibg=bg guifg=#324263 gui=bold,underline - hi WarningMsg guibg=bg guifg=#ca001f gui=bold - hi WildMenu guibg=#fedc56 guifg=fg gui=bold - - hi Comment guibg=bg guifg=#558817 gui=none - hi Constant guibg=bg guifg=#a8660d gui=none - hi Error guibg=bg guifg=#bf001d gui=none - hi Identifier guibg=bg guifg=#0e7c6b gui=none - hi Ignore guibg=bg guifg=bg gui=none - hi lCursor guibg=#79bf21 guifg=#ffffff gui=none - hi MatchParen guibg=#0f8674 guifg=#ffffff gui=none - hi PreProc guibg=bg guifg=#a33243 gui=none - hi Special guibg=bg guifg=#844631 gui=none - hi Statement guibg=bg guifg=#2239a8 gui=bold - hi Todo guibg=#fedc56 guifg=#512b1e gui=bold - hi Type guibg=bg guifg=#1d318d gui=bold - hi Underlined ctermbg=bg ctermfg=fg guibg=bg guifg=#272fc2 gui=underline - - hi htmlBold ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold - hi htmlBoldItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,italic - hi htmlBoldUnderline ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,underline - hi htmlBoldUnderlineItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold,underline,italic - hi htmlItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=italic - hi htmlUnderline ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=underline - hi htmlUnderlineItalic ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=underline,italic -else - hi Normal ctermbg=0 ctermfg=7 guibg=#303030 guifg=#cacaca gui=none - - hi ColorColumn ctermbg=8 ctermfg=15 guibg=#4a4a4a gui=none - hi Cursor guibg=#e5e5e5 guifg=#000000 gui=none - hi CursorColumn ctermbg=8 ctermfg=15 guibg=#404040 gui=none - hi CursorLine ctermbg=8 ctermfg=15 guibg=#404040 gui=none - hi DiffAdd guibg=#558817 guifg=#dadada gui=none - hi DiffChange guibg=#1b2e85 guifg=#dadada gui=none - hi DiffDelete guibg=#9f0018 guifg=#dadada gui=none - hi DiffText guibg=#2540ba guifg=#dadada gui=bold - hi Directory guibg=bg guifg=#8c91e8 gui=none - hi ErrorMsg guibg=#ca001f guifg=#e5e5e5 gui=bold - hi FoldColumn ctermbg=bg guibg=bg guifg=#9a9a9a gui=none - hi Folded guibg=#555555 guifg=#bfcadf gui=bold - hi IncSearch guibg=#a7380e guifg=#dadada gui=none - hi LineNr guibg=bg guifg=#9a9a9a gui=none - hi ModeMsg ctermbg=bg ctermfg=fg guibg=bg guifg=fg gui=bold - hi MoreMsg guibg=bg guifg=#b5b5b5 gui=bold - hi NonText ctermfg=8 guibg=bg guifg=#9a9a9a gui=bold - hi Pmenu guibg=#3d5078 guifg=#dadada gui=none - hi PmenuSbar guibg=#324263 guifg=#dadada gui=none - hi PmenuSel guibg=#f3c201 guifg=#000000 gui=none - hi PmenuThumb guibg=#5c77ad guifg=#dadada gui=none - hi Question guibg=bg guifg=#b5b5b5 gui=bold - hi Search guibg=#947601 guifg=#dadada gui=none - hi SignColumn ctermbg=bg guibg=bg guifg=#9a9a9a gui=none - hi SpecialKey guibg=bg guifg=#d3a901 gui=none - hi StatusLine ctermbg=7 ctermfg=0 guibg=#41609e guifg=#e5e5e5 gui=bold - hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#35466a guifg=#afbacf gui=none - if has("spell") - hi SpellBad guisp=#ea0023 gui=undercurl - hi SpellCap guisp=#8c91e8 gui=undercurl - hi SpellLocal guisp=#16c9ae gui=undercurl - hi SpellRare guisp=#e09ea8 gui=undercurl - endif - hi TabLine guibg=#4a4a4a guifg=#e5e5e5 gui=underline - hi TabLineFill guibg=#4a4a4a guifg=#e5e5e5 gui=underline - hi TabLineSel guibg=bg guifg=#e5e5e5 gui=bold - hi Title ctermbg=bg ctermfg=15 guifg=#e5e5e5 gui=bold - hi VertSplit ctermbg=7 ctermfg=0 guibg=#35466a guifg=#afbacf gui=none - if version >= 700 - hi Visual ctermbg=7 ctermfg=0 guibg=#606060 gui=none - else - hi Visual ctermbg=7 ctermfg=0 guibg=#606060 guifg=fg gui=none - endif - hi VisualNOS ctermbg=8 ctermfg=0 guibg=bg guifg=#bfcadf gui=bold,underline - hi WarningMsg guibg=bg guifg=#ea0023 gui=bold - hi WildMenu guibg=#fbca01 guifg=#000000 gui=bold - - hi Comment guibg=bg guifg=#77be21 gui=none - hi Constant guibg=bg guifg=#dc8511 gui=none - hi Error guibg=bg guifg=#ea0023 gui=none - hi Identifier guibg=bg guifg=#16c9ae gui=none - hi Ignore guibg=bg guifg=bg gui=none - hi lCursor guibg=#c4ec93 guifg=#000000 gui=none - hi MatchParen guibg=#17d2b7 guifg=#000000 gui=none - hi PreProc guibg=bg guifg=#e09ea8 gui=none - hi Special guibg=bg guifg=#d3a901 gui=none - hi Statement guibg=bg guifg=#a7b4ed gui=bold - hi Todo guibg=#fedc56 guifg=#512b1e gui=bold - hi Type guibg=bg guifg=#95a4ea gui=bold - hi Underlined ctermbg=bg ctermfg=15 guibg=bg guifg=#8c91e8 gui=underline - - hi htmlBold ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold - hi htmlBoldItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,italic - hi htmlBoldUnderline ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,underline - hi htmlBoldUnderlineItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic - hi htmlItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=italic - hi htmlUnderline ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=underline - hi htmlUnderlineItalic ctermbg=bg ctermfg=15 guibg=bg guifg=fg gui=underline,italic -endif - -hi! default link bbcodeBold htmlBold -hi! default link bbcodeBoldItalic htmlBoldItalic -hi! default link bbcodeBoldItalicUnderline htmlBoldUnderlineItalic -hi! default link bbcodeBoldUnderline htmlBoldUnderline -hi! default link bbcodeItalic htmlItalic -hi! default link bbcodeItalicUnderline htmlUnderlineItalic -hi! default link bbcodeUnderline htmlUnderline diff --git a/vim/colors/faded-black.vim b/vim/colors/faded-black.vim deleted file mode 100644 index 37c945b..0000000 --- a/vim/colors/faded-black.vim +++ /dev/null @@ -1,89 +0,0 @@ -" Vim color file -" Maintainer: John Kaul -" Created On: 2003 Mar 19 -" Last Change: 2013 Jan 16 - -" Notes: -" This started as a fadded version of of the 'Chocolate Liquor', but -" soon took on a life of its own. Easy on the eyes, but still has good -" contrast. I dont think there is any 'Chocolate Liquor' left in this -" file, but there is prolly an entry or two left in there somewhere. -" -" Only values that differ from defaults are specified. -" -" 01.07.05 update: Tweeked a few colors and added terminal colors. -" Please note that I didnt go thru the terminal colors very well. (I -" just added a few ''dif. then normal'' colors) If you use the terminal -" alot I would make an attempt to fix anything you dont like about this -" color scheme if I were you. :)~ Other than that, I just called it it -" good 'nuff. -" -" 01.16.13 update: Changed a few more colors (still havent looked at the -" terminal colors). -" -" I hope you enjoy... - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name = "faded-black" - - -" Vim >= 7.0 specific colors -if version >= 700 - -hi CursorLine ctermbg=236 ctermfg=NONE guibg=#2d2d2d guifg=NONE term=NONE gui=NONE -hi CursorColumn ctermbg=236 ctermfg=NONE guibg=#2d2d2d guifg=NONE term=NONE gui=NONE -hi MatchParen ctermbg=237 ctermfg=157 guibg=#2f2f2f guifg=#d0ffc0 term=bold gui=bold -hi Pmenu ctermbg=238 ctermfg=255 guibg=#444444 guifg=#ffffff term=NONE gui=NONE -hi PmenuSel ctermbg=148 ctermfg=0 guibg=#b1d631 guifg=#000000 term=NONE gui=NONE - -endif - -" //-- Stuff --// -hi Cursor ctermbg=Red ctermfg=NONE guibg=#8b3a3a guifg=#e3e3e3 gui=NONE -hi Normal ctermbg=NONE ctermfg=LightGrey guibg=#03080F guifg=#958a73 gui=NONE -" hi Normal ctermbg=NONE ctermfg=LightGrey guibg=#03080F guifg=#a69d89 gui=NONE -" The text color between the above two are tough to decide; I leave it up to you. -hi NonText ctermbg=NONE ctermfg=Black guibg=#03080F guifg=#000030 gui=NONE -hi DiffDelete ctermbg=DarkRed ctermfg=White guibg=DarkRed guifg=White gui=NONE -hi DiffAdd ctermbg=DarkGreen ctermfg=White guibg=DarkGreen guifg=White gui=NONE -hi DiffText ctermbg=LightCyan ctermfg=Yellow guibg=Lightblue guifg=Yellow gui=NONE -hi DiffChange ctermbg=LightBlue ctermfg=White guibg=LightBlue3 guifg=White gui=NONE -hi Constant ctermbg=NONE ctermfg=Red guibg=NONE guifg=#872e30 gui=NONE -hi StatusLine ctermbg=DarkGrey ctermfg=Red guibg=DarkGrey guifg=LightRed gui=italic -hi StatusLineNC ctermbg=Darkgrey ctermfg=black guibg=DarkGrey guifg=Black gui=NONE -hi VertSplit ctermbg=NONE ctermfg=NONE guibg=NONE guifg=Grey gui=NONE -hi Visual ctermbg=DarkRed ctermfg=Red guibg=#6b6b6b guifg=#431818 term=reverse -hi Search ctermbg=NONE ctermfg=LightGrey guibg=#80363a guifg=#a69c89 gui=NONE -hi Label ctermbg=NONE ctermfg=NONE guibg=NONE guifg=#ffc0c0 gui=NONE -hi LineNr ctermbg=NONE ctermfg=Red guibg=NONE guifg=#A39274 gui=NONE - -" //-- Messages --// -hi MoreMsg ctermbg=NONE ctermfg=DarkGreen guibg=NONE guifg=SeaGreen term=bold,italic gui=bold -hi question ctermbg=NONE ctermfg=DarkGreen guibg=NONE guifg=SeaGreen term=standout gui=bold - -" //-- Syntax group --// -hi Comment ctermbg=NONE ctermfg=DarkGreen guibg=NONE guifg=#545f3a gui=italic -hi PreProc ctermbg=NONE ctermfg=NONE guibg=NONE guifg=#bbaccc gui=NONE -hi Statement ctermbg=NONE ctermfg=Yellow guibg=NONE guifg=#ab952b gui=NONE -hi Type ctermbg=NONE ctermfg=darkmagenta guibg=NONE guifg=#ba5bdb gui=NONE -hi Identifier ctermbg=NONE ctermfg=Yellow guibg=NONE guifg=#737d95 gui=NONE -hi Special ctermbg=NONE ctermfg=Green guibg=NONE guifg=#5b5646 gui=NONE -hi Todo ctermbg=NONE ctermfg=NONE guibg=NONE guifg=LightBlue gui=bold,italic -hi Number ctermbg=NONE ctermfg=NONE guibg=NONE guifg=lightblue gui=NONE -" -" Lisp stuff -hi lispAtomMark ctermbg=NONE ctermfg=cyan guifg=darkcyan guibg=NONE gui=NONE -hi lispNumber ctermbg=NONE ctermfg=DarkGreen guifg=lightblue guibg=NONE gui=NONE -" -" hi Constant -" hi Error -" hi Ignore -" hi Underlined - -" //-- Fold --// -hi Folded ctermbg=NONE ctermfg=NONE guibg=#001a33 guifg=#a69c89 gui=italic -hi FoldColumn ctermbg=NONE ctermfg=Yellow guibg=#6699CC guifg=#0000EE gui=NONE diff --git a/vim/colors/freya.vim b/vim/colors/freya.vim deleted file mode 100644 index d190851..0000000 --- a/vim/colors/freya.vim +++ /dev/null @@ -1,79 +0,0 @@ -set background=dark - -hi clear - -if exists("syntax_on") - syntax reset -endif - -let colors_name = "freya" - -hi Normal ctermbg=0 ctermfg=7 cterm=none guibg=#2a2a2a guifg=#dcdccc gui=none - -hi Cursor guibg=fg guifg=bg gui=none -hi CursorColumn guibg=#3f3f3f gui=none -hi CursorLine guibg=#3f3f3f gui=none -hi DiffAdd guibg=#008b00 guifg=fg gui=none -hi DiffChange guibg=#00008b guifg=fg gui=none -hi DiffDelete guibg=#8b0000 guifg=fg gui=none -hi DiffText guibg=#0000cd guifg=fg gui=bold -hi Directory guibg=bg guifg=#d4b064 gui=none -hi ErrorMsg guibg=bg guifg=#f07070 gui=bold -hi FoldColumn ctermbg=bg guibg=bg guifg=#c2b680 gui=none -hi Folded guibg=#101010 guifg=#c2b680 gui=none -hi IncSearch guibg=#866a4f guifg=fg gui=none -hi LineNr guibg=bg guifg=#9f8f80 gui=none -hi ModeMsg guibg=bg guifg=fg gui=bold -hi MoreMsg guibg=bg guifg=#dabfa5 gui=bold -hi NonText ctermfg=8 guibg=bg guifg=#9f8f80 gui=bold -hi Pmenu guibg=#a78869 guifg=#000000 gui=none -hi PmenuSbar guibg=#B99F86 guifg=fg gui=none -hi PmenuSel guibg=#c0aa94 guifg=bg gui=none -hi PmenuThumb guibg=#f7f7f1 guifg=bg gui=none -hi Question guibg=bg guifg=#dabfa5 gui=bold -hi Search guibg=#c0aa94 guifg=bg gui=none -hi SignColumn ctermbg=bg guibg=bg guifg=#c2b680 gui=none -hi SpecialKey guibg=bg guifg=#d4b064 gui=none -if has("spell") - hi SpellBad guisp=#f07070 gui=undercurl - hi SpellCap guisp=#7070f0 gui=undercurl - hi SpellLocal guisp=#70f0f0 gui=undercurl - hi SpellRare guisp=#f070f0 gui=undercurl -endif -hi StatusLine ctermbg=7 ctermfg=0 guibg=#736559 guifg=#f7f7f1 gui=bold -hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#564d43 guifg=#f7f7f1 gui=none -hi TabLine guibg=#564d43 guifg=#f7f7f1 gui=underline -hi TabLineFill guibg=#564d43 guifg=#f7f7f1 gui=underline -hi TabLineSel guibg=bg guifg=#f7f7f1 gui=bold -hi Title ctermbg=0 ctermfg=15 guifg=#f7f7f1 gui=bold -hi VertSplit ctermbg=7 ctermfg=0 guibg=#564d43 guifg=#f7f7f1 gui=none -if version >= 700 - hi Visual ctermbg=7 ctermfg=0 guibg=#5f5f5f gui=none -else - hi Visual ctermbg=7 ctermfg=0 guibg=#5f5f5f guifg=fg gui=none -endif -hi VisualNOS guibg=bg guifg=#c0aa94 gui=bold,underline -hi WarningMsg guibg=bg guifg=#f07070 gui=none -hi WildMenu guibg=#c0aa94 guifg=bg gui=bold - -hi Comment guibg=bg guifg=#c2b680 gui=none -hi Constant guibg=bg guifg=#f8af80 gui=none -hi Error guibg=bg guifg=#f07070 gui=none -hi Identifier guibg=bg guifg=#dabfa5 gui=none -hi Ignore guibg=bg guifg=bg gui=none -hi lCursor guibg=#c0aa94 guifg=bg gui=none -hi MatchParen guibg=#008b8b gui=none -hi PreProc guibg=bg guifg=#c2d0ae gui=none -hi Special guibg=bg guifg=#d4b064 gui=none -hi Statement guibg=bg guifg=#e0af91 gui=bold -hi Todo guibg=#aed0ae guifg=bg gui=none -hi Type guibg=bg guifg=#dabfa5 gui=bold -hi Underlined guibg=bg guifg=#d4b064 gui=underline - -hi htmlBold ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold -hi htmlItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=italic -hi htmlUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline -hi htmlBoldItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,italic -hi htmlBoldUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline -hi htmlBoldUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic -hi htmlUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline,italic diff --git a/vim/colors/inkpot.vim b/vim/colors/inkpot.vim deleted file mode 100644 index a062248..0000000 --- a/vim/colors/inkpot.vim +++ /dev/null @@ -1,212 +0,0 @@ -" Vim color file -" Name: inkpot.vim -" Maintainer: Ciaran McCreesh -" This should work in the GUI, rxvt-unicode (88 colour mode) and xterm (256 -" colour mode). It won't work in 8/16 colour terminals. -" -" To use a black background, :let g:inkpot_black_background = 1 - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif - -let colors_name = "inkpot" - -" map a urxvt cube number to an xterm-256 cube number -fun! M(a) - return strpart("0135", a:a, 1) + 0 -endfun - -" map a urxvt colour to an xterm-256 colour -fun! X(a) - if &t_Co == 88 - return a:a - else - if a:a == 8 - return 237 - elseif a:a < 16 - return a:a - elseif a:a > 79 - return 232 + (3 * (a:a - 80)) - else - let l:b = a:a - 16 - let l:x = l:b % 4 - let l:y = (l:b / 4) % 4 - let l:z = (l:b / 16) - return 16 + M(l:x) + (6 * M(l:y)) + (36 * M(l:z)) - endif - endif -endfun - -if ! exists("g:inkpot_black_background") - let g:inkpot_black_background = 0 -endif - -if has("gui_running") - if ! g:inkpot_black_background - hi Normal gui=NONE guifg=#cfbfad guibg=#1e1e27 - else - hi Normal gui=NONE guifg=#cfbfad guibg=#000000 - endif - - hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60 - hi Search gui=NONE guifg=#303030 guibg=#cd8b60 - hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e - hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e - hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE - hi MoreMsg gui=BOLD guifg=#7e7eae guibg=NONE - hi Question gui=BOLD guifg=#ffcd00 guibg=NONE - - hi StatusLine gui=BOLD guifg=#b9b9b9 guibg=#3e3e5e - hi User1 gui=BOLD guifg=#00ff8b guibg=#3e3e5e - hi User2 gui=BOLD guifg=#7070a0 guibg=#3e3e5e - hi StatusLineNC gui=NONE guifg=#b9b9b9 guibg=#3e3e5e - hi VertSplit gui=NONE guifg=#b9b9b9 guibg=#3e3e5e - - hi WildMenu gui=BOLD guifg=#eeeeee guibg=#6e6eaf - - hi MBENormal guifg=#cfbfad guibg=#2e2e3f - hi MBEChanged guifg=#eeeeee guibg=#2e2e3f - hi MBEVisibleNormal guifg=#cfcfcd guibg=#4e4e8f - hi MBEVisibleChanged guifg=#eeeeee guibg=#4e4e8f - - hi DiffText gui=NONE guifg=#ffffcd guibg=#4a2a4a - hi DiffChange gui=NONE guifg=#ffffcd guibg=#306b8f - hi DiffDelete gui=NONE guifg=#ffffcd guibg=#6d3030 - hi DiffAdd gui=NONE guifg=#ffffcd guibg=#306d30 - - hi Cursor gui=NONE guifg=#404040 guibg=#8b8bff - hi lCursor gui=NONE guifg=#404040 guibg=#8fff8b - hi CursorIM gui=NONE guifg=#404040 guibg=#8b8bff - - hi Folded gui=NONE guifg=#cfcfcd guibg=#4b208f - hi FoldColumn gui=NONE guifg=#8b8bcd guibg=#2e2e2e - - hi Directory gui=NONE guifg=#00ff8b guibg=NONE - hi LineNr gui=NONE guifg=#8b8bcd guibg=#2e2e2e - hi NonText gui=BOLD guifg=#8b8bcd guibg=NONE - hi SpecialKey gui=BOLD guifg=#ab60ed guibg=NONE - hi Title gui=BOLD guifg=#af4f4b guibg=NONE - hi Visual gui=NONE guifg=#eeeeee guibg=#4e4e8f - - hi Comment gui=NONE guifg=#cd8b00 guibg=NONE - hi Constant gui=NONE guifg=#ffcd8b guibg=NONE - hi String gui=NONE guifg=#ffcd8b guibg=#404040 - hi Error gui=NONE guifg=#ffffff guibg=#6e2e2e - hi Identifier gui=NONE guifg=#ff8bff guibg=NONE - hi Ignore gui=NONE - hi Number gui=NONE guifg=#f0ad6d guibg=NONE - hi PreProc gui=NONE guifg=#409090 guibg=NONE - hi Special gui=NONE guifg=#c080d0 guibg=NONE - hi SpecialChar gui=NONE guifg=#c080d0 guibg=#404040 - hi Statement gui=NONE guifg=#808bed guibg=NONE - hi Todo gui=BOLD guifg=#303030 guibg=#d0a060 - hi Type gui=NONE guifg=#ff8bff guibg=NONE - hi Underlined gui=BOLD guifg=#df9f2d guibg=NONE - hi TaglistTagName gui=BOLD guifg=#808bed guibg=NONE - - hi perlSpecialMatch gui=NONE guifg=#c080d0 guibg=#404040 - hi perlSpecialString gui=NONE guifg=#c080d0 guibg=#404040 - - hi cSpecialCharacter gui=NONE guifg=#c080d0 guibg=#404040 - hi cFormat gui=NONE guifg=#c080d0 guibg=#404040 - - hi doxygenBrief gui=NONE guifg=#fdab60 guibg=NONE - hi doxygenParam gui=NONE guifg=#fdd090 guibg=NONE - hi doxygenPrev gui=NONE guifg=#fdd090 guibg=NONE - hi doxygenSmallSpecial gui=NONE guifg=#fdd090 guibg=NONE - hi doxygenSpecial gui=NONE guifg=#fdd090 guibg=NONE - hi doxygenComment gui=NONE guifg=#ad7b20 guibg=NONE - hi doxygenSpecial gui=NONE guifg=#fdab60 guibg=NONE - hi doxygenSpecialMultilineDesc gui=NONE guifg=#ad600b guibg=NONE - hi doxygenSpecialOnelineDesc gui=NONE guifg=#ad600b guibg=NONE - - if v:version >= 700 - hi Pmenu gui=NONE guifg=#eeeeee guibg=#4e4e8f - hi PmenuSel gui=BOLD guifg=#eeeeee guibg=#2e2e3f - hi PmenuSbar gui=BOLD guifg=#eeeeee guibg=#6e6eaf - hi PmenuThumb gui=BOLD guifg=#eeeeee guibg=#6e6eaf - - hi SpellBad gui=undercurl guisp=#cc6666 - hi SpellRare gui=undercurl guisp=#cc66cc - hi SpellLocal gui=undercurl guisp=#cccc66 - hi SpellCap gui=undercurl guisp=#66cccc - - hi MatchParen gui=NONE guifg=#404040 guibg=#8fff8b - endif -else - if ! g:inkpot_black_background - exec "hi Normal cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(80) - else - exec "hi Normal cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(16) - endif - - exec "hi IncSearch cterm=BOLD ctermfg=" . X(80) . " ctermbg=" . X(73) - exec "hi Search cterm=NONE ctermfg=" . X(80) . " ctermbg=" . X(73) - exec "hi ErrorMsg cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(48) - exec "hi WarningMsg cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(68) - exec "hi ModeMsg cterm=BOLD ctermfg=" . X(38) . " ctermbg=" . "NONE" - exec "hi MoreMsg cterm=BOLD ctermfg=" . X(38) . " ctermbg=" . "NONE" - exec "hi Question cterm=BOLD ctermfg=" . X(52) . " ctermbg=" . "NONE" - - exec "hi StatusLine cterm=BOLD ctermfg=" . X(85) . " ctermbg=" . X(81) - exec "hi User1 cterm=BOLD ctermfg=" . X(28) . " ctermbg=" . X(81) - exec "hi User2 cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . X(81) - exec "hi StatusLineNC cterm=NONE ctermfg=" . X(84) . " ctermbg=" . X(81) - exec "hi VertSplit cterm=NONE ctermfg=" . X(84) . " ctermbg=" . X(81) - - exec "hi WildMenu cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(38) - - exec "hi MBENormal ctermfg=" . X(85) . " ctermbg=" . X(81) - exec "hi MBEChanged ctermfg=" . X(87) . " ctermbg=" . X(81) - exec "hi MBEVisibleNormal ctermfg=" . X(85) . " ctermbg=" . X(82) - exec "hi MBEVisibleChanged ctermfg=" . X(87) . " ctermbg=" . X(82) - - exec "hi DiffText cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(34) - exec "hi DiffChange cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(17) - exec "hi DiffDelete cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(32) - exec "hi DiffAdd cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(20) - - exec "hi Folded cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(35) - exec "hi FoldColumn cterm=NONE ctermfg=" . X(39) . " ctermbg=" . X(80) - - exec "hi Directory cterm=NONE ctermfg=" . X(28) . " ctermbg=" . "NONE" - exec "hi LineNr cterm=NONE ctermfg=" . X(39) . " ctermbg=" . X(80) - exec "hi NonText cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . "NONE" - exec "hi SpecialKey cterm=BOLD ctermfg=" . X(55) . " ctermbg=" . "NONE" - exec "hi Title cterm=BOLD ctermfg=" . X(48) . " ctermbg=" . "NONE" - exec "hi Visual cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(38) - - exec "hi Comment cterm=NONE ctermfg=" . X(52) . " ctermbg=" . "NONE" - exec "hi Constant cterm=NONE ctermfg=" . X(73) . " ctermbg=" . "NONE" - exec "hi String cterm=NONE ctermfg=" . X(73) . " ctermbg=" . X(81) - exec "hi Error cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(32) - exec "hi Identifier cterm=NONE ctermfg=" . X(53) . " ctermbg=" . "NONE" - exec "hi Ignore cterm=NONE" - exec "hi Number cterm=NONE ctermfg=" . X(69) . " ctermbg=" . "NONE" - exec "hi PreProc cterm=NONE ctermfg=" . X(25) . " ctermbg=" . "NONE" - exec "hi Special cterm=NONE ctermfg=" . X(55) . " ctermbg=" . "NONE" - exec "hi SpecialChar cterm=NONE ctermfg=" . X(55) . " ctermbg=" . X(81) - exec "hi Statement cterm=NONE ctermfg=" . X(27) . " ctermbg=" . "NONE" - exec "hi Todo cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(57) - exec "hi Type cterm=NONE ctermfg=" . X(71) . " ctermbg=" . "NONE" - exec "hi Underlined cterm=BOLD ctermfg=" . X(77) . " ctermbg=" . "NONE" - exec "hi TaglistTagName cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . "NONE" - - if v:version >= 700 - exec "hi Pmenu cterm=NONE ctermfg=" . X(87) . " ctermbg=" . X(82) - exec "hi PmenuSel cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(38) - exec "hi PmenuSbar cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(39) - exec "hi PmenuThumb cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(39) - - exec "hi SpellBad cterm=NONE ctermbg=" . X(32) - exec "hi SpellRare cterm=NONE ctermbg=" . X(33) - exec "hi SpellLocal cterm=NONE ctermbg=" . X(36) - exec "hi SpellCap cterm=NONE ctermbg=" . X(21) - exec "hi MatchParen cterm=NONE ctermbg=" . X(14) . "ctermfg=" . X(25) - endif -endif - -" vim: set et : diff --git a/vim/colors/matrix.vim b/vim/colors/matrix.vim deleted file mode 100644 index da5c687..0000000 --- a/vim/colors/matrix.vim +++ /dev/null @@ -1,80 +0,0 @@ -" vim:set ts=8 sts=2 sw=2 tw=0: -" -" matrix.vim - MATRIX like colorscheme. -" -" Maintainer: MURAOKA Taro -" Last Change: 10-Jun-2003. - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name = 'matrix' - -" the character under the cursor -hi Cursor guifg=#226622 guibg=#55ff55 -hi lCursor guifg=#226622 guibg=#55ff55 -" like Cursor, but used when in IME mode |CursorIM| -hi CursorIM guifg=#226622 guibg=#55ff55 -" directory names (and other special names in listings) -hi Directory guifg=#55ff55 guibg=#000000 -" diff mode: Added line |diff.txt| -hi DiffAdd guifg=#55ff55 guibg=#226622 gui=none -" diff mode: Changed line |diff.txt| -hi DiffChange guifg=#55ff55 guibg=#226622 gui=none -" diff mode: Deleted line |diff.txt| -hi DiffDelete guifg=#113311 guibg=#113311 gui=none -" diff mode: Changed text within a changed line |diff.txt| -hi DiffText guifg=#55ff55 guibg=#339933 gui=bold -" error messages on the command line -hi ErrorMsg guifg=#55ff55 guibg=#339933 -" the column separating vertically split windows -hi VertSplit guifg=#339933 guibg=#339933 -" line used for closed folds -hi Folded guifg=#44cc44 guibg=#113311 -" 'foldcolumn' -hi FoldColumn guifg=#44cc44 guibg=#226622 -" 'incsearch' highlighting; also used for the text replaced with -hi IncSearch guifg=#226622 guibg=#55ff55 gui=none -" line number for ":number" and ":#" commands, and when 'number' -hi LineNr guifg=#44cc44 guibg=#000000 -" 'showmode' message (e.g., "-- INSERT --") -hi ModeMsg guifg=#44cc44 guibg=#000000 -" |more-prompt| -hi MoreMsg guifg=#44cc44 guibg=#000000 -" '~' and '@' at the end of the window, characters from -hi NonText guifg=#44cc44 guibg=#113311 -" normal text -hi Normal guifg=#44cc44 guibg=#000000 -" |hit-enter| prompt and yes/no questions -hi Question guifg=#44cc44 guibg=#000000 -" Last search pattern highlighting (see 'hlsearch'). -hi Search guifg=#113311 guibg=#44cc44 gui=none -" Meta and special keys listed with ":map", also for text used -hi SpecialKey guifg=#44cc44 guibg=#000000 -" status line of current window -hi StatusLine guifg=#55ff55 guibg=#339933 gui=none -" status lines of not-current windows -hi StatusLineNC guifg=#113311 guibg=#339933 gui=none -" titles for output from ":set all", ":autocmd" etc. -hi Title guifg=#55ff55 guibg=#113311 gui=bold -" Visual mode selection -hi Visual guifg=#55ff55 guibg=#339933 gui=none -" Visual mode selection when vim is "Not Owning the Selection". -hi VisualNOS guifg=#44cc44 guibg=#000000 -" warning messages -hi WarningMsg guifg=#55ff55 guibg=#000000 -" current match in 'wildmenu' completion -hi WildMenu guifg=#226622 guibg=#55ff55 - -hi Comment guifg=#226622 guibg=#000000 -hi Constant guifg=#55ff55 guibg=#226622 -hi Special guifg=#44cc44 guibg=#226622 -hi Identifier guifg=#55ff55 guibg=#000000 -hi Statement guifg=#55ff55 guibg=#000000 gui=bold -hi PreProc guifg=#339933 guibg=#000000 -hi Type guifg=#55ff55 guibg=#000000 gui=bold -hi Underlined guifg=#55ff55 guibg=#000000 gui=underline -hi Error guifg=#55ff55 guibg=#339933 -hi Todo guifg=#113311 guibg=#44cc44 gui=none diff --git a/vim/colors/mayansmoke.vim b/vim/colors/mayansmoke.vim deleted file mode 100644 index 6d146f8..0000000 --- a/vim/colors/mayansmoke.vim +++ /dev/null @@ -1,343 +0,0 @@ -" ============================================================================= -" -" 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/colors/moria.vim b/vim/colors/moria.vim deleted file mode 100644 index f03b297..0000000 --- a/vim/colors/moria.vim +++ /dev/null @@ -1,205 +0,0 @@ -if exists("g:moria_style") - let s:moria_style = g:moria_style -else - let s:moria_style = &background -endif - -execute "command! -nargs=1 Colo let g:moria_style = \"\" | colo moria" - -if s:moria_style == "black" || s:moria_style == "dark" || s:moria_style == "darkslategray" - set background=dark -elseif s:moria_style == "light" || s:moria_style == "white" - set background=light -else - let s:moria_style = &background -endif - -hi clear - -if exists("syntax_on") - syntax reset -endif - -let colors_name = "moria" - -if &background == "dark" - if s:moria_style == "darkslategray" - hi Normal ctermbg=0 ctermfg=7 guibg=#2f4f4f guifg=#d0d0d0 gui=none - - hi CursorColumn guibg=#404040 gui=none - hi CursorLine guibg=#404040 gui=none - hi FoldColumn ctermbg=bg guibg=bg guifg=#a0c0c0 gui=none - hi Folded guibg=#585858 guifg=#c0e0e0 gui=none - hi LineNr guifg=#a0c0c0 gui=none - hi NonText ctermfg=8 guibg=bg guifg=#a0c0c0 gui=bold - hi Pmenu guibg=#80a0a0 guifg=#000000 gui=none - hi PmenuSbar guibg=#608080 guifg=fg gui=none - hi PmenuThumb guibg=#c0e0e0 guifg=bg gui=none - hi SignColumn ctermbg=bg guibg=bg guifg=#a0c0c0 gui=none - hi StatusLine ctermbg=7 ctermfg=0 guibg=#507070 guifg=fg gui=bold - hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#406060 guifg=fg gui=none - hi TabLine guibg=#567676 guifg=fg gui=underline - hi TabLineFill guibg=#567676 guifg=fg gui=underline - hi VertSplit ctermbg=7 ctermfg=0 guibg=#406060 guifg=fg gui=none - if version >= 700 - hi Visual ctermbg=7 ctermfg=0 guibg=#608080 gui=none - else - hi Visual ctermbg=7 ctermfg=0 guibg=#608080 guifg=fg gui=none - endif - hi VisualNOS guibg=bg guifg=#90b0b0 gui=bold,underline - else - if s:moria_style == "dark" - hi Normal ctermbg=0 ctermfg=7 guibg=#202020 guifg=#d0d0d0 gui=none - - hi CursorColumn guibg=#444444 gui=none - hi CursorLine guibg=#444444 gui=none - elseif s:moria_style == "black" - hi Normal ctermbg=0 ctermfg=7 guibg=#000000 guifg=#d0d0d0 gui=none - - hi CursorColumn guibg=#3a3a3a gui=none - hi CursorLine guibg=#3a3a3a gui=none - endif - hi FoldColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none - hi Folded guibg=#585858 guifg=#c0d0e0 gui=none - hi LineNr guifg=#a0b0c0 gui=none - hi NonText ctermfg=8 guibg=bg guifg=#a0b0c0 gui=bold - hi Pmenu guibg=#8090a0 guifg=#000000 gui=none - hi PmenuSbar guibg=#607080 guifg=fg gui=none - hi PmenuThumb guibg=#c0d0e0 guifg=bg gui=none - hi SignColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none - hi StatusLine ctermbg=7 ctermfg=0 guibg=#485868 guifg=fg gui=bold - hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#304050 guifg=fg gui=none - hi TabLine guibg=#566676 guifg=fg gui=underline - hi TabLineFill guibg=#566676 guifg=fg gui=underline - hi VertSplit ctermbg=7 ctermfg=0 guibg=#304050 guifg=fg gui=none - if version >= 700 - hi Visual ctermbg=7 ctermfg=0 guibg=#607080 gui=none - else - hi Visual ctermbg=7 ctermfg=0 guibg=#607080 guifg=fg gui=none - endif - hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline - endif - hi Cursor guibg=#ffa500 guifg=bg gui=none - hi DiffAdd guibg=#008b00 guifg=fg gui=none - hi DiffChange guibg=#00008b guifg=fg gui=none - hi DiffDelete guibg=#8b0000 guifg=fg gui=none - hi DiffText guibg=#0000cd guifg=fg gui=bold - hi Directory guibg=bg guifg=#1e90ff gui=none - hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold - hi IncSearch guibg=#e0cd78 guifg=#000000 gui=none - hi ModeMsg guibg=bg guifg=fg gui=bold - hi MoreMsg guibg=bg guifg=#7ec0ee gui=bold - hi PmenuSel guibg=#e0e000 guifg=#000000 gui=none - hi Question guibg=bg guifg=#e8b87e gui=bold - hi Search guibg=#90e090 guifg=#000000 gui=none - hi SpecialKey guibg=bg guifg=#e8b87e gui=none - if has("spell") - hi SpellBad guisp=#ee2c2c gui=undercurl - hi SpellCap guisp=#2c2cee gui=undercurl - hi SpellLocal guisp=#2ceeee gui=undercurl - hi SpellRare guisp=#ee2cee gui=undercurl - endif - hi TabLineSel guibg=bg guifg=fg gui=bold - hi Title ctermbg=0 ctermfg=15 guifg=fg gui=bold - hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold - hi WildMenu guibg=#e0e000 guifg=#000000 gui=bold - - hi Comment guibg=bg guifg=#d0d0a0 gui=none - hi Constant guibg=bg guifg=#87df71 gui=none - hi Error guibg=bg guifg=#ee2c2c gui=none - hi Identifier guibg=bg guifg=#7ee0ce gui=none - hi Ignore guibg=bg guifg=bg gui=none - hi lCursor guibg=#00e700 guifg=#000000 gui=none - hi MatchParen guibg=#008b8b gui=none - hi PreProc guibg=bg guifg=#d7a0d7 gui=none - hi Special guibg=bg guifg=#e8b87e gui=none - hi Statement guibg=bg guifg=#7ec0ee gui=none - hi Todo guibg=#e0e000 guifg=#000000 gui=none - hi Type guibg=bg guifg=#f09479 gui=none - hi Underlined guibg=bg guifg=#00a0ff gui=underline - - hi htmlBold ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold - hi htmlItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=italic - hi htmlUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline - hi htmlBoldItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,italic - hi htmlBoldUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline - hi htmlBoldUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic - hi htmlUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline,italic -elseif &background == "light" - if s:moria_style == "light" - hi Normal ctermbg=15 ctermfg=0 guibg=#f0f0f0 guifg=#000000 gui=none - - hi CursorColumn guibg=#d4d4d4 gui=none - hi CursorLine guibg=#d4d4d4 gui=none - elseif s:moria_style == "white" - hi Normal ctermbg=15 ctermfg=0 guibg=#ffffff guifg=#000000 gui=none - - hi CursorColumn guibg=#dbdbdb gui=none - hi CursorLine guibg=#dbdbdb gui=none - endif - hi Cursor guibg=#883400 guifg=bg gui=none - hi DiffAdd guibg=#008b00 guifg=#ffffff gui=none - hi DiffChange guibg=#00008b guifg=#ffffff gui=none - hi DiffDelete guibg=#8b0000 guifg=#ffffff gui=none - hi DiffText guibg=#0000cd guifg=#ffffff gui=bold - hi Directory guibg=bg guifg=#0000f0 gui=none - hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold - hi FoldColumn ctermbg=bg guibg=bg guifg=#506070 gui=none - hi Folded guibg=#c5c5c5 guifg=#203040 gui=none - hi IncSearch guibg=#ffcd78 gui=none - hi LineNr guifg=#506070 gui=none - hi ModeMsg ctermbg=15 ctermfg=0 guibg=bg guifg=fg gui=bold - hi MoreMsg guibg=bg guifg=#1f3f81 gui=bold - hi NonText ctermfg=8 guibg=bg guifg=#506070 gui=bold - hi Pmenu guibg=#8a9aaa guifg=#000000 gui=none - hi PmenuSbar guibg=#708090 guifg=fg gui=none - hi PmenuSel guibg=#ffff00 guifg=#000000 gui=none - hi PmenuThumb guibg=#b0c0d0 guifg=fg gui=none - hi Question guibg=bg guifg=#813f11 gui=bold - hi Search guibg=#a0f0a0 gui=none - hi SignColumn ctermbg=bg guibg=bg guifg=#506070 gui=none - hi SpecialKey guibg=bg guifg=#912f11 gui=none - if has("spell") - hi SpellBad guisp=#ee2c2c gui=undercurl - hi SpellCap guisp=#2c2cee gui=undercurl - hi SpellLocal guisp=#008b8b gui=undercurl - hi SpellRare guisp=#ee2cee gui=undercurl - endif - hi StatusLine ctermbg=0 ctermfg=15 guibg=#a0b0c0 guifg=fg gui=bold - hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none - hi TabLine guibg=#b4c4d4 guifg=fg gui=underline - hi TabLineFill guibg=#b4c4d4 guifg=fg gui=underline - hi TabLineSel guibg=bg guifg=fg gui=bold - hi Title guifg=fg gui=bold - hi VertSplit ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none - if version >= 700 - hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 gui=none - else - hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 guifg=fg gui=none - endif - hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline - hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold - hi WildMenu guibg=#ffff00 guifg=fg gui=bold - - hi Comment guibg=bg guifg=#786000 gui=none - hi Constant guibg=bg guifg=#077807 gui=none - hi Error guibg=bg guifg=#ee2c2c gui=none - hi Identifier guibg=bg guifg=#007080 gui=none - hi Ignore guibg=bg guifg=bg gui=none - hi lCursor guibg=#008000 guifg=#ffffff gui=none - hi MatchParen guibg=#00ffff gui=none - hi PreProc guibg=bg guifg=#800090 gui=none - hi Special guibg=bg guifg=#912f11 gui=none - hi Statement guibg=bg guifg=#1f3f81 gui=bold - hi Todo guibg=#ffff00 guifg=fg gui=none - hi Type guibg=bg guifg=#912f11 gui=bold - hi Underlined guibg=bg guifg=#0000cd gui=underline - - hi htmlBold guibg=bg guifg=fg gui=bold - hi htmlItalic guibg=bg guifg=fg gui=italic - hi htmlUnderline guibg=bg guifg=fg gui=underline - hi htmlBoldItalic guibg=bg guifg=fg gui=bold,italic - hi htmlBoldUnderline guibg=bg guifg=fg gui=bold,underline - hi htmlBoldUnderlineItalic guibg=bg guifg=fg gui=bold,underline,italic - hi htmlUnderlineItalic guibg=bg guifg=fg gui=underline,italic -endif diff --git a/vim/colors/obsidian2.vim b/vim/colors/obsidian2.vim deleted file mode 100644 index ad7f64d..0000000 --- a/vim/colors/obsidian2.vim +++ /dev/null @@ -1,74 +0,0 @@ -" Vim color file -" Name: Obsidian -" Maintainer: Aydar Khabibullin -" Version: 0.5 -" Date: 01/30/2011 12:35:30 AM - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name="obsidian2" - -let s:Colors = [ -\'#a082bd','#e0e2e4','#93c763', -\'#ffcd22','#ec7600','#ff8409', -\'#e8e2b7','#d39745','#66747b', -\'#678cb1','#5899c0','#5ab9be', -\'#293134','#2f393c','#f3db2e'] - -" Syntax -execute "hi Normal guifg=" . s:Colors[1] . " guibg=" . s:Colors[12] -execute "hi Comment guifg=" . s:Colors[8] . " guibg=" . s:Colors[12] . " gui=italic" -execute "hi Conditional guifg=" . s:Colors[2] . " guibg=" . s:Colors[12] -execute "hi Constant guifg=" . s:Colors[1] . " guibg=" . s:Colors[12] -execute "hi Error guifg=" . s:Colors[7] . " guibg=" . s:Colors[12] -execute "hi Identifier guifg=" . s:Colors[9] . " guibg=" . s:Colors[12] -execute "hi Ignore guifg=" . s:Colors[1] -execute "hi Operator guifg=" . s:Colors[6] . " guibg=" . s:Colors[12] -execute "hi PreProc guifg=" . s:Colors[0] . " guibg=" . s:Colors[12] -execute "hi Repeat guifg=" . s:Colors[2] . " guibg=" . s:Colors[12] -execute "hi Special guifg=" . s:Colors[2] . " guibg=" . s:Colors[12] -execute "hi Statement guifg=" . s:Colors[2] . " guibg=" . s:Colors[12] -execute "hi Number guifg=" . s:Colors[3] . " guibg=" . s:Colors[12] -execute "hi Boolean guifg=" . s:Colors[11] . " guibg=" . s:Colors[12] -execute "hi String guifg=" . s:Colors[5] . " guibg=" . s:Colors[12] -execute "hi Character guifg=" . s:Colors[5] . " guibg=" . s:Colors[12] -execute "hi Title guifg=" . s:Colors[1] . " guibg=" . s:Colors[12] -execute "hi Todo guifg=" . s:Colors[12] . " guibg=" . s:Colors[0] . " gui=bold guisp=NONE" -execute "hi Type guifg=" . s:Colors[9] . " guibg=" . s:Colors[12] -execute "hi Underline guifg=" . s:Colors[10] . " guibg=" . s:Colors[12] - -" Groups -execute "hi Cursor guifg=" . s:Colors[8] . " guibg=" . s:Colors[4] -execute "hi CursorIM guifg=" . s:Colors[7] . " guibg=" . s:Colors[4] -execute "hi CursorLine guifg=NONE guibg=" . s:Colors[13] -execute "hi CursorColumn guifg=". s:Colors[1] . " guibg=" . s:Colors[13] -execute "hi Directory guifg=" . s:Colors[10] . " guibg=" . s:Colors[12] -execute "hi ErrorMsg guifg=" . s:Colors[13] . " guibg=" . s:Colors[7] -execute "hi FoldColumn guifg=" . s:Colors[13] . " guibg=" . s:Colors[12] -execute "hi Folded guifg=" . s:Colors[12] . " guibg=" . s:Colors[11] -execute "hi IncSearch guifg=" . s:Colors[1] . " guibg=" . s:Colors[12] . " gui=none" -execute "hi LineNr guifg=" . s:Colors[8] . " guibg=" . s:Colors[12] . " gui=none" -execute "hi MatchParen guifg=" . s:Colors[12] . " guibg=" . s:Colors[4] . " gui=bold" -execute "hi ModeMsg guifg=" . s:Colors[5] . " guibg=" . s:Colors[12] -execute "hi MoreMsg guifg=" . s:Colors[5] . " guibg=" . s:Colors[12] -execute "hi NonText guifg=" . s:Colors[1] . " guibg=" . s:Colors[12] -execute "hi Pmenu guifg=" . s:Colors[1] . " guibg=" . s:Colors[8] -execute "hi PmenuSel guifg=" . s:Colors[13] . " guibg=" . s:Colors[9] -execute "hi Question guifg=" . s:Colors[0] . " guibg=" . s:Colors[12] -execute "hi Search guifg=" . s:Colors[0] . " guibg=" . s:Colors[12] -execute "hi SpecialKey guifg=" . s:Colors[10] . " guibg=" . s:Colors[12] -execute "hi StatusLine guifg=" . s:Colors[1] . " guibg=" . s:Colors[9] . " gui=none" -execute "hi StatusLineNC guifg=" . s:Colors[1] . " guibg=" . s:Colors[8] . " gui=none" -execute "hi TabLine guifg=" . s:Colors[8] . " guibg=" . s:Colors[12] . " gui=none" -execute "hi TabLineFill guifg=" . s:Colors[12] . " guibg=" . s:Colors[13] . " gui=none" -execute "hi TabLineSel guifg=" . s:Colors[1] . " guibg=" . s:Colors[13] . " gui=none" -execute "hi Tooltip guifg=" . s:Colors[9] . " guibg=" . s:Colors[8] . " gui=none" -execute "hi VertSplit guifg=" . s:Colors[0] . " guibg=" . s:Colors[13] . " gui=none" -execute "hi Visual guifg=" . s:Colors[1] . " guibg=" . s:Colors[0] . " gui=none" -hi VisualNOS gui=none guibg=black -execute "hi WarningMsg guifg=" . s:Colors[5] . " guibg=" . s:Colors[12] . " gui=none" -execute "hi WildMenu guifg=" . s:Colors[14] . " guibg=" . s:Colors[5] . " gui=none" - diff --git a/vim/colors/oceandeep.vim b/vim/colors/oceandeep.vim deleted file mode 100644 index c19b2c0..0000000 --- a/vim/colors/oceandeep.vim +++ /dev/null @@ -1,111 +0,0 @@ -" Vim color file -" Maintainer: Tom Regner -" Last Change: 2002-12-05 -" Version: 1.1 -" URL: http://vim.sourceforge.net/script.php?script_id=368 - - -""" Init -set background=dark -highlight clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name = "oceandeep" - - -""""""""\ Colors \"""""""" - - -"""" GUI Colors - -highlight Cursor gui=None guibg=PaleTurquoise3 guifg=White -highlight CursorIM gui=bold guifg=white guibg=PaleTurquoise3 -highlight Directory guifg=LightSeaGreen guibg=bg -highlight DiffAdd gui=None guifg=fg guibg=DarkCyan -highlight DiffChange gui=None guifg=fg guibg=Green4 -highlight DiffDelete gui=None guifg=fg guibg=black -highlight DiffText gui=bold guifg=fg guibg=bg -highlight ErrorMsg guifg=LightYellow guibg=FireBrick -" previously 'FillColumn': -"highlight FillColumn gui=NONE guifg=black guibg=grey60 -highlight VertSplit gui=NONE guifg=black guibg=grey60 -highlight Folded gui=bold guibg=#305060 guifg=#b0d0e0 -highlight FoldColumn gui=bold guibg=#305060 guifg=#b0d0e0 -highlight IncSearch gui=reverse guifg=fg guibg=bg -highlight LineNr gui=bold guibg=grey6 guifg=LightSkyBlue3 -highlight ModeMsg guibg=DarkGreen guifg=LightGreen -highlight MoreMsg gui=bold guifg=SeaGreen4 guibg=bg -if version < 600 - " same as SpecialKey - highlight NonText guibg=#123A4A guifg=#3D5D6D -else - " Bottom fill (use e.g. same as LineNr) - highlight NonText gui=None guibg=#103040 guifg=LightSkyBlue -endif -highlight Normal gui=None guibg=#103040 guifg=honeydew2 -highlight Question gui=bold guifg=SeaGreen2 guibg=bg -highlight Search gui=NONE guibg=LightSkyBlue4 guifg=NONE -highlight SpecialKey guibg=#103040 guifg=#324262 -highlight StatusLine gui=bold guibg=grey88 guifg=black -highlight StatusLineNC gui=NONE guibg=grey60 guifg=grey10 -highlight Title gui=bold guifg=MediumOrchid1 guibg=bg -highlight Visual gui=reverse guibg=WHITE guifg=SeaGreen -highlight VisualNOS gui=bold,underline guifg=fg guibg=bg -highlight WarningMsg gui=bold guifg=FireBrick1 guibg=bg -highlight WildMenu gui=bold guibg=Chartreuse guifg=Black - - -"""" Syntax Colors - -"highlight Comment gui=reverse guifg=#507080 -highlight Comment gui=None guifg=#507080 - -highlight Constant guifg=cyan3 guibg=bg -hi String gui=None guifg=turquoise2 guibg=bg - "hi Character gui=None guifg=Cyan guibg=bg - highlight Number gui=None guifg=Cyan guibg=bg - highlight Boolean gui=bold guifg=Cyan guibg=bg - "hi Float gui=None guifg=Cyan guibg=bg - -highlight Identifier guifg=LightSkyBlue3 -hi Function gui=None guifg=DarkSeaGreen3 guibg=bg - -highlight Statement gui=NONE guifg=LightGreen - highlight Conditional gui=None guifg=LightGreen guibg=bg - highlight Repeat gui=None guifg=SeaGreen2 guibg=bg - "hi Label gui=None guifg=LightGreen guibg=bg - highlight Operator gui=None guifg=Chartreuse guibg=bg - highlight Keyword gui=bold guifg=LightGreen guibg=bg - highlight Exception gui=bold guifg=LightGreen guibg=bg - -highlight PreProc guifg=SkyBlue1 -hi Include gui=None guifg=LightSteelBlue3 guibg=bg -hi Define gui=None guifg=LightSteelBlue2 guibg=bg -hi Macro gui=None guifg=LightSkyBlue3 guibg=bg -hi PreCondit gui=None guifg=LightSkyBlue2 guibg=bg - -highlight Type gui=NONE guifg=LightBlue -hi StorageClass gui=None guifg=LightBlue guibg=bg -hi Structure gui=None guifg=LightBlue guibg=bg -hi Typedef gui=None guifg=LightBlue guibg=bg - -highlight Special gui=bold guifg=aquamarine3 - "hi SpecialChar gui=bold guifg=White guibg=bg - "hi Tag gui=bold guifg=White guibg=bg - "hi Delimiter gui=bold guifg=White guibg=bg - "hi SpecialComment gui=bold guifg=White guibg=bg - "hi Debug gui=bold guifg=White guibg=bg - -highlight Underlined gui=underline guifg=honeydew4 guibg=bg - -highlight Ignore guifg=#204050 - -highlight Error guifg=LightYellow guibg=FireBrick - -highlight Todo guifg=Cyan guibg=#507080 - -""" OLD COLORS - - - diff --git a/vim/colors/peaksea.vim b/vim/colors/peaksea.vim deleted file mode 100644 index 2466360..0000000 --- a/vim/colors/peaksea.vim +++ /dev/null @@ -1,601 +0,0 @@ -" Vim color file --- psc (peak sea color) "Lite version" -" Maintainer: Pan, Shi Zhu -" URL: http://vim.sourceforge.net/scripts/script.php?script_id=760 -" Last Change: 5 Feb 2010 -" Version: 3.4 -" -" Comments and e-mails are welcomed, thanks. -" -" The peaksea color is simply a colorscheme with the default settings of -" the original ps_color. Lite version means there's no custom settings -" and fancy features such as integration with reloaded.vim -" -" The full version of ps_color.vim will be maintained until Vim 8. -" By then there will be only the lite version: peaksea.vim -" -" Note: Please set the background option in your .vimrc and/or .gvimrc -" -" It is much better *not* to set 'background' option inside -" a colorscheme file. because ":set background" improperly -" may cause colorscheme be sourced twice -" -" Color Scheme Overview: -" :ru syntax/hitest.vim -" -" Relevant Help: -" :h highlight-groups -" :h psc-cterm-color-table -" -" Colors Order: -" #rrggbb -" - -hi clear - -if exists("syntax_on") - syntax reset -endif - -let g:colors_name = expand(":t:r") - -" I don't want to abuse folding, but here folding is used to avoid confusion. -if &background=='light' - " for background=light {{{2 - " LIGHT COLOR DEFINE START - - hi Normal guifg=#000000 guibg=#e0e0e0 gui=NONE - hi Search guifg=NONE guibg=#f8f8f8 gui=NONE - hi Visual guifg=NONE guibg=#a6caf0 gui=NONE - hi Cursor guifg=#f0f0f0 guibg=#008000 gui=NONE - " The idea of CursorIM is pretty good, however, the feature is still buggy - " in the current version (Vim 7.0). - " The following line will be kept commented until the bug fixed. - " - " hi CursorIM guifg=#f0f0f0 guibg=#800080 - hi Special guifg=#907000 guibg=NONE gui=NONE - hi Comment guifg=#606000 guibg=NONE gui=NONE - hi Number guifg=#907000 guibg=NONE gui=NONE - hi Constant guifg=#007068 guibg=NONE gui=NONE - hi StatusLine guifg=fg guibg=#a6caf0 gui=NONE - hi LineNr guifg=#686868 guibg=NONE gui=NONE - hi Question guifg=fg guibg=#d0d090 gui=NONE - hi PreProc guifg=#009030 guibg=NONE gui=NONE - hi Statement guifg=#2060a8 guibg=NONE gui=NONE - hi Type guifg=#0850a0 guibg=NONE gui=NONE - hi Todo guifg=#800000 guibg=#e0e090 gui=NONE - " NOTE THIS IS IN THE WARM SECTION - hi Error guifg=#c03000 guibg=NONE gui=NONE - hi Identifier guifg=#a030a0 guibg=NONE gui=NONE - hi ModeMsg guifg=fg guibg=#b0b0e0 gui=NONE - hi VisualNOS guifg=fg guibg=#b0b0e0 gui=NONE - hi SpecialKey guifg=#1050a0 guibg=NONE gui=NONE - hi NonText guifg=#002090 guibg=#d0d0d0 gui=NONE - hi Directory guifg=#a030a0 guibg=NONE gui=NONE - hi ErrorMsg guifg=fg guibg=#f0b090 gui=NONE - hi MoreMsg guifg=#489000 guibg=NONE gui=NONE - hi Title guifg=#a030a0 guibg=NONE gui=NONE - hi WarningMsg guifg=#b02000 guibg=NONE gui=NONE - hi WildMenu guifg=fg guibg=#d0d090 gui=NONE - hi Folded guifg=NONE guibg=#b0e0b0 gui=NONE - hi FoldColumn guifg=fg guibg=#90e090 gui=NONE - hi DiffAdd guifg=NONE guibg=#b0b0e0 gui=NONE - hi DiffChange guifg=NONE guibg=#e0b0e0 gui=NONE - hi DiffDelete guifg=#002090 guibg=#d0d0d0 gui=NONE - hi DiffText guifg=NONE guibg=#c0e080 gui=NONE - hi SignColumn guifg=fg guibg=#90e090 gui=NONE - - hi IncSearch guifg=#f0f0f0 guibg=#806060 gui=NONE - hi StatusLineNC guifg=fg guibg=#c0c0c0 gui=NONE - hi VertSplit guifg=fg guibg=#c0c0c0 gui=NONE - hi Underlined guifg=#6a5acd guibg=NONE gui=underline - hi Ignore guifg=bg guibg=NONE - " NOTE THIS IS IN THE WARM SECTION - if v:version >= 700 - if has('spell') - hi SpellBad guifg=NONE guibg=NONE guisp=#c03000 - hi SpellCap guifg=NONE guibg=NONE guisp=#2060a8 - hi SpellRare guifg=NONE guibg=NONE guisp=#a030a0 - hi SpellLocal guifg=NONE guibg=NONE guisp=#007068 - endif - hi Pmenu guifg=fg guibg=#e0b0e0 - hi PmenuSel guifg=#f0f0f0 guibg=#806060 gui=NONE - hi PmenuSbar guifg=fg guibg=#c0c0c0 gui=NONE - hi PmenuThumb guifg=fg guibg=#c0e080 gui=NONE - hi TabLine guifg=fg guibg=#c0c0c0 gui=NONE - hi TabLineFill guifg=fg guibg=#c0c0c0 gui=NONE - hi TabLineSel guifg=fg guibg=NONE gui=NONE - hi CursorColumn guifg=NONE guibg=#f0b090 - hi CursorLine guifg=NONE guibg=NONE gui=underline - hi MatchParen guifg=NONE guibg=#c0e080 - endif - - " LIGHT COLOR DEFINE END - - " Vim 7 added stuffs - if v:version >= 700 - hi Ignore gui=NONE - - " the gui=undercurl guisp could only support in Vim 7 - if has('spell') - hi SpellBad gui=undercurl - hi SpellCap gui=undercurl - hi SpellRare gui=undercurl - hi SpellLocal gui=undercurl - endif - hi TabLine gui=underline - hi TabLineFill gui=underline - hi CursorLine gui=underline - endif - - " For reversed stuffs, clear the reversed prop and set the bold prop again - hi IncSearch gui=bold - hi StatusLine gui=bold - hi StatusLineNC gui=bold - hi VertSplit gui=bold - hi Visual gui=bold - - " Enable the bold property - hi Question gui=bold - hi DiffText gui=bold - hi Statement gui=bold - hi Type gui=bold - hi MoreMsg gui=bold - hi ModeMsg gui=bold - hi NonText gui=bold - hi Title gui=bold - hi DiffDelete gui=bold - hi TabLineSel gui=bold - - " gui define for background=light end here - - " generally, a dumb terminal is dark, we assume the light terminal has 256 - " color support. - if &t_Co==8 || &t_Co==16 - set t_Co=256 - endif - if &t_Co==256 - " 256color light terminal support here - - hi Normal ctermfg=16 ctermbg=254 cterm=NONE - " Comment/Uncomment the following line to disable/enable transparency - "hi Normal ctermfg=16 ctermbg=NONE cterm=NONE - hi Search ctermfg=NONE ctermbg=231 cterm=NONE - hi Visual ctermfg=NONE ctermbg=153 cterm=NONE - hi Cursor ctermfg=255 ctermbg=28 cterm=NONE - " hi CursorIM ctermfg=255 ctermbg=90 - hi Special ctermfg=94 ctermbg=NONE cterm=NONE - hi Comment ctermfg=58 ctermbg=NONE cterm=NONE - hi Number ctermfg=94 ctermbg=NONE cterm=NONE - hi Constant ctermfg=23 ctermbg=NONE cterm=NONE - hi StatusLine ctermfg=fg ctermbg=153 cterm=NONE - hi LineNr ctermfg=242 ctermbg=NONE cterm=NONE - hi Question ctermfg=fg ctermbg=186 cterm=NONE - hi PreProc ctermfg=29 ctermbg=NONE cterm=NONE - hi Statement ctermfg=25 ctermbg=NONE cterm=NONE - hi Type ctermfg=25 ctermbg=NONE cterm=NONE - hi Todo ctermfg=88 ctermbg=186 cterm=NONE - " NOTE THIS IS IN THE WARM SECTION - hi Error ctermfg=130 ctermbg=NONE cterm=NONE - hi Identifier ctermfg=133 ctermbg=NONE cterm=NONE - hi ModeMsg ctermfg=fg ctermbg=146 cterm=NONE - hi VisualNOS ctermfg=fg ctermbg=146 cterm=NONE - hi SpecialKey ctermfg=25 ctermbg=NONE cterm=NONE - hi NonText ctermfg=18 ctermbg=252 cterm=NONE - " Comment/Uncomment the following line to disable/enable transparency - "hi NonText ctermfg=18 ctermbg=NONE cterm=NONE - hi Directory ctermfg=133 ctermbg=NONE cterm=NONE - hi ErrorMsg ctermfg=fg ctermbg=216 cterm=NONE - hi MoreMsg ctermfg=64 ctermbg=NONE cterm=NONE - hi Title ctermfg=133 ctermbg=NONE cterm=NONE - hi WarningMsg ctermfg=124 ctermbg=NONE cterm=NONE - hi WildMenu ctermfg=fg ctermbg=186 cterm=NONE - hi Folded ctermfg=NONE ctermbg=151 cterm=NONE - hi FoldColumn ctermfg=fg ctermbg=114 cterm=NONE - hi DiffAdd ctermfg=NONE ctermbg=146 cterm=NONE - hi DiffChange ctermfg=NONE ctermbg=182 cterm=NONE - hi DiffDelete ctermfg=18 ctermbg=252 cterm=NONE - hi DiffText ctermfg=NONE ctermbg=150 cterm=NONE - hi SignColumn ctermfg=fg ctermbg=114 cterm=NONE - - hi IncSearch ctermfg=255 ctermbg=95 cterm=NONE - hi StatusLineNC ctermfg=fg ctermbg=250 cterm=NONE - hi VertSplit ctermfg=fg ctermbg=250 cterm=NONE - hi Underlined ctermfg=62 ctermbg=NONE cterm=underline - hi Ignore ctermfg=bg ctermbg=NONE - " NOTE THIS IS IN THE WARM SECTION - if v:version >= 700 - if has('spell') - if 0 - " ctermsp is not supported in Vim7, we ignore it. - hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=130 - hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=25 - hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=133 - hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=23 - else - hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE - endif - endif - hi Pmenu ctermfg=fg ctermbg=182 - hi PmenuSel ctermfg=255 ctermbg=95 cterm=NONE - hi PmenuSbar ctermfg=fg ctermbg=250 cterm=NONE - hi PmenuThumb ctermfg=fg ctermbg=150 cterm=NONE - hi TabLine ctermfg=fg ctermbg=250 cterm=NONE - hi TabLineFill ctermfg=fg ctermbg=250 cterm=NONE - hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE - hi CursorColumn ctermfg=NONE ctermbg=216 - hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline - hi MatchParen ctermfg=NONE ctermbg=150 - endif - - hi TabLine cterm=underline - hi TabLineFill cterm=underline - hi CursorLine cterm=underline - - " For reversed stuffs, clear the reversed prop and set the bold prop again - hi IncSearch cterm=bold - hi StatusLine cterm=bold - hi StatusLineNC cterm=bold - hi VertSplit cterm=bold - hi Visual cterm=bold - - hi NonText cterm=bold - hi Question cterm=bold - hi Title cterm=bold - hi DiffDelete cterm=bold - hi DiffText cterm=bold - hi Statement cterm=bold - hi Type cterm=bold - hi MoreMsg cterm=bold - hi ModeMsg cterm=bold - hi TabLineSel cterm=bold - - "hi lCursor ctermfg=bg ctermbg=fg cterm=NONE - endif " t_Co==256 - " }}}2 -elseif &background=='dark' - " for background=dark {{{2 - " DARK COLOR DEFINE START - - hi Normal guifg=#d0d0d0 guibg=#202020 gui=NONE - hi Comment guifg=#d0d090 guibg=NONE gui=NONE - hi Constant guifg=#80c0e0 guibg=NONE gui=NONE - hi Number guifg=#e0c060 guibg=NONE gui=NONE - hi Identifier guifg=#f0c0f0 guibg=NONE gui=NONE - hi Statement guifg=#c0d8f8 guibg=NONE gui=NONE - hi PreProc guifg=#60f080 guibg=NONE gui=NONE - hi Type guifg=#b0d0f0 guibg=NONE gui=NONE - hi Special guifg=#e0c060 guibg=NONE gui=NONE - hi Error guifg=#f08060 guibg=NONE gui=NONE - hi Todo guifg=#800000 guibg=#d0d090 gui=NONE - hi Search guifg=NONE guibg=#800000 gui=NONE - hi Visual guifg=#000000 guibg=#a6caf0 gui=NONE - hi Cursor guifg=#000000 guibg=#00f000 gui=NONE - " NOTE THIS IS IN THE COOL SECTION - " hi CursorIM guifg=#000000 guibg=#f000f0 gui=NONE - hi StatusLine guifg=#000000 guibg=#a6caf0 gui=NONE - hi LineNr guifg=#b0b0b0 guibg=NONE gui=NONE - hi Question guifg=#000000 guibg=#d0d090 gui=NONE - hi ModeMsg guifg=fg guibg=#000080 gui=NONE - hi VisualNOS guifg=fg guibg=#000080 gui=NONE - hi SpecialKey guifg=#b0d0f0 guibg=NONE gui=NONE - hi NonText guifg=#6080f0 guibg=#101010 gui=NONE - hi Directory guifg=#80c0e0 guibg=NONE gui=NONE - hi ErrorMsg guifg=#d0d090 guibg=#800000 gui=NONE - hi MoreMsg guifg=#c0e080 guibg=NONE gui=NONE - hi Title guifg=#f0c0f0 guibg=NONE gui=NONE - hi WarningMsg guifg=#f08060 guibg=NONE gui=NONE - hi WildMenu guifg=#000000 guibg=#d0d090 gui=NONE - hi Folded guifg=NONE guibg=#004000 gui=NONE - hi FoldColumn guifg=#e0e0e0 guibg=#008000 gui=NONE - hi DiffAdd guifg=NONE guibg=#000080 gui=NONE - hi DiffChange guifg=NONE guibg=#800080 gui=NONE - hi DiffDelete guifg=#6080f0 guibg=#202020 gui=NONE - hi DiffText guifg=#000000 guibg=#c0e080 gui=NONE - hi SignColumn guifg=#e0e0e0 guibg=#008000 gui=NONE - hi IncSearch guifg=#000000 guibg=#d0d0d0 gui=NONE - hi StatusLineNC guifg=#000000 guibg=#c0c0c0 gui=NONE - hi VertSplit guifg=#000000 guibg=#c0c0c0 gui=NONE - hi Underlined guifg=#80a0ff guibg=NONE gui=underline - hi Ignore guifg=#000000 guibg=NONE - " NOTE THIS IS IN THE COOL SECTION - if v:version >= 700 - if has('spell') - " the guisp= could only support in Vim 7 - hi SpellBad guifg=NONE guibg=NONE guisp=#f08060 - hi SpellCap guifg=NONE guibg=NONE guisp=#6080f0 - hi SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0 - hi SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8 - endif - hi Pmenu guifg=fg guibg=#800080 - hi PmenuSel guifg=#000000 guibg=#d0d0d0 gui=NONE - hi PmenuSbar guifg=fg guibg=#000080 gui=NONE - hi PmenuThumb guifg=fg guibg=#008000 gui=NONE - hi TabLine guifg=fg guibg=#008000 gui=NONE - hi TabLineFill guifg=fg guibg=#008000 gui=NONE - hi TabLineSel guifg=fg guibg=NONE gui=NONE - hi CursorColumn guifg=NONE guibg=#800000 gui=NONE - hi CursorLine guifg=NONE guibg=NONE gui=underline - hi MatchParen guifg=NONE guibg=#800080 - endif - - " DARK COLOR DEFINE END - - " Vim 7 added stuffs - if v:version >= 700 - hi Ignore gui=NONE - - " the gui=undercurl could only support in Vim 7 - if has('spell') - hi SpellBad gui=undercurl - hi SpellCap gui=undercurl - hi SpellRare gui=undercurl - hi SpellLocal gui=undercurl - endif - hi TabLine gui=underline - hi TabLineFill gui=underline - hi Underlined gui=underline - hi CursorLine gui=underline - endif - - " gui define for background=dark end here - - if &t_Co==8 || &t_Co==16 - " for 8-color and 16-color term - hi Normal ctermfg=LightGrey ctermbg=Black - hi Special ctermfg=Yellow ctermbg=bg - hi Comment ctermfg=DarkYellow ctermbg=bg - hi Constant ctermfg=Blue ctermbg=bg - hi Number ctermfg=Yellow ctermbg=bg - hi LineNr ctermfg=DarkGrey ctermbg=bg - hi PreProc ctermfg=Green ctermbg=bg - hi Statement ctermfg=Cyan ctermbg=bg - hi Type ctermfg=Cyan ctermbg=bg - hi Error ctermfg=Red ctermbg=bg - hi Identifier ctermfg=Magenta ctermbg=bg - hi SpecialKey ctermfg=Cyan ctermbg=bg - hi NonText ctermfg=Blue ctermbg=bg - hi Directory ctermfg=Blue ctermbg=bg - hi MoreMsg ctermfg=Green ctermbg=bg - hi Title ctermfg=Magenta ctermbg=bg - hi WarningMsg ctermfg=Red ctermbg=bg - hi DiffDelete ctermfg=Blue ctermbg=bg - - hi Search ctermfg=NONE ctermbg=DarkRed - hi Visual ctermfg=Black ctermbg=DarkCyan - hi Cursor ctermfg=Black ctermbg=Green - hi StatusLine ctermfg=Black ctermbg=DarkCyan - hi Question ctermfg=Black ctermbg=DarkYellow - hi Todo ctermfg=DarkRed ctermbg=DarkYellow - hi Folded ctermfg=White ctermbg=DarkGreen - hi ModeMsg ctermfg=Grey ctermbg=DarkBlue - hi VisualNOS ctermfg=Grey ctermbg=DarkBlue - hi ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed - hi WildMenu ctermfg=Black ctermbg=DarkYellow - hi FoldColumn ctermfg=White ctermbg=DarkGreen - hi SignColumn ctermfg=White ctermbg=DarkGreen - hi DiffText ctermfg=Black ctermbg=DarkYellow - - if v:version >= 700 - if has('spell') - hi SpellBad ctermfg=NONE ctermbg=DarkRed - hi SpellCap ctermfg=NONE ctermbg=DarkBlue - hi SpellRare ctermfg=NONE ctermbg=DarkMagenta - hi SpellLocal ctermfg=NONE ctermbg=DarkGreen - endif - hi Pmenu ctermfg=fg ctermbg=DarkMagenta - hi PmenuSel ctermfg=Black ctermbg=fg - hi PmenuSbar ctermfg=fg ctermbg=DarkBlue - hi PmenuThumb ctermfg=fg ctermbg=DarkGreen - hi TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline - hi TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline - hi CursorColumn ctermfg=NONE ctermbg=DarkRed - - hi TabLineSel ctermfg=fg ctermbg=bg - hi CursorLine ctermfg=NONE ctermbg=bg cterm=underline - - hi MatchParen ctermfg=NONE ctermbg=DarkMagenta - endif - if &t_Co==8 - " 8 colour terminal support, this assumes 16 colour is available through - " setting the 'bold' attribute, will get bright foreground colour. - " However, the bright background color is not available for 8-color terms. - " - " You can manually set t_Co=16 in your .vimrc to see if your terminal - " supports 16 colours, - hi DiffText cterm=none - hi Visual cterm=none - hi Cursor cterm=none - hi Comment cterm=none - hi Todo cterm=none - hi StatusLine cterm=none - hi Question cterm=none - hi DiffChange cterm=none - hi ModeMsg cterm=none - hi VisualNOS cterm=none - hi ErrorMsg cterm=none - hi WildMenu cterm=none - hi DiffAdd cterm=none - hi Folded cterm=none - hi DiffDelete cterm=none - hi Normal cterm=none - hi PmenuThumb cterm=none - hi Search cterm=bold - hi Special cterm=bold - hi Constant cterm=bold - hi Number cterm=bold - hi LineNr cterm=bold - hi PreProc cterm=bold - hi Statement cterm=bold - hi Type cterm=bold - hi Error cterm=bold - hi Identifier cterm=bold - hi SpecialKey cterm=bold - hi NonText cterm=bold - hi MoreMsg cterm=bold - hi Title cterm=bold - hi WarningMsg cterm=bold - hi FoldColumn cterm=bold - hi SignColumn cterm=bold - hi Directory cterm=bold - hi DiffDelete cterm=bold - else - " Background > 7 is only available with 16 or more colors - - hi WarningMsg cterm=none - hi Search cterm=none - hi Visual cterm=none - hi Cursor cterm=none - hi Special cterm=none - hi Comment cterm=none - hi Constant cterm=none - hi Number cterm=none - hi LineNr cterm=none - hi PreProc cterm=none - hi Todo cterm=none - hi Error cterm=none - hi Identifier cterm=none - hi Folded cterm=none - hi SpecialKey cterm=none - hi Directory cterm=none - hi ErrorMsg cterm=none - hi Normal cterm=none - hi PmenuThumb cterm=none - hi WildMenu cterm=none - hi FoldColumn cterm=none - hi SignColumn cterm=none - hi DiffAdd cterm=none - hi DiffChange cterm=none - hi Question cterm=none - hi StatusLine cterm=none - hi DiffText cterm=none - hi IncSearch cterm=reverse - hi StatusLineNC cterm=reverse - hi VertSplit cterm=reverse - - " Well, well, bold font with color 0-7 is not possible. - " So, the Question, StatusLine, DiffText cannot act as expected. - - hi Statement cterm=none - hi Type cterm=none - hi MoreMsg cterm=none - hi ModeMsg cterm=none - hi NonText cterm=none - hi Title cterm=none - hi VisualNOS cterm=none - hi DiffDelete cterm=none - hi TabLineSel cterm=none - - endif - elseif &t_Co==256 - " 256color dark terminal support here - hi Normal ctermfg=252 ctermbg=234 cterm=NONE - " Comment/Uncomment the following line to disable/enable transparency - "hi Normal ctermfg=252 ctermbg=NONE cterm=NONE - hi Comment ctermfg=186 ctermbg=NONE cterm=NONE - hi Constant ctermfg=110 ctermbg=NONE cterm=NONE - hi Number ctermfg=179 ctermbg=NONE cterm=NONE - hi Identifier ctermfg=219 ctermbg=NONE cterm=NONE - hi Statement ctermfg=153 ctermbg=NONE cterm=NONE - hi PreProc ctermfg=84 ctermbg=NONE cterm=NONE - hi Type ctermfg=153 ctermbg=NONE cterm=NONE - hi Special ctermfg=179 ctermbg=NONE cterm=NONE - hi Error ctermfg=209 ctermbg=NONE cterm=NONE - hi Todo ctermfg=88 ctermbg=186 cterm=NONE - hi Search ctermfg=NONE ctermbg=88 cterm=NONE - hi Visual ctermfg=16 ctermbg=153 cterm=NONE - hi Cursor ctermfg=16 ctermbg=46 cterm=NONE - " NOTE THIS IS IN THE COOL SECTION - " hi CursorIM ctermfg=16 ctermbg=201 cterm=NONE - hi StatusLine ctermfg=16 ctermbg=153 cterm=NONE - hi LineNr ctermfg=249 ctermbg=NONE cterm=NONE - hi Question ctermfg=16 ctermbg=186 cterm=NONE - hi ModeMsg ctermfg=fg ctermbg=18 cterm=NONE - hi VisualNOS ctermfg=fg ctermbg=18 cterm=NONE - hi SpecialKey ctermfg=153 ctermbg=NONE cterm=NONE - hi NonText ctermfg=69 ctermbg=233 cterm=NONE - " Comment/Uncomment the following line to disable/enable transparency - "hi NonText ctermfg=69 ctermbg=NONE cterm=NONE - hi Directory ctermfg=110 ctermbg=NONE cterm=NONE - hi ErrorMsg ctermfg=186 ctermbg=88 cterm=NONE - hi MoreMsg ctermfg=150 ctermbg=NONE cterm=NONE - hi Title ctermfg=219 ctermbg=NONE cterm=NONE - hi WarningMsg ctermfg=209 ctermbg=NONE cterm=NONE - hi WildMenu ctermfg=16 ctermbg=186 cterm=NONE - hi Folded ctermfg=NONE ctermbg=22 cterm=NONE - hi FoldColumn ctermfg=254 ctermbg=28 cterm=NONE - hi DiffAdd ctermfg=NONE ctermbg=18 cterm=NONE - hi DiffChange ctermfg=NONE ctermbg=90 cterm=NONE - hi DiffDelete ctermfg=69 ctermbg=234 cterm=NONE - hi DiffText ctermfg=16 ctermbg=150 cterm=NONE - hi SignColumn ctermfg=254 ctermbg=28 cterm=NONE - hi IncSearch ctermfg=16 ctermbg=252 cterm=NONE - hi StatusLineNC ctermfg=16 ctermbg=250 cterm=NONE - hi VertSplit ctermfg=16 ctermbg=250 cterm=NONE - hi Underlined ctermfg=111 ctermbg=NONE cterm=underline - hi Ignore ctermfg=16 ctermbg=NONE - " NOTE THIS IS IN THE COOL SECTION - if v:version >= 700 - if has('spell') - " the ctermsp= is not supported in Vim 7 we simply ignored - if 0 - hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=209 - hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=69 - hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=219 - hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=153 - else - hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE - hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE - endif - endif - hi Pmenu ctermfg=fg ctermbg=90 - hi PmenuSel ctermfg=16 ctermbg=252 cterm=NONE - hi PmenuSbar ctermfg=fg ctermbg=18 cterm=NONE - hi PmenuThumb ctermfg=fg ctermbg=28 cterm=NONE - hi TabLine ctermfg=fg ctermbg=28 cterm=NONE - hi TabLineFill ctermfg=fg ctermbg=28 cterm=NONE - hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE - hi CursorColumn ctermfg=NONE ctermbg=88 cterm=NONE - hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline - hi MatchParen ctermfg=NONE ctermbg=90 - hi TabLine cterm=underline - hi TabLineFill cterm=underline - hi Underlined cterm=underline - hi CursorLine cterm=underline - endif - - endif " t_Co - - " }}}2 -endif - -" Links: -" -" COLOR LINKS DEFINE START - -hi link String Constant -" Character must be different from strings because in many languages -" (especially C, C++) a 'char' variable is scalar while 'string' is pointer, -" mistaken a 'char' for a 'string' will cause disaster! -hi link Character Number -hi link SpecialChar LineNr -hi link Tag Identifier -hi link cCppOut LineNr -" The following are not standard hi links, -" these are used by DrChip -hi link Warning MoreMsg -hi link Notice Constant -" these are used by Calendar -hi link CalToday PreProc -" these are used by TagList -hi link MyTagListTagName IncSearch -hi link MyTagListTagScope Constant - -" COLOR LINKS DEFINE END - -" vim:et:nosta:sw=2:ts=8: -" vim600:fdm=marker:fdl=1: diff --git a/vim/colors/railscasts.vim b/vim/colors/railscasts.vim deleted file mode 100644 index 2055b41..0000000 --- a/vim/colors/railscasts.vim +++ /dev/null @@ -1,96 +0,0 @@ -" Vim color scheme -" -" Name: railscasts.vim -" Maintainer: Nick Moffitt -" Last Change: 01 Mar 2008 -" License: WTFPL -" Version: 2.1 -" -" This theme is based on Josh O'Rourke's Vim clone of the railscast -" textmate theme. The key thing I have done here is supply 256-color -" terminal equivalents for as many of the colors as possible, and fixed -" up some of the funny behaviors for editing e-mails and such. -" -" To use for gvim: -" 1: install this file as ~/.vim/colors/railscasts.vim -" 2: put "colorscheme railscasts" in your .gvimrc -" -" If you are using Ubuntu, you can get the benefit of this in your -" terminals using ordinary vim by taking the following steps: -" -" 1: sudo apt-get install ncurses-term -" 2: put the following in your .vimrc -" if $COLORTERM == 'gnome-terminal' -" set term=gnome-256color -" colorscheme railscasts -" else -" colorscheme default -" endif -" 3: if you wish to use this with screen, add the following to your .screenrc: -" attrcolor b ".I" -" termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' -" defbce "on" -" term screen-256color-bce - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif - -let g:colors_name = "railscasts" - -hi link htmlTag xmlTag -hi link htmlTagName xmlTagName -hi link htmlEndTag xmlEndTag - -highlight Normal guifg=#E6E1DC guibg=#111111 -highlight Cursor guifg=#000000 ctermfg=0 guibg=#FFFFFF ctermbg=15 -highlight CursorLine guibg=#000000 ctermbg=233 cterm=NONE - -highlight Comment guifg=#BC9458 ctermfg=180 gui=italic -highlight Constant guifg=#6D9CBE ctermfg=73 -highlight Define guifg=#CC7833 ctermfg=173 -highlight Error guifg=#FFC66D ctermfg=221 guibg=#990000 ctermbg=88 -highlight Function guifg=#FFC66D ctermfg=221 gui=NONE cterm=NONE -highlight Identifier guifg=#6D9CBE ctermfg=73 gui=NONE cterm=NONE -highlight Include guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight PreCondit guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight Keyword guifg=#CC7833 ctermfg=173 cterm=NONE -highlight LineNr guifg=#2B2B2B ctermfg=159 guibg=#C0C0FF -highlight Number guifg=#A5C261 ctermfg=107 -highlight PreProc guifg=#E6E1DC ctermfg=103 -highlight Search guifg=NONE ctermfg=NONE guibg=#2b2b2b ctermbg=235 gui=italic cterm=underline -highlight Statement guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight String guifg=#A5C261 ctermfg=107 -highlight Title guifg=#FFFFFF ctermfg=15 -highlight Type guifg=#DA4939 ctermfg=167 gui=NONE cterm=NONE -highlight Visual guibg=#5A647E ctermbg=60 - -highlight DiffAdd guifg=#E6E1DC ctermfg=7 guibg=#519F50 ctermbg=71 -highlight DiffDelete guifg=#E6E1DC ctermfg=7 guibg=#660000 ctermbg=52 -highlight Special guifg=#DA4939 ctermfg=167 - -highlight pythonBuiltin guifg=#6D9CBE ctermfg=73 gui=NONE cterm=NONE -highlight rubyBlockParameter guifg=#FFFFFF ctermfg=15 -highlight rubyClass guifg=#FFFFFF ctermfg=15 -highlight rubyConstant guifg=#DA4939 ctermfg=167 -highlight rubyInstanceVariable guifg=#D0D0FF ctermfg=189 -highlight rubyInterpolation guifg=#519F50 ctermfg=107 -highlight rubyLocalVariableOrMethod guifg=#D0D0FF ctermfg=189 -highlight rubyPredefinedConstant guifg=#DA4939 ctermfg=167 -highlight rubyPseudoVariable guifg=#FFC66D ctermfg=221 -highlight rubyStringDelimiter guifg=#A5C261 ctermfg=143 - -highlight xmlTag guifg=#E8BF6A ctermfg=179 -highlight xmlTagName guifg=#E8BF6A ctermfg=179 -highlight xmlEndTag guifg=#E8BF6A ctermfg=179 - -highlight mailSubject guifg=#A5C261 ctermfg=107 -highlight mailHeaderKey guifg=#FFC66D ctermfg=221 -highlight mailEmail guifg=#A5C261 ctermfg=107 gui=italic cterm=underline - -highlight SpellBad guifg=#D70000 ctermfg=160 ctermbg=NONE cterm=underline -highlight SpellRare guifg=#D75F87 ctermfg=168 guibg=NONE ctermbg=NONE gui=underline cterm=underline -highlight SpellCap guifg=#D0D0FF ctermfg=189 guibg=NONE ctermbg=NONE gui=underline cterm=underline -highlight MatchParen guifg=#FFFFFF ctermfg=15 guibg=#005f5f ctermbg=23 diff --git a/vim/colors/solarized.vim b/vim/colors/solarized.vim deleted file mode 100644 index ee46b17..0000000 --- a/vim/colors/solarized.vim +++ /dev/null @@ -1,969 +0,0 @@ -" Name: Solarized vim colorscheme -" Author: Ethan Schoonover -" URL: http://ethanschoonover.com/solarized -" (see this url for latest release & screenshots) -" License: OSI approved MIT license (see end of this file) -" Created: In the middle of the night -" Modified: 2011 Apr 14 -" -" Usage "{{{ -" -" --------------------------------------------------------------------- -" ABOUT: -" --------------------------------------------------------------------- -" Solarized is a carefully designed selective contrast colorscheme with dual -" light and dark modes that runs in both GUI, 256 and 16 color modes. -" -" See the homepage above for screenshots and details. -" -" --------------------------------------------------------------------- -" INSTALLATION: -" --------------------------------------------------------------------- -" -" Two options for installation: manual or pathogen -" -" MANUAL INSTALLATION OPTION: -" --------------------------------------------------------------------- -" -" 1. Put the files in the right place! -" 2. Move `solarized.vim` to your `.vim/colors` directory. -" -" RECOMMENDED PATHOGEN INSTALLATION OPTION: -" --------------------------------------------------------------------- -" -" 1. Download and install Tim Pope's Pathogen from: -" https://github.com/tpope/vim-pathogen -" -" 2. Next, move or clone the `vim-colors-solarized` directory so that it is -" a subdirectory of the `.vim/bundle` directory. -" -" a. **clone with git:** -" -" $ cd ~/.vim/bundle -" $ git clone git://github.com/altercation/vim-colors-solarized.git -" -" b. **or move manually into the pathogen bundle directory:** -" In the parent directory of vim-colors-solarized: -" -" $ mv vim-colors-solarized ~/.vim/bundle/ -" -" MODIFY VIMRC: -" -" After either Option 1 or Option 2 above, put the following two lines in your -" .vimrc: -" -" syntax enable -" set background=dark -" colorscheme solarized -" -" or, for the light background mode of Solarized: -" -" syntax enable -" set background=light -" colorscheme solarized -" -" I like to have a different background in GUI and terminal modes, so I can use -" the following if-then. However, I find vim's background autodetection to be -" pretty good and, at least with MacVim, I can leave this background value -" assignment out entirely and get the same results. -" -" if has('gui_running') -" set background=light -" else -" set background=dark -" endif -" -" See the Solarized homepage at http://ethanschoonover.com/solarized for -" screenshots which will help you select either the light or dark background. -" -" Other options are detailed below. -" -" IMPORTANT NOTE FOR TERMINAL USERS: -" -" If you are going to use Solarized in Terminal mode (i.e. not in a GUI version -" like gvim or macvim), **please please please** consider setting your terminal -" emulator's colorscheme to used the Solarized palette. I've included palettes -" for some popular terminal emulator as well as Xdefaults in the official -" Solarized download available from [Solarized homepage]. If you use -" Solarized *without* these colors, Solarized will need to be told to degrade -" its colorscheme to a set compatible with the limited 256 terminal palette -" (whereas by using the terminal's 16 ansi color values, you can set the -" correct, specific values for the Solarized palette). -" -" If you do use the custom terminal colors, solarized.vim should work out of -" the box for you. If you are using a terminal emulator that supports 256 -" colors and don't want to use the custom Solarized terminal colors, you will -" need to use the degraded 256 colorscheme. To do so, simply add the following -" line *before* the `colorschem solarized` line: -" -" let g:solarized_termcolors=256 -" -" Again, I recommend just changing your terminal colors to Solarized values -" either manually or via one of the many terminal schemes available for import. -" -" --------------------------------------------------------------------- -" TOGGLE BACKGROUND FUNCTION: -" --------------------------------------------------------------------- -" -" Solarized comes with a Toggle Background plugin that by default will map to -" if that mapping is available. If it is not available you will need to -" either map the function manually or change your current mapping to -" something else. If you wish to map the function manually, enter the following -" lines in your .vimrc: -" -" nmap ToggleBackground -" imap ToggleBackground -" vmap ToggleBackground -" -" Note that it is important to *not* use the noremap map variants. The plugin -" uses noremap internally. You may run `:help togglebg` for more information. -" -" --------------------------------------------------------------------- -" OPTIONS -" --------------------------------------------------------------------- -" -" Set these in your vimrc file prior to calling the colorscheme. -" -" option name default optional -" ------------------------------------------------ -" g:solarized_termcolors= 16 | 256 -" g:solarized_termtrans = 0 | 1 -" g:solarized_degrade = 0 | 1 -" g:solarized_bold = 1 | 0 -" g:solarized_underline = 1 | 0 -" g:solarized_italic = 1 | 0 -" g:solarized_contrast = "normal"| "high" or "low" -" g:solarized_visibility= "normal"| "high" or "low" -" ------------------------------------------------ -" -" OPTION DETAILS -" -" ------------------------------------------------ -" g:solarized_termcolors= 256 | 16 -" ------------------------------------------------ -" The most important option if you are using vim in terminal (non gui) mode! -" This tells Solarized to use the 256 degraded color mode if running in a 256 -" color capable terminal. Otherwise, if set to `16` it will use the terminal -" emulators colorscheme (best option as long as you've set the emulators colors -" to the Solarized palette). -" -" If you are going to use Solarized in Terminal mode (i.e. not in a GUI -" version like gvim or macvim), **please please please** consider setting your -" terminal emulator's colorscheme to used the Solarized palette. I've included -" palettes for some popular terminal emulator as well as Xdefaults in the -" official Solarized download available from: -" http://ethanschoonover.com/solarized . If you use Solarized without these -" colors, Solarized will by default use an approximate set of 256 colors. It -" isn't bad looking and has been extensively tweaked, but it's still not quite -" the real thing. -" -" ------------------------------------------------ -" g:solarized_termtrans = 0 | 1 -" ------------------------------------------------ -" If you use a terminal emulator with a transparent background and Solarized -" isn't displaying the background color transparently, set this to 1 and -" Solarized will use the default (transparent) background of the terminal -" emulator. *urxvt* required this in my testing; iTerm2 did not. -" -" Note that on Mac OS X Terminal.app, solarized_termtrans is set to 1 by -" default as this is almost always the best option. The only exception to this -" is if the working terminfo file supports 256 colors (xterm-256color). -" -" ------------------------------------------------ -" g:solarized_degrade = 0 | 1 -" ------------------------------------------------ -" For test purposes only; forces Solarized to use the 256 degraded color mode -" to test the approximate color values for accuracy. -" -" ------------------------------------------------ -" g:solarized_bold = 1 | 0 -" ------------------------------------------------ -" ------------------------------------------------ -" g:solarized_underline = 1 | 0 -" ------------------------------------------------ -" ------------------------------------------------ -" g:solarized_italic = 1 | 0 -" ------------------------------------------------ -" If you wish to stop Solarized from displaying bold, underlined or -" italicized typefaces, simply assign a zero value to the appropriate -" variable, for example: `let g:solarized_italic=0` -" -" ------------------------------------------------ -" g:solarized_contrast = "normal"| "high" or "low" -" ------------------------------------------------ -" Stick with normal! It's been carefully tested. Setting this option to high -" or low does use the same Solarized palette but simply shifts some values up -" or down in order to expand or compress the tonal range displayed. -" -" ------------------------------------------------ -" g:solarized_visibility = "normal"| "high" or "low" -" ------------------------------------------------ -" Special characters such as trailing whitespace, tabs, newlines, when -" displayed using ":set list" can be set to one of three levels depending on -" your needs. -" -" --------------------------------------------------------------------- -" COLOR VALUES -" --------------------------------------------------------------------- -" Download palettes and files from: http://ethanschoonover.com/solarized -" -" L\*a\*b values are canonical (White D65, Reference D50), other values are -" matched in sRGB space. -" -" SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB -" --------- ------- ---- ------- ----------- ---------- ----------- ----------- -" base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 -" base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 -" base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 -" base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 -" base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 -" base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 -" base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93 -" base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99 -" yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71 -" orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80 -" red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86 -" magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83 -" violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77 -" blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82 -" cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63 -" green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60 -" -" --------------------------------------------------------------------- -" COLORSCHEME HACKING -" --------------------------------------------------------------------- -" -" Useful commands for testing colorschemes: -" :source $VIMRUNTIME/syntax/hitest.vim -" :help highlight-groups -" :help cterm-colors -" :help group-name -" -" Useful links for developing colorschemes: -" http://www.vim.org/scripts/script.php?script_id=2937 -" http://vimcasts.org/episodes/creating-colorschemes-for-vim/ -" http://www.frexx.de/xterm-256-notes/" -" -" -" }}} -" Default option values"{{{ -" --------------------------------------------------------------------- -if !exists("g:solarized_termtrans") - if ($TERM_PROGRAM ==? "apple_terminal" && &t_Co < 256) - let g:solarized_termtrans = 1 - else - let g:solarized_termtrans = 0 - endif -endif -if !exists("g:solarized_degrade") - let g:solarized_degrade = 0 -endif -if !exists("g:solarized_bold") - let g:solarized_bold = 1 -endif -if !exists("g:solarized_underline") - let g:solarized_underline = 1 -endif -if !exists("g:solarized_italic") - let g:solarized_italic = 1 -endif -if !exists("g:solarized_termcolors") - let g:solarized_termcolors = 16 -endif -if !exists("g:solarized_contrast") - let g:solarized_contrast = "normal" -endif -if !exists("g:solarized_visibility") - let g:solarized_visibility = "normal" -endif -"}}} -" Colorscheme initialization "{{{ -" --------------------------------------------------------------------- -hi clear -if exists("syntax_on") - syntax reset -endif -let colors_name = "solarized" - -"}}} -" GUI & CSApprox hexadecimal palettes"{{{ -" --------------------------------------------------------------------- -" -" Set both gui and terminal color values in separate conditional statements -" Due to possibility that CSApprox is running (though I suppose we could just -" leave the hex values out entirely in that case and include only cterm colors) -" We also check to see if user has set solarized (force use of the -" neutral gray monotone palette component) -if (has("gui_running") && g:solarized_degrade == 0) - let s:vmode = "gui" - let s:base03 = "#002b36" - let s:base02 = "#073642" - let s:base01 = "#586e75" - let s:base00 = "#657b83" - let s:base0 = "#839496" - let s:base1 = "#93a1a1" - let s:base2 = "#eee8d5" - let s:base3 = "#fdf6e3" - let s:yellow = "#b58900" - let s:orange = "#cb4b16" - let s:red = "#dc322f" - let s:magenta = "#d33682" - let s:violet = "#6c71c4" - let s:blue = "#268bd2" - let s:cyan = "#2aa198" - let s:green = "#859900" -elseif (has("gui_running") && g:solarized_degrade == 1) - " These colors are identical to the 256 color mode. They may be viewed - " while in gui mode via "let g:solarized_degrade=1", though this is not - " recommened and is for testing only. - let s:vmode = "gui" - let s:base03 = "#1c1c1c" - let s:base02 = "#262626" - let s:base01 = "#4e4e4e" - let s:base00 = "#585858" - let s:base0 = "#808080" - let s:base1 = "#8a8a8a" - let s:base2 = "#d7d7af" - let s:base3 = "#ffffd7" - let s:yellow = "#af8700" - let s:orange = "#d75f00" - let s:red = "#af0000" - let s:magenta = "#af005f" - let s:violet = "#5f5faf" - let s:blue = "#0087ff" - let s:cyan = "#00afaf" - let s:green = "#5f8700" -elseif g:solarized_termcolors != 256 && &t_Co >= 16 - let s:vmode = "cterm" - let s:base03 = "8" - let s:base02 = "0" - let s:base01 = "10" - let s:base00 = "11" - let s:base0 = "12" - let s:base1 = "14" - let s:base2 = "7" - let s:base3 = "15" - let s:yellow = "3" - let s:orange = "9" - let s:red = "1" - let s:magenta = "5" - let s:violet = "13" - let s:blue = "4" - let s:cyan = "6" - let s:green = "2" -elseif g:solarized_termcolors == 256 - let s:vmode = "cterm" - let s:base03 = "234" - let s:base02 = "235" - let s:base01 = "239" - let s:base00 = "240" - let s:base0 = "244" - let s:base1 = "245" - let s:base2 = "187" - let s:base3 = "230" - let s:yellow = "136" - let s:orange = "166" - let s:red = "124" - let s:magenta = "125" - let s:violet = "61" - let s:blue = "33" - let s:cyan = "37" - let s:green = "64" -else - let s:vmode = "cterm" - let s:bright = "* term=bold cterm=bold" - let s:base03 = "0".s:bright - let s:base02 = "0" - let s:base01 = "2".s:bright - let s:base00 = "3".s:bright - let s:base0 = "4".s:bright - let s:base1 = "6".s:bright - let s:base2 = "7" - let s:base3 = "7".s:bright - let s:yellow = "3" - let s:orange = "1".s:bright - let s:red = "1" - let s:magenta = "5" - let s:violet = "13" - let s:blue = "4" - let s:cyan = "6" - let s:green = "2" -endif -"}}} -" Formatting options and null values for passthrough effect "{{{ -" --------------------------------------------------------------------- - let s:none = "NONE" - let s:none = "NONE" - let s:t_none = "NONE" - let s:n = "NONE" - let s:c = ",undercurl" - let s:r = ",reverse" - let s:s = ",standout" - let s:ou = "" - let s:ob = "" -"}}} -" Background value based on termtrans setting "{{{ -" --------------------------------------------------------------------- -if (has("gui_running") || g:solarized_termtrans == 0) - let s:back = s:base03 -else - let s:back = "NONE" -endif -"}}} -" Alternate light scheme "{{{ -" --------------------------------------------------------------------- -if &background == "light" - let s:temp03 = s:base03 - let s:temp02 = s:base02 - let s:temp01 = s:base01 - let s:temp00 = s:base00 - let s:base03 = s:base3 - let s:base02 = s:base2 - let s:base01 = s:base1 - let s:base00 = s:base0 - let s:base0 = s:temp00 - let s:base1 = s:temp01 - let s:base2 = s:temp02 - let s:base3 = s:temp03 - if (s:back != "NONE") - let s:back = s:base03 - endif -endif -"}}} -" Optional contrast schemes "{{{ -" --------------------------------------------------------------------- -if g:solarized_contrast == "high" - let s:base01 = s:base00 - let s:base00 = s:base0 - let s:base0 = s:base1 - let s:base1 = s:base2 - let s:base2 = s:base3 - let s:back = s:back -endif -if g:solarized_contrast == "low" - let s:back = s:base02 - let s:ou = ",underline" -endif -"}}} -" Overrides dependent on user specified values"{{{ -" --------------------------------------------------------------------- -if g:solarized_bold == 1 - let s:b = ",bold" -else - let s:b = "" -endif - -if g:solarized_underline == 1 - let s:u = ",underline" -else - let s:u = "" -endif - -if g:solarized_italic == 1 - let s:i = ",italic" -else - let s:i = "" -endif -"}}} -" Highlighting primitives"{{{ -" --------------------------------------------------------------------- - -exe "let s:bg_none = ' ".s:vmode."bg=".s:none ."'" -exe "let s:bg_back = ' ".s:vmode."bg=".s:back ."'" -exe "let s:bg_base03 = ' ".s:vmode."bg=".s:base03 ."'" -exe "let s:bg_base02 = ' ".s:vmode."bg=".s:base02 ."'" -exe "let s:bg_base01 = ' ".s:vmode."bg=".s:base01 ."'" -exe "let s:bg_base00 = ' ".s:vmode."bg=".s:base00 ."'" -exe "let s:bg_base0 = ' ".s:vmode."bg=".s:base0 ."'" -exe "let s:bg_base1 = ' ".s:vmode."bg=".s:base1 ."'" -exe "let s:bg_base2 = ' ".s:vmode."bg=".s:base2 ."'" -exe "let s:bg_base3 = ' ".s:vmode."bg=".s:base3 ."'" -exe "let s:bg_green = ' ".s:vmode."bg=".s:green ."'" -exe "let s:bg_yellow = ' ".s:vmode."bg=".s:yellow ."'" -exe "let s:bg_orange = ' ".s:vmode."bg=".s:orange ."'" -exe "let s:bg_red = ' ".s:vmode."bg=".s:red ."'" -exe "let s:bg_magenta = ' ".s:vmode."bg=".s:magenta."'" -exe "let s:bg_violet = ' ".s:vmode."bg=".s:violet ."'" -exe "let s:bg_blue = ' ".s:vmode."bg=".s:blue ."'" -exe "let s:bg_cyan = ' ".s:vmode."bg=".s:cyan ."'" - -exe "let s:fg_none = ' ".s:vmode."fg=".s:none ."'" -exe "let s:fg_back = ' ".s:vmode."fg=".s:back ."'" -exe "let s:fg_base03 = ' ".s:vmode."fg=".s:base03 ."'" -exe "let s:fg_base02 = ' ".s:vmode."fg=".s:base02 ."'" -exe "let s:fg_base01 = ' ".s:vmode."fg=".s:base01 ."'" -exe "let s:fg_base00 = ' ".s:vmode."fg=".s:base00 ."'" -exe "let s:fg_base0 = ' ".s:vmode."fg=".s:base0 ."'" -exe "let s:fg_base1 = ' ".s:vmode."fg=".s:base1 ."'" -exe "let s:fg_base2 = ' ".s:vmode."fg=".s:base2 ."'" -exe "let s:fg_base3 = ' ".s:vmode."fg=".s:base3 ."'" -exe "let s:fg_green = ' ".s:vmode."fg=".s:green ."'" -exe "let s:fg_yellow = ' ".s:vmode."fg=".s:yellow ."'" -exe "let s:fg_orange = ' ".s:vmode."fg=".s:orange ."'" -exe "let s:fg_red = ' ".s:vmode."fg=".s:red ."'" -exe "let s:fg_magenta = ' ".s:vmode."fg=".s:magenta."'" -exe "let s:fg_violet = ' ".s:vmode."fg=".s:violet ."'" -exe "let s:fg_blue = ' ".s:vmode."fg=".s:blue ."'" -exe "let s:fg_cyan = ' ".s:vmode."fg=".s:cyan ."'" - -exe "let s:fmt_none = ' ".s:vmode."=NONE". " term=NONE". "'" -exe "let s:fmt_bold = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" -exe "let s:fmt_bldi = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" -exe "let s:fmt_undr = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" -exe "let s:fmt_undb = ' ".s:vmode."=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" -exe "let s:fmt_undi = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" -exe "let s:fmt_uopt = ' ".s:vmode."=NONE".s:ou. " term=NONE".s:ou."'" -exe "let s:fmt_curl = ' ".s:vmode."=NONE".s:c. " term=NONE".s:c."'" -exe "let s:fmt_ital = ' ".s:vmode."=NONE". " term=NONE". "'" -exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'" -exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'" - -if has("gui_running") - exe "let s:sp_none = ' guisp=".s:none ."'" - exe "let s:sp_back = ' guisp=".s:back ."'" - exe "let s:sp_base03 = ' guisp=".s:base03 ."'" - exe "let s:sp_base02 = ' guisp=".s:base02 ."'" - exe "let s:sp_base01 = ' guisp=".s:base01 ."'" - exe "let s:sp_base00 = ' guisp=".s:base00 ."'" - exe "let s:sp_base0 = ' guisp=".s:base0 ."'" - exe "let s:sp_base1 = ' guisp=".s:base1 ."'" - exe "let s:sp_base2 = ' guisp=".s:base2 ."'" - exe "let s:sp_base3 = ' guisp=".s:base3 ."'" - exe "let s:sp_green = ' guisp=".s:green ."'" - exe "let s:sp_yellow = ' guisp=".s:yellow ."'" - exe "let s:sp_orange = ' guisp=".s:orange ."'" - exe "let s:sp_red = ' guisp=".s:red ."'" - exe "let s:sp_magenta = ' guisp=".s:magenta."'" - exe "let s:sp_violet = ' guisp=".s:violet ."'" - exe "let s:sp_blue = ' guisp=".s:blue ."'" - exe "let s:sp_cyan = ' guisp=".s:cyan ."'" -else - let s:sp_none = "" - let s:sp_back = "" - let s:sp_base03 = "" - let s:sp_base02 = "" - let s:sp_base01 = "" - let s:sp_base00 = "" - let s:sp_base0 = "" - let s:sp_base1 = "" - let s:sp_base2 = "" - let s:sp_base3 = "" - let s:sp_green = "" - let s:sp_yellow = "" - let s:sp_orange = "" - let s:sp_red = "" - let s:sp_magenta = "" - let s:sp_violet = "" - let s:sp_blue = "" - let s:sp_cyan = "" -endif - -"}}} -" Basic highlighting"{{{ -" --------------------------------------------------------------------- -" note that link syntax to avoid duplicate configuration doesn't work with the -" exe compiled formats - -exe "hi! Normal" .s:fmt_none .s:fg_base0 .s:bg_back - -exe "hi! Comment" .s:fmt_ital .s:fg_base01 .s:bg_none -" *Comment any comment - -exe "hi! Constant" .s:fmt_none .s:fg_cyan .s:bg_none -" *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 - -exe "hi! Identifier" .s:fmt_none .s:fg_blue .s:bg_none -" *Identifier any variable name -" Function function name (also: methods for classes) -" -exe "hi! Statement" .s:fmt_none .s:fg_green .s:bg_none -" *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 - -exe "hi! PreProc" .s:fmt_none .s:fg_orange .s:bg_none -" *PreProc generic Preprocessor -" Include preprocessor #include -" Define preprocessor #define -" Macro same as Define -" PreCondit preprocessor #if, #else, #endif, etc. - -exe "hi! Type" .s:fmt_none .s:fg_yellow .s:bg_none -" *Type int, long, char, etc. -" StorageClass static, register, volatile, etc. -" Structure struct, union, enum, etc. -" Typedef A typedef - -exe "hi! Special" .s:fmt_none .s:fg_red .s:bg_none -" *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 - -exe "hi! Underlined" .s:fmt_none .s:fg_violet .s:bg_none -" *Underlined text that stands out, HTML links - -exe "hi! Ignore" .s:fmt_none .s:fg_none .s:bg_none -" *Ignore left blank, hidden |hl-Ignore| - -exe "hi! Error" .s:fmt_bold .s:fg_red .s:bg_none -" *Error any erroneous construct - -exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none -" *Todo anything that needs extra attention; mostly the -" keywords TODO FIXME and XXX -" -"}}} -" Extended highlighting "{{{ -" --------------------------------------------------------------------- -if (g:solarized_visibility=="high") - exe "hi! SpecialKey" .s:fmt_revr .s:fg_red .s:bg_none - exe "hi! NonText" .s:fmt_bold .s:fg_base1 .s:bg_none -elseif (g:solarized_visibility=="low") - exe "hi! SpecialKey" .s:fmt_bold .s:fg_base02 .s:bg_none - exe "hi! NonText" .s:fmt_bold .s:fg_base02 .s:bg_none -else - exe "hi! SpecialKey" .s:fmt_bold .s:fg_red .s:bg_none - exe "hi! NonText" .s:fmt_bold .s:fg_base01 .s:bg_none -endif -if (has("gui_running")) || &t_Co > 8 - exe "hi! StatusLine" .s:fmt_none .s:fg_base02 .s:bg_base1 - exe "hi! StatusLineNC" .s:fmt_none .s:fg_base02 .s:bg_base00 - "exe "hi! Visual" .s:fmt_stnd .s:fg_none .s:bg_base02 - exe "hi! Visual" .s:fmt_none .s:fg_base03 .s:bg_base01 -else - exe "hi! StatusLine" .s:fmt_none .s:fg_base02 .s:bg_base2 - exe "hi! StatusLineNC" .s:fmt_none .s:fg_base02 .s:bg_base2 - exe "hi! Visual" .s:fmt_none .s:fg_none .s:bg_base2 -endif -exe "hi! Directory" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! ErrorMsg" .s:fmt_revr .s:fg_red .s:bg_none -exe "hi! IncSearch" .s:fmt_stnd .s:fg_orange .s:bg_none -exe "hi! Search" .s:fmt_revr .s:fg_yellow .s:bg_none -exe "hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02 -exe "hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none -exe "hi! VertSplit" .s:fmt_bold .s:fg_base00 .s:bg_base00 -exe "hi! Title" .s:fmt_bold .s:fg_orange .s:bg_none -exe "hi! VisualNOS" .s:fmt_stnd .s:fg_none .s:bg_base02 -exe "hi! WarningMsg" .s:fmt_bold .s:fg_red .s:bg_none -exe "hi! WildMenu" .s:fmt_none .s:fg_base2 .s:bg_base02 -exe "hi! Folded" .s:fmt_undb .s:fg_base0 .s:bg_base02 .s:sp_base03 -exe "hi! FoldColumn" .s:fmt_bold .s:fg_base0 .s:bg_base02 -exe "hi! DiffAdd" .s:fmt_revr .s:fg_green .s:bg_none -exe "hi! DiffChange" .s:fmt_revr .s:fg_yellow .s:bg_none -exe "hi! DiffDelete" .s:fmt_revr .s:fg_red .s:bg_none -exe "hi! DiffText" .s:fmt_revr .s:fg_blue .s:bg_none -exe "hi! SignColumn" .s:fmt_none .s:fg_base0 .s:bg_base02 -exe "hi! Conceal" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! SpellBad" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_red -exe "hi! SpellCap" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_violet -exe "hi! SpellRare" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_cyan -exe "hi! SpellLocal" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_yellow -exe "hi! Pmenu" .s:fmt_none .s:fg_base0 .s:bg_base02 -exe "hi! PmenuSel" .s:fmt_none .s:fg_base2 .s:bg_base01 -exe "hi! PmenuSbar" .s:fmt_none .s:fg_base0 .s:bg_base2 -exe "hi! PmenuThumb" .s:fmt_none .s:fg_base03 .s:bg_base0 -exe "hi! TabLine" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 -exe "hi! TabLineSel" .s:fmt_undr .s:fg_base2 .s:bg_base01 .s:sp_base0 -exe "hi! TabLineFill" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 -exe "hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02 -exe "hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1 -exe "hi! ColorColumn" .s:fmt_none .s:fg_none .s:bg_base02 -exe "hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0 -hi! link lCursor Cursor -exe "hi! MatchParen" .s:fmt_bold .s:fg_red .s:bg_base01 - -"}}} -" vim syntax highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! vimLineComment" . s:fg_base01 .s:bg_none .s:fmt_ital -exe "hi! vimCommentString".s:fg_violet .s:bg_none .s:fmt_none -hi! link vimVar Identifier -hi! link vimFunc Function -hi! link vimUserFunc Function -exe "hi! vimCommand" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! vimCmdSep" . s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! helpExample" . s:fg_base1 .s:bg_none .s:fmt_none -hi! link helpSpecial Special -exe "hi! helpOption" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! helpNote" . s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! helpVim" . s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! helpHyperTextJump" .s:fg_blue .s:bg_none .s:fmt_undr -exe "hi! helpHyperTextEntry".s:fg_green .s:bg_none .s:fmt_none -exe "hi! vimIsCommand" . s:fg_base00 .s:bg_none .s:fmt_none -exe "hi! vimSynMtchOpt" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! vimSynType" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! vimHiLink" . s:fg_blue .s:bg_none .s:fmt_none -exe "hi! vimHiGroup" . s:fg_blue .s:bg_none .s:fmt_none -exe "hi! vimGroup" . s:fg_blue .s:bg_none .s:fmt_undb -"}}} -" html highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! htmlTag" . s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! htmlEndTag" . s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! htmlTagN" . s:fg_base1 .s:bg_none .s:fmt_bold -exe "hi! htmlTagName" . s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! htmlSpecialTagName". s:fg_blue .s:bg_none .s:fmt_ital -exe "hi! htmlArg" . s:fg_base00 .s:bg_none .s:fmt_none -exe "hi! javaScript" . s:fg_yellow .s:bg_none .s:fmt_none -"}}} -" perl highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! perlHereDoc" . s:fg_base1 .s:bg_back .s:fmt_none -exe "hi! perlVarPlain" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! perlStatementFileDesc". s:fg_cyan.s:bg_back.s:fmt_none - -"}}} -" tex highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! texStatement" . s:fg_cyan .s:bg_back .s:fmt_none -exe "hi! texMathZoneX" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texRefLabel" . s:fg_yellow .s:bg_back .s:fmt_none -"}}} -" ruby highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! rubyDefine" . s:fg_base1 .s:bg_back .s:fmt_bold -"rubyInclude -"rubySharpBang -"rubyAccess -"rubyPredefinedVariable -"rubyBoolean -"rubyClassVariable -"rubyBeginEnd -"rubyRepeatModifier -"hi! link rubyArrayDelimiter Special " [ , , ] -"rubyCurlyBlock { , , } - -"hi! link rubyClass Keyword -"hi! link rubyModule Keyword -"hi! link rubyKeyword Keyword -"hi! link rubyOperator Operator -"hi! link rubyIdentifier Identifier -"hi! link rubyInstanceVariable Identifier -"hi! link rubyGlobalVariable Identifier -"hi! link rubyClassVariable Identifier -"hi! link rubyConstant Type -"}}} -" haskell syntax highlighting"{{{ -" --------------------------------------------------------------------- -" For use with syntax/haskell.vim : Haskell Syntax File -" http://www.vim.org/scripts/script.php?script_id=3034 -" See also Steffen Siering's github repository: -" http://github.com/urso/dotrc/blob/master/vim/syntax/haskell.vim -" --------------------------------------------------------------------- -" -" Treat True and False specially, see the plugin referenced above -let hs_highlight_boolean=1 -" highlight delims, see the plugin referenced above -let hs_highlight_delimiters=1 - -exe "hi! cPreCondit". s:fg_orange.s:bg_none .s:fmt_none - -exe "hi! VarId" . s:fg_blue .s:bg_none .s:fmt_none -exe "hi! ConId" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hsImport" . s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! hsString" . s:fg_base00 .s:bg_none .s:fmt_none - -exe "hi! hsStructure" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hs_hlFunctionName" . s:fg_blue .s:bg_none -exe "hi! hsStatement" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsImportLabel" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hs_OpFunctionName" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hs_DeclareFunction" . s:fg_orange .s:bg_none .s:fmt_none -exe "hi! hsVarSym" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsType" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hsTypedef" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsModuleName" . s:fg_green .s:bg_none .s:fmt_undr -exe "hi! hsModuleStartLabel" . s:fg_magenta.s:bg_none .s:fmt_none -hi! link hsImportParams Delimiter -hi! link hsDelimTypeExport Delimiter -hi! link hsModuleStartLabel hsStructure -hi! link hsModuleWhereLabel hsModuleStartLabel - -" following is for the haskell-conceal plugin -" the first two items don't have an impact, but better safe -exe "hi! hsNiceOperator" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsniceoperator" . s:fg_cyan .s:bg_none .s:fmt_none - -"}}} -" pandoc markdown syntax highlighting "{{{ -" --------------------------------------------------------------------- - -"PandocHiLink pandocNormalBlock -exe "hi! pandocTitleBlock" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocTitleBlockTitle" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocTitleComment" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocComment" .s:fg_base01 .s:bg_none .s:fmt_ital -exe "hi! pandocVerbatimBlock" .s:fg_yellow .s:bg_none .s:fmt_none -hi! link pandocVerbatimBlockDeep pandocVerbatimBlock -hi! link pandocCodeBlock pandocVerbatimBlock -hi! link pandocCodeBlockDelim pandocVerbatimBlock -exe "hi! pandocBlockQuote" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader1" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader2" .s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader3" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader4" .s:fg_red .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader5" .s:fg_base0 .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader6" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocListMarker" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocListReference" .s:fg_magenta.s:bg_none .s:fmt_undr - -" Definitions -" --------------------------------------------------------------------- -let s:fg_pdef = s:fg_violet -exe "hi! pandocDefinitionBlock" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocDefinitionTerm" .s:fg_pdef .s:bg_none .s:fmt_stnd -exe "hi! pandocDefinitionIndctr" .s:fg_pdef .s:bg_none .s:fmt_bold -exe "hi! pandocEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNestedDefinition" .s:fg_pdef .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNestedDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi -exe "hi! pandocStrikeoutDefinition" .s:fg_pdef .s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInlineDefinition" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocSuperscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocSubscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none - -" Tables -" --------------------------------------------------------------------- -let s:fg_ptable = s:fg_blue -exe "hi! pandocTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocTableStructure" .s:fg_ptable.s:bg_none .s:fmt_none -hi! link pandocTableStructureTop pandocTableStructre -hi! link pandocTableStructureEnd pandocTableStructre -exe "hi! pandocTableZebraLight" .s:fg_ptable.s:bg_base03.s:fmt_none -exe "hi! pandocTableZebraDark" .s:fg_ptable.s:bg_base02.s:fmt_none -exe "hi! pandocEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrikeoutTable" .s:fg_ptable.s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInlineTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocSuperscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocSubscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none - -" Headings -" --------------------------------------------------------------------- -let s:fg_phead = s:fg_orange -exe "hi! pandocHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocHeadingMarker" .s:fg_yellow.s:bg_none.s:fmt_bold -exe "hi! pandocEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocStrongEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisHeading".s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrikeoutHeading" .s:fg_phead .s:bg_none.s:fmt_revr -exe "hi! pandocVerbatimInlineHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocSuperscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocSubscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold - -" Links -" --------------------------------------------------------------------- -exe "hi! pandocLinkDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocLinkLabel" .s:fg_blue .s:bg_none .s:fmt_undr -exe "hi! pandocLinkText" .s:fg_blue .s:bg_none .s:fmt_undb -exe "hi! pandocLinkURL" .s:fg_base00 .s:bg_none .s:fmt_undr -exe "hi! pandocLinkTitle" .s:fg_base00 .s:bg_none .s:fmt_undi -exe "hi! pandocLinkTitleDelim" .s:fg_base01 .s:bg_none .s:fmt_undi .s:sp_base00 -exe "hi! pandocLinkDefinition" .s:fg_cyan .s:bg_none .s:fmt_undr .s:sp_base00 -exe "hi! pandocLinkDefinitionID" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocImageCaption" .s:fg_violet .s:bg_none .s:fmt_undb -exe "hi! pandocFootnoteLink" .s:fg_green .s:bg_none .s:fmt_undr -exe "hi! pandocFootnoteDefLink" .s:fg_green .s:bg_none .s:fmt_bold -exe "hi! pandocFootnoteInline" .s:fg_green .s:bg_none .s:fmt_undb -exe "hi! pandocFootnote" .s:fg_green .s:bg_none .s:fmt_none -exe "hi! pandocCitationDelim" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocCitation" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocCitationID" .s:fg_magenta.s:bg_none .s:fmt_undr -exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none - -" Main Styles -" --------------------------------------------------------------------- -exe "hi! pandocStyleDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocEmphasis" .s:fg_base0 .s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrikeout" .s:fg_base01 .s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInline" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! pandocSuperscript" .s:fg_violet .s:bg_none .s:fmt_none -exe "hi! pandocSubscript" .s:fg_violet .s:bg_none .s:fmt_none - -exe "hi! pandocRule" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocRuleLine" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocEscapePair" .s:fg_red .s:bg_none .s:fmt_bold -exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocNonBreakingSpace" . s:fg_red .s:bg_none .s:fmt_revr -hi! link pandocEscapedCharacter pandocEscapePair -hi! link pandocLineBreak pandocEscapePair - -" Embedded Code -" --------------------------------------------------------------------- -exe "hi! pandocMetadataDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocMetadataKey" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_bold -hi! link pandocMetadataTitle pandocMetadata - -"}}} -" Utility autocommand "{{{ -" --------------------------------------------------------------------- -" In cases where Solarized is initialized inside a terminal vim session and -" then transferred to a gui session via the command `:gui`, the gui vim process -" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` -" related code that sets gui specific values isn't executed. -" -" Currently, Solarized sets only the cterm or gui values for the colorscheme -" depending on gui or terminal mode. It's possible that, if the following -" autocommand method is deemed excessively poor form, that approach will be -" used again and the autocommand below will be dropped. -" -" However it seems relatively benign in this case to include the autocommand -" here. It fires only in cases where vim is transferring from terminal to gui -" mode (detected with the script scope s:vmode variable). It also allows for -" other potential terminal customizations that might make gui mode suboptimal. -" -autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif -"}}} -" License "{{{ -" --------------------------------------------------------------------- -" -" Copyright (c) 2011 Ethan Schoonover -" -" Permission is hereby granted, free of charge, to any person obtaining a copy -" of this software and associated documentation files (the "Software"), to deal -" in the Software without restriction, including without limitation the rights -" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -" copies of the Software, and to permit persons to whom the Software is -" furnished to do so, subject to the following conditions: -" -" The above copyright notice and this permission notice shall be included in -" all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -" THE SOFTWARE. -" -" vim:foldmethod=marker:foldlevel=0 -"}}} diff --git a/vim/colors/southwest-fog.vim b/vim/colors/southwest-fog.vim deleted file mode 100644 index 2b47384..0000000 --- a/vim/colors/southwest-fog.vim +++ /dev/null @@ -1,157 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Author: Mario Gutierrez (mario@mgutz.com) -" Last Change: Dececember 6, 2010 -" Version: 0.2 -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let colors_name = "southwest-fog" - - -"""""""""" General - -hi Normal guifg=#acb9c7 guibg=#26292e gui=none - -if version >= 700 - hi CursorColumn guibg=#30333a - hi CursorLine guibg=#30333a - hi MatchParen guifg=magenta guibg=#1a1d20 gui=bold,italic - hi Pmenu guifg=bg guibg=#957b94 - hi PmenuSel guifg=bg guibg=#a694b3 - - hi IncSearch guifg=bg guibg=#9d94b3 gui=bold - hi Search guifg=bg guibg=#9d94b3 gui=none -endif - -hi Cursor guifg=bg guibg=#73b87f gui=none -hi DiffAdd guifg=bg guibg=#70869d gui=none -hi DiffChange guifg=bg guibg=#a58f73 gui=none -hi DiffDelete guifg=bg guibg=#a27376 gui=none -hi DiffText guifg=bg guibg=#a4a273 gui=none -hi ErrorMsg guifg=fg guibg=#aa2e34 gui=none -hi Folded guifg=fg guibg=#3d4a3e gui=none -hi FoldColumn guifg=#d7969d guibg=#3f4c4d gui=none -hi LineNr guifg=#3d424a guibg=bg gui=none -hi NonText guifg=#3d424a guibg=bg gui=none -hi Question guifg=#6dbb6d guibg=bg gui=none -hi StatusLine guifg=#b0d3bb guibg=#1a1d20 gui=none -hi StatusLineNC guifg=#5a6c60 guibg=#1a1d20 gui=none -hi TabLine guifg=#555555 guibg=#dddddd gui=none -hi TabLineFill guifg=fg guibg=#dddddd gui=none -hi TabLineSel guifg=#101010 guibg=#b0b0b0 gui=none -hi Title guifg=#d7969d guibg=bg gui=none -hi VertSplit guifg=#1a1d20 guibg=#1a1d20 gui=none -hi Visual guifg=bg guibg=#94b3b3 gui=none -hi WarningMsg guifg=#bb6d6d guibg=bg gui=none - - -"""""""""" Syntax highlighting - -hi Comment guifg=#5a6c60 guibg=bg gui=italic -hi Constant guifg=#b1c7ad gui=none -hi Error guifg=fg guibg=#aa2e34 gui=none -hi Function guifg=#cccbb1 gui=none -hi Identifier guifg=#b89e93 gui=none -hi Ignore guifg=bg guibg=bg gui=none -hi Keyword guifg=#ccc0b1 gui=none -hi Number guifg=#e1d4a8 gui=none -hi PreProc guifg=#bbacc7 gui=none -hi Special guifg=#a58f73 gui=none -hi Special guifg=#b8a792 gui=none -hi Statement guifg=#ccc0b1 gui=none -hi String guifg=#9a7bb2 gui=none -hi Todo guifg=#bebb83 guibg=bg gui=bold -hi Type guifg=#cbb0b2 gui=none -hi Underlined guifg=#bea483 gui=underline - - -""""""""""" ERB - -hi link erubyDelimiter PreProc - - -""""""""""" HAML - -hi link hamlAttributes htmlArg -hi link hamlTag htmlTag -hi link hamlTagName htmlTagName -hi link hamlIdChar hamlId -hi link hamlClassChar hamlClass - - -""""""""""" HELP - -hi link helpSectionDelim NonText -hi link helpExample Statement - - -""""""""""" HTML - -hi link htmlTag Statement -hi link htmlEndTag Statement -hi link htmlTagName Statement - - -"""""""""" JavaScript - -hi link javaScriptFunction Statement -hi link javaScriptFuncName Function -hi link javaScriptLabel PreProc - - -"""""""""" MAKE - -hi link makeCommands Statement - - -"""""""""" MARKDOWN (tpope's vim-markdown) - -hi link markdownCodeBlock Statement -hi link markdownCode Statement -hi link markdownCodeDelimiter Statement -hi link markdownHeadingDelimiter Title -hi markdownLinkText guifg=#cbb0b2 gui=underline -hi markdownUrl guifg=#69839a guibg=bg gui=none -hi link markdownLinkTextDelimiter markdownUrl -hi link markdownLinkDelimiter markdownUrl - - -""""""""""" NERDTree - -hi link treePart NonText -hi link treePartFile treePart -hi link treeDirSlash treePart -hi link treeDir Statement -hi link treeClosable PreProc -hi link treeOpenable treeClosable -hi link treeUp treeClosable -hi treeFlag guifg=#3e71a1 guibg=bg gui=none -hi link treeHelp Comment -hi link treeLink Type -hi link treeExecFile Type - - -"""""""""" PHP - -hi link phpVarSelector Identifier - - -"""""""""" Ruby - -hi link rubyAccess PreProc -hi rubyInterpolation guifg=#f6abf1 guibg=bg -hi link rubyInterpolationDelimiter rubyInterpolation -hi link rubyStringDelimiter String - - -""""""""""" XML - -hi link xmlTag htmlTag -hi link xmlEndTag htmlEndTag -hi link xmlTagName htmlTagName - -" vim: set sw=4 sts=4: diff --git a/vim/colors/wombat.vim b/vim/colors/wombat.vim deleted file mode 100644 index 9ad1e56..0000000 --- a/vim/colors/wombat.vim +++ /dev/null @@ -1,51 +0,0 @@ -" Maintainer: Lars H. Nielsen (dengmao@gmail.com) -" Last Change: January 22 2007 - -set background=dark - -hi clear - -if exists("syntax_on") - syntax reset -endif - -let colors_name = "wombat" - - -" Vim >= 7.0 specific colors -if version >= 700 - hi CursorLine guibg=#2d2d2d - hi CursorColumn guibg=#2d2d2d - hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold - hi Pmenu guifg=#f6f3e8 guibg=#444444 - hi PmenuSel guifg=#000000 guibg=#cae682 -endif - -" General colors -hi Cursor guifg=NONE guibg=#656565 gui=none -hi Normal guifg=#f6f3e8 guibg=#242424 gui=none -hi NonText guifg=#808080 guibg=#303030 gui=none -hi LineNr guifg=#857b6f guibg=#000000 gui=none -hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic -hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none -hi VertSplit guifg=#444444 guibg=#444444 gui=none -hi Folded guibg=#384048 guifg=#a0a8b0 gui=none -hi Title guifg=#f6f3e8 guibg=NONE gui=bold -hi Visual guifg=#f6f3e8 guibg=#444444 gui=none -hi SpecialKey guifg=#808080 guibg=#343434 gui=none - -" Syntax highlighting -hi Comment guifg=#99968b gui=italic -hi Todo guifg=#8f8f8f gui=italic -hi Constant guifg=#e5786d gui=none -hi String guifg=#95e454 gui=italic -hi Identifier guifg=#cae682 gui=none -hi Function guifg=#cae682 gui=none -hi Type guifg=#cae682 gui=none -hi Statement guifg=#8ac6f2 gui=none -hi Keyword guifg=#8ac6f2 gui=none -hi PreProc guifg=#e5786d gui=none -hi Number guifg=#e5786d gui=none -hi Special guifg=#e7f6da gui=none - - diff --git a/vim/colors/wombat256.vim b/vim/colors/wombat256.vim deleted file mode 100644 index 73be6db..0000000 --- a/vim/colors/wombat256.vim +++ /dev/null @@ -1,302 +0,0 @@ -" Vim color file -" Maintainer: David Liang (bmdavll at gmail dot com) -" Last Change: November 28 2008 -" -" wombat256.vim - a modified version of Wombat by Lars Nielsen that also -" works on xterms with 88 or 256 colors. The algorithm for approximating the -" GUI colors with the xterm palette is from desert256.vim by Henry So Jr. - -set background=dark - -if version > 580 - hi clear - if exists("syntax_on") - syntax reset - endif -endif - -let g:colors_name = "wombat256" - -if !has("gui_running") && &t_Co != 88 && &t_Co != 256 - finish -endif - -" functions {{{ -" returns an approximate grey index for the given grey level -fun grey_number(x) - if &t_Co == 88 - if a:x < 23 - return 0 - elseif a:x < 69 - return 1 - elseif a:x < 103 - return 2 - elseif a:x < 127 - return 3 - elseif a:x < 150 - return 4 - elseif a:x < 173 - return 5 - elseif a:x < 196 - return 6 - elseif a:x < 219 - return 7 - elseif a:x < 243 - return 8 - else - return 9 - endif - else - if a:x < 14 - return 0 - else - let l:n = (a:x - 8) / 10 - let l:m = (a:x - 8) % 10 - if l:m < 5 - return l:n - else - return l:n + 1 - endif - endif - endif -endfun - -" returns the actual grey level represented by the grey index -fun grey_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 46 - elseif a:n == 2 - return 92 - elseif a:n == 3 - return 115 - elseif a:n == 4 - return 139 - elseif a:n == 5 - return 162 - elseif a:n == 6 - return 185 - elseif a:n == 7 - return 208 - elseif a:n == 8 - return 231 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 8 + (a:n * 10) - endif - endif -endfun - -" returns the palette index for the given grey index -fun grey_color(n) - if &t_Co == 88 - if a:n == 0 - return 16 - elseif a:n == 9 - return 79 - else - return 79 + a:n - endif - else - if a:n == 0 - return 16 - elseif a:n == 25 - return 231 - else - return 231 + a:n - endif - endif -endfun - -" returns an approximate color index for the given color level -fun rgb_number(x) - if &t_Co == 88 - if a:x < 69 - return 0 - elseif a:x < 172 - return 1 - elseif a:x < 230 - return 2 - else - return 3 - endif - else - if a:x < 75 - return 0 - else - let l:n = (a:x - 55) / 40 - let l:m = (a:x - 55) % 40 - if l:m < 20 - return l:n - else - return l:n + 1 - endif - endif - endif -endfun - -" returns the actual color level for the given color index -fun rgb_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 139 - elseif a:n == 2 - return 205 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 55 + (a:n * 40) - endif - endif -endfun - -" returns the palette index for the given R/G/B color indices -fun rgb_color(x, y, z) - if &t_Co == 88 - return 16 + (a:x * 16) + (a:y * 4) + a:z - else - return 16 + (a:x * 36) + (a:y * 6) + a:z - endif -endfun - -" returns the palette index to approximate the given R/G/B color levels -fun color(r, g, b) - " get the closest grey - let l:gx = grey_number(a:r) - let l:gy = grey_number(a:g) - let l:gz = grey_number(a:b) - - " get the closest color - let l:x = rgb_number(a:r) - let l:y = rgb_number(a:g) - let l:z = rgb_number(a:b) - - if l:gx == l:gy && l:gy == l:gz - " there are two possibilities - let l:dgr = grey_level(l:gx) - a:r - let l:dgg = grey_level(l:gy) - a:g - let l:dgb = grey_level(l:gz) - a:b - let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) - let l:dr = rgb_level(l:gx) - a:r - let l:dg = rgb_level(l:gy) - a:g - let l:db = rgb_level(l:gz) - a:b - let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) - if l:dgrey < l:drgb - " use the grey - return grey_color(l:gx) - else - " use the color - return rgb_color(l:x, l:y, l:z) - endif - else - " only one possibility - return rgb_color(l:x, l:y, l:z) - endif -endfun - -" returns the palette index to approximate the 'rrggbb' hex string -fun rgb(rgb) - let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 - let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 - let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 - return color(l:r, l:g, l:b) -endfun - -" sets the highlighting for the given group -fun X(group, fg, bg, attr) - if a:fg != "" - exec "hi ".a:group." guifg=#".a:fg." ctermfg=".rgb(a:fg) - endif - if a:bg != "" - exec "hi ".a:group." guibg=#".a:bg." ctermbg=".rgb(a:bg) - endif - if a:attr != "" - if a:attr == 'italic' - exec "hi ".a:group." gui=".a:attr." cterm=none" - else - exec "hi ".a:group." gui=".a:attr." cterm=".a:attr - endif - endif -endfun -" }}} - -call X("Normal", "cccccc", "242424", "none") -call X("Cursor", "222222", "ecee90", "none") -call X("CursorLine", "", "32322e", "none") -call X("CursorColumn", "", "2d2d2d", "") - "CursorIM - "Question - "IncSearch -call X("Search", "444444", "af87d7", "") -call X("MatchParen", "ecee90", "857b6f", "bold") -call X("SpecialKey", "6c6c6c", "2d2d2d", "none") -call X("Visual", "ecee90", "597418", "none") -call X("LineNr", "857b6f", "121212", "none") -call X("Folded", "a0a8b0", "404048", "none") -call X("Title", "f6f3e8", "", "bold") -call X("VertSplit", "444444", "444444", "none") -call X("StatusLine", "f6f3e8", "444444", "italic") -call X("StatusLineNC", "857b6f", "444444", "none") - "Scrollbar - "Tooltip - "Menu - "WildMenu -call X("Pmenu", "f6f3e8", "444444", "") -call X("PmenuSel", "121212", "caeb82", "") -call X("WarningMsg", "ff0000", "", "") - "ErrorMsg - "ModeMsg - "MoreMsg - "Directory - "DiffAdd - "DiffChange - "DiffDelete - "DiffText - -" syntax highlighting -call X("Number", "e5786d", "", "none") -call X("Constant", "e5786d", "", "none") -call X("String", "95e454", "", "italic") -call X("Comment", "c0bc6c", "", "italic") -call X("Identifier", "caeb82", "", "none") -call X("Keyword", "87afff", "", "none") -call X("Statement", "87afff", "", "none") -call X("Function", "caeb82", "", "none") -call X("PreProc", "e5786d", "", "none") -call X("Type", "caeb82", "", "none") -call X("Special", "ffdead", "", "none") -call X("Todo", "857b6f", "", "italic") - "Underlined - "Error - "Ignore - -hi! link VisualNOS Visual -hi! link NonText LineNr -hi! link FoldColumn Folded - -" delete functions {{{ -delf X -delf rgb -delf color -delf rgb_color -delf rgb_level -delf rgb_number -delf grey_color -delf grey_level -delf grey_number -" }}} - -" vim:set ts=4 sw=4 noet fdm=marker: diff --git a/vim/colors/zenburn.vim b/vim/colors/zenburn.vim deleted file mode 100644 index 42dacf5..0000000 --- a/vim/colors/zenburn.vim +++ /dev/null @@ -1,133 +0,0 @@ -" Vim color file -" Maintainer: Jani Nurminen -" Last Change: $Id$ -" URL: Not yet... -" License: GPL -" -" Nothing too fancy, just some alien fruit salad to keep you in the zone. -" This syntax file was designed to be used with dark environments and -" low light situations. Of course, if it works during a daybright office, go -" ahead :) -" -" Owes heavily to other Vim color files! With special mentions -" to "BlackDust", "Camo" and "Desert". -" -" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn. -" See also :help syntax -" -" CONFIGURABLE PARAMETERS: -" -" You can use the default (don't set any parameters), or you can -" set some parameters to tweak the Zenlook colours. -" -" * To get more contrast to the Visual selection, use -" -" let g:zenburn_alternate_Visual = 1 -" -" * To use alternate colouring for Error message, use -" -" let g:zenburn_alternate_Error = 1 -" -" * The new default for Include is a duller orang.e To use the original -" colouring for Include, use -" -" let g:zenburn_alternate_Include = 1 -" -" * To turn the parameter(s) back to defaults, use unlet. -" -" That's it, enjoy! -" -" TODO -" - IME colouring (CursorIM) -" - obscure syntax groups: check and colourize -" - add more groups if necessary - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif -let g:colors_name="zenburn" - -hi Boolean guifg=#dca3a3 -hi Character guifg=#dca3a3 gui=bold -hi Comment guifg=#7f9f7f -hi Conditional guifg=#f0dfaf gui=bold -hi Constant guifg=#dca3a3 gui=bold -hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold -hi Debug guifg=#dca3a3 gui=bold -hi Define guifg=#ffcfaf gui=bold -hi Delimiter guifg=#8f8f8f -hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold -hi DiffChange guibg=#333333 -hi DiffDelete guifg=#333333 guibg=#464646 -hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold -hi Directory guifg=#dcdccc gui=bold -hi ErrorMsg guifg=#60b48a guibg=#3f3f3f gui=bold -hi Exception guifg=#c3bf9f gui=bold -hi Float guifg=#c0bed1 -hi FoldColumn guifg=#93b3a3 guibg=#3f4040 -hi Folded guifg=#93b3a3 guibg=#3f4040 -hi Function guifg=#efef8f -hi Identifier guifg=#efdcbc -hi IncSearch guibg=#f8f893 guifg=#385f38 -hi Keyword guifg=#f0dfaf gui=bold -hi Label guifg=#dfcfaf gui=underline -hi LineNr guifg=#7f8f8f guibg=#464646 -hi Macro guifg=#ffcfaf gui=bold -hi ModeMsg guifg=#ffcfaf gui=none -hi MoreMsg guifg=#ffffff gui=bold -hi NonText guifg=#404040 -hi Normal guifg=#dcdccc guibg=#3f3f3f -hi Number guifg=#8cd0d3 -hi Operator guifg=#f0efd0 -hi PreCondit guifg=#dfaf8f gui=bold -hi PreProc guifg=#ffcfaf gui=bold -hi Question guifg=#ffffff gui=bold -hi Repeat guifg=#ffd7a7 gui=bold -hi Search guifg=#ffffe0 guibg=#385f38 -hi SpecialChar guifg=#dca3a3 gui=bold -hi SpecialComment guifg=#82a282 gui=bold -hi Special guifg=#cfbfaf -hi SpecialKey guifg=#9ece9e -hi Statement guifg=#e3ceab guibg=#3f3f3f gui=none -hi StatusLine guifg=#1e2320 guibg=#acbc90 -hi StatusLineNC guifg=#2e3330 guibg=#88b090 -hi StorageClass guifg=#c3bf9f gui=bold -hi String guifg=#cc9393 -hi Structure guifg=#efefaf gui=bold -hi Tag guifg=#dca3a3 gui=bold -hi Title guifg=#efefef guibg=#3f3f3f gui=bold -hi Todo guifg=#7faf8f guibg=#3f3f3f gui=bold -hi Typedef guifg=#dfe4cf gui=bold -hi Type guifg=#dfdfbf gui=bold -hi Underlined guifg=#dcdccc guibg=#3f3f3f gui=underline -hi VertSplit guifg=#303030 guibg=#688060 -hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline -hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold -hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline - -if exists("g:zenburn_alternate_Visual") - " Visual with more contrast, thanks to Steve Hall & Cream posse - hi Visual guifg=#000000 guibg=#71d3b4 -else - " use default visual - hi Visual guifg=#233323 guibg=#71d3b4 -endif - -if exists("g:zenburn_alternate_Error") - " use a bit different Error - hi Error guifg=#ef9f9f guibg=#201010 gui=bold -else - " default - hi Error guifg=#e37170 guibg=#332323 gui=none -endif - -if exists("g:zenburn_alternate_Include") - " original setting - hi Include guifg=#ffcfaf gui=bold -else - " new, less contrasted one - hi Include guifg=#dfaf8f gui=bold -endif - " TODO check every syntax group that they're ok diff --git a/vim/doc/Align.txt b/vim/doc/Align.txt deleted file mode 100644 index 8c8c716..0000000 --- a/vim/doc/Align.txt +++ /dev/null @@ -1,1602 +0,0 @@ -*align.txt* The Alignment Tool Jan 07, 2013 - -Author: Charles E. Campbell - (remove NOSPAM from Campbell's email first) -Copyright: (c) 2004-2012 by Charles E. Campbell *Align-copyright* - The VIM LICENSE applies to Align.vim, AlignMaps.vim, and Align.txt - (see |copyright|) except use "Align and AlignMaps" instead of "Vim" - NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. - -============================================================================== -1. Contents *align* *align-contents* {{{1 - - 1. Contents.................: |align-contents| - 2. Alignment Manual.........: |align-manual| - 3. Alignment Usage..........: |align-usage| - Alignment Concepts.......: |align-concepts| - Alignment Commands.......: |align-commands| - Alignment Control........: |align-control| - Separators.............: |alignctrl-separators| - Initial Whitespace.....: |alignctrl-w| |alignctrl-W| |alignctrl-I| - Justification..........: |alignctrl-l| |alignctrl-r| |alignctrl-c| - Justification Control..: |alignctrl--| |alignctrl-+| |alignctrl-:| - Cyclic/Sequential......: |alignctrl-=| |alignctrl-C| - Separator Justification: |alignctrl-<| |alignctrl->| |alignctrl-|| - Line (de)Selection.....: |alignctrl-g| |alignctrl-v| - Temporary Settings.....: |alignctrl-m| - Padding................: |alignctrl-p| |alignctrl-P| - Current Options........: |alignctrl-settings| |alignctrl-| - Alignment Control Init...: |alignctrl-init| - Alignment................: |align-align| - 4. Alignment Maps...........: |align-maps| - \a,....................: |alignmap-a,| - \a?....................: |alignmap-a?| - \a<....................: |alignmap-a<| - \abox..................: |alignmap-abox| - \acom..................: |alignmap-acom| - \anum..................: |alignmap-anum| - \ascom.................: |alignmap-ascom| - \adec..................: |alignmap-adec| - \adef..................: |alignmap-adef| - \afnc..................: |alignmap-afnc| - \adcom.................: |alignmap-adcom| - \aocom.................: |alignmap-aocom| - \tsp...................: |alignmap-tsp| - \tsq...................: |alignmap-tsq| - \tt....................: |alignmap-tt| - \t=....................: |alignmap-t=| - \T=....................: |alignmap-T=| - \Htd...................: |alignmap-Htd| - 5. Alignment Tool History...: |align-history| - -============================================================================== -2. Align Manual *alignman* *alignmanual* *align-manual* {{{1 - - Align comes as a vimball; simply typing > - vim Align.vba.gz - :so % -< should put its components where they belong. The components are: > - .vim/plugin/AlignPlugin.vim - .vim/plugin/AlignMapsPlugin.vim - .vim/plugin/cecutil.vim - .vim/autoload/Align.vim - .vim/autoload/AlignMaps.vim - .vim/doc/Align.txt -< To see a user's guide, see |align-userguide| - To see examples, see |alignctrl| and |alignmaps| -> -/=============+=========+=====================================================\ -|| \ Default/ || -|| Commands \ Value/ Explanation || -|| | | || -++==============+====+=======================================================++ -|| AlignCtrl | | =Clrc-+:pPIWw [..list-of-separator-patterns..] || -|| | +-------------------------------------------------------+| -|| | | may be called as a command or as a function: || -|| | | :AlignCtrl =lp0P0W & \\ || -|| | | :call Align#AlignCtrl('=lp0P0W','&','\\') || -|| | | || -|| | +-------------------------------------------------------++ -|| 1st arg | = | = all separator patterns are equivalent and are || -|| | | simultaneously active. Patterns are |regexp|. || -|| | | C cycle through separator patterns. Patterns are || -|| | | |regexp| and are active sequentially. || -|| | | || -|| | < | < left justify separator Separators are justified, || -|| | | > right justify separator too. Separator styles || -|| | | | center separator are cyclic. || -|| | | || -|| | l | l left justify Justification styles are always || -|| | | r right justify cyclic (ie. lrc would mean left j., || -|| | | c center then right j., then center, repeat. || -|| | | - skip this separator || -|| | | + re-use last justification method || -|| | | : treat rest of text as a field || -|| | | * use AlignSkip() function (to skip or not) || -|| | | || -|| | p1 | p### pad separator on left by # blanks || -|| | P1 | P### pad separator on right by # blanks || -|| | | || -|| | I | I preserve and apply first line's leading white || -|| | | space to all lines || -|| | | W preserve leading white space on every line, even || -|| | | if it varies from line to line || -|| | | w don't preserve leading white space || -|| | | || -|| | | g second argument is a selection pattern -- only || -|| | | align on lines that have a match (inspired by || -|| | | :g/selection pattern/command) || -|| | | v second argument is a selection pattern -- only || -|| | | align on lines that _don't_ have a match (inspired || -|| | | by :v/selection pattern/command) || -|| | | || -|| | | m Map support: AlignCtrl will immediately do an || -|| | | AlignPush() and the next call to Align() will do || -|| | | an AlignPop at the end. This feature allows maps || -|| | | to preserve user settings. || -|| | | || -|| | | default || -|| | | AlignCtrl default || -|| | | will clear the AlignCtrl || -|| | | stack & set the default: AlignCtrl "Ilp1P1=" '=' || -|| | | || -|| +----+-------------------------------------------------------+| -|| More args | More arguments are interpreted as describing separators || -|| +------------------------------------------------------------+| -|| No args | AlignCtrl will display its current settings || -||==============+============================================================+| -||[range]Align | [..list-of-separators..] || -||[range]Align! | [AlignCtrl settings] [..list-of-separators..] || -|| +------------------------------------------------------------+| -|| | Aligns text over the given range. The range may be || -|| | selected via visual mode (v, V, or ctrl-v) or via || -|| | the command line. The Align operation may be invoked || -|| | as a command or as a function; as a function, the first || -|| | argument is 0=separators only, 1=AlignCtrl option string || -|| | followed by a list of separators. || -|| | :[range]Align || -|| | :[range]Align [list of separators] || -|| | :[range]call Align#Align(0) || -|| | :[range]call Align#Align(0,"list","of","separators",...) || -\=============================================================================/ - -============================================================================== -3. Alignment Usage *alignusage* *align-usage* *align-userguide* {{{1 - - -ALIGNMENT CONCEPTS *align-concept* *align-concepts* *alignctrl* {{{1 - - The typical text to be aligned is considered to be: - - * composed of two or more fields - * separated by one or more separator pattern(s): - * two or more lines -> - ws field ws separator ws field ws separator ... - ws field ws separator ws field ws separator ... -< - where "ws" stands for "white space" such as blanks and/or tabs, - and "fields" are arbitrary text. For example, consider > - - x= y= z= 3; - xx= yy= zz= 4; - zzz= yyy= zzz= 5; - a= b= c= 3; -< - Assume that it is desired to line up all the "=" signs; these, - then, are the separators. The fields are composed of all the - alphameric text. Assuming they lie on lines 1-4, one may align - those "=" signs with: > - :AlignCtrl l - :1,4Align = -< The result is: > - x = y = z = 3; - xx = yy = zz = 4; - zzz = yyy = zzz = 5; - a = b = c = 3; - -< Note how each "=" sign is surrounded by a single space; the - default padding is p1P1 (p1 means one space before the separator, - and P1 means one space after it). If you wish to change the - padding, say, to no padding, use (see |alignctrl-p|) > - - :AlignCtrl lp0P0 - -< Next, note how each field is left justified; that's what the "l" - in the AlignCtrl parameters (a small letter "ell") does. If - right-justification of the fields had been desired, an "r" - could've been used: > - :AlignCtrl r -< yielding > - x = y = z = 3; - xx = yy = zz = 4; - zzz = yyy = zzz = 5; - a = b = c = 3; -< There are many more options available for field justification: see - |alignctrl-c| and |alignctrl--|. - - Separators, although commonly only one character long, are actually - specified by regular expressions (see |regexp|), and one may left - justify, right justify, or center them, too (see |alignctrl-<|). - - Assume that for some reason a left-right-left-right-... justification - sequence was desired. This wish is simply achieved with > - :AlignCtrl lr - :1,4Align = -< because the justification commands are considered to be "cyclic"; ie. - lr is the same as lrlrlrlrlrlrlr... - - There's a lot more discussed under |alignctrl|; hopefully the examples - there will help, too. - - -ALIGNMENT COMMANDS *align-command* *align-commands* {{{2 - - The script includes two primary commands and two - minor commands: - - AlignCtrl : this command/function sets up alignment options - which persist until changed for later Align calls. - It controls such things as: how to specify field - separators, initial white space, padding about - separators, left/right/center justification, etc. > - ex. AlignCtrl wp0P1 - Interpretation: during subsequent alignment - operations, preserve each line's initial - whitespace. Use no padding before separators - but provide one padding space after separators. -< - Align : this command/function operates on the range given it to - align text based on one or more separator patterns. The - patterns may be provided via AlignCtrl or via Align - itself. > - - ex. :%Align , - Interpretation: align all commas over the entire - file. -< The :Align! format permits alignment control commands - to precede the alignment patterns. > - ex. :%Align! p2P2 = -< This will align all "=" in the file with two padding - spaces on both sides of each "=" sign. - - NOTE ON USING PATTERNS WITH ALIGN:~ - Align and AlignCtrl use || to obtain their - input patterns and they use an internal function to - split arguments at whitespace unless inside "..."s. - One may escape characters inside a double-quote string - by preceding such characters with a backslash. - - AlignPush : this command/function pushes the current AlignCtrl - state onto an internal stack. > - ex. :AlignPush - Interpretation: save the current AlignCtrl - settings, whatever they may be. They'll - also remain as the current settings until - AlignCtrl is used to change them. -< - AlignPop : this command/function pops the current AlignCtrl - state from an internal stack. > - ex. :AlignPop - Interpretation: presumably AlignPush was - used (at least once) previously; this command - restores the AlignCtrl settings when AlignPush - was last used. -< Also see |alignctrl-m| for a way to automatically do - an AlignPop after an Align (primarily this is for maps). - -ALIGNMENT OPTIONS *align-option* *align-options* *align-xstrlen* {{{2 - *align-utf8* *align-utf* *align-codepoint* *align-strlen* *align-multibyte* - - For those of you who are using 2-byte (or more) characters such as are - available with utf-8, Align now provides a special option which you - may choose based upon your needs: - - Use Built-in strlen() ~ -> - let g:Align_xstrlen= 0 - -< This is the fastest method, but it doesn't handle multibyte characters - well. It is the default for: - - enc=latin1 - vim compiled without multi-byte support - $LANG is en_US.UTF-8 (assuming USA english) - - Number of codepoints (Latin a + combining circumflex are two codepoints)~ -> - let g:Align_xstrlen= 1 (default) -< - Number of spacing codepoints (Latin a + combining circumflex is one~ - spacing codepoint; a hard tab is one; wide and narrow CJK are one~ - each; etc.)~ -> - let g:Align_xstrlen= 2 -< - Virtual length (counting, for instance, tabs as anything between 1 and~ - 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when~ - immediately preceded by lam, one otherwise, etc.)~ -> - let g:Align_xstrlen= 3 -< - User may specify a function to compute the string length~ -> - let g:Align_xstrlen= "strlen" -< This method will cause Align to call upon the named function returning - string length. it should resemble the |strlen()| function, taking one - argument (the string) for input and returning the string length. - - By putting one of these settings into your <.vimrc>, Align will use an - internal (interpreted) function to determine a string's length instead - of Vim's built-in |strlen()| function. Since the function is - interpreted, Align will run a bit slower but will handle such strings - correctly. The last settings (g:Align_xstrlen= 3 and - g:Align_xstrlen="userfuncname") probably will run the slowest but be - the most accurate. (thanks to Tony Mechelynck for these) - - -ALIGNMENT CONTROL *:AlignCtrl* *align-control* {{{2 - - This command doesn't do the alignment operation itself; instead, it - controls subsequent alignment operation(s). - - The first argument to AlignCtrl is a string which may contain one or - more alignment control settings. Most of the settings are specified - by single letters; the exceptions are the p# and P# commands which - interpret a digit following the p or P as specifying padding about the - separator. - - The typical text line is considered to be composed of two or more - fields separated by one or more separator pattern(s): > - - ws field ws separator ws field ws separator ... -< - where "ws" stands for "white space" such as blanks and/or tabs. - - - SEPARATORS *alignctrl-separators* {{{3 - - As a result, separators may not have white space (tabs or blanks) on - their outsides (ie. ": :" is fine as a separator, but " :: " is - not). Usually such separators are not needed, although a map has been - provided which works around this limitation and aligns on whitespace - (see |alignmap-tsp|). - - However, if you really need to have separators with leading or - trailing whitespace, consider handling them by performing a substitute - first (ie. s/ :: /@/g), do the alignment on the temporary pattern - (ie. @), and then perform a substitute to revert the separators back - to their desired condition (ie. s/@/ :: /g). - - The Align#Align() function (which is invoked by the :Align command) - will first convert tabs over the region into spaces and then apply - alignment control. Except for initial white space, white space - surrounding the fields is ignored. One has three options just for - handling initial white space: - - - --- *alignctrl-w* - wWI INITIAL WHITE SPACE *alignctrl-W* {{{3 - --- *alignctrl-I* - w : ignore all selected lines' initial white space - W : retain all selected lines' initial white space - I : retain only the first line's initial white space and - re-use it for subsequent lines - - Example: Leading white space options: > - +---------------+-------------------+-----------------+ - |AlignCtrl w= :=| AlignCtrl W= := | AlignCtrl I= := | - +------------------+---------------+-------------------+-----------------+ - | Original | w option | W option | I option | - +------------------+---------------+-------------------+-----------------+ - | a := baaa |a := baaa | a := baaa | a := baaa | - | caaaa := deeee |caaaa := deeee | caaaa := deeee | caaaa := deeee| - | ee := f |ee := f | ee := f | ee := f | - +------------------+---------------+-------------------+-----------------+ -< - The original has at least one leading white space on every line. - Using Align with w eliminated each line's leading white space. - Using Align with W preserved each line's leading white space. - Using Align with I applied the first line's leading white space - (three spaces) to each line. - - - ------ *alignctrl-l* - lrc-+: FIELD JUSTIFICATION *alignctrl-r* {{{3 - ------ *alignctrl-c* - - With "lrc", the fields will be left-justified, right-justified, or - centered as indicated by the justification specifiers (lrc). The - "lrc" options are re-used by cycling through them as needed: - - l means llllll.... - r means rrrrrr.... - lr means lrlrlr.... - llr means llrllr.... - - Example: Justification options: Align = > - +------------+-------------------+-------------------+-------------------+ - | Original | AlignCtrl l | AlignCtrl r | AlignCtrl lr | - +------------+-------------------+-------------------+-------------------+ - | a=bb=ccc=1 |a = bb = ccc = 1| a = bb = ccc = 1|a = bb = ccc = 1| - | ccc=a=bb=2 |ccc = a = bb = 2|ccc = a = bb = 2|ccc = a = bb = 2| - | dd=eee=f=3 |dd = eee = f = 3| dd = eee = f = 3|dd = eee = f = 3| - +------------+-------------------+-------------------+-------------------+ - | Alignment |l l l l| r r r r|l r l r| - +------------+-------------------+-------------------+-------------------+ -< - AlignCtrl l : The = separator is repeatedly re-used, as the - cycle only consists of one character (the "l"). - Every time left-justification is used for fields. - AlignCtrl r : The = separator is repeatedly re-used, as the - cycle only consists of one character (the "r"). - Every time right-justification is used for fields - AlignCtrl lr: Again, the "=" separator is repeatedly re-used, - but the fields are justified alternately between - left and right. - - Even more separator control is available! With "-+:": - - - : skip treating the separator as a separator. *alignctrl--* - + : repeat use of the last "lrc" justification *alignctrl-+* - : : treat the rest of the line as a single field *alignctrl-:* - * : like -, but only if g:AlignSkip() returns true *alignctrl-star* - (see |alignctrl-alignskip|) - - Example: More justification options: Align = > - +------------+---------------+--------------------+---------------+ - | Original | AlignCtrl -l | AlignCtrl rl+ | AlignCtrl l: | - +------------+---------------+--------------------+---------------+ - | a=bb=ccc=1 |a=bb = ccc=1 | a = bb = ccc = 1 |a = bb=ccc=1 | - | ccc=a=bb=2 |ccc=a = bb=2 |ccc = a = bb = 2 |ccc = a=bb=2 | - | dd=eee=f=3 |dd=eee = f=3 | dd = eee = f = 3 |dd = eee=f=3 | - +------------+---------------+--------------------+---------------+ - | Alignment |l l | r l l l |l l | - +------------+---------------+--------------------+---------------+ -< - In the first example in "More justification options": - - The first "=" separator is skipped by the "-" specification, - and so "a=bb", "ccc=a", and "dd=eee" are considered as single fields. - - The next "=" separator has its (left side) field left-justified. - Due to the cyclic nature of separator patterns, the "-l" - specification is equivalent to "-l-l-l ...". - - Hence the next specification is a "skip", so "ccc=1", etc are fields. - - In the second example in "More justification options": - - The first field is right-justified, the second field is left - justified, and all remaining fields repeat the last justification - command (ie. they are left justified, too). - - Hence rl+ is equivalent to rlllllllll ... - (whereas plain rl is equivalent to rlrlrlrlrl ... ). - - In the third example in "More justification options": - - The text following the first separator is treated as a single field. - - Thus using the - and : operators one can apply justification to a - single separator. - - ex. 1st separator only: AlignCtrl l: - 2nd separator only: AlignCtrl -l: - 3rd separator only: AlignCtrl --l: - etc. - - *g:AlignSkip* - Align Skip Control *alignctrl-alignskip* - - The separator control '*' permits a function to decide whether or - not a character which matches the current separator pattern should - instead be skipped. - - 1. Define a function; example: > - - fun! AlignSkipString(lineno,indx) - let synid = synID(a:lineno,a:indx+1,1) - let synname = synIDattr(synIDtrans(synid),"name") - let ret= (synname == "String")? 1 : 0 - return ret - endfun -< - Input: lineno: current line number - indx : index to character; leftmost character - in the line has an indx of 0 (like |strpart()|) - Output: 0 : if separator is ok - 1 : skip separator like it was a '-' - - 2. Set up |g:AlignSkip| as a function reference (see |Funcref|): > - - let g:AlignSkip= function("AlignSkipString") -< - 3. Use * as a separator control where a separator potentially should - be skipped over. - - - --- *alignctrl-=* - =C CYCLIC VS ALL-ACTIVE SEPARATORS *alignctrl-C* {{{3 - --- - - The separators themselves may be considered as equivalent and - simultaneously active ("=") or sequentially cycled through ("C"). - Separators are regular expressions (|regexp|) and are specified as the - second, third, etc arguments. When the separator patterns are - equivalent and simultaneously active, there will be one pattern - constructed: > - - AlignCtrl ... pat1 pat2 pat3 -< becomes > - \(pat1\|pat2\|pat3\) -< (ie. pat1 -or- pat2 -or- pat3; see |/bar|) - - Each separator pattern is thus equivalent and simultaneously active. - The cyclic separator AlignCtrl option stores a list of patterns, only - one of which is active for each field at a time. - - Example: Equivalent/Simultaneously-Active vs Cyclic Separators > - +-------------+------------------+---------------------+----------------------+ - | Original | AlignCtrl = = + -| AlignCtrl = = | AlignCtrl C = + - | - +-------------+------------------+---------------------+----------------------+ - |a = b + c - d|a = b + c - d |a = b + c - d |a = b + c - d | - |x = y = z + 2|x = y = z + 2 |x = y = z + 2|x = y = z + 2 | - |w = s - t = 0|w = s - t = 0 |w = s - t = 0 |w = s - t = 0 | - +-------------+------------------+---------------------+----------------------+ -< - The original is initially aligned with all operators (=+-) being - considered as equivalent and simultaneously active field separators. - Thus the "AlignCtrl = = + -" example shows no change. - - The second example only accepts the '=' as a field separator; - consequently "b + c - d" is now a single field. - - The third example illustrates cyclic field separators and is analyzed - in the following illustration: > - - field1 separator field2 separator field3 separator field4 - a = b + c - d - x = y = z + 2 - w = s - t = 0 -< - The word "cyclic" is used because the patterns form a cycle of use; in - the above case, its = + - = + - = + - = + -... - - Example: Cyclic separators > - Label : this is some text discussing ":"s | ex. abc:def:ghi - Label : this is some text with a ":" in it | ex. abc:def -< - apply AlignCtrl lWC : | | - (select lines)Align > - Label : this is some text discussing ":"s | ex. abc:def:ghi - Label : this is some text with a ":" in it | ex. abcd:efg -< - In the current example, - : is the first separator So the first ":"s are aligned - | is the second separator but subsequent ":"s are not. - | is the third separator The "|"s are aligned, too. - : is the fourth separator Since there aren't two bars, - | is the fifth separator the subsequent potential cycles - | is the sixth separator don't appear. - ... - - In this case it would probably have been a better idea to have used > - AlignCtrl WCl: : | -< as that alignment control would guarantee that no more cycling - would be used after the vertical bar. - - Example: Cyclic separators - - Original: > - a| b&c | (d|e) & f-g-h - aa| bb&cc | (dd|ee) & ff-gg-hh - aaa| bbb&ccc | (ddd|eee) & fff-ggg-hhh -< - AlignCtrl C | | & - > - a | b&c | (d|e) & f - g-h - aa | bb&cc | (dd|ee) & ff - gg-hh - aaa | bbb&ccc | (ddd|eee) & fff - ggg-hhh -< - In this example, - the first and second separators are "|", - the third separator is "&", and - the fourth separator is "-", - - (cycling) - the fifth and sixth separators are "|", - the seventh separator is "&", and - the eighth separator is "-", etc. - - Thus the first "&"s are (not yet) separators, and hence are treated as - part of the field. Ignoring white space for the moment, the AlignCtrl - shown here means that Align will work with > - - field | field | field & field - field | field | field & field - ... -< - - --- *alignctrl-<* - <>| SEPARATOR JUSTIFICATION *alignctrl->* {{{3 - --- *alignctrl-|* - - Separators may be of differing lengths as shown in the example below. - Hence they too may be justified left, right, or centered. - Furthermore, separator justification specifications are cyclic: - - < means <<<<<... justify separator(s) to the left - > means >>>>>... justify separator(s) to the right - | means |||||... center separator(s) - - Example: Separator Justification: Align -\+ > - +-----------------+ - | Original | - +-----------------+ - | a - bbb - c | - | aa -- bb -- ccc | - | aaa --- b --- cc| - +---------------------+-+-----------------+-+---------------------+ - | AlignCtrl < | AlignCtrl > | AlignCtrl | | - +---------------------+---------------------+---------------------+ - | a - bbb - c | a - bbb - c | a - bbb - c | - | aa -- bb -- ccc | aa -- bb -- ccc | aa -- bb -- ccc | - | aaa --- b --- cc | aaa --- b --- cc | aaa --- b --- cc | - +---------------------+---------------------+---------------------+ -< - - --- *alignctrl-g* - gv SELECTIVE APPLICATION *alignctrl-v* {{{3 - --- - - - These two options provide a way to select (g) or to deselect (v) lines - based on a pattern. Ideally :g/pat/Align would work; unfortunately - it results in Align#Align() being called on each line satisfying the - pattern separately. > - - AlignCtrl g pattern -< - Align will only consider those lines which have the given pattern. > - - AlignCtrl v pattern -< - Align will only consider those lines without the given pattern. As an - example of use, consider the following example: > - - :AlignCtrl v ^\s*/\* - Original :Align = :Align = - +----------------+------------------+----------------+ - |one= 2; |one = 2; |one = 2; | - |three= 4; |three = 4; |three = 4; | - |/* skip=this */ |/* skip = this */ |/* skip=this */ | - |five= 6; |five = 6; |five = 6; | - +----------------+------------------+----------------+ -< - The first "Align =" aligned with all "="s, including the one in the - "/* skip=this */" comment. - - The second "Align =" had a AlignCtrl v-pattern which caused it to skip - (ignore) the "/* skip=this */" line when aligning. - - To remove AlignCtrl's g and v patterns, use (as appropriate) > - - AlignCtrl g - AlignCtrl v -< - To see what g/v patterns are currently active, just use the reporting - capability of an unadorned call to AlignCtrl: > - - AlignCtrl -< - - --- - m MAP SUPPORT *alignctrl-m* {{{3 - --- - - This option primarily supports the development of maps. The - Align#AlignCtrl() call will first do an Align#AlignPush() (ie. retain - current alignment control settings). The next Align#Align() will, in - addition to its alignment job, finish up with an Align#AlignPop(). - Thus the Align#AlignCtrl settings that follow the "m" are only - temporarily in effect for just the next Align#Align(). - - - --- - p### *alignctrl-p* - P### PADDING *alignctrl-P* {{{3 - --- - - These two options control pre-padding and post-padding with blanks - about the separator. One may pad separators with zero to nine spaces; - the padding number(s) is/are treated as a cyclic parameter. Thus one - may specify padding separately for each field or re-use a padding - pattern. > - - Example: AlignCtrl p102P0 - +---------+----------------------------------+ - | Original| a=b=c=d=e=f=g=h=1 | - | Align = | a =b=c =d =e=f =g =h=1 | - +---------+----------------------------------+ - | prepad | 1 0 2 1 0 2 1 0 | - +---------+----------------------------------+ -< - This example will cause Align to: - - pre-pad the first "=" with a single blank, - pre-pad the second "=" with no blanks, - pre-pad the third "=" with two blanks, - pre-pad the fourth "=" with a single blank, - pre-pad the fifth "=" with no blanks, - pre-pad the sixth "=" with two blanks, - etc. - - --------------- *alignctrl-settings* - No option given DISPLAY STATUS *alignctrl-* {{{3 - --------------- *alignctrl-no-option* - - AlignCtrl, when called with no arguments, will display the current - alignment control settings. A typical display is shown below: > - - AlignCtrl<=> qty=1 AlignStyle Padding<1|1> - Pat1<\(=\)> -< - Interpreting, this means that the separator patterns are all - equivalent; in this case, there's only one (qty=1). Fields will be - padded on the right with spaces (left justification), and separators - will be padded on each side with a single space. - - To change one of these items, see: - - AlignCtrl......|alignctrl| - qty............|align-concept| - AlignStyle.....|alignctrl--| |alignctrl-+| |alignctrl-:| |alignctrl-c| - Padding........|alignctrl-p| |alignctrl-P| - - One may get a string which can be fed back into AlignCtrl: > - - :let alignctrl= Align#AlignCtrl() -< - This form will put a string describing the current AlignCtrl options, - except for the "g" and "v" patterns, into a variable. The - Align#AlignCtrl() function will still echo its settings, however. One - can feed any non-supported "option" to AlignCtrl() to prevent this, - however: > - - :let alignctrl= Align#AlignCtrl("d") - - -ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{2 - - If you'd like to have your own default AlignCtrl, you'll be wanting to - put it in a file such as: > - - $HOME/.vim/after/plugin/AlignPlugin.vim - -< Anything in that file would be sourced at startup, but after your - .vimrc and after $HOME/.vim/plugin/AlignPlugin.vim; hence, :Align - and :AlignCtrl will then be defined. - - -ALIGNMENT *:Align* *align-align* {{{2 - - Once the alignment control has been determined, the user specifies a - range of lines for the Align command/function to do its thing. - Alignment is often done on a line-range basis, but one may also - restrict alignment to a visual block using ctrl-v. For any visual - mode, one types the colon (:) and then "Align". One may, of course, - specify a range of lines: > - - :[range]Align [list-of-separators] -< - where the |:range| is the usual Vim-powered set of possibilities; the - list of separators is the same as the AlignCtrl capability. There is - only one list of separators, but either AlignCtrl or Align can be used - to specify that list. - - An alternative form of the Align command can handle both alignment - control and the separator list: > - - :[range]Align! [alignment-control-string] [list-of-separators] -< - The alignment control string will be applied only for this particular - application of Align (it uses |alignctrl-m|). The "g pattern" and - "v pattern" alignment controls (see |alignctrl-g| and |alignctrl-v|) - are also available via this form of the Align command. - - Align makes two passes over the text to be aligned. The first pass - determines how many fields there are and determines the maximum sizes - of each field; these sizes are then stored in a vector. The second - pass pads the field (left/right/centered as specified) to bring its - length up to the maximum size of the field. Then the separator and - its AlignCtrl-specified padding is appended. - - Pseudo-Code:~ - During pass 1 - | For all fields in the current line - || Determine current separator - || Examine field specified by current separator - || Determine length of field and save if largest thus far - Initialize newline based on initial whitespace option (wWI) - During pass 2 - | For all fields in current line - || Determine current separator - || Extract field specified by current separator - || Prepend/append padding as specified by AlignCtrl - || (right/left/center)-justify to fit field into max-size field - || Append separator with AlignCtrl-specified separator padding - || Delete current line, install newly aligned line - - The g and v AlignCtrl patterns cause the passes not to consider lines - for alignment, either by requiring that the g-pattern be present or - that the v-pattern not be present. - - The whitespace on either side of a separator is ignored. - - -============================================================================== -4. Alignment Maps *alignmaps* *align-maps* {{{1 - - There are a number of maps provided in the AlignMaps plugin which - depend upon the Align plugin. The maps provided by AlignMaps - typically start with a leading "t" (for the older "textab" program - which Align supercedes) or with an "a" for the more complicated - alignment maps. - - The AlignMaps plugin, although provided in the vimball containing - Align.vim, is really a separate plugin (Align doesn't depend on - AlignMaps). Consequently, if you'd rather not have AlignMaps's - mappings, just use the *:AlignMapsClean* command to remove its - components. The :AlignMapsClean command does not remove any maps - generated by AlignMaps in the current instance of vim. - - The maps are shown below with a leading backslash (\). However, the - actual maps use the construct (see |mapleader|), so the maps' - leading kick-off character is easily customized. - - Furthermore, all the maps specified by the AlignMaps plugin use the - construct (see ||and |usr_41.txt|). Hence, if one wishes - to override the mapping(s) entirely, one may do that, too. As an - example: > - map ACOM AM_acom -< would have \ACOM do - what \acom previously did (assuming that the mapleader has been left - at its default value of a backslash). - - \a, : useful for breaking up comma-separated - declarations prior to \adec |alignmap-a,| - \a( : aligns ( and , (useful for prototypes) *alignmap-a(* - \a? : aligns (...)? ...:... expressions on ? and : |alignmap-a?| - \a< : aligns << and >> for c++ |alignmap-a<| - \a= : aligns := assignments |alignmap-a=| - \abox : draw a C-style comment box around text lines |alignmap-abox| - \acom : useful for aligning comments |alignmap-acom| - \adcom: useful for aligning comments in declarations |alignmap-adcom| - \anum : useful for aligning numbers |alignmap-anum| - NOTE: For the visual-mode use of \anum, is needed! - See http://www.drchip.org/astronaut/vim/index.html#VIS - \aenum: align a European-style number |alignmap-anum| - \aunum: align a USA-style number |alignmap-anum| - \adec : useful for aligning declarations |alignmap-adec| - \adef : useful for aligning definitions |alignmap-adef| - \afnc : useful for aligning ansi-c style functions' - argument lists |alignmap-afnc| - \adcom: a variant of \acom, restricted to comment |alignmap-adcom| - containing lines only, but also only for - those which don't begin with a comment. - Good for certain declaration styles. - \aocom: a variant of \acom, restricted to comment |alignmap-aocom| - containing lines only - \tab : align a table based on tabs *alignmap-tab* - (converts to spaces) - \tml : useful for aligning the trailing backslashes |alignmap-tml| - used to continue lines (shell programming, etc) - \tsp : use Align to make a table separated by blanks |alignmap-tsp| - (left justified) - \ts, : like \t, but swaps whitespace on the right of *alignmap-ts,* - the commas to their left - \ts: : like \t: but swaps whitespace on the right of *alignmap-ts:* - the colons to their left - \ts< : like \t< but swaps whitespace on the right of *alignmap-ts<* - the less-than signs to their left - \ts= : like \t= but swaps whitespace on the right of *alignmap-ts=* - the equals signs to their left - \Tsp : use Align to make a table separated by blanks |alignmap-Tsp| - (right justified) - \tsq : use Align to make a table separated by blanks |alignmap-tsq| - (left justified) -- "strings" are not split up - \tt : useful for aligning LaTeX tabular tables |alignmap-tt| - \Htd : tabularizes html tables: |alignmap-Htd| - ...field... ...field... - - *alignmap-t|* *alignmap-t#* *alignmap-t,* *alignmap-t:* - *alignmap-t;* *alignmap-t<* *alignmap-t?* *alignmap-t~* - *alignmap-m=* - \tx : make a left-justified alignment on - character "x" where "x" is: ,:<=@|# |alignmap-t=| - \Tx : make a right-justified alignment on - character "x" where "x" is: ,:<=@# |alignmap-T=| - \m= : like \t= but aligns with %... style comments - - The leading backslash is actually (see |mapleader| to learn - how to customize the leader to be whatever you like). These maps use - the package and are defined in the file. - Although the maps use AlignCtrl options, they typically use the "m" - option which pushes the options (AlignPush). The associated Align - call which follows will then AlignPop the user's original options - back. - - ALIGNMENT MAP USE WITH MARK AND MOVE~ - In the examples below, one may select the text with a "ma" at the - first line, move to the last line, then execute the map. - - ALIGNMENT MAP USE WITH VISUAL MODE~ - Alternatively, one may select the text with the "V" visual mode - command. - - If you want to use visual-block mode (ctrl-v), I suggest using - an AlignMap with the vis.vim plugin, available at either - - stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195 - devel : http://www.drchip.org/astronaut/vim/index.html#VIS - - Use it with commands such as > - - ctrl-v (move) - :B norm \alignmap_sequence -< - - ALIGNMENT MAP USE WITH MENUS~ - One may use the mark-and-move style (ma, move, use the menu) or - the visual mode style (use the V visual mode, move, then select - the alignment map with menu selection). The alignment map menu - items are under DrChip.AlignMaps . - - One may even change the top level menu name to whatever is wished; by - default, its > - let g:DrChipTopLvlMenu= "DrChip." -< If you set the variable to the empty string (""), then no menu items - will be produced. Of course, one must have a vim with +menu, the gui - must be running, and |'go'| must have the menu bar suboption (ie. m - must be included). - - COMPLEX ALIGNMENT MAP METHOD~ - For those complex alignment maps which do alignment on constructs - (e.g. \acom, \adec, etc), a series of substitutes is used to insert - "@" symbols in appropriate locations. Align#Align() is then used to - do alignment directly on "@"s; then it is followed by further - substitutes to do clean-up. However, the maps \WS and \WE, used by - every map supported by AlignMaps, protect any original embedded "@" - symbols by first converting them to characters, doing the - requested job, and then converting them back. > - - \WS calls AlignMaps#WrapperStart() - \WE calls AlignMaps#WrapperEnd() -< - - --------------------------- - Alignment Map Examples: \a, *alignmap-a,* {{{3 - --------------------------- - - Original: illustrates comma-separated declaration splitting: > - int a,b,c; - struct ABC_str abc,def; -< - Becomes: > - int a; - int b; - int c; - struct ABC_str abc; - struct ABC_str def; -< - - --------------------------- - Alignment Map Examples: \a? *alignmap-a?* {{{3 - --------------------------- - - Original: illustrates ()?: aligning > - printf("<%s>\n", - (x == ABC)? "abc" : - (x == DEFG)? "defg" : - (x == HIJKL)? "hijkl" : "???"); -< - Becomes: select "(x == ..." lines, then \a? > - printf("<%s>\n", - (x == ABC)? "abc" : - (x == DEFG)? "defg" : - (x == HIJKL)? "hijkl" : "???"); -< - - --------------------------- - Alignment Map Examples: \a< *alignmap-a<* {{{3 - --------------------------- - - Original: illustrating aligning of << and >> > - cin << x; - cin << y; - cout << "this is x=" << x; - cout << "but y=" << y << "is not"; -< - Becomes: select "(x == ..." lines, then \a< > - cin << x; - cin << y; - cout << "this is x=" << x; - cout << "but y=" << y << "is not"; -< - - --------------------------- - Alignment Map Examples: \a= *alignmap-a=* {{{3 - --------------------------- - - Original: illustrates how to align := assignments > - aa:=bb:=cc:=1; - a:=b:=c:=1; - aaa:=bbb:=ccc:=1; -< - Bcomes: select the three assignment lines, then \a:= > - aa := bb := cc := 1; - a := b := c := 1; - aaa := bbb := ccc := 1; -< - - --------------------------- - Alignment Map Examples: \abox *alignmap-abox* {{{3 - --------------------------- - - Original: illustrates how to comment-box some text > - This is some plain text - which will - soon be surrounded by a - comment box. -< - Becomes: Select "This..box." with ctrl-v, press \abox > - /*************************** - * This is some plain text * - * which will * - * soon be surrounded by a * - * comment box. * - ***************************/ -< - - --------------------------- - Alignment Map Examples: \acom *alignmap-acom* {{{3 - --------------------------- - - Original: illustrates aligning C-style comments (works for //, too) > - if(itworks) { /* this */ - then= dothis; /* is a */ - } /* set of three comments */ -< - Becomes: Select the three lines, press \acom > - if(itworks) { /* this */ - then= dothis; /* is a */ - } /* set of three comments */ -< - Also see |alignmap-aocom| - - - --------------------------- - Alignment Map Examples: \anum *alignmap-anum* {{{3 - --------------------------- - - First, note that the behavior of the \anum map depends on the existence - of either the vim variable > - g:alignmaps_usanumber -< or > - g:alignmaps_euronumber -< when AlignMaps is loaded. - - Essentially, "usa" numbers use "."s and "euro" numbers use ","s to - separate the integer from the fractional portion of a number. - "Usa" numbers are default. - - Original: illustrates how to get numbers lined up > - -1.234 .5678 -.901e-4 - 1.234 5.678 9.01e-4 - 12.34 56.78 90.1e-4 - 123.4 567.8 901.e-4 -< - Becomes: Go to first line, ma. Go to last line, press \anum > - -1.234 .5678 -.901e-4 - 1.234 5.678 9.01e-4 - 12.34 56.78 90.1e-4 - 123.4 567.8 901.e-4 -< - Original: > - | -1.234 .5678 -.901e-4 | - | 1.234 5.678 9.01e-4 | - | 12.34 56.78 90.1e-4 | - | 123.4 567.8 901.e-4 | -< - Becomes: Select the numbers with ctrl-v (visual-block mode), > - press \anum - | -1.234 .5678 -.901e-4 | - | 1.234 5.678 9.01e-4 | - | 12.34 56.78 90.1e-4 | - | 123.4 567.8 901.e-4 | -< - Original: > - -1,234 ,5678 -,901e-4 - 1,234 5,678 9,01e-4 - 12,34 56,78 90,1e-4 - 123,4 567,8 901,e-4 -< - Becomes: (assuming g:alignmaps_euronumber exists) - Go to first line, ma. Go to last line, press \anum > - -1,234 ,5678 -,901e-4 - 1,234 5,678 9,01e-4 - 12,34 56,78 90,1e-4 - 123,4 567,8 901,e-4 -< - In addition: - \aenum is provided to support European-style numbers - \aunum is provided to support USA-style numbers - - *g:alignmaps_usanumber* *g:alignmaps_euronumber* - One may get \aenum behavior for \anum by putting > - let g:alignmaps_euronumber= 1 -< or \aunum behavior for \anum by putting > - let g:alignmaps_usanumber= 1 -< in one's <.vimrc>. - - - --------------------------- - Alignment Map Examples: \ascom *alignmap-ascom* {{{3 - --------------------------- - - Original: > - /* A Title */ - int x; /* this is a comment */ - int yzw; /* this is another comment*/ -< - Becomes: Select the three lines, press \ascom > - /* A Title */ - int x; /* this is a comment */ - int yzw; /* this is another comment */ -< - - --------------------------- - Alignment Map Examples: \adec *alignmap-adec* {{{3 - --------------------------- - - Original: illustrates how to clean up C/C++ declarations > - int a; - float b; - double *c=NULL; - char x[5]; - struct abc_str abc; - struct abc_str *pabc; - int a; /* a */ - float b; /* b */ - double *c=NULL; /* b */ - char x[5]; /* x[5] */ - struct abc_str abc; /* abc */ - struct abc_str *pabc; /* pabc */ - static int a; /* a */ - static float b; /* b */ - static double *c=NULL; /* b */ - static char x[5]; /* x[5] */ - static struct abc_str abc; /* abc */ - static struct abc_str *pabc; /* pabc */ -< - Becomes: Select the declarations text, then \adec > - int a; - float b; - double *c = NULL; - char x[5]; - struct abc_str abc; - struct abc_str *pabc; - int a; /* a */ - float b; /* b */ - double *c = NULL; /* b */ - char x[5]; /* x[5] */ - struct abc_str abc; /* abc */ - struct abc_str *pabc; /* pabc */ - static int a; /* a */ - static float b; /* b */ - static double *c = NULL; /* b */ - static char x[5]; /* x[5] */ - static struct abc_str abc; /* abc */ - static struct abc_str *pabc; /* pabc */ -< - - --------------------------- - Alignment Map Examples: \adef *alignmap-adef* {{{3 - --------------------------- - - Original: illustrates how to line up #def'initions > - #define ONE 1 - #define TWO 22 - #define THREE 333 - #define FOUR 4444 -< - Becomes: Select four definition lines, apply \adef > - # define ONE 1 - # define TWO 22 - # define THREE 333 - # define FOUR 4444 -< - - --------------------------- - Alignment Map Examples: \afnc *alignmap-afnc* {{{3 - --------------------------- - - This map is an exception to the usual selection rules. - It uses "]]" to find the function body's leading "{". - Just put the cursor anywhere in the function arguments and - the entire function declaration should be processed. - - Because "]]" looks for that "{" in the first column, the - "original" and "becomes" examples are in the first column, - too. - - Original: illustrates lining up ansi-c style function definitions > - int f( - struct abc_str ***a, /* one */ - long *b, /* two */ - int c) /* three */ - { - } -< - Becomes: put cursor anywhere before the '{', press \afnc > - int f( - struct abc_str ***a, /* one */ - long *b, /* two */ - int c) /* three */ - { - } -< - - --------------------------- - Alignment Map Examples: \adcom *alignmap-adcom* {{{3 - --------------------------- - - Original: illustrates aligning comments that don't begin - lines (optionally after some whitespace). > - struct { - /* this is a test */ - int x; /* of how */ - double y; /* to use adcom */ - }; -< - Becomes: Select the inside lines of the structure, - then press \adcom. The comment-only - line is ignored but the other two comments - get aligned. > - struct { - /* this is a test */ - int x; /* of how */ - double y; /* to use adcom */ - }; -< - - --------------------------- - Alignment Map Examples: \aocom *alignmap-aocom* {{{3 - --------------------------- - - Original: illustrates how to align C-style comments (works for //, too) - but restricted only to aligning with those lines containing - comments. See the difference from \acom (|alignmap-acom|). > - if(itworks) { /* this comment */ - then= dothis; - } /* only appears on two lines */ -< - Becomes: Select the three lines, press \aocom > - if(itworks) { /* this comment */ - then= dothis; - } /* only appears on two lines */ -< - Also see |alignmap-acom| - - - --------------------------- *alignmap-Tsp* - Alignment Map Examples: \tsp *alignmap-tsp* {{{3 - --------------------------- - - Normally Align can't use white spaces for field separators as such - characters are ignored surrounding field separators. The \tsp and - \Tsp maps get around this limitation. - - Original: > - one two three four five - six seven eight nine ten - eleven twelve thirteen fourteen fifteen -< - Becomes: Select the lines, \tsp > - one two three four five - six seven eight nine ten - eleven twelve thirteen fourteen fifteen -< - Becomes: Select the lines, \Tsp > - one two three four five - six seven eight nine ten - eleven twelve thirteen fourteen fifteen -< - - --------------------------- - Alignment Map Examples: \tsq *alignmap-tsq* {{{3 - --------------------------- - - The \tsp map is useful for aligning tables based on white space, - but sometimes one wants double-quoted strings to act as a single - object in spite of embedded spaces. The \tsq map was invented - to support this. (thanks to Leif Wickland) - - Original: > - "one two" three - four "five six" -< - Becomes: Select the lines, \tsq > - "one two" three - four "five six" -< - - --------------------------- - Alignment Map Examples: \tt *alignmap-tt* {{{3 - --------------------------- - - Original: illustrates aligning a LaTex Table > - \begin{tabular}{||c|l|r||} - \hline\hline - one&two&three\\ \hline - four&five&six\\ - seven&eight&nine\\ - \hline\hline - \end{tabular} -< - Becomes: Select the three lines inside the table > - (ie. one..,four..,seven..) and press \tt - \begin{tabular}{||c|l|r||} - \hline\hline - one & two & three \\ \hline - four & five & six \\ - seven & eight & nine \\ - \hline\hline - \end{tabular} -< - - ---------------------------- - Alignment Map Examples: \tml *alignmap-tml* {{{3 - ---------------------------- - - Original: illustrates aligning multi-line continuation marks > - one \ - two three \ - four five six \ - seven \\ \ - eight \nine \ - ten \ -< - Becomes: > - one \ - two three \ - four five six \ - seven \\ \ - eight \nine \ - ten \ -< - - --------------------------- - Alignment Map Examples: \t= *alignmap-t=* {{{3 - --------------------------- - - Original: illustrates left-justified aligning of = > - aa=bb=cc=1;/*one*/ - a=b=c=1;/*two*/ - aaa=bbb=ccc=1;/*three*/ -< - Becomes: Select the three equations, press \t= > - aa = bb = cc = 1; /* one */ - a = b = c = 1; /* two */ - aaa = bbb = ccc = 1; /* three */ -< - - --------------------------- - Alignment Map Examples: \T= *alignmap-T=* {{{3 - --------------------------- - - Original: illustrates right-justified aligning of = > - aa=bb=cc=1; /* one */ - a=b=c=1; /* two */ - aaa=bbb=ccc=1; /* three */ -< - Becomes: Select the three equations, press \T= > - aa = bb = cc = 1; /* one */ - a = b = c = 1; /* two */ - aaa = bbb = ccc = 1; /* three */ -< - - --------------------------- - Alignment Map Examples: \Htd *alignmap-Htd* {{{3 - --------------------------- - - Original: for aligning tables with html > - ...field one......field two... - ...field three......field four... -< - Becomes: Select ... lines, press \Htd > - ...field one... ...field two... - ...field three... ...field four... -< -============================================================================== -4. Alignment Tools' History *align-history* {{{1 - -ALIGN HISTORY {{{2 - v37 Nov 29, 2012 * (Kim Jang-hwan) reported that with g:Align_xstrlen - set to 3 that the cursor was moved (linewise) - after invocation. Fixed. - Jan 07, 2013 * now has visual mode mappings to accompany all - normal mode mappings (use |V| to invoke) - v36 May 20, 2009 * Previously, the "W" AlignCtrl setting, intended - to retain initial white space, did so by convert- - ing any leading tabs into an equivalent quantity - of blanks (using the current tabstop setting). - Align will now retain leading tabs. - Nov 24, 2009 * QArgSplitter() used split(), intending to split - on white space only. However, the \tab map - uses ctrl-o as a separator instead of tabs; the - split() function treated the ctrl-o as a whitespace - character, too. Solution: give split() an explicit - pattern matching blanks and tabs, only. \tab now - works again! - Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support - May 10, 2011 * if the range is only one line, then Align will - automatically grow the range to accommodate all - lines containing the first separator pattern - surrounding the current line. - Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to - specify a function by name which computes string - length. - Oct 27, 2011 * (reported by Fco Javier) reported a problem with - the default s:Strlen() result; there was a missing - "let". Fixed. - Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when - it should've been doing "setlocal noet". - Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when - g:Align_xstrlen is zero. - v35 Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading - installed - Nov 19, 2008 * new sanity check for an AlignStyle of just ":" - Jan 08, 2009 * save&restore of |'mod'| now done with local - variant - v34 Jul 08, 2008 * using :AlignCtrl before entering any alignment - control commands was causing an error. - v33 Sep 20, 2007 * s:Strlen() introduced to support various ways - used to represent characters and their effects - on string lengths. See |align-strlen|. - * Align now accepts "..." -- so it can accept - whitespace as separators. - v32 Aug 18, 2007 * uses || instead of || plus a - custom argument splitter to allow patterns with - backslashes to slide in unaltered. - v31 Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s) - implemented. - v30 Feb 12, 2007 * now uses |setline()| - v29 Jan 18, 2006 * cecutil updated to use keepjumps - Feb 23, 2006 * Align now converted to vim 7.0 style using - auto-loading functions. - v28 Aug 17, 2005 * report option workaround - Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed - v27 Apr 15, 2005 * cpo workaround - ignorecase workaround - v26 Aug 20, 2004 * loaded_align now also indicates version number - GetLatestVimScripts :AutoInstall: now supported - v25 Jul 27, 2004 * For debugging, uses Dfunc(), Dret(), and Decho() - v24 Mar 03, 2004 * (should've done this earlier!) visualmode(1) - not supported until v6.2, now Align will avoid - calling it for earlier versions. Visualmode - clearing won't take place then, of course. - v23 Oct 07, 2003 * Included Leif Wickland's ReplaceQuotedSpaces() - function which supports \tsq - v22 Jan 29, 2003 * Now requires 6.1.308 or later to clear visualmode() - v21 Jan 10, 2003 * BugFix: similar problem to #19; new code - bypasses "norm! v\" until initialization - is over. - v20 Dec 30, 2002 * BugFix: more on "unable to highlight" fixed - v19 Nov 21, 2002 * BugFix: some terminals gave an "unable to highlight" - message at startup; Hari Krishna Dara tracked it - down; a silent! now included to prevent noise. - v18 Nov 04, 2002 * BugFix: re-enabled anti-repeated-loading - v17 Nov 04, 2002 * BugFix: forgot to have AlignPush() push s:AlignSep - AlignCtrl now clears visual-block mode when used so - that Align won't try to use old visual-block - selection marks '< '> - v16 Sep 18, 2002 * AlignCtrl <>| options implemented (separator - justification) - v15 Aug 22, 2002 * bug fix: AlignCtrl's ":" now acts as a modifier of - the preceding alignment operator (lrc) - v14 Aug 20, 2002 * bug fix: AlignCtrl default now keeps &ic unchanged - bug fix: Align, on end-field, wasn't using correct - alignop bug fix: Align, on end-field, was appending - padding - v13 Aug 19, 2002 * bug fix: zero-length g/v patterns are accepted - bug fix: always skip blank lines - bug fix: AlignCtrl default now also clears g and v - patterns - v12 Aug 16, 2002 * moved keep_ic above zero-length pattern checks - added "AlignCtrl default" - fixed bug with last field getting separator spaces - at end line - v11 Jul 08, 2002 * prevent separator patterns which match zero length - -+: included as additional alignment/justification - styles - v10 Jun 26, 2002 * =~# used instead of =~ (for matching case) - ignorecase option handled - v09 Jun 25, 2002 * implemented cyclic padding - -ALIGNMENT MAP HISTORY *alignmap-history* {{{2 - v43 Nov 28, 2012 * changed a lot of maps to use nnoremap (instead - of map) - Jan 07, 2013 * - v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum - Feb 16, 2010 * map for \t=, \T= now handles x++ = something; - for c, c++ correctly. - Oct 29, 2010 * added a note on having one's own default - AlignCtrl (see |alignctrl-init|) - Feb 22, 2011 * for menus, &go =~# used to insure correct case - Jun 10, 2011 * |:AlignMapsClean| command provided to make it - easy for those who would prefer not to have - AlignMaps' maps not to have them. - v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent - re-loading installed - * AlignMaps now use 0x0f (ctrl-p) for special - character substitutions (instead of 0xff). - Seems to avoid some problems with having to - use Strlen(). - * bug fixed with \ts, - * new maps: \ts; \ts, \ts: \ts< \ts= \a( - v40 Oct 21, 2008 * Modified AlignMaps so that its maps use s - and