mirror of https://github.com/akelge/zsh
migration
This commit is contained in:
parent
fec1d63a8d
commit
0d61c334d7
|
@ -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')
|
File diff suppressed because it is too large
Load Diff
|
@ -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 <cr> 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! '<ma'>
|
||||
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 <unique> ".maplead.a:mapname." <Plug>AM_".a:mapname
|
||||
exe "vmap <silent> ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."<cr>"
|
||||
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/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
|
||||
keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/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\<right>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\<CR>\<Esc>"
|
||||
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
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,319 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_globals.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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')
|
||||
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_screen.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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')
|
||||
|
||||
|
|
@ -1,458 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_sole.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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
|
|
@ -1,183 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_sole_communicator.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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
|
|
@ -1,210 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_sole_shared_memory.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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()
|
||||
|
||||
|
|
@ -1,762 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_sole_subprocess.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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
|
||||
|
||||
|
||||
|
|
@ -1,278 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_sole_wrapper.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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
|
|
@ -1,198 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_subprocess.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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
|
|
@ -1,448 +0,0 @@
|
|||
# FILE: autoload/conque_term/conque_win32_util.py
|
||||
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
# 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 ''
|
||||
|
||||
|
|
@ -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 <cr> 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 =~ '\%(\<bash\>\|\<zsh\>\)\%(\.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\<CR>"
|
||||
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\<CR>"
|
||||
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*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$'
|
||||
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 <GetLatestVimScripts.dat> 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
|
|
@ -1,610 +0,0 @@
|
|||
" Text formatter plugin for Vim text editor
|
||||
"
|
||||
" Version: 2.1
|
||||
" Last Change: 2008-09-13
|
||||
" Maintainer: Teemu Likonen <tlikonen@iki.fi>
|
||||
" 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("\<Tab>",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
|
|
@ -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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>colour(r, g, b)
|
||||
" Get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" Get the closest colour
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" There are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>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 <SID>grey_colour(l:gx)
|
||||
else
|
||||
" Use the colour
|
||||
return <SID>rgb_colour(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" Only one possibility
|
||||
return <SID>rgb_colour(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>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 <SID>colour(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" Sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Vim Highlighting
|
||||
call <SID>X("Normal", s:foreground, s:background, "")
|
||||
call <SID>X("LineNr", s:selection, "", "")
|
||||
call <SID>X("NonText", s:selection, "", "")
|
||||
call <SID>X("SpecialKey", s:selection, "", "")
|
||||
call <SID>X("Search", s:background, s:yellow, "")
|
||||
call <SID>X("TabLine", s:window, s:foreground, "reverse")
|
||||
call <SID>X("TabLineFill", s:window, s:foreground, "reverse")
|
||||
call <SID>X("StatusLine", s:window, s:yellow, "reverse")
|
||||
call <SID>X("StatusLineNC", s:window, s:foreground, "reverse")
|
||||
call <SID>X("VertSplit", s:window, s:window, "none")
|
||||
call <SID>X("Visual", "", s:selection, "")
|
||||
call <SID>X("Directory", s:blue, "", "")
|
||||
call <SID>X("ModeMsg", s:green, "", "")
|
||||
call <SID>X("MoreMsg", s:green, "", "")
|
||||
call <SID>X("Question", s:green, "", "")
|
||||
call <SID>X("WarningMsg", s:red, "", "")
|
||||
call <SID>X("MatchParen", "", s:selection, "")
|
||||
call <SID>X("Folded", s:comment, s:background, "")
|
||||
call <SID>X("FoldColumn", "", s:background, "")
|
||||
if version >= 700
|
||||
call <SID>X("CursorLine", "", s:line, "none")
|
||||
call <SID>X("CursorColumn", "", s:line, "none")
|
||||
call <SID>X("PMenu", s:foreground, s:selection, "none")
|
||||
call <SID>X("PMenuSel", s:foreground, s:selection, "reverse")
|
||||
call <SID>X("SignColumn", "", s:background, "none")
|
||||
end
|
||||
if version >= 703
|
||||
call <SID>X("ColorColumn", "", s:line, "none")
|
||||
end
|
||||
|
||||
" Standard Highlighting
|
||||
call <SID>X("Comment", s:comment, "", "")
|
||||
call <SID>X("Todo", s:comment, s:background, "")
|
||||
call <SID>X("Title", s:comment, "", "")
|
||||
call <SID>X("Identifier", s:red, "", "none")
|
||||
call <SID>X("Statement", s:foreground, "", "")
|
||||
call <SID>X("Conditional", s:foreground, "", "")
|
||||
call <SID>X("Repeat", s:foreground, "", "")
|
||||
call <SID>X("Structure", s:purple, "", "")
|
||||
call <SID>X("Function", s:blue, "", "")
|
||||
call <SID>X("Constant", s:orange, "", "")
|
||||
call <SID>X("Keyword", s:orange, "", "")
|
||||
call <SID>X("String", s:green, "", "")
|
||||
call <SID>X("Special", s:foreground, "", "")
|
||||
call <SID>X("PreProc", s:purple, "", "")
|
||||
call <SID>X("Operator", s:aqua, "", "none")
|
||||
call <SID>X("Type", s:blue, "", "none")
|
||||
call <SID>X("Define", s:purple, "", "none")
|
||||
call <SID>X("Include", s:blue, "", "")
|
||||
"call <SID>X("Ignore", "666666", "", "")
|
||||
|
||||
" Vim Highlighting
|
||||
call <SID>X("vimCommand", s:red, "", "none")
|
||||
|
||||
" C Highlighting
|
||||
call <SID>X("cType", s:yellow, "", "")
|
||||
call <SID>X("cStorageClass", s:purple, "", "")
|
||||
call <SID>X("cConditional", s:purple, "", "")
|
||||
call <SID>X("cRepeat", s:purple, "", "")
|
||||
|
||||
" PHP Highlighting
|
||||
call <SID>X("phpVarSelector", s:red, "", "")
|
||||
call <SID>X("phpKeyword", s:purple, "", "")
|
||||
call <SID>X("phpRepeat", s:purple, "", "")
|
||||
call <SID>X("phpConditional", s:purple, "", "")
|
||||
call <SID>X("phpStatement", s:purple, "", "")
|
||||
call <SID>X("phpMemberSelector", s:foreground, "", "")
|
||||
|
||||
" Ruby Highlighting
|
||||
call <SID>X("rubySymbol", s:green, "", "")
|
||||
call <SID>X("rubyConstant", s:yellow, "", "")
|
||||
call <SID>X("rubyAccess", s:yellow, "", "")
|
||||
call <SID>X("rubyAttribute", s:blue, "", "")
|
||||
call <SID>X("rubyInclude", s:blue, "", "")
|
||||
call <SID>X("rubyLocalVariableOrMethod", s:orange, "", "")
|
||||
call <SID>X("rubyCurlyBlock", s:orange, "", "")
|
||||
call <SID>X("rubyStringDelimiter", s:green, "", "")
|
||||
call <SID>X("rubyInterpolationDelimiter", s:orange, "", "")
|
||||
call <SID>X("rubyConditional", s:purple, "", "")
|
||||
call <SID>X("rubyRepeat", s:purple, "", "")
|
||||
call <SID>X("rubyControl", s:purple, "", "")
|
||||
call <SID>X("rubyException", s:purple, "", "")
|
||||
|
||||
" Python Highlighting
|
||||
call <SID>X("pythonInclude", s:purple, "", "")
|
||||
call <SID>X("pythonStatement", s:purple, "", "")
|
||||
call <SID>X("pythonConditional", s:purple, "", "")
|
||||
call <SID>X("pythonRepeat", s:purple, "", "")
|
||||
call <SID>X("pythonException", s:purple, "", "")
|
||||
call <SID>X("pythonFunction", s:blue, "", "")
|
||||
call <SID>X("pythonPreCondit", s:purple, "", "")
|
||||
call <SID>X("pythonRepeat", s:aqua, "", "")
|
||||
call <SID>X("pythonExClass", s:orange, "", "")
|
||||
|
||||
" JavaScript Highlighting
|
||||
call <SID>X("javaScriptBraces", s:foreground, "", "")
|
||||
call <SID>X("javaScriptFunction", s:purple, "", "")
|
||||
call <SID>X("javaScriptConditional", s:purple, "", "")
|
||||
call <SID>X("javaScriptRepeat", s:purple, "", "")
|
||||
call <SID>X("javaScriptNumber", s:orange, "", "")
|
||||
call <SID>X("javaScriptMember", s:orange, "", "")
|
||||
call <SID>X("javascriptNull", s:orange, "", "")
|
||||
call <SID>X("javascriptGlobal", s:blue, "", "")
|
||||
call <SID>X("javascriptStatement", s:red, "", "")
|
||||
|
||||
" CoffeeScript Highlighting
|
||||
call <SID>X("coffeeRepeat", s:purple, "", "")
|
||||
call <SID>X("coffeeConditional", s:purple, "", "")
|
||||
call <SID>X("coffeeKeyword", s:purple, "", "")
|
||||
call <SID>X("coffeeObject", s:yellow, "", "")
|
||||
|
||||
" HTML Highlighting
|
||||
call <SID>X("htmlTag", s:red, "", "")
|
||||
call <SID>X("htmlTagName", s:red, "", "")
|
||||
call <SID>X("htmlArg", s:red, "", "")
|
||||
call <SID>X("htmlScriptTag", s:red, "", "")
|
||||
|
||||
" Diff Highlighting
|
||||
call <SID>X("diffAdd", "", "4c4e39", "")
|
||||
call <SID>X("diffDelete", s:background, s:red, "")
|
||||
call <SID>X("diffChange", "", "2B5B77", "")
|
||||
call <SID>X("diffText", s:line, s:blue, "")
|
||||
|
||||
" ShowMarks Highlighting
|
||||
call <SID>X("ShowMarksHLl", s:orange, s:background, "none")
|
||||
call <SID>X("ShowMarksHLo", s:purple, s:background, "none")
|
||||
call <SID>X("ShowMarksHLu", s:yellow, s:background, "none")
|
||||
call <SID>X("ShowMarksHLm", s:aqua, s:background, "none")
|
||||
|
||||
" Lua Highlighting
|
||||
call <SID>X("luaStatement", s:purple, "", "")
|
||||
call <SID>X("luaRepeat", s:purple, "", "")
|
||||
call <SID>X("luaCondStart", s:purple, "", "")
|
||||
call <SID>X("luaCondElseif", s:purple, "", "")
|
||||
call <SID>X("luaCond", s:purple, "", "")
|
||||
call <SID>X("luaCondEnd", s:purple, "", "")
|
||||
|
||||
" Cucumber Highlighting
|
||||
call <SID>X("cucumberGiven", s:blue, "", "")
|
||||
call <SID>X("cucumberGivenAnd", s:blue, "", "")
|
||||
|
||||
" Go Highlighting
|
||||
call <SID>X("goDirective", s:purple, "", "")
|
||||
call <SID>X("goDeclaration", s:purple, "", "")
|
||||
call <SID>X("goStatement", s:purple, "", "")
|
||||
call <SID>X("goConditional", s:purple, "", "")
|
||||
call <SID>X("goConstants", s:orange, "", "")
|
||||
call <SID>X("goTodo", s:yellow, "", "")
|
||||
call <SID>X("goDeclType", s:blue, "", "")
|
||||
call <SID>X("goBuiltins", s:purple, "", "")
|
||||
|
||||
" Clojure "highlighting
|
||||
call <SID>X("clojureConstant", s:orange, "", "")
|
||||
call <SID>X("clojureBoolean", s:orange, "", "")
|
||||
call <SID>X("clojureCharacter", s:orange, "", "")
|
||||
call <SID>X("clojureKeyword", s:green, "", "")
|
||||
call <SID>X("clojureNumber", s:orange, "", "")
|
||||
call <SID>X("clojureString", s:green, "", "")
|
||||
call <SID>X("clojureRegexp", s:green, "", "")
|
||||
call <SID>X("clojureParen", s:aqua, "", "")
|
||||
call <SID>X("clojureVariable", s:yellow, "", "")
|
||||
call <SID>X("clojureCond", s:blue, "", "")
|
||||
call <SID>X("clojureDefine", s:purple, "", "")
|
||||
call <SID>X("clojureException", s:red, "", "")
|
||||
call <SID>X("clojureFunc", s:blue, "", "")
|
||||
call <SID>X("clojureMacro", s:blue, "", "")
|
||||
call <SID>X("clojureRepeat", s:blue, "", "")
|
||||
call <SID>X("clojureSpecial", s:purple, "", "")
|
||||
call <SID>X("clojureQuote", s:blue, "", "")
|
||||
call <SID>X("clojureUnquote", s:blue, "", "")
|
||||
call <SID>X("clojureMeta", s:blue, "", "")
|
||||
call <SID>X("clojureDeref", s:blue, "", "")
|
||||
call <SID>X("clojureAnonArg", s:blue, "", "")
|
||||
call <SID>X("clojureRepeat", s:blue, "", "")
|
||||
call <SID>X("clojureDispatch", s:blue, "", "")
|
||||
|
||||
" Scala "highlighting
|
||||
call <SID>X("scalaKeyword", s:purple, "", "")
|
||||
call <SID>X("scalaKeywordModifier", s:purple, "", "")
|
||||
call <SID>X("scalaOperator", s:blue, "", "")
|
||||
call <SID>X("scalaPackage", s:red, "", "")
|
||||
call <SID>X("scalaFqn", s:foreground, "", "")
|
||||
call <SID>X("scalaFqnSet", s:foreground, "", "")
|
||||
call <SID>X("scalaImport", s:purple, "", "")
|
||||
call <SID>X("scalaBoolean", s:orange, "", "")
|
||||
call <SID>X("scalaDef", s:purple, "", "")
|
||||
call <SID>X("scalaVal", s:purple, "", "")
|
||||
call <SID>X("scalaVar", s:aqua, "", "")
|
||||
call <SID>X("scalaClass", s:purple, "", "")
|
||||
call <SID>X("scalaObject", s:purple, "", "")
|
||||
call <SID>X("scalaTrait", s:purple, "", "")
|
||||
call <SID>X("scalaDefName", s:blue, "", "")
|
||||
call <SID>X("scalaValName", s:foreground, "", "")
|
||||
call <SID>X("scalaVarName", s:foreground, "", "")
|
||||
call <SID>X("scalaClassName", s:foreground, "", "")
|
||||
call <SID>X("scalaType", s:yellow, "", "")
|
||||
call <SID>X("scalaTypeSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaAnnotation", s:orange, "", "")
|
||||
call <SID>X("scalaNumber", s:orange, "", "")
|
||||
call <SID>X("scalaDefSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaClassSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaBackTick", s:green, "", "")
|
||||
call <SID>X("scalaRoot", s:foreground, "", "")
|
||||
call <SID>X("scalaMethodCall", s:blue, "", "")
|
||||
call <SID>X("scalaCaseType", s:yellow, "", "")
|
||||
call <SID>X("scalaLineComment", s:comment, "", "")
|
||||
call <SID>X("scalaComment", s:comment, "", "")
|
||||
call <SID>X("scalaDocComment", s:comment, "", "")
|
||||
call <SID>X("scalaDocTags", s:comment, "", "")
|
||||
call <SID>X("scalaEmptyString", s:green, "", "")
|
||||
call <SID>X("scalaMultiLineString", s:green, "", "")
|
||||
call <SID>X("scalaUnicode", s:orange, "", "")
|
||||
call <SID>X("scalaString", s:green, "", "")
|
||||
call <SID>X("scalaStringEscape", s:green, "", "")
|
||||
call <SID>X("scalaSymbol", s:orange, "", "")
|
||||
call <SID>X("scalaChar", s:orange, "", "")
|
||||
call <SID>X("scalaXml", s:green, "", "")
|
||||
call <SID>X("scalaConstructorSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaBackTick", s:blue, "", "")
|
||||
|
||||
" Git
|
||||
call <SID>X("diffAdded", s:green, "", "")
|
||||
call <SID>X("diffRemoved", s:red, "", "")
|
||||
call <SID>X("gitcommitSummary", "", "", "bold")
|
||||
|
||||
" Delete Functions
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>colour
|
||||
delf <SID>rgb_colour
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_colour
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
endif
|
||||
|
||||
set background=dark
|
|
@ -1,76 +0,0 @@
|
|||
" Vim color file
|
||||
" Maintainer: Tim Aldrich <aldy0169@yahoo.com>
|
||||
" 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
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "earendel"
|
||||
|
||||
execute "command! -nargs=1 Colo set background=<args>"
|
||||
|
||||
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
|
|
@ -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
|
|
@ -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
|
|
@ -1,212 +0,0 @@
|
|||
" Vim color file
|
||||
" Name: inkpot.vim
|
||||
" Maintainer: Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
|
||||
" 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! <SID>M(a)
|
||||
return strpart("0135", a:a, 1) + 0
|
||||
endfun
|
||||
|
||||
" map a urxvt colour to an xterm-256 colour
|
||||
fun! <SID>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 + <SID>M(l:x) + (6 * <SID>M(l:y)) + (36 * <SID>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=" . <SID>X(79) . " ctermbg=" . <SID>X(80)
|
||||
else
|
||||
exec "hi Normal cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(16)
|
||||
endif
|
||||
|
||||
exec "hi IncSearch cterm=BOLD ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
|
||||
exec "hi Search cterm=NONE ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
|
||||
exec "hi ErrorMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(48)
|
||||
exec "hi WarningMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(68)
|
||||
exec "hi ModeMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
|
||||
exec "hi MoreMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
|
||||
exec "hi Question cterm=BOLD ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
|
||||
|
||||
exec "hi StatusLine cterm=BOLD ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi User1 cterm=BOLD ctermfg=" . <SID>X(28) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi User2 cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi StatusLineNC cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi VertSplit cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
|
||||
|
||||
exec "hi WildMenu cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
|
||||
|
||||
exec "hi MBENormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi MBEChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi MBEVisibleNormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(82)
|
||||
exec "hi MBEVisibleChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
|
||||
|
||||
exec "hi DiffText cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(34)
|
||||
exec "hi DiffChange cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(17)
|
||||
exec "hi DiffDelete cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
|
||||
exec "hi DiffAdd cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(20)
|
||||
|
||||
exec "hi Folded cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(35)
|
||||
exec "hi FoldColumn cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
|
||||
|
||||
exec "hi Directory cterm=NONE ctermfg=" . <SID>X(28) . " ctermbg=" . "NONE"
|
||||
exec "hi LineNr cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
|
||||
exec "hi NonText cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
|
||||
exec "hi SpecialKey cterm=BOLD ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
|
||||
exec "hi Title cterm=BOLD ctermfg=" . <SID>X(48) . " ctermbg=" . "NONE"
|
||||
exec "hi Visual cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(38)
|
||||
|
||||
exec "hi Comment cterm=NONE ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
|
||||
exec "hi Constant cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . "NONE"
|
||||
exec "hi String cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi Error cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
|
||||
exec "hi Identifier cterm=NONE ctermfg=" . <SID>X(53) . " ctermbg=" . "NONE"
|
||||
exec "hi Ignore cterm=NONE"
|
||||
exec "hi Number cterm=NONE ctermfg=" . <SID>X(69) . " ctermbg=" . "NONE"
|
||||
exec "hi PreProc cterm=NONE ctermfg=" . <SID>X(25) . " ctermbg=" . "NONE"
|
||||
exec "hi Special cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
|
||||
exec "hi SpecialChar cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . <SID>X(81)
|
||||
exec "hi Statement cterm=NONE ctermfg=" . <SID>X(27) . " ctermbg=" . "NONE"
|
||||
exec "hi Todo cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(57)
|
||||
exec "hi Type cterm=NONE ctermfg=" . <SID>X(71) . " ctermbg=" . "NONE"
|
||||
exec "hi Underlined cterm=BOLD ctermfg=" . <SID>X(77) . " ctermbg=" . "NONE"
|
||||
exec "hi TaglistTagName cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
|
||||
|
||||
if v:version >= 700
|
||||
exec "hi Pmenu cterm=NONE ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
|
||||
exec "hi PmenuSel cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
|
||||
exec "hi PmenuSbar cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
|
||||
exec "hi PmenuThumb cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
|
||||
|
||||
exec "hi SpellBad cterm=NONE ctermbg=" . <SID>X(32)
|
||||
exec "hi SpellRare cterm=NONE ctermbg=" . <SID>X(33)
|
||||
exec "hi SpellLocal cterm=NONE ctermbg=" . <SID>X(36)
|
||||
exec "hi SpellCap cterm=NONE ctermbg=" . <SID>X(21)
|
||||
exec "hi MatchParen cterm=NONE ctermbg=" . <SID>X(14) . "ctermfg=" . <SID>X(25)
|
||||
endif
|
||||
endif
|
||||
|
||||
" vim: set et :
|
|
@ -1,80 +0,0 @@
|
|||
" vim:set ts=8 sts=2 sw=2 tw=0:
|
||||
"
|
||||
" matrix.vim - MATRIX like colorscheme.
|
||||
"
|
||||
" Maintainer: MURAOKA Taro <koron@tka.att.ne.jp>
|
||||
" 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
|
|
@ -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}}}
|
||||
|
|
@ -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 = \"<args>\" | 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
|
|
@ -1,74 +0,0 @@
|
|||
" Vim color file
|
||||
" Name: Obsidian
|
||||
" Maintainer: Aydar Khabibullin <aydar.kh@gmail.com>
|
||||
" 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"
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
" Vim color file
|
||||
" Maintainer: Tom Regner <regner@dievision.de>
|
||||
" 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
|
||||
|
||||
|
||||
|
|
@ -1,601 +0,0 @@
|
|||
" Vim color file --- psc (peak sea color) "Lite version"
|
||||
" Maintainer: Pan, Shi Zhu <Go to the following URL for my email>
|
||||
" 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("<sfile>: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:
|
|
@ -1,96 +0,0 @@
|
|||
" Vim color scheme
|
||||
"
|
||||
" Name: railscasts.vim
|
||||
" Maintainer: Nick Moffitt <nick@zork.net>
|
||||
" Last Change: 01 Mar 2008
|
||||
" License: WTFPL <http://sam.zoy.org/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
|
|
@ -1,969 +0,0 @@
|
|||
" Name: Solarized vim colorscheme
|
||||
" Author: Ethan Schoonover <es@ethanschoonover.com>
|
||||
" 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
|
||||
" <F5> if that mapping is available. If it is not available you will need to
|
||||
" either map the function manually or change your current <F5> mapping to
|
||||
" something else. If you wish to map the function manually, enter the following
|
||||
" lines in your .vimrc:
|
||||
"
|
||||
" nmap <unique> <F5> <Plug>ToggleBackground
|
||||
" imap <unique> <F5> <Plug>ToggleBackground
|
||||
" vmap <unique> <F5> <Plug>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
|
||||
"}}}
|
|
@ -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:
|
|
@ -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
|
||||
|
||||
|
|
@ -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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>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 <SID>color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>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 <SID>grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>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 <SID>color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>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 <SID>X("Normal", "cccccc", "242424", "none")
|
||||
call <SID>X("Cursor", "222222", "ecee90", "none")
|
||||
call <SID>X("CursorLine", "", "32322e", "none")
|
||||
call <SID>X("CursorColumn", "", "2d2d2d", "")
|
||||
"CursorIM
|
||||
"Question
|
||||
"IncSearch
|
||||
call <SID>X("Search", "444444", "af87d7", "")
|
||||
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
|
||||
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
|
||||
call <SID>X("Visual", "ecee90", "597418", "none")
|
||||
call <SID>X("LineNr", "857b6f", "121212", "none")
|
||||
call <SID>X("Folded", "a0a8b0", "404048", "none")
|
||||
call <SID>X("Title", "f6f3e8", "", "bold")
|
||||
call <SID>X("VertSplit", "444444", "444444", "none")
|
||||
call <SID>X("StatusLine", "f6f3e8", "444444", "italic")
|
||||
call <SID>X("StatusLineNC", "857b6f", "444444", "none")
|
||||
"Scrollbar
|
||||
"Tooltip
|
||||
"Menu
|
||||
"WildMenu
|
||||
call <SID>X("Pmenu", "f6f3e8", "444444", "")
|
||||
call <SID>X("PmenuSel", "121212", "caeb82", "")
|
||||
call <SID>X("WarningMsg", "ff0000", "", "")
|
||||
"ErrorMsg
|
||||
"ModeMsg
|
||||
"MoreMsg
|
||||
"Directory
|
||||
"DiffAdd
|
||||
"DiffChange
|
||||
"DiffDelete
|
||||
"DiffText
|
||||
|
||||
" syntax highlighting
|
||||
call <SID>X("Number", "e5786d", "", "none")
|
||||
call <SID>X("Constant", "e5786d", "", "none")
|
||||
call <SID>X("String", "95e454", "", "italic")
|
||||
call <SID>X("Comment", "c0bc6c", "", "italic")
|
||||
call <SID>X("Identifier", "caeb82", "", "none")
|
||||
call <SID>X("Keyword", "87afff", "", "none")
|
||||
call <SID>X("Statement", "87afff", "", "none")
|
||||
call <SID>X("Function", "caeb82", "", "none")
|
||||
call <SID>X("PreProc", "e5786d", "", "none")
|
||||
call <SID>X("Type", "caeb82", "", "none")
|
||||
call <SID>X("Special", "ffdead", "", "none")
|
||||
call <SID>X("Todo", "857b6f", "", "italic")
|
||||
"Underlined
|
||||
"Error
|
||||
"Ignore
|
||||
|
||||
hi! link VisualNOS Visual
|
||||
hi! link NonText LineNr
|
||||
hi! link FoldColumn Folded
|
||||
|
||||
" delete functions {{{
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>color
|
||||
delf <SID>rgb_color
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_color
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
" }}}
|
||||
|
||||
" vim:set ts=4 sw=4 noet fdm=marker:
|
|
@ -1,133 +0,0 @@
|
|||
" Vim color file
|
||||
" Maintainer: Jani Nurminen <jani.nurminen@intellitel.com>
|
||||
" 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
|
1602
vim/doc/Align.txt
1602
vim/doc/Align.txt
File diff suppressed because it is too large
Load Diff
|
@ -1,988 +0,0 @@
|
|||
*NERD_commenter.txt* Plugin for commenting code
|
||||
|
||||
|
||||
NERD COMMENTER REFERENCE MANUAL~
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *NERDCommenterContents*
|
||||
|
||||
1.Intro...................................|NERDCommenter|
|
||||
2.Installation............................|NERDComInstallation|
|
||||
3.Functionality provided..................|NERDComFunctionality|
|
||||
3.1 Functionality Summary.............|NERDComFunctionalitySummary|
|
||||
3.2 Functionality Details.............|NERDComFunctionalityDetails|
|
||||
3.2.1 Comment map.................|NERDComComment|
|
||||
3.2.2 Nested comment map..........|NERDComNestedComment|
|
||||
3.2.3 Toggle comment map..........|NERDComToggleComment|
|
||||
3.2.4 Minimal comment map.........|NERDComMinimalComment|
|
||||
3.2.5 Invert comment map..........|NERDComInvertComment|
|
||||
3.2.6 Sexy comment map............|NERDComSexyComment|
|
||||
3.2.7 Yank comment map............|NERDComYankComment|
|
||||
3.2.8 Comment to EOL map..........|NERDComEOLComment|
|
||||
3.2.9 Append com to line map......|NERDComAppendComment|
|
||||
3.2.10 Insert comment map.........|NERDComInsertComment|
|
||||
3.2.11 Use alternate delims map...|NERDComAltDelim|
|
||||
3.2.12 Comment aligned maps.......|NERDComAlignedComment|
|
||||
3.2.13 Uncomment line map.........|NERDComUncommentLine|
|
||||
3.4 Sexy Comments.....................|NERDComSexyComments|
|
||||
3.5 The NERDComment function..........|NERDComNERDComment|
|
||||
4.Options.................................|NERDComOptions|
|
||||
4.1 Options summary...................|NERDComOptionsSummary|
|
||||
4.2 Options details...................|NERDComOptionsDetails|
|
||||
4.3 Default delimiter Options.........|NERDComDefaultDelims|
|
||||
5. Customising key mappings...............|NERDComMappings|
|
||||
6. Issues with the script.................|NERDComIssues|
|
||||
6.1 Delimiter detection heuristics....|NERDComHeuristics|
|
||||
6.2 Nesting issues....................|NERDComNesting|
|
||||
7.About.. ............................|NERDComAbout|
|
||||
8.Changelog...............................|NERDComChangelog|
|
||||
9.Credits.................................|NERDComCredits|
|
||||
10.License................................|NERDComLicense|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *NERDCommenter*
|
||||
|
||||
The NERD commenter provides many different commenting operations and styles
|
||||
which are invoked via key mappings and a menu. These operations are available
|
||||
for most filetypes.
|
||||
|
||||
There are also options that allow to tweak the commenting engine to your
|
||||
taste.
|
||||
|
||||
==============================================================================
|
||||
2. Installation *NERDComInstallation*
|
||||
|
||||
The NERD Commenter requires Vim 7 or higher.
|
||||
|
||||
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
|
||||
should have 2 files: >
|
||||
plugin/NERD_commenter.vim
|
||||
doc/NERD_commenter.txt
|
||||
<
|
||||
Next, to finish installing the help file run: >
|
||||
:helptags ~/.vim/doc
|
||||
<
|
||||
See |add-local-help| for more details.
|
||||
|
||||
Make sure that you have filetype plugins enabled, as the script makes use of
|
||||
|'commentstring'| where possible (which is usually set in a filetype plugin).
|
||||
See |filetype-plugin-on| for details, but basically, stick this in your vimrc >
|
||||
filetype plugin on
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
3. Functionality provided *NERDComFunctionality*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.1 Functionality summary *NERDComFunctionalitySummary*
|
||||
|
||||
The following key mappings are provided by default (there is also a menu
|
||||
with items corresponding to all the mappings below):
|
||||
|
||||
[count]<leader>cc |NERDComComment|
|
||||
Comment out the current line or text selected in visual mode.
|
||||
|
||||
|
||||
[count]<leader>cn |NERDComNestedComment|
|
||||
Same as <leader>cc but forces nesting.
|
||||
|
||||
|
||||
[count]<leader>c<space> |NERDComToggleComment|
|
||||
Toggles the comment state of the selected line(s). If the topmost selected
|
||||
line is commented, all selected lines are uncommented and vice versa.
|
||||
|
||||
|
||||
[count]<leader>cm |NERDComMinimalComment|
|
||||
Comments the given lines using only one set of multipart delimiters.
|
||||
|
||||
|
||||
[count]<leader>ci |NERDComInvertComment|
|
||||
Toggles the comment state of the selected line(s) individually.
|
||||
|
||||
|
||||
[count]<leader>cs |NERDComSexyComment|
|
||||
Comments out the selected lines ``sexily''
|
||||
|
||||
|
||||
[count]<leader>cy |NERDComYankComment|
|
||||
Same as <leader>cc except that the commented line(s) are yanked first.
|
||||
|
||||
|
||||
<leader>c$ |NERDComEOLComment|
|
||||
Comments the current line from the cursor to the end of line.
|
||||
|
||||
|
||||
<leader>cA |NERDComAppendComment|
|
||||
Adds comment delimiters to the end of line and goes into insert mode between
|
||||
them.
|
||||
|
||||
|
||||
|NERDComInsertComment|
|
||||
Adds comment delimiters at the current cursor position and inserts between.
|
||||
Disabled by default.
|
||||
|
||||
|
||||
<leader>ca |NERDComAltDelim|
|
||||
Switches to the alternative set of delimiters.
|
||||
|
||||
|
||||
[count]<leader>cl
|
||||
[count]<leader>cb |NERDComAlignedComment|
|
||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
||||
left side (<leader>cl) or both sides (<leader>cb).
|
||||
|
||||
|
||||
[count]<leader>cu |NERDComUncommentLine|
|
||||
Uncomments the selected line(s).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2 Functionality details *NERDComFunctionalityDetails*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.1 Comment map *NERDComComment*
|
||||
|
||||
Default mapping: [count]<leader>cc
|
||||
Mapped to: <plug>NERDCommenterComment
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
|
||||
Comments out the current line. If multiple lines are selected in visual-line
|
||||
mode, they are all commented out. If some text is selected in visual or
|
||||
visual-block mode then the script will try to comment out the exact text that
|
||||
is selected using multi-part delimiters if they are available.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.2 Nested comment map *NERDComNestedComment*
|
||||
|
||||
Default mapping: [count]<leader>cn
|
||||
Mapped to: <plug>NERDCommenterNest
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
Performs nested commenting. Works the same as <leader>cc except that if a line
|
||||
is already commented then it will be commented again.
|
||||
|
||||
If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will
|
||||
be replaced by place-holder delimiters if needed. Otherwise the nested
|
||||
comment will only be added if the current commenting delimiters have no right
|
||||
delimiter (to avoid syntax errors)
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
Related options:
|
||||
|'NERDDefaultNesting'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.3 Toggle comment map *NERDComToggleComment*
|
||||
|
||||
Default mapping: [count]<leader>c<space>
|
||||
Mapped to: <plug>NERDCommenterToggle
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
Toggles commenting of the lines selected. The behaviour of this mapping
|
||||
depends on whether the first line selected is commented or not. If so, all
|
||||
selected lines are uncommented and vice versa.
|
||||
|
||||
With this mapping, a line is only considered to be commented if it starts with
|
||||
a left delimiter.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.4 Minimal comment map *NERDComMinimalComment*
|
||||
|
||||
Default mapping: [count]<leader>cm
|
||||
Mapped to: <plug>NERDCommenterMinimal
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
Comments the selected lines using one set of multipart delimiters if possible.
|
||||
|
||||
For example: if you are programming in c and you select 5 lines and press
|
||||
<leader>cm then a '/*' will be placed at the start of the top line and a '*/'
|
||||
will be placed at the end of the last line.
|
||||
|
||||
Sets of multipart comment delimiters that are between the top and bottom
|
||||
selected lines are replaced with place holders (see |'NERDLPlace'|) if
|
||||
|'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then
|
||||
the comment will be aborted if place holders are required to prevent illegal
|
||||
syntax.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.5 Invert comment map *NERDComInvertComment*
|
||||
|
||||
Default mapping: <leader>ci
|
||||
Mapped to: <plug>NERDCommenterInvert
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
Inverts the commented state of each selected line. If the a selected line is
|
||||
commented then it is uncommented and vice versa. Each line is examined and
|
||||
commented/uncommented individually.
|
||||
|
||||
With this mapping, a line is only considered to be commented if it starts with
|
||||
a left delimiter.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.6 Sexy comment map *NERDComSexyComment*
|
||||
|
||||
Default mapping: [count]<leader>cs
|
||||
Mapped to: <plug>NERDCommenterSexy
|
||||
Applicable modes: normal, visual-line.
|
||||
|
||||
Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
|
||||
a description of what sexy comments are. Can only be done on filetypes for
|
||||
which there is at least one set of multipart comment delimiters specified.
|
||||
|
||||
Sexy comments cannot be nested and lines inside a sexy comment cannot be
|
||||
commented again.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
Related options:
|
||||
|'NERDCompactSexyComs'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.7 Yank comment map *NERDComYankComment*
|
||||
|
||||
Default mapping: [count]<leader>cy
|
||||
Mapped to: <plug>NERDCommenterYank
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
Same as <leader>cc except that it yanks the line(s) that are commented first.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.8 Comment to EOL map *NERDComEOLComment*
|
||||
|
||||
Default mapping: <leader>c$
|
||||
Mapped to: <plug>NERDCommenterToEOL
|
||||
Applicable modes: normal.
|
||||
|
||||
Comments the current line from the current cursor position up to the end of
|
||||
the line.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.9 Append com to line map *NERDComAppendComment*
|
||||
|
||||
Default mapping: <leader>cA
|
||||
Mapped to: <plug>NERDCommenterAppend
|
||||
Applicable modes: normal.
|
||||
|
||||
Appends comment delimiters to the end of the current line and goes
|
||||
to insert mode between the new delimiters.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.10 Insert comment map *NERDComInsertComment*
|
||||
|
||||
Default mapping: disabled by default.
|
||||
Map it to: <plug>NERDCommenterInInsert
|
||||
Applicable modes: insert.
|
||||
|
||||
Adds comment delimiters at the current cursor position and inserts
|
||||
between them.
|
||||
|
||||
NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
|
||||
mapping add >
|
||||
let NERDComInsertMap='<c-c>'
|
||||
<
|
||||
to your vimrc.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.11 Use alternate delims map *NERDComAltDelim*
|
||||
|
||||
Default mapping: <leader>ca
|
||||
Mapped to: <plug>NERDCommenterAltDelims
|
||||
Applicable modes: normal.
|
||||
|
||||
Changes to the alternative commenting style if one is available. For example,
|
||||
if the user is editing a c++ file using // comments and they hit <leader>ca
|
||||
then they will be switched over to /**/ comments.
|
||||
|
||||
See also |NERDComDefaultDelims|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.12 Comment aligned maps *NERDComAlignedComment*
|
||||
|
||||
Default mappings: [count]<leader>cl [count]<leader>cb
|
||||
Mapped to: <plug>NERDCommenterAlignLeft
|
||||
<plug>NERDCommenterAlignBoth
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
Same as <leader>cc except that the comment delimiters are aligned on the left
|
||||
side or both sides respectively. These comments are always nested if the
|
||||
line(s) are already commented.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2.13 Uncomment line map *NERDComUncommentLine*
|
||||
|
||||
Default mapping: [count]<leader>cu
|
||||
Mapped to: <plug>NERDCommenterUncomment
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
Uncomments the current line. If multiple lines are selected in
|
||||
visual mode then they are all uncommented.
|
||||
|
||||
When uncommenting, if the line contains multiple sets of delimiters then the
|
||||
``outtermost'' pair of delimiters will be removed.
|
||||
|
||||
The script uses a set of heurisics to distinguish ``real'' delimiters from
|
||||
``fake'' ones when uncommenting. See |NERDComIssues| for details.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
lines were selected in visual-line mode.
|
||||
|
||||
Related options:
|
||||
|'NERDRemoveAltComs'|
|
||||
|'NERDRemoveExtraSpaces'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.3 Sexy Comments *NERDComSexyComments*
|
||||
These are comments that use one set of multipart comment delimiters as well as
|
||||
one other marker symbol. For example: >
|
||||
/*
|
||||
* This is a c style sexy comment
|
||||
* So there!
|
||||
*/
|
||||
|
||||
/* This is a c style sexy comment
|
||||
* So there!
|
||||
* But this one is ``compact'' style */
|
||||
<
|
||||
Here the multipart delimiters are /* and */ and the marker is *.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.4 The NERDComment function *NERDComNERDComment*
|
||||
|
||||
All of the NERD commenter mappings and menu items invoke a single function
|
||||
which delegates the commenting work to other functions. This function is
|
||||
public and has the prototype: >
|
||||
function! NERDComment(isVisual, type)
|
||||
<
|
||||
The arguments to this function are simple:
|
||||
- isVisual: if you wish to do any kind of visual comment then set this to
|
||||
1 and the function will use the '< and '> marks to find the comment
|
||||
boundries. If set to 0 then the function will operate on the current
|
||||
line.
|
||||
- type: is used to specify what type of commenting operation is to be
|
||||
performed, and it can be one of the following: "sexy", "invert",
|
||||
"minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
|
||||
"toEOL", "append", "insert", "uncomment", "yank"
|
||||
|
||||
For example, if you typed >
|
||||
:call NERDComment(1, 'sexy')
|
||||
<
|
||||
then the script would do a sexy comment on the last visual selection.
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. Options *NERDComOptions*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.1 Options summary *NERDComOptionsSummary*
|
||||
|
||||
|'loaded_nerd_comments'| Turns off the script.
|
||||
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
|
||||
be used when commenting in
|
||||
visual/visual-block mode.
|
||||
|'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
|
||||
doing visual-block comments.
|
||||
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|
||||
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|
||||
|'NERDDefaultNesting'| Tells the script to use nested comments
|
||||
by default.
|
||||
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
||||
will appear (if at all).
|
||||
|'NERDLPlace'| Specifies what to use as the left
|
||||
delimiter placeholder when nesting
|
||||
comments.
|
||||
|'NERDUsePlaceHolders'| Specifies which filetypes may use
|
||||
placeholders when nesting comments.
|
||||
|'NERDRemoveAltComs'| Tells the script whether to remove
|
||||
alternative comment delimiters when
|
||||
uncommenting.
|
||||
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
|
||||
extra spaces when uncommenting
|
||||
(regardless of whether NERDSpaceDelims
|
||||
is set)
|
||||
|'NERDRPlace'| Specifies what to use as the right
|
||||
delimiter placeholder when nesting
|
||||
comments.
|
||||
|'NERDSpaceDelims'| Specifies whether to add extra spaces
|
||||
around delimiters when commenting, and
|
||||
whether to remove them when
|
||||
uncommenting.
|
||||
|'NERDCompactSexyComs'| Specifies whether to use the compact
|
||||
style sexy comments.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3 Options details *NERDComOptionsDetails*
|
||||
|
||||
To enable any of the below options you should put the given line in your
|
||||
~/.vimrc
|
||||
|
||||
*'loaded_nerd_comments'*
|
||||
If this script is driving you insane you can turn it off by setting this
|
||||
option >
|
||||
let loaded_nerd_comments=1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDAllowAnyVisualDelims'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
If set to 1 then, when doing a visual or visual-block comment (but not a
|
||||
visual-line comment), the script will choose the right delimiters to use for
|
||||
the comment. This means either using the current delimiters if they are
|
||||
multipart or using the alternative delimiters if THEY are multipart. For
|
||||
example if we are editing the following java code: >
|
||||
float foo = 1221;
|
||||
float bar = 324;
|
||||
System.out.println(foo * bar);
|
||||
<
|
||||
If we are using // comments and select the "foo" and "bar" in visual-block
|
||||
mode, as shown left below (where '|'s are used to represent the visual-block
|
||||
boundary), and comment it then the script will use the alternative delims as
|
||||
shown on the right: >
|
||||
|
||||
float |foo| = 1221; float /*foo*/ = 1221;
|
||||
float |bar| = 324; float /*bar*/ = 324;
|
||||
System.out.println(foo * bar); System.out.println(foo * bar);
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDBlockComIgnoreEmpty'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
This option affects visual-block mode commenting. If this option is turned
|
||||
on, lines that begin outside the right boundary of the selection block will be
|
||||
ignored.
|
||||
|
||||
For example, if you are commenting this chunk of c code in visual-block mode
|
||||
(where the '|'s are used to represent the visual-block boundary) >
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|int| main(){
|
||||
| | printf("SUCK THIS\n");
|
||||
| | while(1){
|
||||
| | fork();
|
||||
| | }
|
||||
|} |
|
||||
<
|
||||
If NERDBlockComIgnoreEmpty=0 then this code will become: >
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
/*int*/ main(){
|
||||
/* */ printf("SUCK THIS\n");
|
||||
/* */ while(1){
|
||||
/* */ fork();
|
||||
/* */ }
|
||||
/*} */
|
||||
<
|
||||
Otherwise, the code block would become: >
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
/*int*/ main(){
|
||||
printf("SUCK THIS\n");
|
||||
while(1){
|
||||
fork();
|
||||
}
|
||||
/*} */
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDCommentWholeLinesInVMode'*
|
||||
Values: 0, 1 or 2.
|
||||
Default: 0.
|
||||
|
||||
By default the script tries to comment out exactly what is selected in visual
|
||||
mode (v). For example if you select and comment the following c code (using |
|
||||
to represent the visual boundary): >
|
||||
in|t foo = 3;
|
||||
int bar =| 9;
|
||||
int baz = foo + bar;
|
||||
<
|
||||
This will result in: >
|
||||
in/*t foo = 3;*/
|
||||
/*int bar =*/ 9;
|
||||
int baz = foo + bar;
|
||||
<
|
||||
But some people prefer it if the whole lines are commented like: >
|
||||
/*int foo = 3;*/
|
||||
/*int bar = 9;*/
|
||||
int baz = foo + bar;
|
||||
<
|
||||
If you prefer the second option then stick this line in your vimrc: >
|
||||
let NERDCommentWholeLinesInVMode=1
|
||||
<
|
||||
|
||||
If the filetype you are editing only has no multipart delimiters (for example
|
||||
a shell script) and you hadnt set this option then the above would become >
|
||||
in#t foo = 3;
|
||||
#int bar = 9;
|
||||
<
|
||||
(where # is the comment delimiter) as this is the closest the script can
|
||||
come to commenting out exactly what was selected. If you prefer for whole
|
||||
lines to be commented out when there is no multipart delimiters but the EXACT
|
||||
text that was selected to be commented out if there IS multipart delimiters
|
||||
then stick the following line in your vimrc: >
|
||||
let NERDCommentWholeLinesInVMode=2
|
||||
<
|
||||
|
||||
Note that this option does not affect the behaviour of commenting in
|
||||
|visual-block| mode.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDCreateDefaultMappings'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
If set to 0, none of the default mappings will be created.
|
||||
|
||||
See also |NERDComMappings|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDRemoveAltComs'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
When uncommenting a line (for a filetype with an alternative commenting style)
|
||||
this option tells the script whether to look for, and remove, comment
|
||||
delimiters of the alternative style.
|
||||
|
||||
For example, if you are editing a c++ file using // style comments and you go
|
||||
<leader>cu on this line: >
|
||||
/* This is a c++ comment baby! */
|
||||
<
|
||||
It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDRemoveExtraSpaces'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
By default, the NERD commenter will remove spaces around comment delimiters if
|
||||
either:
|
||||
1. |'NERDSpaceDelims'| is set to 1.
|
||||
2. NERDRemoveExtraSpaces is set to 1.
|
||||
|
||||
This means that if we have the following lines in a c code file: >
|
||||
/* int foo = 5; */
|
||||
/* int bar = 10; */
|
||||
int baz = foo + bar
|
||||
<
|
||||
If either of the above conditions hold then if these lines are uncommented
|
||||
they will become: >
|
||||
int foo = 5;
|
||||
int bar = 10;
|
||||
int baz = foo + bar
|
||||
<
|
||||
Otherwise they would become: >
|
||||
int foo = 5;
|
||||
int bar = 10;
|
||||
int baz = foo + bar
|
||||
<
|
||||
If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
|
||||
set NERDRemoveExtraSpaces to 0.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDLPlace'*
|
||||
*'NERDRPlace'*
|
||||
Values: arbitrary string.
|
||||
Default:
|
||||
NERDLPlace: "[>"
|
||||
NERDRPlace: "<]"
|
||||
|
||||
These options are used to control the strings used as place-holder delimiters.
|
||||
Place holder delimiters are used when performing nested commenting when the
|
||||
filetype supports commenting styles with both left and right delimiters.
|
||||
To set these options use lines like: >
|
||||
let NERDLPlace="FOO"
|
||||
let NERDRPlace="BAR"
|
||||
<
|
||||
Following the above example, if we have line of c code: >
|
||||
/* int horse */
|
||||
<
|
||||
and we comment it with <leader>cn it will be changed to: >
|
||||
/*FOO int horse BAR*/
|
||||
<
|
||||
When we uncomment this line it will go back to what it was.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDMenuMode'*
|
||||
Values: 0, 1, 2, 3.
|
||||
Default: 3
|
||||
|
||||
This option can take 4 values:
|
||||
"0": Turns the menu off.
|
||||
"1": Turns the 'comment' menu on with no menu shortcut.
|
||||
"2": Turns the 'comment 'menu on with <alt>-c as the shortcut.
|
||||
"3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDUsePlaceHolders'*
|
||||
Values: 0 or 1.
|
||||
Default 1.
|
||||
|
||||
This option is used to specify whether place-holder delimiters should be used
|
||||
when creating a nested comment.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDSpaceDelims'*
|
||||
Values: 0 or 1.
|
||||
Default 0.
|
||||
|
||||
Some people prefer a space after the left delimiter and before the right
|
||||
delimiter like this: >
|
||||
/* int foo=2; */
|
||||
<
|
||||
as opposed to this: >
|
||||
/*int foo=2;*/
|
||||
<
|
||||
If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
|
||||
|
||||
See also |'NERDRemoveExtraSpaces'|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDCompactSexyComs'*
|
||||
Values: 0 or 1.
|
||||
Default 0.
|
||||
|
||||
Some people may want their sexy comments to be like this: >
|
||||
/* Hi There!
|
||||
* This is a sexy comment
|
||||
* in c */
|
||||
<
|
||||
As opposed to like this: >
|
||||
/*
|
||||
* Hi There!
|
||||
* This is a sexy comment
|
||||
* in c
|
||||
*/
|
||||
<
|
||||
If this option is set to 1 then the top style will be used.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDDefaultNesting'*
|
||||
Values: 0 or 1.
|
||||
Default 1.
|
||||
|
||||
When this option is set to 1, comments are nested automatically. That is, if
|
||||
you hit <leader>cc on a line that is already commented it will be commented
|
||||
again.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||
|
||||
If you want the NERD commenter to use the alternative delimiters for a
|
||||
specific filetype by default then put a line of this form into your vimrc: >
|
||||
let NERD_<filetype>_alt_style=1
|
||||
<
|
||||
Example: java uses // style comments by default, but you want it to default to
|
||||
/* */ style comments instead. You would put this line in your vimrc: >
|
||||
let NERD_java_alt_style=1
|
||||
<
|
||||
|
||||
See |NERDComAltDelim| for switching commenting styles at runtime.
|
||||
|
||||
==============================================================================
|
||||
5. Key mapping customisation *NERDComMappings*
|
||||
|
||||
To change a mapping just map another key combo to the internal <plug> mapping.
|
||||
For example, to remap the |NERDComComment| mapping to ",omg" you would put
|
||||
this line in your vimrc: >
|
||||
map ,omg <plug>NERDCommenterComment
|
||||
<
|
||||
This will stop the corresponding default mappings from being created.
|
||||
|
||||
See the help for the mapping in question to see which <plug> mapping to
|
||||
map to.
|
||||
|
||||
See also |'NERDCreateDefaultMappings'|.
|
||||
|
||||
==============================================================================
|
||||
6. Issues with the script *NERDComIssues*
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.1 Delimiter detection heuristics *NERDComHeuristics*
|
||||
|
||||
Heuristics are used to distinguish the real comment delimiters
|
||||
|
||||
Because we have comment mappings that place delimiters in the middle of lines,
|
||||
removing comment delimiters is a bit tricky. This is because if comment
|
||||
delimiters appear in a line doesnt mean they really ARE delimiters. For
|
||||
example, Java uses // comments but the line >
|
||||
System.out.println("//");
|
||||
<
|
||||
clearly contains no real comment delimiters.
|
||||
|
||||
To distinguish between ``real'' comment delimiters and ``fake'' ones we use a
|
||||
set of heuristics. For example, one such heuristic states that any comment
|
||||
delimiter that has an odd number of non-escaped " characters both preceding
|
||||
and following it on the line is not a comment because it is probably part of a
|
||||
string. These heuristics, while usually pretty accurate, will not work for all
|
||||
cases.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.2 Nesting issues *NERDComNesting*
|
||||
|
||||
If we have some line of code like this: >
|
||||
/*int foo */ = /*5 + 9;*/
|
||||
<
|
||||
This will not be uncommented legally. The NERD commenter will remove the
|
||||
"outter most" delimiters so the line will become: >
|
||||
int foo */ = /*5 + 9;
|
||||
<
|
||||
which almost certainly will not be what you want. Nested sets of comments will
|
||||
uncomment fine though. Eg: >
|
||||
/*int/* foo =*/ 5 + 9;*/
|
||||
<
|
||||
will become: >
|
||||
int/* foo =*/ 5 + 9;
|
||||
<
|
||||
(Note that in the above examples I have deliberately not used place holders
|
||||
for simplicity)
|
||||
|
||||
==============================================================================
|
||||
7. About *NERDComAbout*
|
||||
|
||||
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
||||
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
||||
metropolises and eating tourist busses.
|
||||
|
||||
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
|
||||
its a lonely life being the worlds premier terror machine. How would you feel
|
||||
if your face looked like a toaster and a t-rex put together? :(
|
||||
|
||||
The latest stable versions can be found at
|
||||
http://www.vim.org/scripts/script.php?script_id=1218
|
||||
|
||||
The latest dev versions are on github
|
||||
http://github.com/scrooloose/nerdcommenter
|
||||
|
||||
==============================================================================
|
||||
8. Changelog *NERDComChangelog*
|
||||
|
||||
2.3.0
|
||||
- remove all filetypes which have a &commentstring in the standard vim
|
||||
runtime for vim > 7.0 unless the script stores an alternate set of
|
||||
delimiters
|
||||
- make the script complain if the user doesnt have filetype plugins enabled
|
||||
- use <leader> instead of comma to start the default mappings
|
||||
- fix a couple of bugs with sexy comments - thanks to Tim Smart
|
||||
- lots of refactoring
|
||||
|
||||
2.2.2
|
||||
- remove the NERDShutup option and the message is suppresses, this makes
|
||||
the plugin silently rely on &commentstring for unknown filetypes.
|
||||
- add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and
|
||||
udevrules. Thanks to Thilo Six.
|
||||
- match filetypes case insensitively
|
||||
- add support for mp (metapost), thanks to Andrey Skvortsov.
|
||||
- add support for htmlcheetah, thanks to Simon Hengel.
|
||||
- add support for javacc, thanks to Matt Tolton.
|
||||
- make <%# %> the default delims for eruby, thanks to tpope.
|
||||
- add support for javascript.jquery, thanks to Ivan Devat.
|
||||
- add support for cucumber and pdf. Fix sass and railslog delims,
|
||||
thanks to tpope
|
||||
|
||||
2.2.1
|
||||
- add support for newlisp and clojure, thanks to Matthew Lee Hinman.
|
||||
- fix automake comments, thanks to Elias Pipping
|
||||
- make haml comments default to -# with / as the alternative delimiter,
|
||||
thanks to tpope
|
||||
- add support for actionscript and processing thanks to Edwin Benavides
|
||||
- add support for ps1 (powershell), thanks to Jason Mills
|
||||
- add support for hostsaccess, thanks to Thomas Rowe
|
||||
- add support for CVScommit
|
||||
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
|
||||
- use # for gitcommit comments, thanks to Simon Ruderich.
|
||||
- add support for mako and genshi, thanks to Keitheis.
|
||||
- add support for conkyrc, thanks to David
|
||||
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
|
||||
- add support for sieve, thanks to Stefan Walk
|
||||
- add support for objj, thanks to Adam Thorsen.
|
||||
|
||||
2.2.0
|
||||
- rewrote the mappings system to be more "standard".
|
||||
- removed all the mapping options. Now, mappings to <plug> mappings are
|
||||
used
|
||||
- see :help NERDComMappings, and :help NERDCreateDefaultMappings for
|
||||
more info
|
||||
- remove "prepend comments" and "right aligned comments".
|
||||
- add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
|
||||
Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
|
||||
O'Shea, François and Giacomo Mariani respectively.
|
||||
- bugfix for haskell delimiters. Thanks to mntnoe.
|
||||
2.1.18
|
||||
- add support for llvm. Thanks to nicothakis.
|
||||
- add support for xquery. Thanks to Phillip Kovalev.
|
||||
2.1.17
|
||||
- fixed haskell delimiters (hackily). Thanks to Elias Pipping.
|
||||
- add support for mailcap. Thanks to Pascal Brueckner.
|
||||
- add support for stata. Thanks to Jerónimo Carballo.
|
||||
- applied a patch from ewfalor to fix an error in the help file with the
|
||||
NERDMapleader doc
|
||||
- disable the insert mode ctrl-c mapping by default, see :help
|
||||
NERDComInsertComment if you wish to restore it
|
||||
|
||||
==============================================================================
|
||||
9. Credits *NERDComCredits*
|
||||
|
||||
Thanks to the follow people for suggestions and patches:
|
||||
|
||||
Nick Brettell
|
||||
Matthew Hawkins
|
||||
Mathieu Clabaut
|
||||
Greg Searle
|
||||
Nguyen
|
||||
Litchi
|
||||
Jorge Scandaliaris
|
||||
Shufeng Zheng
|
||||
Martin Stubenschrott
|
||||
Markus Erlmann
|
||||
Brent Rice
|
||||
Richard Willis
|
||||
Igor Prischepoff
|
||||
Harry
|
||||
David Bourgeois
|
||||
Eike Von Seggern
|
||||
Torsten Blix
|
||||
Alexander Bosecke
|
||||
Stefano Zacchiroli
|
||||
Norick Chen
|
||||
Joseph Barker
|
||||
Gary Church
|
||||
Tim Carey-Smith
|
||||
Markus Klinik
|
||||
Anders
|
||||
Seth Mason
|
||||
James Hales
|
||||
Heptite
|
||||
Cheng Fang
|
||||
Yongwei Wu
|
||||
David Miani
|
||||
Jeremy Hinegardner
|
||||
Marco
|
||||
Ingo Karkat
|
||||
Zhang Shuhan
|
||||
tpope
|
||||
Ben Schmidt
|
||||
David Fishburn
|
||||
Erik Falor
|
||||
JaGoTerr
|
||||
Elias Pipping
|
||||
mntnoe
|
||||
Mark S.
|
||||
|
||||
|
||||
Thanks to the following people for sending me new filetypes to support:
|
||||
|
||||
The hackers The filetypes~
|
||||
Sam R verilog
|
||||
Jonathan Derque context, plaintext and mail
|
||||
Vigil fetchmail
|
||||
Michael Brunner kconfig
|
||||
Antono Vasiljev netdict
|
||||
Melissa Reid omlet
|
||||
Ilia N Ternovich quickfix
|
||||
John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
|
||||
Anders occam
|
||||
Mark Woodward csv
|
||||
fREW gentoo-package-mask,
|
||||
gentoo-package-keywords,
|
||||
gentoo-package-use, and vo_base
|
||||
Alexey verilog_systemverilog, systemverilog
|
||||
Lizendir fstab
|
||||
Michael Böhler autoit, autohotkey and docbk
|
||||
Aaron Small cmake
|
||||
Ramiro htmldjango and django
|
||||
Stefano Zacchiroli debcontrol, debchangelog, mkd
|
||||
Alex Tarkovsky ebuild and eclass
|
||||
Jorge Rodrigues gams
|
||||
Rainer Müller Objective C
|
||||
Jason Mills Groovy, ps1
|
||||
Normandie Azucena vera
|
||||
Florian Apolloner ldif
|
||||
David Fishburn lookupfile
|
||||
Niels Aan de Brugh rst
|
||||
Don Hatlestad ahk
|
||||
Christophe Benz Desktop and xsd
|
||||
Eyolf Østrem lilypond, bbx and lytex
|
||||
Ingo Karkat dosbatch
|
||||
Nicolas Weber markdown, objcpp
|
||||
tinoucas gentoo-conf-d
|
||||
Greg Weber D, haml
|
||||
Bruce Sherrod velocity
|
||||
timberke cobol, calibre
|
||||
Aaron Schaefer factor
|
||||
Mr X asterisk, mplayerconf
|
||||
Kuchma Michael plsql
|
||||
Brett Warneke spectre
|
||||
Pipp lhaskell
|
||||
Renald Buter scala
|
||||
Vladimir Lomov asymptote
|
||||
Marco mrxvtrc, aap
|
||||
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
||||
SVNdiff, gitAnnotate, gitdiff, dtrace
|
||||
llvm, applescript
|
||||
Chen Xing Wikipedia
|
||||
Jacobo Diaz dakota, patran
|
||||
Li Jin gentoo-env-d, gentoo-init-d,
|
||||
gentoo-make-conf, grub, modconf, sudoers
|
||||
SpookeyPeanut rib
|
||||
Greg Jandl pyrex/cython
|
||||
Christophe Benz services, gitcommit
|
||||
A Pontus vimperator
|
||||
Stromnov slice, bzr
|
||||
Martin Kustermann pamconf
|
||||
Indriði Einarsson mason
|
||||
Chris map
|
||||
Krzysztof A. Adamski group
|
||||
Pascal Brueckner mailcap
|
||||
Jerónimo Carballo stata
|
||||
Phillip Kovalev xquery
|
||||
Bernhard Grotz potwiki
|
||||
sgronblo man
|
||||
François txt2tags
|
||||
Giacomo Mariani SVNinfo
|
||||
Matthew Lee Hinman newlisp, clojure
|
||||
Elias Pipping automake
|
||||
Edwin Benavides actionscript, processing
|
||||
Thomas Rowe hostsaccess
|
||||
Simon Ruderich asciidoc, git, gitcommit, gitrebase
|
||||
Keitheis mako, genshi
|
||||
David conkyrc
|
||||
Miguel Jaque Barbero SVNannotate
|
||||
Stefan Walk sieve
|
||||
Adam Thorsen objj
|
||||
Thilo Six dhcpd, limits, ntp, resolv, rgb, sysctl,
|
||||
udevconf, udevrules
|
||||
Andrey Skvortsov mp
|
||||
Simon Hengel htmlcheetah
|
||||
Matt Tolton javacc
|
||||
Ivan Devat javascript.jquery
|
||||
tpope cucumber,pdf
|
||||
==============================================================================
|
||||
10. License *NERDComLicense*
|
||||
|
||||
The NERD commenter is released under the wtfpl.
|
||||
See http://sam.zoy.org/wtfpl/COPYING.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,77 +0,0 @@
|
|||
*akmap.txt* Andre Vim mappings
|
||||
|
||||
1. Overview |akmap-intro|
|
||||
2. Toggles |akmap-toggles|
|
||||
3. OS Interaction |akmap-os|
|
||||
4. Developer |akmap-dev|
|
||||
5. Commenter |akmap-commenter|
|
||||
6. Text |akmap-text|
|
||||
7. Misc |akmap-misc|
|
||||
7. Version |akmap-ver|
|
||||
|
||||
======================================================================
|
||||
|
||||
*akmap-intro*
|
||||
1. Overview~
|
||||
<,hh> - Show this file
|
||||
|
||||
*akmap-toggles*
|
||||
2. Toggles~
|
||||
,l - Toggle list |list|
|
||||
,N - Toggle line numbers |numbers|
|
||||
,x - Toggle paste |paste|
|
||||
,f - Toggle Full screen
|
||||
,n - Toggle NERD Tree (file browser) |NERDTree|
|
||||
,T - Toggle tags list |taglist.txt|
|
||||
|
||||
*akmap-os*
|
||||
3. OS interaction~
|
||||
,ts - Open terminal window, splitting |ConqueTerm|
|
||||
,tt - Open terminal window, new tab |ConqueTerm|
|
||||
,of - Open Filemanager (Finder) in actual directory
|
||||
|
||||
*akmap-dev*
|
||||
4. Developer~
|
||||
,ml - Append modeline
|
||||
,ff - Javascript beautifier
|
||||
,pw - PyDoc
|
||||
|
||||
*akmap-commenter*
|
||||
5. Commenter~
|
||||
See |NERDCommenter|
|
||||
|
||||
,cc - Comment
|
||||
,cu - Uncomment
|
||||
,ci - Invert comment status (decomment if commented, comment else)
|
||||
,cy - Yank and comment
|
||||
,ca - Alternate delimiters
|
||||
,cs - Sexy comments (nicer)
|
||||
|
||||
*akmap-text*
|
||||
6. Text~
|
||||
See |textformat|
|
||||
|
||||
,ac - Align center
|
||||
,aj - Align justify
|
||||
,al - Align left
|
||||
,ar - Align right
|
||||
|
||||
*akmap-misc*
|
||||
7. Misc~
|
||||
|
||||
In command or insertion mode:
|
||||
<Shift-Ctrl-Up> - Move line up
|
||||
<Shift-Ctrl-Down> - Move line down
|
||||
|
||||
In Visual mode:
|
||||
<Shift-Ctrl-Up> - Move block up
|
||||
<Shift-Ctrl-Down> - Move block down
|
||||
|
||||
|
||||
*akmap-ver*
|
||||
8. Version~
|
||||
Author: Andrea Mistrali
|
||||
Version: $Id$
|
||||
Last change: $Date$
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
|
@ -1,442 +0,0 @@
|
|||
*bufexplorer.txt* Buffer Explorer Last Change: 19 Nov 2008
|
||||
|
||||
Buffer Explorer *buffer-explorer* *bufexplorer*
|
||||
Version 7.2.2
|
||||
|
||||
Plugin for easily exploring (or browsing) Vim |:buffers|.
|
||||
|
||||
|bufexplorer-usage| Usage
|
||||
|bufexplorer-installation| Installation
|
||||
|bufexplorer-customization| Customization
|
||||
|bufexplorer-changelog| Change Log
|
||||
|bufexplorer-todo| Todo
|
||||
|bufexplorer-credits| Credits
|
||||
|
||||
For Vim version 7.0 and above.
|
||||
This plugin is only available if 'compatible' is not set.
|
||||
|
||||
{Vi does not have any of this}
|
||||
|
||||
==============================================================================
|
||||
INSTALLATION *bufexplorer-installation*
|
||||
|
||||
To install:
|
||||
- Download the bufexplorer.zip.
|
||||
- Extract the zip archive into your runtime directory.
|
||||
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
|
||||
- Start Vim or goto an existing instance of Vim.
|
||||
- Execute the following command:
|
||||
>
|
||||
:helptag <your runtime directory/doc
|
||||
<
|
||||
This will generate all the help tags for any file located in the doc
|
||||
directory.
|
||||
|
||||
==============================================================================
|
||||
USAGE *bufexplorer-usage*
|
||||
|
||||
To start exploring in the current window, use: >
|
||||
\be OR :BufExplorer
|
||||
To start exploring in a newly split horizontal window, use: >
|
||||
\bs or :HSBufExplorer
|
||||
To start exploring in a newly split vertical window, use: >
|
||||
\bv or :VSBufExplorer
|
||||
|
||||
If you would like to use something other than '\', you may simply change the
|
||||
leader (see |mapleader|).
|
||||
|
||||
Note: If the current buffer is modified when bufexplorer started, the current
|
||||
window is always split and the new bufexplorer is displayed in that new
|
||||
window.
|
||||
|
||||
Commands to use once exploring:
|
||||
|
||||
<enter> Opens the buffer that is under the cursor into the current
|
||||
window.
|
||||
<F1> Toggle help information.
|
||||
<leftmouse> Opens the buffer that is under the cursor into the current
|
||||
window.
|
||||
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
||||
d |:wipeout| the buffer under the cursor from the list.
|
||||
When a buffers is wiped, it will not be shown when unlisted
|
||||
buffer are displayed.
|
||||
D |:delete| the buffer under the cursor from the list.
|
||||
The buffer's 'buflisted' is cleared. This allows for the buffer
|
||||
to be displayed again using the 'show unlisted' command.
|
||||
f Toggles whether you are taken to the active window when
|
||||
selecting a buffer or not.
|
||||
p Toggles the showing of a split filename/pathname.
|
||||
q Quit exploring.
|
||||
r Reverses the order the buffers are listed in.
|
||||
R Toggles relative path/absolute path.
|
||||
s Selects the order the buffers are listed in. Either by buffer
|
||||
number, file name, file extension, most recently used (MRU), or
|
||||
full path.
|
||||
t Opens the buffer that is under the cursor in another tab.
|
||||
u Toggles the showing of "unlisted" buffers.
|
||||
|
||||
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
|
||||
sort method) of all the buffers that are currently opened. You are then
|
||||
able to move the cursor to the line containing the buffer's name you are
|
||||
wanting to act upon. Once you have selected the buffer you would like,
|
||||
you can then either open it, close it(delete), resort the list, reverse
|
||||
the sort, quit exploring and so on...
|
||||
|
||||
===============================================================================
|
||||
CUSTOMIZATION *bufexplorer-customization*
|
||||
|
||||
*g:bufExplorerDefaultHelp*
|
||||
To control whether the default help is displayed or not, use: >
|
||||
let g:bufExplorerDefaultHelp=0 " Do not show default help.
|
||||
let g:bufExplorerDefaultHelp=1 " Show default help.
|
||||
The default is to show the default help.
|
||||
|
||||
*g:bufExplorerDetailedHelp*
|
||||
To control whether detailed help is display by, use: >
|
||||
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
|
||||
let g:bufExplorerDetailedHelp=1 " Show detailed help.
|
||||
The default is NOT to show detailed help.
|
||||
|
||||
*g:bufExplorerFindActive*
|
||||
To control whether you are taken to the active window when selecting a buffer,
|
||||
use: >
|
||||
let g:bufExplorerFindActive=0 " Do not go to active window.
|
||||
let g:bufExplorerFindActive=1 " Go to active window.
|
||||
The default is to be taken to the active window.
|
||||
|
||||
*g:bufExplorerReverseSort*
|
||||
To control whether to sort the buffer in reverse order or not, use: >
|
||||
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
|
||||
let g:bufExplorerReverseSort=1 " Sort in reverse order.
|
||||
The default is NOT to sort in reverse order.
|
||||
|
||||
*g:bufExplorerShowDirectories*
|
||||
Directories usually show up in the list from using a command like ":e .".
|
||||
To control whether to show directories in the buffer list or not, use: >
|
||||
let g:bufExplorerShowDirectories=1 " Show directories.
|
||||
let g:bufExplorerShowDirectories=0 " Don't show directories.
|
||||
The default is to show directories.
|
||||
|
||||
*g:bufExplorerShowRelativePath*
|
||||
To control whether to show absolute paths or relative to the current
|
||||
directory, use: >
|
||||
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
|
||||
let g:bufExplorerShowRelativePath=1 " Show relative paths.
|
||||
The default is to show absolute paths.
|
||||
|
||||
*g:bufExplorerShowUnlisted*
|
||||
To control whether to show unlisted buffer or not, use: >
|
||||
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
||||
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
||||
The default is to NOT show unlisted buffers.
|
||||
|
||||
*g:bufExplorerSortBy*
|
||||
To control what field the buffers are sorted by, use: >
|
||||
let g:bufExplorerSortBy='extension' " Sort by file extension.
|
||||
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
|
||||
let g:bufExplorerSortBy='mru' " Sort by most recently used.
|
||||
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
|
||||
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
|
||||
The default is to sort by mru.
|
||||
|
||||
*g:bufExplorerSplitBelow*
|
||||
To control where the new split window will be placed above or below the
|
||||
current window, use: >
|
||||
let g:bufExplorerSplitBelow=1 " Split new window below current.
|
||||
let g:bufExplorerSplitBelow=0 " Split new window above current.
|
||||
The default is to use what ever is set by the global &splitbelow
|
||||
variable.
|
||||
|
||||
*g:bufExplorerSplitOutPathName*
|
||||
To control whether to split out the path and file name or not, use: >
|
||||
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
|
||||
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
|
||||
" name.
|
||||
The default is to split the path and file name.
|
||||
|
||||
*g:bufExplorerSplitRight*
|
||||
To control where the new vsplit window will be placed to the left or right of
|
||||
current window, use: >
|
||||
let g:bufExplorerSplitRight=0 " Split left.
|
||||
let g:bufExplorerSplitRight=1 " Split right.
|
||||
The default is to use the global &splitright.
|
||||
|
||||
===============================================================================
|
||||
CHANGE LOG *bufexplorer-changelog*
|
||||
|
||||
7.2.2 - Fix:
|
||||
* Thanks to David L. Dight for spotting and fixing an issue when
|
||||
using ctrl^. bufexplorer would incorrectly handle the previous
|
||||
buffer so that when ctrl^ was pressed the incorrect file was opened.
|
||||
7.2.1 - Fix:
|
||||
* Thanks to Dimitar for spotting and fixing a feature that was
|
||||
inadvertently left out of the previous version. The feature was
|
||||
when bufexplorer was used together with WinManager, you could use
|
||||
the tab key to open a buffer in a split window.
|
||||
7.2.0 - Enhancements:
|
||||
* For all those missing the \bs and \bv commands, these have now
|
||||
returned. Thanks to Phil O'Connell for asking for the return of
|
||||
these missing features and helping test out this version.
|
||||
Fixes:
|
||||
* Fixed problem with the bufExplorerFindActive code not working
|
||||
correctly.
|
||||
* Fixed an incompatibility between bufexplorer and netrw that caused
|
||||
buffers to be incorrectly removed from the MRU list.
|
||||
7.1.7 - Fixes:
|
||||
* TaCahiroy fixed several issues related to opening a buffer in a
|
||||
tab.
|
||||
7.1.6 - Fixes:
|
||||
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
|
||||
McCarthy.
|
||||
7.1.5 - Fixes:
|
||||
* Could not open unnamed buffers. Fixed by TaCahiroy.
|
||||
7.1.4 - Fixes:
|
||||
* Sometimes when a file's path has 'white space' in it, extra buffers
|
||||
would be created containing each piece of the path. i.e:
|
||||
opening c:\document and settings\test.txt would create a buffer
|
||||
named "and" and a buffer named "Documents". This was reported and
|
||||
fixed by TaCa Yoss.
|
||||
7.1.3 - Fixes:
|
||||
* Added code to allow only one instance of the plugin to run at a
|
||||
time. Thanks Dennis Hostetler.
|
||||
7.1.2 - Fixes:
|
||||
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
|
||||
'jumplist' and with a couple calls to 'keepjumps', everything is
|
||||
fine again.
|
||||
* Went back to just having a plugin file, no autoload file. By having
|
||||
the autoload, WinManager was no longer working and without really
|
||||
digging into the cause, it was easier to go back to using just a
|
||||
plugin file.
|
||||
7.1.1 - Fixes:
|
||||
* A problem spotted by Thomas Arendsen Hein.
|
||||
When running Vim (7.1.94), error E493 was being thrown.
|
||||
Enhancements:
|
||||
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
|
||||
buffer.
|
||||
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
|
||||
* Making use of 'autoload' now to make the plugin load quicker.
|
||||
* Removed '\bs' and '\bv'. These are now controlled by the user. The
|
||||
user can issue a ':sp' or ':vs' to create a horizontal or vertical
|
||||
split window and then issue a '\be'
|
||||
* Added handling of tabs.
|
||||
7.0.17 - Fixed issue with 'drop' command.
|
||||
Various enhancements and improvements.
|
||||
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
|
||||
...
|
||||
Open file1, open file2, modify file1, open bufexplorer, you get the
|
||||
following error:
|
||||
|
||||
--------8<--------
|
||||
Error detected while processing function
|
||||
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
|
||||
line 4:
|
||||
E37: No write since last change (add ! to override)
|
||||
|
||||
But the worse thing is, when I want to save the current buffer and
|
||||
type ':w', I get another error message:
|
||||
E382: Cannot write, 'buftype' option is set
|
||||
--------8<--------
|
||||
|
||||
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
|
||||
the ':args' command.
|
||||
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
|
||||
versions to be recompiled with 'gui' support so the 'drop' command
|
||||
would work. The 'drop' command is really not needed in terminal
|
||||
versions.
|
||||
7.0.13 - Fixed integration with WinManager.
|
||||
Thanks to Dave Eggum for another update.
|
||||
- Fix: The detailed help didn't display the mapping for toggling
|
||||
the split type, even though the split type is displayed.
|
||||
- Fixed incorrect description in the detailed help for toggling
|
||||
relative or full paths.
|
||||
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
|
||||
thing.
|
||||
- Created a s:Set() function that sets a variable only if it hasn't
|
||||
already been defined. It's useful for initializing all those
|
||||
default settings.
|
||||
- Removed checks for repetitive command definitions. They were
|
||||
unnecessary.
|
||||
- Made the help highlighting a little more fancy.
|
||||
- Minor reverse compatibility issue: Changed ambiguous setting
|
||||
names to be more descriptive of what they do (also makes the code
|
||||
easier to follow):
|
||||
Changed bufExplorerSortDirection to bufExplorerReverseSort
|
||||
Changed bufExplorerSplitType to bufExplorerSplitVertical
|
||||
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
|
||||
- When the BufExplorer window closes, all the file-local marks are
|
||||
now deleted. This may have the benefit of cleaning up some of the
|
||||
jumplist.
|
||||
- Changed the name of the parameter for StartBufExplorer from
|
||||
"split" to "open". The parameter is a string which specifies how
|
||||
the buffer will be open, not if it is split or not.
|
||||
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
|
||||
only used in one spot.
|
||||
- Created four functions (SplitOpen(), RebuildBufferList(),
|
||||
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
|
||||
reduce repeated code.
|
||||
- Changed the name of AddHeader() to CreateHelp() to be more
|
||||
descriptive of what it does. It now returns an array instead of
|
||||
updating the window directly. This has the benefit of making the
|
||||
code more efficient since the text the function returns is used a
|
||||
little differently in the two places the function is called.
|
||||
- Other minor simplifications.
|
||||
7.0.12 - MAJOR Update.
|
||||
This version will ONLY run with Vim version 7.0 or greater.
|
||||
Dave Eggum has made some 'significant' updates to this latest
|
||||
version:
|
||||
- Added BufExplorerGetAltBuf() global function to be used in the
|
||||
user’s rulerformat.
|
||||
- Added g:bufExplorerSplitRight option.
|
||||
- Added g:bufExplorerShowRelativePath option with mapping.
|
||||
- Added current line highlighting.
|
||||
- The split type can now be changed whether bufexplorer is opened
|
||||
in split mode or not.
|
||||
- Various major and minor bug fixes and speed improvements.
|
||||
- Sort by extension.
|
||||
Other improvements/changes:
|
||||
- Changed the help key from '?' to <F1> to be more 'standard'.
|
||||
- Fixed splitting of vertical bufexplorer window.
|
||||
Hopefully I have not forgot something :)
|
||||
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
|
||||
changed passive voice to active on a couple of warning messages.
|
||||
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
|
||||
the slash character used when displaying the path was incorrect.
|
||||
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
|
||||
bufexplorer/winmanager integration. The bug was were an
|
||||
annoying message would be displayed when a window was split or
|
||||
a new file was opened in a new window. Thanks Martin!
|
||||
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
|
||||
The bug was related to the incorrect displaying of the buffer
|
||||
explorer's window title.
|
||||
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
|
||||
enhancement allows the user to press 'S', that is capital S, which
|
||||
will open the buffer under the cursor in a newly created split
|
||||
window.
|
||||
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
|
||||
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
|
||||
tried to do a \bs to split the bufexplorer window, it would always
|
||||
split horizontal, not vertical. He also found that I had a typeo in
|
||||
that the variable g:bufExplorerSplitVertSize was all lower case in
|
||||
the documentation which was incorrect.
|
||||
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
|
||||
modified, the '+' was not showing up correctly.
|
||||
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
|
||||
been using vim 7.0 and not 6.3, I started using a function (getftype)
|
||||
that is not in 6.3. So for backward compatibility, I conditionaly use
|
||||
this function now. Thus, the g:bufExplorerShowDirectories feature is
|
||||
only available when using vim 7.0 and above.
|
||||
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
|
||||
buffer was deleted. This issue got me to rewrite the buffer display
|
||||
logic (which I've wanted to do for sometime now).
|
||||
Also great thanks to Dave Eggum for coming up with idea for
|
||||
g:bufExplorerShowDirectories. Read the above information about this
|
||||
feature.
|
||||
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
|
||||
has the default help turned off and then brought up the explorer. An
|
||||
E493 would be displayed.
|
||||
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
|
||||
The first problem allowed a modified buffer to be deleted. Opps! The
|
||||
second problem occurred when several files were opened, BufExplorer
|
||||
was started, the current buffer was deleted using the 'd' option, and
|
||||
then BufExplorer was exited. The deleted buffer was still visible
|
||||
while it is not in the buffers list. Opps again!
|
||||
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
|
||||
the fixed width (g:bufExplorerSplitVertSize) of a new window
|
||||
when opening bufexplorer vertically and fixed height
|
||||
(g:bufExplorerSplitHorzSize) of a new window when opening
|
||||
bufexplorer horizontally. By default, the windows are normally
|
||||
split to use half the existing width or height.
|
||||
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
|
||||
bufexplorer related stuff.
|
||||
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
|
||||
of the code. When selecting that the window was to be split
|
||||
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
|
||||
were split vertically, even though g:bufExplorerSplitType was not set
|
||||
to 'v'.
|
||||
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
|
||||
reason his bufexplorer window was always showing up folded. He added
|
||||
'setlocal nofoldenable' and it was fixed.
|
||||
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
|
||||
logic and option.
|
||||
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
|
||||
problem in that the last search pattern is overridden by the search
|
||||
pattern for blank lines.
|
||||
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
|
||||
for sometime now. The <esc> key mapping was causing the buffer
|
||||
explored to close prematurely when vim was run in an xterm. The <esc>
|
||||
key mapping is now removed.
|
||||
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
|
||||
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
|
||||
setlocal nonumber and foldcolumn=0. This allows for line numbering
|
||||
and folding to be turned off temporarily while in the explorer.
|
||||
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
|
||||
newly split window to be temporarily vertical, which was suggested by
|
||||
Thomas Glanzmann.
|
||||
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
|
||||
Added folds to hide winmanager configuration.
|
||||
If anyone had the 'C' option in their cpoptions they would receive
|
||||
a E10 error on startup of BufExplorer. cpo is now saved, updated and
|
||||
restored. Thanks to Charles E Campbell, Jr.
|
||||
Attempted to make sure there can only be one BufExplorer window open
|
||||
at a time.
|
||||
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
|
||||
way buffers sorted by name will be in the correct order regardless of
|
||||
case.
|
||||
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
|
||||
to work in insertmode/modeless mode (evim). Added Initialize
|
||||
and Cleanup autocommands to handle commands that need to be
|
||||
performed when starting or leaving bufexplorer.
|
||||
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
|
||||
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
|
||||
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
|
||||
vertical splitting.
|
||||
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
|
||||
typos that I had in the documentation. I guess I need to run
|
||||
the spell checker more :o)
|
||||
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
|
||||
around the MRUList autocommands.
|
||||
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
|
||||
search history which messed up hlsearch.
|
||||
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
|
||||
winmanager.vim script could more easily integrate with this script.
|
||||
Tried to improve performance.
|
||||
6.0.9 - Added MRU (Most Recently Used) sort ordering.
|
||||
6.0.8 - Was not resetting the showcmd command correctly.
|
||||
Added nifty help file.
|
||||
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
|
||||
some are not, yet. Added highlighting of current and alternate
|
||||
filenames. Added splitting of path/filename toggle. Reworked
|
||||
ShowBuffers().
|
||||
Changed my email address.
|
||||
6.0.6 - Copyright notice added. Needed this so that it could be distributed
|
||||
with Debian Linux. Fixed problem with the SortListing() function
|
||||
failing when there was only one buffer to display.
|
||||
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
|
||||
hit 'd' on a buffer that belonged to a files that no longer existed
|
||||
and that the 'yank' buffer was being overridden by the help text when
|
||||
the bufexplorer was opened.
|
||||
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
|
||||
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
|
||||
as well as fixing the 'w:sortDirLabel not being defined' bug.
|
||||
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
|
||||
6.0.2 - Can't remember.
|
||||
6.0.1 - Initial release.
|
||||
|
||||
===============================================================================
|
||||
TODO *bufexplorer-todo*
|
||||
|
||||
- The issuing of a ':bd' command does not always remove the buffer number from
|
||||
the MRU list.
|
||||
|
||||
===============================================================================
|
||||
CREDITS *bufexplorer-credits*
|
||||
|
||||
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
|
||||
|
||||
Credit must go out to Bram Moolenaar and all the Vim developers for
|
||||
making the world's best editor (IMHO). I also want to thank everyone who
|
||||
helped and gave me suggestions. I wouldn't want to leave anyone out so I
|
||||
won't list names.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:noet:wrap:ts=8:ft=help:norl:
|
|
@ -1,204 +0,0 @@
|
|||
*cecutil.txt* DrChip's Utilities Sep 04, 2007
|
||||
|
||||
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
|
||||
(remove NOSPAM from Campbell's email first)
|
||||
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *cecutil-copyright*
|
||||
The VIM LICENSE applies to cecutil.vim and cecutil.txt
|
||||
(see |copyright|) except use "cecutil" instead of "Vim"
|
||||
No warranty, express or implied. Use At-Your-Own-Risk.
|
||||
|
||||
==============================================================================
|
||||
1. Contents *cecutil* *cecutil-contents*
|
||||
|
||||
1. Contents.................: |cecutil-contents|
|
||||
2. Positioning..............: |cecutil-posn|
|
||||
3. Marks....................: |cecutil-marks|
|
||||
4. Maps.....................: |cecutil-maps|
|
||||
5. History..................: |cecutil-history|
|
||||
|
||||
==============================================================================
|
||||
2. Positioning *cecutil-posn* *cecutil-position*
|
||||
|
||||
let winposn= SaveWinPosn() *cecutil-savewinposn*
|
||||
|
||||
This operation will save window position in winposn variable and
|
||||
on a (buffer local) b:winposn{} stack.
|
||||
|
||||
call SaveWinPosn()
|
||||
|
||||
This function will save window position in b:winposn{b:iwinposn}
|
||||
|
||||
let winposn= SaveWinPosn(0)
|
||||
|
||||
This operation will _only_ save the window position in winposn variable.
|
||||
Ie. the window position will not appear on the b:winposn{} stack. You
|
||||
will then need to use RestoreWinPosn(winposn) to restore to this window
|
||||
position.
|
||||
|
||||
call RestoreWinPosn() *cecutil-restorewinposn*
|
||||
|
||||
This function call will use the local buffer b:winposn{} stack to
|
||||
restore the last window position saved therein. It will also
|
||||
pop the stack.
|
||||
|
||||
call RestoreWinPosn(winposn)
|
||||
|
||||
This function call will use the winposn variable and restore
|
||||
the window position accordingly. It will also search the
|
||||
stack and remove any similar entry from the stack.
|
||||
|
||||
*cecutil-map* *cecutil-cmd* *cecutil-swp* *cecutil-rwp*
|
||||
\swp : save current window position (uses the b:winposn{} stack)
|
||||
:SWP like \swp, but provided as a command
|
||||
|
||||
\rwp : restore window position (uses the b:winposn{} stack)
|
||||
:RWP like \rwp, but provided as a command
|
||||
|
||||
==============================================================================
|
||||
3. Marks *cecutil-marks*
|
||||
|
||||
call SaveMark(markname) *cecutil-savemark*
|
||||
let savemark= SaveMark(markname)
|
||||
SM markname >
|
||||
|
||||
ex. call SaveMark("a")
|
||||
let savemarkb= SaveMark("b")
|
||||
:SM a
|
||||
<
|
||||
This function saves a string in the global variable g:savemark_{markname}
|
||||
which contains sufficient information to completely restore the position
|
||||
of a mark. It also returns that string.
|
||||
|
||||
call RestoreMark(markname) *cecutil-restoremark*
|
||||
call RestoreMark(savemark)
|
||||
|
||||
This function either takes a single-character string (ex. "a") and uses
|
||||
g:savemark_{markname} to restore the mark position or assumes that
|
||||
the string passed to it is a SaveMark() string (and uses it to restore
|
||||
the mark). >
|
||||
|
||||
ex. call RestoreMark("a")
|
||||
call RestoreMark(savemarkb)
|
||||
:RM a
|
||||
<
|
||||
|
||||
call DestroyMark(markname) *cecutil-destroymark*
|
||||
|
||||
The DestroyMark() function completely removes a mark. It does this
|
||||
by saving the window position, copying line one, putting the
|
||||
to-be-destroyed mark on that new line, deleting the new line, and
|
||||
then restoring the window position. The windows' modified status
|
||||
is preserved. >
|
||||
|
||||
ex. call DestroyMark("a")
|
||||
:DM a
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
4.Maps *cecutil-maps*
|
||||
*cecutil-saveusermaps*
|
||||
call SaveUserMaps(mapmode,maplead,mapchx,suffix)
|
||||
|
||||
This function sets up a script-variable (ie. a variable that can
|
||||
generally be accessed only from within cecutil's own functions;
|
||||
see |s:|) called s:restoremap. The selected user's maps are appended
|
||||
to this variable; the RestoreUserMaps() (|cecutil-restoreusermaps|)
|
||||
function uses the contents of this variable to restore user maps.
|
||||
|
||||
mapmode - see :help maparg for its list (see |maparg()|) >
|
||||
ex. "n" = Normal
|
||||
< Will now accept an optional leading "u"; if present,
|
||||
SaveUserMaps() will save and unmap (otherwise, it
|
||||
will save only)
|
||||
mapchx - "<something>" handled as a single map item. >
|
||||
ex. "<left>"
|
||||
< - "string" a string of single letters which are actually
|
||||
multiple two-letter maps
|
||||
maplead - the maps are assumed to have the form >
|
||||
maplead . each_character_in_string
|
||||
< ex. maplead="\" and mapchx="abc" saves mappings for >
|
||||
\a, \b, and \c
|
||||
< Of course, if maplead is "", then for mapchx="abc",
|
||||
mappings for just a, b, and c are saved.
|
||||
- :something handled as a single map item, w/o the ":" >
|
||||
ex. mapchx= ":abc"
|
||||
< will save the user mapping for "abc"
|
||||
suffix - a string unique to your plugin >
|
||||
ex. suffix= "DrawIt"
|
||||
<
|
||||
Some examples follow: >
|
||||
|
||||
call SaveUserMaps("n","","webWEBjklh$0%;,nN","HiMtchBrkt")
|
||||
< normal mode maps for w, e, b, W, E, B, j, k, l, etc
|
||||
(if any) are all saved in the variable
|
||||
s:restoremaps_HiMtchBrkt >
|
||||
|
||||
call SaveUserMaps("n","","<up>","DrawIt")
|
||||
< the normal mode map (if any) for the <up> key is saved in
|
||||
the variable s:restoremaps_DrawIt >
|
||||
|
||||
call SaveUserMaps("n","",":F(","HiMtchBrkt")
|
||||
< the normal mode map for F( (if any) is saved in the
|
||||
variable s:restoremaps_HiMtchBrkt
|
||||
|
||||
call RestoreUserMaps(suffix)
|
||||
|
||||
The usermaps saved by SaveUserMaps() with the given suffix will be
|
||||
restored (ie. s:restoremaps_{suffix}). Example: >
|
||||
|
||||
call RestoreUserMaps("HiMtchBrkt")
|
||||
< will restore all user maps redefined for the HiMtchBrkt plugin
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. History *cecutil-history* {{{1
|
||||
|
||||
v17 Sep 04, 2007 : * new function, QArgSplitter(), included
|
||||
v16 Oct 30, 2006 : * com -> com! so AsNeeded is happier
|
||||
Feb 12, 2007 * fixed a bug where :somemap (a map of "somemap")
|
||||
did not use the optional mapleader (so it'd be
|
||||
a map of "\somemap", if "\" is the mapleader).
|
||||
(problem pointed out by Michael Zhang)
|
||||
v15 Jan 25, 2006 : * bypass for report option for DestroyMark() included
|
||||
* SaveWinPosn() and RestoreWinPosn() now handle an
|
||||
empty buffer
|
||||
* b:(varname) now use b:cecutil_(varname)
|
||||
* map restoration improved
|
||||
v14 Jan 23, 2006 : * bypasses for si, so, and siso options included
|
||||
Jan 25, 2006 * SaveUserMaps' mapmode argument, heretofore just
|
||||
a single letter (see |maparg()|), now accepts a
|
||||
leading "u". If present, SaveUserMaps() will
|
||||
do an unmap.
|
||||
v13 Jan 12, 2006 : * SaveUserMaps() was saving user maps but then also
|
||||
unmap'ing them. HiMtchBrkt needed to append a
|
||||
function call to maps, not overwrite them. So
|
||||
the new SaveUserMaps() just saves user maps,
|
||||
leaving their definitions in place.
|
||||
Jan 18, 2006 * keepjumps used to avoid jumplist changes when
|
||||
using SaveWinPosn() and RestoreWinPosn()
|
||||
v12 Dec 29, 2005 : * bugfix (affected Mines.vim)
|
||||
v11 Dec 29, 2005 : * two new functions (SaveUserMaps() and
|
||||
RestoreUserMaps() )
|
||||
v10 Nov 22, 2005 : * SaveWinPosn bugfix
|
||||
v9 Jun 02, 2005 : * <q-args> produces a "" argument when there are
|
||||
no arguments, which caused difficulties. Fixed.
|
||||
v8 Apr 22, 2005 : * <q-args> used to handle marknames with commands
|
||||
Thus, :DM a will delete mark a
|
||||
v7 Mar 10, 2005 : * removed zO from saved window position; caused
|
||||
problems with ftplugin/currfunc.vim
|
||||
* doing a SWP and RWP on an empty buffer produced
|
||||
"empty buffer" messages; now these are ignored
|
||||
Apr 13, 2005 * command (SWP RWP MP SP etc) now have -bar so
|
||||
that the "|" can be used to chain such commands
|
||||
v6 Feb 17, 2005 : * improved SaveMark() and RestoreMark()
|
||||
v5 Jan 18, 2005 : * s:loaded_winposn changed to g:loaded_cecutil
|
||||
v4 Oct 25, 2004 : * changed com! to com so that error messages will
|
||||
be given when there's a command-name conflict
|
||||
v3 May 19, 2004 : * bugfix: the sequence \swp\rwp wasn't working right
|
||||
* bugfix: \swp...\rwp was echoing the current
|
||||
line when the \rwp should've been silent
|
||||
* improved Dfunc/Decho/Dret debugging
|
||||
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:fdm=marker
|
|
@ -1,646 +0,0 @@
|
|||
*ConqueTerm* Plugin to run a shell inside a Vim buffer
|
||||
|
||||
The ConqueTerm plugin will turn a Vim buffer into a terminal emulator, allowing
|
||||
you to run and interact with a shell or shell application inside the buffer.
|
||||
|
||||
1. Installation |conque-term-setup|
|
||||
1.1 Requirements for Unix |conque-term-requirements|
|
||||
1.2 Requirements for Windows |conque-term-windows|
|
||||
1.3 Installation |conque-term-installation|
|
||||
2. Usage |conque-term-usage|
|
||||
2.1 General Usage |conque-term-gen-usage|
|
||||
2.2 Special keys |conque-term-special-keys|
|
||||
2.2.1 Send text to Conque |conque-term-send|
|
||||
2.2.2 Toggle terminal input mode |conque-term-input-mode|
|
||||
2.2.3 Sending the <Esc> key press |conque-term-esc|
|
||||
3. Configuration |conque-term-options|
|
||||
3.1 General |conque-config-general|
|
||||
3.1.1 Python version |ConqueTerm_PyVersion|
|
||||
3.1.2 Fast mode |ConqueTerm_FastMode|
|
||||
3.1.3 Color support |ConqueTerm_Color|
|
||||
3.1.4 Session Support |ConqueTerm_SessionSupport|
|
||||
3.1.5 Keep updating terminal buffer |ConqueTerm_ReadUnfocused|
|
||||
3.1.6 Insert mode when entering buffer |ConqueTerm_InsertOnEnter|
|
||||
3.1.7 Close buffer when program exits |ConqueTerm_CloseOnEnd|
|
||||
3.1.8 Hide start messages |ConqueTerm_StartMessages|
|
||||
3.1.9 Regex for highlighting your prompt |ConqueTerm_PromptRegex|
|
||||
3.1.10 Syntax type |ConqueTerm_Syntax|
|
||||
3.2 Keyboard |conque-config-keyboard|
|
||||
3.2.1 The <Esc> key |ConqueTerm_EscKey|
|
||||
3.2.2 Toggle terminal input mode |ConqueTerm_ToggleKey|
|
||||
3.2.3 Enable <C-w> in insert mode |ConqueTerm_CWInsert|
|
||||
3.2.4 Execute current file in Conque |ConqueTerm_ExecFileKey|
|
||||
3.2.5 Send current file contents to Conque|ConqueTerm_SendFileKey|
|
||||
3.2.6 Send selected text to Conque |ConqueTerm_SendVisKey|
|
||||
3.2.7 Function Keys |ConqueTerm_SendFunctionKeys|
|
||||
3.3 Unix |conque-config-unix|
|
||||
3.3.1 Choose your terminal type |ConqueTerm_TERM|
|
||||
3.4 Windows |conque-config-windows|
|
||||
3.4.1 Python executable |ConqueTerm_PyExe|
|
||||
3.4.2 Windows character code page |ConqueTerm_CodePage|
|
||||
3.4.3 Terminal color method |ConqueTerm_ColorMode|
|
||||
4. VimScript API |conque-term-api|
|
||||
4.1 conque_term#open() |conque-term-open|
|
||||
4.2 conque_term#subprocess() |conque-term-subprocess|
|
||||
4.3 conque_term#get_instance() |conque-term-get-instance|
|
||||
4.4 CONQUE_OBJECT.write() |conque-term-write|
|
||||
4.5 CONQUE_OBJECT.writeln() |conque-term-writeln|
|
||||
4.6 CONQUE_OBJECT.read() |conque-term-read|
|
||||
4.7 CONQUE_OBJECT.set_callback() |conque-term-set-callback|
|
||||
4.8 CONQUE_OBJECT.close() |conque-term-close|
|
||||
4.9 Registering functions |conque-term-events|
|
||||
5. Misc |conque-term-misc|
|
||||
5.1 Known bugs |conque-term-bugs|
|
||||
5.2 Contribute |conque-term-contribute|
|
||||
5.3 Feedback |conque-term-feedback|
|
||||
|
||||
==============================================================================
|
||||
|
||||
1. Installation *conque-term-setup*
|
||||
|
||||
Conque is designed for both Unix and Windows operating systems, however the
|
||||
requirements are slightly different. Please check section below corresponding
|
||||
to your installed OS.
|
||||
|
||||
1.1 Requirements for Unix *conque-term-requirements*
|
||||
|
||||
* [G]Vim 7.0+ with +python and/or +python3
|
||||
* Python 2.3+ and/or 3.x
|
||||
* Unix-like OS: Linux, OS X, Solaris, Cygwin, etc
|
||||
|
||||
The most common stumbling block is getting a version of Vim which has the
|
||||
python interface enabled. Most all software package managers will have a copy
|
||||
of Vim with Python support, so that is often the easiest way to get it. If
|
||||
you're compiling Vim from source, be sure to use the --enable-pythoninterp
|
||||
option, or --enable-python3interp for Python 3. On OS X the best option is
|
||||
MacVim, which installs with Python support by default.
|
||||
|
||||
1.2 Requirements for Windows *conque-term-windows*
|
||||
|
||||
* [G]Vim 7.3 with +python and/or +python3
|
||||
* Python 2.7 and/or 3.1
|
||||
* Modern Windows OS (XP or later)
|
||||
|
||||
Conque only officially supports the latest GVim 7.3 Windows installer
|
||||
available at www.vim.org. If you are currently using Vim 7.2 or earlier you
|
||||
will need to upgrade to 7.3 for Windows support. The Windows installer already
|
||||
has the +python/+python3 interface built in.
|
||||
|
||||
The official 7.3 release of Vim for Windows only works with Python versions
|
||||
2.7 and/or 3.1. You can download and install Python from their website
|
||||
http://www.python.org/download
|
||||
|
||||
If you are compiling Vim + Python from source on Windows, the requirements
|
||||
become only Vim 7.3+ and Python 2.7+.
|
||||
|
||||
|
||||
1.3 Installation *conque-term-installation*
|
||||
|
||||
Download the latest vimball from http://conque.googlecode.com
|
||||
|
||||
Open the .vba file with Vim and run the following commands:
|
||||
>
|
||||
:so %
|
||||
:q
|
||||
<
|
||||
That's it! The :ConqueTerm command will be available the next time you start
|
||||
Vim. You can delete the .vba file when you've verified Conque was successfully
|
||||
installed.
|
||||
|
||||
==============================================================================
|
||||
|
||||
2. Usage *conque-term-usage*
|
||||
|
||||
2.1 General Usage *conque-term-gen-usage*
|
||||
|
||||
Type :ConqueTerm <command> to launch an application in the current buffer. Eg:
|
||||
>
|
||||
:ConqueTerm bash
|
||||
:ConqueTerm mysql -h localhost -u joe_lunchbox Menu
|
||||
:ConqueTerm Powershell.exe
|
||||
<
|
||||
Use :ConqueTermSplit or :ConqueTermVSplit to open Conque in a new horizontal
|
||||
or vertical buffer. Use :ConqueTermTab to open Conque in a new tab.
|
||||
|
||||
In insert mode you can interact with the shell as you would expect in a
|
||||
normal terminal. All key presses will be sent to the terminal, including
|
||||
control characters. See |conque-term-special-keys| for more information,
|
||||
particularly regarding the <Esc> key.
|
||||
|
||||
In normal mode you can use Vim commands to browse your terminal output and
|
||||
scroll back through the history. Most all Vim functionality will work, such
|
||||
as searching, yanking or highlighting text.
|
||||
|
||||
|
||||
2.2 Special keys *conque-term-special-keys*
|
||||
|
||||
There are several keys which can be configured to have special behavior with
|
||||
Conque.
|
||||
|
||||
2.2.1 Send text to Conque *conque-term-send*
|
||||
|
||||
Conque gives you three different commands to send text from a different
|
||||
buffer, probably a source code file, to the Conque terminal buffer. All three
|
||||
are configurable to use your choice of key combinations.
|
||||
|
||||
To send a visually selected range of text to an existing terminal buffer,
|
||||
press the <F9> key.
|
||||
|
||||
To send the entire contents of the file you are editing to an existing
|
||||
terminal buffer, press the <F10> key.
|
||||
|
||||
Finally, to execute the current file in a new terminal buffer press the <F11>
|
||||
key. This will split the screen with a new Conque buffer. The file you are
|
||||
editing must be executable for this command to work.
|
||||
|
||||
See |conque-term-options| for information about configuring these commands.
|
||||
|
||||
2.2.2 Toggle terminal input mode *conque-term-input-mode*
|
||||
|
||||
If you want to use insert mode to edit the terminal screen, press <F8>. You
|
||||
will now be able to edit the terminal output freely without your cursor
|
||||
jumping the the active prompt line. This may be useful if you want to reformat
|
||||
terminal output for readability.
|
||||
|
||||
While the terminal is paused new output will not be displayed on the screen
|
||||
until you press <F8> again to resume.
|
||||
|
||||
You can configure Conque to use a different key with the |ConqueTerm_ToggleKey|
|
||||
option.
|
||||
|
||||
2.2.3 Sending the <Esc> key press *conque-term-esc*
|
||||
|
||||
By default if you press the <Esc> key in a Conque buffer you will leave insert
|
||||
mode. But what if you want the <Esc> character to be sent to your terminal?
|
||||
There are two options. By default, pressing <Esc> twice will send one <Esc>
|
||||
character to the terminal and you will remain in insert mode, while pressing
|
||||
it once will leave insert mode.
|
||||
|
||||
Alternatively you can use the |ConqueTerm_EscKey| option to choose a
|
||||
different key for leaving insert mode. If a custom key is set, then all <Esc>
|
||||
key presses will be sent to the terminal.
|
||||
|
||||
2.3 Registering functions *conque-term-register*
|
||||
|
||||
Conque allows you to write your own VimScript functions which will be called
|
||||
at certain events. See the API section |conque-term-events| for more.
|
||||
|
||||
==============================================================================
|
||||
|
||||
3. Options *conque-term-options*
|
||||
|
||||
You can set the following options in your .vimrc (default values shown)
|
||||
|
||||
3.1 General *conque-config-general*
|
||||
|
||||
3.1.1 Python version *ConqueTerm_PyVersion*
|
||||
|
||||
Conque will work with either Python 2.x or 3.x, assuming the interfaces have
|
||||
been installed. By default it will try to use Python 2 first, then will try
|
||||
Python 3. If you want Conque to use Python 3, set this variable to 3.
|
||||
|
||||
Note: even if you set this to 3, if you don't have the python3 interface
|
||||
Conque will fall back to using Python 2.
|
||||
>
|
||||
let g:ConqueTerm_PyVersion = 2
|
||||
<
|
||||
3.1.2 Fast Mode *ConqueTerm_FastMode*
|
||||
|
||||
Disable features which could make Conque run slowly. This includes most
|
||||
terminal colors and some unicode support. Set this to 1 to enable fast mode.
|
||||
>
|
||||
let g:ConqueTerm_FastMode = 0
|
||||
<
|
||||
3.1.3 Color support *ConqueTerm_Color*
|
||||
|
||||
Terminal colors have the potential to slow down terminal screen rendering,
|
||||
depending on how many colors are used and how fast the computer is. This
|
||||
option allows you to choose how much color support will be enabled.
|
||||
|
||||
If set to 0, terminal colors will be disabled. This will allow the terminal to
|
||||
render most quickly. Syntax highlighting will still work. For example
|
||||
highlighting quoted strings or MySQL output.
|
||||
|
||||
If set to 1, terminal colors will be enabled, but only for the most recent 200
|
||||
lines of terminal output. Older output will be periodically stripped of color
|
||||
highlighting to keep the display responsive.
|
||||
|
||||
If set to 2, terminal colors will always be enabled. If your programs don't
|
||||
use color output very frequently this is a good choice.
|
||||
|
||||
Note: Color support is automatically disabled in "fast mode".
|
||||
>
|
||||
let g:ConqueTerm_Color = 1
|
||||
<
|
||||
3.1.4 Session Support *ConqueTerm_SessionSupport*
|
||||
|
||||
Vim's :mksession command allows you to save your current buffer configuration
|
||||
to a file, which can be loaded at a later time after you've closed Vim.
|
||||
|
||||
By default, Conque buffers are not restored. This is mostly for safety
|
||||
reasons; you may not want Vim to automatically re-run a destructive command.
|
||||
|
||||
However, if you're not working with missile launch code, and want Vim to
|
||||
restart your Conque buffers when you load a session file, set this variable
|
||||
to 1. Note your original subprocess and shell output will not be restored, but
|
||||
the same command will be started in your buffer.
|
||||
>
|
||||
let g:ConqueTerm_SessionSupport = 0
|
||||
<
|
||||
3.1.5 Keep updating terminal buffer *ConqueTerm_ReadUnfocused*
|
||||
|
||||
If set to 1 then your Conque buffers will continue to update after you've
|
||||
switched to another buffer.
|
||||
|
||||
Note: Conque buffers may continue to update, but they will not scroll down as
|
||||
new lines are added beyond the bottom of the visible buffer area. This is a
|
||||
limitation of the Vim scripting language for which I haven't found a
|
||||
workaround.
|
||||
>
|
||||
let g:ConqueTerm_ReadUnfocused = 1
|
||||
<
|
||||
3.1.6 Insert mode when entering buffer *ConqueTerm_InsertOnEnter*
|
||||
|
||||
If set to 1 then you will automatically go into insert mode when you enter the
|
||||
buffer. This diverges from normal Vim behavior. If 0 you will still be in
|
||||
normal mode.
|
||||
>
|
||||
let g:ConqueTerm_InsertOnEnter = 0
|
||||
<
|
||||
3.1.7 Close buffer when program exits *ConqueTerm_CloseOnEnd*
|
||||
|
||||
If you want your terminal buffer to be closed and permanently deleted when the
|
||||
program running inside of it exits, set this option to 1. Otherwise the buffer
|
||||
will become a simple text buffer after the program exits, and you can edit the
|
||||
program output in insert mode.
|
||||
>
|
||||
let g:ConqueTerm_CloseOnEnd = 0
|
||||
<
|
||||
3.1.8 Show start messages *ConqueTerm_StartMessages*
|
||||
|
||||
Display warning messages when starting up ConqueTerm if your system is
|
||||
configured incorrectly.
|
||||
>
|
||||
let g:ConqueTerm_StartMessages = 1
|
||||
<
|
||||
3.1.9 Regex for highlighting your prompt *ConqueTerm_PromptRegex*
|
||||
|
||||
Use this regular expression for sytax highlighting your terminal prompt. Your
|
||||
terminal will generally run faster if you use Vim highlighting instead of
|
||||
terminal colors for your prompt. You can also use it to do more advanced
|
||||
syntax highlighting for the prompt line.
|
||||
>
|
||||
let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
|
||||
<
|
||||
3.1.10 Choose Vim syntax type *ConqueTerm_Syntax*
|
||||
|
||||
Set the buffer syntax. The default 'conque' has highlighting for MySQL, but
|
||||
not much else.
|
||||
>
|
||||
let g:ConqueTerm_Syntax = 'conque'
|
||||
<
|
||||
3.2 Keyboard *conque-config-keyboard*
|
||||
|
||||
3.2.1 The <Esc> key *ConqueTerm_EscKey*
|
||||
|
||||
If a custom key is set, then all <Esc> key presses will be sent to the
|
||||
terminal and you must use this custom key to leave insert mode. If left to the
|
||||
default value of '<Esc>' then you must press it twice to send the escape
|
||||
character to the terminal, while pressing it once will leave insert mode.
|
||||
|
||||
Note: You cannot use a key which is internally coded with the escape
|
||||
character. This includes the <F-> keys and often the <A-> and <M-> keys.
|
||||
Picking a control key, such as <C-k> will be your best bet.
|
||||
>
|
||||
let g:ConqueTerm_EscKey = '<Esc>'
|
||||
<
|
||||
3.2.2 Toggle terminal input mode *ConqueTerm_ToggleKey*
|
||||
|
||||
Press this key to pause terminal input and output display. You will then be
|
||||
able to edit the terminal screen as if it were a normal text buffer. Press
|
||||
this key again to resume terminal mode.
|
||||
>
|
||||
let g:ConqueTerm_ToggleKey = '<F8>'
|
||||
<
|
||||
3.2.3 Enable <C-w> in insert mode *ConqueTerm_CWInsert*
|
||||
|
||||
If set to 1 then you can leave the Conque buffer using the <C-w> commands
|
||||
while you're still in insert mode. If set to 0 then the <C-w> character will
|
||||
be sent to the terminal. If both this option and ConqueTerm_InsertOnEnter are
|
||||
set you can go in and out of the terminal buffer while never leaving insert
|
||||
mode.
|
||||
>
|
||||
let g:ConqueTerm_CWInsert = 0
|
||||
<
|
||||
3.2.4 Execute current file in Conque *ConqueTerm_ExecFileKey*
|
||||
|
||||
Press this key to execute the file you're currently editing in a Conque
|
||||
buffer. Is equivelent to running the command :ConqueTermSplit YOUR_FILE. Your
|
||||
file must be executable for this command to work correctly.
|
||||
>
|
||||
let g:ConqueTerm_ExecFileKey = '<F11>'
|
||||
<
|
||||
3.2.5 Send current file contents to Conque *ConqueTerm_SendFileKey*
|
||||
|
||||
Press this key to send your entire file contents to the most recently opened
|
||||
Conque buffer as keyboard input.
|
||||
>
|
||||
let g:ConqueTerm_SendFileKey = '<F10>'
|
||||
<
|
||||
3.2.6 Send selected text to Conque *ConqueTerm_SendVisKey*
|
||||
|
||||
Use this key to send the currently selected text to the most recently created
|
||||
Conque buffer.
|
||||
>
|
||||
let g:ConqueTerm_SendVisKey = '<F9>'
|
||||
<
|
||||
3.2.7 Function Keys *ConqueTerm_SendFunctionKeys*
|
||||
|
||||
By default, function keys (the F1-F12 row at the top of your keyboard) are not
|
||||
passed to the terminal. Set this option to 1 to send these key events.
|
||||
|
||||
Note: Unless you configured |ConqueTerm_SendVisKey| and |ConqueTerm_ToggleKey|
|
||||
to use different keys, <F8> and <F9> will not be sent to the terminal even if
|
||||
you set this option to 1.
|
||||
>
|
||||
let g:ConqueTerm_SendFunctionKeys = 0
|
||||
<
|
||||
3.3 Unix *conque-config-unix*
|
||||
|
||||
3.3.1 Choose your terminal type, Unix ONLY *ConqueTerm_TERM*
|
||||
|
||||
Use this option to tell Conque what type of terminal it should identify itself
|
||||
as. Conque officially uses the more limited VT100 terminal type for
|
||||
developement and testing, although it supports some more advanced features
|
||||
such as colors and title strings.
|
||||
|
||||
You can change this setting to a more advanced type, namely 'xterm', but your
|
||||
results may vary depending on which programs you're running.
|
||||
>
|
||||
let g:ConqueTerm_TERM = 'vt100'
|
||||
<
|
||||
3.4 Windows *conque-config-windows*
|
||||
|
||||
3.4.1 Python executable, Windows ONLY *ConqueTerm_PyExe*
|
||||
|
||||
The Windows version of Conque needs to know the path to the python.exe
|
||||
executable for the version of Python Conque is using. If you installed Python
|
||||
in the default location, or added the Python directory to your system path,
|
||||
Conque should be able to find python.exe without you changing this variable.
|
||||
|
||||
For example, you might set this to 'C:\Program Files\Python27\python.exe'
|
||||
>
|
||||
let g:ConqueTerm_PyExe = ''
|
||||
<
|
||||
3.4.2 Windows character code page *ConqueTerm_CodePage*
|
||||
|
||||
Set the "code page" Windows will use for your console. Leave this value set to
|
||||
zero to use the environment code page.
|
||||
|
||||
Note: Displaying unicode characters on Conque for Windows needs work.
|
||||
>
|
||||
let g:ConqueTerm_CodePage = 0
|
||||
<
|
||||
3.4.3 Terminal color method, Windows ONLY *ConqueTerm_ColorMode*
|
||||
|
||||
Vim syntax highlighting by coordinate (e.g. the 3-7th characters on the 42nd
|
||||
line) can be very slow. If you set this variable to 'conceal', you can use
|
||||
the new conceal feature to render terminal colors. Requires Vim 7.3 and only
|
||||
works on the Windows version of Conque. This will make colors render faster,
|
||||
however it will also add hidden characters to the screen, which may be
|
||||
annoying if you're copying and pasting terminal output out of the Conque
|
||||
buffer. Set this to an empty string '' to disable concealed highlighting.
|
||||
>
|
||||
let g:ConqueTerm_ColorMode = 'conceal'
|
||||
<
|
||||
==============================================================================
|
||||
|
||||
4. VimScript API (Beta) *conque-term-api*
|
||||
|
||||
The Conque scripting API allows you to create and interact with Conque
|
||||
terminals with the VimScript language. This API is still in beta stage.
|
||||
|
||||
4.1 conque_term#open({command}, [buf_opts], [remain]) *conque-term-open*
|
||||
|
||||
The open() function will create a new terminal buffer and start your command.
|
||||
|
||||
The {command} must be an executable, either an absolute path or relative to
|
||||
your system path.
|
||||
|
||||
You can pass in a list of vim commands [buf_opts] which will be executed after
|
||||
the new buffer is created but before the command is started. These are
|
||||
typically commands to alter the size, position or configuration of the buffer
|
||||
window.
|
||||
|
||||
Note: If you don't pass in a command such as 'split', the terminal will open
|
||||
in the current buffer.
|
||||
|
||||
If you don't want the new terminal buffer to become the new active buffer, set
|
||||
[remain] to 1. Only works if you create a split screen using [options].
|
||||
|
||||
Returns a Conque terminal object.
|
||||
|
||||
Examples:
|
||||
>
|
||||
let my_terminal = conque_term#open('/bin/bash')
|
||||
let my_terminal = conque_term#open('ipython', ['split', 'resize 20'], 1)
|
||||
<
|
||||
4.2 conque_term#subprocess({command}) *conque-term-subprocess*
|
||||
|
||||
Starts a new subprocess with your {command}, but no terminal buffer is ever
|
||||
created. This may be useful if you need asynchronous interaction with a
|
||||
subprocess, but want to handle the output on your own.
|
||||
|
||||
Returns a Conque terminal object.
|
||||
|
||||
Example:
|
||||
>
|
||||
let my_subprocess = conque_term#subprocess('tail -f /var/log/foo.log')
|
||||
<
|
||||
4.3 conque_term#get_instance( [terminal_number] ) *conque-term-get-instance*
|
||||
|
||||
Use the get_instance() function to retrieve an existing terminal object. The
|
||||
terminal could have been created either with the user command :ConqueTerm or
|
||||
with an API call to conque_term#open() or subprocess().
|
||||
|
||||
Use the optional [terminal_number] to retrieve a specific terminal instance.
|
||||
Otherwise if the current buffer is a Conque terminal, it will be returned,
|
||||
else the most recently created terminal. The terminal number is what you see
|
||||
at the end of a terminal buffer name, e.g. "bash - 2".
|
||||
|
||||
Returns a Conque terminal object.
|
||||
|
||||
Example:
|
||||
>
|
||||
nnoremap <F4> :call conque_term#get_instance().writeln('clear')<CR>
|
||||
<
|
||||
4.4 CONQUE_OBJECT.write({text}) *conque-term-write*
|
||||
|
||||
Once you have a terminal object from open(), subprocess() or get_instance()
|
||||
you can send text input to it with the write() method.
|
||||
|
||||
No return value.
|
||||
|
||||
Examples:
|
||||
>
|
||||
call my_terminal.write("whoami\n")
|
||||
call my_terminal.write("\<C-c>")
|
||||
<
|
||||
4.5 CONQUE_OBJECT.writeln({text}) *conque-term-writeln*
|
||||
|
||||
The same as write() except adds a \n character to the end if your input.
|
||||
|
||||
Examples:
|
||||
>
|
||||
call my_subprocess.writeln('make')
|
||||
<
|
||||
4.6 CONQUE_OBJECT.read( [timeout], [update_buffer] ) *conque-term-read*
|
||||
|
||||
Read new output from a Conque terminal subprocess. New output will be returned
|
||||
as a string, and the terminal buffer will also be updated by default.
|
||||
|
||||
If you are reading immediately after calling the write() method, you may want
|
||||
to wait [timeout] milliseconds for output to be ready.
|
||||
|
||||
If you want to prevent the output from being displayed in the terminal buffer,
|
||||
set [update_buffer] to 0. This option has no effect if the terminal was
|
||||
created with the subprocess() function, since there never is a buffer to
|
||||
update.
|
||||
|
||||
Returns output string.
|
||||
|
||||
Note: The terminal buffer will not automatically scroll down if the new output
|
||||
extends beyond the bottom of the visible buffer. Vim doesn't allow "unfocused"
|
||||
buffers to be scrolled at the current version, although hopefully this will
|
||||
change.
|
||||
|
||||
Examples:
|
||||
>
|
||||
call my_terminal.writeln('whoami')
|
||||
let output = my_terminal.read(500)
|
||||
call my_terminal.writeln('ls -lha')
|
||||
let output = my_terminal.read(1000, 1)
|
||||
<
|
||||
4.7 CONQUE_OBJECT.set_callback( {funcname} ) *conque-term-set-callback*
|
||||
|
||||
Register a callback function for this subprocess instance. This function will
|
||||
automatically be called whenever new output is available. Only practical with
|
||||
subprocess() objects.
|
||||
|
||||
Conque checkes for new subprocess output once a second when Vim is idle. If
|
||||
new output is found your function will be called.
|
||||
|
||||
Pass in the callback function name {funcname} as a string.
|
||||
|
||||
No return value.
|
||||
|
||||
Note: this method requires the g:ConqueTerm_ReadUnfocused option to be set.
|
||||
|
||||
Note: this method is experimental, results may vary.
|
||||
|
||||
Example:
|
||||
>
|
||||
let sp = conque_term#subprocess('tail -f /home/joe/log/error_log')
|
||||
|
||||
function! MyErrorAlert(output)
|
||||
echo a:output
|
||||
endfunction
|
||||
|
||||
call sp.set_callback('MyErrorAlert')
|
||||
<
|
||||
4.8 CONQUE_OBJECT.close() *conque-term-close*
|
||||
|
||||
Kill your terminal subprocess. Sends the ABORT signal. You probably want to
|
||||
close your subprocess in a more graceful manner with the write() method, but
|
||||
this can be used when needed. Does not close the terminal buffer, if it
|
||||
exists.
|
||||
|
||||
This method will be called on all existing Conque subprocesses when Vim exits.
|
||||
|
||||
Example:
|
||||
>
|
||||
let term = conque_term#open('ping google.com', ['belowright split'])
|
||||
call term.read(5000)
|
||||
call term.close()
|
||||
<
|
||||
4.9 Registering functions *conque-term-events*
|
||||
|
||||
Conque provides the option to register callback functions which will be
|
||||
executed at several different events. The currently available events are:
|
||||
|
||||
after_startup After your application has loaded into the buffer.
|
||||
buffer_enter When you switch to a Conque buffer.
|
||||
buffer_leave When you leave a Conque buffer.
|
||||
|
||||
You may use the function conque_term#register_function(event, function_name)
|
||||
to add additional hooks at a particular event. The second argument should be
|
||||
the name of a callback function which has one parameter, the current
|
||||
terminal object (see|conque-term-api|for more about terminal objects).
|
||||
|
||||
For example:
|
||||
>
|
||||
function MyConqueStartup(term)
|
||||
|
||||
" set buffer syntax using the name of the program currently running
|
||||
let syntax_associations = { 'ipython': 'python', 'irb': 'ruby' }
|
||||
|
||||
if has_key(syntax_associations, a:term.program_name)
|
||||
execute 'setlocal syntax=' . syntax_associations[a:term.program_name]
|
||||
else
|
||||
execute 'setlocal syntax=' . a:term.program_name
|
||||
endif
|
||||
|
||||
" shrink window height to 10 rows
|
||||
resize 10
|
||||
|
||||
" silly example of terminal api usage
|
||||
if a:term.program_name == 'bash'
|
||||
call a:term.writeln('svn up ~/projects/*')
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
call conque_term#register_function('after_startup', 'MyConqueStartup')
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
|
||||
5. Misc *conque-term-misc*
|
||||
|
||||
|
||||
5.1 Known bugs *conque-term-bugs*
|
||||
|
||||
The following are known limitations:
|
||||
|
||||
- Font/color highlighting is imperfect and slow. If you don't care about
|
||||
color in your shell, set g:ConqueTerm_Color = 0 in your .vimrc
|
||||
- Conque only supports the extended ASCII character set for input, not utf-8.
|
||||
- VT100 escape sequence support is not complete.
|
||||
- Alt/Meta key support in Vim isn't great in general, and conque is no
|
||||
exception. Pressing <Esc><Esc>x or <Esc><M-x> instead of <M-x> works in
|
||||
most cases.
|
||||
|
||||
|
||||
5.2 Contribute *conque-term-contribute*
|
||||
|
||||
The two contributions most in need are improvements to Vim itself. I currently
|
||||
use hacks to capture key press input from the user, and to poll the terminal
|
||||
for more output. The Vim todo.txt document lists proposed improvements to give
|
||||
users this behavior without hacks. Having a key press event should allow
|
||||
Conque to work with multi- byte input. If you are a Vim developer, please
|
||||
consider prioritizing these two items:
|
||||
|
||||
- todo.txt (Autocommands, line ~3137)
|
||||
8 Add an event like CursorHold that is triggered repeatedly, not just
|
||||
once after typing something.
|
||||
|
||||
|
||||
5.3 Feedback *conque-term-feedback*
|
||||
|
||||
Bugs, suggestions and patches are all welcome.
|
||||
|
||||
For more information visit http://conque.googlecode.com
|
||||
|
||||
Check out the latest from svn at http://conque.googlecode.com/svn/trunk/
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
|
@ -1,71 +0,0 @@
|
|||
*open-terminal* Open Terminal, Filemanager for various platform
|
||||
|
||||
Open Terminal Help File
|
||||
|
||||
Introduction |open-terminal-introduction|
|
||||
Commmands |open-terminal-commands|
|
||||
Requires |open-terminal-requires|
|
||||
Key map examples |open-terminal-keymap|
|
||||
Changelog |open-terminal-changelog|
|
||||
About |open-terminal-about|
|
||||
|
||||
==============================================================================
|
||||
Introduction *open-terminal-introduction*
|
||||
|
||||
Some vim user want to shell like emacs's eshell. But vim don't support shell,
|
||||
terminal interface in vim (at least 7.x version).
|
||||
|
||||
In this situation, I use native terminal software open script for my various
|
||||
working platforms.
|
||||
|
||||
==============================================================================
|
||||
Commmands *open-terminal-commands*
|
||||
|
||||
*OpenTerminal*
|
||||
:OpenTerminal Open native terminal sw. Check |requires| list
|
||||
|
||||
*OpenFilemanager*
|
||||
:OpenFilemanager Open native file manager. Check |requires| list
|
||||
|
||||
|
||||
==============================================================================
|
||||
Map key examples *open-terminal-keymap*
|
||||
>
|
||||
nnoremap <silent> <F9> :OpenTerminal<CR>
|
||||
nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
Requires (per platform) *open-terminal-requires*
|
||||
|
||||
I use Mac, Gnome, Windows(gvim). I don't test in KDE environment.
|
||||
|
||||
Platform Terminal File manager ~
|
||||
>
|
||||
Mac Terminal.app Finder
|
||||
(with Applescript)
|
||||
Gnome gnome-terminal nautilus
|
||||
KDE konsole konqueror
|
||||
Windows cmd explorer
|
||||
(with start)
|
||||
cygwin bash explorer
|
||||
<
|
||||
==============================================================================
|
||||
Changelog *open-terminal-changelog*
|
||||
|
||||
0.1:
|
||||
- First release used script for everyone.
|
||||
|
||||
|
||||
==============================================================================
|
||||
About *open-terminal-about*
|
||||
|
||||
Copyright (c) 2009 by neocoin ~
|
||||
File: open_terminal.vim
|
||||
Author: Sangmin Ryu (neocoin@gmail.com)
|
||||
Date: Tue Dec 22 13:33:32 PST 2009
|
||||
License: The MIT License
|
||||
|
||||
==============================================================================
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
|
@ -1,461 +0,0 @@
|
|||
*pi_getscript.txt* For Vim version 7.0. Last change: 2011 May 31
|
||||
>
|
||||
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||
<
|
||||
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
|
||||
(remove NOSPAM from the email address)
|
||||
*GetLatestVimScripts-copyright*
|
||||
Copyright: (c) 2004-2010 by Charles E. Campbell, Jr. *glvs-copyright*
|
||||
The VIM LICENSE applies to getscript.vim and
|
||||
pi_getscript.txt (see |copyright|) except use
|
||||
"getscript" instead of "Vim". No warranty, express or implied.
|
||||
Use At-Your-Own-Risk.
|
||||
|
||||
Getscript is a plugin that simplifies retrieval of the latest versions of the
|
||||
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
|
||||
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
|
||||
get the latest versions of scripts listed therein from http://vim.sf.net/.
|
||||
|
||||
==============================================================================
|
||||
1. Contents *glvs-contents* *glvs* *getscript*
|
||||
*GetLatestVimScripts*
|
||||
|
||||
1. Contents........................................: |glvs-contents|
|
||||
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
|
||||
3. GetLatestVimScripts Usage.......................: |glvs-usage|
|
||||
4. GetLatestVimScripts Data File...................: |glvs-data|
|
||||
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
|
||||
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
|
||||
7. GetLatestViMScripts Options.....................: |glvs-options|
|
||||
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
|
||||
9. GetLatestVimScripts History.....................: |glvs-hist|
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. GetLatestVimScripts -- Getting Started *getscript-start*
|
||||
*getlatestvimscripts-install*
|
||||
|
||||
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
|
||||
|
||||
Vim 7.0 does not include the GetLatestVimScripts.dist file which
|
||||
serves as an example and a template. So, you'll need to create
|
||||
your own! See |GetLatestVimScripts_dat|.
|
||||
|
||||
VERSION FROM VIM SF NET *glvs-install*
|
||||
|
||||
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
|
||||
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
|
||||
the first time.
|
||||
|
||||
The GetLatestVimScripts.dist file serves as an example and a template for your
|
||||
own personal list. Feel free to remove all the scripts mentioned within it;
|
||||
the "important" part of it is the first two lines.
|
||||
|
||||
Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
|
||||
|
||||
1. if compressed: gunzip getscript.vba.gz
|
||||
2. Unix:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd ~/.vim/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
3. Windows:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd **path-to-vimfiles**/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
|
||||
|
||||
Unless it has been defined elsewhere, >
|
||||
|
||||
:GLVS
|
||||
|
||||
will invoke GetLatestVimScripts(). If some other plugin has defined that
|
||||
command, then you may type
|
||||
>
|
||||
:GetLatestVimScripts
|
||||
<
|
||||
The script will attempt to update and, if permitted, will automatically
|
||||
install scripts from http://vim.sourceforge.net/. To do so it will peruse a
|
||||
file,
|
||||
>
|
||||
.vim/GetLatest/GetLatestVimScripts.dat (unix)
|
||||
<
|
||||
or >
|
||||
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
|
||||
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
|
||||
directory (see |glvs-plugins|).
|
||||
|
||||
Scripts which have been downloaded will appear in the
|
||||
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
|
||||
subdirectory. GetLatestVimScripts will attempt to automatically
|
||||
install them if you have the following line in your <.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall=1
|
||||
|
||||
The <GetLatestVimScripts.dat> file will be automatically be updated to
|
||||
reflect the latest version of script(s) so downloaded.
|
||||
(also see |glvs-options|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
|
||||
*:GetLatestVimScripts_dat*
|
||||
The data file <GetLatestVimScripts.dat> must have for its first two lines
|
||||
the following text:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
<
|
||||
Following those two lines are three columns; the first two are numeric
|
||||
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
|
||||
contains an example of such a data file. Anything following a #... is
|
||||
ignored, so you may embed comments in the file.
|
||||
|
||||
The first number on each line gives the script's ScriptID. When you're about
|
||||
to use a web browser to look at scripts on http://vim.sf.net/, just before you
|
||||
click on the script's link, you'll see a line resembling
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
|
||||
download the associated page, and is assigned by vim.sf.net itself
|
||||
during initial uploading of the plugin.
|
||||
|
||||
The second number on each line gives the script's SourceID. The SourceID
|
||||
records the count of uploaded scripts as determined by vim.sf.net; hence it
|
||||
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
|
||||
insures that GetLatestVimScripts will assume that the script it has is
|
||||
out-of-date.
|
||||
|
||||
The SourceID is extracted by GetLatestVimScripts from the script's page on
|
||||
vim.sf.net; whenever it is greater than the one stored in the
|
||||
GetLatestVimScripts.dat file, the script will be downloaded
|
||||
(see |GetLatestVimScripts_dat|).
|
||||
|
||||
If your script's author has included a special comment line in his/her plugin,
|
||||
the plugin itself will be used by GetLatestVimScripts to build your
|
||||
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
|
||||
may have. As an example, consider: >
|
||||
|
||||
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
|
||||
|
||||
This comment line tells getscript.vim to check vimscript #884 and that the
|
||||
script is automatically installable. Getscript will also use this line to
|
||||
help build the GetLatestVimScripts.dat file, by including a line such as: >
|
||||
|
||||
884 1 :AutoInstall: AutoAlign.vim
|
||||
<
|
||||
assuming that such a line isn't already in GetLatestVimScripts.dat file.
|
||||
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
|
||||
comprehensive ability to keep your plugins up-to-date!
|
||||
|
||||
In summary:
|
||||
|
||||
* Optionally tell getscript that it is allowed to build/append a
|
||||
GetLatestVimScripts.dat file based upon already installed plugins: >
|
||||
let g:GetLatestVimScripts_allowautoinstall=1
|
||||
<
|
||||
* A line such as >
|
||||
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
|
||||
< in an already-downloaded plugin constitutes the concurrence of the
|
||||
plugin author that getscript may do AutoInstall. Not all plugins
|
||||
may be AutoInstall-able, and the plugin's author is best situated
|
||||
to know whether or not his/her plugin will AutoInstall properly.
|
||||
|
||||
* A line such as >
|
||||
884 1 :AutoInstall: AutoAlign.vim
|
||||
< in your GetLatestVimScripts.dat file constitutes your permission
|
||||
to getscript to do AutoInstall. AutoInstall requires both your
|
||||
and the plugin author's permission. See |GetLatestVimScripts_dat|.
|
||||
|
||||
|
||||
*GetLatestVimScripts_dat*
|
||||
As an example of a <GetLatestVimScripts.dat> file:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 :AutoInstall: Align.vim
|
||||
120 2 Decho.vim
|
||||
40 3 DrawIt.tar.gz
|
||||
451 4 EasyAccents.vim
|
||||
195 5 engspchk.vim
|
||||
642 6 GetLatestVimScripts.vim
|
||||
489 7 Manpageview.vim
|
||||
<
|
||||
Note: the first two lines are required, but essentially act as comments.
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
|
||||
|
||||
(this section is for plugin authors)~
|
||||
|
||||
If a plugin author includes the following comment anywhere in their plugin,
|
||||
GetLatestVimScripts will find it and use it to automatically build the user's
|
||||
GetLatestVimScripts.dat files:
|
||||
>
|
||||
src_id
|
||||
v
|
||||
" GetLatestVimScripts: ### ### yourscriptname
|
||||
^
|
||||
scriptid
|
||||
<
|
||||
As an author, you should include such a line in to refer to your own script
|
||||
plus any additional lines describing any plugin dependencies it may have.
|
||||
Same format, of course!
|
||||
|
||||
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
|
||||
are, then you may include :AutoInstall: just before "yourscriptname":
|
||||
>
|
||||
src_id
|
||||
v
|
||||
" GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
|
||||
^
|
||||
scriptid
|
||||
<
|
||||
NOTE: The :AutoInstall: feature requires both the plugin author's and~
|
||||
the user's permission to operate!~
|
||||
|
||||
GetLatestVimScripts commands for those scripts are then appended, if not
|
||||
already present, to the user's GetLatest/GetLatestVimScripts.dat file. It is
|
||||
a relatively painless way to automate the acquisition of any scripts your
|
||||
plugins depend upon.
|
||||
|
||||
Now, as an author, you probably don't want GetLatestVimScripts to download
|
||||
your own scripts atop your own copy, thereby overwriting your not-yet-released
|
||||
hard work. GetLatestVimScripts provides a solution for this: put
|
||||
>
|
||||
0 0 yourscriptname
|
||||
<
|
||||
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
|
||||
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
|
||||
lines. As a result, those lines won't be inadvertently installed into your
|
||||
<GetLatestVimScripts.dat> file and subsequently used to download your own
|
||||
scripts. This is especially important to do if you've included the
|
||||
:AutoInstall: option.
|
||||
|
||||
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
|
||||
as you've used in your GetLatestVimScripts comment!
|
||||
|
||||
|
||||
==============================================================================
|
||||
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
|
||||
*glvs-autoinstall*
|
||||
|
||||
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
|
||||
supportive of auto-install, as they may have special things you need to do to
|
||||
install them (please refer to the script's "install" directions). On the
|
||||
other hand, most scripts will be auto-installable.
|
||||
|
||||
To let GetLatestVimScripts do an autoinstall, the data file's comment field
|
||||
should begin with (surrounding blanks are ignored): >
|
||||
|
||||
:AutoInstall:
|
||||
<
|
||||
Both colons are needed, and it should begin the comment (yourscriptname)
|
||||
field.
|
||||
|
||||
One may prevent any autoinstalling by putting the following line in your
|
||||
<.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall= 0
|
||||
<
|
||||
With :AutoInstall: enabled, as it is by default, files which end with
|
||||
|
||||
---.tar.bz2 : decompressed & untarred in .vim/ directory
|
||||
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.bz2 : decompressed & moved into .vim/plugin directory
|
||||
---.tar.gz : decompressed & untarred in .vim/ directory
|
||||
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.gz : decompressed & moved into .vim/plugin directory
|
||||
---.vba : unzipped in .vim/ directory
|
||||
---.vim : moved to .vim/plugin directory
|
||||
---.zip : unzipped in .vim/ directory
|
||||
|
||||
and which merely need to have their components placed by the untar/gunzip or
|
||||
move-to-plugin-directory process should be auto-installable. Vimballs, of
|
||||
course, should always be auto-installable.
|
||||
|
||||
When is a script not auto-installable? Let me give an example:
|
||||
|
||||
.vim/after/syntax/blockhl.vim
|
||||
|
||||
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
|
||||
available at:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=104
|
||||
|
||||
Currently, vim's after/syntax only supports by-filetype scripts (in
|
||||
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
|
||||
possibly overwrite the current user's after/syntax/c.vim file.
|
||||
|
||||
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
|
||||
allow a after/syntax/c/ directory:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=1023
|
||||
|
||||
The script allows multiple syntax files to exist separately in the
|
||||
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
|
||||
appropriate tarball for auto-install because of the potential for the
|
||||
after/syntax/c.vim contained in it to overwrite a user's c.vim.
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. GetLatestVimScripts Options *glvs-options*
|
||||
>
|
||||
g:GetLatestVimScripts_wget
|
||||
< default= "wget"
|
||||
This variable holds the name of the command for obtaining
|
||||
scripts.
|
||||
>
|
||||
g:GetLatestVimScripts_options
|
||||
< default= "-q -O"
|
||||
This variable holds the options to be used with the
|
||||
g:GetLatestVimScripts_wget command.
|
||||
>
|
||||
g:GetLatestVimScripts_allowautoinstall
|
||||
< default= 1
|
||||
This variable indicates whether GetLatestVimScripts is allowed
|
||||
to attempt to automatically install scripts. Furthermore, the
|
||||
plugin author has to have explicitly indicated that his/her
|
||||
plugin is automatically installable (via the :AutoInstall:
|
||||
keyword in the GetLatestVimScripts comment line).
|
||||
>
|
||||
g:GetLatestVimScripts_autoinstalldir
|
||||
< default= $HOME/.vim (linux)
|
||||
default= $HOME/vimfiles (windows)
|
||||
Override where :AutoInstall: scripts will be installed.
|
||||
Doesn't override vimball installation.
|
||||
|
||||
==============================================================================
|
||||
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
|
||||
|
||||
The Vim sourceforge page dynamically creates a page by keying off of the
|
||||
so-called script-id. Within the webpage of
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
is a line specifying the latest source-id (src_id). The source identifier
|
||||
numbers are always increasing, hence if the src_id is greater than the one
|
||||
recorded for the script in GetLatestVimScripts then it's time to download a
|
||||
newer copy of that script.
|
||||
|
||||
GetLatestVimScripts will then download the script and update its internal
|
||||
database of script ids, source ids, and scriptnames.
|
||||
|
||||
The AutoInstall process will:
|
||||
|
||||
Move the file from GetLatest/ to the following directory
|
||||
Unix : $HOME/.vim
|
||||
Windows: $HOME\vimfiles
|
||||
if the downloaded file ends with ".bz2"
|
||||
bunzip2 it
|
||||
else if the downloaded file ends with ".gz"
|
||||
gunzip it
|
||||
if the resulting file ends with ".zip"
|
||||
unzip it
|
||||
else if the resulting file ends with ".tar"
|
||||
tar -oxvf it
|
||||
else if the resulting file ends with ".vim"
|
||||
move it to the plugin subdirectory
|
||||
|
||||
|
||||
==============================================================================
|
||||
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
||||
|
||||
v33 May 31, 2011 : * using fnameescape() instead of escape()
|
||||
* *.xz support
|
||||
v32 Jun 19, 2010 : * (Jan Steffens) added support for xz compression
|
||||
v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
|
||||
* (David Schaefer) the acd option interferes with vimballs
|
||||
Solution: bypass the acd option
|
||||
v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
|
||||
issue an error message if it is not supported
|
||||
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
|
||||
getscriptPlugin.vim was setting it but not restoring it.
|
||||
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
|
||||
interface, register-a bypass
|
||||
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
|
||||
creating pop-up windows
|
||||
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
|
||||
loading
|
||||
v23 Nov 03, 2006 : * ignores comments (#...)
|
||||
* handles vimballs
|
||||
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
||||
available
|
||||
v21 May 01, 2006 : * now takes advantage of autoloading.
|
||||
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
|
||||
unzip needs the -o flag to overwrite.
|
||||
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
|
||||
script! Fixed.
|
||||
v18 Mar 21, 2005 : * bugfix to automatic database construction
|
||||
* bugfix - nowrapscan caused an error
|
||||
(tnx to David Green for the fix)
|
||||
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
|
||||
:AutoInstall:s, even though its o/s is windows
|
||||
Apr 01, 2005 * when downloading errors occurred, GLVS was
|
||||
terminating early. It now just goes on to trying
|
||||
the next script (after trying three times to
|
||||
download a script description page)
|
||||
Apr 20, 2005 * bugfix - when a failure to download occurred,
|
||||
GetLatestVimScripts would stop early and claim that
|
||||
everything was current. Fixed.
|
||||
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
|
||||
defaults to 1, can be used to prevent all
|
||||
:AutoInstall:
|
||||
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
|
||||
* fixed bug with :AutoInstall: use of helptags
|
||||
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
|
||||
always preventing downloads (just usually). Fixed.
|
||||
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
|
||||
s:dotvim. Fixed.
|
||||
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
|
||||
is zero. Useful for script authors; that way their
|
||||
own GetLatestVimScripts activity won't overwrite
|
||||
their scripts.
|
||||
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
|
||||
was intended only for testing. Removed, now works.
|
||||
* :AutoInstall: implemented
|
||||
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
|
||||
* :GetLatestVimScripts command
|
||||
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
|
||||
now holds scripts that need updating
|
||||
v10 Apr 19, 2004 : * moved history from script to doc
|
||||
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
|
||||
double quotes ("") whereas other systems will use
|
||||
single quotes ('') around the urls in calls via wget
|
||||
v8 Dec 01, 2003 : makes three tries at downloading
|
||||
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
|
||||
not found in downloaded webpage
|
||||
Uses t_ti, t_te, and rs to make progress visible
|
||||
v6 Aug 06, 2003 : final status messages now display summary of work
|
||||
( "Downloaded someqty scripts" or
|
||||
"Everything was current")
|
||||
Now GetLatestVimScripts is careful about downloading
|
||||
GetLatestVimScripts.vim itself!
|
||||
(goes to <NEW_GetLatestVimScripts.vim>)
|
||||
v5 Aug 04, 2003 : missing an endif near bottom
|
||||
v4 Jun 17, 2003 : redraw! just before each "considering" message
|
||||
v3 May 27, 2003 : Protects downloaded files from errant shell
|
||||
expansions with single quotes: '...'
|
||||
v2 May 14, 2003 : extracts name of item to be obtained from the
|
||||
script file. Uses it instead of comment field
|
||||
for output filename; comment is used in the
|
||||
"considering..." line and is now just a comment!
|
||||
* Fixed a bug: a string-of-numbers is not the
|
||||
same as a number, so I added zero to them
|
||||
and they became numbers. Fixes comparison.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:fdm=marker
|
1501
vim/doc/taglist.txt
1501
vim/doc/taglist.txt
File diff suppressed because it is too large
Load Diff
602
vim/doc/tags
602
vim/doc/tags
|
@ -1,602 +0,0 @@
|
|||
'NERDAllowAnyVisualDelims' NERD_commenter.txt /*'NERDAllowAnyVisualDelims'*
|
||||
'NERDBlockComIgnoreEmpty' NERD_commenter.txt /*'NERDBlockComIgnoreEmpty'*
|
||||
'NERDChristmasTree' NERD_tree.txt /*'NERDChristmasTree'*
|
||||
'NERDCommentWholeLinesInVMode' NERD_commenter.txt /*'NERDCommentWholeLinesInVMode'*
|
||||
'NERDCompactSexyComs' NERD_commenter.txt /*'NERDCompactSexyComs'*
|
||||
'NERDCreateDefaultMappings' NERD_commenter.txt /*'NERDCreateDefaultMappings'*
|
||||
'NERDDefaultNesting' NERD_commenter.txt /*'NERDDefaultNesting'*
|
||||
'NERDLPlace' NERD_commenter.txt /*'NERDLPlace'*
|
||||
'NERDMenuMode' NERD_commenter.txt /*'NERDMenuMode'*
|
||||
'NERDRPlace' NERD_commenter.txt /*'NERDRPlace'*
|
||||
'NERDRemoveAltComs' NERD_commenter.txt /*'NERDRemoveAltComs'*
|
||||
'NERDRemoveExtraSpaces' NERD_commenter.txt /*'NERDRemoveExtraSpaces'*
|
||||
'NERDSpaceDelims' NERD_commenter.txt /*'NERDSpaceDelims'*
|
||||
'NERDTreeAutoCenter' NERD_tree.txt /*'NERDTreeAutoCenter'*
|
||||
'NERDTreeAutoCenterThreshold' NERD_tree.txt /*'NERDTreeAutoCenterThreshold'*
|
||||
'NERDTreeBookmarksFile' NERD_tree.txt /*'NERDTreeBookmarksFile'*
|
||||
'NERDTreeCaseSensitiveSort' NERD_tree.txt /*'NERDTreeCaseSensitiveSort'*
|
||||
'NERDTreeChDirMode' NERD_tree.txt /*'NERDTreeChDirMode'*
|
||||
'NERDTreeDirArrows' NERD_tree.txt /*'NERDTreeDirArrows'*
|
||||
'NERDTreeHighlightCursorline' NERD_tree.txt /*'NERDTreeHighlightCursorline'*
|
||||
'NERDTreeHijackNetrw' NERD_tree.txt /*'NERDTreeHijackNetrw'*
|
||||
'NERDTreeIgnore' NERD_tree.txt /*'NERDTreeIgnore'*
|
||||
'NERDTreeMinimalUI' NERD_tree.txt /*'NERDTreeMinimalUI'*
|
||||
'NERDTreeMouseMode' NERD_tree.txt /*'NERDTreeMouseMode'*
|
||||
'NERDTreeQuitOnOpen' NERD_tree.txt /*'NERDTreeQuitOnOpen'*
|
||||
'NERDTreeShowBookmarks' NERD_tree.txt /*'NERDTreeShowBookmarks'*
|
||||
'NERDTreeShowFiles' NERD_tree.txt /*'NERDTreeShowFiles'*
|
||||
'NERDTreeShowHidden' NERD_tree.txt /*'NERDTreeShowHidden'*
|
||||
'NERDTreeShowLineNumbers' NERD_tree.txt /*'NERDTreeShowLineNumbers'*
|
||||
'NERDTreeSortOrder' NERD_tree.txt /*'NERDTreeSortOrder'*
|
||||
'NERDTreeStatusline' NERD_tree.txt /*'NERDTreeStatusline'*
|
||||
'NERDTreeWinPos' NERD_tree.txt /*'NERDTreeWinPos'*
|
||||
'NERDTreeWinSize' NERD_tree.txt /*'NERDTreeWinSize'*
|
||||
'NERDUsePlaceHolders' NERD_commenter.txt /*'NERDUsePlaceHolders'*
|
||||
'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'*
|
||||
'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'*
|
||||
'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'*
|
||||
'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'*
|
||||
'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'*
|
||||
'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'*
|
||||
'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'*
|
||||
'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'*
|
||||
'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'*
|
||||
'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'*
|
||||
'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'*
|
||||
'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'*
|
||||
'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
|
||||
'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'*
|
||||
'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'*
|
||||
'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'*
|
||||
'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'*
|
||||
'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'*
|
||||
'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'*
|
||||
'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'*
|
||||
'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'*
|
||||
'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'*
|
||||
'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'*
|
||||
'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'*
|
||||
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
|
||||
'loaded_nerd_comments' NERD_commenter.txt /*'loaded_nerd_comments'*
|
||||
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
|
||||
:Align Align.txt /*:Align*
|
||||
:AlignCenter textformat.txt /*:AlignCenter*
|
||||
:AlignCtrl Align.txt /*:AlignCtrl*
|
||||
:AlignJustify textformat.txt /*:AlignJustify*
|
||||
:AlignLeft textformat.txt /*:AlignLeft*
|
||||
:AlignMapsClean Align.txt /*:AlignMapsClean*
|
||||
:AlignRight textformat.txt /*:AlignRight*
|
||||
:CVSEdit vcscommand.txt /*:CVSEdit*
|
||||
:CVSEditors vcscommand.txt /*:CVSEditors*
|
||||
:CVSUnedit vcscommand.txt /*:CVSUnedit*
|
||||
:CVSWatch vcscommand.txt /*:CVSWatch*
|
||||
:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd*
|
||||
:CVSWatchOff vcscommand.txt /*:CVSWatchOff*
|
||||
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
|
||||
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
|
||||
:CVSWatchers vcscommand.txt /*:CVSWatchers*
|
||||
:GLVS pi_getscript.txt /*:GLVS*
|
||||
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
|
||||
:NERDTree NERD_tree.txt /*:NERDTree*
|
||||
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
|
||||
:NERDTreeFind NERD_tree.txt /*:NERDTreeFind*
|
||||
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
|
||||
:NERDTreeMirror NERD_tree.txt /*:NERDTreeMirror*
|
||||
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
|
||||
:TChangesetOpen trac.txt /*:TChangesetOpen*
|
||||
:TTAddComment trac.txt /*:TTAddComment*
|
||||
:TTClearAllFilters trac.txt /*:TTClearAllFilters*
|
||||
:TTClearFilter trac.txt /*:TTClearFilter*
|
||||
:TTFilterComponent trac.txt /*:TTFilterComponent*
|
||||
:TTFilterMilestone trac.txt /*:TTFilterMilestone*
|
||||
:TTFilterNoMilestone trac.txt /*:TTFilterNoMilestone*
|
||||
:TTFilterNoOwner trac.txt /*:TTFilterNoOwner*
|
||||
:TTFilterOwner trac.txt /*:TTFilterOwner*
|
||||
:TTFilterPriority trac.txt /*:TTFilterPriority*
|
||||
:TTFilterResolution trac.txt /*:TTFilterResolution*
|
||||
:TTFilterSeverity trac.txt /*:TTFilterSeverity*
|
||||
:TTFilterStatus trac.txt /*:TTFilterStatus*
|
||||
:TTFilterType trac.txt /*:TTFilterType*
|
||||
:TTIgnoreComponent trac.txt /*:TTIgnoreComponent*
|
||||
:TTIgnoreMilestone trac.txt /*:TTIgnoreMilestone*
|
||||
:TTIgnoreNoMilestone trac.txt /*:TTIgnoreNoMilestone*
|
||||
:TTIgnoreNoOwner trac.txt /*:TTIgnoreNoOwner*
|
||||
:TTIgnoreOwner trac.txt /*:TTIgnoreOwner*
|
||||
:TTIgnorePriority trac.txt /*:TTIgnorePriority*
|
||||
:TTIgnoreResolution trac.txt /*:TTIgnoreResolution*
|
||||
:TTIgnoreSeverity trac.txt /*:TTIgnoreSeverity*
|
||||
:TTIgnoreStatus trac.txt /*:TTIgnoreStatus*
|
||||
:TTIgnoreType trac.txt /*:TTIgnoreType*
|
||||
:TTLServer trac.txt /*:TTLServer*
|
||||
:TTListFilters trac.txt /*:TTListFilters*
|
||||
:TTOpen trac.txt /*:TTOpen*
|
||||
:TTPreview trac.txt /*:TTPreview*
|
||||
:TTServer trac.txt /*:TTServer*
|
||||
:TTSet trac.txt /*:TTSet*
|
||||
:TTSortby trac.txt /*:TTSortby*
|
||||
:TTUpdateDescrption trac.txt /*:TTUpdateDescrption*
|
||||
:TTimelineOpen trac.txt /*:TTimelineOpen*
|
||||
:TWAddAttachment trac.txt /*:TWAddAttachment*
|
||||
:TWGetAttachment trac.txt /*:TWGetAttachment*
|
||||
:TWOpen trac.txt /*:TWOpen*
|
||||
:TWPreview trac.txt /*:TWPreview*
|
||||
:TWSave trac.txt /*:TWSave*
|
||||
:TWServer trac.txt /*:TWServer*
|
||||
:TWVimDiff trac.txt /*:TWVimDiff*
|
||||
:TlistAddFiles taglist.txt /*:TlistAddFiles*
|
||||
:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive*
|
||||
:TlistClose taglist.txt /*:TlistClose*
|
||||
:TlistDebug taglist.txt /*:TlistDebug*
|
||||
:TlistHighlightTag taglist.txt /*:TlistHighlightTag*
|
||||
:TlistLock taglist.txt /*:TlistLock*
|
||||
:TlistMessages taglist.txt /*:TlistMessages*
|
||||
:TlistOpen taglist.txt /*:TlistOpen*
|
||||
:TlistSessionLoad taglist.txt /*:TlistSessionLoad*
|
||||
:TlistSessionSave taglist.txt /*:TlistSessionSave*
|
||||
:TlistShowPrototype taglist.txt /*:TlistShowPrototype*
|
||||
:TlistShowTag taglist.txt /*:TlistShowTag*
|
||||
:TlistToggle taglist.txt /*:TlistToggle*
|
||||
:TlistUndebug taglist.txt /*:TlistUndebug*
|
||||
:TlistUnlock taglist.txt /*:TlistUnlock*
|
||||
:TlistUpdate taglist.txt /*:TlistUpdate*
|
||||
:VCSAdd vcscommand.txt /*:VCSAdd*
|
||||
:VCSAnnotate vcscommand.txt /*:VCSAnnotate*
|
||||
:VCSBlame vcscommand.txt /*:VCSBlame*
|
||||
:VCSCommit vcscommand.txt /*:VCSCommit*
|
||||
:VCSDelete vcscommand.txt /*:VCSDelete*
|
||||
:VCSDiff vcscommand.txt /*:VCSDiff*
|
||||
:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal*
|
||||
:VCSInfo vcscommand.txt /*:VCSInfo*
|
||||
:VCSLock vcscommand.txt /*:VCSLock*
|
||||
:VCSLog vcscommand.txt /*:VCSLog*
|
||||
:VCSRemove vcscommand.txt /*:VCSRemove*
|
||||
:VCSRevert vcscommand.txt /*:VCSRevert*
|
||||
:VCSReview vcscommand.txt /*:VCSReview*
|
||||
:VCSStatus vcscommand.txt /*:VCSStatus*
|
||||
:VCSUnlock vcscommand.txt /*:VCSUnlock*
|
||||
:VCSUpdate vcscommand.txt /*:VCSUpdate*
|
||||
:VCSVimDiff vcscommand.txt /*:VCSVimDiff*
|
||||
Align-copyright Align.txt /*Align-copyright*
|
||||
ConqueTerm conque_term.txt /*ConqueTerm*
|
||||
ConqueTerm_CWInsert conque_term.txt /*ConqueTerm_CWInsert*
|
||||
ConqueTerm_CloseOnEnd conque_term.txt /*ConqueTerm_CloseOnEnd*
|
||||
ConqueTerm_CodePage conque_term.txt /*ConqueTerm_CodePage*
|
||||
ConqueTerm_Color conque_term.txt /*ConqueTerm_Color*
|
||||
ConqueTerm_ColorMode conque_term.txt /*ConqueTerm_ColorMode*
|
||||
ConqueTerm_EscKey conque_term.txt /*ConqueTerm_EscKey*
|
||||
ConqueTerm_ExecFileKey conque_term.txt /*ConqueTerm_ExecFileKey*
|
||||
ConqueTerm_FastMode conque_term.txt /*ConqueTerm_FastMode*
|
||||
ConqueTerm_InsertOnEnter conque_term.txt /*ConqueTerm_InsertOnEnter*
|
||||
ConqueTerm_PromptRegex conque_term.txt /*ConqueTerm_PromptRegex*
|
||||
ConqueTerm_PyExe conque_term.txt /*ConqueTerm_PyExe*
|
||||
ConqueTerm_PyVersion conque_term.txt /*ConqueTerm_PyVersion*
|
||||
ConqueTerm_ReadUnfocused conque_term.txt /*ConqueTerm_ReadUnfocused*
|
||||
ConqueTerm_SendFileKey conque_term.txt /*ConqueTerm_SendFileKey*
|
||||
ConqueTerm_SendFunctionKeys conque_term.txt /*ConqueTerm_SendFunctionKeys*
|
||||
ConqueTerm_SendVisKey conque_term.txt /*ConqueTerm_SendVisKey*
|
||||
ConqueTerm_SessionSupport conque_term.txt /*ConqueTerm_SessionSupport*
|
||||
ConqueTerm_StartMessages conque_term.txt /*ConqueTerm_StartMessages*
|
||||
ConqueTerm_Syntax conque_term.txt /*ConqueTerm_Syntax*
|
||||
ConqueTerm_TERM conque_term.txt /*ConqueTerm_TERM*
|
||||
ConqueTerm_ToggleKey conque_term.txt /*ConqueTerm_ToggleKey*
|
||||
GetLatestVimScripts pi_getscript.txt /*GetLatestVimScripts*
|
||||
GetLatestVimScripts-copyright pi_getscript.txt /*GetLatestVimScripts-copyright*
|
||||
GetLatestVimScripts_dat pi_getscript.txt /*GetLatestVimScripts_dat*
|
||||
NERDComAbout NERD_commenter.txt /*NERDComAbout*
|
||||
NERDComAlignedComment NERD_commenter.txt /*NERDComAlignedComment*
|
||||
NERDComAltDelim NERD_commenter.txt /*NERDComAltDelim*
|
||||
NERDComAppendComment NERD_commenter.txt /*NERDComAppendComment*
|
||||
NERDComChangelog NERD_commenter.txt /*NERDComChangelog*
|
||||
NERDComComment NERD_commenter.txt /*NERDComComment*
|
||||
NERDComCredits NERD_commenter.txt /*NERDComCredits*
|
||||
NERDComDefaultDelims NERD_commenter.txt /*NERDComDefaultDelims*
|
||||
NERDComEOLComment NERD_commenter.txt /*NERDComEOLComment*
|
||||
NERDComFunctionality NERD_commenter.txt /*NERDComFunctionality*
|
||||
NERDComFunctionalityDetails NERD_commenter.txt /*NERDComFunctionalityDetails*
|
||||
NERDComFunctionalitySummary NERD_commenter.txt /*NERDComFunctionalitySummary*
|
||||
NERDComHeuristics NERD_commenter.txt /*NERDComHeuristics*
|
||||
NERDComInsertComment NERD_commenter.txt /*NERDComInsertComment*
|
||||
NERDComInstallation NERD_commenter.txt /*NERDComInstallation*
|
||||
NERDComInvertComment NERD_commenter.txt /*NERDComInvertComment*
|
||||
NERDComIssues NERD_commenter.txt /*NERDComIssues*
|
||||
NERDComLicense NERD_commenter.txt /*NERDComLicense*
|
||||
NERDComMappings NERD_commenter.txt /*NERDComMappings*
|
||||
NERDComMinimalComment NERD_commenter.txt /*NERDComMinimalComment*
|
||||
NERDComNERDComment NERD_commenter.txt /*NERDComNERDComment*
|
||||
NERDComNestedComment NERD_commenter.txt /*NERDComNestedComment*
|
||||
NERDComNesting NERD_commenter.txt /*NERDComNesting*
|
||||
NERDComOptions NERD_commenter.txt /*NERDComOptions*
|
||||
NERDComOptionsDetails NERD_commenter.txt /*NERDComOptionsDetails*
|
||||
NERDComOptionsSummary NERD_commenter.txt /*NERDComOptionsSummary*
|
||||
NERDComSexyComment NERD_commenter.txt /*NERDComSexyComment*
|
||||
NERDComSexyComments NERD_commenter.txt /*NERDComSexyComments*
|
||||
NERDComToggleComment NERD_commenter.txt /*NERDComToggleComment*
|
||||
NERDComUncommentLine NERD_commenter.txt /*NERDComUncommentLine*
|
||||
NERDComYankComment NERD_commenter.txt /*NERDComYankComment*
|
||||
NERDCommenter NERD_commenter.txt /*NERDCommenter*
|
||||
NERDCommenterContents NERD_commenter.txt /*NERDCommenterContents*
|
||||
NERDTree NERD_tree.txt /*NERDTree*
|
||||
NERDTree-? NERD_tree.txt /*NERDTree-?*
|
||||
NERDTree-A NERD_tree.txt /*NERDTree-A*
|
||||
NERDTree-B NERD_tree.txt /*NERDTree-B*
|
||||
NERDTree-C NERD_tree.txt /*NERDTree-C*
|
||||
NERDTree-C-J NERD_tree.txt /*NERDTree-C-J*
|
||||
NERDTree-C-K NERD_tree.txt /*NERDTree-C-K*
|
||||
NERDTree-D NERD_tree.txt /*NERDTree-D*
|
||||
NERDTree-F NERD_tree.txt /*NERDTree-F*
|
||||
NERDTree-I NERD_tree.txt /*NERDTree-I*
|
||||
NERDTree-J NERD_tree.txt /*NERDTree-J*
|
||||
NERDTree-K NERD_tree.txt /*NERDTree-K*
|
||||
NERDTree-O NERD_tree.txt /*NERDTree-O*
|
||||
NERDTree-P NERD_tree.txt /*NERDTree-P*
|
||||
NERDTree-R NERD_tree.txt /*NERDTree-R*
|
||||
NERDTree-T NERD_tree.txt /*NERDTree-T*
|
||||
NERDTree-U NERD_tree.txt /*NERDTree-U*
|
||||
NERDTree-X NERD_tree.txt /*NERDTree-X*
|
||||
NERDTree-cd NERD_tree.txt /*NERDTree-cd*
|
||||
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
|
||||
NERDTree-e NERD_tree.txt /*NERDTree-e*
|
||||
NERDTree-f NERD_tree.txt /*NERDTree-f*
|
||||
NERDTree-gi NERD_tree.txt /*NERDTree-gi*
|
||||
NERDTree-go NERD_tree.txt /*NERDTree-go*
|
||||
NERDTree-gs NERD_tree.txt /*NERDTree-gs*
|
||||
NERDTree-i NERD_tree.txt /*NERDTree-i*
|
||||
NERDTree-m NERD_tree.txt /*NERDTree-m*
|
||||
NERDTree-o NERD_tree.txt /*NERDTree-o*
|
||||
NERDTree-p NERD_tree.txt /*NERDTree-p*
|
||||
NERDTree-q NERD_tree.txt /*NERDTree-q*
|
||||
NERDTree-r NERD_tree.txt /*NERDTree-r*
|
||||
NERDTree-s NERD_tree.txt /*NERDTree-s*
|
||||
NERDTree-t NERD_tree.txt /*NERDTree-t*
|
||||
NERDTree-u NERD_tree.txt /*NERDTree-u*
|
||||
NERDTree-x NERD_tree.txt /*NERDTree-x*
|
||||
NERDTreeAPI NERD_tree.txt /*NERDTreeAPI*
|
||||
NERDTreeAbout NERD_tree.txt /*NERDTreeAbout*
|
||||
NERDTreeAddKeyMap() NERD_tree.txt /*NERDTreeAddKeyMap()*
|
||||
NERDTreeAddMenuItem() NERD_tree.txt /*NERDTreeAddMenuItem()*
|
||||
NERDTreeAddMenuSeparator() NERD_tree.txt /*NERDTreeAddMenuSeparator()*
|
||||
NERDTreeAddSubmenu() NERD_tree.txt /*NERDTreeAddSubmenu()*
|
||||
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
|
||||
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
|
||||
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
|
||||
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
|
||||
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
|
||||
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
|
||||
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
|
||||
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
|
||||
NERDTreeKeymapAPI NERD_tree.txt /*NERDTreeKeymapAPI*
|
||||
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
|
||||
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
|
||||
NERDTreeMenu NERD_tree.txt /*NERDTreeMenu*
|
||||
NERDTreeMenuAPI NERD_tree.txt /*NERDTreeMenuAPI*
|
||||
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
|
||||
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
|
||||
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
|
||||
NERDTreeRender() NERD_tree.txt /*NERDTreeRender()*
|
||||
NERD_commenter.txt NERD_commenter.txt /*NERD_commenter.txt*
|
||||
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
|
||||
OpenFilemanager open_terminal.txt /*OpenFilemanager*
|
||||
OpenTerminal open_terminal.txt /*OpenTerminal*
|
||||
TSearch trac.txt /*TSearch*
|
||||
TTAddAttachment trac.txt /*TTAddAttachment*
|
||||
TTCreateDefect trac.txt /*TTCreateDefect*
|
||||
TTCreateEnhancement trac.txt /*TTCreateEnhancement*
|
||||
TTCreateTask trac.txt /*TTCreateTask*
|
||||
TTLoadTicketSession trac.txt /*TTLoadTicketSession*
|
||||
TTSaveTicketSession trac.txt /*TTSaveTicketSession*
|
||||
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
|
||||
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
|
||||
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
|
||||
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
|
||||
VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt*
|
||||
VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec*
|
||||
VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite*
|
||||
VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide*
|
||||
VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit*
|
||||
VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll*
|
||||
VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings*
|
||||
VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings*
|
||||
VCSCommandDisableMenu vcscommand.txt /*VCSCommandDisableMenu*
|
||||
VCSCommandEdit vcscommand.txt /*VCSCommandEdit*
|
||||
VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup*
|
||||
VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix*
|
||||
VCSCommandMappings vcscommand.txt /*VCSCommandMappings*
|
||||
VCSCommandMenuPriority vcscommand.txt /*VCSCommandMenuPriority*
|
||||
VCSCommandMenuRoot vcscommand.txt /*VCSCommandMenuRoot*
|
||||
VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension*
|
||||
VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction*
|
||||
VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec*
|
||||
VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt*
|
||||
VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt*
|
||||
VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec*
|
||||
VCSCommandSplit vcscommand.txt /*VCSCommandSplit*
|
||||
VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
|
||||
VCSCommandVCSTypePreference vcscommand.txt /*VCSCommandVCSTypePreference*
|
||||
akmap-commenter akmap.txt /*akmap-commenter*
|
||||
akmap-dev akmap.txt /*akmap-dev*
|
||||
akmap-intro akmap.txt /*akmap-intro*
|
||||
akmap-misc akmap.txt /*akmap-misc*
|
||||
akmap-os akmap.txt /*akmap-os*
|
||||
akmap-text akmap.txt /*akmap-text*
|
||||
akmap-toggles akmap.txt /*akmap-toggles*
|
||||
akmap-ver akmap.txt /*akmap-ver*
|
||||
akmap.txt akmap.txt /*akmap.txt*
|
||||
align Align.txt /*align*
|
||||
align-align Align.txt /*align-align*
|
||||
align-codepoint Align.txt /*align-codepoint*
|
||||
align-command Align.txt /*align-command*
|
||||
align-commands Align.txt /*align-commands*
|
||||
align-concept Align.txt /*align-concept*
|
||||
align-concepts Align.txt /*align-concepts*
|
||||
align-contents Align.txt /*align-contents*
|
||||
align-control Align.txt /*align-control*
|
||||
align-history Align.txt /*align-history*
|
||||
align-manual Align.txt /*align-manual*
|
||||
align-maps Align.txt /*align-maps*
|
||||
align-multibyte Align.txt /*align-multibyte*
|
||||
align-option Align.txt /*align-option*
|
||||
align-options Align.txt /*align-options*
|
||||
align-strlen Align.txt /*align-strlen*
|
||||
align-usage Align.txt /*align-usage*
|
||||
align-userguide Align.txt /*align-userguide*
|
||||
align-utf Align.txt /*align-utf*
|
||||
align-utf8 Align.txt /*align-utf8*
|
||||
align-xstrlen Align.txt /*align-xstrlen*
|
||||
align.txt Align.txt /*align.txt*
|
||||
alignctrl Align.txt /*alignctrl*
|
||||
alignctrl- Align.txt /*alignctrl-*
|
||||
alignctrl-+ Align.txt /*alignctrl-+*
|
||||
alignctrl-- Align.txt /*alignctrl--*
|
||||
alignctrl-: Align.txt /*alignctrl-:*
|
||||
alignctrl-< Align.txt /*alignctrl-<*
|
||||
alignctrl-= Align.txt /*alignctrl-=*
|
||||
alignctrl-> Align.txt /*alignctrl->*
|
||||
alignctrl-C Align.txt /*alignctrl-C*
|
||||
alignctrl-I Align.txt /*alignctrl-I*
|
||||
alignctrl-P Align.txt /*alignctrl-P*
|
||||
alignctrl-W Align.txt /*alignctrl-W*
|
||||
alignctrl-alignskip Align.txt /*alignctrl-alignskip*
|
||||
alignctrl-c Align.txt /*alignctrl-c*
|
||||
alignctrl-g Align.txt /*alignctrl-g*
|
||||
alignctrl-init Align.txt /*alignctrl-init*
|
||||
alignctrl-initialization Align.txt /*alignctrl-initialization*
|
||||
alignctrl-l Align.txt /*alignctrl-l*
|
||||
alignctrl-m Align.txt /*alignctrl-m*
|
||||
alignctrl-no-option Align.txt /*alignctrl-no-option*
|
||||
alignctrl-p Align.txt /*alignctrl-p*
|
||||
alignctrl-r Align.txt /*alignctrl-r*
|
||||
alignctrl-separators Align.txt /*alignctrl-separators*
|
||||
alignctrl-settings Align.txt /*alignctrl-settings*
|
||||
alignctrl-star Align.txt /*alignctrl-star*
|
||||
alignctrl-v Align.txt /*alignctrl-v*
|
||||
alignctrl-w Align.txt /*alignctrl-w*
|
||||
alignman Align.txt /*alignman*
|
||||
alignmanual Align.txt /*alignmanual*
|
||||
alignmap-Htd Align.txt /*alignmap-Htd*
|
||||
alignmap-T= Align.txt /*alignmap-T=*
|
||||
alignmap-Tsp Align.txt /*alignmap-Tsp*
|
||||
alignmap-a( Align.txt /*alignmap-a(*
|
||||
alignmap-a, Align.txt /*alignmap-a,*
|
||||
alignmap-a< Align.txt /*alignmap-a<*
|
||||
alignmap-a= Align.txt /*alignmap-a=*
|
||||
alignmap-a? Align.txt /*alignmap-a?*
|
||||
alignmap-abox Align.txt /*alignmap-abox*
|
||||
alignmap-acom Align.txt /*alignmap-acom*
|
||||
alignmap-adcom Align.txt /*alignmap-adcom*
|
||||
alignmap-adec Align.txt /*alignmap-adec*
|
||||
alignmap-adef Align.txt /*alignmap-adef*
|
||||
alignmap-afnc Align.txt /*alignmap-afnc*
|
||||
alignmap-anum Align.txt /*alignmap-anum*
|
||||
alignmap-aocom Align.txt /*alignmap-aocom*
|
||||
alignmap-ascom Align.txt /*alignmap-ascom*
|
||||
alignmap-history Align.txt /*alignmap-history*
|
||||
alignmap-m= Align.txt /*alignmap-m=*
|
||||
alignmap-t# Align.txt /*alignmap-t#*
|
||||
alignmap-t, Align.txt /*alignmap-t,*
|
||||
alignmap-t: Align.txt /*alignmap-t:*
|
||||
alignmap-t; Align.txt /*alignmap-t;*
|
||||
alignmap-t< Align.txt /*alignmap-t<*
|
||||
alignmap-t= Align.txt /*alignmap-t=*
|
||||
alignmap-t? Align.txt /*alignmap-t?*
|
||||
alignmap-tab Align.txt /*alignmap-tab*
|
||||
alignmap-tml Align.txt /*alignmap-tml*
|
||||
alignmap-ts, Align.txt /*alignmap-ts,*
|
||||
alignmap-ts: Align.txt /*alignmap-ts:*
|
||||
alignmap-ts< Align.txt /*alignmap-ts<*
|
||||
alignmap-ts= Align.txt /*alignmap-ts=*
|
||||
alignmap-tsp Align.txt /*alignmap-tsp*
|
||||
alignmap-tsq Align.txt /*alignmap-tsq*
|
||||
alignmap-tt Align.txt /*alignmap-tt*
|
||||
alignmap-t~ Align.txt /*alignmap-t~*
|
||||
alignmaps Align.txt /*alignmaps*
|
||||
alignusage Align.txt /*alignusage*
|
||||
b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
|
||||
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
|
||||
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
|
||||
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
|
||||
bufexplorer bufexplorer.txt /*bufexplorer*
|
||||
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
|
||||
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
|
||||
bufexplorer-customization bufexplorer.txt /*bufexplorer-customization*
|
||||
bufexplorer-installation bufexplorer.txt /*bufexplorer-installation*
|
||||
bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
|
||||
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
|
||||
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
|
||||
buffer-explorer bufexplorer.txt /*buffer-explorer*
|
||||
cecutil cecutil.txt /*cecutil*
|
||||
cecutil-cmd cecutil.txt /*cecutil-cmd*
|
||||
cecutil-contents cecutil.txt /*cecutil-contents*
|
||||
cecutil-copyright cecutil.txt /*cecutil-copyright*
|
||||
cecutil-destroymark cecutil.txt /*cecutil-destroymark*
|
||||
cecutil-history cecutil.txt /*cecutil-history*
|
||||
cecutil-map cecutil.txt /*cecutil-map*
|
||||
cecutil-maps cecutil.txt /*cecutil-maps*
|
||||
cecutil-marks cecutil.txt /*cecutil-marks*
|
||||
cecutil-position cecutil.txt /*cecutil-position*
|
||||
cecutil-posn cecutil.txt /*cecutil-posn*
|
||||
cecutil-restoremark cecutil.txt /*cecutil-restoremark*
|
||||
cecutil-restorewinposn cecutil.txt /*cecutil-restorewinposn*
|
||||
cecutil-rwp cecutil.txt /*cecutil-rwp*
|
||||
cecutil-savemark cecutil.txt /*cecutil-savemark*
|
||||
cecutil-saveusermaps cecutil.txt /*cecutil-saveusermaps*
|
||||
cecutil-savewinposn cecutil.txt /*cecutil-savewinposn*
|
||||
cecutil-swp cecutil.txt /*cecutil-swp*
|
||||
cecutil.txt cecutil.txt /*cecutil.txt*
|
||||
conque-config-general conque_term.txt /*conque-config-general*
|
||||
conque-config-keyboard conque_term.txt /*conque-config-keyboard*
|
||||
conque-config-unix conque_term.txt /*conque-config-unix*
|
||||
conque-config-windows conque_term.txt /*conque-config-windows*
|
||||
conque-term-api conque_term.txt /*conque-term-api*
|
||||
conque-term-bugs conque_term.txt /*conque-term-bugs*
|
||||
conque-term-close conque_term.txt /*conque-term-close*
|
||||
conque-term-contribute conque_term.txt /*conque-term-contribute*
|
||||
conque-term-esc conque_term.txt /*conque-term-esc*
|
||||
conque-term-events conque_term.txt /*conque-term-events*
|
||||
conque-term-feedback conque_term.txt /*conque-term-feedback*
|
||||
conque-term-gen-usage conque_term.txt /*conque-term-gen-usage*
|
||||
conque-term-get-instance conque_term.txt /*conque-term-get-instance*
|
||||
conque-term-input-mode conque_term.txt /*conque-term-input-mode*
|
||||
conque-term-installation conque_term.txt /*conque-term-installation*
|
||||
conque-term-misc conque_term.txt /*conque-term-misc*
|
||||
conque-term-open conque_term.txt /*conque-term-open*
|
||||
conque-term-options conque_term.txt /*conque-term-options*
|
||||
conque-term-read conque_term.txt /*conque-term-read*
|
||||
conque-term-register conque_term.txt /*conque-term-register*
|
||||
conque-term-requirements conque_term.txt /*conque-term-requirements*
|
||||
conque-term-send conque_term.txt /*conque-term-send*
|
||||
conque-term-set-callback conque_term.txt /*conque-term-set-callback*
|
||||
conque-term-setup conque_term.txt /*conque-term-setup*
|
||||
conque-term-special-keys conque_term.txt /*conque-term-special-keys*
|
||||
conque-term-subprocess conque_term.txt /*conque-term-subprocess*
|
||||
conque-term-usage conque_term.txt /*conque-term-usage*
|
||||
conque-term-windows conque_term.txt /*conque-term-windows*
|
||||
conque-term-write conque_term.txt /*conque-term-write*
|
||||
conque-term-writeln conque_term.txt /*conque-term-writeln*
|
||||
cvscommand-changes vcscommand.txt /*cvscommand-changes*
|
||||
g:AlignSkip Align.txt /*g:AlignSkip*
|
||||
g:alignmaps_euronumber Align.txt /*g:alignmaps_euronumber*
|
||||
g:alignmaps_usanumber Align.txt /*g:alignmaps_usanumber*
|
||||
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
|
||||
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
|
||||
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
|
||||
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
|
||||
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
|
||||
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
|
||||
g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted*
|
||||
g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
|
||||
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
|
||||
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
|
||||
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*
|
||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||
getscript pi_getscript.txt /*getscript*
|
||||
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
|
||||
getscript-data pi_getscript.txt /*getscript-data*
|
||||
getscript-history pi_getscript.txt /*getscript-history*
|
||||
getscript-plugins pi_getscript.txt /*getscript-plugins*
|
||||
getscript-start pi_getscript.txt /*getscript-start*
|
||||
glvs pi_getscript.txt /*glvs*
|
||||
glvs-alg pi_getscript.txt /*glvs-alg*
|
||||
glvs-algorithm pi_getscript.txt /*glvs-algorithm*
|
||||
glvs-autoinstall pi_getscript.txt /*glvs-autoinstall*
|
||||
glvs-contents pi_getscript.txt /*glvs-contents*
|
||||
glvs-copyright pi_getscript.txt /*glvs-copyright*
|
||||
glvs-data pi_getscript.txt /*glvs-data*
|
||||
glvs-dist-install pi_getscript.txt /*glvs-dist-install*
|
||||
glvs-hist pi_getscript.txt /*glvs-hist*
|
||||
glvs-install pi_getscript.txt /*glvs-install*
|
||||
glvs-options pi_getscript.txt /*glvs-options*
|
||||
glvs-plugins pi_getscript.txt /*glvs-plugins*
|
||||
glvs-usage pi_getscript.txt /*glvs-usage*
|
||||
open-terminal open_terminal.txt /*open-terminal*
|
||||
open-terminal-about open_terminal.txt /*open-terminal-about*
|
||||
open-terminal-changelog open_terminal.txt /*open-terminal-changelog*
|
||||
open-terminal-commands open_terminal.txt /*open-terminal-commands*
|
||||
open-terminal-introduction open_terminal.txt /*open-terminal-introduction*
|
||||
open-terminal-keymap open_terminal.txt /*open-terminal-keymap*
|
||||
open-terminal-requires open_terminal.txt /*open-terminal-requires*
|
||||
pi_getscript.txt pi_getscript.txt /*pi_getscript.txt*
|
||||
taglist-commands taglist.txt /*taglist-commands*
|
||||
taglist-debug taglist.txt /*taglist-debug*
|
||||
taglist-extend taglist.txt /*taglist-extend*
|
||||
taglist-faq taglist.txt /*taglist-faq*
|
||||
taglist-functions taglist.txt /*taglist-functions*
|
||||
taglist-install taglist.txt /*taglist-install*
|
||||
taglist-internet taglist.txt /*taglist-internet*
|
||||
taglist-intro taglist.txt /*taglist-intro*
|
||||
taglist-keys taglist.txt /*taglist-keys*
|
||||
taglist-license taglist.txt /*taglist-license*
|
||||
taglist-menu taglist.txt /*taglist-menu*
|
||||
taglist-options taglist.txt /*taglist-options*
|
||||
taglist-requirements taglist.txt /*taglist-requirements*
|
||||
taglist-session taglist.txt /*taglist-session*
|
||||
taglist-todo taglist.txt /*taglist-todo*
|
||||
taglist-using taglist.txt /*taglist-using*
|
||||
taglist.txt taglist.txt /*taglist.txt*
|
||||
textformat-commands textformat.txt /*textformat-commands*
|
||||
textformat-config textformat.txt /*textformat-config*
|
||||
textformat-history textformat.txt /*textformat-history*
|
||||
textformat-keymap textformat.txt /*textformat-keymap*
|
||||
textformat-start textformat.txt /*textformat-start*
|
||||
textformat.txt textformat.txt /*textformat.txt*
|
||||
trac-changeset-view trac.txt /*trac-changeset-view*
|
||||
trac-format trac.txt /*trac-format*
|
||||
trac-format-blockquotes trac.txt /*trac-format-blockquotes*
|
||||
trac-format-definition trac.txt /*trac-format-definition*
|
||||
trac-format-discussion trac.txt /*trac-format-discussion*
|
||||
trac-format-font trac.txt /*trac-format-font*
|
||||
trac-format-headings trac.txt /*trac-format-headings*
|
||||
trac-format-images trac.txt /*trac-format-images*
|
||||
trac-format-links trac.txt /*trac-format-links*
|
||||
trac-format-lists trac.txt /*trac-format-lists*
|
||||
trac-format-macros trac.txt /*trac-format-macros*
|
||||
trac-format-misc trac.txt /*trac-format-misc*
|
||||
trac-format-nolink trac.txt /*trac-format-nolink*
|
||||
trac-format-notes trac.txt /*trac-format-notes*
|
||||
trac-format-paragraphs trac.txt /*trac-format-paragraphs*
|
||||
trac-format-preformatted trac.txt /*trac-format-preformatted*
|
||||
trac-format-processors trac.txt /*trac-format-processors*
|
||||
trac-format-tables trac.txt /*trac-format-tables*
|
||||
trac-format-traclinks trac.txt /*trac-format-traclinks*
|
||||
trac-requirements trac.txt /*trac-requirements*
|
||||
trac-search-view trac.txt /*trac-search-view*
|
||||
trac-server trac.txt /*trac-server*
|
||||
trac-setup trac.txt /*trac-setup*
|
||||
trac-ticket-attachments trac.txt /*trac-ticket-attachments*
|
||||
trac-ticket-changes trac.txt /*trac-ticket-changes*
|
||||
trac-ticket-comments trac.txt /*trac-ticket-comments*
|
||||
trac-ticket-create trac.txt /*trac-ticket-create*
|
||||
trac-ticket-filters trac.txt /*trac-ticket-filters*
|
||||
trac-ticket-session trac.txt /*trac-ticket-session*
|
||||
trac-ticket-sorting trac.txt /*trac-ticket-sorting*
|
||||
trac-ticket-view trac.txt /*trac-ticket-view*
|
||||
trac-timeline-view trac.txt /*trac-timeline-view*
|
||||
trac-wiki-attachments trac.txt /*trac-wiki-attachments*
|
||||
trac-wiki-diff trac.txt /*trac-wiki-diff*
|
||||
trac-wiki-editing trac.txt /*trac-wiki-editing*
|
||||
trac-wiki-htmlpreview trac.txt /*trac-wiki-htmlpreview*
|
||||
trac-wiki-save trac.txt /*trac-wiki-save*
|
||||
trac-wiki-view trac.txt /*trac-wiki-view*
|
||||
trac.txt trac.txt /*trac.txt*
|
||||
vcscommand vcscommand.txt /*vcscommand*
|
||||
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
|
||||
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*
|
||||
vcscommand-bugs vcscommand.txt /*vcscommand-bugs*
|
||||
vcscommand-commands vcscommand.txt /*vcscommand-commands*
|
||||
vcscommand-config vcscommand.txt /*vcscommand-config*
|
||||
vcscommand-contents vcscommand.txt /*vcscommand-contents*
|
||||
vcscommand-customize vcscommand.txt /*vcscommand-customize*
|
||||
vcscommand-events vcscommand.txt /*vcscommand-events*
|
||||
vcscommand-install vcscommand.txt /*vcscommand-install*
|
||||
vcscommand-intro vcscommand.txt /*vcscommand-intro*
|
||||
vcscommand-manual vcscommand.txt /*vcscommand-manual*
|
||||
vcscommand-mappings vcscommand.txt /*vcscommand-mappings*
|
||||
vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override*
|
||||
vcscommand-naming vcscommand.txt /*vcscommand-naming*
|
||||
vcscommand-options vcscommand.txt /*vcscommand-options*
|
||||
vcscommand-ssh vcscommand.txt /*vcscommand-ssh*
|
||||
vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config*
|
||||
vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env*
|
||||
vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other*
|
||||
vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper*
|
||||
vcscommand-statusline vcscommand.txt /*vcscommand-statusline*
|
||||
vcscommand.txt vcscommand.txt /*vcscommand.txt*
|
|
@ -1,301 +0,0 @@
|
|||
*textformat.txt* Vim Text Formatter (version 2.1) 2008-09-13
|
||||
|
||||
|
||||
Description This plugin provides commands and key mappings to quickly
|
||||
align and format text. Text can be easily reformatted and
|
||||
aligned to either left or right margin or justified to both
|
||||
margins or centered. The text formatting commands provided by
|
||||
this plugin are a bit more automatic and more intelligent than
|
||||
those integrated to Vim. Together they make more powerful
|
||||
command set for formatting text.
|
||||
|
||||
Author Teemu Likonen <tlikonen@iki.fi>
|
||||
|
||||
|
||||
|
||||
|
||||
Contents
|
||||
|
||||
1. Quick start |textformat-start|
|
||||
2. Commands |textformat-commands|
|
||||
3. Default key mappings |textformat-keymap|
|
||||
4. Configuration |textformat-config|
|
||||
5. Version history |textformat-history|
|
||||
|
||||
==============================================================================
|
||||
1. Quick start *textformat-start*
|
||||
|
||||
The impatient are always with us so below is a short info on (probably) the
|
||||
most important tools provided by this plugin. See the following sections of
|
||||
this manual for more detailed instructions.
|
||||
|
||||
<Leader>al Left-align and reformat
|
||||
<Leader>ar Right-align
|
||||
<Leader>aj Left-right justify and reformat
|
||||
<Leader>ac Center lines
|
||||
|
||||
In normal mode the commands operate on current paragraph; in visual mode they
|
||||
operate on the selected lines. By default, <Leader> is the backslash key, so
|
||||
the mappings are actually \al, \ar, \aj and \ac, by default. If you have
|
||||
changed the g:mapleader variable in your .vimrc file <Leader> may be something
|
||||
else.
|
||||
|
||||
==============================================================================
|
||||
2. Commands *textformat-commands*
|
||||
|
||||
Let's start with the basic components of this plugin. These are the ex
|
||||
commands. You probably don't need these very often but they can be handy if
|
||||
you want to have text formatting and aligning as a part of a macro or function
|
||||
or something. The "daily tools" are explained later.
|
||||
|
||||
:[range]AlignLeft [indent] *:AlignLeft*
|
||||
Align to left all the lines in [range] (default is
|
||||
current line) and truncate all extra whitespace
|
||||
characters. That is, if there are more than one space
|
||||
between words they are reduced to just one. If
|
||||
'joinspaces' is set then two spaces are added after
|
||||
every sentence ending with character ".", "?" or "!".
|
||||
|
||||
If optional numeric argument [indent] is given then
|
||||
that is used as the left margin. If [indent] is not
|
||||
given the indent of the first line in the [range] (and
|
||||
the first line of each paragraph within the [range])
|
||||
is used to define indent for the rest of the lines in
|
||||
the paragraph. There is one exception: if
|
||||
'formatoptions' contains "2" then the second line
|
||||
defines the indent for the rest of the lines in the
|
||||
paragraph.
|
||||
|
||||
Note: This is very similar to |:left| command except
|
||||
that this also truncates whitespaces and that without
|
||||
[indent] each paragraph's indent is detected and used.
|
||||
|
||||
Note: There is a possible unexpected behaviour: If
|
||||
command is run without [range] (i.e., it's just the
|
||||
current line) and [indent] is not given then this
|
||||
command just "aligns" to the current indent position
|
||||
and truncates whitespaces. You might see nothing
|
||||
happening if there weren't any extra whitespaces. Use
|
||||
[indent] (or |:left| command) to align to desired
|
||||
column.
|
||||
|
||||
:[range]AlignRight [width] *:AlignRight*
|
||||
Align to right all the lines in [range] (default is
|
||||
current line) and truncate all extra whitespace
|
||||
characters (honor 'joinspaces', as in :AlignLeft).
|
||||
[width] is used as the right margin. If [width] is not
|
||||
given the value of 'textwidth' option is used instead.
|
||||
If 'textwidth' is zero then the value of 80 is used.
|
||||
|
||||
Note: This is very similar to |:right| command except
|
||||
that this also truncates whitespaces.
|
||||
|
||||
:[range]AlignJustify [width] *:AlignJustify*
|
||||
Left-right justify lines in [range] (default is
|
||||
current line). This means adjusting spaces between
|
||||
words so that the lines fit. If 'joinspaces' is set
|
||||
then at least two spaces are printed after every
|
||||
sentence ending with a ".", "?" or "!". The first line
|
||||
in [range] (and the first line in each paragraph
|
||||
within the [range]) defines the indent for the rest of
|
||||
the lines in the paragraph, except if 'formatoptions'
|
||||
contains "2" then it's the second line.
|
||||
|
||||
Numeric argument [width] is used as the right margin.
|
||||
If [width] is not given the value of 'textwidth' is
|
||||
used instead. If 'textwidth' is zero then the value of
|
||||
80 is used.
|
||||
|
||||
Also see the Discussion below.
|
||||
|
||||
:[range]AlignCenter [width] *:AlignCenter*
|
||||
Center lines in [range] (default is current line)
|
||||
between the first column and [width]. All extra
|
||||
whitespace characters are truncated (but honor
|
||||
'joinspaces', just like in :AlignLeft). If [width] is
|
||||
not given the value of 'textwidth' option is used
|
||||
instead. If 'textwidth' is zero the value of 80 is
|
||||
used.
|
||||
|
||||
Note: This is very similar to |:center| except that
|
||||
this also truncates whitespaces.
|
||||
|
||||
|
||||
Discussion ~
|
||||
|
||||
All the previous ex commands are rather "stupid" and operate on single lines
|
||||
only. They do not wrap lines nor do other kind of formatting. If [width] (or
|
||||
'textwidth') is too narrow for the line then some characters will go beyond
|
||||
the right margin. This is similar to Vim's own |:left|, |:right| and |:center|
|
||||
commands. More sophisticated formatting tools are provided as key mappings
|
||||
(see below).
|
||||
|
||||
Usually when paragraphs are justified the last line of each paragraph is
|
||||
aligned to left. However, :AlignJustify command does not do this. The purpose
|
||||
of this command is to do exactly what was asked for: left-right justify
|
||||
a range of lines. More sophisticated justify tools is <Leader>aj which
|
||||
reformats the paragraph (like |gw|), justifies lines and aligns each
|
||||
paragraph's last line to left.
|
||||
|
||||
All the commands truncate extra whitespaces which makes them work well
|
||||
together. This is particularly because the left-right justify needs to add
|
||||
extra spaces to make lines fill the text area. If you later want to reformat
|
||||
such previously justified paragraph and align it to left, for example, it's
|
||||
convenient that the tool automatically handles this and removes extra spaces.
|
||||
If you want to align text without truncating whitespaces use Vim's own align
|
||||
commands: |:left|, |:right| and |:center|.
|
||||
|
||||
==============================================================================
|
||||
3. Default key mappings *textformat-keymap*
|
||||
|
||||
By default this plugin provides a couple of key mappings for convenient text
|
||||
formatting. If the mappings have already been defined by user (or are taken by
|
||||
other plugins) then some of the following mappings may not be automatically
|
||||
available. See the next section of this manual for information on how to
|
||||
change the default mappings.
|
||||
|
||||
There are key mappings available for normal mode and visual mode. As usual,
|
||||
<Leader> is the backslash key by default but it can be changed with
|
||||
g:mapleader variable. Consult the Vim manual for more information on <Leader>.
|
||||
|
||||
|
||||
Normal mode (current paragraph) ~
|
||||
|
||||
<Leader>al Left-align the current "inner paragraph" (see |ip|)
|
||||
and reformat it according to 'textwidth'.
|
||||
|
||||
<Leader>ar Right-align the current "inner paragraph" (see |ip|)
|
||||
to margin at 'textwidth'. This does not reformat the
|
||||
paragraph because with right-aligned text user usually
|
||||
wants to decide exactly what goes to what line.
|
||||
|
||||
<Leader>aj Left-right justify the current "inner paragraph" (see
|
||||
|ip|). Technically each line's whitespaces are first
|
||||
truncated, then the text is reformatted according to
|
||||
'textwidth' and finally lines are justified. The last
|
||||
line (of each text paragraph) is aligned to left.
|
||||
|
||||
<Leader>ac Center lines of current "inner paragraph" (see |ip|)
|
||||
between the first column and 'textwidth'. This does
|
||||
not reformat the paragraph because with centered text
|
||||
user usually wants to decide exactly what goes to what
|
||||
line.
|
||||
|
||||
|
||||
Visual mode (range of lines) ~
|
||||
|
||||
{Visual}<Leader>al Left-align and reformat {Visual} lines so that they
|
||||
fill 'textwidth'.
|
||||
|
||||
{Visual}<Leader>ar Right-align {Visual} lines.
|
||||
|
||||
{Visual}<Leader>aj Left-right justify {Visual} lines. First truncate all
|
||||
extra whitespace characters, then reformat lines so
|
||||
that they fill 'textwidth' and finally left-right
|
||||
justify. The last line of each paragraph as well as
|
||||
the last line in {Visual} range is aligned to left.
|
||||
|
||||
{Visual}<Leader>ac Center {Visual} lines.
|
||||
|
||||
|
||||
Both normal mode and visual mode commands truncate extra whitespace
|
||||
characters. If 'joinspaces' is set then an extra space is added after every
|
||||
sentence ending with a ".", "?" or "!". The first line in each paragraph
|
||||
inside the range defines the indent for the rest of the lines in the
|
||||
paragraph, except if 'formatoptions' contains "2" then it's the second line.
|
||||
|
||||
|
||||
Paragraph definitions ~
|
||||
|
||||
The normal mode commands operate on the concept of "inner paragraph" (see
|
||||
|ip|). The effect is almost the same as selecting current paragraph with Vim's
|
||||
"vip" command and then executing the equivalent visual mode command. Such
|
||||
inner paragraph may contain several text paragraphs if 'formatoptions'
|
||||
contains "w". Each of them is reformatted separately with <Leader>al and
|
||||
<Leader>aj commands.
|
||||
|
||||
New paragraph always begins after a blank line. If 'formatoptions' contains
|
||||
"w" then new paragraph also begins after a line which ends with
|
||||
a non-whitespace character. That is, with "w" in 'formatoptions' every line
|
||||
which ends with a non-whitespace also ends a paragraph. In left-right justify
|
||||
(<Leader>aj) such line is aligned to left. You need to ensure that there is
|
||||
a trailing whitespace in every consecutive line which belongs to same
|
||||
paragraph (the whitespace is preserved after formatting). If 'formatoptions'
|
||||
does not contain "w" then all consecutive non-blank lines belong to same
|
||||
paragraph.
|
||||
|
||||
==============================================================================
|
||||
4. Configuration *textformat-config*
|
||||
|
||||
The key mappings can be configured freely by user. This plugin uses the
|
||||
default ones only if they are free and not used for other purposes. Here's an
|
||||
example of lines you could put to your .vimrc file:
|
||||
>
|
||||
nmap <F5> <Plug>Quick_Align_Paragraph_Left
|
||||
nmap <F6> <Plug>Quick_Align_Paragraph_Right
|
||||
nmap <F7> <Plug>Quick_Align_Paragraph_Justify
|
||||
nmap <F8> <Plug>Quick_Align_Paragraph_Center
|
||||
|
||||
vmap <F5> <Plug>Align_Range_Left
|
||||
vmap <F6> <Plug>Align_Range_Right
|
||||
vmap <F7> <Plug>Align_Range_Justify
|
||||
vmap <F8> <Plug>Align_Range_Center
|
||||
|
||||
That is, |:nmap| command defines mappings for normal mode and |:vmap| for
|
||||
visual mode. Function keys from <F5> to <F8> are used in this example. The
|
||||
rest of the line is a code word for Vim and this plugin. They must be written
|
||||
exactly as shown in the example. I think the code words are pretty much
|
||||
self-descriptive.
|
||||
|
||||
Don't use |:nnoremap| and |:vnoremap| commands here; they don't work because
|
||||
the right-hand side (<Plug>...) must be remappable. See Vim's manual for more
|
||||
information about the key map commands.
|
||||
|
||||
Most part of this plugin is loaded into memory when the text-formatting
|
||||
commands or key maps are used for the first time. Only the very minimum is
|
||||
automatically loaded when Vim is started. If you want to completely avoid
|
||||
loading this plugin put the following line to your .vimrc file:
|
||||
>
|
||||
let g:loaded_textformat = 1
|
||||
|
||||
Happy formatting!
|
||||
|
||||
==============================================================================
|
||||
5. Version history *textformat-history*
|
||||
|
||||
v2.1 2008-09-13
|
||||
|
||||
- Minor internal cleanup.
|
||||
|
||||
v2.0 2008-08-10
|
||||
|
||||
- \al and \aj now reformat text also in visual mode.
|
||||
- \al and \aj honor "w" in 'formatoptions' and detect paragraph
|
||||
boundaries accordingly.
|
||||
- :AlignLeft, :AlignJustify, \al and \aj recognize several
|
||||
paragraphs within the range and detect indent for each
|
||||
paragraph separately.
|
||||
- Add logic to load the plugin script only once.
|
||||
|
||||
v1.1 2008-08-04
|
||||
|
||||
- Keep cursor position more accurately when formatting
|
||||
a paragraph with \al and \aj.
|
||||
- When 'joinspaces' is set insert two spaces after .?!
|
||||
punctuation with left-right justify. This is now similar to
|
||||
other commands.
|
||||
|
||||
v1.0 2008-08-03
|
||||
|
||||
- All the commands now follow user's 'expandtab' setting and
|
||||
print leading whitespaces accordingly. Now this works just
|
||||
like :left, :right and :center commands.
|
||||
- The left-aligned last line in justified paragraph did not
|
||||
honor 'joinspaces'. Fixed.
|
||||
|
||||
v0.9 2008-08-01
|
||||
|
||||
- Initial upload to http://www.vim.org .
|
||||
|
||||
==============================================================================
|
||||
vim: ft=help tw=78 ts=8 et norl fo+=2aw
|
627
vim/doc/trac.txt
627
vim/doc/trac.txt
|
@ -1,627 +0,0 @@
|
|||
*trac.txt*
|
||||
|
||||
Vimtrac Usage Notes
|
||||
|
||||
1. System Requirements |trac-requirements|
|
||||
2. Setup |trac-setup|
|
||||
3. Server Selection |trac-server|
|
||||
4. Wiki Viewing / Editing |trac-wiki-view|
|
||||
4.1 Wiki Browsing/Editing |trac-wiki-editing|
|
||||
4.2. Adding/ Retrieving an Attachment |trac-wiki-attachments|
|
||||
4.3. HTML Preview |trac-wiki-htmlpreview|
|
||||
4.4. Saving Wiki's |trac-wiki-save|
|
||||
4.5 Wiki Vim Diffs |trac-wiki-diff|
|
||||
5. Trac Ticket View |trac-ticket-view|
|
||||
5.1 Ticket Filters |trac-ticket-filters|
|
||||
5.1.1 Ticket Sorting |trac-ticket-sorting|
|
||||
5.2. Adding Comments |trac-ticket-comments|
|
||||
5.3. Changing ticket states |trac-ticket-changes|
|
||||
5.4. Creating Tickets |trac-ticket-create|
|
||||
5.5. Adding/Retrieving attachments |trac-ticket-attachments|
|
||||
5.6 Ticket Sessions |trac-ticket-session|
|
||||
6. Trac Search View |trac-search-view|
|
||||
7. Changeset View |trac-changeset-view|
|
||||
8. Timeline View |trac-timeline-view|
|
||||
9. WikiFormatting |trac-wiki-formatting|
|
||||
9.1 Font Styles |trac-format-font|
|
||||
9.1 Notes: |trac-format-notes|
|
||||
9.2 Headings |trac-format-headings|
|
||||
9.3 Paragraphs |trac-format-paragraphs|
|
||||
9.4 Lists |trac-format-lists|
|
||||
9.4 Definition Lists |trac-format-definition|
|
||||
9.5 Preformatted Text |trac-format-preformatted|
|
||||
9.6 Blockquotes |trac-format-blockquotes|
|
||||
9.7 Discussion Citations |trac-format-discussion|
|
||||
9.8 Tables |trac-format-tables|
|
||||
9.9 Links |trac-format-links|
|
||||
9.9.1 Trac Links |trac-format-traclinks|
|
||||
9.10 Escaping Links and WikiPageNames |trac-format-nolink|
|
||||
9.11 Images |trac-format-images|
|
||||
9.12 Macros |trac-format-macros|
|
||||
9.13 Processors |trac-format-processors|
|
||||
9.14 Miscellaneous |trac-format-misc|
|
||||
================================================================================
|
||||
1. System Requirements *trac-requirements*
|
||||
|
||||
You must have a working Trac repository version 0.10 or later complete with
|
||||
the xmlrpc plugin and a user with suitable access rights.
|
||||
|
||||
Vim must be compiled with python support and your client must have python
|
||||
2.4.4 or later
|
||||
|
||||
To use the summary view you need to have the Align plugin installed for the
|
||||
layout.
|
||||
|
||||
http://www.vim.org/scripts/script.php?script_id=294
|
||||
================================================================================
|
||||
2. Setup *trac-setup*
|
||||
|
||||
You need to create a list of trac servers using this format in your vimrc.
|
||||
|
||||
"let g:tracServerList = {}
|
||||
"let g:tracServerList['(Server Name)'] =
|
||||
\'http://(user):(password)@(trac serverpath)/login/xmlrpc'
|
||||
|
||||
Check out
|
||||
|
||||
http://www.ascetinteractive.com.au/vimtrac/wiki/UsageNotes and
|
||||
http://www.ascetinteractive.com.au/vimtrac/wiki/TricksAndTips
|
||||
|
||||
for more up to date notes
|
||||
|
||||
================================================================================
|
||||
3. Server Selection *trac-server*
|
||||
|
||||
|
||||
:TWServer [ServerName] *:TWServer*
|
||||
:TTServer [ServerName] *:TTServer*
|
||||
:TTLServer [ServerName] *:TTLServer*
|
||||
|
||||
Sets the current trac server where the
|
||||
The <tab> key will cycle through available servers.
|
||||
|
||||
The wiki (TW), ticket (TT) and timeline (TTL) vaiations will open the
|
||||
respective views
|
||||
================================================================================
|
||||
4. Wiki Viewing / Editing *trac-wiki-view*
|
||||
|
||||
The Trac Wiki view is for browsing an editing a trac websites wiki pages.
|
||||
|
||||
*:TWOpen*
|
||||
|
||||
To open the wiki view use the command :TWOpen [OptionalWikiPage]
|
||||
|
||||
If no page argument is given the plugin will open the main page WikiStart
|
||||
by default
|
||||
|
||||
4.1. Browsing/Editing *trac-wiki-editing*
|
||||
|
||||
The WIKITOC_WINDOW will show a list of pages. Scrolling up and down and
|
||||
Pressing <return> on a page will open the selected page in the WIKI_WINDOW
|
||||
|
||||
Pressing <space> over the page in the WIKITOC_WINDOW will display the page
|
||||
in a browser
|
||||
|
||||
Trac sites usually have a bunch of in built pages Trac* or Wiki* you can
|
||||
hide these from view by setting the global variable in your vimrc. let
|
||||
g:tracHideTracWiki = 'yes'
|
||||
|
||||
At the moment this is done with a simple regexp so if you name your own
|
||||
pages Trac... or Wiki... they will not appear on the Table of Contents.
|
||||
|
||||
You can also load a page by pressing the usual tag jump <c-]> to open the
|
||||
page under the cursor. At the moment theres no page name validation so it
|
||||
will throw an error if you try an open a nonexistant page.
|
||||
|
||||
4.2. Adding/ Retrieving an Attachment *trac-wiki-attachments*
|
||||
|
||||
:TWAddAttachment [file_path] *:TWAddAttachment*
|
||||
|
||||
adds an attachment to the current active wiki page
|
||||
|
||||
:TWGetAttachment [file] *:TWGetAttachment*
|
||||
|
||||
gets an attachment from the active Wiki Page and save it to the current
|
||||
working directory.
|
||||
|
||||
If a Wiki page opened contains attachments The Wiki Attachment window will
|
||||
appear. Attachments can be downloaded by hovering over the desired
|
||||
attachment and pressing <enter>
|
||||
|
||||
4.3. HTML Preview *trac-wiki-htmlpreview*
|
||||
|
||||
:TTPreview *:TWPreview* *:TTPreview*
|
||||
|
||||
displays the current wiki in html preview (only tested on lynx set
|
||||
g:tracBrowser)
|
||||
|
||||
You can also use the shortcut <leader>tp
|
||||
|
||||
4.4. Saving Wiki's *trac-wiki-save*
|
||||
|
||||
To save a page you can type in the command view
|
||||
:TWSave [optional_wiki_update_comment] *:TWSave*
|
||||
|
||||
Alternatively you can quickly save a page with your regular :wq<cr> or :w<cr>
|
||||
which I've mapped to perform the TWSave? command.
|
||||
|
||||
Exiting Trac Wiki View
|
||||
|
||||
Exiting is done by either the command
|
||||
|
||||
:TClose, :wq<cr> or :q<cr> in either of the wiki windows
|
||||
|
||||
4.5 Wiki Vim Diffs *trac-wiki-diff*
|
||||
|
||||
:TWVimDiff <revision no> *:TWVimDiff*
|
||||
|
||||
Opens a vertical split diff The current wiki's <revision no>. If theres
|
||||
no argument supplied it will be the previous revision.
|
||||
|
||||
|
||||
================================================================================
|
||||
5. Trac Ticket View *trac-ticket-view*
|
||||
|
||||
The Trac ticket view is you browse trac tickets
|
||||
|
||||
Opening
|
||||
|
||||
:TTOpen [optional_ticket_id] *:TTOpen*
|
||||
|
||||
Browsing
|
||||
|
||||
You can scroll up and down the ticket list. Pressing enter will load the
|
||||
ticket id under the cursor.
|
||||
|
||||
|
||||
5.1 Ticket Filters *trac-ticket-filters*
|
||||
|
||||
:TTFilterMilestone [Milestone] *:TTFilterMilestone*
|
||||
:TTFilterType [Type] *:TTFilterType*
|
||||
:TTFilterStatus [Status] *:TTFilterStatus*
|
||||
:TTFilterResolution [Resolution *:TTFilterResolution*
|
||||
:TTFilterPriority [Priority] *:TTFilterPriority*
|
||||
:TTFilterSeverity [Severity] *:TTFilterSeverity*
|
||||
:TTFilterComponent [Component] *:TTFilterComponent*
|
||||
:TTFilterOwner [Owner] *:TTFilterOwner*
|
||||
|
||||
For filtering on respective ticket attributes. Allows a tab complete option
|
||||
for Filter acts as a whitelist ignoring all other tickets not matching the
|
||||
attribute
|
||||
|
||||
:TTIgnoreMilestone [Milestone] *:TTIgnoreMilestone*
|
||||
:TTIgnoreType [Type] *:TTIgnoreType*
|
||||
:TTIgnoreStatus [Status] *:TTIgnoreStatus*
|
||||
:TTIgnoreResolution [Resolution *:TTIgnoreResolution*
|
||||
:TTIgnorePriority [Priority] *:TTIgnorePriority*
|
||||
:TTIgnoreSeverity [Severity] *:TTIgnoreSeverity*
|
||||
:TTIgnoreComponent [Component] *:TTIgnoreComponent*
|
||||
:TTIgnoreOwner [Owner] *:TTIgnoreOwner*
|
||||
|
||||
The Opposite of TTFilter... acts as a blacklist filter on tickets.
|
||||
|
||||
:TTIgnoreNoMilestone [NoMilestone] *:TTIgnoreNoMilestone*
|
||||
:TTIgnoreNoOwner [NoOwner] *:TTIgnoreNoOwner*
|
||||
:TTFilterNoMilestone [NoMilestone] *:TTFilterNoMilestone*
|
||||
:TTFilterNoOwner [NoOwner] *:TTFilterNoOwner*
|
||||
|
||||
Special filters for tickets not owned or categorised
|
||||
|
||||
:TTClearAllFilters *:TTClearAllFilters*
|
||||
Resets the filter list to blank
|
||||
:TTClearFilter [filter no] *:TTClearFilter*
|
||||
Filter numbers and descriptions are displayed at the top of the ticket
|
||||
list. Using this filter will remove the filter number
|
||||
:TTListFilters *:TTListFilters*
|
||||
|
||||
5.1.2 Ticket Sorting *trac-ticket-sorting*
|
||||
|
||||
:TTSortby [sort_option] *:TTSortby*
|
||||
|
||||
Tickets can either be sorted according to milestone or priority. Milestones
|
||||
will appear in order of due date and ticket priority is arranged according
|
||||
to the trac-admin priority settings.
|
||||
|
||||
5.2. Adding Comments *trac-ticket-comments*
|
||||
|
||||
The TICKET_COMMENT window is for adding comments. To commit a comment write
|
||||
the message first and then type
|
||||
|
||||
:TTAddComment *:TTAddComment*
|
||||
|
||||
5.3. Changing ticket states *trac-ticket-changes*
|
||||
|
||||
Trac current ticket option modifications (use tab complete)
|
||||
|
||||
:TTSetMilestone [Milestone] *:TTSet*
|
||||
:TTSetType [Type]
|
||||
:TTSetStatus [Status]
|
||||
:TTSetResolution [Resolution]
|
||||
:TTSetPriority [Priority]
|
||||
:TTSetSeverity [Severity]
|
||||
:TTSetComponent [Component]
|
||||
:TTSetSummary [Summary]
|
||||
|
||||
The setting will immediately be sent to the server.
|
||||
|
||||
|
||||
:TTUpdateDescrption *:TTUpdateDescrption*
|
||||
|
||||
Takes the text from the TICKET_COMMENT_WINDOW and updates a tickets
|
||||
description. It will prompt for confirmation before committing
|
||||
|
||||
5.4. Creating Tickets *trac-ticket-create*
|
||||
|
||||
This is still a bit of a hack. If you add a description in the
|
||||
TICKET_COMMENT window and type the command
|
||||
|
||||
:TTCreateTask [ticket_summary] *TTCreateTask*
|
||||
:TTCreateDefect [ticket_summary] *TTCreateDefect*
|
||||
:TTCreateEnhancement [ticket_summary] *TTCreateEnhancement*
|
||||
|
||||
A new ticket will be created with the default attributes (set in trac.ini).
|
||||
When creating a ticket you can create a description initially in the
|
||||
TICKET_COMMENT_WINDOW or alternatively you can add a description later
|
||||
using |TTUpdateDescrption|.
|
||||
|
||||
5.5. Adding/Retrieving attachments *trac-ticket-attachments*
|
||||
|
||||
:TTAddAttachment [file_path] *TTAddAttachment*
|
||||
|
||||
Adds a ticket to the current open ticket
|
||||
:TTGetAttachment [file]
|
||||
|
||||
Retrieves an atteched file and saves it to the current working directory.
|
||||
File options for the current ticket may be viewed with <tab> completion.
|
||||
|
||||
5.6. Ticket Sessions *trac-ticket-session*
|
||||
|
||||
It's possible to associate a list of open files with a trac ticket on the
|
||||
local server which can be handy for reopening tickets another day to make
|
||||
further changes.
|
||||
|
||||
Note: the plugin needs a directory to write to by default it is
|
||||
let g:tracSessionDirectory = expand ('$HOME') . '/.vimtrac_session'
|
||||
|
||||
TTSaveTicketSession *TTSaveTicketSession*
|
||||
Saves the open files and line numbers to the active ticket. You must
|
||||
have a ticket open in the ticket view for this to take effect.
|
||||
|
||||
TTLoadTicketSession *TTLoadTicketSession*
|
||||
|
||||
Loads the Tickets Session information
|
||||
|
||||
5.7. Exiting
|
||||
|
||||
:TClose
|
||||
|
||||
or :q<cr> in either of the Ticket windows will close the view
|
||||
|
||||
================================================================================
|
||||
6. Trac Search View *trac-search-view*
|
||||
|
||||
*TSearch*
|
||||
:TSearch [search_term]
|
||||
|
||||
Opening Trac Search View
|
||||
|
||||
Will open search view containing matching wiki/ticket/changesets along with
|
||||
basic descrriptions
|
||||
|
||||
:TClose will close this view or a ticket/wiki view will open if an item is
|
||||
selected
|
||||
|
||||
================================================================================
|
||||
7. Changeset View *trac-changeset-view*
|
||||
|
||||
:TChangesetOpen [changeset_id] *:TChangesetOpen*
|
||||
|
||||
opens a unified diff changeset view in a split window
|
||||
|
||||
You can also open a changeset by pressing <enter> on a matching
|
||||
Changeset:>> line in the Trac Seatch window
|
||||
|
||||
================================================================================
|
||||
8. Timeline View *trac-timeline-view*
|
||||
|
||||
Timeline view requires feedparser.py installed.
|
||||
|
||||
http://www.feedparser.org/
|
||||
|
||||
The timeline view grabs the rss feed from a trac server.
|
||||
|
||||
:TTimelineOpen *:TTimelineOpen*
|
||||
|
||||
You can also open tickets, wikis and changesets by pressing <enter> on a
|
||||
matching Changeset:>>, Wiki:>> and Ticket:>> line
|
||||
================================================================================
|
||||
9. Trac Wiki Formatting *trac-format*
|
||||
|
||||
This reference is based on the trac wiki information provided with trac.
|
||||
(WikiFormatting) Made easier to read within vim. I'd suggest you read the
|
||||
document in your browser and use this as a quick refresher
|
||||
|
||||
Access this file with :TWikiFormat
|
||||
|
||||
|
||||
Wiki markup is a core feature in Trac, tightly integrating all the other
|
||||
parts of Trac into a flexible and powerful whole.
|
||||
|
||||
Trac has a built in small and powerful wiki rendering engine. This wiki
|
||||
engine implements an ever growing subset of the commands from other popular
|
||||
Wikis, especially [http://moinmoin.wikiwikiweb.de/ MoinMoin].
|
||||
|
||||
|
||||
This page demonstrates the formatting syntax available anywhere
|
||||
WikiFormatting is allowed.
|
||||
|
||||
|
||||
9.1 Font Styles *trac-format-font*
|
||||
|
||||
The Trac wiki supports the following font styles:
|
||||
{{{
|
||||
* '''bold''', '''!''' can be bold too''', and '''! '''
|
||||
* ''italic''
|
||||
* '''''bold italic'''''
|
||||
* __underline__
|
||||
* {{{monospace}}} or `monospace`
|
||||
* ~~strike-through~~
|
||||
* ^superscript^
|
||||
* ,,subscript,,
|
||||
}}}
|
||||
|
||||
|
||||
9.1 Notes: *trac-format-notes*
|
||||
|
||||
`{{{...}}}` and {{{`...`}}} commands not only select a monospace font, but
|
||||
also treat their content as verbatim text, meaning that no further wiki
|
||||
processing is done on this text.
|
||||
|
||||
{{{ ! }}} tells wiki parser to not take the following characters as wiki
|
||||
format, so pay attention to put a space after !, e.g. when ending bold.
|
||||
|
||||
9.2 Headings *trac-format-headings*
|
||||
|
||||
You can create heading by starting a line with one up to five ''equal''
|
||||
characters ("=") followed by a single space and the headline text. The line
|
||||
should end with a space followed by the same number of ''='' characters.
|
||||
The heading might optionally be followed by an explicit id. If not, an
|
||||
implicit but nevertheless readable id will be generated.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
= Heading =
|
||||
== Subheading ==
|
||||
=== About ''this'' ===
|
||||
=== Explicit id === #using-explicit-id-in-heading
|
||||
}}}
|
||||
|
||||
9.3 Paragraphs *trac-format-paragraphs*
|
||||
|
||||
A new text paragraph is created whenever two blocks of text are separated
|
||||
by one or more empty lines.
|
||||
|
||||
A forced line break can also be inserted, using:
|
||||
{{{
|
||||
Line 1[[BR]]Line 2
|
||||
}}}
|
||||
|
||||
|
||||
9.4 Lists *trac-format-lists*
|
||||
|
||||
The wiki supports both ordered/numbered and unordered lists.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
* Item 1
|
||||
* Item 1.1
|
||||
* Item 2
|
||||
|
||||
1. Item 1
|
||||
a. Item 1.a
|
||||
a. Item 1.b
|
||||
i. Item 1.b.i
|
||||
i. Item 1.b.ii
|
||||
1. Item 2
|
||||
And numbered lists can also be given an explicit number:
|
||||
3. Item 3
|
||||
}}}
|
||||
|
||||
Note that there must be one or more spaces preceding the list item markers,
|
||||
otherwise the list will be treated as a normal paragraph.
|
||||
|
||||
|
||||
9.4 Definition Lists *trac-format-definition*
|
||||
|
||||
The wiki also supports definition lists.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
llama::
|
||||
some kind of mammal, with hair
|
||||
ppython::
|
||||
some kind of reptile, without hair
|
||||
(can you spot the typo?)
|
||||
}}}
|
||||
|
||||
Note that you need a space in front of the defined term.
|
||||
|
||||
|
||||
9.5 Preformatted Text *trac-format-preformatted*
|
||||
|
||||
Block containing preformatted text are suitable for source code snippets,
|
||||
notes and examples. Use three ''curly braces'' wrapped around the text to
|
||||
define a block quote. The curly braces need to be on a separate line.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
{{{
|
||||
def HelloWorld():
|
||||
print "Hello World"
|
||||
}}}
|
||||
}}}
|
||||
|
||||
9.6 Blockquotes *trac-format-blockquotes*
|
||||
|
||||
In order to mark a paragraph as blockquote, indent that paragraph with two
|
||||
spaces.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
This text is a quote from someone else.
|
||||
}}}
|
||||
|
||||
9.7 Discussion Citations *trac-format-discussion*
|
||||
|
||||
To delineate a citation in an ongoing discussion thread, such as the ticket
|
||||
comment area, e-mail-like citation marks (">", ">>", etc.) may be used.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
>> Someone's original text
|
||||
> Someone else's reply text
|
||||
My reply text
|
||||
}}}
|
||||
|
||||
|
||||
''Note: Some WikiFormatting elements, such as lists and preformatted text,
|
||||
are lost in the citation area. Some reformatting may be necessary to
|
||||
create a clear citation.''
|
||||
|
||||
9.8 Tables *trac-format-tables*
|
||||
|
||||
Simple tables can be created like this:
|
||||
{{{
|
||||
||Cell 1||Cell 2||Cell 3||
|
||||
||Cell 4||Cell 5||Cell 6||
|
||||
}}}
|
||||
|
||||
Note that more complex tables can be created using
|
||||
[wiki:WikiRestructuredText#BiggerReSTExample reStructuredText].
|
||||
|
||||
|
||||
9.9 Links *trac-format-links*
|
||||
|
||||
Hyperlinks are automatically created for WikiPageNames and URLs.
|
||||
!WikiPageLinks can be disabled by prepending an exclamation mark "!"
|
||||
character, such as {{{!WikiPageLink}}}.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
TitleIndex, http://www.edgewall.com/, !NotAlink
|
||||
}}}
|
||||
|
||||
Links can be given a more descriptive title by writing the link followed by
|
||||
a space and a title and all this inside square brackets. If the
|
||||
descriptive title is omitted, then the explicit prefix is discarded, unless
|
||||
the link is an external link. This can be useful for wiki pages not
|
||||
adhering to the WikiPageNames convention.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
* [http://www.edgewall.com/ Edgewall Software]
|
||||
* [wiki:TitleIndex Title Index]
|
||||
* [wiki:ISO9000]
|
||||
}}}
|
||||
|
||||
9.9.1 Trac Links *trac-format-traclinks*
|
||||
|
||||
Wiki pages can link directly to other parts of the Trac system. Pages can
|
||||
refer to tickets, reports, changesets, milestones, source files and other
|
||||
Wiki pages using the following notations:
|
||||
|
||||
{{{
|
||||
* Tickets: #1 or ticket:1
|
||||
* Reports: {1} or report:1
|
||||
* Changesets: r1, [1] or changeset:1
|
||||
* ...
|
||||
}}}
|
||||
|
||||
See TracLinks for more in-depth information.
|
||||
|
||||
|
||||
9.10 Escaping Links and WikiPageNames *trac-format-nolink*
|
||||
|
||||
You may avoid making hyperlinks out of TracLinks by preceding an expression
|
||||
with a single "!" (exclamation mark).
|
||||
|
||||
Example:
|
||||
{{{
|
||||
!NoHyperLink
|
||||
!#42 is not a link
|
||||
}}}
|
||||
|
||||
9.11 Images *trac-format-images*
|
||||
|
||||
Urls ending with `.png`, `.gif` or `.jpg` are no longer automatically
|
||||
interpreted as image links, and converted to `<img>` tags.
|
||||
|
||||
You now have to use the ![[Image]] macro (see below).
|
||||
|
||||
|
||||
9.12 Macros *trac-format-macros*
|
||||
|
||||
Macros are ''custom functions'' to insert dynamic content in a page.
|
||||
|
||||
Example:
|
||||
{{{
|
||||
[[Timestamp]]
|
||||
}}}
|
||||
|
||||
|
||||
See WikiMacros for more information, and a list of installed macros.
|
||||
|
||||
|
||||
9.13 Processors *trac-format-processors*
|
||||
|
||||
Trac supports alternative markup formats using WikiProcessors. For example,
|
||||
processors are used to write pages in
|
||||
[wiki:WikiRestructuredText reStructuredText] or [wiki:WikiHtml HTML].
|
||||
|
||||
Example 1:
|
||||
{{{
|
||||
#!html
|
||||
<pre class="wiki">{{{
|
||||
#!html
|
||||
<h1 style="text-align: right; color: blue">HTML Test</h1>
|
||||
}}}</pre>
|
||||
}}}
|
||||
|
||||
Example:
|
||||
{{{
|
||||
#!html
|
||||
<pre class="wiki">{{{
|
||||
#!python
|
||||
class Test:
|
||||
|
||||
def __init__(self):
|
||||
print "Hello World"
|
||||
if __name__ == '__main__':
|
||||
Test()
|
||||
}}}</pre>
|
||||
}}}
|
||||
|
||||
|
||||
Perl:
|
||||
{{{
|
||||
#!perl
|
||||
my ($test) = 0;
|
||||
if ($test > 0) {
|
||||
print "hello";
|
||||
}
|
||||
}}}
|
||||
|
||||
See WikiProcessors for more information.
|
||||
|
||||
|
||||
9.14 Miscellaneous *trac-format-misc*
|
||||
|
||||
Four or more dashes will be replaced by a horizontal line (<HR>)
|
||||
|
||||
Example:
|
||||
{{{
|
||||
----
|
||||
}}}
|
||||
|
||||
See also: TracLinks, TracGuide, WikiHtml, WikiMacros, WikiProcessors,
|
||||
TracSyntaxColoring.
|
|
@ -1,843 +0,0 @@
|
|||
*vcscommand.txt* vcscommand
|
||||
Copyright (c) Bob Hiestand
|
||||
|
||||
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.
|
||||
|
||||
For instructions on installing this file, type
|
||||
:help add-local-help
|
||||
inside Vim.
|
||||
|
||||
Author: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
Credits: Benji Fisher's excellent MatchIt documentation
|
||||
|
||||
==============================================================================
|
||||
1. Contents *vcscommand-contents*
|
||||
|
||||
Installation : |vcscommand-install|
|
||||
vcscommand Intro : |vcscommand|
|
||||
vcscommand Manual : |vcscommand-manual|
|
||||
Customization : |vcscommand-customize|
|
||||
SSH "integration" : |vcscommand-ssh|
|
||||
Changes from cvscommand : |cvscommand-changes|
|
||||
Bugs : |vcscommand-bugs|
|
||||
|
||||
==============================================================================
|
||||
|
||||
2. vcscommand Installation *vcscommand-install*
|
||||
|
||||
The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim,
|
||||
vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install
|
||||
the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim
|
||||
files into a plugin directory in your runtime path (please see
|
||||
|add-global-plugin| and |'runtimepath'|.
|
||||
|
||||
This help file can be included in the VIM help system by copying it into a
|
||||
'doc' directory in your runtime path and then executing the |:helptags|
|
||||
command, specifying the full path of the 'doc' directory. Please see
|
||||
|add-local-help| for more details.
|
||||
|
||||
vcscommand may be customized by setting variables, creating maps, and
|
||||
specifying event handlers. Please see |vcscommand-customize| for more
|
||||
details.
|
||||
|
||||
==============================================================================
|
||||
|
||||
3. vcscommand Intro *vcscommand*
|
||||
*vcscommand-intro*
|
||||
|
||||
The vcscommand plugin provides global ex commands for manipulating
|
||||
version-controlled source files, currently those controlled either by CVS or
|
||||
Subversion. In general, each command operates on the current buffer and
|
||||
accomplishes a separate source control function, such as update, commit, log,
|
||||
and others (please see |vcscommand-commands| for a list of all available
|
||||
commands). The results of each operation are displayed in a scratch buffer.
|
||||
Several buffer variables are defined for those scratch buffers (please see
|
||||
|vcscommand-buffer-variables|).
|
||||
|
||||
The notion of "current file" means either the current buffer, or, in the case
|
||||
of a directory buffer (such as Explorer or netrw buffers), the directory (and
|
||||
all subdirectories) represented by the the buffer.
|
||||
|
||||
For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as
|
||||
though it was invoked on the original file and splits the screen so that the
|
||||
output appears in a new window.
|
||||
|
||||
Many of the commands accept revisions as arguments. By default, most operate
|
||||
on the most recent revision on the current branch if no revision is specified.
|
||||
|
||||
Each vcscommand is mapped to a key sequence starting with the |<Leader>|
|
||||
keystroke. The default mappings may be overridden by supplying different
|
||||
mappings before the plugin is loaded, such as in the vimrc, in the standard
|
||||
fashion for plugin mappings. For examples, please see
|
||||
|vcscommand-mappings-override|.
|
||||
|
||||
The vcscommand plugin may be configured in several ways. For more details,
|
||||
please see |vcscommand-customize|.
|
||||
|
||||
==============================================================================
|
||||
|
||||
4. vcscommand Manual *vcscommand-manual*
|
||||
|
||||
4.1 vcscommand commands *vcscommand-commands*
|
||||
|
||||
vcscommand defines the following commands:
|
||||
|
||||
|:VCSAdd|
|
||||
|:VCSAnnotate|
|
||||
|:VCSBlame|
|
||||
|:VCSCommit|
|
||||
|:VCSDelete|
|
||||
|:VCSDiff|
|
||||
|:VCSGotoOriginal|
|
||||
|:VCSLog|
|
||||
|:VCSRemove|
|
||||
|:VCSRevert|
|
||||
|:VCSReview|
|
||||
|:VCSStatus|
|
||||
|:VCSUpdate|
|
||||
|:VCSVimDiff|
|
||||
|
||||
The following commands are specific to CVS files:
|
||||
|
||||
|:CVSEdit|
|
||||
|:CVSEditors|
|
||||
|:CVSUnedit|
|
||||
|:CVSWatch|
|
||||
|:CVSWatchAdd|
|
||||
|:CVSWatchOn|
|
||||
|:CVSWatchOff|
|
||||
|:CVSWatchRemove|
|
||||
|:CVSWatchers|
|
||||
|
||||
:VCSAdd *:VCSAdd*
|
||||
|
||||
This command adds the current file to source control. Please note, this does
|
||||
not commit the newly-added file. All parameters to the command are passed to
|
||||
the underlying VCS.
|
||||
|
||||
:VCSAnnotate[!] *:VCSAnnotate*
|
||||
|
||||
This command displays the current file with each line annotated with the
|
||||
version in which it was most recently changed. If an argument is given, the
|
||||
argument is used as a revision number to display. If not given an argument,
|
||||
it uses the most recent version of the file (on the current branch, if under
|
||||
CVS control). Additionally, if the current buffer is a VCSAnnotate buffer
|
||||
already, the version number on the current line is used.
|
||||
|
||||
If '!' is used, the view of the annotated buffer is split so that the
|
||||
annotation is in a separate window from the content, and each is highlighted
|
||||
separately.
|
||||
|
||||
For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
|
||||
will cause the above behavior to change. Instead of annotating the version on
|
||||
the current line, the parent revision is used instead, crossing branches if
|
||||
necessary.
|
||||
|
||||
With no arguments the cursor will jump to the line in the annotated buffer
|
||||
corresponding to the current line in the source buffer.
|
||||
|
||||
:VCSBlame[!] *:VCSBlame*
|
||||
|
||||
Alias for |:VCSAnnotate|.
|
||||
|
||||
:VCSCommit[!] *:VCSCommit*
|
||||
|
||||
This command commits changes to the current file to source control.
|
||||
|
||||
If called with arguments, the arguments are the log message.
|
||||
|
||||
If '!' is used, an empty log message is committed.
|
||||
|
||||
If called with no arguments, this is a two-step command. The first step opens
|
||||
a buffer to accept a log message. When that buffer is written, it is
|
||||
automatically closed and the file is committed using the information from that
|
||||
log message. The commit can be abandoned if the log message buffer is deleted
|
||||
or wiped before being written.
|
||||
|
||||
Alternatively, the mapping that is used to invoke :VCSCommit (by default
|
||||
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
|
||||
buffer in Normal mode to immediately commit. This is useful if the
|
||||
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
|
||||
commit-on-write behavior.
|
||||
|
||||
:VCSDelete *:VCSDelete*
|
||||
|
||||
Deletes the current file and removes it from source control. All parameters
|
||||
to the command are passed to the underlying VCS.
|
||||
|
||||
:VCSDiff *:VCSDiff*
|
||||
|
||||
With no arguments, this displays the differences between the current file and
|
||||
its parent version under source control in a new scratch buffer.
|
||||
|
||||
With one argument, the diff is performed on the current file against the
|
||||
specified revision.
|
||||
|
||||
With two arguments, the diff is performed between the specified revisions of
|
||||
the current file.
|
||||
|
||||
For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff
|
||||
options. If that variable does not exist, a plugin-specific default is used.
|
||||
If you wish to have no options, then set it to the empty string.
|
||||
|
||||
For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff
|
||||
options. If that variable does not exist, the SVN default is used.
|
||||
Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff
|
||||
application.
|
||||
|
||||
:VCSGotoOriginal *:VCSGotoOriginal*
|
||||
|
||||
This command jumps to the source buffer if the current buffer is a VCS scratch
|
||||
buffer.
|
||||
|
||||
:VCSGotoOriginal!
|
||||
|
||||
Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach
|
||||
buffers associated with the original file.
|
||||
|
||||
:VCSInfo *:VCSInfo*
|
||||
|
||||
This command displays extended information about the current file in a new
|
||||
scratch buffer.
|
||||
|
||||
:VCSLock *:VCSLock*
|
||||
|
||||
This command locks the current file in order to prevent other users from
|
||||
concurrently modifying it. The exact semantics of this command depend on the
|
||||
underlying VCS. This does nothing in CVS. All parameters are passed to the
|
||||
underlying VCS.
|
||||
|
||||
:VCSLog *:VCSLog*
|
||||
|
||||
Displays the version history of the current file in a new scratch buffer. If
|
||||
there is one parameter supplied, it is taken as as a revision parameters to be
|
||||
passed through to the underlying VCS. Otherwise, all parameters are passed to
|
||||
the underlying VCS.
|
||||
|
||||
:VCSRemove *:VCSRemove*
|
||||
|
||||
Alias for |:VCSDelete|.
|
||||
|
||||
:VCSRevert *:VCSRevert*
|
||||
|
||||
This command replaces the current file with the most recent version from the
|
||||
repository in order to wipe out any undesired changes.
|
||||
|
||||
:VCSReview *:VCSReview*
|
||||
|
||||
Displays a particular version of the current file in a new scratch buffer. If
|
||||
no argument is given, the most recent version of the file on the current
|
||||
branch is retrieved.
|
||||
|
||||
:VCSStatus *:VCSStatus*
|
||||
|
||||
Displays versioning information about the current file in a new scratch
|
||||
buffer. All parameters are passed to the underlying VCS.
|
||||
|
||||
|
||||
:VCSUnlock *:VCSUnlock*
|
||||
|
||||
Unlocks the current file in order to allow other users from concurrently
|
||||
modifying it. The exact semantics of this command depend on the underlying
|
||||
VCS. All parameters are passed to the underlying VCS.
|
||||
|
||||
:VCSUpdate *:VCSUpdate*
|
||||
|
||||
Updates the current file with any relevant changes from the repository. This
|
||||
intentionally does not automatically reload the current buffer, though vim
|
||||
should prompt the user to do so if the underlying file is altered by this
|
||||
command.
|
||||
|
||||
:VCSVimDiff *:VCSVimDiff*
|
||||
|
||||
Uses vimdiff to display differences between versions of the current file.
|
||||
|
||||
If no revision is specified, the most recent version of the file on the
|
||||
current branch is used. With one argument, that argument is used as the
|
||||
revision as above. With two arguments, the differences between the two
|
||||
revisions is displayed using vimdiff.
|
||||
|
||||
With either zero or one argument, the original buffer is used to perform the
|
||||
vimdiff. When the scratch buffer is closed, the original buffer will be
|
||||
returned to normal mode.
|
||||
|
||||
Once vimdiff mode is started using the above methods, additional vimdiff
|
||||
buffers may be added by passing a single version argument to the command.
|
||||
There may be up to 4 vimdiff buffers total.
|
||||
|
||||
Using the 2-argument form of the command resets the vimdiff to only those 2
|
||||
versions. Additionally, invoking the command on a different file will close
|
||||
the previous vimdiff buffers.
|
||||
|
||||
:CVSEdit *:CVSEdit*
|
||||
|
||||
This command performs "cvs edit" on the current file. Yes, the output buffer
|
||||
in this case is almost completely useless.
|
||||
|
||||
:CVSEditors *:CVSEditors*
|
||||
|
||||
This command performs "cvs edit" on the current file.
|
||||
|
||||
:CVSUnedit *:CVSUnedit*
|
||||
|
||||
Performs "cvs unedit" on the current file. Again, yes, the output buffer here
|
||||
is basically useless.
|
||||
|
||||
:CVSWatch *:CVSWatch*
|
||||
|
||||
This command takes an argument which must be one of [on|off|add|remove]. The
|
||||
command performs "cvs watch" with the given argument on the current file.
|
||||
|
||||
:CVSWatchAdd *:CVSWatchAdd*
|
||||
|
||||
This command is an alias for ":CVSWatch add"
|
||||
|
||||
:CVSWatchOn *:CVSWatchOn*
|
||||
|
||||
This command is an alias for ":CVSWatch on"
|
||||
|
||||
:CVSWatchOff *:CVSWatchOff*
|
||||
|
||||
This command is an alias for ":CVSWatch off"
|
||||
|
||||
:CVSWatchRemove *:CVSWatchRemove*
|
||||
|
||||
This command is an alias for ":CVSWatch remove"
|
||||
|
||||
:CVSWatchers *:CVSWatchers*
|
||||
|
||||
This command performs "cvs watchers" on the current file.
|
||||
|
||||
4.2 Mappings *vcscommand-mappings*
|
||||
|
||||
By default, a mapping is defined for each command. These mappings execute the
|
||||
default (no-argument) form of each command.
|
||||
|
||||
|<Leader>|ca VCSAdd
|
||||
|<Leader>|cn VCSAnnotate
|
||||
|<Leader>|cN VCSAnnotate!
|
||||
|<Leader>|cc VCSCommit
|
||||
|<Leader>|cD VCSDelete
|
||||
|<Leader>|cd VCSDiff
|
||||
|<Leader>|cg VCSGotoOriginal
|
||||
|<Leader>|cG VCSGotoOriginal!
|
||||
|<Leader>|ci VCSInfo
|
||||
|<Leader>|cl VCSLog
|
||||
|<Leader>|cL VCSLock
|
||||
|<Leader>|cr VCSReview
|
||||
|<Leader>|cs VCSStatus
|
||||
|<Leader>|cu VCSUpdate
|
||||
|<Leader>|cU VCSUnlock
|
||||
|<Leader>|cv VCSVimDiff
|
||||
|
||||
Only for CVS buffers:
|
||||
|
||||
|<Leader>|ce CVSEdit
|
||||
|<Leader>|cE CVSEditors
|
||||
|<Leader>|ct CVSUnedit
|
||||
|<Leader>|cwv CVSWatchers
|
||||
|<Leader>|cwa CVSWatchAdd
|
||||
|<Leader>|cwn CVSWatchOn
|
||||
|<Leader>|cwf CVSWatchOff
|
||||
|<Leader>|cwf CVSWatchRemove
|
||||
|
||||
*vcscommand-mappings-override*
|
||||
|
||||
The default mappings can be overridden by user-provided instead by mapping to
|
||||
<Plug>CommandName. This is especially useful when these mappings collide with
|
||||
other existing mappings (vim will warn of this during plugin initialization,
|
||||
but will not clobber the existing mappings).
|
||||
|
||||
There are three methods for controlling mapping:
|
||||
|
||||
First, maps can be overriden for individual commands. For instance, to
|
||||
override the default mapping for :VCSAdd to set it to '\add', add the
|
||||
following to the vimrc:
|
||||
|
||||
nmap \add <Plug>VCSAdd
|
||||
|
||||
Second, the default map prefix ('<Leader>c') can be overridden by defining the
|
||||
|VCSCommandMapPrefix| variable.
|
||||
|
||||
Third, the entire set of default maps can be overridden by defining the
|
||||
|VCSCommandMappings| variable.
|
||||
|
||||
|
||||
4.3 Automatic buffer variables *vcscommand-buffer-variables*
|
||||
|
||||
Several buffer variables are defined in each vcscommand result buffer. These
|
||||
may be useful for additional customization in callbacks defined in the event
|
||||
handlers (please see |vcscommand-events|).
|
||||
|
||||
The following variables are automatically defined:
|
||||
|
||||
b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer*
|
||||
|
||||
This variable is set to the buffer number of the source file.
|
||||
|
||||
b:VCSCommandCommand *b:VCSCommandCommand*
|
||||
|
||||
This variable is set to the name of the vcscommand that created the result
|
||||
buffer.
|
||||
|
||||
b:VCSCommandSourceFile *b:VCSCommandSourceFile*
|
||||
|
||||
This variable is set to the name of the original file under source control.
|
||||
|
||||
b:VCSCommandVCSType *b:VCSCommandVCSType*
|
||||
|
||||
This variable is set to the type of the source control. This variable is also
|
||||
set on the original file itself.
|
||||
==============================================================================
|
||||
|
||||
5. Configuration and customization *vcscommand-customize*
|
||||
*vcscommand-config*
|
||||
|
||||
The vcscommand plugin can be configured in several ways: by setting
|
||||
configuration variables (see |vcscommand-options|) or by defining vcscommand
|
||||
event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin
|
||||
supports a customized status line (see |vcscommand-statusline| and
|
||||
|vcscommand-buffer-management|).
|
||||
|
||||
5.1 vcscommand configuration variables *vcscommand-options*
|
||||
|
||||
Several variables affect the plugin's behavior. These variables are checked
|
||||
at time of execution, and may be defined at the window, buffer, or global
|
||||
level and are checked in that order of precedence.
|
||||
|
||||
|
||||
The following variables are available:
|
||||
|
||||
|VCSCommandCommitOnWrite|
|
||||
|VCSCommandCVSDiffOpt|
|
||||
|VCSCommandCVSExec|
|
||||
|VCSCommandDeleteOnHide|
|
||||
|VCSCommandDiffSplit|
|
||||
|VCSCommandDisableAll|
|
||||
|VCSCommandDisableMappings|
|
||||
|VCSCommandDisableExtensionMappings|
|
||||
|VCSCommandDisableMenu|
|
||||
|VCSCommandEdit|
|
||||
|VCSCommandEnableBufferSetup|
|
||||
|VCSCommandMappings|
|
||||
|VCSCommandMapPrefix|
|
||||
|VCSCommandMenuPriority|
|
||||
|VCSCommandMenuRoot|
|
||||
|VCSCommandResultBufferNameExtension|
|
||||
|VCSCommandResultBufferNameFunction|
|
||||
|VCSCommandSplit|
|
||||
|VCSCommandSVKExec|
|
||||
|VCSCommandSVNDiffExt|
|
||||
|VCSCommandSVNDiffOpt|
|
||||
|VCSCommandSVNExec|
|
||||
|VCSCommandVCSTypeOverride|
|
||||
|VCSCommandVCSTypePreference|
|
||||
|
||||
VCSCommandCommitOnWrite *VCSCommandCommitOnWrite*
|
||||
|
||||
This variable, if set to a non-zero value, causes the pending commit
|
||||
to take place immediately as soon as the log message buffer is written.
|
||||
If set to zero, only the VCSCommit mapping will cause the pending commit to
|
||||
occur. If not set, it defaults to 1.
|
||||
|
||||
VCSCommandCVSExec *VCSCommandCVSExec*
|
||||
|
||||
This variable controls the executable used for all CVS commands If not set,
|
||||
it defaults to "cvs".
|
||||
|
||||
VCSCommandDeleteOnHide *VCSCommandDeleteOnHide*
|
||||
|
||||
This variable, if set to a non-zero value, causes the temporary result buffers
|
||||
to automatically delete themselves when hidden.
|
||||
|
||||
VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt*
|
||||
|
||||
This variable, if set, determines the options passed to the diff command of
|
||||
CVS. If not set, it defaults to 'u'.
|
||||
|
||||
VCSCommandDiffSplit *VCSCommandDiffSplit*
|
||||
|
||||
This variable overrides the |VCSCommandSplit| variable, but only for buffers
|
||||
created with |:VCSVimDiff|.
|
||||
|
||||
VCSCommandDisableAll *VCSCommandDisableAll*
|
||||
|
||||
This variable, if set, prevents the plugin or any extensions from loading at
|
||||
all. This is useful when a single runtime distribution is used on multiple
|
||||
systems with varying versions.
|
||||
|
||||
VCSCommandDisableMappings *VCSCommandDisableMappings*
|
||||
|
||||
This variable, if set to a non-zero value, prevents the default command
|
||||
mappings from being set. This supercedes
|
||||
|VCSCommandDisableExtensionMappings|.
|
||||
|
||||
VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings*
|
||||
|
||||
This variable, if set to a non-zero value, prevents the default command
|
||||
mappings from being set for commands specific to an individual VCS.
|
||||
|
||||
VCSCommandEdit *VCSCommandEdit*
|
||||
|
||||
This variable controls whether the original buffer is replaced ('edit') or
|
||||
split ('split'). If not set, it defaults to 'split'.
|
||||
|
||||
VCSCommandDisableMenu *VCSCommandDisableMenu*
|
||||
|
||||
This variable, if set to a non-zero value, prevents the default command menu
|
||||
from being set.
|
||||
|
||||
VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup*
|
||||
|
||||
This variable, if set to a non-zero value, activates VCS buffer management
|
||||
mode see (|vcscommand-buffer-management|). This mode means that the
|
||||
'VCSCommandBufferInfo' variable is filled with version information if the file
|
||||
is VCS-controlled. This is useful for displaying version information in the
|
||||
status bar.
|
||||
|
||||
VCSCommandMappings *VCSCommandMappings*
|
||||
|
||||
This variable, if set, overrides the default mappings used for shortcuts. It
|
||||
should be a List of 2-element Lists, each containing a shortcut and function
|
||||
name pair. The value of the '|VCSCommandMapPrefix|' variable will be added to
|
||||
each shortcut.
|
||||
|
||||
VCSCommandMapPrefix *VCSCommandMapPrefix*
|
||||
|
||||
This variable, if set, overrides the default mapping prefix ('<Leader>c').
|
||||
This allows customization of the mapping space used by the vcscommand
|
||||
shortcuts.
|
||||
|
||||
VCSCommandMenuPriority *VCSCommandMenuPriority*
|
||||
|
||||
This variable, if set, overrides the default menu priority '' (empty)
|
||||
|
||||
VCSCommandMenuRoot *VCSCommandMenuRoot*
|
||||
|
||||
This variable, if set, overrides the default menu root 'Plugin.VCS'
|
||||
|
||||
VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension*
|
||||
|
||||
This variable, if set to a non-blank value, is appended to the name of the VCS
|
||||
command output buffers. For example, '.vcs'. Using this option may help
|
||||
avoid problems caused by autocommands dependent on file extension.
|
||||
|
||||
VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction*
|
||||
|
||||
This variable, if set, specifies a custom function for naming VCS command
|
||||
output buffers. This function is expected to return the new buffer name, and
|
||||
will be passed the following arguments:
|
||||
|
||||
command - name of the VCS command being executed (such as 'Log' or
|
||||
'Diff').
|
||||
|
||||
originalBuffer - buffer number of the source file.
|
||||
|
||||
vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN').
|
||||
|
||||
statusText - extra text associated with the VCS action (such as version
|
||||
numbers).
|
||||
|
||||
VCSCommandSplit *VCSCommandSplit*
|
||||
|
||||
This variable controls the orientation of the various window splits that
|
||||
may occur.
|
||||
|
||||
If set to 'horizontal', the resulting windows will be on stacked on top of
|
||||
one another. If set to 'vertical', the resulting windows will be
|
||||
side-by-side. If not set, it defaults to 'horizontal' for all but
|
||||
VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt'
|
||||
setting, if set, otherwise 'vertical'.
|
||||
|
||||
VCSCommandSVKExec *VCSCommandSVKExec*
|
||||
|
||||
This variable controls the executable used for all SVK commands If not set,
|
||||
it defaults to "svk".
|
||||
|
||||
VCSCommandSVNDiffExt *VCSCommandSVNDiffExt*
|
||||
|
||||
This variable, if set, is passed to SVN via the --diff-cmd command to select
|
||||
an external application for performing the diff.
|
||||
|
||||
VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt*
|
||||
|
||||
This variable, if set, determines the options passed with the '-x' parameter
|
||||
to the SVN diff command. If not set, no options are passed.
|
||||
|
||||
VCSCommandSVNExec *VCSCommandSVNExec*
|
||||
|
||||
This variable controls the executable used for all SVN commands If not set,
|
||||
it defaults to "svn".
|
||||
|
||||
VCSCommandVCSTypeOverride *VCSCommandVCSTypeOverride*
|
||||
|
||||
This variable allows the VCS type detection to be overridden on a path-by-path
|
||||
basis. The value of this variable is expected to be a List of Lists. Each
|
||||
item in the high-level List is a List containing two elements. The first
|
||||
element is a regular expression that will be matched against the full file
|
||||
name of a given buffer. If it matches, the second element will be used as the
|
||||
VCS type.
|
||||
|
||||
VCSCommandVCSTypePreference *VCSCommandVCSTypePreference*
|
||||
|
||||
This variable allows the VCS type detection to be weighted towards a specific
|
||||
VCS, in case more than one potential VCS is detected as useable. The format
|
||||
of the variable is either a list or a space-separated string containing the
|
||||
ordered-by-preference abbreviations of the preferred VCS types.
|
||||
|
||||
5.2 VCSCommand events *vcscommand-events*
|
||||
|
||||
For additional customization, vcscommand can trigger user-defined events.
|
||||
Event handlers are provided by defining User event autocommands (see
|
||||
|autocommand|, |User|) in the vcscommand group with patterns matching the
|
||||
event name.
|
||||
|
||||
For instance, the following could be added to the vimrc to provide a 'q'
|
||||
mapping to quit a vcscommand scratch buffer:
|
||||
|
||||
augroup VCSCommand
|
||||
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
|
||||
augroup END
|
||||
|
||||
The following hooks are available:
|
||||
|
||||
VCSBufferCreated This event is fired just after a vcscommand
|
||||
result buffer is created and populated. It is
|
||||
executed within the context of the vcscommand
|
||||
buffer. The vcscommand buffer variables may
|
||||
be useful for handlers of this event (please
|
||||
see |vcscommand-buffer-variables|).
|
||||
|
||||
VCSBufferSetup This event is fired just after vcscommand buffer
|
||||
setup occurs, if enabled.
|
||||
|
||||
VCSPluginInit This event is fired when the vcscommand plugin
|
||||
first loads.
|
||||
|
||||
VCSPluginFinish This event is fired just after the vcscommand
|
||||
plugin loads.
|
||||
|
||||
VCSVimDiffFinish This event is fired just after the VCSVimDiff
|
||||
command executes to allow customization of,
|
||||
for instance, window placement and focus.
|
||||
|
||||
Additionally, there is another hook which is used internally to handle loading
|
||||
the multiple scripts in order. This hook should probably not be used by an
|
||||
end user without a good idea of how it works. Among other things, any events
|
||||
associated with this hook are cleared after they are executed (during
|
||||
vcscommand.vim script initialization).
|
||||
|
||||
VCSLoadExtensions This event is fired just before the
|
||||
VCSPluginFinish. It is used internally to
|
||||
execute any commands from the VCS
|
||||
implementation plugins that needs to be
|
||||
deferred until the primary plugin is
|
||||
initialized.
|
||||
|
||||
5.3 vcscommand buffer naming *vcscommand-naming*
|
||||
|
||||
vcscommand result buffers use the following naming convention:
|
||||
[{VCS type} {VCS command} {Source file name}]
|
||||
|
||||
If additional buffers are created that would otherwise conflict, a
|
||||
distinguishing number is added:
|
||||
|
||||
[{VCS type} {VCS command} {Source file name}] (1,2, etc)
|
||||
|
||||
5.4 vcscommand status line support *vcscommand-statusline*
|
||||
|
||||
It is intended that the user will customize the |'statusline'| option to
|
||||
include vcscommand result buffer attributes. A sample function that may be
|
||||
used in the |'statusline'| option is provided by the plugin,
|
||||
VCSCommandGetStatusLine(). In order to use that function in the status line, do
|
||||
something like the following:
|
||||
|
||||
set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P
|
||||
|
||||
of which %{VCSCommandGetStatusLine()} is the relevant portion.
|
||||
|
||||
The sample VCSCommandGetStatusLine() function handles both vcscommand result
|
||||
buffers and VCS-managed files if vcscommand buffer management is enabled
|
||||
(please see |vcscommand-buffer-management|).
|
||||
|
||||
5.5 vcscommand buffer management *vcscommand-buffer-management*
|
||||
|
||||
The vcscommand plugin can operate in buffer management mode, which means that
|
||||
it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into
|
||||
a buffer. This is rather slow because it means that the VCS will be invoked
|
||||
at each entry into a buffer (during the |BufEnter| autocommand).
|
||||
|
||||
This mode is disabled by default. In order to enable it, set the
|
||||
|VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling
|
||||
this mode simply provides the buffer variable mentioned above. The user must
|
||||
explicitly include information from the variable in the |'statusline'| option
|
||||
if they are to appear in the status line (but see |vcscommand-statusline| for
|
||||
a simple way to do that).
|
||||
|
||||
The 'VCSCommandBufferInfo' variable is a list which contains, in order, the
|
||||
revision of the current file, the latest revision of the file in the
|
||||
repository, and (for CVS) the name of the branch. If those values cannot be
|
||||
determined, the list is a single element: 'Unknown'.
|
||||
|
||||
==============================================================================
|
||||
|
||||
6. SSH "integration" *vcscommand-ssh*
|
||||
|
||||
The following instructions are intended for use in integrating the
|
||||
vcscommand.vim plugin with an SSH-based CVS environment.
|
||||
|
||||
Familiarity with SSH and CVS are assumed.
|
||||
|
||||
These instructions assume that the intent is to have a message box pop up in
|
||||
order to allow the user to enter a passphrase. If, instead, the user is
|
||||
comfortable using certificate-based authentication, then only instructions
|
||||
6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then
|
||||
work transparently.
|
||||
|
||||
6.1 Environment settings *vcscommand-ssh-env*
|
||||
|
||||
6.1.1 CVSROOT should be set to something like:
|
||||
|
||||
:ext:user@host:/path_to_repository
|
||||
|
||||
6.1.2 CVS_RSH should be set to:
|
||||
|
||||
ssh
|
||||
|
||||
Together, those settings tell CVS to use ssh as the transport when
|
||||
performing CVS calls.
|
||||
|
||||
6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case,
|
||||
running gnome, it's set to:
|
||||
|
||||
/usr/libexec/openssh/gnome-ssh-askpass
|
||||
|
||||
This tells SSH how to get passwords if no input is available.
|
||||
|
||||
6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs
|
||||
executable on the remote (server) machine.
|
||||
|
||||
6.2 CVS wrapper program *vcscommand-ssh-wrapper*
|
||||
|
||||
Now you need to convince SSH to use the password-dialog program. This means
|
||||
you need to execute SSH (and therefore CVS) without standard input. The
|
||||
following script is a simple perl wrapper that dissasociates the CVS command
|
||||
from the current terminal. Specific steps to do this may vary from system to
|
||||
system; the following example works for me on linux.
|
||||
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use POSIX qw(setsid);
|
||||
open STDIN, '/dev/null';
|
||||
fork and do {wait; exit;};
|
||||
setsid;
|
||||
exec('cvs', @ARGV);
|
||||
|
||||
6.3 Configuring vcscommand.vim *vcscommand-ssh-config*
|
||||
|
||||
At this point, you should be able to use your wrapper script to invoke CVS with
|
||||
various commands, and get the password dialog. All that's left is to make CVS
|
||||
use your newly-created wrapper script.
|
||||
|
||||
6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this
|
||||
is globally, by putting the following in your .vimrc:
|
||||
|
||||
let VCSCommandCVSExec=/path/to/cvs/wrapper/script
|
||||
|
||||
6.4 Where to go from here *vcscommand-ssh-other*
|
||||
|
||||
The script given above works even when non-SSH CVS connections are used,
|
||||
except possibly when interactively entering the message for CVS commit log
|
||||
(depending on the editor you use... VIM works fine). Since the vcscommand.vim
|
||||
plugin handles that message without a terminal, the wrapper script can be used
|
||||
all the time.
|
||||
|
||||
This allows mixed-mode operation, where some work is done with SSH-based CVS
|
||||
repositories, and others with pserver or local access.
|
||||
|
||||
It is possible, though beyond the scope of the plugin, to dynamically set the
|
||||
CVS executable based on the CVSROOT for the file being edited. The user
|
||||
events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to
|
||||
set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable
|
||||
on a file-by-file basis. Alternatively, much the same can be done (less
|
||||
automatically) by the various project-oriented plugins out there.
|
||||
|
||||
It is highly recommended for ease-of-use that certificates with no passphrase
|
||||
or ssh-agent are employed so that the user is not given the password prompt
|
||||
too often.
|
||||
|
||||
==============================================================================
|
||||
|
||||
7. Changes from cvscommand *cvscommand-changes*
|
||||
|
||||
1. Require Vim 7 in order to leverage several convenient features; also
|
||||
because I wanted to play with Vim 7.
|
||||
|
||||
2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are
|
||||
the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS.
|
||||
|
||||
3. Renamed options, events to start with 'VCSCommand'.
|
||||
|
||||
4. Removed option to jump to the parent version of the current line in an
|
||||
annotated buffer, as opposed to the version on the current line. This made
|
||||
little sense in the branching scheme used by subversion, where jumping to a
|
||||
parent branch required finding a different location in the repository. It
|
||||
didn't work consistently in CVS anyway.
|
||||
|
||||
5. Removed option to have nameless scratch buffers.
|
||||
|
||||
6. Changed default behavior of scratch buffers to split the window instead of
|
||||
displaying in the current window. This may still be overridden using the
|
||||
'VCSCommandEdit' option.
|
||||
|
||||
7. Split plugin into multiple plugins.
|
||||
|
||||
8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for
|
||||
subversion but not for CVS. These were not kept specific to subversion as they
|
||||
seemed more general in nature and more likely to be supported by any future VCS
|
||||
supported by this plugin.
|
||||
|
||||
9. Changed name of buffer variables set by commands.
|
||||
|
||||
'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer'
|
||||
'b:cvscmd' became 'b:VCSCommandCommand'
|
||||
|
||||
10. Added new automatic variables to command result buffers.
|
||||
|
||||
'b:VCSCommandSourceFile'
|
||||
'b:VCSCommandVCSType'
|
||||
|
||||
==============================================================================
|
||||
|
||||
8. Known bugs *vcscommand-bugs*
|
||||
|
||||
Please let me know if you run across any.
|
||||
|
||||
CVSUnedit may, if a file is changed from the repository, provide prompt text
|
||||
to determine whether the changes should be thrown away. Currently, that text
|
||||
shows up in the CVS result buffer as information; there is no way for the user
|
||||
to actually respond to the prompt and the CVS unedit command does nothing. If
|
||||
this really bothers anyone, please let me know.
|
||||
|
||||
VCSVimDiff, when using the original (real) source buffer as one of the diff
|
||||
buffers, uses some hacks to try to restore the state of the original buffer
|
||||
when the scratch buffer containing the other version is destroyed. There may
|
||||
still be bugs in here, depending on many configuration details.
|
||||
|
||||
vim:tw=78:ts=8:ft=help
|
|
@ -1,73 +0,0 @@
|
|||
|
||||
" ViM autocommands for binary plist files
|
||||
" Copyright (C) 2005 Moritz Heckscher
|
||||
"
|
||||
" Note: When a file changes externally and you answer no to vim's question if
|
||||
" you want to write anyway, the autocommands (e.g. for BufWritePost) are still
|
||||
" executed, it seems, which could have some unwanted side effects.
|
||||
"
|
||||
" This program is free software; you can redistribute it and/or modify
|
||||
" it under the terms of the GNU General Public License as published by
|
||||
" the Free Software Foundation; either version 2 of the License, or
|
||||
" (at your option) any later version.
|
||||
"
|
||||
" This program is distributed in the hope that it will be useful,
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
" GNU General Public License for more details.
|
||||
autocmd BufReadPre,FileReadPre *.plist set binary ft=plist syntax=xml
|
||||
" ... and call it just after editing a file in a new buffer...
|
||||
autocmd BufReadPost *.plist call MyBinaryPlistReadPost()
|
||||
" ... or when reading a file into an existing buffer (in that case, don't
|
||||
" save as binary later on).
|
||||
autocmd FileReadPost *.plist call MyBinaryPlistReadPost() | let b:saveAsBinaryPlist = 0
|
||||
autocmd BufWritePre,FileWritePre *.plist call MyBinaryPlistWritePre()
|
||||
autocmd BufWritePost,FileWritePost *.plist call MyBinaryPlistWritePost()
|
||||
|
||||
|
||||
" breaking lines etc; since setting this for normal plist files doesn't
|
||||
" hurt and it's not yet known whether or not the file to be read is stored
|
||||
" in binary format, set the option in any case to be sure).
|
||||
" Do it before editing a file in a new buffer and before reading a file
|
||||
" into in an existing buffer (using ':read foo.plist').
|
||||
|
||||
" Define a little function to convert binary files if necessary...
|
||||
fun MyBinaryPlistReadPost()
|
||||
" Check if the first line just read in indicates a binary plist
|
||||
if getline("'[") =~ "^bplist"
|
||||
" Filter lines read into buffer (convert to XML with plutil)
|
||||
'[,']!plutil -convert xml1 /dev/stdin -o /dev/stdout
|
||||
" Many people seem to want to save files originally stored
|
||||
" in binary format as such after editing, so memorize format.
|
||||
let b:saveAsBinaryPlist = 1
|
||||
endif
|
||||
" Yeah, plain text (finally or all the way through, either way...)!
|
||||
set nobinary
|
||||
" Trigger file type detection to get syntax coloring etc. according
|
||||
" to file contents (alternative: 'setfiletype xml' to force xml).
|
||||
filetype detect
|
||||
endfun
|
||||
|
||||
" Define and use functions for conversion back to binary format
|
||||
fun MyBinaryPlistWritePre()
|
||||
if exists("b:saveAsBinaryPlist") && b:saveAsBinaryPlist
|
||||
" Must set binary mode before conversion (for EOL settings)
|
||||
set binary
|
||||
" Convert buffer lines to be written to binary
|
||||
silent '[,']!plutil -convert binary1 /dev/stdin -o /dev/stdout
|
||||
" If there was a problem, e.g. when the file contains syntax
|
||||
" errors, undo the conversion and go back to nobinary so the
|
||||
" file will be saved in text format.
|
||||
if v:shell_error | undo | set nobinary | endif
|
||||
endif
|
||||
endfun
|
||||
fun MyBinaryPlistWritePost()
|
||||
" If file was to be written in binary format and there was no error
|
||||
" doing the conversion, ...
|
||||
if exists("b:saveAsBinaryPlist") && b:saveAsBinaryPlist && !v:shell_error
|
||||
" ... undo the conversion and go back to nobinary so the
|
||||
" lines are shown as text again in vim.
|
||||
undo
|
||||
set nobinary
|
||||
endif
|
||||
endfun
|
|
@ -1,160 +0,0 @@
|
|||
# coding: utf-8
|
||||
|
||||
from mccabe.mccabe import get_module_complexity
|
||||
from pyflakes import checker, messages
|
||||
import _ast
|
||||
from pep8 import pep8 as p8
|
||||
from pep8.autopep8 import fix_file as pep8_fix, fix_lines as pep8_fix_lines
|
||||
import os
|
||||
|
||||
|
||||
class Pep8Options():
|
||||
verbose = 0
|
||||
diff = False
|
||||
in_place = True
|
||||
recursive = False
|
||||
pep8_passes = 100
|
||||
max_line_length = 79
|
||||
ignore = ''
|
||||
select = ''
|
||||
aggressive = False
|
||||
|
||||
|
||||
class MccabeOptions():
|
||||
complexity = 10
|
||||
|
||||
flake_code_mapping = {
|
||||
'W402': (messages.UnusedImport,),
|
||||
'W403': (messages.ImportShadowedByLoopVar,),
|
||||
'W404': (messages.ImportStarUsed,),
|
||||
'W405': (messages.LateFutureImport,),
|
||||
'W801': (messages.RedefinedWhileUnused,
|
||||
messages.RedefinedInListComp,),
|
||||
'W802': (messages.UndefinedName,),
|
||||
'W803': (messages.UndefinedExport,),
|
||||
'W804': (messages.UndefinedLocal,
|
||||
messages.UnusedVariable,),
|
||||
'W805': (messages.DuplicateArgument,),
|
||||
'W806': (messages.Redefined,),
|
||||
}
|
||||
|
||||
flake_class_mapping = dict(
|
||||
(k, c) for (c, v) in flake_code_mapping.items() for k in v)
|
||||
|
||||
|
||||
def fix_file(filename):
|
||||
pep8_fix(filename, Pep8Options)
|
||||
|
||||
|
||||
def fix_lines(lines):
|
||||
return pep8_fix_lines(lines, Pep8Options)
|
||||
|
||||
|
||||
def run_checkers(filename, checkers, ignore):
|
||||
|
||||
result = []
|
||||
|
||||
for c in checkers:
|
||||
|
||||
checker_fun = globals().get(c)
|
||||
if not checker:
|
||||
continue
|
||||
|
||||
try:
|
||||
for e in checker_fun(filename):
|
||||
e.update(
|
||||
col=e.get('col') or 0,
|
||||
text="{0} [{1}]".format(
|
||||
e.get('text', '').strip(
|
||||
).replace("'", "\"").splitlines()[0],
|
||||
c),
|
||||
filename=os.path.normpath(filename),
|
||||
type=e.get('type') or 'W',
|
||||
bufnr=0,
|
||||
)
|
||||
result.append(e)
|
||||
except:
|
||||
pass
|
||||
|
||||
result = filter(lambda e: _ignore_error(e, ignore), result)
|
||||
return sorted(result, key=lambda x: x['lnum'])
|
||||
|
||||
|
||||
def mccabe(filename):
|
||||
return get_module_complexity(filename, min=MccabeOptions.complexity)
|
||||
|
||||
|
||||
def pep8(filename):
|
||||
style = PEP8 or _init_pep8()
|
||||
return style.input_file(filename)
|
||||
|
||||
|
||||
def pyflakes(filename):
|
||||
codeString = file(filename, 'U').read() + '\n'
|
||||
errors = []
|
||||
try:
|
||||
tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
|
||||
except SyntaxError as e:
|
||||
errors.append(dict(
|
||||
lnum=e.lineno or 0,
|
||||
col=e.offset or 0,
|
||||
text=getattr(e, 'msg', None) or str(e),
|
||||
type='E'
|
||||
))
|
||||
else:
|
||||
w = checker.Checker(tree, filename)
|
||||
w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
|
||||
for w in w.messages:
|
||||
errors.append(dict(
|
||||
lnum=w.lineno,
|
||||
col=0,
|
||||
text=u'{0} {1}'.format(
|
||||
flake_class_mapping.get(w.__class__, ''),
|
||||
w.message % w.message_args),
|
||||
type='E'
|
||||
))
|
||||
return errors
|
||||
|
||||
|
||||
PEP8 = None
|
||||
|
||||
|
||||
def _init_pep8():
|
||||
global PEP8
|
||||
|
||||
class _PEP8Report(p8.BaseReport):
|
||||
|
||||
def init_file(self, filename, lines, expected, line_offset):
|
||||
super(_PEP8Report, self).init_file(
|
||||
filename, lines, expected, line_offset)
|
||||
self.errors = []
|
||||
|
||||
def error(self, line_number, offset, text, check):
|
||||
code = super(_PEP8Report, self).error(
|
||||
line_number, offset, text, check)
|
||||
|
||||
self.errors.append(dict(
|
||||
text=text,
|
||||
type=code,
|
||||
col=offset + 1,
|
||||
lnum=line_number,
|
||||
))
|
||||
|
||||
def get_file_results(self):
|
||||
return self.errors
|
||||
|
||||
PEP8 = p8.StyleGuide(reporter=_PEP8Report)
|
||||
return PEP8
|
||||
|
||||
|
||||
def _ignore_error(e, ignore):
|
||||
for i in ignore:
|
||||
if e['text'].startswith(i):
|
||||
return False
|
||||
return True
|
||||
|
||||
if __name__ == '__main__':
|
||||
for r in run_checkers(
|
||||
'/home/andrew/devel/vim/bundle/flake8-vim/ftplugin/python/flake8.py',
|
||||
checkers=['mccabe', 'pyflakes', 'pep8'], ignore=[]):
|
||||
print r
|
|
@ -1,188 +0,0 @@
|
|||
" Check python support
|
||||
if !has('python')
|
||||
echo "Error: PyFlake.vim required vim compiled with +python."
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:PyFlakeRangeCommand')
|
||||
let g:PyFlakeRangeCommand = 'Q'
|
||||
endif
|
||||
|
||||
if !exists('b:PyFlake_initialized')
|
||||
let b:PyFlake_initialized = 1
|
||||
|
||||
au BufWritePost <buffer> call flake8#on_write()
|
||||
au CursorHold <buffer> call flake8#get_message()
|
||||
au CursorMoved <buffer> call flake8#get_message()
|
||||
|
||||
" Commands
|
||||
command! -buffer PyFlakeToggle :let b:PyFlake_disabled = exists('b:PyFlake_disabled') ? b:PyFlake_disabled ? 0 : 1 : 1
|
||||
command! -buffer PyFlake :call flake8#run()
|
||||
command! -buffer -range=% PyFlakeAuto :call flake8#auto(<line1>,<line2>)
|
||||
|
||||
" Keymaps
|
||||
if g:PyFlakeRangeCommand != ''
|
||||
exec 'vnoremap <buffer> <silent> ' . g:PyFlakeRangeCommand . ' :PyFlakeAuto<CR>'
|
||||
endif
|
||||
|
||||
let b:showing_message = 0
|
||||
|
||||
" Signs definition
|
||||
sign define W text=WW texthl=Todo
|
||||
sign define C text=CC texthl=Comment
|
||||
sign define R text=RR texthl=Visual
|
||||
sign define E text=EE texthl=Error
|
||||
endif
|
||||
|
||||
"Check for flake8 plugin is loaded
|
||||
if exists("g:PyFlakeDirectory")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:PyFlakeOnWrite')
|
||||
let g:PyFlakeOnWrite = 1
|
||||
endif
|
||||
|
||||
" Init variables
|
||||
let g:PyFlakeDirectory = expand('<sfile>:p:h')
|
||||
|
||||
if !exists('g:PyFlakeCheckers')
|
||||
let g:PyFlakeCheckers = 'pep8,mccabe,pyflakes'
|
||||
endif
|
||||
if !exists('g:PyFlakeDefaultComplexity')
|
||||
let g:PyFlakeDefaultComplexity=10
|
||||
endif
|
||||
if !exists('g:PyFlakeDisabledMessages')
|
||||
let g:PyFlakeDisabledMessages = 'E501'
|
||||
endif
|
||||
if !exists('g:PyFlakeCWindow')
|
||||
let g:PyFlakeCWindow = 6
|
||||
endif
|
||||
if !exists('g:PyFlakeSigns')
|
||||
let g:PyFlakeSigns = 1
|
||||
endif
|
||||
if !exists('g:PyFlakeMaxLineLength')
|
||||
let g:PyFlakeMaxLineLength = 100
|
||||
endif
|
||||
|
||||
python << EOF
|
||||
|
||||
import sys
|
||||
import json
|
||||
import vim
|
||||
|
||||
sys.path.insert(0, vim.eval("g:PyFlakeDirectory"))
|
||||
from flake8 import run_checkers, fix_lines, Pep8Options, MccabeOptions
|
||||
|
||||
def flake8_check():
|
||||
checkers=vim.eval('g:PyFlakeCheckers').split(',')
|
||||
ignore=vim.eval('g:PyFlakeDisabledMessages').split(',')
|
||||
MccabeOptions.complexity=int(vim.eval('g:PyFlakeDefaultComplexity'))
|
||||
Pep8Options.max_line_length=int(vim.eval('g:PyFlakeMaxLineLength'))
|
||||
filename=vim.current.buffer.name
|
||||
parse_result(run_checkers(filename, checkers, ignore))
|
||||
|
||||
def parse_result(result):
|
||||
vim.command('let g:qf_list = {}'.format(json.dumps(result, ensure_ascii=False)))
|
||||
|
||||
EOF
|
||||
|
||||
function! flake8#on_write()
|
||||
if !g:PyFlakeOnWrite || exists("b:PyFlake_disabled") && b:PyFlake_disabled
|
||||
return
|
||||
endif
|
||||
call flake8#check()
|
||||
endfunction
|
||||
|
||||
function! flake8#run()
|
||||
if &modifiable && &modified
|
||||
write
|
||||
endif
|
||||
call flake8#check()
|
||||
endfun
|
||||
|
||||
function! flake8#check()
|
||||
py flake8_check()
|
||||
let s:matchDict = {}
|
||||
for err in g:qf_list
|
||||
let s:matchDict[err.lnum] = err.text
|
||||
endfor
|
||||
call setqflist(g:qf_list, 'r')
|
||||
|
||||
" Place signs
|
||||
if g:PyFlakeSigns
|
||||
call flake8#place_signs()
|
||||
endif
|
||||
|
||||
" Open cwindow
|
||||
if g:PyFlakeCWindow
|
||||
cclose
|
||||
if len(g:qf_list)
|
||||
let l:winsize = len(g:qf_list) > g:PyFlakeCWindow ? g:PyFlakeCWindow : len(g:qf_list)
|
||||
exec l:winsize . 'cwindow'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! flake8#auto(l1, l2) "{{{
|
||||
cclose
|
||||
sign unplace *
|
||||
let s:matchDict = {}
|
||||
call setqflist([])
|
||||
|
||||
python << EOF
|
||||
start, end = int(vim.eval('a:l1'))-1, int(vim.eval('a:l2'))
|
||||
enc = vim.eval('&enc')
|
||||
lines = fix_lines(vim.current.buffer[start:end]).splitlines()
|
||||
res = [ln.encode(enc, 'replace') for ln in lines]
|
||||
vim.current.buffer[start:end] = res
|
||||
EOF
|
||||
endfunction "}}}
|
||||
|
||||
function! flake8#place_signs()
|
||||
"first remove all sings
|
||||
sign unplace *
|
||||
|
||||
"now we place one sign for every quickfix line
|
||||
let l:id = 1
|
||||
for item in getqflist()
|
||||
execute(':sign place '.l:id.' name='.l:item.type.' line='.l:item.lnum.' buffer='.l:item.bufnr)
|
||||
let l:id = l:id + 1
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" keep track of whether or not we are showing a message
|
||||
" WideMsg() prints [long] message up to (&columns-1) length
|
||||
" guaranteed without "Press Enter" prompt.
|
||||
function! flake8#wide_msg(msg)
|
||||
let x=&ruler | let y=&showcmd
|
||||
set noruler noshowcmd
|
||||
redraw
|
||||
echo strpart(a:msg, 0, &columns-1)
|
||||
let &ruler=x | let &showcmd=y
|
||||
endfun
|
||||
|
||||
|
||||
function! flake8#get_message()
|
||||
let s:cursorPos = getpos(".")
|
||||
|
||||
" Bail if RunPyflakes hasn't been called yet.
|
||||
if !exists('s:matchDict')
|
||||
return
|
||||
endif
|
||||
|
||||
" if there's a message for the line the cursor is currently on, echo
|
||||
" it to the console
|
||||
if has_key(s:matchDict, s:cursorPos[1])
|
||||
let s:pyflakesMatch = get(s:matchDict, s:cursorPos[1])
|
||||
call flake8#wide_msg(s:pyflakesMatch)
|
||||
let b:showing_message = 1
|
||||
return
|
||||
endif
|
||||
|
||||
" otherwise, if we're showing a message, clear it
|
||||
if b:showing_message == 1
|
||||
echo
|
||||
let b:showing_message = 0
|
||||
endif
|
||||
endfunction
|
|
@ -1,446 +0,0 @@
|
|||
" -*- vim -*-
|
||||
" FILE: python.vim
|
||||
" LAST MODIFICATION: 2008-05-17 6:29pm
|
||||
" (C) Copyright 2001-2005 Mikael Berthe <bmikael@lists.lilotux.net>
|
||||
" Maintained by Jon Franklin <jvfranklin@gmail.com>
|
||||
" Version: 1.12
|
||||
|
||||
" USAGE:
|
||||
"
|
||||
" Save this file to $VIMFILES/ftplugin/python.vim. You can have multiple
|
||||
" python ftplugins by creating $VIMFILES/ftplugin/python and saving your
|
||||
" ftplugins in that directory. If saving this to the global ftplugin
|
||||
" directory, this is the recommended method, since vim ships with an
|
||||
" ftplugin/python.vim file already.
|
||||
" You can set the global variable "g:py_select_leading_comments" to 0
|
||||
" if you don't want to select comments preceding a declaration (these
|
||||
" are usually the description of the function/class).
|
||||
" You can set the global variable "g:py_select_trailing_comments" to 0
|
||||
" if you don't want to select comments at the end of a function/class.
|
||||
" If these variables are not defined, both leading and trailing comments
|
||||
" are selected.
|
||||
" Example: (in your .vimrc) "let g:py_select_leading_comments = 0"
|
||||
" You may want to take a look at the 'shiftwidth' option for the
|
||||
" shift commands...
|
||||
"
|
||||
" REQUIREMENTS:
|
||||
" vim (>= 7)
|
||||
"
|
||||
" Shortcuts:
|
||||
" ]t -- Jump to beginning of block
|
||||
" ]e -- Jump to end of block
|
||||
" ]v -- Select (Visual Line Mode) block
|
||||
" ]< -- Shift block to left
|
||||
" ]> -- Shift block to right
|
||||
" ]# -- Comment selection
|
||||
" ]u -- Uncomment selection
|
||||
" ]c -- Select current/previous class
|
||||
" ]d -- Select current/previous function
|
||||
" ]<up> -- Jump to previous line with the same/lower indentation
|
||||
" ]<down> -- Jump to next line with the same/lower indentation
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:loaded_py_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:loaded_py_ftplugin = 1
|
||||
|
||||
map ]t :PBoB<CR>
|
||||
vmap ]t :<C-U>PBOB<CR>m'gv``
|
||||
map ]e :PEoB<CR>
|
||||
vmap ]e :<C-U>PEoB<CR>m'gv``
|
||||
|
||||
map ]v ]tV]e
|
||||
map ]< ]tV]e<
|
||||
vmap ]< <
|
||||
map ]> ]tV]e>
|
||||
vmap ]> >
|
||||
|
||||
map ]# :call PythonCommentSelection()<CR>
|
||||
vmap ]# :call PythonCommentSelection()<CR>
|
||||
map ]u :call PythonUncommentSelection()<CR>
|
||||
vmap ]u :call PythonUncommentSelection()<CR>
|
||||
|
||||
map ]c :call PythonSelectObject("class")<CR>
|
||||
map ]d :call PythonSelectObject("function")<CR>
|
||||
|
||||
map ]<up> :call PythonNextLine(-1)<CR>
|
||||
map ]<down> :call PythonNextLine(1)<CR>
|
||||
" You may prefer use <s-up> and <s-down>... :-)
|
||||
|
||||
" jump to previous class
|
||||
map ]J :call PythonDec("class", -1)<CR>
|
||||
vmap ]J :call PythonDec("class", -1)<CR>
|
||||
|
||||
" jump to next class
|
||||
map ]j :call PythonDec("class", 1)<CR>
|
||||
vmap ]j :call PythonDec("class", 1)<CR>
|
||||
|
||||
" jump to previous function
|
||||
map ]F :call PythonDec("function", -1)<CR>
|
||||
vmap ]F :call PythonDec("function", -1)<CR>
|
||||
|
||||
" jump to next function
|
||||
map ]f :call PythonDec("function", 1)<CR>
|
||||
vmap ]f :call PythonDec("function", 1)<CR>
|
||||
|
||||
|
||||
|
||||
" Menu entries
|
||||
nmenu <silent> &Python.Update\ IM-Python\ Menu
|
||||
\:call UpdateMenu()<CR>
|
||||
nmenu &Python.-Sep1- :
|
||||
nmenu <silent> &Python.Beginning\ of\ Block<Tab>[t
|
||||
\]t
|
||||
nmenu <silent> &Python.End\ of\ Block<Tab>]e
|
||||
\]e
|
||||
nmenu &Python.-Sep2- :
|
||||
nmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||
\]<
|
||||
vmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||
\]<
|
||||
nmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||
\]>
|
||||
vmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||
\]>
|
||||
nmenu &Python.-Sep3- :
|
||||
vmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||
\]#
|
||||
nmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||
\]#
|
||||
vmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||
\]u
|
||||
nmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||
\]u
|
||||
nmenu &Python.-Sep4- :
|
||||
nmenu <silent> &Python.Previous\ Class<Tab>]J
|
||||
\]J
|
||||
nmenu <silent> &Python.Next\ Class<Tab>]j
|
||||
\]j
|
||||
nmenu <silent> &Python.Previous\ Function<Tab>]F
|
||||
\]F
|
||||
nmenu <silent> &Python.Next\ Function<Tab>]f
|
||||
\]f
|
||||
nmenu &Python.-Sep5- :
|
||||
nmenu <silent> &Python.Select\ Block<Tab>]v
|
||||
\]v
|
||||
nmenu <silent> &Python.Select\ Function<Tab>]d
|
||||
\]d
|
||||
nmenu <silent> &Python.Select\ Class<Tab>]c
|
||||
\]c
|
||||
nmenu &Python.-Sep6- :
|
||||
nmenu <silent> &Python.Previous\ Line\ wrt\ indent<Tab>]<up>
|
||||
\]<up>
|
||||
nmenu <silent> &Python.Next\ Line\ wrt\ indent<Tab>]<down>
|
||||
\]<down>
|
||||
|
||||
:com! PBoB execute "normal ".PythonBoB(line('.'), -1, 1)."G"
|
||||
:com! PEoB execute "normal ".PythonBoB(line('.'), 1, 1)."G"
|
||||
:com! UpdateMenu call UpdateMenu()
|
||||
|
||||
|
||||
" Go to a block boundary (-1: previous, 1: next)
|
||||
" If force_sel_comments is true, 'g:py_select_trailing_comments' is ignored
|
||||
function! PythonBoB(line, direction, force_sel_comments)
|
||||
let ln = a:line
|
||||
let ind = indent(ln)
|
||||
let mark = ln
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ln = ln + a:direction
|
||||
if (a:direction == 1) && (!a:force_sel_comments) &&
|
||||
\ exists("g:py_select_trailing_comments") &&
|
||||
\ (!g:py_select_trailing_comments)
|
||||
let sel_comments = 0
|
||||
else
|
||||
let sel_comments = 1
|
||||
endif
|
||||
|
||||
while((ln >= 1) && (ln <= line('$')))
|
||||
if (sel_comments) || (match(getline(ln), "^\\s*#") == -1)
|
||||
if (!indent_valid)
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ind = indent(ln)
|
||||
let mark = ln
|
||||
else
|
||||
if (strlen(getline(ln)))
|
||||
if (indent(ln) < ind)
|
||||
break
|
||||
endif
|
||||
let mark = ln
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let ln = ln + a:direction
|
||||
endwhile
|
||||
|
||||
return mark
|
||||
endfunction
|
||||
|
||||
|
||||
" Go to previous (-1) or next (1) class/function definition
|
||||
function! PythonDec(obj, direction)
|
||||
if (a:obj == "class")
|
||||
let objregexp = "^\\s*class\\s\\+[a-zA-Z0-9_]\\+"
|
||||
\ . "\\s*\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*:"
|
||||
else
|
||||
let objregexp = "^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*:"
|
||||
endif
|
||||
let flag = "W"
|
||||
if (a:direction == -1)
|
||||
let flag = flag."b"
|
||||
endif
|
||||
let res = search(objregexp, flag)
|
||||
endfunction
|
||||
|
||||
|
||||
" Comment out selected lines
|
||||
" commentString is inserted in non-empty lines, and should be aligned with
|
||||
" the block
|
||||
function! PythonCommentSelection() range
|
||||
let commentString = "#"
|
||||
let cl = a:firstline
|
||||
let ind = 1000 " I hope nobody use so long lines! :)
|
||||
|
||||
" Look for smallest indent
|
||||
while (cl <= a:lastline)
|
||||
if strlen(getline(cl))
|
||||
let cind = indent(cl)
|
||||
let ind = ((ind < cind) ? ind : cind)
|
||||
endif
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
if (ind == 1000)
|
||||
let ind = 1
|
||||
else
|
||||
let ind = ind + 1
|
||||
endif
|
||||
|
||||
let cl = a:firstline
|
||||
execute ":".cl
|
||||
" Insert commentString in each non-empty line, in column ind
|
||||
while (cl <= a:lastline)
|
||||
if strlen(getline(cl))
|
||||
execute "normal ".ind."|i".commentString
|
||||
endif
|
||||
execute "normal \<Down>"
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Uncomment selected lines
|
||||
function! PythonUncommentSelection() range
|
||||
" commentString could be different than the one from CommentSelection()
|
||||
" For example, this could be "# \\="
|
||||
let commentString = "#"
|
||||
let cl = a:firstline
|
||||
while (cl <= a:lastline)
|
||||
let ul = substitute(getline(cl),
|
||||
\"\\(\\s*\\)".commentString."\\(.*\\)$", "\\1\\2", "")
|
||||
call setline(cl, ul)
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
|
||||
" Select an object ("class"/"function")
|
||||
function! PythonSelectObject(obj)
|
||||
" Go to the object declaration
|
||||
normal $
|
||||
call PythonDec(a:obj, -1)
|
||||
let beg = line('.')
|
||||
|
||||
if !exists("g:py_select_leading_comments") || (g:py_select_leading_comments)
|
||||
let decind = indent(beg)
|
||||
let cl = beg
|
||||
while (cl>1)
|
||||
let cl = cl - 1
|
||||
if (indent(cl) == decind) && (getline(cl)[decind] == "#")
|
||||
let beg = cl
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
|
||||
if (a:obj == "class")
|
||||
let eod = "\\(^\\s*class\\s\\+[a-zA-Z0-9_]\\+\\s*"
|
||||
\ . "\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*\\)\\@<=:"
|
||||
else
|
||||
let eod = "\\(^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*\\)\\@<=:"
|
||||
endif
|
||||
" Look for the end of the declaration (not always the same line!)
|
||||
call search(eod, "")
|
||||
|
||||
" Is it a one-line definition?
|
||||
if match(getline('.'), "^\\s*\\(#.*\\)\\=$", col('.')) == -1
|
||||
let cl = line('.')
|
||||
execute ":".beg
|
||||
execute "normal V".cl."G"
|
||||
else
|
||||
" Select the whole block
|
||||
execute "normal \<Down>"
|
||||
let cl = line('.')
|
||||
execute ":".beg
|
||||
execute "normal V".PythonBoB(cl, 1, 0)."G"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" Jump to the next line with the same (or lower) indentation
|
||||
" Useful for moving between "if" and "else", for example.
|
||||
function! PythonNextLine(direction)
|
||||
let ln = line('.')
|
||||
let ind = indent(ln)
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ln = ln + a:direction
|
||||
|
||||
while((ln >= 1) && (ln <= line('$')))
|
||||
if (!indent_valid) && strlen(getline(ln))
|
||||
break
|
||||
else
|
||||
if (strlen(getline(ln)))
|
||||
if (indent(ln) <= ind)
|
||||
break
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let ln = ln + a:direction
|
||||
endwhile
|
||||
|
||||
execute "normal ".ln."G"
|
||||
endfunction
|
||||
|
||||
function! UpdateMenu()
|
||||
" delete menu if it already exists, then rebuild it.
|
||||
" this is necessary in case you've got multiple buffers open
|
||||
" a future enhancement to this would be to make the menu aware of
|
||||
" all buffers currently open, and group classes and functions by buffer
|
||||
if exists("g:menuran")
|
||||
aunmenu IM-Python
|
||||
endif
|
||||
let restore_fe = &foldenable
|
||||
set nofoldenable
|
||||
" preserve disposition of window and cursor
|
||||
let cline=line('.')
|
||||
let ccol=col('.') - 1
|
||||
norm H
|
||||
let hline=line('.')
|
||||
" create the menu
|
||||
call MenuBuilder()
|
||||
" restore disposition of window and cursor
|
||||
exe "norm ".hline."Gzt"
|
||||
let dnscroll=cline-hline
|
||||
exe "norm ".dnscroll."j".ccol."l"
|
||||
let &foldenable = restore_fe
|
||||
endfunction
|
||||
|
||||
function! MenuBuilder()
|
||||
norm gg0
|
||||
let currentclass = -1
|
||||
let classlist = []
|
||||
let parentclass = ""
|
||||
while line(".") < line("$")
|
||||
" search for a class or function
|
||||
if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*:\|^\s*def\s\+[_a-zA-Z].*:' ) != -1
|
||||
norm ^
|
||||
let linenum = line('.')
|
||||
let indentcol = col('.')
|
||||
norm "nye
|
||||
let classordef=@n
|
||||
norm w"nywge
|
||||
let objname=@n
|
||||
let parentclass = FindParentClass(classlist, indentcol)
|
||||
if classordef == "class"
|
||||
call AddClass(objname, linenum, parentclass)
|
||||
else " this is a function
|
||||
call AddFunction(objname, linenum, parentclass)
|
||||
endif
|
||||
" We actually created a menu, so lets set the global variable
|
||||
let g:menuran=1
|
||||
call RebuildClassList(classlist, [objname, indentcol], classordef)
|
||||
endif " line matched
|
||||
norm j
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" classlist contains the list of nested classes we are in.
|
||||
" in most cases it will be empty or contain a single class
|
||||
" but where a class is nested within another, it will contain 2 or more
|
||||
" this function adds or removes classes from the list based on indentation
|
||||
function! RebuildClassList(classlist, newclass, classordef)
|
||||
let i = len(a:classlist) - 1
|
||||
while i > -1
|
||||
if a:newclass[1] <= a:classlist[i][1]
|
||||
call remove(a:classlist, i)
|
||||
endif
|
||||
let i = i - 1
|
||||
endwhile
|
||||
if a:classordef == "class"
|
||||
call add(a:classlist, a:newclass)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" we found a class or function, determine its parent class based on
|
||||
" indentation and what's contained in classlist
|
||||
function! FindParentClass(classlist, indentcol)
|
||||
let i = 0
|
||||
let parentclass = ""
|
||||
while i < len(a:classlist)
|
||||
if a:indentcol <= a:classlist[i][1]
|
||||
break
|
||||
else
|
||||
if len(parentclass) == 0
|
||||
let parentclass = a:classlist[i][0]
|
||||
else
|
||||
let parentclass = parentclass.'\.'.a:classlist[i][0]
|
||||
endif
|
||||
endif
|
||||
let i = i + 1
|
||||
endwhile
|
||||
return parentclass
|
||||
endfunction
|
||||
|
||||
" add a class to the menu
|
||||
function! AddClass(classname, lineno, parentclass)
|
||||
if len(a:parentclass) > 0
|
||||
let classstring = a:parentclass.'\.'.a:classname
|
||||
else
|
||||
let classstring = a:classname
|
||||
endif
|
||||
exe 'menu IM-Python.classes.'.classstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||
endfunction
|
||||
|
||||
" add a function to the menu, grouped by member class
|
||||
function! AddFunction(functionname, lineno, parentclass)
|
||||
if len(a:parentclass) > 0
|
||||
let funcstring = a:parentclass.'.'.a:functionname
|
||||
else
|
||||
let funcstring = a:functionname
|
||||
endif
|
||||
exe 'menu IM-Python.functions.'.funcstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:JumpToAndUnfold(line)
|
||||
" Go to the right line
|
||||
execute 'normal '.a:line.'gg'
|
||||
" Check to see if we are in a fold
|
||||
let lvl = foldlevel(a:line)
|
||||
if lvl != 0
|
||||
" and if so, then expand the fold out, other wise, ignore this part.
|
||||
execute 'normal 15zo'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"" This one will work only on vim 6.2 because of the try/catch expressions.
|
||||
" function! s:JumpToAndUnfoldWithExceptions(line)
|
||||
" try
|
||||
" execute 'normal '.a:line.'gg15zo'
|
||||
" catch /^Vim\((\a\+)\)\=:E490:/
|
||||
" " Do nothing, just consume the error
|
||||
" endtry
|
||||
"endfunction
|
||||
|
||||
|
||||
" vim:set et sts=2 sw=2:
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
" Vim folding file
|
||||
" Language: Python
|
||||
" Author: Jorrit Wiersma (foldexpr), Max Ischenko (foldtext), Robert
|
||||
" Ames (line counts)
|
||||
" Last Change: 2005 Jul 14
|
||||
" Version: 2.3
|
||||
" Bug fix: Drexler Christopher, Tom Schumm, Geoff Gerrietts
|
||||
|
||||
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=GetPythonFold(v:lnum)
|
||||
setlocal foldtext=PythonFoldText()
|
||||
|
||||
|
||||
function! PythonFoldText()
|
||||
let line = getline(v:foldstart)
|
||||
let nnum = nextnonblank(v:foldstart + 1)
|
||||
let nextline = getline(nnum)
|
||||
if nextline =~ '^\s\+"""$'
|
||||
let line = line . getline(nnum + 1)
|
||||
elseif nextline =~ '^\s\+"""'
|
||||
let line = line . ' ' . matchstr(nextline, '"""\zs.\{-}\ze\("""\)\?$')
|
||||
elseif nextline =~ '^\s\+"[^"]\+"$'
|
||||
let line = line . ' ' . matchstr(nextline, '"\zs.*\ze"')
|
||||
elseif nextline =~ '^\s\+pass\s*$'
|
||||
let line = line . ' pass'
|
||||
endif
|
||||
let size = 1 + v:foldend - v:foldstart
|
||||
if size < 10
|
||||
let size = " " . size
|
||||
endif
|
||||
if size < 100
|
||||
let size = " " . size
|
||||
endif
|
||||
if size < 1000
|
||||
let size = " " . size
|
||||
endif
|
||||
return size . " lines: " . line
|
||||
endfunction
|
||||
|
||||
|
||||
function! GetPythonFold(lnum)
|
||||
" Determine folding level in Python source
|
||||
"
|
||||
let line = getline(a:lnum)
|
||||
let ind = indent(a:lnum)
|
||||
|
||||
" Ignore blank lines
|
||||
if line =~ '^\s*$'
|
||||
return "="
|
||||
endif
|
||||
|
||||
" Ignore triple quoted strings
|
||||
if line =~ "(\"\"\"|''')"
|
||||
return "="
|
||||
endif
|
||||
|
||||
" Ignore continuation lines
|
||||
if line =~ '\\$'
|
||||
return '='
|
||||
endif
|
||||
|
||||
" Support markers
|
||||
if line =~ '{{{'
|
||||
return "a1"
|
||||
elseif line =~ '}}}'
|
||||
return "s1"
|
||||
endif
|
||||
|
||||
" Classes and functions get their own folds
|
||||
if line =~ '^\s*\(class\|def\)\s'
|
||||
return ">" . (ind / &sw + 1)
|
||||
endif
|
||||
|
||||
let pnum = prevnonblank(a:lnum - 1)
|
||||
|
||||
if pnum == 0
|
||||
" Hit start of file
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If the previous line has foldlevel zero, and we haven't increased
|
||||
" it, we should have foldlevel zero also
|
||||
if foldlevel(pnum) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" The end of a fold is determined through a difference in indentation
|
||||
" between this line and the next.
|
||||
" So first look for next line
|
||||
let nnum = nextnonblank(a:lnum + 1)
|
||||
if nnum == 0
|
||||
return "="
|
||||
endif
|
||||
|
||||
" First I check for some common cases where this algorithm would
|
||||
" otherwise fail. (This is all a hack)
|
||||
let nline = getline(nnum)
|
||||
if nline =~ '^\s*\(except\|else\|elif\)'
|
||||
return "="
|
||||
endif
|
||||
|
||||
" Python programmers love their readable code, so they're usually
|
||||
" going to have blank lines at the ends of functions or classes
|
||||
" If the next line isn't blank, we probably don't need to end a fold
|
||||
if nnum == a:lnum + 1
|
||||
return "="
|
||||
endif
|
||||
|
||||
" If next line has less indentation we end a fold.
|
||||
" This ends folds that aren't there a lot of the time, and this sometimes
|
||||
" confuses vim. Luckily only rarely.
|
||||
let nind = indent(nnum)
|
||||
if nind < ind
|
||||
return "<" . (nind / &sw + 1)
|
||||
endif
|
||||
|
||||
" If none of the above apply, keep the indentation
|
||||
return "="
|
||||
|
||||
endfunction
|
||||
|
|
@ -1,293 +0,0 @@
|
|||
""" Meager code path measurement tool.
|
||||
Ned Batchelder
|
||||
http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html
|
||||
MIT License.
|
||||
"""
|
||||
try:
|
||||
from compiler import parse # NOQA
|
||||
iter_child_nodes = None # NOQA
|
||||
except ImportError:
|
||||
from ast import parse, iter_child_nodes # NOQA
|
||||
|
||||
import optparse
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
|
||||
WARNING_CODE = "W901"
|
||||
|
||||
|
||||
class ASTVisitor:
|
||||
|
||||
VERBOSE = 0
|
||||
|
||||
def __init__(self):
|
||||
self.node = None
|
||||
self._cache = {}
|
||||
|
||||
def default(self, node, *args):
|
||||
if hasattr(node, 'getChildNodes'):
|
||||
children = node.getChildNodes()
|
||||
else:
|
||||
children = iter_child_nodes(node)
|
||||
|
||||
for child in children:
|
||||
self.dispatch(child, *args)
|
||||
|
||||
def dispatch(self, node, *args):
|
||||
self.node = node
|
||||
klass = node.__class__
|
||||
meth = self._cache.get(klass)
|
||||
if meth is None:
|
||||
className = klass.__name__
|
||||
meth = getattr(self.visitor, 'visit' + className, self.default)
|
||||
self._cache[klass] = meth
|
||||
|
||||
return meth(node, *args)
|
||||
|
||||
def preorder(self, tree, visitor, *args):
|
||||
"""Do preorder walk of tree using visitor"""
|
||||
self.visitor = visitor
|
||||
visitor.visit = self.dispatch
|
||||
self.dispatch(tree, *args) # XXX *args make sense?
|
||||
|
||||
|
||||
class PathNode:
|
||||
def __init__(self, name, look="circle"):
|
||||
self.name = name
|
||||
self.look = look
|
||||
|
||||
def to_dot(self):
|
||||
print('node [shape=%s,label="%s"] %d;' % \
|
||||
(self.look, self.name, self.dot_id()))
|
||||
|
||||
def dot_id(self):
|
||||
return id(self)
|
||||
|
||||
|
||||
class PathGraph:
|
||||
def __init__(self, name, entity, lineno):
|
||||
self.name = name
|
||||
self.entity = entity
|
||||
self.lineno = lineno
|
||||
self.nodes = defaultdict(list)
|
||||
|
||||
def connect(self, n1, n2):
|
||||
self.nodes[n1].append(n2)
|
||||
|
||||
def to_dot(self):
|
||||
print('subgraph {')
|
||||
for node in self.nodes:
|
||||
node.to_dot()
|
||||
for node, nexts in self.nodes.items():
|
||||
for next in nexts:
|
||||
print('%s -- %s;' % (node.dot_id(), next.dot_id()))
|
||||
print('}')
|
||||
|
||||
def complexity(self):
|
||||
""" Return the McCabe complexity for the graph.
|
||||
V-E+2
|
||||
"""
|
||||
num_edges = sum([len(n) for n in self.nodes.values()])
|
||||
num_nodes = len(self.nodes)
|
||||
return num_edges - num_nodes + 2
|
||||
|
||||
|
||||
class PathGraphingAstVisitor(ASTVisitor):
|
||||
""" A visitor for a parsed Abstract Syntax Tree which finds executable
|
||||
statements.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
ASTVisitor.__init__(self)
|
||||
self.classname = ""
|
||||
self.graphs = {}
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
self.graph = None
|
||||
self.tail = None
|
||||
|
||||
def visitFunction(self, node):
|
||||
|
||||
if self.classname:
|
||||
entity = '%s%s' % (self.classname, node.name)
|
||||
else:
|
||||
entity = node.name
|
||||
|
||||
name = '%d:1: %r' % (node.lineno, entity)
|
||||
|
||||
if self.graph is not None:
|
||||
# closure
|
||||
pathnode = self.appendPathNode(name)
|
||||
self.tail = pathnode
|
||||
self.default(node)
|
||||
bottom = PathNode("", look='point')
|
||||
self.graph.connect(self.tail, bottom)
|
||||
self.graph.connect(pathnode, bottom)
|
||||
self.tail = bottom
|
||||
else:
|
||||
self.graph = PathGraph(name, entity, node.lineno)
|
||||
pathnode = PathNode(name)
|
||||
self.tail = pathnode
|
||||
self.default(node)
|
||||
self.graphs["%s%s" % (self.classname, node.name)] = self.graph
|
||||
self.reset()
|
||||
|
||||
visitFunctionDef = visitFunction
|
||||
|
||||
def visitClass(self, node):
|
||||
old_classname = self.classname
|
||||
self.classname += node.name + "."
|
||||
self.default(node)
|
||||
self.classname = old_classname
|
||||
|
||||
def appendPathNode(self, name):
|
||||
if not self.tail:
|
||||
return
|
||||
pathnode = PathNode(name)
|
||||
self.graph.connect(self.tail, pathnode)
|
||||
self.tail = pathnode
|
||||
return pathnode
|
||||
|
||||
def visitSimpleStatement(self, node):
|
||||
if node.lineno is None:
|
||||
lineno = 0
|
||||
else:
|
||||
lineno = node.lineno
|
||||
name = "Stmt %d" % lineno
|
||||
self.appendPathNode(name)
|
||||
|
||||
visitAssert = visitAssign = visitAssTuple = visitPrint = \
|
||||
visitPrintnl = visitRaise = visitSubscript = visitDecorators = \
|
||||
visitPass = visitDiscard = visitGlobal = visitReturn = \
|
||||
visitSimpleStatement
|
||||
|
||||
def visitLoop(self, node):
|
||||
name = "Loop %d" % node.lineno
|
||||
|
||||
if self.graph is None:
|
||||
# global loop
|
||||
self.graph = PathGraph(name, name, node.lineno)
|
||||
pathnode = PathNode(name)
|
||||
self.tail = pathnode
|
||||
self.default(node)
|
||||
self.graphs["%s%s" % (self.classname, name)] = self.graph
|
||||
self.reset()
|
||||
else:
|
||||
pathnode = self.appendPathNode(name)
|
||||
self.tail = pathnode
|
||||
self.default(node.body)
|
||||
bottom = PathNode("", look='point')
|
||||
self.graph.connect(self.tail, bottom)
|
||||
self.graph.connect(pathnode, bottom)
|
||||
self.tail = bottom
|
||||
|
||||
# TODO: else clause in node.else_
|
||||
|
||||
visitFor = visitWhile = visitLoop
|
||||
|
||||
def visitIf(self, node):
|
||||
name = "If %d" % node.lineno
|
||||
pathnode = self.appendPathNode(name)
|
||||
if not pathnode:
|
||||
return # TODO: figure out what to do with if's outside def's.
|
||||
loose_ends = []
|
||||
for t, n in node.tests:
|
||||
self.tail = pathnode
|
||||
self.default(n)
|
||||
loose_ends.append(self.tail)
|
||||
if node.else_:
|
||||
self.tail = pathnode
|
||||
self.default(node.else_)
|
||||
loose_ends.append(self.tail)
|
||||
else:
|
||||
loose_ends.append(pathnode)
|
||||
bottom = PathNode("", look='point')
|
||||
for le in loose_ends:
|
||||
self.graph.connect(le, bottom)
|
||||
self.tail = bottom
|
||||
|
||||
# TODO: visitTryExcept
|
||||
# TODO: visitTryFinally
|
||||
# TODO: visitWith
|
||||
|
||||
# XXX todo: determine which ones can add to the complexity
|
||||
# py2
|
||||
# TODO: visitStmt
|
||||
# TODO: visitAssName
|
||||
# TODO: visitCallFunc
|
||||
# TODO: visitConst
|
||||
|
||||
# py3
|
||||
# TODO: visitStore
|
||||
# TODO: visitCall
|
||||
# TODO: visitLoad
|
||||
# TODO: visitNum
|
||||
# TODO: visitarguments
|
||||
# TODO: visitExpr
|
||||
|
||||
|
||||
def get_code_complexity(code, min=7, filename='stdin'):
|
||||
complex = []
|
||||
try:
|
||||
ast = parse(code)
|
||||
except AttributeError:
|
||||
e = sys.exc_info()[1]
|
||||
sys.stderr.write("Unable to parse %s: %s\n" % (filename, e))
|
||||
return 0
|
||||
|
||||
visitor = PathGraphingAstVisitor()
|
||||
visitor.preorder(ast, visitor)
|
||||
for graph in visitor.graphs.values():
|
||||
if graph is None:
|
||||
# ?
|
||||
continue
|
||||
if graph.complexity() >= min:
|
||||
complex.append(dict(
|
||||
type = 'W',
|
||||
lnum = graph.lineno,
|
||||
text = '%s %r is too complex (%d)' % (
|
||||
WARNING_CODE,
|
||||
graph.entity,
|
||||
graph.complexity(),
|
||||
)
|
||||
))
|
||||
|
||||
return complex
|
||||
|
||||
|
||||
def get_module_complexity(module_path, min=7):
|
||||
"""Returns the complexity of a module"""
|
||||
code = open(module_path, "rU").read() + '\n\n'
|
||||
return get_code_complexity(code, min, filename=module_path)
|
||||
|
||||
|
||||
def main(argv):
|
||||
opar = optparse.OptionParser()
|
||||
opar.add_option("-d", "--dot", dest="dot",
|
||||
help="output a graphviz dot file", action="store_true")
|
||||
opar.add_option("-m", "--min", dest="min",
|
||||
help="minimum complexity for output", type="int",
|
||||
default=2)
|
||||
|
||||
options, args = opar.parse_args(argv)
|
||||
|
||||
text = open(args[0], "rU").read() + '\n\n'
|
||||
ast = parse(text)
|
||||
visitor = PathGraphingAstVisitor()
|
||||
visitor.preorder(ast, visitor)
|
||||
|
||||
if options.dot:
|
||||
print('graph {')
|
||||
for graph in visitor.graphs.values():
|
||||
if graph.complexity() >= options.min:
|
||||
graph.to_dot()
|
||||
print('}')
|
||||
else:
|
||||
for graph in visitor.graphs.values():
|
||||
if graph.complexity() >= options.min:
|
||||
print(graph.name, graph.complexity())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
|||
|
||||
__version__ = '0.6.1'
|
|
@ -1,130 +0,0 @@
|
|||
"""
|
||||
API for the command-line I{pyflakes} tool.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import _ast
|
||||
|
||||
from pyflakes import checker
|
||||
from pyflakes import reporter as modReporter
|
||||
|
||||
__all__ = ['check', 'checkPath', 'checkRecursive', 'iterSourceCode', 'main']
|
||||
|
||||
|
||||
def check(codeString, filename, reporter=None):
|
||||
"""
|
||||
Check the Python source given by C{codeString} for flakes.
|
||||
|
||||
@param codeString: The Python source to check.
|
||||
@type codeString: C{str}
|
||||
|
||||
@param filename: The name of the file the source came from, used to report
|
||||
errors.
|
||||
@type filename: C{str}
|
||||
|
||||
@param reporter: A L{Reporter} instance, where errors and warnings will be
|
||||
reported.
|
||||
|
||||
@return: The number of warnings emitted.
|
||||
@rtype: C{int}
|
||||
"""
|
||||
if reporter is None:
|
||||
reporter = modReporter._makeDefaultReporter()
|
||||
# First, compile into an AST and handle syntax errors.
|
||||
try:
|
||||
tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
|
||||
except SyntaxError:
|
||||
value = sys.exc_info()[1]
|
||||
msg = value.args[0]
|
||||
|
||||
(lineno, offset, text) = value.lineno, value.offset, value.text
|
||||
|
||||
# If there's an encoding problem with the file, the text is None.
|
||||
if text is None:
|
||||
# Avoid using msg, since for the only known case, it contains a
|
||||
# bogus message that claims the encoding the file declared was
|
||||
# unknown.
|
||||
reporter.unexpectedError(filename, 'problem decoding source')
|
||||
else:
|
||||
reporter.syntaxError(filename, msg, lineno, offset, text)
|
||||
return 1
|
||||
except Exception:
|
||||
reporter.unexpectedError(filename, 'problem decoding source')
|
||||
return 1
|
||||
else:
|
||||
# Okay, it's syntactically valid. Now check it.
|
||||
w = checker.Checker(tree, filename)
|
||||
w.messages.sort(key=lambda m: m.lineno)
|
||||
for warning in w.messages:
|
||||
reporter.flake(warning)
|
||||
return len(w.messages)
|
||||
|
||||
|
||||
def checkPath(filename, reporter=None):
|
||||
"""
|
||||
Check the given path, printing out any warnings detected.
|
||||
|
||||
@param reporter: A L{Reporter} instance, where errors and warnings will be
|
||||
reported.
|
||||
|
||||
@return: the number of warnings printed
|
||||
"""
|
||||
if reporter is None:
|
||||
reporter = modReporter._makeDefaultReporter()
|
||||
try:
|
||||
f = open(filename, 'U')
|
||||
try:
|
||||
return check(f.read() + '\n', filename, reporter)
|
||||
finally:
|
||||
f.close()
|
||||
except UnicodeError:
|
||||
reporter.unexpectedError(filename, 'problem decoding source')
|
||||
except IOError:
|
||||
msg = sys.exc_info()[1]
|
||||
reporter.unexpectedError(filename, msg.args[1])
|
||||
return 1
|
||||
|
||||
|
||||
def iterSourceCode(paths):
|
||||
"""
|
||||
Iterate over all Python source files in C{paths}.
|
||||
|
||||
@param paths: A list of paths. Directories will be recursed into and
|
||||
any .py files found will be yielded. Any non-directories will be
|
||||
yielded as-is.
|
||||
"""
|
||||
for path in paths:
|
||||
if os.path.isdir(path):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
for filename in filenames:
|
||||
if filename.endswith('.py'):
|
||||
yield os.path.join(dirpath, filename)
|
||||
else:
|
||||
yield path
|
||||
|
||||
|
||||
def checkRecursive(paths, reporter):
|
||||
"""
|
||||
Recursively check all source files in C{paths}.
|
||||
|
||||
@param paths: A list of paths to Python source files and directories
|
||||
containing Python source files.
|
||||
@param reporter: A L{Reporter} where all of the warnings and errors
|
||||
will be reported to.
|
||||
@return: The number of warnings found.
|
||||
"""
|
||||
warnings = 0
|
||||
for sourcePath in iterSourceCode(paths):
|
||||
warnings += checkPath(sourcePath, reporter)
|
||||
return warnings
|
||||
|
||||
|
||||
def main():
|
||||
args = sys.argv[1:]
|
||||
reporter = modReporter._makeDefaultReporter()
|
||||
if args:
|
||||
warnings = checkRecursive(args, reporter)
|
||||
else:
|
||||
warnings = check(sys.stdin.read(), '<stdin>', reporter)
|
||||
raise SystemExit(warnings > 0)
|
|
@ -1,723 +0,0 @@
|
|||
# -*- test-case-name: pyflakes -*-
|
||||
# (c) 2005-2010 Divmod, Inc.
|
||||
# See LICENSE file for details
|
||||
|
||||
import os.path
|
||||
try:
|
||||
import builtins
|
||||
PY2 = False
|
||||
except ImportError:
|
||||
import __builtin__ as builtins
|
||||
PY2 = True
|
||||
|
||||
try:
|
||||
import ast
|
||||
iter_child_nodes = ast.iter_child_nodes
|
||||
except (ImportError, AttributeError): # Python 2.5
|
||||
import _ast as ast
|
||||
|
||||
def iter_child_nodes(node, astcls=ast.AST):
|
||||
"""
|
||||
Yield all direct child nodes of *node*, that is, all fields that are nodes
|
||||
and all items of fields that are lists of nodes.
|
||||
"""
|
||||
for name in node._fields:
|
||||
field = getattr(node, name, None)
|
||||
if isinstance(field, astcls):
|
||||
yield field
|
||||
elif isinstance(field, list):
|
||||
for item in field:
|
||||
yield item
|
||||
# Python >= 3.3 uses ast.Try instead of (ast.TryExcept + ast.TryFinally)
|
||||
if hasattr(ast, 'Try'):
|
||||
ast_TryExcept = ast.Try
|
||||
ast_TryFinally = ()
|
||||
else:
|
||||
ast_TryExcept = ast.TryExcept
|
||||
ast_TryFinally = ast.TryFinally
|
||||
|
||||
from pyflakes import messages
|
||||
|
||||
|
||||
class Binding(object):
|
||||
"""
|
||||
Represents the binding of a value to a name.
|
||||
|
||||
The checker uses this to keep track of which names have been bound and
|
||||
which names have not. See L{Assignment} for a special type of binding that
|
||||
is checked with stricter rules.
|
||||
|
||||
@ivar used: pair of (L{Scope}, line-number) indicating the scope and
|
||||
line number that this binding was last used
|
||||
"""
|
||||
|
||||
def __init__(self, name, source):
|
||||
self.name = name
|
||||
self.source = source
|
||||
self.used = False
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s object %r from line %r at 0x%x>' % (self.__class__.__name__,
|
||||
self.name,
|
||||
self.source.lineno,
|
||||
id(self))
|
||||
|
||||
|
||||
class UnBinding(Binding):
|
||||
"""Created by the 'del' operator."""
|
||||
|
||||
|
||||
class Importation(Binding):
|
||||
"""
|
||||
A binding created by an import statement.
|
||||
|
||||
@ivar fullName: The complete name given to the import statement,
|
||||
possibly including multiple dotted components.
|
||||
@type fullName: C{str}
|
||||
"""
|
||||
def __init__(self, name, source):
|
||||
self.fullName = name
|
||||
name = name.split('.')[0]
|
||||
super(Importation, self).__init__(name, source)
|
||||
|
||||
|
||||
class Argument(Binding):
|
||||
"""
|
||||
Represents binding a name as an argument.
|
||||
"""
|
||||
|
||||
|
||||
class Definition(Binding):
|
||||
"""
|
||||
A binding that defines a function or a class.
|
||||
"""
|
||||
|
||||
|
||||
class Assignment(Binding):
|
||||
"""
|
||||
Represents binding a name with an explicit assignment.
|
||||
|
||||
The checker will raise warnings for any Assignment that isn't used. Also,
|
||||
the checker does not consider assignments in tuple/list unpacking to be
|
||||
Assignments, rather it treats them as simple Bindings.
|
||||
"""
|
||||
|
||||
|
||||
class FunctionDefinition(Definition):
|
||||
pass
|
||||
|
||||
|
||||
class ClassDefinition(Definition):
|
||||
pass
|
||||
|
||||
|
||||
class ExportBinding(Binding):
|
||||
"""
|
||||
A binding created by an C{__all__} assignment. If the names in the list
|
||||
can be determined statically, they will be treated as names for export and
|
||||
additional checking applied to them.
|
||||
|
||||
The only C{__all__} assignment that can be recognized is one which takes
|
||||
the value of a literal list containing literal strings. For example::
|
||||
|
||||
__all__ = ["foo", "bar"]
|
||||
|
||||
Names which are imported and not otherwise used but appear in the value of
|
||||
C{__all__} will not have an unused import warning reported for them.
|
||||
"""
|
||||
def names(self):
|
||||
"""
|
||||
Return a list of the names referenced by this binding.
|
||||
"""
|
||||
names = []
|
||||
if isinstance(self.source, ast.List):
|
||||
for node in self.source.elts:
|
||||
if isinstance(node, ast.Str):
|
||||
names.append(node.s)
|
||||
return names
|
||||
|
||||
|
||||
class Scope(dict):
|
||||
importStarred = False # set to True when import * is found
|
||||
usesLocals = False
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), dict.__repr__(self))
|
||||
|
||||
|
||||
class ClassScope(Scope):
|
||||
pass
|
||||
|
||||
|
||||
class FunctionScope(Scope):
|
||||
"""
|
||||
I represent a name scope for a function.
|
||||
|
||||
@ivar globals: Names declared 'global' in this function.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(FunctionScope, self).__init__()
|
||||
self.globals = {}
|
||||
|
||||
|
||||
class ModuleScope(Scope):
|
||||
pass
|
||||
|
||||
|
||||
# Globally defined names which are not attributes of the builtins module, or
|
||||
# are only present on some platforms.
|
||||
_MAGIC_GLOBALS = ['__file__', '__builtins__', 'WindowsError']
|
||||
|
||||
|
||||
def getNodeName(node):
|
||||
# Returns node.id, or node.name, or None
|
||||
if hasattr(node, 'id'): # One of the many nodes with an id
|
||||
return node.id
|
||||
if hasattr(node, 'name'): # a ExceptHandler node
|
||||
return node.name
|
||||
|
||||
|
||||
class Checker(object):
|
||||
"""
|
||||
I check the cleanliness and sanity of Python code.
|
||||
|
||||
@ivar _deferredFunctions: Tracking list used by L{deferFunction}. Elements
|
||||
of the list are two-tuples. The first element is the callable passed
|
||||
to L{deferFunction}. The second element is a copy of the scope stack
|
||||
at the time L{deferFunction} was called.
|
||||
|
||||
@ivar _deferredAssignments: Similar to C{_deferredFunctions}, but for
|
||||
callables which are deferred assignment checks.
|
||||
"""
|
||||
|
||||
nodeDepth = 0
|
||||
traceTree = False
|
||||
builtIns = set(dir(builtins)) | set(_MAGIC_GLOBALS)
|
||||
|
||||
def __init__(self, tree, filename='(none)', builtins=None):
|
||||
self._deferredFunctions = []
|
||||
self._deferredAssignments = []
|
||||
self.deadScopes = []
|
||||
self.messages = []
|
||||
self.filename = filename
|
||||
if builtins:
|
||||
self.builtIns = self.builtIns.union(builtins)
|
||||
self.scopeStack = [ModuleScope()]
|
||||
self.futuresAllowed = True
|
||||
self.root = tree
|
||||
self.handleChildren(tree)
|
||||
self.runDeferred(self._deferredFunctions)
|
||||
# Set _deferredFunctions to None so that deferFunction will fail
|
||||
# noisily if called after we've run through the deferred functions.
|
||||
self._deferredFunctions = None
|
||||
self.runDeferred(self._deferredAssignments)
|
||||
# Set _deferredAssignments to None so that deferAssignment will fail
|
||||
# noisily if called after we've run through the deferred assignments.
|
||||
self._deferredAssignments = None
|
||||
del self.scopeStack[1:]
|
||||
self.popScope()
|
||||
self.checkDeadScopes()
|
||||
|
||||
def deferFunction(self, callable):
|
||||
"""
|
||||
Schedule a function handler to be called just before completion.
|
||||
|
||||
This is used for handling function bodies, which must be deferred
|
||||
because code later in the file might modify the global scope. When
|
||||
`callable` is called, the scope at the time this is called will be
|
||||
restored, however it will contain any new bindings added to it.
|
||||
"""
|
||||
self._deferredFunctions.append((callable, self.scopeStack[:]))
|
||||
|
||||
def deferAssignment(self, callable):
|
||||
"""
|
||||
Schedule an assignment handler to be called just after deferred
|
||||
function handlers.
|
||||
"""
|
||||
self._deferredAssignments.append((callable, self.scopeStack[:]))
|
||||
|
||||
def runDeferred(self, deferred):
|
||||
"""
|
||||
Run the callables in C{deferred} using their associated scope stack.
|
||||
"""
|
||||
for handler, scope in deferred:
|
||||
self.scopeStack = scope
|
||||
handler()
|
||||
|
||||
@property
|
||||
def scope(self):
|
||||
return self.scopeStack[-1]
|
||||
|
||||
def popScope(self):
|
||||
self.deadScopes.append(self.scopeStack.pop())
|
||||
|
||||
def checkDeadScopes(self):
|
||||
"""
|
||||
Look at scopes which have been fully examined and report names in them
|
||||
which were imported but unused.
|
||||
"""
|
||||
for scope in self.deadScopes:
|
||||
export = isinstance(scope.get('__all__'), ExportBinding)
|
||||
if export:
|
||||
all = scope['__all__'].names()
|
||||
if not scope.importStarred and os.path.basename(self.filename) != '__init__.py':
|
||||
# Look for possible mistakes in the export list
|
||||
undefined = set(all) - set(scope)
|
||||
for name in undefined:
|
||||
self.report(messages.UndefinedExport,
|
||||
scope['__all__'].source.lineno, name)
|
||||
else:
|
||||
all = []
|
||||
|
||||
# Look for imported names that aren't used.
|
||||
for importation in scope.values():
|
||||
if isinstance(importation, Importation):
|
||||
if not importation.used and importation.name not in all:
|
||||
self.report(messages.UnusedImport,
|
||||
importation.source.lineno, importation.name)
|
||||
|
||||
def pushFunctionScope(self):
|
||||
self.scopeStack.append(FunctionScope())
|
||||
|
||||
def pushClassScope(self):
|
||||
self.scopeStack.append(ClassScope())
|
||||
|
||||
def report(self, messageClass, *args, **kwargs):
|
||||
self.messages.append(messageClass(self.filename, *args, **kwargs))
|
||||
|
||||
def hasParent(self, node, kind):
|
||||
while hasattr(node, 'parent'):
|
||||
node = node.parent
|
||||
if isinstance(node, kind):
|
||||
return True
|
||||
|
||||
def getCommonAncestor(self, lnode, rnode, stop=None):
|
||||
if not stop:
|
||||
stop = self.root
|
||||
if lnode is rnode:
|
||||
return lnode
|
||||
if stop in (lnode, rnode):
|
||||
return stop
|
||||
|
||||
if not hasattr(lnode, 'parent') or not hasattr(rnode, 'parent'):
|
||||
return
|
||||
if (lnode.level > rnode.level):
|
||||
return self.getCommonAncestor(lnode.parent, rnode, stop)
|
||||
if (rnode.level > lnode.level):
|
||||
return self.getCommonAncestor(lnode, rnode.parent, stop)
|
||||
return self.getCommonAncestor(lnode.parent, rnode.parent, stop)
|
||||
|
||||
def descendantOf(self, node, ancestors, stop=None):
|
||||
for a in ancestors:
|
||||
if self.getCommonAncestor(node, a, stop) not in (stop, None):
|
||||
return True
|
||||
return False
|
||||
|
||||
def onFork(self, parent, lnode, rnode, items):
|
||||
return (self.descendantOf(lnode, items, parent) ^
|
||||
self.descendantOf(rnode, items, parent))
|
||||
|
||||
def differentForks(self, lnode, rnode):
|
||||
"""True, if lnode and rnode are located on different forks of IF/TRY"""
|
||||
ancestor = self.getCommonAncestor(lnode, rnode)
|
||||
if isinstance(ancestor, ast.If):
|
||||
for fork in (ancestor.body, ancestor.orelse):
|
||||
if self.onFork(ancestor, lnode, rnode, fork):
|
||||
return True
|
||||
elif isinstance(ancestor, ast_TryExcept):
|
||||
body = ancestor.body + ancestor.orelse
|
||||
for fork in [body] + [[hdl] for hdl in ancestor.handlers]:
|
||||
if self.onFork(ancestor, lnode, rnode, fork):
|
||||
return True
|
||||
elif isinstance(ancestor, ast_TryFinally):
|
||||
if self.onFork(ancestor, lnode, rnode, ancestor.body):
|
||||
return True
|
||||
return False
|
||||
|
||||
def addBinding(self, node, value, reportRedef=True):
|
||||
"""
|
||||
Called when a binding is altered.
|
||||
|
||||
- `node` is the statement responsible for the change
|
||||
- `value` is the optional new value, a Binding instance, associated
|
||||
with the binding; if None, the binding is deleted if it exists.
|
||||
- if `reportRedef` is True (default), rebinding while unused will be
|
||||
reported.
|
||||
"""
|
||||
redefinedWhileUnused = False
|
||||
if not isinstance(self.scope, ClassScope):
|
||||
for scope in self.scopeStack[::-1]:
|
||||
existing = scope.get(value.name)
|
||||
if (isinstance(existing, Importation)
|
||||
and not existing.used
|
||||
and (not isinstance(value, Importation) or value.fullName == existing.fullName)
|
||||
and reportRedef
|
||||
and not self.differentForks(node, existing.source)):
|
||||
redefinedWhileUnused = True
|
||||
self.report(messages.RedefinedWhileUnused,
|
||||
node.lineno, value.name, existing.source.lineno)
|
||||
|
||||
existing = self.scope.get(value.name)
|
||||
if not redefinedWhileUnused and self.hasParent(value.source, ast.ListComp):
|
||||
if (existing and reportRedef
|
||||
and not self.hasParent(existing.source, (ast.For, ast.ListComp))):
|
||||
self.report(messages.RedefinedInListComp,
|
||||
node.lineno, value.name, existing.source.lineno)
|
||||
|
||||
if isinstance(value, UnBinding):
|
||||
try:
|
||||
del self.scope[value.name]
|
||||
except KeyError:
|
||||
self.report(messages.UndefinedName, node.lineno, value.name)
|
||||
elif (isinstance(existing, Definition)
|
||||
and not existing.used
|
||||
and not self.differentForks(node, existing.source)):
|
||||
self.report(messages.RedefinedWhileUnused,
|
||||
node.lineno, value.name, existing.source.lineno)
|
||||
else:
|
||||
self.scope[value.name] = value
|
||||
|
||||
def handleNodeLoad(self, node):
|
||||
name = getNodeName(node)
|
||||
if not name:
|
||||
return
|
||||
# try local scope
|
||||
importStarred = self.scope.importStarred
|
||||
try:
|
||||
self.scope[name].used = (self.scope, node.lineno)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
# try enclosing function scopes
|
||||
for scope in self.scopeStack[-2:0:-1]:
|
||||
importStarred = importStarred or scope.importStarred
|
||||
if not isinstance(scope, FunctionScope):
|
||||
continue
|
||||
try:
|
||||
scope[name].used = (self.scope, node.lineno)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
# try global scope
|
||||
importStarred = importStarred or self.scopeStack[0].importStarred
|
||||
try:
|
||||
self.scopeStack[0][name].used = (self.scope, node.lineno)
|
||||
except KeyError:
|
||||
if not importStarred and name not in self.builtIns:
|
||||
if (os.path.basename(self.filename) == '__init__.py' and name == '__path__'):
|
||||
# the special name __path__ is valid only in packages
|
||||
pass
|
||||
else:
|
||||
self.report(messages.UndefinedName, node.lineno, name)
|
||||
|
||||
def handleNodeStore(self, node):
|
||||
name = getNodeName(node)
|
||||
if not name:
|
||||
return
|
||||
# if the name hasn't already been defined in the current scope
|
||||
if isinstance(self.scope, FunctionScope) and name not in self.scope:
|
||||
# for each function or module scope above us
|
||||
for scope in self.scopeStack[:-1]:
|
||||
if not isinstance(scope, (FunctionScope, ModuleScope)):
|
||||
continue
|
||||
# if the name was defined in that scope, and the name has
|
||||
# been accessed already in the current scope, and hasn't
|
||||
# been declared global
|
||||
if (name in scope and scope[name].used and scope[name].used[0] is self.scope
|
||||
and name not in self.scope.globals):
|
||||
# then it's probably a mistake
|
||||
self.report(messages.UndefinedLocal,
|
||||
scope[name].used[1], name, scope[name].source.lineno)
|
||||
break
|
||||
|
||||
parent = getattr(node, 'parent', None)
|
||||
if isinstance(parent, (ast.For, ast.comprehension, ast.Tuple, ast.List)):
|
||||
binding = Binding(name, node)
|
||||
elif parent is not None and name == '__all__' and isinstance(self.scope, ModuleScope):
|
||||
binding = ExportBinding(name, parent.value)
|
||||
else:
|
||||
binding = Assignment(name, node)
|
||||
if name in self.scope:
|
||||
binding.used = self.scope[name].used
|
||||
self.addBinding(node, binding)
|
||||
|
||||
def handleNodeDelete(self, node):
|
||||
name = getNodeName(node)
|
||||
if not name:
|
||||
return
|
||||
if isinstance(self.scope, FunctionScope) and name in self.scope.globals:
|
||||
del self.scope.globals[name]
|
||||
else:
|
||||
self.addBinding(node, UnBinding(name, node))
|
||||
|
||||
def handleChildren(self, tree):
|
||||
for node in iter_child_nodes(tree):
|
||||
self.handleNode(node, tree)
|
||||
|
||||
def isDocstring(self, node):
|
||||
"""
|
||||
Determine if the given node is a docstring, as long as it is at the
|
||||
correct place in the node tree.
|
||||
"""
|
||||
return isinstance(node, ast.Str) or (isinstance(node, ast.Expr) and
|
||||
isinstance(node.value, ast.Str))
|
||||
|
||||
def handleNode(self, node, parent):
|
||||
if node is None:
|
||||
return
|
||||
node.parent = parent
|
||||
if self.traceTree:
|
||||
print(' ' * self.nodeDepth + node.__class__.__name__)
|
||||
self.nodeDepth += 1
|
||||
if self.futuresAllowed and not (isinstance(node, ast.ImportFrom) or
|
||||
self.isDocstring(node)):
|
||||
self.futuresAllowed = False
|
||||
nodeType = node.__class__.__name__.upper()
|
||||
node.level = self.nodeDepth
|
||||
try:
|
||||
handler = getattr(self, nodeType)
|
||||
handler(node)
|
||||
finally:
|
||||
self.nodeDepth -= 1
|
||||
if self.traceTree:
|
||||
print(' ' * self.nodeDepth + 'end ' + node.__class__.__name__)
|
||||
|
||||
def ignore(self, node):
|
||||
pass
|
||||
|
||||
# "stmt" type nodes
|
||||
RETURN = DELETE = PRINT = WHILE = IF = WITH = WITHITEM = RAISE = \
|
||||
TRYEXCEPT = TRYFINALLY = TRY = ASSERT = EXEC = EXPR = handleChildren
|
||||
|
||||
CONTINUE = BREAK = PASS = ignore
|
||||
|
||||
# "expr" type nodes
|
||||
BOOLOP = BINOP = UNARYOP = IFEXP = DICT = SET = YIELD = YIELDFROM = \
|
||||
COMPARE = CALL = REPR = ATTRIBUTE = SUBSCRIPT = LIST = TUPLE = \
|
||||
STARRED = handleChildren
|
||||
|
||||
NUM = STR = BYTES = ELLIPSIS = ignore
|
||||
|
||||
# "slice" type nodes
|
||||
SLICE = EXTSLICE = INDEX = handleChildren
|
||||
|
||||
# expression contexts are node instances too, though being constants
|
||||
LOAD = STORE = DEL = AUGLOAD = AUGSTORE = PARAM = ignore
|
||||
|
||||
# same for operators
|
||||
AND = OR = ADD = SUB = MULT = DIV = MOD = POW = LSHIFT = RSHIFT = \
|
||||
BITOR = BITXOR = BITAND = FLOORDIV = INVERT = NOT = UADD = USUB = \
|
||||
EQ = NOTEQ = LT = LTE = GT = GTE = IS = ISNOT = IN = NOTIN = ignore
|
||||
|
||||
# additional node types
|
||||
COMPREHENSION = KEYWORD = handleChildren
|
||||
|
||||
def GLOBAL(self, node):
|
||||
"""
|
||||
Keep track of globals declarations.
|
||||
"""
|
||||
if isinstance(self.scope, FunctionScope):
|
||||
self.scope.globals.update(dict.fromkeys(node.names))
|
||||
|
||||
NONLOCAL = GLOBAL
|
||||
|
||||
def LISTCOMP(self, node):
|
||||
# handle generators before element
|
||||
for gen in node.generators:
|
||||
self.handleNode(gen, node)
|
||||
self.handleNode(node.elt, node)
|
||||
|
||||
GENERATOREXP = SETCOMP = LISTCOMP
|
||||
|
||||
def DICTCOMP(self, node):
|
||||
for gen in node.generators:
|
||||
self.handleNode(gen, node)
|
||||
self.handleNode(node.key, node)
|
||||
self.handleNode(node.value, node)
|
||||
|
||||
def FOR(self, node):
|
||||
"""
|
||||
Process bindings for loop variables.
|
||||
"""
|
||||
vars = []
|
||||
|
||||
def collectLoopVars(n):
|
||||
if isinstance(n, ast.Name):
|
||||
vars.append(n.id)
|
||||
elif isinstance(n, ast.expr_context):
|
||||
return
|
||||
else:
|
||||
for c in iter_child_nodes(n):
|
||||
collectLoopVars(c)
|
||||
|
||||
collectLoopVars(node.target)
|
||||
for varn in vars:
|
||||
if (isinstance(self.scope.get(varn), Importation)
|
||||
# unused ones will get an unused import warning
|
||||
and self.scope[varn].used):
|
||||
self.report(messages.ImportShadowedByLoopVar,
|
||||
node.lineno, varn, self.scope[varn].source.lineno)
|
||||
|
||||
self.handleChildren(node)
|
||||
|
||||
def NAME(self, node):
|
||||
"""
|
||||
Handle occurrence of Name (which can be a load/store/delete access.)
|
||||
"""
|
||||
if node.id == 'locals' and isinstance(node.parent, ast.Call):
|
||||
# we are doing locals() call in current scope
|
||||
self.scope.usesLocals = True
|
||||
# Locate the name in locals / function / globals scopes.
|
||||
if isinstance(node.ctx, (ast.Load, ast.AugLoad)):
|
||||
self.handleNodeLoad(node)
|
||||
elif isinstance(node.ctx, (ast.Store, ast.AugStore)):
|
||||
self.handleNodeStore(node)
|
||||
elif isinstance(node.ctx, ast.Del):
|
||||
self.handleNodeDelete(node)
|
||||
else:
|
||||
# must be a Param context -- this only happens for names in function
|
||||
# arguments, but these aren't dispatched through here
|
||||
raise RuntimeError("Got impossible expression context: %r" % (node.ctx,))
|
||||
|
||||
def FUNCTIONDEF(self, node):
|
||||
if not hasattr(node, 'decorator_list'): # Python 2.5
|
||||
node.decorator_list = node.decorators
|
||||
for deco in node.decorator_list:
|
||||
self.handleNode(deco, node)
|
||||
self.addBinding(node, FunctionDefinition(node.name, node))
|
||||
self.LAMBDA(node)
|
||||
|
||||
def LAMBDA(self, node):
|
||||
args = []
|
||||
|
||||
if PY2:
|
||||
def addArgs(arglist):
|
||||
for arg in arglist:
|
||||
if isinstance(arg, ast.Tuple):
|
||||
addArgs(arg.elts)
|
||||
else:
|
||||
if arg.id in args:
|
||||
self.report(messages.DuplicateArgument,
|
||||
node.lineno, arg.id)
|
||||
args.append(arg.id)
|
||||
addArgs(node.args.args)
|
||||
defaults = node.args.defaults
|
||||
else:
|
||||
for arg in node.args.args + node.args.kwonlyargs:
|
||||
if arg.arg in args:
|
||||
self.report(messages.DuplicateArgument,
|
||||
node.lineno, arg.arg)
|
||||
args.append(arg.arg)
|
||||
self.handleNode(arg.annotation, node)
|
||||
if hasattr(node, 'returns'): # Only for FunctionDefs
|
||||
for annotation in (node.args.varargannotation,
|
||||
node.args.kwargannotation, node.returns):
|
||||
self.handleNode(annotation, node)
|
||||
defaults = node.args.defaults + node.args.kw_defaults
|
||||
|
||||
# vararg/kwarg identifiers are not Name nodes
|
||||
for wildcard in (node.args.vararg, node.args.kwarg):
|
||||
if not wildcard:
|
||||
continue
|
||||
if wildcard in args:
|
||||
self.report(messages.DuplicateArgument, node.lineno, wildcard)
|
||||
args.append(wildcard)
|
||||
for default in defaults:
|
||||
self.handleNode(default, node)
|
||||
|
||||
def runFunction():
|
||||
|
||||
self.pushFunctionScope()
|
||||
for name in args:
|
||||
self.addBinding(node, Argument(name, node), reportRedef=False)
|
||||
if isinstance(node.body, list):
|
||||
# case for FunctionDefs
|
||||
for stmt in node.body:
|
||||
self.handleNode(stmt, node)
|
||||
else:
|
||||
# case for Lambdas
|
||||
self.handleNode(node.body, node)
|
||||
|
||||
def checkUnusedAssignments():
|
||||
"""
|
||||
Check to see if any assignments have not been used.
|
||||
"""
|
||||
for name, binding in self.scope.items():
|
||||
if (not binding.used and name not in self.scope.globals
|
||||
and not self.scope.usesLocals
|
||||
and isinstance(binding, Assignment)):
|
||||
self.report(messages.UnusedVariable,
|
||||
binding.source.lineno, name)
|
||||
self.deferAssignment(checkUnusedAssignments)
|
||||
self.popScope()
|
||||
|
||||
self.deferFunction(runFunction)
|
||||
|
||||
def CLASSDEF(self, node):
|
||||
"""
|
||||
Check names used in a class definition, including its decorators, base
|
||||
classes, and the body of its definition. Additionally, add its name to
|
||||
the current scope.
|
||||
"""
|
||||
# no class decorator in Python 2.5
|
||||
for deco in getattr(node, 'decorator_list', ''):
|
||||
self.handleNode(deco, node)
|
||||
for baseNode in node.bases:
|
||||
self.handleNode(baseNode, node)
|
||||
if not PY2:
|
||||
for keywordNode in node.keywords:
|
||||
self.handleNode(keywordNode, node)
|
||||
self.pushClassScope()
|
||||
for stmt in node.body:
|
||||
self.handleNode(stmt, node)
|
||||
self.popScope()
|
||||
self.addBinding(node, ClassDefinition(node.name, node))
|
||||
|
||||
def ASSIGN(self, node):
|
||||
self.handleNode(node.value, node)
|
||||
for target in node.targets:
|
||||
self.handleNode(target, node)
|
||||
|
||||
def AUGASSIGN(self, node):
|
||||
self.handleNodeLoad(node.target)
|
||||
self.handleNode(node.value, node)
|
||||
self.handleNode(node.target, node)
|
||||
|
||||
def IMPORT(self, node):
|
||||
for alias in node.names:
|
||||
name = alias.asname or alias.name
|
||||
importation = Importation(name, node)
|
||||
self.addBinding(node, importation)
|
||||
|
||||
def IMPORTFROM(self, node):
|
||||
if node.module == '__future__':
|
||||
if not self.futuresAllowed:
|
||||
self.report(messages.LateFutureImport,
|
||||
node.lineno, [n.name for n in node.names])
|
||||
else:
|
||||
self.futuresAllowed = False
|
||||
|
||||
for alias in node.names:
|
||||
if alias.name == '*':
|
||||
self.scope.importStarred = True
|
||||
self.report(messages.ImportStarUsed, node.lineno, node.module)
|
||||
continue
|
||||
name = alias.asname or alias.name
|
||||
importation = Importation(name, node)
|
||||
if node.module == '__future__':
|
||||
importation.used = (self.scope, node.lineno)
|
||||
self.addBinding(node, importation)
|
||||
|
||||
def EXCEPTHANDLER(self, node):
|
||||
# 3.x: in addition to handling children, we must handle the name of
|
||||
# the exception, which is not a Name node, but a simple string.
|
||||
if isinstance(node.name, str):
|
||||
self.handleNodeStore(node)
|
||||
self.handleChildren(node)
|
|
@ -1,113 +0,0 @@
|
|||
# (c) 2005 Divmod, Inc. See LICENSE file for details
|
||||
|
||||
|
||||
class Message(object):
|
||||
message = ''
|
||||
message_args = ()
|
||||
|
||||
def __init__(self, filename, lineno):
|
||||
self.filename = filename
|
||||
self.lineno = lineno
|
||||
|
||||
def __str__(self):
|
||||
return '%s:%s: %s' % (self.filename, self.lineno, self.message % self.message_args)
|
||||
|
||||
|
||||
class UnusedImport(Message):
|
||||
message = '%r imported but unused'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class RedefinedWhileUnused(Message):
|
||||
message = 'redefinition of unused %r from line %r'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class RedefinedInListComp(Message):
|
||||
message = 'list comprehension redefines %r from line %r'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportShadowedByLoopVar(Message):
|
||||
message = 'import %r from line %r shadowed by loop variable'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportStarUsed(Message):
|
||||
message = "'from %s import *' used; unable to detect undefined names"
|
||||
|
||||
def __init__(self, filename, lineno, modname):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (modname,)
|
||||
|
||||
|
||||
class UndefinedName(Message):
|
||||
message = 'undefined name %r'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class UndefinedExport(Message):
|
||||
message = 'undefined name %r in __all__'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class UndefinedLocal(Message):
|
||||
message = "local variable %r (defined in enclosing scope on line %r) referenced before assignment"
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class DuplicateArgument(Message):
|
||||
message = 'duplicate argument %r in function definition'
|
||||
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class Redefined(Message):
|
||||
message = 'redefinition of %r from line %r'
|
||||
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class LateFutureImport(Message):
|
||||
message = 'future import(s) %r after other statements'
|
||||
|
||||
def __init__(self, filename, lineno, names):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (names,)
|
||||
|
||||
|
||||
class UnusedVariable(Message):
|
||||
"""
|
||||
Indicates that a variable has been explicity assigned to but not actually
|
||||
used.
|
||||
"""
|
||||
message = 'local variable %r is assigned to but never used'
|
||||
|
||||
def __init__(self, filename, lineno, names):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (names,)
|
|
@ -1,79 +0,0 @@
|
|||
# (c) 2005-2012 Divmod, Inc.
|
||||
# See LICENSE file for details
|
||||
|
||||
import sys
|
||||
try:
|
||||
u = unicode
|
||||
except NameError:
|
||||
u = str
|
||||
|
||||
|
||||
class Reporter(object):
|
||||
"""
|
||||
Formats the results of pyflakes checks to users.
|
||||
"""
|
||||
|
||||
def __init__(self, warningStream, errorStream):
|
||||
"""
|
||||
Construct a L{Reporter}.
|
||||
|
||||
@param warningStream: A file-like object where warnings will be
|
||||
written to. The stream's C{write} method must accept unicode.
|
||||
C{sys.stdout} is a good value.
|
||||
@param errorStream: A file-like object where error output will be
|
||||
written to. The stream's C{write} method must accept unicode.
|
||||
C{sys.stderr} is a good value.
|
||||
"""
|
||||
self._stdout = warningStream
|
||||
self._stderr = errorStream
|
||||
|
||||
def unexpectedError(self, filename, msg):
|
||||
"""
|
||||
An unexpected error occurred trying to process C{filename}.
|
||||
|
||||
@param filename: The path to a file that we could not process.
|
||||
@ptype filename: C{unicode}
|
||||
@param msg: A message explaining the problem.
|
||||
@ptype msg: C{unicode}
|
||||
"""
|
||||
self._stderr.write(u("%s: %s\n") % (filename, msg))
|
||||
|
||||
def syntaxError(self, filename, msg, lineno, offset, text):
|
||||
"""
|
||||
There was a syntax errror in C{filename}.
|
||||
|
||||
@param filename: The path to the file with the syntax error.
|
||||
@ptype filename: C{unicode}
|
||||
@param msg: An explanation of the syntax error.
|
||||
@ptype msg: C{unicode}
|
||||
@param lineno: The line number where the syntax error occurred.
|
||||
@ptype lineno: C{int}
|
||||
@param offset: The column on which the syntax error occurred.
|
||||
@ptype offset: C{int}
|
||||
@param text: The source code containing the syntax error.
|
||||
@ptype text: C{unicode}
|
||||
"""
|
||||
line = text.splitlines()[-1]
|
||||
if offset is not None:
|
||||
offset = offset - (len(text) - len(line))
|
||||
self._stderr.write(u('%s:%d: %s\n') % (filename, lineno, msg))
|
||||
self._stderr.write(u(line))
|
||||
self._stderr.write(u('\n'))
|
||||
if offset is not None:
|
||||
self._stderr.write(u(" " * (offset + 1) + "^\n"))
|
||||
|
||||
def flake(self, message):
|
||||
"""
|
||||
pyflakes found something wrong with the code.
|
||||
|
||||
@param: A L{pyflakes.messages.Message}.
|
||||
"""
|
||||
self._stdout.write(u(message))
|
||||
self._stdout.write(u('\n'))
|
||||
|
||||
|
||||
def _makeDefaultReporter():
|
||||
"""
|
||||
Make a reporter that can be used when no reporter is specified.
|
||||
"""
|
||||
return Reporter(sys.stdout, sys.stderr)
|
50
vim/gvimrc
50
vim/gvimrc
|
@ -1,50 +0,0 @@
|
|||
"
|
||||
" GVIMRC - for GUI Vim Version (gvim, MacVim)
|
||||
"
|
||||
" $Id$
|
||||
"
|
||||
|
||||
set guifont=Monaco\ 11
|
||||
set anti
|
||||
set lines=45 " Change in vimrc.local
|
||||
set columns=90 " Change in vimrc.local
|
||||
set mousefocus
|
||||
set errorbells
|
||||
set visualbell
|
||||
set showtabline=2
|
||||
set guicursor=a:block-blinkon0
|
||||
set showtabline=2
|
||||
set guitablabel=%!GuiTabLabel()
|
||||
set guitabtooltip=%!GuiTabToolTip()
|
||||
set background=dark
|
||||
|
||||
if has('mac') || has('macunix')
|
||||
set guifont=Monaco:h11
|
||||
set fuoptions=maxvert,maxhorz
|
||||
set transparency=4
|
||||
endif
|
||||
|
||||
set guioptions-=T
|
||||
set guioptions+=a
|
||||
if &background == "dark"
|
||||
hi normal guibg=black
|
||||
endif
|
||||
|
||||
" colorscheme railscasts
|
||||
" colorscheme zenburn
|
||||
colorscheme freya
|
||||
" colorscheme southwest-fog
|
||||
" colorscheme moria
|
||||
" colorscheme morning
|
||||
" colorscheme desert
|
||||
" colorscheme macvim
|
||||
" colorscheme inkpot
|
||||
|
||||
" Emacs like indenting. Pressing Tab indents line
|
||||
set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
|
||||
set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
|
||||
|
||||
" User customizations are held in file ~/.vim/gvimrc.local
|
||||
if filereadable($HOME."/.vim/gvimrc.local")
|
||||
source $HOME/.vim/gvimrc.local
|
||||
endif
|
|
@ -1,330 +0,0 @@
|
|||
" Vim indent file
|
||||
" Language: Javascript
|
||||
" Maintainer: Darrick Wiebe <darrick at innatesoftware.com>
|
||||
" URL: http://github.com/pangloss/vim-javascript
|
||||
" Version: 1.0.0
|
||||
" Last Change: August 31, 2009
|
||||
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
|
||||
|
||||
" 0. Initialization {{{1
|
||||
" =================
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal nosmartindent
|
||||
|
||||
" Now, set up our indentation expression and keys that trigger it.
|
||||
setlocal indentexpr=GetJavascriptIndent()
|
||||
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetJavascriptIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" 1. Variables {{{1
|
||||
" ============
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let s:syng_strcom = '\<javaScript\%(RegexpString\|CommentTodo\|LineComment\|Comment\|DocComment\)\>'
|
||||
|
||||
" Regex of syntax group names that are strings.
|
||||
let s:syng_string =
|
||||
\ '\<javaScript\%(RegexpString\)\>'
|
||||
|
||||
" Regex of syntax group names that are strings or documentation.
|
||||
let s:syng_stringdoc =
|
||||
\'\<javaScriptDocComment\>'
|
||||
|
||||
" Expression used to check whether we should skip a match with searchpair().
|
||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
||||
|
||||
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
|
||||
|
||||
" Regex that defines continuation lines, not including (, {, or [.
|
||||
let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
|
||||
|
||||
" Regex that defines continuation lines.
|
||||
" TODO: this needs to deal with if ...: and so on
|
||||
let s:msl_regex = '\%([\\*+/.:([]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
|
||||
|
||||
let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{]*' . s:line_term
|
||||
|
||||
" Regex that defines blocks.
|
||||
let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
|
||||
|
||||
" 2. Auxiliary Functions {{{1
|
||||
" ======================
|
||||
|
||||
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
||||
function s:IsInStringOrComment(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string.
|
||||
function s:IsInString(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string or documentation.
|
||||
function s:IsInStringOrDocumentation(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
|
||||
endfunction
|
||||
|
||||
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
||||
function s:PrevNonBlankNonString(lnum)
|
||||
let in_block = 0
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
while lnum > 0
|
||||
" Go in and out of blocks comments as necessary.
|
||||
" If the line isn't empty (with opt. comment) or in a string, end search.
|
||||
let line = getline(lnum)
|
||||
if line =~ '/\*'
|
||||
if in_block
|
||||
let in_block = 0
|
||||
else
|
||||
break
|
||||
endif
|
||||
elseif !in_block && line =~ '\*/'
|
||||
let in_block = 1
|
||||
elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
endwhile
|
||||
return lnum
|
||||
endfunction
|
||||
|
||||
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
|
||||
function s:GetMSL(lnum, in_one_line_scope)
|
||||
" Start on the line we're at and use its indent.
|
||||
let msl = a:lnum
|
||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
||||
while lnum > 0
|
||||
" If we have a continuation line, or we're in a string, use line as MSL.
|
||||
" Otherwise, terminate search as we have found our MSL already.
|
||||
let line = getline(lnum)
|
||||
let col = match(line, s:msl_regex) + 1
|
||||
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
|
||||
let msl = lnum
|
||||
else
|
||||
" Don't use lines that are part of a one line scope as msl unless the
|
||||
" flag in_one_line_scope is set to 1
|
||||
"
|
||||
if a:in_one_line_scope
|
||||
break
|
||||
end
|
||||
let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
|
||||
if msl_one_line == 0
|
||||
break
|
||||
endif
|
||||
endif
|
||||
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
||||
endwhile
|
||||
return msl
|
||||
endfunction
|
||||
|
||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
||||
function s:LineHasOpeningBrackets(lnum)
|
||||
let open_0 = 0
|
||||
let open_2 = 0
|
||||
let open_4 = 0
|
||||
let line = getline(a:lnum)
|
||||
let pos = match(line, '[][(){}]', 0)
|
||||
while pos != -1
|
||||
if !s:IsInStringOrComment(a:lnum, pos + 1)
|
||||
let idx = stridx('(){}[]', line[pos])
|
||||
if idx % 2 == 0
|
||||
let open_{idx} = open_{idx} + 1
|
||||
else
|
||||
let open_{idx - 1} = open_{idx - 1} - 1
|
||||
endif
|
||||
endif
|
||||
let pos = match(line, '[][(){}]', pos + 1)
|
||||
endwhile
|
||||
return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
|
||||
endfunction
|
||||
|
||||
function s:Match(lnum, regex)
|
||||
let col = match(getline(a:lnum), a:regex) + 1
|
||||
return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
|
||||
endfunction
|
||||
|
||||
function s:IndentWithContinuation(lnum, ind, width)
|
||||
" Set up variables to use and search for MSL to the previous line.
|
||||
let p_lnum = a:lnum
|
||||
let lnum = s:GetMSL(a:lnum, 1)
|
||||
let line = getline(line)
|
||||
|
||||
" If the previous line wasn't a MSL and is continuation return its indent.
|
||||
" TODO: the || s:IsInString() thing worries me a bit.
|
||||
if p_lnum != lnum
|
||||
if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
|
||||
return a:ind + a:width
|
||||
endif
|
||||
endif
|
||||
|
||||
" Set up more variables now that we know we aren't continuation bound.
|
||||
let msl_ind = indent(lnum)
|
||||
|
||||
" If the previous line ended with [*+/.-=], start a continuation that
|
||||
" indents an extra level.
|
||||
if s:Match(lnum, s:continuation_regex)
|
||||
if lnum == p_lnum
|
||||
return msl_ind + a:width
|
||||
else
|
||||
return msl_ind
|
||||
endif
|
||||
endif
|
||||
|
||||
return a:ind
|
||||
endfunction
|
||||
|
||||
function s:InOneLineScope(lnum)
|
||||
let msl = s:GetMSL(a:lnum, 1)
|
||||
if msl > 0 && s:Match(msl, s:one_line_scope_regex)
|
||||
return msl
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function s:ExitingOneLineScope(lnum)
|
||||
let msl = s:GetMSL(a:lnum, 1)
|
||||
if msl > 0
|
||||
" if the current line is in a one line scope ..
|
||||
if s:Match(msl, s:one_line_scope_regex)
|
||||
return 0
|
||||
else
|
||||
let prev_msl = s:GetMSL(msl - 1, 1)
|
||||
if s:Match(prev_msl, s:one_line_scope_regex)
|
||||
return prev_msl
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" 3. GetJavascriptIndent Function {{{1
|
||||
" =========================
|
||||
|
||||
function GetJavascriptIndent()
|
||||
" 3.1. Setup {{{2
|
||||
" ----------
|
||||
|
||||
" Set up variables for restoring position in file. Could use v:lnum here.
|
||||
let vcol = col('.')
|
||||
|
||||
" 3.2. Work on the current line {{{2
|
||||
" -----------------------------
|
||||
|
||||
" Get the current line.
|
||||
let line = getline(v:lnum)
|
||||
let ind = -1
|
||||
|
||||
|
||||
" If we got a closing bracket on an empty line, find its match and indent
|
||||
" according to it. For parentheses we indent to its column - 1, for the
|
||||
" others we indent to the containing line's MSL's level. Return -1 if fail.
|
||||
let col = matchend(line, '^\s*[]})]')
|
||||
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
|
||||
call cursor(v:lnum, col)
|
||||
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
||||
if line[col-1]==')' && col('.') != col('$') - 1
|
||||
let ind = virtcol('.')-1
|
||||
else
|
||||
let ind = indent(s:GetMSL(line('.'), 0))
|
||||
endif
|
||||
endif
|
||||
return ind
|
||||
endif
|
||||
|
||||
" If we have a /* or */ set indent to first column.
|
||||
if match(line, '^\s*\%(/\*\|\*/\)$') != -1
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If we are in a multi-line string or line-comment, don't do anything to it.
|
||||
if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1)
|
||||
return indent('.')
|
||||
endif
|
||||
|
||||
" 3.3. Work on the previous line. {{{2
|
||||
" -------------------------------
|
||||
|
||||
" Find a non-blank, non-multi-line string line above the current line.
|
||||
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
|
||||
|
||||
" If the line is empty and inside a string, use the previous line.
|
||||
if line =~ '^\s*$' && lnum != prevnonblank(v:lnum - 1)
|
||||
return indent(prevnonblank(v:lnum))
|
||||
endif
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Set up variables for current line.
|
||||
let line = getline(lnum)
|
||||
let ind = indent(lnum)
|
||||
|
||||
" If the previous line ended with a block opening, add a level of indent.
|
||||
if s:Match(lnum, s:block_regex)
|
||||
return indent(s:GetMSL(lnum, 0)) + &sw
|
||||
endif
|
||||
|
||||
" If the previous line contained an opening bracket, and we are still in it,
|
||||
" add indent depending on the bracket type.
|
||||
if line =~ '[[({]'
|
||||
let counts = s:LineHasOpeningBrackets(lnum)
|
||||
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||
if col('.') + 1 == col('$')
|
||||
return ind + &sw
|
||||
else
|
||||
return virtcol('.')
|
||||
endif
|
||||
elseif counts[1] == '1' || counts[2] == '1'
|
||||
return ind + &sw
|
||||
else
|
||||
call cursor(v:lnum, vcol)
|
||||
end
|
||||
endif
|
||||
|
||||
" 3.4. Work on the MSL line. {{{2
|
||||
" --------------------------
|
||||
|
||||
let ind_con = ind
|
||||
let ind = s:IndentWithContinuation(lnum, ind_con, &sw)
|
||||
|
||||
" }}}2
|
||||
"
|
||||
"
|
||||
let ols = s:InOneLineScope(lnum)
|
||||
if ols > 0
|
||||
let ind = ind + &sw
|
||||
else
|
||||
let ols = s:ExitingOneLineScope(lnum)
|
||||
while ols > 0 && ind > 0
|
||||
let ind = ind - &sw
|
||||
let ols = s:InOneLineScope(ols - 1)
|
||||
endwhile
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim:set sw=2 sts=2 ts=8 noet:
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
" Vim indent file
|
||||
" Language: Python
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Original Author: David Bustos <bustos@caltech.edu>
|
||||
" Last Change: 2006 Jun 18
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" Some preliminary settings
|
||||
setlocal nolisp " Make sure lisp indenting doesn't supersede us
|
||||
setlocal autoindent " indentexpr isn't much help otherwise
|
||||
|
||||
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||
setlocal indentkeys+=<:>,=elif,=except,0#
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetPythonIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Come here when loading the script the first time.
|
||||
|
||||
let s:maxoff = 50 " maximum number of lines to look backwards for ()
|
||||
|
||||
function GetPythonIndent(lnum)
|
||||
|
||||
" If this line is explicitly joined: If the previous line was also joined,
|
||||
" line it up with that one, otherwise add two 'shiftwidth'
|
||||
if getline(a:lnum - 1) =~ '\\$'
|
||||
if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
|
||||
return indent(a:lnum - 1)
|
||||
endif
|
||||
return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2))
|
||||
endif
|
||||
|
||||
" If the start of the line is in a string don't change the indent.
|
||||
if has('syntax_items')
|
||||
\ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$"
|
||||
return -1
|
||||
endif
|
||||
|
||||
" Search backwards for the previous non-empty line.
|
||||
let plnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
if plnum == 0
|
||||
" This is the first non-empty line, use zero indent.
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If the previous line is inside parenthesis, use the indent of the starting
|
||||
" line.
|
||||
" Trick: use the non-existing "dummy" variable to break out of the loop when
|
||||
" going too far back.
|
||||
call cursor(plnum, 1)
|
||||
let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
|
||||
\ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
if parlnum > 0
|
||||
let plindent = indent(parlnum)
|
||||
let plnumstart = parlnum
|
||||
else
|
||||
let plindent = indent(plnum)
|
||||
let plnumstart = plnum
|
||||
endif
|
||||
|
||||
|
||||
" When inside parenthesis: If at the first line below the parenthesis add
|
||||
" two 'shiftwidth', otherwise same as previous line.
|
||||
" i = (a
|
||||
" + b
|
||||
" + c)
|
||||
call cursor(a:lnum, 1)
|
||||
let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
if p > 0
|
||||
if p == plnum
|
||||
" When the start is inside parenthesis, only indent one 'shiftwidth'.
|
||||
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||
\ . " =~ '\\(Comment\\|String\\)$'")
|
||||
if pp > 0
|
||||
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : &sw)
|
||||
endif
|
||||
return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (&sw * 2))
|
||||
endif
|
||||
if plnumstart == p
|
||||
return indent(plnum)
|
||||
endif
|
||||
return plindent
|
||||
endif
|
||||
|
||||
|
||||
" Get the line and remove a trailing comment.
|
||||
" Use syntax highlighting attributes when possible.
|
||||
let pline = getline(plnum)
|
||||
let pline_len = strlen(pline)
|
||||
if has('syntax_items')
|
||||
" If the last character in the line is a comment, do a binary search for
|
||||
" the start of the comment. synID() is slow, a linear search would take
|
||||
" too long on a long line.
|
||||
if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$"
|
||||
let min = 1
|
||||
let max = pline_len
|
||||
while min < max
|
||||
let col = (min + max) / 2
|
||||
if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$"
|
||||
let max = col
|
||||
else
|
||||
let min = col + 1
|
||||
endif
|
||||
endwhile
|
||||
let pline = strpart(pline, 0, min - 1)
|
||||
endif
|
||||
else
|
||||
let col = 0
|
||||
while col < pline_len
|
||||
if pline[col] == '#'
|
||||
let pline = strpart(pline, 0, col)
|
||||
break
|
||||
endif
|
||||
let col = col + 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
" If the previous line ended with a colon, indent this line
|
||||
if pline =~ ':\s*$'
|
||||
return plindent + &sw
|
||||
endif
|
||||
|
||||
" If the previous line was a stop-execution statement...
|
||||
if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||
" See if the user has already dedented
|
||||
if indent(a:lnum) > indent(plnum) - &sw
|
||||
" If not, recommend one dedent
|
||||
return indent(plnum) - &sw
|
||||
endif
|
||||
" Otherwise, trust the user
|
||||
return -1
|
||||
endif
|
||||
|
||||
" If the current line begins with a keyword that lines up with "try"
|
||||
if getline(a:lnum) =~ '^\s*\(except\|finally\)\>'
|
||||
let lnum = a:lnum - 1
|
||||
while lnum >= 1
|
||||
if getline(lnum) =~ '^\s*\(try\|except\)\>'
|
||||
let ind = indent(lnum)
|
||||
if ind >= indent(a:lnum)
|
||||
return -1 " indent is already less than this
|
||||
endif
|
||||
return ind " line up with previous try or except
|
||||
endif
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
return -1 " no matching "try"!
|
||||
endif
|
||||
|
||||
" If the current line begins with a header keyword, dedent
|
||||
if getline(a:lnum) =~ '^\s*\(elif\|else\)\>'
|
||||
|
||||
" Unless the previous line was a one-liner
|
||||
if getline(plnumstart) =~ '^\s*\(for\|if\|try\)\>'
|
||||
return plindent
|
||||
endif
|
||||
|
||||
" Or the user has already dedented
|
||||
if indent(a:lnum) <= plindent - &sw
|
||||
return -1
|
||||
endif
|
||||
|
||||
return plindent - &sw
|
||||
endif
|
||||
|
||||
" When after a () construct we probably want to go back to the start line.
|
||||
" a = (b
|
||||
" + c)
|
||||
" here
|
||||
if parlnum > 0
|
||||
return plindent
|
||||
endif
|
||||
|
||||
return -1
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:sw=2
|
|
@ -1 +0,0 @@
|
|||
setlocal indentkeys+=0#
|
|
@ -1,2 +0,0 @@
|
|||
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
vim +PluginInstall +qall
|
|
@ -1,41 +0,0 @@
|
|||
" ============================================================================
|
||||
" File: exec_menuitem.vim
|
||||
" Description: plugin for NERD Tree that provides an execute file menu item
|
||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Last Change: 22 July, 2009
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" ============================================================================
|
||||
if exists("g:loaded_nerdtree_exec_menuitem")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_nerdtree_exec_menuitem = 1
|
||||
|
||||
call NERDTreeAddMenuItem({
|
||||
\ 'text': '(!)Execute file',
|
||||
\ 'shortcut': '!',
|
||||
\ 'callback': 'NERDTreeExecFile',
|
||||
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
|
||||
|
||||
function! NERDTreeExecFileActive()
|
||||
let node = g:NERDTreeFileNode.GetSelected()
|
||||
return !node.path.isDirectory && node.path.isExecutable
|
||||
endfunction
|
||||
|
||||
function! NERDTreeExecFile()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
echo "==========================================================\n"
|
||||
echo "Complete the command to execute (add arguments etc):\n"
|
||||
let cmd = treenode.path.str({'escape': 1})
|
||||
let cmd = input(':!', cmd . ' ')
|
||||
|
||||
if cmd != ''
|
||||
exec ':!' . cmd
|
||||
else
|
||||
echo "Aborted"
|
||||
endif
|
||||
endfunction
|
|
@ -1,224 +0,0 @@
|
|||
" ============================================================================
|
||||
" File: fs_menu.vim
|
||||
" Description: plugin for the NERD Tree that provides a file system menu
|
||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Last Change: 17 July, 2009
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" ============================================================================
|
||||
if exists("g:loaded_nerdtree_fs_menu")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_nerdtree_fs_menu = 1
|
||||
|
||||
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||
|
||||
if has("gui_mac") || has("gui_macvim")
|
||||
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
|
||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
|
||||
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
|
||||
endif
|
||||
|
||||
if g:NERDTreePath.CopyingSupported()
|
||||
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||
endif
|
||||
|
||||
"FUNCTION: s:echo(msg){{{1
|
||||
function! s:echo(msg)
|
||||
redraw
|
||||
echomsg "NERDTree: " . a:msg
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:echoWarning(msg){{{1
|
||||
function! s:echoWarning(msg)
|
||||
echohl warningmsg
|
||||
call s:echo(a:msg)
|
||||
echohl normal
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
|
||||
"prints out the given msg and, if the user responds by pushing 'y' then the
|
||||
"buffer with the given bufnum is deleted
|
||||
"
|
||||
"Args:
|
||||
"bufnum: the buffer that may be deleted
|
||||
"msg: a message that will be echoed to the user asking them if they wish to
|
||||
" del the buffer
|
||||
function! s:promptToDelBuffer(bufnum, msg)
|
||||
echo a:msg
|
||||
if nr2char(getchar()) ==# 'y'
|
||||
exec "silent bdelete! " . a:bufnum
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: NERDTreeAddNode(){{{1
|
||||
function! NERDTreeAddNode()
|
||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||
|
||||
let newNodeName = input("Add a childnode\n".
|
||||
\ "==========================================================\n".
|
||||
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
|
||||
\ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
|
||||
|
||||
if newNodeName ==# ''
|
||||
call s:echo("Node Creation Aborted.")
|
||||
return
|
||||
endif
|
||||
|
||||
try
|
||||
let newPath = g:NERDTreePath.Create(newNodeName)
|
||||
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
|
||||
|
||||
let newTreeNode = g:NERDTreeFileNode.New(newPath)
|
||||
if parentNode.isOpen || !empty(parentNode.children)
|
||||
call parentNode.addChild(newTreeNode, 1)
|
||||
call NERDTreeRender()
|
||||
call newTreeNode.putCursorHere(1, 0)
|
||||
endif
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Node Not Created.")
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
"FUNCTION: NERDTreeMoveNode(){{{1
|
||||
function! NERDTreeMoveNode()
|
||||
let curNode = g:NERDTreeFileNode.GetSelected()
|
||||
let newNodePath = input("Rename the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "Enter the new path for the node: \n" .
|
||||
\ "", curNode.path.str(), "file")
|
||||
|
||||
if newNodePath ==# ''
|
||||
call s:echo("Node Renaming Aborted.")
|
||||
return
|
||||
endif
|
||||
|
||||
try
|
||||
let bufnum = bufnr(curNode.path.str())
|
||||
|
||||
call curNode.rename(newNodePath)
|
||||
call NERDTreeRender()
|
||||
|
||||
"if the node is open in a buffer, ask the user if they want to
|
||||
"close that buffer
|
||||
if bufnum != -1
|
||||
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||
call s:promptToDelBuffer(bufnum, prompt)
|
||||
endif
|
||||
|
||||
call curNode.putCursorHere(1, 0)
|
||||
|
||||
redraw
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Node Not Renamed.")
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||
function! NERDTreeDeleteNode()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let confirmed = 0
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
let choice =input("Delete the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||
\ "" . currentNode.path.str() . ": ")
|
||||
let confirmed = choice ==# 'yes'
|
||||
else
|
||||
echo "Delete the current node\n" .
|
||||
\ "==========================================================\n".
|
||||
\ "Are you sure you wish to delete the node:\n" .
|
||||
\ "" . currentNode.path.str() . " (yN):"
|
||||
let choice = nr2char(getchar())
|
||||
let confirmed = choice ==# 'y'
|
||||
endif
|
||||
|
||||
|
||||
if confirmed
|
||||
try
|
||||
call currentNode.delete()
|
||||
call NERDTreeRender()
|
||||
|
||||
"if the node is open in a buffer, ask the user if they want to
|
||||
"close that buffer
|
||||
let bufnum = bufnr(currentNode.path.str())
|
||||
if buflisted(bufnum)
|
||||
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||
call s:promptToDelBuffer(bufnum, prompt)
|
||||
endif
|
||||
|
||||
redraw
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Could not remove node")
|
||||
endtry
|
||||
else
|
||||
call s:echo("delete aborted")
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||
function! NERDTreeCopyNode()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let newNodePath = input("Copy the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "Enter the new path to copy the node to: \n" .
|
||||
\ "", currentNode.path.str(), "file")
|
||||
|
||||
if newNodePath != ""
|
||||
"strip trailing slash
|
||||
let newNodePath = substitute(newNodePath, '\/$', '', '')
|
||||
|
||||
let confirmed = 1
|
||||
if currentNode.path.copyingWillOverwrite(newNodePath)
|
||||
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
|
||||
let choice = nr2char(getchar())
|
||||
let confirmed = choice ==# 'y'
|
||||
endif
|
||||
|
||||
if confirmed
|
||||
try
|
||||
let newNode = currentNode.copy(newNodePath)
|
||||
if !empty(newNode)
|
||||
call NERDTreeRender()
|
||||
call newNode.putCursorHere(0, 0)
|
||||
endif
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Could not copy node")
|
||||
endtry
|
||||
endif
|
||||
else
|
||||
call s:echo("Copy aborted.")
|
||||
endif
|
||||
redraw
|
||||
endfunction
|
||||
|
||||
function! NERDTreeQuickLook()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
if treenode != {}
|
||||
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! NERDTreeRevealInFinder()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
if treenode != {}
|
||||
let x = system("open -R '" . treenode.path.str() . "'")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! NERDTreeExecuteFile()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
if treenode != {}
|
||||
let x = system("open '" . treenode.path.str() . "'")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -1,12 +0,0 @@
|
|||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
910 18164 :AutoInstall: pydoc.vim
|
||||
2771 16279 :AutoInstall: conque_term.vim
|
||||
294 19633 :AutoInstall: Align.vim
|
||||
1066 7618 :AutoInstall: cecutil.vim
|
||||
642 15781 :AutoInstall: getscript.vim
|
||||
2324 9247 :AutoInstall: TextFormat
|
||||
1658 17123 :AutoInstall: NERD_tree.vim
|
||||
1218 14455 :AutoInstall: NERD_commenter.vim
|
||||
90 19809 :AutoInstall: vcscommand.vim
|
||||
2896 11941 :AutoInstall: open_terminal.vim
|
|
@ -1,18 +0,0 @@
|
|||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 Align.vim
|
||||
302 2 AnsiEsc.vim
|
||||
122 3 astronaut.vim
|
||||
104 4 blockhl.vim
|
||||
120 5 decho.vim
|
||||
40 6 DrawIt.tar.gz
|
||||
451 7 EasyAccents.vim
|
||||
195 8 engspchk.vim
|
||||
642 9 GetLatestVimScripts.vim
|
||||
489 10 Manpageview.vim
|
||||
551 11 Mines.vim
|
||||
514 12 mrswin.vim
|
||||
670 13 visincr.vim
|
||||
628 14 SeeTab.vim
|
||||
508 15 ZoomWin.vim
|
||||
877 16 gvcolor.vim
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,213 +0,0 @@
|
|||
" FILE: plugin/conque_term.vim {{{
|
||||
" AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
" 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.
|
||||
" }}}
|
||||
|
||||
" See docs/conque_term.txt for help or type :help ConqueTerm
|
||||
|
||||
if exists('g:ConqueTerm_Loaded') || v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
" **********************************************************************************************************
|
||||
" **** CONFIGURATION ***************************************************************************************
|
||||
" **********************************************************************************************************
|
||||
|
||||
" {{{
|
||||
|
||||
" Fast mode {{{
|
||||
" Disables all features which could cause Conque to run slowly, including:
|
||||
" * Disables terminal colors
|
||||
" * Disables some multi-byte character handling
|
||||
if !exists('g:ConqueTerm_FastMode')
|
||||
let g:ConqueTerm_FastMode = 0
|
||||
endif " }}}
|
||||
|
||||
" automatically go into insert mode when entering buffer {{{
|
||||
if !exists('g:ConqueTerm_InsertOnEnter')
|
||||
let g:ConqueTerm_InsertOnEnter = 0
|
||||
endif " }}}
|
||||
|
||||
" Allow user to use <C-w> keys to switch window in insert mode. {{{
|
||||
if !exists('g:ConqueTerm_CWInsert')
|
||||
let g:ConqueTerm_CWInsert = 0
|
||||
endif " }}}
|
||||
|
||||
" Choose key mapping to leave insert mode {{{
|
||||
" If you choose something other than '<Esc>', then <Esc> will be sent to terminal
|
||||
" Using a different key will usually fix Alt/Meta key issues
|
||||
if !exists('g:ConqueTerm_EscKey')
|
||||
let g:ConqueTerm_EscKey = '<Esc>'
|
||||
endif " }}}
|
||||
|
||||
" Use this key to execute the current file in a split window. {{{
|
||||
" THIS IS A GLOBAL KEY MAPPING
|
||||
if !exists('g:ConqueTerm_ExecFileKey')
|
||||
let g:ConqueTerm_ExecFileKey = '<F11>'
|
||||
endif " }}}
|
||||
|
||||
" Use this key to send the current file contents to conque. {{{
|
||||
" THIS IS A GLOBAL KEY MAPPING
|
||||
if !exists('g:ConqueTerm_SendFileKey')
|
||||
let g:ConqueTerm_SendFileKey = '<F10>'
|
||||
endif " }}}
|
||||
|
||||
" Use this key to send selected text to conque. {{{
|
||||
" THIS IS A GLOBAL KEY MAPPING
|
||||
if !exists('g:ConqueTerm_SendVisKey')
|
||||
let g:ConqueTerm_SendVisKey = '<F9>'
|
||||
endif " }}}
|
||||
|
||||
" Use this key to toggle terminal key mappings. {{{
|
||||
" Only mapped inside of Conque buffers.
|
||||
if !exists('g:ConqueTerm_ToggleKey')
|
||||
let g:ConqueTerm_ToggleKey = '<F8>'
|
||||
endif " }}}
|
||||
|
||||
" Enable color. {{{
|
||||
" If your apps use a lot of color it will slow down the shell.
|
||||
" 0 - no terminal colors. You still will see Vim syntax highlighting.
|
||||
" 1 - limited terminal colors (recommended). Past terminal color history cleared regularly.
|
||||
" 2 - all terminal colors. Terminal color history never cleared.
|
||||
if !exists('g:ConqueTerm_Color')
|
||||
let g:ConqueTerm_Color = 1
|
||||
endif " }}}
|
||||
|
||||
" Color mode. Windows ONLY {{{
|
||||
" Set this variable to 'conceal' to use Vim's conceal mode for terminal colors.
|
||||
" This makes colors render much faster, but has some odd baggage.
|
||||
if !exists('g:ConqueTerm_ColorMode')
|
||||
let g:ConqueTerm_ColorMode = ''
|
||||
endif " }}}
|
||||
|
||||
" TERM environment setting {{{
|
||||
if !exists('g:ConqueTerm_TERM')
|
||||
let g:ConqueTerm_TERM = 'vt100'
|
||||
endif " }}}
|
||||
|
||||
" Syntax for your buffer {{{
|
||||
if !exists('g:ConqueTerm_Syntax')
|
||||
let g:ConqueTerm_Syntax = 'conque_term'
|
||||
endif " }}}
|
||||
|
||||
" Keep on updating the shell window after you've switched to another buffer {{{
|
||||
if !exists('g:ConqueTerm_ReadUnfocused')
|
||||
let g:ConqueTerm_ReadUnfocused = 0
|
||||
endif " }}}
|
||||
|
||||
" Use this regular expression to highlight prompt {{{
|
||||
if !exists('g:ConqueTerm_PromptRegex')
|
||||
let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
|
||||
endif " }}}
|
||||
|
||||
" Choose which Python version to attempt to load first {{{
|
||||
" Valid values are 2, 3 or 0 (no preference)
|
||||
if !exists('g:ConqueTerm_PyVersion')
|
||||
let g:ConqueTerm_PyVersion = 2
|
||||
endif " }}}
|
||||
|
||||
" Path to python.exe. (Windows only) {{{
|
||||
" By default, Conque will check C:\PythonNN\python.exe then will search system path
|
||||
" If you have installed Python in an unusual location and it's not in your path, fill in the full path below
|
||||
" E.g. 'C:\Program Files\Python\Python27\python.exe'
|
||||
if !exists('g:ConqueTerm_PyExe')
|
||||
let g:ConqueTerm_PyExe = ''
|
||||
endif " }}}
|
||||
|
||||
" Automatically close buffer when program exits {{{
|
||||
if !exists('g:ConqueTerm_CloseOnEnd')
|
||||
let g:ConqueTerm_CloseOnEnd = 0
|
||||
endif " }}}
|
||||
|
||||
" Send function key presses to terminal {{{
|
||||
if !exists('g:ConqueTerm_SendFunctionKeys')
|
||||
let g:ConqueTerm_SendFunctionKeys = 0
|
||||
endif " }}}
|
||||
|
||||
" Session support {{{
|
||||
if !exists('g:ConqueTerm_SessionSupport')
|
||||
let g:ConqueTerm_SessionSupport = 0
|
||||
endif " }}}
|
||||
|
||||
" hide Conque startup messages {{{
|
||||
" messages should only appear the first 3 times you start Vim with a new version of Conque
|
||||
" and include important Conque feature and option descriptions
|
||||
" TODO - disabled and unused for now
|
||||
if !exists('g:ConqueTerm_StartMessages')
|
||||
let g:ConqueTerm_StartMessages = 1
|
||||
endif " }}}
|
||||
|
||||
" Windows character code page {{{
|
||||
" Leave at 0 to use current environment code page.
|
||||
" Use 65001 for utf-8, although many console apps do not support it.
|
||||
if !exists('g:ConqueTerm_CodePage')
|
||||
let g:ConqueTerm_CodePage = 0
|
||||
endif " }}}
|
||||
|
||||
" InsertCharPre support {{{
|
||||
" Disable this feature by default, still in Beta
|
||||
if !exists('g:ConqueTerm_InsertCharPre')
|
||||
let g:ConqueTerm_InsertCharPre = 0
|
||||
endif " }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" **********************************************************************************************************
|
||||
" **** Startup *********************************************************************************************
|
||||
" **********************************************************************************************************
|
||||
|
||||
" Startup {{{
|
||||
|
||||
let g:ConqueTerm_Loaded = 1
|
||||
let g:ConqueTerm_Idx = 0
|
||||
let g:ConqueTerm_Version = 210
|
||||
|
||||
command! -nargs=+ -complete=shellcmd ConqueTerm call conque_term#open(<q-args>)
|
||||
command! -nargs=+ -complete=shellcmd ConqueTermSplit call conque_term#open(<q-args>, ['belowright split'])
|
||||
command! -nargs=+ -complete=shellcmd ConqueTermVSplit call conque_term#open(<q-args>, ['belowright vsplit'])
|
||||
command! -nargs=+ -complete=shellcmd ConqueTermTab call conque_term#open(<q-args>, ['tabnew'])
|
||||
|
||||
" }}}
|
||||
|
||||
" **********************************************************************************************************
|
||||
" **** Global Mappings & Autocommands **********************************************************************
|
||||
" **********************************************************************************************************
|
||||
|
||||
" Startup {{{
|
||||
|
||||
if exists('g:ConqueTerm_SessionSupport') && g:ConqueTerm_SessionSupport == 1
|
||||
autocmd SessionLoadPost * call conque_term#resume_session()
|
||||
endif
|
||||
|
||||
if maparg(g:ConqueTerm_ExecFileKey, 'n') == ''
|
||||
exe 'nnoremap <silent> ' . g:ConqueTerm_ExecFileKey . ' :call conque_term#exec_file()<CR>'
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
" vim:foldmethod=marker
|
|
@ -1,629 +0,0 @@
|
|||
if &cp || exists("loaded_jsbeautify")
|
||||
finish
|
||||
endif
|
||||
let loaded_jsbeautify = 3
|
||||
|
||||
|
||||
|
||||
function! s:trim_output()
|
||||
while len(s:output) > 0 && (s:output[len(s:output)-1] == " " || s:output[len(s:output)-1] == s:indent_string)
|
||||
call remove(s:output, -1)
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:print_newline(ignore_repeated)
|
||||
let s:if_line_flag = 0
|
||||
call s:trim_output()
|
||||
if len(s:output)==0
|
||||
return
|
||||
endif
|
||||
if s:output[len(s:output)-1] != "\n" || !a:ignore_repeated
|
||||
call add(s:output, "\n")
|
||||
endif
|
||||
let index = 0
|
||||
while index < s:indent_level
|
||||
call add(s:output, s:indent_string)
|
||||
let index += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:print_space()
|
||||
let last_output = " "
|
||||
if len(s:output) > 0
|
||||
let last_output = s:output[len(s:output) - 1]
|
||||
endif
|
||||
if last_output != " " && last_output != "\n" && last_output != s:indent_string
|
||||
call add(s:output, " ")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:print_token()
|
||||
call add(s:output, s:token_text)
|
||||
endfunctio
|
||||
|
||||
function! s:indent()
|
||||
let s:indent_level += 1
|
||||
endfunction
|
||||
|
||||
function! s:unindent()
|
||||
if s:indent_level
|
||||
let s:indent_level -= 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:remove_indent()
|
||||
if len(s:output)>0 && s:output[len(s:output) -1] == s:indent_string
|
||||
call remove(s:output, -1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:set_mode(mode)
|
||||
call add(s:modes, s:current_mode)
|
||||
let s:current_mode = a:mode
|
||||
endfunction
|
||||
|
||||
function! s:restore_mode()
|
||||
if s:current_mode == "DO_BLOCK"
|
||||
let s:do_block_just_closed = 1
|
||||
else
|
||||
let s:do_block_just_closed = 0
|
||||
endif
|
||||
let s:current_mode = remove(s:modes, -1)
|
||||
endfunction
|
||||
|
||||
function! s:in_array(what, arr)
|
||||
return index(a:arr, a:what) != -1
|
||||
endfunction
|
||||
|
||||
function! s:get_next_token()
|
||||
let n_newlines = 0
|
||||
|
||||
if s:parser_pos >= len(s:input)
|
||||
return ["", "TK_EOF"]
|
||||
endif
|
||||
|
||||
let c = s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
|
||||
while s:in_array(c, s:whitespace)
|
||||
if s:parser_pos >= len(s:input)
|
||||
return ["", "TK_EOF"]
|
||||
endif
|
||||
|
||||
if c == "\n"
|
||||
let n_newlines += 1
|
||||
endif
|
||||
|
||||
let c = s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
endwhile
|
||||
|
||||
let wanted_newline = 0
|
||||
|
||||
if s:opt_preserve_newlines
|
||||
if n_newlines > 1
|
||||
for i in [0, 1]
|
||||
call s:print_newline(i==0)
|
||||
endfor
|
||||
endif
|
||||
let wanted_newline = n_newlines == 1
|
||||
endif
|
||||
|
||||
if s:in_array(c, s:wordchar)
|
||||
if s:parser_pos < len(s:input)
|
||||
while s:in_array(s:input[s:parser_pos], s:wordchar)
|
||||
let c .= s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos == len(s:input)
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
|
||||
"if s:parser_pos != len(s:input) && c =~ /^[0-9]+[Ee]$/ && (s:input[s:parser_pos] == "-" || s:input[s:parser_pos] == "+")
|
||||
"let sign = s:input[s:parser_pos]
|
||||
"let s:parser_pos += 1
|
||||
|
||||
"let t = get_next_token(s:parser_pos)
|
||||
"let c .= sign . t[0]
|
||||
"return [c, "TK_WORD"]
|
||||
" endif
|
||||
|
||||
if c == "in"
|
||||
return [c, "TK_OPERATOR"]
|
||||
endif
|
||||
if wanted_newline && s:last_type != "TK_OPERATOR" && !s:if_line_flag
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
return [c, "TK_WORD"]
|
||||
endif
|
||||
if c == "(" || c == "["
|
||||
return [c, "TK_START_EXPR"]
|
||||
endif
|
||||
|
||||
if c == ")" || c == "]"
|
||||
return [c, "TK_END_EXPR"]
|
||||
endif
|
||||
|
||||
if c == "{"
|
||||
return [c, "TK_START_BLOCK"]
|
||||
endif
|
||||
|
||||
if c == "}"
|
||||
return [c, "TK_END_BLOCK"]
|
||||
endif
|
||||
|
||||
if c == ";"
|
||||
return [c, "TK_SEMICOLON"]
|
||||
endif
|
||||
|
||||
if c == "/"
|
||||
let comment = ""
|
||||
if s:input[s:parser_pos] == "*"
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos < len(s:input)
|
||||
while !(s:input[s:parser_pos] == "*" && s:parser_pos + 1 < len(s:input) && s:input[s:parser_pos + 1] == "/" && s:parser_pos < len(s:input))
|
||||
let comment .= s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos >= len(s:input)
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
let s:parser_pos += 2
|
||||
return ['/*' . comment . '*/', 'TK_BLOCK_COMMENT']
|
||||
endif
|
||||
|
||||
" peek for comment // ...
|
||||
if s:input[s:parser_pos] == "/"
|
||||
let comment = c
|
||||
while s:input[s:parser_pos] != "\r" && s:input[s:parser_pos] != "\n"
|
||||
let comment .= s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos >= len(s:input)
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
let s:parser_pos += 1
|
||||
if wanted_newline
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
return [comment, "TK_COMMENT"]
|
||||
endif
|
||||
endif
|
||||
|
||||
if c == "'" || c =='"' || (c == "/" && ((s:last_type == "TK_WORD" && s:last_text == "return") || (s:last_type == "TK_START_EXPR" || s:last_type == "TK_START_BLOCK" || s:last_type == "TK_END_BLOCK" || s:last_type == "TK_OPERATOR" || s:last_type == "TK_EOF" || s:last_type == "TK_SEMICOLON")))
|
||||
let sep = c
|
||||
let esc = 0
|
||||
let resulting_string = c
|
||||
|
||||
if s:parser_pos < len(s:input)
|
||||
while esc || s:input[s:parser_pos] != sep
|
||||
let resulting_string .= s:input[s:parser_pos]
|
||||
if !esc
|
||||
let esc = s:input[s:parser_pos] == "\\"
|
||||
else
|
||||
let esc = 0
|
||||
endif
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos >= len(s:input)
|
||||
return [resulting_string, "TK_STRING"]
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
|
||||
let s:parser_pos += 1
|
||||
|
||||
let resulting_string .= sep
|
||||
|
||||
if sep == "/"
|
||||
|
||||
while s:parser_pos < len(s:input) && s:in_array(s:input[s:parser_pos], s:wordchar)
|
||||
let resulting_string .= s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
endwhile
|
||||
endif
|
||||
return [resulting_string, "TK_STRING"]
|
||||
endif
|
||||
|
||||
if c == "#"
|
||||
let sharp = "#"
|
||||
if s:parser_pos < len(s:input) && s:in_array(s:input[s:parser_pos], s:digits)
|
||||
let c = s:input[s:parser_pos]
|
||||
let sharp .= c
|
||||
let s:parser_pos += 1
|
||||
|
||||
while s:parser_pos < len(s:input) && c != "#" && c !="="
|
||||
let c = s:input[s:parser_pos]
|
||||
let sharp .= c
|
||||
let s:parser_pos += 1
|
||||
endwhile
|
||||
|
||||
if c == "#"
|
||||
return [sharp, "TK_WORD"]
|
||||
else
|
||||
return [sharp, "TK_OPERATOR"]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if c == "<" && s:input[s:parser_pos-1 : s:parser_pos+3] == "<!--"
|
||||
let s:parser_pos += 3
|
||||
return ["<!--", "TK_COMMENT"]
|
||||
endif
|
||||
|
||||
if c == "-" && s:input[s:parser_pos-1 : s:parser_pos+2] == "-->"
|
||||
let s:parser_pos += 2
|
||||
if wanted_newline
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
return ["-->", "TK_COMMENT"]
|
||||
endif
|
||||
|
||||
if s:in_array(c, s:punct)
|
||||
while s:parser_pos < len(s:input) && s:in_array(c . s:input[s:parser_pos], s:punct)
|
||||
let c .= s:input[s:parser_pos]
|
||||
let s:parser_pos += 1
|
||||
if s:parser_pos >= len(s:input)
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return [c, "TK_OPERATOR"]
|
||||
endif
|
||||
|
||||
return [c, "TK_UNKNOWN"]
|
||||
endif
|
||||
|
||||
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:is_js()
|
||||
return expand("%:e") == "js"
|
||||
endfunction
|
||||
|
||||
"function! g:Jsbeautify(js_source_text, options)
|
||||
function! g:Jsbeautify()
|
||||
if !s:is_js()
|
||||
echo "Not a JS file."
|
||||
return
|
||||
endif
|
||||
|
||||
"let a:options = {}
|
||||
let s:opt_indent_size = 1
|
||||
let s:opt_indent_char = " "
|
||||
let s:opt_preserve_newlines = 1
|
||||
let s:opt_indent_level = 0
|
||||
|
||||
let s:if_line_flag = 0
|
||||
"--------------------------------
|
||||
|
||||
let s:indent_string = ""
|
||||
while s:opt_indent_size > 0
|
||||
let s:indent_string .= s:opt_indent_char
|
||||
let s:opt_indent_size -= 1
|
||||
endwhile
|
||||
|
||||
let s:indent_level = s:opt_indent_level
|
||||
|
||||
let lines = getline(1, "$")
|
||||
let s:input = join(lines, "\n")
|
||||
"let s:input = a:js_source_text
|
||||
|
||||
let s:last_word = "" "last 'TK_WORD' passed
|
||||
let s:last_type = "TK_START_EXPR" "last token type
|
||||
let s:last_text = "" "last token text
|
||||
let s:output = []
|
||||
|
||||
let s:do_block_just_closed = 0
|
||||
let s:var_line = 0
|
||||
let s:var_line_tainted = 0
|
||||
|
||||
let s:whitespace = ["\n", "\r", "\t", " "]
|
||||
let s:wordchar = split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$", '\zs')
|
||||
let s:digits = split("0123456789", '\zs')
|
||||
|
||||
"<!-- is a special case (ok, it"s a minor hack actually)
|
||||
let s:punct = split("+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::", " ")
|
||||
|
||||
let s:line_starters = split("continue,try,throw,return,var,if,switch,case,default,for,while,break", ",")
|
||||
|
||||
let s:current_mode = "BLOCK"
|
||||
let s:modes = [s:current_mode]
|
||||
|
||||
let s:parser_pos = 0
|
||||
let s:in_case = 0
|
||||
while 1
|
||||
let t = s:get_next_token()
|
||||
let s:token_text = t[0]
|
||||
let s:token_type = t[1]
|
||||
if s:token_type == "TK_EOF"
|
||||
break
|
||||
endif
|
||||
|
||||
try
|
||||
if s:token_type == "TK_START_EXPR"
|
||||
let s:var_line = 0
|
||||
call s:set_mode("EXPRESSION")
|
||||
if s:last_text == ";"
|
||||
call s:print_newline(1)
|
||||
elseif s:last_type == "TK_END_EXPR" || s:last_type == "TK_START_EXPR"
|
||||
" do nothing on (( and )( and ][ and ]( ..
|
||||
elseif s:last_type != "TK_WORD" && s:last_type != "TK_OPERATOR"
|
||||
call s:print_space()
|
||||
elseif s:in_array(s:last_word, s:line_starters)
|
||||
call s:print_space()
|
||||
endif
|
||||
|
||||
call s:print_token()
|
||||
|
||||
elseif s:token_type == "TK_END_EXPR"
|
||||
call s:print_token()
|
||||
call s:restore_mode()
|
||||
elseif s:token_type == "TK_START_BLOCK"
|
||||
|
||||
if s:last_word == "do"
|
||||
call s:set_mode("DO_BLOCK")
|
||||
else
|
||||
call s:set_mode("BLOCK")
|
||||
endif
|
||||
if s:last_type != "TK_OPERATOR" && s:last_type != "TK_START_EXPR"
|
||||
if s:last_type == "TK_START_BLOCK"
|
||||
call s:print_newline(1)
|
||||
else
|
||||
call s:print_space()
|
||||
endif
|
||||
endif
|
||||
call s:print_token()
|
||||
call s:indent()
|
||||
elseif s:token_type == "TK_END_BLOCK"
|
||||
if s:last_type == "TK_START_BLOCK"
|
||||
call s:remove_indent()
|
||||
call s:unindent()
|
||||
else
|
||||
call s:unindent()
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
call s:print_token()
|
||||
call s:restore_mode()
|
||||
|
||||
elseif s:token_type == "TK_WORD"
|
||||
if s:do_block_just_closed
|
||||
" do {} ## while ()
|
||||
call s:print_space()
|
||||
call s:print_token()
|
||||
call s:print_space()
|
||||
let s:do_block_just_closed = 0
|
||||
throw "jump out"
|
||||
endif
|
||||
if s:token_text == "case" || s:token_text == "default"
|
||||
if s:last_text == ":"
|
||||
"switch cases following one another
|
||||
call s:remove_indent()
|
||||
else
|
||||
" case statement starts in the same line where switch
|
||||
call s:unindent()
|
||||
call s:print_newline(1)
|
||||
call s:indent()
|
||||
endif
|
||||
call s:print_token()
|
||||
let s:in_case = 1
|
||||
throw "jump out"
|
||||
endif
|
||||
|
||||
let s:prefix = "NONE"
|
||||
|
||||
if s:last_type == "TK_END_BLOCK"
|
||||
if !s:in_array(tolower(s:token_text), ["else", "catch", "finally"])
|
||||
let s:prefix = "NEWLINE"
|
||||
else
|
||||
let s:prefix = "SPACE"
|
||||
call s:print_space()
|
||||
endif
|
||||
elseif s:last_type == "TK_SEMICOLON" && (s:current_mode == "BLOCK" || s:current_mode == "DO_BLOCK")
|
||||
let s:prefix = "NEWLINE"
|
||||
elseif s:last_type == "TK_SEMICOLON" && s:current_mode == "EXPRESSION"
|
||||
let s:prefix = "SPACE"
|
||||
elseif s:last_type == "TK_STRING"
|
||||
let s:prefix = "NEWLINE"
|
||||
elseif s:last_type == "TK_WORD"
|
||||
let s:prefix = "SPACE"
|
||||
elseif s:last_type == "TK_START_BLOCK"
|
||||
let s:prefix = "NEWLINE"
|
||||
elseif s:last_type == "TK_END_EXPR"
|
||||
call s:print_space()
|
||||
let s:prefix = "NEWLINE"
|
||||
endif
|
||||
|
||||
if s:last_type != "TK_END_BLOCK" && s:in_array(tolower(s:token_text), ["else", "catch", "finally"])
|
||||
call s:print_newline(1)
|
||||
elseif s:in_array(s:token_text, s:line_starters) || s:prefix == "NEWLINE"
|
||||
if s:last_text == "else"
|
||||
call s:print_space()
|
||||
elseif (s:last_type == "TK_START_EXPR" || s:last_text == "=" || s:last_text == ",") && s:token_text == "function"
|
||||
" no need to force newline on "function":
|
||||
" DONOTHINT
|
||||
elseif s:last_type == "TK_WORD" && (s:last_text == "return" || s:last_text == "throw")
|
||||
" no newline between "return nnn"
|
||||
call s:print_space()
|
||||
elseif s:last_type != "TK_END_EXPR"
|
||||
if (s:last_type != "TK_START_EXPR" || s:token_text != "var") && s:last_text != ":"
|
||||
" no need to force newline on "var": for (var
|
||||
" x = 0...)
|
||||
if s:token_text == "if" && s:last_type == "TK_WORD" && s:last_word == "else"
|
||||
" no newline for } else if {
|
||||
call s:print_space()
|
||||
else
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if s:in_array(s:token_text, s:line_starters) && s:last_text != ")"
|
||||
call s:print_newline(1)
|
||||
endif
|
||||
endif
|
||||
elseif s:prefix == "SPACE"
|
||||
call s:print_space()
|
||||
endif
|
||||
call s:print_token()
|
||||
let s:last_word = s:token_text
|
||||
|
||||
if s:token_text == "var"
|
||||
let s:var_line = 1
|
||||
let s:var_line_tainted = 0
|
||||
endif
|
||||
|
||||
if s:token_text == "if" || s:token_text == "else"
|
||||
let s:if_line_flag = 1
|
||||
endif
|
||||
|
||||
elseif s:token_type == "TK_SEMICOLON"
|
||||
call s:print_token()
|
||||
let s:var_line = 0
|
||||
|
||||
elseif s:token_type == "TK_STRING"
|
||||
if s:last_type == "TK_START_BLOCK" || s:last_type == "TK_END_BLOCK" || s:last_type == "TK_SEMICOLON"
|
||||
call s:print_newline(1)
|
||||
elseif s:last_type == "TK_WORD"
|
||||
call s:print_space()
|
||||
endif
|
||||
call s:print_token()
|
||||
|
||||
elseif s:token_type == "TK_OPERATOR"
|
||||
|
||||
let start_delim = 1
|
||||
let end_delim = 1
|
||||
if s:var_line && s:token_text != ","
|
||||
let s:var_line_tainted = 1
|
||||
if s:token_text == ":"
|
||||
let s:var_line = 0
|
||||
endif
|
||||
endif
|
||||
if s:var_line && s:token_text=="," && s:current_mode == "EXPRESSION"
|
||||
" do not break on comma, for(var a = 1, b = 2)
|
||||
let s:var_line_tainted = 0
|
||||
endif
|
||||
|
||||
if s:token_text == ":" && s:in_case
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
throw "jump out"
|
||||
endif
|
||||
|
||||
if s:token_text == "::"
|
||||
" no spaces around exotic namespacing syntax operator
|
||||
call s:print_token()
|
||||
throw "jump out"
|
||||
endif
|
||||
|
||||
let s:in_case = 0
|
||||
|
||||
if s:token_text == ","
|
||||
if s:var_line
|
||||
if s:var_line_tainted
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
let s:var_line_tainted = 0
|
||||
else
|
||||
call s:print_token()
|
||||
call s:print_space()
|
||||
endif
|
||||
elseif s:last_type == "TK_END_BLOCK"
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
else
|
||||
if s:current_mode == "BLOCK"
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
else
|
||||
" EXPR od DO_BLOCK
|
||||
call s:print_token()
|
||||
call s:print_space()
|
||||
endif
|
||||
endif
|
||||
throw "jump out"
|
||||
elseif s:token_text == "--" || s:token_text == "++" " unary operators special case
|
||||
if s:last_text == ";"
|
||||
" space for (;; ++i)
|
||||
let start_delim = 1
|
||||
let end_delim = 0
|
||||
else
|
||||
let start_delim = 0
|
||||
let end_delim = 0
|
||||
endif
|
||||
elseif s:token_text == "!" && s:last_type == "TK_START_EXPR"
|
||||
" special case handling: if (!a)
|
||||
let start_delim = 0
|
||||
let end_delim = 0
|
||||
elseif s:last_type == "TK_OPERATOR"
|
||||
let s:start_delim = 0
|
||||
let s:end_delim = 0
|
||||
elseif s:last_type == "TK_END_EXPR"
|
||||
let s:start_delim = 1
|
||||
let s:end_delim = 1
|
||||
elseif s:token_text == "."
|
||||
" decimal digits or object.property
|
||||
let start_delim = 0
|
||||
let end_delim = 0
|
||||
elseif s:token_text == ":"
|
||||
" zz: xx
|
||||
" can"t differentiate ternary op, so for now it"s a ? b:
|
||||
" c;without space before colon
|
||||
if s:last_text =~ '/^\d+$/'
|
||||
" a little help for ternary a ? 1 : 0
|
||||
let start_delim = 1
|
||||
else
|
||||
let start_delim = 0
|
||||
endif
|
||||
endif
|
||||
if start_delim
|
||||
call s:print_space()
|
||||
endif
|
||||
|
||||
call s:print_token()
|
||||
|
||||
if end_delim
|
||||
call s:print_space()
|
||||
endif
|
||||
throw "jump out"
|
||||
|
||||
elseif s:token_type == "TK_BLOCK_COMMENT"
|
||||
call s:print_newline(1)
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
|
||||
elseif s:token_type == "TK_COMMENT"
|
||||
|
||||
"call s:print_newline(1)
|
||||
call s:print_space()
|
||||
call s:print_token()
|
||||
call s:print_newline(1)
|
||||
|
||||
elseif s:token_type == "TK_UNKNOWN"
|
||||
call s:print_token()
|
||||
throw "jump out"
|
||||
endif
|
||||
catch /.*/
|
||||
if v:exception != 'jump out'
|
||||
echo "exception caught: " v:exception
|
||||
endif
|
||||
endtry
|
||||
|
||||
let s:last_type = s:token_type
|
||||
let s:last_text = s:token_text
|
||||
endwhile
|
||||
|
||||
" mark position
|
||||
let save_cursor = getpos(".")
|
||||
|
||||
let ret = join(s:output, "")
|
||||
:g/.*/d
|
||||
let @0 = ret
|
||||
:put!0
|
||||
|
||||
" go back
|
||||
call setpos('.', save_cursor)
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <leader>ff :call g:Jsbeautify()<cr>
|
|
@ -1,108 +0,0 @@
|
|||
"
|
||||
" File: open_terminal.vim
|
||||
"
|
||||
" Requires:
|
||||
" platform Terminal File manager
|
||||
" Mac Terminal.app Finder
|
||||
" (with Applescript)
|
||||
" Gnome gnome-terminal nautilus
|
||||
" KDE konsole konqueror
|
||||
" Windows cmd explorer
|
||||
" (with start)
|
||||
" cygwin bash explorer
|
||||
"
|
||||
" Example:
|
||||
" nnoremap <silent> <F9> :OpenTerminal<CR>
|
||||
" nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
|
||||
"
|
||||
" Commands:
|
||||
" OpenTerminal
|
||||
" OpenFilemanager
|
||||
"
|
||||
|
||||
" OpenTerminal {{{1
|
||||
function! s:open_terminal()
|
||||
let l:current_dir = getcwd()
|
||||
execute("chdir " . escape(expand("%:p:h"), " \"'"))
|
||||
|
||||
if has("mac")
|
||||
let l:cmd = "
|
||||
\ tell application 'System Events' \n
|
||||
\ set is_term_running to exists application process '$Terminal' \n
|
||||
\ end tell \n
|
||||
\
|
||||
\ set cmd to 'cd $current_path' \n
|
||||
\ tell application '$Terminal' \n
|
||||
\ activate \n
|
||||
\ if is_term_running is true then \n
|
||||
\ do script with command cmd \n
|
||||
\ else \n
|
||||
\ do script with command cmd in window 1 \n
|
||||
\ end if \n
|
||||
\ end tell \n
|
||||
\ "
|
||||
let l:cmd = substitute(l:cmd, "'", '\\"', 'g')
|
||||
let l:cmd = substitute( l:cmd, "$Terminal", "Terminal", "g" )
|
||||
let l:cmd = substitute( l:cmd, "$current_path", "'" . expand("%:p:h") . "'" , "g")
|
||||
call system('osascript -e " ' . l:cmd . '"')
|
||||
|
||||
elseif has("gui_gnome") && executable("gnome-terminal")
|
||||
call system("gnome-terminal &")
|
||||
elseif has("gui_gnome") && executable("konsole")
|
||||
call system("konsole &")
|
||||
elseif has("gui_win32")
|
||||
try
|
||||
call system("start cmd")
|
||||
catch /E484:/
|
||||
echo "Ignore E484 error in Windows platform"
|
||||
endtry
|
||||
elseif executable("bash")
|
||||
!bash
|
||||
elseif has("win32")
|
||||
stop
|
||||
endif
|
||||
|
||||
execute("chdir " . escape(l:current_dir, " \"'"))
|
||||
endfunction
|
||||
|
||||
command! -nargs=0 -bar OpenTerminal call s:open_terminal()
|
||||
|
||||
"}}}1
|
||||
|
||||
" OpenFilemanager {{{1
|
||||
function! s:open_filemanager()
|
||||
let l:cmd = "$cmd ."
|
||||
|
||||
let l:current_dir = getcwd()
|
||||
execute("chdir " . escape(expand("%:p:h"), " \"'"))
|
||||
|
||||
if has("mac")
|
||||
call system("open .")
|
||||
elseif has("gui_gnome") && executable("nautilus")
|
||||
call system("nautilus .")
|
||||
elseif has("gui_gnome") && executable("konqueror")
|
||||
call system("konqueror .")
|
||||
elseif has("gui_win32") || has("win32")
|
||||
call system("explorer .")
|
||||
elseif executable("bash")
|
||||
!bash
|
||||
endif
|
||||
|
||||
execute("chdir " . escape(l:current_dir, " \"'"))
|
||||
endfunction
|
||||
|
||||
command! -nargs=0 -bar OpenFilemanager call s:open_filemanager()
|
||||
" }}}1
|
||||
|
||||
" About file info {{{1
|
||||
"=============================================================================
|
||||
" Copyright (c) 2009 by neocoin
|
||||
" File: open_terminal.vim
|
||||
" Author: Sangmin Ryu (neocoin@gmail.com)
|
||||
" Date: Tue Dec 22 13:33:32 PST 2009
|
||||
" License: The MIT License
|
||||
" Version: 0.1
|
||||
"=============================================================================
|
||||
" }}}1
|
||||
|
||||
" vim: set fdm=marker:
|
|
@ -1,75 +0,0 @@
|
|||
" Copyright by Andrea Mistrali <am@am.cx>
|
||||
" First version: Who knows?
|
||||
" Last modified: 2009-04-28T17:26 CEST (+0200)
|
||||
"
|
||||
" Synopsis: Templating system for vim
|
||||
"
|
||||
" Remember to define in your vimrc the following var
|
||||
" let g:fullname = 'Your Full Name'
|
||||
" let g:email = 'your.email@address'
|
||||
"
|
||||
" Skeleton files could contain (in the first 20 lines) the following
|
||||
" 'vars':
|
||||
" @@LONGNAME@@ - replaced by g:fullname
|
||||
" @@EMAIL@@ - replaced by g:email
|
||||
" @@DESCR@@ - Synopsis of file (asked by this plugin)
|
||||
" @@crdate@@ - replaced by creation date
|
||||
|
||||
" Define template directory
|
||||
let g:skeletons = '~/.vim/templates'
|
||||
let s:timeFormat= "%FT%H:%M %Z (%z)"
|
||||
|
||||
" Preserve template files
|
||||
augroup newfiles
|
||||
" First we load templates for the file type
|
||||
autocmd BufNewFile * ks|call OpenFile()|'s
|
||||
|
||||
" Update of "Last Modified" date on writing
|
||||
" autocmd BufWritePre,FileWritePre * ks|call LastMod()|'s
|
||||
|
||||
" Protect templates and plugin, removing write commands
|
||||
autocmd BufRead,BufNewFile ~/.vim/templates/* au! newfiles
|
||||
autocmd BufRead,BufNewFile */skeleton.vim au! newfiles
|
||||
autocmd BufWritePre,FileWritePre */skeleton.vim au! newfiles
|
||||
augroup END
|
||||
|
||||
|
||||
" Function to modify "Last Modified" date. Works on first N lines
|
||||
function! LastMod()
|
||||
if line("$") > 20
|
||||
let l = 20
|
||||
else
|
||||
let l = line("$")
|
||||
endif
|
||||
execute "1," . l . "s/Last modified: .*/Last modified: " .
|
||||
\ strftime(s:timeFormat) . "/e"
|
||||
endfunction
|
||||
|
||||
" Function to open a file and set some defaults
|
||||
function! OpenFile()
|
||||
let s:filename=expand("<afile>")
|
||||
let l:ext=fnamemodify(s:filename, ":e")
|
||||
let l:skel = g:skeletons."/skeleton.".l:ext
|
||||
if filereadable(fnamemodify(l:skel,":p"))
|
||||
let s:doit=input("Perform auto insert (y/n)? ")
|
||||
if s:doit == 'n' || s:doit == 'N'
|
||||
return
|
||||
endif
|
||||
execute "0r" l:skel
|
||||
let s:syn=input("Synopsis: ")
|
||||
if line("$") > 20
|
||||
let l = 20
|
||||
else
|
||||
let l = line("$")
|
||||
endif
|
||||
execute "1," . l . "s/@@DESCR@@/" .
|
||||
\ s:syn
|
||||
execute "1," . l . "s/@@crdate@@/" .
|
||||
\ strftime(s:timeFormat) . "/e"
|
||||
execute "1," . l . "s/@@LONGNAME@@/" .
|
||||
\ g:fullname . "/e"
|
||||
execute "1," . l . "s/@@EMAIL@@/" .
|
||||
\ g:email . "/e"
|
||||
endif
|
||||
endfunction
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,66 +0,0 @@
|
|||
" Text formatter plugin for Vim text editor
|
||||
"
|
||||
" Version: 2.1
|
||||
" Last Change: 2008-09-13
|
||||
" Maintainer: Teemu Likonen <tlikonen@iki.fi>
|
||||
" License: This file is placed in the public domain.
|
||||
" GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat
|
||||
|
||||
"{{{1 The beginning stuff
|
||||
if &compatible || exists('g:loaded_textformat')
|
||||
finish
|
||||
endif
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
"}}}1
|
||||
|
||||
if v:version < 700
|
||||
echohl ErrorMsg
|
||||
echomsg 'TextFormat plugin needs Vim version 7.0 or later. Sorry.'
|
||||
echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists(':AlignLeft')
|
||||
command -nargs=? -range AlignLeft <line1>,<line2>call textformat#Align_Command('left',<args>)
|
||||
endif
|
||||
if !exists(':AlignRight')
|
||||
command -nargs=? -range AlignRight <line1>,<line2>call textformat#Align_Command('right',<args>)
|
||||
endif
|
||||
if !exists(':AlignJustify')
|
||||
command -nargs=? -range AlignJustify <line1>,<line2>call textformat#Align_Command('justify',<args>)
|
||||
endif
|
||||
if !exists(':AlignCenter')
|
||||
command -nargs=? -range AlignCenter <line1>,<line2>call textformat#Align_Command('center',<args>)
|
||||
endif
|
||||
|
||||
nnoremap <silent> <Plug>Quick_Align_Paragraph_Left :call textformat#Quick_Align_Left()<CR>
|
||||
nnoremap <silent> <Plug>Quick_Align_Paragraph_Right :call textformat#Quick_Align_Right()<CR>
|
||||
nnoremap <silent> <Plug>Quick_Align_Paragraph_Justify :call textformat#Quick_Align_Justify()<CR>
|
||||
nnoremap <silent> <Plug>Quick_Align_Paragraph_Center :call textformat#Quick_Align_Center()<CR>
|
||||
|
||||
vnoremap <silent> <Plug>Align_Range_Left :call textformat#Visual_Align_Left()<CR>
|
||||
vnoremap <silent> <Plug>Align_Range_Right :call textformat#Visual_Align_Right()<CR>
|
||||
vnoremap <silent> <Plug>Align_Range_Justify :call textformat#Visual_Align_Justify()<CR>
|
||||
vnoremap <silent> <Plug>Align_Range_Center :call textformat#Visual_Align_Center()<CR>
|
||||
|
||||
function! s:Add_Mapping(mode, lhs, rhs)
|
||||
if maparg(a:lhs, a:mode) == '' && !hasmapto(a:rhs, a:mode)
|
||||
execute a:mode.'map '.a:lhs.' '.a:rhs
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call s:Add_Mapping('n', '<Leader>al', '<Plug>Quick_Align_Paragraph_Left')
|
||||
call s:Add_Mapping('n', '<Leader>ar', '<Plug>Quick_Align_Paragraph_Right')
|
||||
call s:Add_Mapping('n', '<Leader>aj', '<Plug>Quick_Align_Paragraph_Justify')
|
||||
call s:Add_Mapping('n', '<Leader>ac', '<Plug>Quick_Align_Paragraph_Center')
|
||||
|
||||
call s:Add_Mapping('v', '<Leader>al', '<Plug>Align_Range_Left')
|
||||
call s:Add_Mapping('v', '<Leader>ar', '<Plug>Align_Range_Right')
|
||||
call s:Add_Mapping('v', '<Leader>aj', '<Plug>Align_Range_Justify')
|
||||
call s:Add_Mapping('v', '<Leader>ac', '<Plug>Align_Range_Center')
|
||||
|
||||
delfunction s:Add_Mapping
|
||||
let g:loaded_textformat = 1
|
||||
let &cpo = s:save_cpo
|
||||
" vim600: fdm=marker
|
|
@ -1,264 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" BZR extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandBZRExec
|
||||
" This variable specifies the BZR executable. If not set, it defaults to
|
||||
" 'bzr' executed from the user's executable path.
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
|
||||
" BZR is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:bzrFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke bzr suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'BZR'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'BZR VCSCommand plugin called on non-BZR item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:bzrFunctions.Identify(buffer) {{{2
|
||||
function! s:bzrFunctions.Identify(buffer)
|
||||
let fileName = resolve(bufname(a:buffer))
|
||||
let l:save_bzr_log=$BZR_LOG
|
||||
try
|
||||
let $BZR_LOG=has("win32") || has("win95") || has("win64") || has("win16") ? "nul" : "/dev/null"
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
|
||||
finally
|
||||
let $BZR_LOG=l:save_bzr_log
|
||||
endtry
|
||||
if(v:shell_error)
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Add() {{{2
|
||||
function! s:bzrFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Annotate(argList) {{{2
|
||||
function! s:bzrFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype ==? 'bzrannotate'
|
||||
" Perform annotation of the version indicated by the current line.
|
||||
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = ''
|
||||
let options = ''
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let caption = a:argList[0]
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = join(a:argList, ' ')
|
||||
let options = ' ' . caption
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||
if resultBuffer > 0
|
||||
normal! 1G2dd
|
||||
endif
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Commit(argList) {{{2
|
||||
function! s:bzrFunctions.Commit(argList)
|
||||
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||
if resultBuffer == 0
|
||||
echomsg 'No commit needed.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Delete() {{{2
|
||||
function! s:bzrFunctions.Delete(argList)
|
||||
return s:DoCommand(join(['rm'] + a:argList, ' '), 'rm', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Diff(argList) {{{2
|
||||
function! s:bzrFunctions.Diff(argList)
|
||||
if len(a:argList) == 0
|
||||
let revOptions = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let revOptions = ['-r' . join(a:argList, '..')]
|
||||
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||
else
|
||||
" Pass-through
|
||||
let caption = join(a:argList, ' ')
|
||||
let revOptions = a:argList
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin.
|
||||
" Returns: List of results: [revision, repository]
|
||||
|
||||
function! s:bzrFunctions.GetBufferInfo()
|
||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||
let fileName = resolve(bufname(originalBuffer))
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"')
|
||||
let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
|
||||
" File not under BZR control.
|
||||
if statusText =~ '^?'
|
||||
return ['Unknown']
|
||||
endif
|
||||
|
||||
let [flags, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)')[1:2]
|
||||
if revision == ''
|
||||
" Error
|
||||
return ['Unknown']
|
||||
elseif flags =~ '^A'
|
||||
return ['New', 'New']
|
||||
else
|
||||
return [revision, repository]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Info(argList) {{{2
|
||||
function! s:bzrFunctions.Info(argList)
|
||||
return s:DoCommand(join(['version-info'] + a:argList, ' '), 'version-info', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Lock(argList) {{{2
|
||||
function! s:bzrFunctions.Lock(argList)
|
||||
echomsg 'bzr lock is not necessary'
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Log() {{{2
|
||||
function! s:bzrFunctions.Log(argList)
|
||||
if len(a:argList) == 0
|
||||
let options = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let options = ['-r' . join(a:argList, ':')]
|
||||
let caption = options[0]
|
||||
else
|
||||
" Pass-through
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Revert(argList) {{{2
|
||||
function! s:bzrFunctions.Revert(argList)
|
||||
return s:DoCommand('revert', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Review(argList) {{{2
|
||||
function! s:bzrFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let versiontag = '(current)'
|
||||
let versionOption = ''
|
||||
else
|
||||
let versiontag = a:argList[0]
|
||||
let versionOption = ' -r ' . versiontag . ' '
|
||||
endif
|
||||
|
||||
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Status(argList) {{{2
|
||||
function! s:bzrFunctions.Status(argList)
|
||||
let options = ['-S']
|
||||
if len(a:argList) != 0
|
||||
let options = a:argList
|
||||
endif
|
||||
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:bzrFunctions.Unlock(argList) {{{2
|
||||
function! s:bzrFunctions.Unlock(argList)
|
||||
echomsg 'bzr unlock is not necessary'
|
||||
endfunction
|
||||
" Function: s:bzrFunctions.Update(argList) {{{2
|
||||
function! s:bzrFunctions.Update(argList)
|
||||
return s:DoCommand('update', 'update', '', {})
|
||||
endfunction
|
||||
|
||||
" Annotate setting {{{2
|
||||
let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | '
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
File diff suppressed because it is too large
Load Diff
|
@ -1,453 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" CVS extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Command documentation {{{2
|
||||
"
|
||||
" The following commands only apply to files under CVS source control.
|
||||
"
|
||||
" CVSEdit Performs "cvs edit" on the current file.
|
||||
"
|
||||
" CVSEditors Performs "cvs editors" on the current file.
|
||||
"
|
||||
" CVSUnedit Performs "cvs unedit" on the current file.
|
||||
"
|
||||
" CVSWatch Takes an argument which must be one of [on|off|add|remove].
|
||||
" Performs "cvs watch" with the given argument on the current
|
||||
" file.
|
||||
"
|
||||
" CVSWatchers Performs "cvs watchers" on the current file.
|
||||
"
|
||||
" CVSWatchAdd Alias for "CVSWatch add"
|
||||
"
|
||||
" CVSWatchOn Alias for "CVSWatch on"
|
||||
"
|
||||
" CVSWatchOff Alias for "CVSWatch off"
|
||||
"
|
||||
" CVSWatchRemove Alias for "CVSWatch remove"
|
||||
"
|
||||
" Mapping documentation: {{{2
|
||||
"
|
||||
" By default, a mapping is defined for each command. User-provided mappings
|
||||
" can be used instead by mapping to <Plug>CommandName, for instance:
|
||||
"
|
||||
" nnoremap ,ce <Plug>CVSEdit
|
||||
"
|
||||
" The default mappings are as follow:
|
||||
"
|
||||
" <Leader>ce CVSEdit
|
||||
" <Leader>cE CVSEditors
|
||||
" <Leader>ct CVSUnedit
|
||||
" <Leader>cwv CVSWatchers
|
||||
" <Leader>cwa CVSWatchAdd
|
||||
" <Leader>cwn CVSWatchOn
|
||||
" <Leader>cwf CVSWatchOff
|
||||
" <Leader>cwr CVSWatchRemove
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandCVSExec
|
||||
" This variable specifies the CVS executable. If not set, it defaults to
|
||||
" 'cvs' executed from the user's executable path.
|
||||
"
|
||||
" VCSCommandCVSDiffOpt
|
||||
" This variable, if set, determines the options passed to the cvs diff
|
||||
" command. If not set, it defaults to 'u'.
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
||||
" CVS is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:cvsFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke cvs suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'CVS'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
|
||||
if ret > 0
|
||||
if getline(line('$')) =~ '^cvs \w\+: closing down connection'
|
||||
$d
|
||||
1
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
return ret
|
||||
else
|
||||
throw 'CVS VCSCommand plugin called on non-CVS item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:GetRevision() {{{2
|
||||
" Function for retrieving the current buffer's revision number.
|
||||
" Returns: Revision number or an empty string if an error occurs.
|
||||
|
||||
function! s:GetRevision()
|
||||
if !exists('b:VCSCommandBufferInfo')
|
||||
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
|
||||
endif
|
||||
|
||||
if len(b:VCSCommandBufferInfo) > 0
|
||||
return b:VCSCommandBufferInfo[0]
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:cvsFunctions.Identify(buffer) {{{2
|
||||
function! s:cvsFunctions.Identify(buffer)
|
||||
let fileName = resolve(bufname(a:buffer))
|
||||
if isdirectory(fileName)
|
||||
let directoryName = fileName
|
||||
else
|
||||
let directoryName = fnamemodify(fileName, ':h')
|
||||
endif
|
||||
if strlen(directoryName) > 0
|
||||
let CVSRoot = directoryName . '/CVS/Root'
|
||||
else
|
||||
let CVSRoot = 'CVS/Root'
|
||||
endif
|
||||
if filereadable(CVSRoot)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Add(argList) {{{2
|
||||
function! s:cvsFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Annotate(argList) {{{2
|
||||
function! s:cvsFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype ==? 'cvsannotate'
|
||||
" This is a CVSAnnotate buffer. Perform annotation of the version
|
||||
" indicated by the current line.
|
||||
let caption = matchstr(getline('.'),'\v^[0-9.]+')
|
||||
|
||||
if VCSCommandGetOption('VCSCommandCVSAnnotateParent', 0) != 0
|
||||
if caption != '1.1'
|
||||
let revmaj = matchstr(caption,'\v[0-9.]+\ze\.[0-9]+')
|
||||
let revmin = matchstr(caption,'\v[0-9.]+\.\zs[0-9]+') - 1
|
||||
if revmin == 0
|
||||
" Jump to ancestor branch
|
||||
let caption = matchstr(revmaj,'\v[0-9.]+\ze\.[0-9]+')
|
||||
else
|
||||
let caption = revmaj . "." . revmin
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let options = ['-r' . caption]
|
||||
else
|
||||
" CVS defaults to pulling HEAD, regardless of current branch.
|
||||
" Therefore, always pass desired revision.
|
||||
let caption = ''
|
||||
let options = ['-r' . s:GetRevision()]
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let caption = a:argList[0]
|
||||
let options = ['-r' . caption]
|
||||
else
|
||||
let caption = join(a:argList)
|
||||
let options = a:argList
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
|
||||
if resultBuffer > 0
|
||||
" Remove header lines from standard error
|
||||
silent v/^\d\+\%(\.\d\+\)\+/d
|
||||
endif
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Commit(argList) {{{2
|
||||
function! s:cvsFunctions.Commit(argList)
|
||||
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||
if resultBuffer == 0
|
||||
echomsg 'No commit needed.'
|
||||
endif
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Delete() {{{2
|
||||
" By default, use the -f option to remove the file first. If options are
|
||||
" passed in, use those instead.
|
||||
function! s:cvsFunctions.Delete(argList)
|
||||
let options = ['-f']
|
||||
let caption = ''
|
||||
if len(a:argList) > 0
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
return s:DoCommand(join(['remove'] + options, ' '), 'delete', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Diff(argList) {{{2
|
||||
function! s:cvsFunctions.Diff(argList)
|
||||
if len(a:argList) == 0
|
||||
let revOptions = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let revOptions = ['-r' . join(a:argList, ' -r')]
|
||||
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||
else
|
||||
" Pass-through
|
||||
let caption = join(a:argList, ' ')
|
||||
let revOptions = a:argList
|
||||
endif
|
||||
|
||||
let cvsDiffOpt = VCSCommandGetOption('VCSCommandCVSDiffOpt', 'u')
|
||||
if cvsDiffOpt == ''
|
||||
let diffOptions = []
|
||||
else
|
||||
let diffOptions = ['-' . cvsDiffOpt]
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin. This CVS extension adds branch name to the return
|
||||
" list as well.
|
||||
" Returns: List of results: [revision, repository, branch]
|
||||
|
||||
function! s:cvsFunctions.GetBufferInfo()
|
||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||
let fileName = bufname(originalBuffer)
|
||||
if isdirectory(fileName)
|
||||
let tag = ''
|
||||
if filereadable(fileName . '/CVS/Tag')
|
||||
let tagFile = readfile(fileName . '/CVS/Tag')
|
||||
if len(tagFile) == 1
|
||||
let tag = substitute(tagFile[0], '^T', '', '')
|
||||
endif
|
||||
endif
|
||||
return [tag]
|
||||
endif
|
||||
let realFileName = fnamemodify(resolve(fileName), ':t')
|
||||
if !filereadable(fileName)
|
||||
return ['Unknown']
|
||||
endif
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
|
||||
try
|
||||
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
let revision=substitute(statusText, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', '')
|
||||
|
||||
" We can still be in a CVS-controlled directory without this being a CVS
|
||||
" file
|
||||
if match(revision, '^New file!$') >= 0
|
||||
let revision='New'
|
||||
elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0
|
||||
return ['Unknown']
|
||||
endif
|
||||
|
||||
let branch=substitute(statusText, '^\_.*Sticky Tag:\s\+\(\d\+\%(\.\d\+\)\+\|\a[A-Za-z0-9-_]*\|(none)\).*$', '\1', '')
|
||||
let repository=substitute(statusText, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', '')
|
||||
let repository=substitute(repository, '^New file!\|No revision control file$', 'New', '')
|
||||
return [revision, repository, branch]
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Log() {{{2
|
||||
function! s:cvsFunctions.Log(argList)
|
||||
if len(a:argList) == 0
|
||||
let options = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let options = ['-r' . join(a:argList, ':')]
|
||||
let caption = options[0]
|
||||
else
|
||||
" Pass-through
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['log'] + options), 'log', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Revert(argList) {{{2
|
||||
function! s:cvsFunctions.Revert(argList)
|
||||
return s:DoCommand('update -C', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Review(argList) {{{2
|
||||
function! s:cvsFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let versiontag = '(current)'
|
||||
let versionOption = ''
|
||||
else
|
||||
let versiontag = a:argList[0]
|
||||
let versionOption = ' -r ' . versiontag . ' '
|
||||
endif
|
||||
|
||||
return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Status(argList) {{{2
|
||||
function! s:cvsFunctions.Status(argList)
|
||||
return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:cvsFunctions.Update(argList) {{{2
|
||||
function! s:cvsFunctions.Update(argList)
|
||||
return s:DoCommand('update', 'update', '', {})
|
||||
endfunction
|
||||
|
||||
" Section: CVS-specific functions {{{1
|
||||
|
||||
" Function: s:CVSEdit() {{{2
|
||||
function! s:CVSEdit()
|
||||
return s:DoCommand('edit', 'cvsedit', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:CVSEditors() {{{2
|
||||
function! s:CVSEditors()
|
||||
return s:DoCommand('editors', 'cvseditors', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:CVSUnedit() {{{2
|
||||
function! s:CVSUnedit()
|
||||
return s:DoCommand('unedit', 'cvsunedit', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:CVSWatch(onoff) {{{2
|
||||
function! s:CVSWatch(onoff)
|
||||
if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$'
|
||||
echoerr 'Argument to CVSWatch must be one of [on|off|add|remove]'
|
||||
return -1
|
||||
end
|
||||
return s:DoCommand('watch ' . tolower(a:onoff), 'cvswatch', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:CVSWatchers() {{{2
|
||||
function! s:CVSWatchers()
|
||||
return s:DoCommand('watchers', 'cvswatchers', '', {})
|
||||
endfunction
|
||||
|
||||
" Annotate setting {{{2
|
||||
let s:cvsFunctions.AnnotateSplitRegex = '): '
|
||||
|
||||
" Section: Command definitions {{{1
|
||||
" Section: Primary commands {{{2
|
||||
com! CVSEdit call s:CVSEdit()
|
||||
com! CVSEditors call s:CVSEditors()
|
||||
com! CVSUnedit call s:CVSUnedit()
|
||||
com! -nargs=1 CVSWatch call s:CVSWatch(<f-args>)
|
||||
com! CVSWatchAdd call s:CVSWatch('add')
|
||||
com! CVSWatchOn call s:CVSWatch('on')
|
||||
com! CVSWatchOff call s:CVSWatch('off')
|
||||
com! CVSWatchRemove call s:CVSWatch('remove')
|
||||
com! CVSWatchers call s:CVSWatchers()
|
||||
|
||||
" Section: Plugin command mappings {{{1
|
||||
|
||||
let s:cvsExtensionMappings = {}
|
||||
if !exists("no_plugin_maps")
|
||||
let mappingInfo = [
|
||||
\['CVSEdit', 'CVSEdit', 'e'],
|
||||
\['CVSEditors', 'CVSEditors', 'E'],
|
||||
\['CVSUnedit', 'CVSUnedit', 't'],
|
||||
\['CVSWatchers', 'CVSWatchers', 'wv'],
|
||||
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
|
||||
\['CVSWatchOff', 'CVSWatch off', 'wf'],
|
||||
\['CVSWatchOn', 'CVSWatch on', 'wn'],
|
||||
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
|
||||
\]
|
||||
|
||||
for [pluginName, commandText, shortCut] in mappingInfo
|
||||
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
||||
if !hasmapto('<Plug>' . pluginName)
|
||||
let s:cvsExtensionMappings[shortCut] = commandText
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
||||
|
||||
" Section: Menu items {{{1
|
||||
for [s:shortcut, s:command] in [
|
||||
\['CVS.&Edit', '<Plug>CVSEdit'],
|
||||
\['CVS.Ed&itors', '<Plug>CVSEditors'],
|
||||
\['CVS.Unedi&t', '<Plug>CVSUnedit'],
|
||||
\['CVS.&Watchers', '<Plug>CVSWatchers'],
|
||||
\['CVS.WatchAdd', '<Plug>CVSWatchAdd'],
|
||||
\['CVS.WatchOn', '<Plug>CVSWatchOn'],
|
||||
\['CVS.WatchOff', '<Plug>CVSWatchOff'],
|
||||
\['CVS.WatchRemove', '<Plug>CVSWatchRemove']
|
||||
\]
|
||||
call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command)
|
||||
endfor
|
||||
unlet s:shortcut s:command
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -1,249 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" git extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandGitExec
|
||||
" This variable specifies the git executable. If not set, it defaults to
|
||||
" 'git' executed from the user's executable path.
|
||||
"
|
||||
" VCSCommandGitDiffOpt
|
||||
" This variable, if set, determines the default options passed to the
|
||||
" VCSDiff command. If any options (starting with '-') are passed to the
|
||||
" command, this variable is not used.
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
||||
" git is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:gitFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke git suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'git'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'git VCSCommand plugin called on non-git item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:gitFunctions.Identify(buffer) {{{2
|
||||
" This function only returns an inexact match due to the detection method used
|
||||
" by git, which simply traverses the directory structure upward.
|
||||
function! s:gitFunctions.Identify(buffer)
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||
try
|
||||
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
|
||||
if(v:shell_error)
|
||||
return 0
|
||||
else
|
||||
return g:VCSCOMMAND_IDENTIFY_INEXACT
|
||||
endif
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Add(argList) {{{2
|
||||
function! s:gitFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Annotate(argList) {{{2
|
||||
function! s:gitFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype == 'gitannotate'
|
||||
" Perform annotation of the version indicated by the current line.
|
||||
let options = matchstr(getline('.'),'^\x\+')
|
||||
else
|
||||
let options = ''
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let options = a:argList[0]
|
||||
else
|
||||
let options = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
return s:DoCommand('blame ' . options, 'annotate', options, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Commit(argList) {{{2
|
||||
function! s:gitFunctions.Commit(argList)
|
||||
try
|
||||
return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||
catch /\m^Version control command failed.*nothing\%( added\)\? to commit/
|
||||
echomsg 'No commit needed.'
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Delete() {{{2
|
||||
" All options are passed through.
|
||||
function! s:gitFunctions.Delete(argList)
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Diff(argList) {{{2
|
||||
" Pass-through call to git-diff. If no options (starting with '-') are found,
|
||||
" then the options in the 'VCSCommandGitDiffOpt' variable are added.
|
||||
function! s:gitFunctions.Diff(argList)
|
||||
let gitDiffOpt = VCSCommandGetOption('VCSCommandGitDiffOpt', '')
|
||||
if gitDiffOpt == ''
|
||||
let diffOptions = []
|
||||
else
|
||||
let diffOptions = [gitDiffOpt]
|
||||
for arg in a:argList
|
||||
if arg =~ '^-'
|
||||
let diffOptions = []
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin. This CVS extension adds branch name to the return
|
||||
" list as well.
|
||||
" Returns: List of results: [revision, repository, branch]
|
||||
|
||||
function! s:gitFunctions.GetBufferInfo()
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
|
||||
try
|
||||
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
|
||||
if v:shell_error
|
||||
let branch = 'DETACHED'
|
||||
else
|
||||
let branch = substitute(branch, '^refs/heads/', '', '')
|
||||
endif
|
||||
|
||||
let info = [branch]
|
||||
|
||||
for method in split(VCSCommandGetOption('VCSCommandGitDescribeArgList', (',tags,all,always')), ',', 1)
|
||||
if method != ''
|
||||
let method = ' --' . method
|
||||
endif
|
||||
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
|
||||
if !v:shell_error
|
||||
call add(info, tag)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
return info
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Log() {{{2
|
||||
function! s:gitFunctions.Log(argList)
|
||||
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Revert(argList) {{{2
|
||||
function! s:gitFunctions.Revert(argList)
|
||||
return s:DoCommand('checkout', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Review(argList) {{{2
|
||||
function! s:gitFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let revision = 'HEAD'
|
||||
else
|
||||
let revision = a:argList[0]
|
||||
endif
|
||||
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
|
||||
try
|
||||
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
|
||||
let prefix = substitute(prefix, '\n$', '', '')
|
||||
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
|
||||
return s:DoCommand('show ' . blob, 'review', revision, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Status(argList) {{{2
|
||||
function! s:gitFunctions.Status(argList)
|
||||
return s:DoCommand(join(['status'] + a:argList), 'status', join(a:argList), {'allowNonZeroExit': 1})
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Update(argList) {{{2
|
||||
function! s:gitFunctions.Update(argList)
|
||||
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
|
||||
endfunction
|
||||
|
||||
" Annotate setting {{{2
|
||||
let s:gitFunctions.AnnotateSplitRegex = ') '
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -1,275 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" Mercurial extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandHGExec
|
||||
" This variable specifies the mercurial executable. If not set, it defaults
|
||||
" to 'hg' executed from the user's executable path.
|
||||
"
|
||||
" VCSCommandHGDiffExt
|
||||
" This variable, if set, sets the external diff program used by Subversion.
|
||||
"
|
||||
" VCSCommandHGDiffOpt
|
||||
" This variable, if set, determines the options passed to the hg diff
|
||||
" command (such as 'u', 'w', or 'b').
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
|
||||
" HG is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:hgFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke hg suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'HG'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'HG VCSCommand plugin called on non-HG item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:hgFunctions.Identify(buffer) {{{2
|
||||
function! s:hgFunctions.Identify(buffer)
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||
try
|
||||
call s:VCSCommandUtility.system(s:Executable() . ' root')
|
||||
if(v:shell_error)
|
||||
return 0
|
||||
else
|
||||
return g:VCSCOMMAND_IDENTIFY_INEXACT
|
||||
endif
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Add() {{{2
|
||||
function! s:hgFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add -v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Annotate(argList) {{{2
|
||||
function! s:hgFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype ==? 'hgannotate'
|
||||
" Perform annotation of the version indicated by the current line.
|
||||
let caption = matchstr(getline('.'),'\v^\s*\w+\s+\zs\d+')
|
||||
let options = ' -un -r' . caption
|
||||
else
|
||||
let caption = ''
|
||||
let options = ' -un'
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let caption = a:argList[0]
|
||||
let options = ' -un -r' . caption
|
||||
else
|
||||
let caption = join(a:argList, ' ')
|
||||
let options = ' ' . caption
|
||||
endif
|
||||
|
||||
return s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Commit(argList) {{{2
|
||||
function! s:hgFunctions.Commit(argList)
|
||||
try
|
||||
return s:DoCommand('commit -v -l "' . a:argList[0] . '"', 'commit', '', {})
|
||||
catch /Version control command failed.*nothing changed/
|
||||
echomsg 'No commit needed.'
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Delete() {{{2
|
||||
function! s:hgFunctions.Delete(argList)
|
||||
return s:DoCommand(join(['remove'] + a:argList, ' '), 'remove', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Diff(argList) {{{2
|
||||
function! s:hgFunctions.Diff(argList)
|
||||
if len(a:argList) == 0
|
||||
let revOptions = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let revOptions = ['-r' . join(a:argList, ':')]
|
||||
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||
else
|
||||
" Pass-through
|
||||
let caption = join(a:argList, ' ')
|
||||
let revOptions = a:argList
|
||||
endif
|
||||
|
||||
let hgDiffExt = VCSCommandGetOption('VCSCommandHGDiffExt', '')
|
||||
if hgDiffExt == ''
|
||||
let diffExt = []
|
||||
else
|
||||
let diffExt = ['--diff-cmd ' . hgDiffExt]
|
||||
endif
|
||||
|
||||
let hgDiffOpt = VCSCommandGetOption('VCSCommandHGDiffOpt', '')
|
||||
if hgDiffOpt == ''
|
||||
let diffOptions = []
|
||||
else
|
||||
let diffOptions = ['-x -' . hgDiffOpt]
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Info(argList) {{{2
|
||||
function! s:hgFunctions.Info(argList)
|
||||
return s:DoCommand(join(['log --limit 1'] + a:argList, ' '), 'log', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin.
|
||||
" Returns: List of results: [revision, repository, branch]
|
||||
|
||||
function! s:hgFunctions.GetBufferInfo()
|
||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||
let fileName = bufname(originalBuffer)
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
|
||||
" File not under HG control.
|
||||
if statusText =~ '^?'
|
||||
return ['Unknown']
|
||||
endif
|
||||
|
||||
let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"')
|
||||
let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
|
||||
|
||||
let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"')
|
||||
let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
|
||||
|
||||
if revision == ''
|
||||
" Error
|
||||
return ['Unknown']
|
||||
elseif statusText =~ '^A'
|
||||
return ['New', 'New']
|
||||
else
|
||||
return [revision, repository]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Log(argList) {{{2
|
||||
function! s:hgFunctions.Log(argList)
|
||||
if len(a:argList) == 0
|
||||
let options = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let options = ['-r' . join(a:argList, ':')]
|
||||
let caption = options[0]
|
||||
else
|
||||
" Pass-through
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Revert(argList) {{{2
|
||||
function! s:hgFunctions.Revert(argList)
|
||||
return s:DoCommand('revert', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Review(argList) {{{2
|
||||
function! s:hgFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let versiontag = '(current)'
|
||||
let versionOption = ''
|
||||
else
|
||||
let versiontag = a:argList[0]
|
||||
let versionOption = ' -r ' . versiontag . ' '
|
||||
endif
|
||||
|
||||
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Status(argList) {{{2
|
||||
function! s:hgFunctions.Status(argList)
|
||||
let options = ['-A', '-v']
|
||||
if len(a:argList) != 0
|
||||
let options = a:argList
|
||||
endif
|
||||
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:hgFunctions.Update(argList) {{{2
|
||||
function! s:hgFunctions.Update(argList)
|
||||
return s:DoCommand('update', 'update', '', {})
|
||||
endfunction
|
||||
|
||||
" Annotate setting {{{2
|
||||
let s:hgFunctions.AnnotateSplitRegex = '\d\+: '
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -1,259 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" SVK extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandSVKExec
|
||||
" This variable specifies the SVK executable. If not set, it defaults to
|
||||
" 'svk' executed from the user's executable path.
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
||||
" SVK is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:svkFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke SVK suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'SVK'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'SVK VCSCommand plugin called on non-SVK item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:svkFunctions.Identify(buffer) {{{2
|
||||
function! s:svkFunctions.Identify(buffer)
|
||||
let fileName = resolve(bufname(a:buffer))
|
||||
if isdirectory(fileName)
|
||||
let directoryName = fileName
|
||||
else
|
||||
let directoryName = fnamemodify(fileName, ':p:h')
|
||||
endif
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
|
||||
if(v:shell_error)
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Add() {{{2
|
||||
function! s:svkFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Annotate(argList) {{{2
|
||||
function! s:svkFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype ==? 'svkannotate'
|
||||
" Perform annotation of the version indicated by the current line.
|
||||
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = ''
|
||||
let options = ''
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let caption = a:argList[0]
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = join(a:argList, ' ')
|
||||
let options = ' ' . caption
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||
if resultBuffer > 0
|
||||
normal! 1G2dd
|
||||
endif
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Commit(argList) {{{2
|
||||
function! s:svkFunctions.Commit(argList)
|
||||
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||
if resultBuffer == 0
|
||||
echomsg 'No commit needed.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Delete() {{{2
|
||||
function! s:svkFunctions.Delete(argList)
|
||||
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Diff(argList) {{{2
|
||||
function! s:svkFunctions.Diff(argList)
|
||||
if len(a:argList) == 0
|
||||
let revOptions = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let revOptions = ['-r' . join(a:argList, ':')]
|
||||
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||
else
|
||||
" Pass-through
|
||||
let caption = join(a:argList, ' ')
|
||||
let revOptions = a:argList
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin.
|
||||
" Returns: List of results: [revision, repository]
|
||||
|
||||
function! s:svkFunctions.GetBufferInfo()
|
||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||
let fileName = resolve(bufname(originalBuffer))
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
|
||||
" File not under SVK control.
|
||||
if statusText =~ '^?'
|
||||
return ['Unknown']
|
||||
endif
|
||||
|
||||
let [flags, revision, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
|
||||
if revision == ''
|
||||
" Error
|
||||
return ['Unknown']
|
||||
elseif flags =~ '^A'
|
||||
return ['New', 'New']
|
||||
else
|
||||
return [revision, repository]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Info(argList) {{{2
|
||||
function! s:svkFunctions.Info(argList)
|
||||
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Lock(argList) {{{2
|
||||
function! s:svkFunctions.Lock(argList)
|
||||
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Log() {{{2
|
||||
function! s:svkFunctions.Log(argList)
|
||||
if len(a:argList) == 0
|
||||
let options = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let options = ['-r' . join(a:argList, ':')]
|
||||
let caption = options[0]
|
||||
else
|
||||
" Pass-through
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Revert(argList) {{{2
|
||||
function! s:svkFunctions.Revert(argList)
|
||||
return s:DoCommand('revert', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Review(argList) {{{2
|
||||
function! s:svkFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let versiontag = '(current)'
|
||||
let versionOption = ''
|
||||
else
|
||||
let versiontag = a:argList[0]
|
||||
let versionOption = ' -r ' . versiontag . ' '
|
||||
endif
|
||||
|
||||
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Status(argList) {{{2
|
||||
function! s:svkFunctions.Status(argList)
|
||||
let options = ['-v']
|
||||
if len(a:argList) != 0
|
||||
let options = a:argList
|
||||
endif
|
||||
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svkFunctions.Unlock(argList) {{{2
|
||||
function! s:svkFunctions.Unlock(argList)
|
||||
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
" Function: s:svkFunctions.Update(argList) {{{2
|
||||
function! s:svkFunctions.Update(argList)
|
||||
return s:DoCommand('update', 'update', '', {})
|
||||
endfunction
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -1,285 +0,0 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" SVN extension for VCSCommand.
|
||||
"
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) Bob Hiestand
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" Section: Documentation {{{1
|
||||
"
|
||||
" Options documentation: {{{2
|
||||
"
|
||||
" VCSCommandSVNExec
|
||||
" This variable specifies the SVN executable. If not set, it defaults to
|
||||
" 'svn' executed from the user's executable path.
|
||||
"
|
||||
" VCSCommandSVNDiffExt
|
||||
" This variable, if set, sets the external diff program used by Subversion.
|
||||
"
|
||||
" VCSCommandSVNDiffOpt
|
||||
" This variable, if set, determines the options passed to the svn diff
|
||||
" command (such as 'u', 'w', or 'b').
|
||||
|
||||
" Section: Plugin header {{{1
|
||||
|
||||
if exists('VCSCommandDisableAll')
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:loaded_VCSCommand')
|
||||
runtime plugin/vcscommand.vim
|
||||
endif
|
||||
|
||||
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
||||
" SVN is not installed
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo=&cpo
|
||||
set cpo&vim
|
||||
|
||||
" Section: Variable initialization {{{1
|
||||
|
||||
let s:svnFunctions = {}
|
||||
|
||||
" Section: Utility functions {{{1
|
||||
|
||||
" Function: s:Executable() {{{2
|
||||
" Returns the executable used to invoke git suitable for use in a shell
|
||||
" command.
|
||||
function! s:Executable()
|
||||
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
||||
endfunction
|
||||
|
||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
|
||||
" command argument.
|
||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||
if VCSCommandGetVCSType(expand('%')) == 'SVN'
|
||||
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'SVN VCSCommand plugin called on non-SVN item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: VCS function implementations {{{1
|
||||
|
||||
" Function: s:svnFunctions.Identify(buffer) {{{2
|
||||
function! s:svnFunctions.Identify(buffer)
|
||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||
try
|
||||
call s:VCSCommandUtility.system(s:Executable() . ' info .')
|
||||
if(v:shell_error)
|
||||
return 0
|
||||
else
|
||||
return g:VCSCOMMAND_IDENTIFY_EXACT
|
||||
endif
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Add() {{{2
|
||||
function! s:svnFunctions.Add(argList)
|
||||
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Annotate(argList) {{{2
|
||||
function! s:svnFunctions.Annotate(argList)
|
||||
if len(a:argList) == 0
|
||||
if &filetype ==? 'svnannotate'
|
||||
" Perform annotation of the version indicated by the current line.
|
||||
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = ''
|
||||
let options = ''
|
||||
endif
|
||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||
let caption = a:argList[0]
|
||||
let options = ' -r' . caption
|
||||
else
|
||||
let caption = join(a:argList, ' ')
|
||||
let options = ' ' . caption
|
||||
endif
|
||||
|
||||
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Commit(argList) {{{2
|
||||
function! s:svnFunctions.Commit(argList)
|
||||
let resultBuffer = s:DoCommand('commit --non-interactive -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||
if resultBuffer == 0
|
||||
echomsg 'No commit needed.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Delete() {{{2
|
||||
function! s:svnFunctions.Delete(argList)
|
||||
return s:DoCommand(join(['delete --non-interactive'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Diff(argList) {{{2
|
||||
function! s:svnFunctions.Diff(argList)
|
||||
if len(a:argList) == 0
|
||||
let revOptions = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let revOptions = ['-r' . join(a:argList, ':')]
|
||||
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||
else
|
||||
" Pass-through
|
||||
let caption = join(a:argList, ' ')
|
||||
let revOptions = a:argList
|
||||
endif
|
||||
|
||||
let svnDiffExt = VCSCommandGetOption('VCSCommandSVNDiffExt', '')
|
||||
if svnDiffExt == ''
|
||||
let diffExt = []
|
||||
else
|
||||
let diffExt = ['--diff-cmd ' . svnDiffExt]
|
||||
endif
|
||||
|
||||
let svnDiffOpt = VCSCommandGetOption('VCSCommandSVNDiffOpt', '')
|
||||
if svnDiffOpt == ''
|
||||
let diffOptions = []
|
||||
else
|
||||
let diffOptions = ['-x -' . svnDiffOpt]
|
||||
endif
|
||||
|
||||
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.GetBufferInfo() {{{2
|
||||
" Provides version control details for the current file. Current version
|
||||
" number and current repository version number are required to be returned by
|
||||
" the vcscommand plugin.
|
||||
" Returns: List of results: [revision, repository, branch]
|
||||
|
||||
function! s:svnFunctions.GetBufferInfo()
|
||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||
let fileName = bufname(originalBuffer)
|
||||
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -v -- "' . fileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
|
||||
" File not under SVN control.
|
||||
if statusText =~ '^?'
|
||||
return ['Unknown']
|
||||
endif
|
||||
" File explicitly ignored by SVN.
|
||||
if statusText =~ '^I'
|
||||
return ['Ignored']
|
||||
endif
|
||||
|
||||
let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
|
||||
if revision == ''
|
||||
" Error
|
||||
return ['Unknown']
|
||||
elseif flags =~ '^A'
|
||||
return ['New', 'New']
|
||||
elseif flags =~ '*'
|
||||
return [revision, repository, '*']
|
||||
else
|
||||
return [revision, repository]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Info(argList) {{{2
|
||||
function! s:svnFunctions.Info(argList)
|
||||
return s:DoCommand(join(['info --non-interactive'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Lock(argList) {{{2
|
||||
function! s:svnFunctions.Lock(argList)
|
||||
return s:DoCommand(join(['lock --non-interactive'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Log(argList) {{{2
|
||||
function! s:svnFunctions.Log(argList)
|
||||
if len(a:argList) == 0
|
||||
let options = []
|
||||
let caption = ''
|
||||
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||
let options = ['-r' . join(a:argList, ':')]
|
||||
let caption = options[0]
|
||||
else
|
||||
" Pass-through
|
||||
let options = a:argList
|
||||
let caption = join(a:argList, ' ')
|
||||
endif
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['log --non-interactive', '-v'] + options), 'log', caption, {})
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Revert(argList) {{{2
|
||||
function! s:svnFunctions.Revert(argList)
|
||||
return s:DoCommand('revert', 'revert', '', {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Review(argList) {{{2
|
||||
function! s:svnFunctions.Review(argList)
|
||||
if len(a:argList) == 0
|
||||
let versiontag = '(current)'
|
||||
let versionOption = ''
|
||||
else
|
||||
let versiontag = a:argList[0]
|
||||
let versionOption = ' -r ' . versiontag . ' '
|
||||
endif
|
||||
|
||||
return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Status(argList) {{{2
|
||||
function! s:svnFunctions.Status(argList)
|
||||
let options = ['-u', '-v']
|
||||
if len(a:argList) != 0
|
||||
let options = a:argList
|
||||
endif
|
||||
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Unlock(argList) {{{2
|
||||
function! s:svnFunctions.Unlock(argList)
|
||||
return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
||||
endfunction
|
||||
|
||||
" Function: s:svnFunctions.Update(argList) {{{2
|
||||
function! s:svnFunctions.Update(argList)
|
||||
return s:DoCommand('update --non-interactive', 'update', '', {})
|
||||
endfunction
|
||||
|
||||
" Annotate setting {{{2
|
||||
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
-*- coding: utf-8 -*-
|
||||
|
||||
Copyright by @@LONGNAME@@ <@@EMAIL@@>
|
||||
First version: @@crdate@@
|
||||
|
||||
Synopsis: @@DESCR@@
|
||||
|
||||
$Id$
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
return 0
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 tw=0 ft=c : */
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright by @@LONGNAME@@ <@@EMAIL@@>
|
||||
# First version: @@crdate@@
|
||||
#
|
||||
# Synopsis: @@DESCR@@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=perl :
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
||||
Copyright by @@LONGNAME@@ <@@EMAIL@@>
|
||||
First version: @@crdate@@
|
||||
|
||||
Synopsis: @@DESCR@@
|
||||
|
||||
$Id$
|
||||
|
||||
"""
|
||||
|
||||
__version__ ='0.1'
|
||||
__author__ ='@@LONGNAME@@ <@@EMAIL@@>'
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
# If we have been called as 'python <script>' let's call main function
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
# vim: set ts=4 sw=4 tw=79 ft=python :
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright by @@LONGNAME@@ <@@EMAIL@@>
|
||||
# First version: @@crdate@@
|
||||
#
|
||||
# Synopsis: @@DESCR@@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
|
||||
# vim: set ts=4 sw=4 tw=79 ft=sh :
|
|
@ -1,253 +0,0 @@
|
|||
" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
|
||||
" Maintainer: Dr. Charles E. Campbell. <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Date: Jan 07, 2013
|
||||
"
|
||||
" NOTE: the code herein needs vim 7.0 or later
|
||||
" 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,
|
||||
" AlignMaps.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:20 For the invisible things of Him since the creation of the {{{1
|
||||
" world are clearly seen, being perceived through the things that are
|
||||
" made, even His everlasting power and divinity; that they may be
|
||||
" without excuse.
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Usage: {{{1
|
||||
" Use 'a to mark beginning of to-be-aligned region, Alternative: use V
|
||||
" move cursor to end of region, and execute map. (linewise visual mode) to
|
||||
" The maps also set up marks 'y and 'z, and retain mark region, execute same
|
||||
" 'a at the beginning of region. map. Uses 'a, 'y, and 'z.
|
||||
"
|
||||
" The start/end wrappers save and restore marks 'y and 'z.
|
||||
"
|
||||
" Although the comments indicate the maps use a leading backslash,
|
||||
" actually they use <Leader> (:he mapleader), so the user can
|
||||
" specify that the maps start how he or she prefers.
|
||||
"
|
||||
" Note: these maps all use <Align.vim>.
|
||||
"
|
||||
" Load Once: {{{1
|
||||
if &cp || exists("g:loaded_AlignMapsPlugin")
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
let g:loaded_AlignMapsPlugin = "v43"
|
||||
set cpo&vim
|
||||
|
||||
" =====================================================================
|
||||
" Public Interface: {{{1
|
||||
com! AlignMapsClean :call AlignMaps#AlignMapsClean()
|
||||
|
||||
" =====================================================================
|
||||
" Maps: {{{1
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" WS: wrapper start map (internal) {{{2
|
||||
" Produces a blank line above and below, marks with 'y and 'z
|
||||
if !hasmapto('<Plug>WrapperStart')
|
||||
map <unique> <SID>WS <Plug>AlignMapsWrapperStart
|
||||
endif
|
||||
nnoremap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
|
||||
vnoremap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" WE: wrapper end (internal) {{{2
|
||||
" Removes guard lines, restores marks y and z, and restores search pattern
|
||||
if !hasmapto('<Plug>WrapperEnd')
|
||||
nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
|
||||
endif
|
||||
nnoremap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Complex C-code alignment maps: {{{2
|
||||
if !hasmapto('<Plug>AM_a?') |call AlignMaps#MakeMap("a?")|endif
|
||||
if !hasmapto('<Plug>AM_a,') |call AlignMaps#MakeMap("a,")|endif
|
||||
if !hasmapto('<Plug>AM_a<') |call AlignMaps#MakeMap("a<")|endif
|
||||
if !hasmapto('<Plug>AM_a=') |call AlignMaps#MakeMap("a=")|endif
|
||||
if !hasmapto('<Plug>AM_a(') |call AlignMaps#MakeMap("a(")|endif
|
||||
if !hasmapto('<Plug>AM_abox') |call AlignMaps#MakeMap("abox")|endif
|
||||
if !hasmapto('<Plug>AM_acom') |call AlignMaps#MakeMap("acom")|endif
|
||||
if !hasmapto('<Plug>AM_adcom')|call AlignMaps#MakeMap("adcom")|endif
|
||||
if !hasmapto('<Plug>AM_aocom')|call AlignMaps#MakeMap("aocom")|endif
|
||||
if !hasmapto('<Plug>AM_ascom')|call AlignMaps#MakeMap("ascom")|endif
|
||||
if !hasmapto('<Plug>AM_adec') |call AlignMaps#MakeMap("adec")|endif
|
||||
if !hasmapto('<Plug>AM_adef') |call AlignMaps#MakeMap("adef")|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Number alignment maps: {{{2
|
||||
if !hasmapto('<Plug>AM_aunum')|call AlignMaps#MakeMap("aunum")|endif
|
||||
if !hasmapto('<Plug>AM_aenum')|call AlignMaps#MakeMap("aenum")|endif
|
||||
if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
|
||||
if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
|
||||
else
|
||||
if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Plug maps: (the real thing) {{{2
|
||||
nnoremap <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_a, <SID>WS:'y,'zs/\(\S\)\s\+/\1 /ge<CR>'yjma'zk:call AlignMaps#CharJoiner(",")<cr>:silent 'y,'zg/,/call AlignMaps#FixMultiDec()<CR>'z:exe "norm \<Plug>AM_adec"<cr><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_a( <SID>WS:AlignCtrl mIp0P1=l<CR>:'a,.Align [(,]<CR>:sil 'y+1,'z-1s/\(\s\+\),/,\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_abox <SID>WS:let g:alignmaps_iws=substitute(getline("'a"),'^\(\s*\).*$','\1','e')<CR>:'a,'z-1s/^\s\+//e<CR>:'a,'z-1s/^.*$/@&@/<CR>:AlignCtrl m=p01P0w @<CR>:'a,.Align<CR>:'a,'z-1s/@/ * /<CR>:'a,'z-1s/@$/*/<CR>'aYP:s/./*/g<CR>0r/'zkYp:s/./*/g<CR>0r A/<Esc>:exe "'a-1,'z-1s/^/".g:alignmaps_iws."/e"<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_acom <SID>WS:'a,.s/\/[*/]\/\=/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:'y,'zs/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(2)<CR>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_adcom <SID>WS:'a,.v/^\s*\/[/*]/s/\/[*/]\*\=/@&@/e<CR>:'a,.v/^\s*\/[/*]/s/\*\//@&/e<CR>:'y,'zv/^\s*\/[/*]/s/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(3)<cr>:'y,'zv/^\s*\/[/*]/s/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ascom <SID>WS:'a,.s/\/[*/]/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:silent! 'a,.g/^\s*@\/[*/]/s/@//ge<CR>:AlignCtrl v ^\s*\/[*/]<CR>:AlignCtrl g \/[*/]<CR>'zk:call AlignMaps#StdAlign(2)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%([a-zA-Z_][a-zA-Z_0-9<>:]*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()<>:]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<CR>:call AlignMaps#StdAlign(1)<cr>:'y,'zv/^\s*[*/]/s/@ //ge<CR>:'y,'zv/^\s*[*/]/s/\(\s*\);/;\1/e<CR>:'y,'zv/^#/s/# //e<CR>:'y,'zv/^\s\+[*/#]/s/\([^/*]\)\(\*\+\)\( \+\)/\1\3\2/e<CR>:'y,'zv/^\s\+[*/#]/s/\((\+\)\( \+\)\*/\2\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/^\(\s\+\) \*/\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/[ \t@]*$//e<CR>:'y,'zs/^[*]/ */e<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_adef <SID>WS:AlignPush<CR>:AlignCtrl v ^\s*\(\/\*\<bar>\/\/\)<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/^\(\s*\)#\(\s\)*define\s*\(\I[a-zA-Z_0-9(),]*\)\s*\(.\{-}\)\($\<Bar>\/\*\)/#\1\2define @\3@\4@\5/e<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/\($\<Bar>\*\/\)/@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>'yjma'zk:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/ @//g<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
|
||||
nnoremap <silent> <script> <Plug>AM_aunum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([.eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#\././ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([.#]\d*\)\=\<bar>[.#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#.]<CR>:'a,'zs/\([.#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([,eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#,/,/ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([,#]\d*\)\=\<bar>[,#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#,]<CR>:'a,'zs/\([,#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
|
||||
" ---------------------------------------------------------------------
|
||||
" html table alignment {{{2
|
||||
if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
|
||||
map <silent> <script> <Plug>AM_Htd <SID>WS:'y,'zs%<[tT][rR]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]></[tT][rR]>%@&@%g<CR>'yjma'zk:AlignCtrl m=Ilp1P0 @<CR>:'a,.Align<CR>:'y,'zs/ @/@/<CR>:'y,'zs/@ <[tT][rR]>/<[tT][rR]>/ge<CR>:'y,'zs/@//ge<CR><SID>WE
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" character-based right-justified alignment maps {{{2
|
||||
if !hasmapto('<Plug>AM_T|')|call AlignMaps#MakeMap("T|")|endif
|
||||
if !hasmapto('<Plug>AM_T#') |call AlignMaps#MakeMap("T#")|endif
|
||||
if !hasmapto('<Plug>AM_T,') |call AlignMaps#MakeMap("T,")|endif
|
||||
if !hasmapto('<Plug>AM_Ts,') |call AlignMaps#MakeMap("Ts,")|endif
|
||||
if !hasmapto('<Plug>AM_T:') |call AlignMaps#MakeMap("T:")|endif
|
||||
if !hasmapto('<Plug>AM_T;') |call AlignMaps#MakeMap("T;")|endif
|
||||
if !hasmapto('<Plug>AM_T<') |call AlignMaps#MakeMap("T<")|endif
|
||||
if !hasmapto('<Plug>AM_T=') |call AlignMaps#MakeMap("T=")|endif
|
||||
if !hasmapto('<Plug>AM_T?') |call AlignMaps#MakeMap("T?")|endif
|
||||
if !hasmapto('<Plug>AM_T@') |call AlignMaps#MakeMap("T@")|endif
|
||||
if !hasmapto('<Plug>AM_TW@') |call AlignMaps#MakeMap("TW@")|endif
|
||||
if !hasmapto('<Plug>AM_Tab') |call AlignMaps#MakeMap("Tab")|endif
|
||||
if !hasmapto('<Plug>AM_Tsp') |call AlignMaps#MakeMap("Tsp")|endif
|
||||
if !hasmapto('<Plug>AM_T~') |call AlignMaps#MakeMap("T~")|endif
|
||||
|
||||
nnoremap <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T= <SID>WS:'a,'z-1s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'z-1s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'z-1s/; */;@/e<CR>:'a,'z-1s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'z-1s/!=/\x="!\<Char-0x0f>"/ge<CR>:AlignCtrl mIp1P1=r = @<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s/; *@/;/e<CR>:'a,'z-1s/; *$/;/e<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-1s/\xff/=/ge<CR><SID>WE:exe "norm <Plug>acom"
|
||||
nnoremap <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_Tab <SID>WS:'a,.s/^\(\t*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\t','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_Tsp <SID>WS:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" character-based left-justified alignment maps {{{2
|
||||
if !hasmapto('<Plug>AM_t|','n') |call AlignMaps#MakeMap("t|")|endif
|
||||
if !hasmapto('<Plug>AM_t#','n') |call AlignMaps#MakeMap("t#")|endif
|
||||
if !hasmapto('<Plug>AM_t,','n') |call AlignMaps#MakeMap("t,")|endif
|
||||
if !hasmapto('<Plug>AM_t:','n') |call AlignMaps#MakeMap("t:")|endif
|
||||
if !hasmapto('<Plug>AM_t;','n') |call AlignMaps#MakeMap("t;")|endif
|
||||
if !hasmapto('<Plug>AM_t<','n') |call AlignMaps#MakeMap("t<")|endif
|
||||
if !hasmapto('<Plug>AM_t=','n') |call AlignMaps#MakeMap("t=")|endif
|
||||
if !hasmapto('<Plug>AM_ts,','n') |call AlignMaps#MakeMap("ts,")|endif
|
||||
if !hasmapto('<Plug>AM_ts:','n') |call AlignMaps#MakeMap("ts:")|endif
|
||||
if !hasmapto('<Plug>AM_ts;','n') |call AlignMaps#MakeMap("ts;")|endif
|
||||
if !hasmapto('<Plug>AM_ts<','n') |call AlignMaps#MakeMap("ts<")|endif
|
||||
if !hasmapto('<Plug>AM_ts=','n') |call AlignMaps#MakeMap("ts=")|endif
|
||||
if !hasmapto('<Plug>AM_w=','n') |call AlignMaps#MakeMap("w=")|endif
|
||||
if !hasmapto('<Plug>AM_t?','n') |call AlignMaps#MakeMap("t?")|endif
|
||||
if !hasmapto('<Plug>AM_t~','n') |call AlignMaps#MakeMap("t~")|endif
|
||||
if !hasmapto('<Plug>AM_t@','n') |call AlignMaps#MakeMap("t@")|endif
|
||||
if !hasmapto('<Plug>AM_tW@','n') |call AlignMaps#MakeMap("tW@")|endif
|
||||
if !hasmapto('<Plug>AM_m=','n') |call AlignMaps#MakeMap("m=")|endif
|
||||
if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
|
||||
if !hasmapto('<Plug>AM_tml','n') |call AlignMaps#MakeMap("tml")|endif
|
||||
if !hasmapto('<Plug>AM_tsp','n') |call AlignMaps#MakeMap("tsp")|endif
|
||||
if !hasmapto('<Plug>AM_tsq','n') |call AlignMaps#MakeMap("tsq")|endif
|
||||
if !hasmapto('<Plug>AM_tt','n') |call AlignMaps#MakeMap("tt")|endif
|
||||
if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
|
||||
|
||||
" <Plug> normal mode mappings
|
||||
nnoremap <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_w= <SID>WS:'a,'zg/=/s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zg/=/s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zg/=/s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zg/=/s/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mWp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1g/=/Align<CR>:'a,'z-1g/=/s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1g/=/s/\( \+\);/;\1/ge<CR>:'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e<CR>:'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1g/=/s/\xff/=/ge<CR>:'y,'zg/=/s/ @//eg<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t@ <SID>WS:call AlignMaps#StdAlign(1)<cr><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_m= <SID>WS:'a,'zs/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zs@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zs/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mIp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-s/%\ze[^=]/ @%@ /e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1s/\xff/=/ge<CR>:'y,'zs/ @//eg<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tab <SID>WS:'a,.s/^\(\t*\)\(.*\)$/\=submatch(1).escape(substitute(submatch(2),'\t',"\<Char-0x0f>",'g'),'\')/<CR>:if &ts == 1<bar>exe "AlignCtrl mI=lp0P0 \<Char-0x0f>"<bar>else<bar>exe "AlignCtrl mI=l"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tsp <SID>WS:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/@/ /g<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/[%@]/ /g<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
|
||||
|
||||
" =====================================================================
|
||||
" Menu Support: {{{1
|
||||
" ma ..move.. use menu
|
||||
" v V or ctrl-v ..move.. use menu
|
||||
if has("menu") && has("gui_running") && &go =~# 'm' && !exists("s:firstmenu")
|
||||
let s:firstmenu= 1
|
||||
if !exists("g:DrChipTopLvlMenu")
|
||||
let g:DrChipTopLvlMenu= "DrChip."
|
||||
endif
|
||||
if g:DrChipTopLvlMenu != ""
|
||||
let s:mapleader = exists("g:mapleader")? g:mapleader : '\'
|
||||
let s:emapleader= escape(s:mapleader,'\ ')
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.<<\ and\ >><tab>'.s:emapleader.'a< '.s:mapleader.'a<'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ =<tab>'.s:emapleader.'t= '.s:mapleader.'t='
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ :=<tab>'.s:emapleader.'a= '.s:mapleader.'a='
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Backslashes<tab>'.s:emapleader.'tml '.s:mapleader.'tml'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Breakup\ Comma\ Declarations<tab>'.s:emapleader.'a, '.s:mapleader.'a,'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.C\ Comment\ Box<tab>'.s:emapleader.'abox '.s:mapleader.'abox'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'t, '.s:mapleader.'t,'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'ts, '.s:mapleader.'ts,'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas\ With\ Strings<tab>'.s:emapleader.'tsq '.s:mapleader.'tsq'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments<tab>'.s:emapleader.'acom '.s:mapleader.'acom'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments\ Only<tab>'.s:emapleader.'aocom '.s:mapleader.'aocom'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declaration\ Comments<tab>'.s:emapleader.'adcom '.s:mapleader.'adcom'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declarations<tab>'.s:emapleader.'adec '.s:mapleader.'adec'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Definitions<tab>'.s:emapleader.'adef '.s:mapleader.'adef'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Function\ Header<tab>'.s:emapleader.'afnc '.s:mapleader.'afnc'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Html\ Tables<tab>'.s:emapleader.'Htd '.s:mapleader.'Htd'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.(\.\.\.)?\.\.\.\ :\ \.\.\.<tab>'.s:emapleader.'a? '.s:mapleader.'a?'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers<tab>'.s:emapleader.'anum '.s:mapleader.'anum'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (American-Style)<tab>'.s:emapleader.'aunum <Leader>aunum '.s:mapleader.'aunum <Leader>aunum'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (Euro-Style)<tab>'.s:emapleader.'aenum '.s:mapleader.'aenum'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Left\ Justified)<tab>'.s:emapleader.'tsp '.s:mapleader.'tsp'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Right\ Justified)<tab>'.s:emapleader.'Tsp '.s:mapleader.'Tsp'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Statements\ With\ Percent\ Style\ Comments<tab>'.s:emapleader.'m= '.s:mapleader.'m='
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ <<tab>'.s:emapleader.'t< '.s:mapleader.'t<'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ \|<tab>'.s:emapleader.'t\| '.s:mapleader.'t|'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ @<tab>'.s:emapleader.'t@ '.s:mapleader.'t@'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ #<tab>'.s:emapleader.'t# '.s:mapleader.'t#'
|
||||
exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Tabs<tab>'.s:emapleader.'tab '.s:mapleader.'tab'
|
||||
unlet s:mapleader
|
||||
unlet s:emapleader
|
||||
endif
|
||||
endif
|
||||
|
||||
" =====================================================================
|
||||
" Restore: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ==============================================================================
|
||||
" Modelines: {{{1
|
||||
" vim: ts=4 nowrap fdm=marker
|
|
@ -1,41 +0,0 @@
|
|||
" AlignPlugin: tool to align multiple fields based on one or more separators
|
||||
" Author: Charles E. Campbell
|
||||
" Date: Nov 02, 2008
|
||||
" 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.
|
||||
" ---------------------------------------------------------------------
|
||||
" Load Once: {{{1
|
||||
if &cp || exists("g:loaded_AlignPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_AlignPlugin = "v37"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
com! -bang -range -nargs=* Align <line1>,<line2>call Align#Align(<bang>0,<q-args>)
|
||||
com! -range -nargs=0 AlignReplaceQuotedSpaces <line1>,<line2>call Align#AlignReplaceQuotedSpaces()
|
||||
com! -nargs=* AlignCtrl call Align#AlignCtrl(<q-args>)
|
||||
com! -nargs=0 AlignPush call Align#AlignPush()
|
||||
com! -nargs=0 AlignPop call Align#AlignPop()
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Restore: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
" vim: ts=4 fdm=marker
|
|
@ -1,536 +0,0 @@
|
|||
" cecutil.vim : save/restore window position
|
||||
" save/restore mark position
|
||||
" save/restore selected user maps
|
||||
" Author: Charles E. Campbell
|
||||
" Version: 18h ASTRO-ONLY
|
||||
" Date: Oct 16, 2012
|
||||
"
|
||||
" Saving Restoring Destroying Marks: {{{1
|
||||
" call SaveMark(markname) let savemark= SaveMark(markname)
|
||||
" call RestoreMark(markname) call RestoreMark(savemark)
|
||||
" call DestroyMark(markname)
|
||||
" commands: SM RM DM
|
||||
"
|
||||
" Saving Restoring Destroying Window Position: {{{1
|
||||
" call SaveWinPosn() let winposn= SaveWinPosn()
|
||||
" call RestoreWinPosn() call RestoreWinPosn(winposn)
|
||||
" \swp : save current window/buffer's position
|
||||
" \rwp : restore current window/buffer's previous position
|
||||
" commands: SWP RWP
|
||||
"
|
||||
" Saving And Restoring User Maps: {{{1
|
||||
" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
|
||||
" call RestoreUserMaps(suffix)
|
||||
"
|
||||
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
|
||||
"
|
||||
" You believe that God is one. You do well. The demons also {{{1
|
||||
" believe, and shudder. But do you want to know, vain man, that
|
||||
" faith apart from works is dead? (James 2:19,20 WEB)
|
||||
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Load Once: {{{1
|
||||
if &cp || exists("g:loaded_cecutil")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_cecutil = "v18h"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
"DechoRemOn
|
||||
|
||||
" =======================
|
||||
" Public Interface: {{{1
|
||||
" =======================
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Map Interface: {{{2
|
||||
if !hasmapto('<Plug>SaveWinPosn')
|
||||
map <unique> <Leader>swp <Plug>SaveWinPosn
|
||||
endif
|
||||
if !hasmapto('<Plug>RestoreWinPosn')
|
||||
map <unique> <Leader>rwp <Plug>RestoreWinPosn
|
||||
endif
|
||||
nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
|
||||
nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Command Interface: {{{2
|
||||
com! -bar -nargs=0 SWP call SaveWinPosn()
|
||||
com! -bar -nargs=? RWP call RestoreWinPosn(<args>)
|
||||
com! -bar -nargs=1 SM call SaveMark(<q-args>)
|
||||
com! -bar -nargs=1 RM call RestoreMark(<q-args>)
|
||||
com! -bar -nargs=1 DM call DestroyMark(<q-args>)
|
||||
|
||||
com! -bar -nargs=1 WLR call s:WinLineRestore(<q-args>)
|
||||
|
||||
if v:version < 630
|
||||
let s:modifier= "sil! "
|
||||
else
|
||||
let s:modifier= "sil! keepj "
|
||||
endif
|
||||
|
||||
" ===============
|
||||
" Functions: {{{1
|
||||
" ===============
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveWinPosn: {{{2
|
||||
" let winposn= SaveWinPosn() will save window position in winposn variable
|
||||
" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
|
||||
fun! SaveWinPosn(...)
|
||||
" echomsg "Decho: SaveWinPosn() a:0=".a:0
|
||||
if line("$") == 1 && getline(1) == ""
|
||||
" echomsg "Decho: SaveWinPosn : empty buffer"
|
||||
return ""
|
||||
endif
|
||||
let so_keep = &l:so
|
||||
let siso_keep = &siso
|
||||
let ss_keep = &l:ss
|
||||
setlocal so=0 siso=0 ss=0
|
||||
|
||||
let swline = line(".") " save-window line in file
|
||||
let swcol = col(".") " save-window column in file
|
||||
if swcol >= col("$")
|
||||
let swcol= swcol + virtcol(".") - virtcol("$") " adjust for virtual edit (cursor past end-of-line)
|
||||
endif
|
||||
let swwline = winline() - 1 " save-window window line
|
||||
let swwcol = virtcol(".") - wincol() " save-window window column
|
||||
let savedposn = ""
|
||||
" echomsg "Decho: sw[".swline.",".swcol."] sww[".swwline.",".swwcol."]"
|
||||
let savedposn = "call GoWinbufnr(".winbufnr(0).")"
|
||||
let savedposn = savedposn."|".s:modifier.swline
|
||||
let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
|
||||
if swwline > 0
|
||||
let savedposn= savedposn.":".s:modifier."call s:WinLineRestore(".(swwline+1).")\<cr>"
|
||||
endif
|
||||
if swwcol > 0
|
||||
let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
|
||||
endif
|
||||
let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
|
||||
|
||||
" save window position in
|
||||
" b:cecutil_winposn_{iwinposn} (stack)
|
||||
" only when SaveWinPosn() is used
|
||||
if a:0 == 0
|
||||
if !exists("b:cecutil_iwinposn")
|
||||
let b:cecutil_iwinposn= 1
|
||||
else
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
|
||||
endif
|
||||
" echomsg "Decho: saving posn to SWP stack"
|
||||
let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
|
||||
endif
|
||||
|
||||
let &l:so = so_keep
|
||||
let &siso = siso_keep
|
||||
let &l:ss = ss_keep
|
||||
|
||||
" if exists("b:cecutil_iwinposn") " Decho
|
||||
" echomsg "Decho: b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]"
|
||||
" else " Decho
|
||||
" echomsg "Decho: b:cecutil_iwinposn doesn't exist"
|
||||
" endif " Decho
|
||||
" echomsg "Decho: SaveWinPosn [".savedposn."]"
|
||||
return savedposn
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreWinPosn: {{{2
|
||||
" call RestoreWinPosn()
|
||||
" call RestoreWinPosn(winposn)
|
||||
fun! RestoreWinPosn(...)
|
||||
" echomsg "Decho: RestoreWinPosn() a:0=".a:0
|
||||
" echomsg "Decho: getline(1)<".getline(1).">"
|
||||
" echomsg "Decho: line(.)=".line(".")
|
||||
if line("$") == 1 && getline(1) == ""
|
||||
" echomsg "Decho: RestoreWinPosn : empty buffer"
|
||||
return ""
|
||||
endif
|
||||
let so_keep = &l:so
|
||||
let siso_keep = &l:siso
|
||||
let ss_keep = &l:ss
|
||||
setlocal so=0 siso=0 ss=0
|
||||
|
||||
if a:0 == 0 || a:1 == ""
|
||||
" use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
|
||||
if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
|
||||
" echomsg "Decho: using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">"
|
||||
try
|
||||
exe s:modifier.b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
catch /^Vim\%((\a\+)\)\=:E749/
|
||||
" ignore empty buffer error messages
|
||||
endtry
|
||||
" normally drop top-of-stack by one
|
||||
" but while new top-of-stack doesn't exist
|
||||
" drop top-of-stack index by one again
|
||||
if b:cecutil_iwinposn >= 1
|
||||
unlet b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
|
||||
while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
|
||||
endwhile
|
||||
if b:cecutil_iwinposn < 1
|
||||
unlet b:cecutil_iwinposn
|
||||
endif
|
||||
endif
|
||||
else
|
||||
echohl WarningMsg
|
||||
echomsg "***warning*** need to SaveWinPosn first!"
|
||||
echohl None
|
||||
endif
|
||||
|
||||
else " handle input argument
|
||||
" echomsg "Decho: using input a:1<".a:1.">"
|
||||
" use window position passed to this function
|
||||
exe a:1
|
||||
" remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
|
||||
if exists("b:cecutil_iwinposn")
|
||||
let jwinposn= b:cecutil_iwinposn
|
||||
while jwinposn >= 1 " search for a:1 in iwinposn..1
|
||||
if exists("b:cecutil_winposn{jwinposn}") " if it exists
|
||||
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
|
||||
unlet b:cecutil_winposn{jwinposn} " unlet it
|
||||
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let jwinposn= jwinposn - 1
|
||||
endwhile
|
||||
endif
|
||||
endif
|
||||
|
||||
" Seems to be something odd: vertical motions after RWP
|
||||
" cause jump to first column. The following fixes that.
|
||||
" Note: was using wincol()>1, but with signs, a cursor
|
||||
" at column 1 yields wincol()==3. Beeping ensued.
|
||||
let vekeep= &ve
|
||||
set ve=all
|
||||
if virtcol('.') > 1
|
||||
exe s:modifier."norm! hl"
|
||||
elseif virtcol(".") < virtcol("$")
|
||||
exe s:modifier."norm! lh"
|
||||
endif
|
||||
let &ve= vekeep
|
||||
|
||||
let &l:so = so_keep
|
||||
let &l:siso = siso_keep
|
||||
let &l:ss = ss_keep
|
||||
|
||||
" echomsg "Decho: RestoreWinPosn"
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:WinLineRestore: {{{2
|
||||
fun! s:WinLineRestore(swwline)
|
||||
" echomsg "Decho: s:WinLineRestore(swwline=".a:swwline.")"
|
||||
while winline() < a:swwline
|
||||
let curwinline= winline()
|
||||
exe s:modifier."norm! \<c-y>"
|
||||
if curwinline == winline()
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
" echomsg "Decho: s:WinLineRestore"
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" GoWinbufnr: go to window holding given buffer (by number) {{{2
|
||||
" Prefers current window; if its buffer number doesn't match,
|
||||
" then will try from topleft to bottom right
|
||||
fun! GoWinbufnr(bufnum)
|
||||
" call Dfunc("GoWinbufnr(".a:bufnum.")")
|
||||
if winbufnr(0) == a:bufnum
|
||||
" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
|
||||
return
|
||||
endif
|
||||
winc t
|
||||
let first=1
|
||||
while winbufnr(0) != a:bufnum && (first || winnr() != 1)
|
||||
winc w
|
||||
let first= 0
|
||||
endwhile
|
||||
" call Dret("GoWinbufnr")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveMark: sets up a string saving a mark position. {{{2
|
||||
" For example, SaveMark("a")
|
||||
" Also sets up a global variable, g:savemark_{markname}
|
||||
fun! SaveMark(markname)
|
||||
" call Dfunc("SaveMark(markname<".a:markname.">)")
|
||||
let markname= a:markname
|
||||
if strpart(markname,0,1) !~ '\a'
|
||||
let markname= strpart(markname,1,1)
|
||||
endif
|
||||
" call Decho("markname=".markname)
|
||||
|
||||
let lzkeep = &lz
|
||||
set lz
|
||||
|
||||
if 1 <= line("'".markname) && line("'".markname) <= line("$")
|
||||
let winposn = SaveWinPosn(0)
|
||||
exe s:modifier."norm! `".markname
|
||||
let savemark = SaveWinPosn(0)
|
||||
let g:savemark_{markname} = savemark
|
||||
let savemark = markname.savemark
|
||||
call RestoreWinPosn(winposn)
|
||||
else
|
||||
let g:savemark_{markname} = ""
|
||||
let savemark = ""
|
||||
endif
|
||||
|
||||
let &lz= lzkeep
|
||||
|
||||
" call Dret("SaveMark : savemark<".savemark.">")
|
||||
return savemark
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreMark: {{{2
|
||||
" call RestoreMark("a") -or- call RestoreMark(savemark)
|
||||
fun! RestoreMark(markname)
|
||||
" call Dfunc("RestoreMark(markname<".a:markname.">)")
|
||||
|
||||
if strlen(a:markname) <= 0
|
||||
" call Dret("RestoreMark : no such mark")
|
||||
return
|
||||
endif
|
||||
let markname= strpart(a:markname,0,1)
|
||||
if markname !~ '\a'
|
||||
" handles 'a -> a styles
|
||||
let markname= strpart(a:markname,1,1)
|
||||
endif
|
||||
" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
|
||||
|
||||
let lzkeep = &lz
|
||||
set lz
|
||||
let winposn = SaveWinPosn(0)
|
||||
|
||||
if strlen(a:markname) <= 2
|
||||
if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
|
||||
" use global variable g:savemark_{markname}
|
||||
" call Decho("use savemark list")
|
||||
call RestoreWinPosn(g:savemark_{markname})
|
||||
exe "norm! m".markname
|
||||
endif
|
||||
else
|
||||
" markname is a savemark command (string)
|
||||
" call Decho("use savemark command")
|
||||
let markcmd= strpart(a:markname,1)
|
||||
call RestoreWinPosn(markcmd)
|
||||
exe "norm! m".markname
|
||||
endif
|
||||
|
||||
call RestoreWinPosn(winposn)
|
||||
let &lz = lzkeep
|
||||
|
||||
" call Dret("RestoreMark")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" DestroyMark: {{{2
|
||||
" call DestroyMark("a") -- destroys mark
|
||||
fun! DestroyMark(markname)
|
||||
" call Dfunc("DestroyMark(markname<".a:markname.">)")
|
||||
|
||||
" save options and set to standard values
|
||||
let reportkeep= &report
|
||||
let lzkeep = &lz
|
||||
set lz report=10000
|
||||
|
||||
let markname= strpart(a:markname,0,1)
|
||||
if markname !~ '\a'
|
||||
" handles 'a -> a styles
|
||||
let markname= strpart(a:markname,1,1)
|
||||
endif
|
||||
" call Decho("markname=".markname)
|
||||
|
||||
let curmod = &mod
|
||||
let winposn = SaveWinPosn(0)
|
||||
1
|
||||
let lineone = getline(".")
|
||||
exe "k".markname
|
||||
d
|
||||
put! =lineone
|
||||
let &mod = curmod
|
||||
call RestoreWinPosn(winposn)
|
||||
|
||||
" restore options to user settings
|
||||
let &report = reportkeep
|
||||
let &lz = lzkeep
|
||||
|
||||
" call Dret("DestroyMark")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{2
|
||||
" However, <q-args> doesn't split at all, so this one returns a list
|
||||
" with splits at all whitespace (only!), plus a leading length-of-list.
|
||||
" The resulting list: qarglist[0] corresponds to a:0
|
||||
" qarglist[i] corresponds to a:{i}
|
||||
fun! QArgSplitter(qarg)
|
||||
" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
|
||||
let qarglist = split(a:qarg)
|
||||
let qarglistlen = len(qarglist)
|
||||
let qarglist = insert(qarglist,qarglistlen)
|
||||
" call Dret("QArgSplitter ".string(qarglist))
|
||||
return qarglist
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" ListWinPosn: {{{2
|
||||
"fun! ListWinPosn() " Decho
|
||||
" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
|
||||
" call Decho("nothing on SWP stack") " Decho
|
||||
" else " Decho
|
||||
" let jwinposn= b:cecutil_iwinposn " Decho
|
||||
" while jwinposn >= 1 " Decho
|
||||
" if exists("b:cecutil_winposn{jwinposn}") " Decho
|
||||
" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
|
||||
" else " Decho
|
||||
" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
|
||||
" endif " Decho
|
||||
" let jwinposn= jwinposn - 1 " Decho
|
||||
" endwhile " Decho
|
||||
" endif " Decho
|
||||
"endfun " Decho
|
||||
"com! -nargs=0 LWP call ListWinPosn() " Decho
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2
|
||||
" which can be used to restore user maps later with
|
||||
" call RestoreUserMaps()
|
||||
"
|
||||
" mapmode - see :help maparg for details (n v o i c l "")
|
||||
" ex. "n" = Normal
|
||||
" The letters "b" and "u" are optional prefixes;
|
||||
" The "u" means that the map will also be unmapped
|
||||
" The "b" means that the map has a <buffer> qualifier
|
||||
" ex. "un" = Normal + unmapping
|
||||
" ex. "bn" = Normal + <buffer>
|
||||
" ex. "bun" = Normal + <buffer> + unmapping
|
||||
" ex. "ubn" = Normal + <buffer> + unmapping
|
||||
" maplead - see mapchx
|
||||
" mapchx - "<something>" handled as a single map item.
|
||||
" ex. "<left>"
|
||||
" - "string" a string of single letters which are actually
|
||||
" multiple two-letter maps (using the maplead:
|
||||
" maplead . each_character_in_string)
|
||||
" ex. maplead="\" and mapchx="abc" saves user mappings for
|
||||
" \a, \b, and \c
|
||||
" Of course, if maplead is "", then for mapchx="abc",
|
||||
" mappings for a, b, and c are saved.
|
||||
" - :something handled as a single map item, w/o the ":"
|
||||
" ex. mapchx= ":abc" will save a mapping for "abc"
|
||||
" suffix - a string unique to your plugin
|
||||
" ex. suffix= "DrawIt"
|
||||
fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
|
||||
" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
|
||||
|
||||
if !exists("s:restoremap_{a:suffix}")
|
||||
" initialize restoremap_suffix to null string
|
||||
let s:restoremap_{a:suffix}= ""
|
||||
endif
|
||||
|
||||
" set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
|
||||
" if 0, save only
|
||||
let mapmode = a:mapmode
|
||||
let dounmap = 0
|
||||
let dobuffer = ""
|
||||
while mapmode =~ '^[bu]'
|
||||
if mapmode =~ '^u'
|
||||
let dounmap = 1
|
||||
let mapmode = strpart(a:mapmode,1)
|
||||
elseif mapmode =~ '^b'
|
||||
let dobuffer = "<buffer> "
|
||||
let mapmode = strpart(a:mapmode,1)
|
||||
endif
|
||||
endwhile
|
||||
" call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
|
||||
|
||||
" save single map :...something...
|
||||
if strpart(a:mapchx,0,1) == ':'
|
||||
" call Decho("save single map :...something...")
|
||||
let amap= strpart(a:mapchx,1)
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
endif
|
||||
let amap = a:maplead.amap
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(amap,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
|
||||
" save single map <something>
|
||||
elseif strpart(a:mapchx,0,1) == '<'
|
||||
" call Decho("save single map <something>")
|
||||
let amap = a:mapchx
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
" call Decho("amap[[".amap."]]")
|
||||
endif
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(a:mapchx,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
|
||||
" save multiple maps
|
||||
else
|
||||
" call Decho("save multiple maps")
|
||||
let i= 1
|
||||
while i <= strlen(a:mapchx)
|
||||
let amap= a:maplead.strpart(a:mapchx,i-1,1)
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
endif
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(amap,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
let i= i + 1
|
||||
endwhile
|
||||
endif
|
||||
" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreUserMaps: {{{2
|
||||
" Used to restore user maps saved by SaveUserMaps()
|
||||
fun! RestoreUserMaps(suffix)
|
||||
" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
|
||||
if exists("s:restoremap_{a:suffix}")
|
||||
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
|
||||
if s:restoremap_{a:suffix} != ""
|
||||
" call Decho("exe ".s:restoremap_{a:suffix})
|
||||
exe "sil! ".s:restoremap_{a:suffix}
|
||||
endif
|
||||
unlet s:restoremap_{a:suffix}
|
||||
endif
|
||||
" call Dret("RestoreUserMaps")
|
||||
endfun
|
||||
|
||||
" ==============
|
||||
" Restore: {{{1
|
||||
" ==============
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ================
|
||||
" Modelines: {{{1
|
||||
" ================
|
||||
" vim: ts=4 fdm=marker
|
|
@ -1,38 +0,0 @@
|
|||
" ---------------------------------------------------------------------
|
||||
" getscriptPlugin.vim
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Date: Jan 07, 2008
|
||||
" Installing: :help glvs-install
|
||||
" Usage: :help glvs
|
||||
"
|
||||
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
|
||||
"
|
||||
" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
|
||||
" all the peoples praise Him."
|
||||
" ---------------------------------------------------------------------
|
||||
" Initialization: {{{1
|
||||
" if you're sourcing this file, surely you can't be
|
||||
" expecting vim to be in its vi-compatible mode
|
||||
if &cp || exists("g:loaded_getscriptPlugin")
|
||||
if &verbose
|
||||
echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
|
||||
endif
|
||||
finish
|
||||
endif
|
||||
let g:loaded_getscriptPlugin = "v33"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
|
||||
com! -nargs=0 GetScripts call getscript#GetLatestVimScripts()
|
||||
silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Restore Options: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" vim: ts=8 sts=2 fdm=marker nowrap
|
|
@ -1,16 +0,0 @@
|
|||
" Append modeline after last line in buffer.
|
||||
" Use substitute() (not printf()) to handle '%%s' modeline in LaTeX files.
|
||||
function! AppendModeline()
|
||||
let save_cursor = getpos('.')
|
||||
let append = ' vim: set ts='.&tabstop.' sw='.&shiftwidth.' tw='.&textwidth.' ft='.&filetype.' :'
|
||||
$put =substitute(&commentstring, '%s', append, '')
|
||||
call setpos('.', save_cursor)
|
||||
endfunction
|
||||
|
||||
" Define as a command
|
||||
command! -nargs=0 -bar AppendModeline call AppendModeline()
|
||||
|
||||
" Map to <Leader>ml
|
||||
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||
|
||||
" vim: set ts=4 sw=4 tw=78 ft=vim :
|
|
@ -1,196 +0,0 @@
|
|||
" Vim ftplugin file
|
||||
" Language: Python
|
||||
" Authors: André Kelpe <efeshundertelf at googlemail dot com>
|
||||
" Romain Chossart <romainchossat at gmail dot com>
|
||||
" Matthias Vogelgesang
|
||||
" Ricardo Catalinas Jiménez <jimenezrick at gmail dot com>
|
||||
" Patches and suggestions from all sorts of fine people
|
||||
"
|
||||
" More info and updates at:
|
||||
"
|
||||
" http://www.vim.org/scripts/script.php?script_id=910
|
||||
"
|
||||
"
|
||||
" This plugin integrates the Python documentation view and search tool pydoc
|
||||
" into Vim. It allows you to view the documentation of a Python module or class
|
||||
" by typing:
|
||||
"
|
||||
" :Pydoc foo.bar.baz (e.g. :Pydoc re.compile)
|
||||
"
|
||||
" Or search a word (uses pydoc -k) in the documentation by typing:
|
||||
"
|
||||
" :PydocSearch foobar (e.g. :PydocSearch socket)
|
||||
"
|
||||
" Vim will split the current window to show the Python documentation found by
|
||||
" pydoc (the buffer will be called '__doc__', Pythonic, isn't it ;-) ). The
|
||||
" name may cause problems if you have a file with the same name, but usually
|
||||
" this should not happen.
|
||||
"
|
||||
" pydoc.vim also allows you to view the documentation of the 'word' (see :help
|
||||
" word) under the cursor by pressing <Leader>pw or the 'WORD' (see :help WORD)
|
||||
" under the cursor by pressing <Leader>pW. This is very useful if you want to
|
||||
" jump to the docs of a module or class found by 'PydocSearch' or if you want
|
||||
" to see the docs of a module/class in your source code. Additionally K is
|
||||
" mapped to show invoke pydoc as well, when you are editing python files.
|
||||
"
|
||||
" The script is developed in GitHub at:
|
||||
"
|
||||
" http://github.com/fs111/pydoc.vim
|
||||
"
|
||||
"
|
||||
" If you want to use the script and pydoc is not in your PATH, just put a
|
||||
" line like this in your .vimrc:
|
||||
"
|
||||
" let g:pydoc_cmd = '/usr/bin/pydoc'
|
||||
"
|
||||
" or more portable
|
||||
"
|
||||
" let g:pydoc_cmd = 'python -m pydoc'
|
||||
"
|
||||
" If you want to open pydoc files in vertical splits or tabs, give the
|
||||
" appropriate command in your .vimrc with:
|
||||
"
|
||||
" let g:pydoc_open_cmd = 'vsplit'
|
||||
"
|
||||
" or
|
||||
"
|
||||
" let g:pydoc_open_cmd = 'tabnew'
|
||||
"
|
||||
" The script will highlight the search term by default. To disable this behaviour
|
||||
" put in your .vimrc:
|
||||
"
|
||||
" let g:pydoc_highlight=0
|
||||
"
|
||||
"
|
||||
" In order to install pydoc.vim download it from vim.org or clone the repository
|
||||
" on githubi and put it in your .vim/ftplugin directory. pydoc.vim is also fully
|
||||
" compatible with pathogen, so cloning the repository into your bundle directory
|
||||
" is also a valid way to install it. (I do this myself. see
|
||||
" https://github.com/fs111/dotvim).
|
||||
"
|
||||
" pydoc.vim is free software; you can redistribute it and/or
|
||||
" modify it under the terms of the GNU General Public License
|
||||
" as published by the Free Software Foundation; either version 2
|
||||
" of the License, or (at your option) any later version.
|
||||
"
|
||||
" Please feel free to contact me and follow me on twitter (@fs111).
|
||||
|
||||
" IMPORTANT: We don't use here the `exists("b:did_ftplugin")' guard becase we
|
||||
" want to let the Python filetype script that comes with Vim to execute as
|
||||
" normal.
|
||||
|
||||
" Don't redefine the functions if this ftplugin has been executed previously
|
||||
" and before finish create the local mappings in the current buffer
|
||||
if exists('*s:ShowPyDoc') && g:pydoc_perform_mappings
|
||||
call s:PerformMappings()
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:pydoc_perform_mappings')
|
||||
let g:pydoc_perform_mappings = 1
|
||||
endif
|
||||
|
||||
if !exists('g:pydoc_highlight')
|
||||
let g:pydoc_highlight = 1
|
||||
endif
|
||||
|
||||
if !exists('g:pydoc_cmd')
|
||||
let g:pydoc_cmd = 'pydoc'
|
||||
endif
|
||||
|
||||
if !exists('g:pydoc_open_cmd')
|
||||
let g:pydoc_open_cmd = 'split'
|
||||
endif
|
||||
|
||||
setlocal switchbuf=useopen
|
||||
highlight pydoc cterm=reverse gui=reverse
|
||||
|
||||
function s:ShowPyDoc(name, type)
|
||||
if a:name == ''
|
||||
return
|
||||
endif
|
||||
|
||||
if g:pydoc_open_cmd == 'split'
|
||||
let l:pydoc_wh = 10
|
||||
endif
|
||||
|
||||
if bufloaded("__doc__")
|
||||
let l:buf_is_new = 0
|
||||
if bufname("%") == "__doc__"
|
||||
" The current buffer is __doc__, thus do not
|
||||
" recreate nor resize it
|
||||
let l:pydoc_wh = -1
|
||||
else
|
||||
" If the __doc__ buffer is open, jump to it
|
||||
silent execute "sbuffer" bufnr("__doc__")
|
||||
let l:pydoc_wh = -1
|
||||
endif
|
||||
else
|
||||
let l:buf_is_new = 1
|
||||
silent execute g:pydoc_open_cmd '__doc__'
|
||||
if g:pydoc_perform_mappings
|
||||
call s:PerformMappings()
|
||||
endif
|
||||
endif
|
||||
|
||||
setlocal modifiable
|
||||
setlocal noswapfile
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=delete
|
||||
setlocal syntax=man
|
||||
|
||||
silent normal ggdG
|
||||
" Remove function/method arguments
|
||||
let s:name2 = substitute(a:name, '(.*', '', 'g' )
|
||||
" Remove all colons
|
||||
let s:name2 = substitute(s:name2, ':', '', 'g' )
|
||||
if a:type == 1
|
||||
execute "silent read !" g:pydoc_cmd s:name2
|
||||
else
|
||||
execute "silent read !" g:pydoc_cmd "-k" s:name2
|
||||
endif
|
||||
normal 1G
|
||||
|
||||
if exists('l:pydoc_wh') && l:pydoc_wh != -1
|
||||
execute "silent resize" l:pydoc_wh
|
||||
end
|
||||
|
||||
if g:pydoc_highlight == 1
|
||||
execute 'syntax match pydoc' "'" . s:name2 . "'"
|
||||
endif
|
||||
|
||||
let l:line = getline(2)
|
||||
if l:line =~ "^no Python documentation found for.*$"
|
||||
if l:buf_is_new
|
||||
execute "bdelete!"
|
||||
else
|
||||
normal u
|
||||
setlocal nomodified
|
||||
setlocal nomodifiable
|
||||
endif
|
||||
redraw
|
||||
echohl WarningMsg | echo l:line | echohl None
|
||||
else
|
||||
setlocal nomodified
|
||||
setlocal nomodifiable
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Mappings
|
||||
function s:PerformMappings()
|
||||
nnoremap <silent> <buffer> <Leader>pw :call <SID>ShowPyDoc('<C-R><C-W>', 1)<CR>
|
||||
nnoremap <silent> <buffer> <Leader>pW :call <SID>ShowPyDoc('<C-R><C-A>', 1)<CR>
|
||||
nnoremap <silent> <buffer> <Leader>pk :call <SID>ShowPyDoc('<C-R><C-W>', 0)<CR>
|
||||
nnoremap <silent> <buffer> <Leader>pK :call <SID>ShowPyDoc('<C-R><C-A>', 0)<CR>
|
||||
|
||||
" remap the K (or 'help') key
|
||||
nnoremap <silent> <buffer> K :call <SID>ShowPyDoc(expand("<cword>"), 1)<CR>
|
||||
endfunction
|
||||
|
||||
if g:pydoc_perform_mappings
|
||||
call s:PerformMappings()
|
||||
endif
|
||||
|
||||
" Commands
|
||||
command -nargs=1 Pydoc :call s:ShowPyDoc('<args>', 1)
|
||||
command -nargs=* PydocSearch :call s:ShowPyDoc('<args>', 0)
|
|
@ -1,94 +0,0 @@
|
|||
" """"""""""""
|
||||
" Status Line
|
||||
" """"""""""""
|
||||
" Some useful functions
|
||||
"return the syntax highlight group under the cursor ''
|
||||
function! StatuslineCurrentHighlight()
|
||||
let name = synIDattr(synID(line('.'),col('.'),1),'name')
|
||||
if name == ''
|
||||
return ''
|
||||
else
|
||||
return '[' . name . ']'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"recalculate the tab warning flag when idle and after writing
|
||||
autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning
|
||||
"
|
||||
"return '[&et]' if &et is set wrong
|
||||
"return '[mixed-indenting]' if spaces and tabs are used to indent
|
||||
"return an empty string if everything is fine
|
||||
function! StatuslineTabWarning()
|
||||
if !exists("b:statusline_tab_warning")
|
||||
let tabs = search('^\t', 'nw') != 0
|
||||
let spaces = search('^ ', 'nw') != 0
|
||||
|
||||
if tabs && spaces
|
||||
let b:statusline_tab_warning = '[mixed-indenting]'
|
||||
elseif (spaces && !&et) || (tabs && &et)
|
||||
let b:statusline_tab_warning = '[&et]'
|
||||
else
|
||||
let b:statusline_tab_warning = ''
|
||||
endif
|
||||
endif
|
||||
return b:statusline_tab_warning
|
||||
endfunction
|
||||
|
||||
"recalculate the trailing whitespace warning when idle, and after saving
|
||||
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
|
||||
|
||||
"return '[\s]' if trailing white space is detected
|
||||
"return '' otherwise
|
||||
function! StatuslineTrailingSpaceWarning()
|
||||
if !exists("b:statusline_trailing_space_warning")
|
||||
if search('\s\+$', 'nw') != 0
|
||||
let b:statusline_trailing_space_warning = '[\s]'
|
||||
else
|
||||
let b:statusline_trailing_space_warning = ''
|
||||
endif
|
||||
endif
|
||||
return b:statusline_trailing_space_warning
|
||||
endfunction
|
||||
|
||||
|
||||
" Real Status line definition
|
||||
set statusline=%t\ "tail of the filename
|
||||
|
||||
"display a warning if fileformat isnt unix
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
|
||||
set statusline+=%*
|
||||
|
||||
"display a warning if file encoding isnt utf-8
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
|
||||
set statusline+=%*
|
||||
|
||||
set statusline+=%h "help file flag
|
||||
set statusline+=%y "filetype
|
||||
set statusline+=%r "read only flag
|
||||
set statusline+=%m "modified flag
|
||||
|
||||
"display a warning if &et is wrong, or we have mixed-indenting
|
||||
set statusline+=%#error#
|
||||
set statusline+=%{StatuslineTabWarning()}
|
||||
set statusline+=%*
|
||||
|
||||
set statusline+=%{StatuslineTrailingSpaceWarning()}
|
||||
|
||||
"display a warning if &paste is set
|
||||
set statusline+=%#error#
|
||||
set statusline+=%{&paste?'[paste]':'[nopaste]'}
|
||||
set statusline+=%*
|
||||
|
||||
" set statusline+=%=
|
||||
|
||||
set statusline+=%= "left/right separator
|
||||
set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
|
||||
set statusline+=\ tw%{&tw}\
|
||||
set statusline+=%02c, "cursor column
|
||||
set statusline+=%03l/%03L "cursor line/total lines
|
||||
set statusline+=\ hex:\ 0x%02B
|
||||
set statusline+=\ %P "percent through file
|
||||
|
||||
" vim: set ts=4 sw=4 tw=78 ft=vim :
|
|
@ -1,72 +0,0 @@
|
|||
" set up tab labels with tab number, buffer name, number of windows
|
||||
function! GuiTabLabel()
|
||||
let label = ''
|
||||
let bufnrlist = tabpagebuflist(v:lnum)
|
||||
|
||||
|
||||
" Append the tab number
|
||||
let label .= tabpagenr().': '
|
||||
|
||||
" Append the buffer name
|
||||
let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
|
||||
if name == ''
|
||||
" give a name to no-name documents
|
||||
if &buftype=='quickfix'
|
||||
let name = '[Quickfix List]'
|
||||
else
|
||||
let name = '[No Name]'
|
||||
endif
|
||||
else
|
||||
" get only the file name
|
||||
let name = fnamemodify(name,":t")
|
||||
endif
|
||||
let label .= name
|
||||
|
||||
for bufnr in bufnrlist
|
||||
if getbufvar(bufnr, "&modified")
|
||||
let label .= ' [+]'
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return label
|
||||
endfunction
|
||||
|
||||
" set up tab tooltips with every buffer name
|
||||
function! GuiTabToolTip()
|
||||
let tip = ''
|
||||
let bufnrlist = tabpagebuflist(v:lnum)
|
||||
|
||||
for bufnr in bufnrlist
|
||||
" separate buffer entries
|
||||
if tip!=''
|
||||
let tip .= ' | '
|
||||
endif
|
||||
|
||||
" Add name of buffer
|
||||
let name=bufname(bufnr)
|
||||
if name == ''
|
||||
" give a name to no name documents
|
||||
if getbufvar(bufnr,'&buftype')=='quickfix'
|
||||
let name = '[Quickfix List]'
|
||||
else
|
||||
let name = '[No Name]'
|
||||
endif
|
||||
endif
|
||||
let tip.=name
|
||||
|
||||
" add modified/modifiable flags
|
||||
if getbufvar(bufnr, "&modified")
|
||||
let tip .= ' [+]'
|
||||
endif
|
||||
if getbufvar(bufnr, "&modifiable")==0
|
||||
let tip .= ' [-]'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return tip
|
||||
endfunction
|
||||
|
||||
set guitablabel=%!GuiTabLabel()
|
||||
set guitabtooltip=%!GuiTabToolTip()
|
||||
|
||||
" vim: set ts=4 sw=4 tw=78 ft=vim :
|
|
@ -1,113 +0,0 @@
|
|||
" FILE: syntax/conque_term.vim {{{
|
||||
" AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
" 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.
|
||||
" }}}
|
||||
|
||||
|
||||
" *******************************************************************************************************************
|
||||
" MySQL *************************************************************************************************************
|
||||
" *******************************************************************************************************************
|
||||
|
||||
" TODO Move these to syntax which is only executed for mysql
|
||||
"syn match MySQLTableBodyG "^\s*\w\+:\(.\+\)\=$" contains=MySQLTableHeadG,MySQLNullG,MySQLBool,MySQLNumberG,MySQLStorageClass oneline skipwhite skipnl
|
||||
"syn match MySQLTableHeadG "^\s*\w\+:" contains=MySQLTableColon skipwhite contained
|
||||
"syn match MySQLTableColon ":" contained
|
||||
|
||||
syn match MySQLTableHead "^ *|.*| *$" nextgroup=MySQLTableDivide contains=MySQLTableBar oneline skipwhite skipnl
|
||||
syn match MySQLTableBody "^ *|.*| *$" nextgroup=MySQLTableBody,MySQLTableEnd contains=MySQLTableBar,MySQLNull,MySQLBool,MySQLNumber,MySQLStorageClass oneline skipwhite skipnl
|
||||
syn match MySQLTableEnd "^ *+[+=-]\++ *$" oneline
|
||||
syn match MySQLTableDivide "^ *+[+=-]\++ *$" nextgroup=MySQLTableBody oneline skipwhite skipnl
|
||||
syn match MySQLTableStart "^ *+[+=-]\++ *$" nextgroup=MySQLTableHead oneline skipwhite skipnl
|
||||
syn match MySQLNull " NULL " contained contains=MySQLTableBar
|
||||
syn match MySQLStorageClass " PRI " contained
|
||||
syn match MySQLStorageClass " MUL " contained
|
||||
syn match MySQLStorageClass " UNI " contained
|
||||
syn match MySQLStorageClass " CURRENT_TIMESTAMP " contained
|
||||
syn match MySQLStorageClass " auto_increment " contained
|
||||
syn match MySQLTableBar "|" contained
|
||||
syn match MySQLNumber "|\? *\d\+\(\.\d\+\)\? *|" contained contains=MySQLTableBar
|
||||
syn match MySQLQueryStat "^\d\+ rows\? in set.*" oneline
|
||||
syn match MySQLPromptLine "^.\?mysql> .*$" contains=MySQLKeyword,MySQLPrompt,MySQLString oneline
|
||||
syn match MySQLPromptLine "^ -> .*$" contains=MySQLKeyword,MySQLPrompt,MySQLString oneline
|
||||
syn match MySQLPrompt "^.\?mysql>" contained oneline
|
||||
syn match MySQLPrompt "^ ->" contained oneline
|
||||
syn case ignore
|
||||
syn keyword MySQLKeyword select count max sum avg date show table tables status like as from left right outer inner join contained
|
||||
syn keyword MySQLKeyword where group by having limit offset order desc asc show contained and interval is null on
|
||||
syn case match
|
||||
syn region MySQLString start=+'+ end=+'+ skip=+\\'+ contained oneline
|
||||
syn region MySQLString start=+"+ end=+"+ skip=+\\"+ contained oneline
|
||||
syn region MySQLString start=+`+ end=+`+ skip=+\\`+ contained oneline
|
||||
|
||||
|
||||
hi def link MySQLPrompt Identifier
|
||||
hi def link MySQLTableHead Title
|
||||
hi def link MySQLTableBody Normal
|
||||
hi def link MySQLBool Boolean
|
||||
hi def link MySQLStorageClass StorageClass
|
||||
hi def link MySQLNumber Number
|
||||
hi def link MySQLKeyword Keyword
|
||||
hi def link MySQLString String
|
||||
|
||||
" terms which have no reasonable default highlight group to link to
|
||||
hi MySQLTableHead term=bold cterm=bold gui=bold
|
||||
if &background == 'dark'
|
||||
hi MySQLTableEnd term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableDivide term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableStart term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableBar term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLNull term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLQueryStat term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
elseif &background == 'light'
|
||||
hi MySQLTableEnd term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableDivide term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableStart term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableBar term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLNull term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLQueryStat term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
endif
|
||||
|
||||
|
||||
" *******************************************************************************************************************
|
||||
" Bash **************************************************************************************************************
|
||||
" *******************************************************************************************************************
|
||||
|
||||
" Typical Prompt
|
||||
if g:ConqueTerm_PromptRegex != ''
|
||||
silent execute "syn match ConquePromptLine '" . g:ConqueTerm_PromptRegex . ".*$' contains=ConquePrompt,ConqueString oneline"
|
||||
silent execute "syn match ConquePrompt '" . g:ConqueTerm_PromptRegex . "' contained oneline"
|
||||
hi def link ConquePrompt Identifier
|
||||
endif
|
||||
|
||||
" Strings
|
||||
syn region ConqueString start=+'+ end=+'+ skip=+\\'+ contained oneline
|
||||
syn region ConqueString start=+"+ end=+"+ skip=+\\"+ contained oneline
|
||||
syn region ConqueString start=+`+ end=+`+ skip=+\\`+ contained oneline
|
||||
hi def link ConqueString String
|
||||
|
||||
" vim: foldmethod=marker
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue