mirror of https://github.com/akelge/zsh
Modified indentation for Python
Added VCS plugin (CVS, SVN, git) Updated templating system Added option to process a ~/.vim/vimrc.local, after all other rc files
This commit is contained in:
parent
2d082edbce
commit
f7dabac03a
|
@ -0,0 +1,212 @@
|
|||
" ir_black color scheme
|
||||
" More at: http://blog.infinitered.com/entries/show/8
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
" Standard colors used in all ir_black themes:
|
||||
" Note, x:x:x are RGB values
|
||||
"
|
||||
" normal: #f6f3e8
|
||||
"
|
||||
" string: #A8FF60 168:255:96
|
||||
" string inner (punc, code, etc): #00A0A0 0:160:160
|
||||
" number: #FF73FD 255:115:253
|
||||
" comments: #7C7C7C 124:124:124
|
||||
" keywords: #96CBFE 150:203:254
|
||||
" operators: white
|
||||
" class: #FFFFB6 255:255:182
|
||||
" method declaration name: #FFD2A7 255:210:167
|
||||
" regular expression: #E9C062 233:192:98
|
||||
" regexp alternate: #FF8000 255:128:0
|
||||
" regexp alternate 2: #B18A3D 177:138:61
|
||||
" variable: #C6C5FE 198:197:254
|
||||
"
|
||||
" Misc colors:
|
||||
" red color (used for whatever): #FF6C60 255:108:96
|
||||
" light red: #FFB6B0 255:182:176
|
||||
"
|
||||
" brown: #E18964 good for special
|
||||
"
|
||||
" lightpurpleish: #FFCCFF
|
||||
"
|
||||
" Interface colors:
|
||||
" background color: black
|
||||
" cursor (where underscore is used): #FFA560 255:165:96
|
||||
" cursor (where block is used): white
|
||||
" visual selection: #1D1E2C
|
||||
" current line: #151515 21:21:21
|
||||
" search selection: #07281C 7:40:28
|
||||
" line number: #3D3D3D 61:61:61
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
" The following are the preferred 16 colors for your terminal
|
||||
" Colors Bright Colors
|
||||
" Black #4E4E4E #7C7C7C
|
||||
" Red #FF6C60 #FFB6B0
|
||||
" Green #A8FF60 #CEFFAB
|
||||
" Yellow #FFFFB6 #FFFFCB
|
||||
" Blue #96CBFE #FFFFCB
|
||||
" Magenta #FF73FD #FF9CFE
|
||||
" Cyan #C6C5FE #DFDFFE
|
||||
" White #EEEEEE #FFFFFF
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
set background=dark
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "ir_black"
|
||||
|
||||
|
||||
"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
" General colors
|
||||
hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse
|
||||
hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
|
||||
hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE
|
||||
hi StatusLine guifg=#CCCCCC guibg=#202020 gui=italic ctermfg=white ctermbg=darkgray cterm=NONE
|
||||
hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE
|
||||
|
||||
hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Visual guifg=NONE guibg=#262D51 gui=NONE ctermfg=NONE ctermbg=darkgray cterm=NONE
|
||||
|
||||
hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
hi WildMenu guifg=green guibg=yellow gui=NONE ctermfg=black ctermbg=yellow cterm=NONE
|
||||
hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE
|
||||
"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Error guifg=NONE guibg=NONE gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color
|
||||
hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
|
||||
hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
|
||||
|
||||
" Message displayed in lower left, such as --INSERT--
|
||||
hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD
|
||||
|
||||
if version >= 700 " Vim 7.x specific colors
|
||||
hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
|
||||
hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
|
||||
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE
|
||||
hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Search guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
|
||||
endif
|
||||
|
||||
" Syntax highlighting
|
||||
hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE
|
||||
hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end
|
||||
|
||||
hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE
|
||||
hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE
|
||||
hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi Operator guifg=white guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
|
||||
hi link Character Constant
|
||||
hi link Boolean Constant
|
||||
hi link Float Number
|
||||
hi link Repeat Statement
|
||||
hi link Label Statement
|
||||
hi link Exception Statement
|
||||
hi link Include PreProc
|
||||
hi link Define PreProc
|
||||
hi link Macro PreProc
|
||||
hi link PreCondit PreProc
|
||||
hi link StorageClass Type
|
||||
hi link Structure Type
|
||||
hi link Typedef Type
|
||||
hi link Tag Special
|
||||
hi link SpecialChar Special
|
||||
hi link SpecialComment Special
|
||||
hi link Debug Special
|
||||
|
||||
|
||||
" Special for Ruby
|
||||
hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc
|
||||
"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield
|
||||
hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE
|
||||
"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
|
||||
|
||||
|
||||
" Special for Java
|
||||
" hi link javaClassDecl Type
|
||||
hi link javaScopeDecl Identifier
|
||||
hi link javaCommentTitle javaDocSeeTag
|
||||
hi link javaDocTags javaDocSeeTag
|
||||
hi link javaDocParam javaDocSeeTag
|
||||
hi link javaDocSeeTagParam javaDocSeeTag
|
||||
|
||||
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
|
||||
|
||||
" Special for XML
|
||||
hi link xmlTag Keyword
|
||||
hi link xmlTagName Conditional
|
||||
hi link xmlEndTag Identifier
|
||||
|
||||
|
||||
" Special for HTML
|
||||
hi link htmlTag Keyword
|
||||
hi link htmlTagName Conditional
|
||||
hi link htmlEndTag Identifier
|
||||
|
||||
|
||||
" Special for Javascript
|
||||
hi link javaScriptNumber Number
|
||||
|
||||
|
||||
" Special for Python
|
||||
"hi link pythonEscape Keyword
|
||||
|
||||
|
||||
" Special for CSharp
|
||||
hi link csXmlTag Keyword
|
||||
|
||||
|
||||
" Special for PHP
|
|
@ -0,0 +1,47 @@
|
|||
""" local syntax file - set colors on a per-machine basis:
|
||||
""" Vim color file
|
||||
""" Title: Manxome Foes Color Scheme
|
||||
""" Maintainer: Ricardo SIGNES <rjbs-vim@lists.manxome.org>
|
||||
""" This Version: R2v2 [2003-07-16]
|
||||
""" suggested vim editing options: tw=0 ts=4 sw=4
|
||||
|
||||
"" clear and re-initialize global variables
|
||||
hi clear
|
||||
set background=dark
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name = "manxome"
|
||||
|
||||
"" set highlight groups
|
||||
"" you'll notice that the ctermbg is often 'none'; this is so that when
|
||||
"" console vim runs in a terminal, transparency (if any) is not broken
|
||||
|
||||
highlight Title ctermfg=3 ctermbg=none cterm=bold guifg=#ffff00 guibg=#000000 gui=none
|
||||
highlight Directory ctermfg=4 ctermbg=none cterm=bold guifg=#0000ff guibg=#000000 gui=none
|
||||
highlight StatusLine ctermfg=7 ctermbg=4 cterm=bold guifg=#ffffff guibg=#0000ff gui=none
|
||||
highlight StatusLineNC ctermfg=0 ctermbg=4 cterm=bold guifg=#000000 guibg=#0000ff gui=none
|
||||
highlight Normal ctermfg=7 ctermbg=none cterm=none guifg=#cccccc guibg=#000000 gui=none
|
||||
highlight Search ctermfg=7 ctermbg=4 cterm=bold guifg=#ffffff guibg=#0000ff gui=none
|
||||
highlight Visual ctermfg=7 ctermbg=6 cterm=bold guifg=#ffffff guibg=#00aaaa gui=none
|
||||
|
||||
"" set major preferred groups
|
||||
|
||||
highlight Comment ctermfg=2 ctermbg=none cterm=bold guifg=#00ff00 guibg=#000000 gui=none
|
||||
highlight Constant ctermfg=6 ctermbg=none cterm=bold guifg=#00ffff guibg=#000000 gui=none
|
||||
highlight Identifier ctermfg=4 ctermbg=none cterm=bold guifg=#0000ee guibg=#000000 gui=none
|
||||
highlight Statement ctermfg=6 ctermbg=none cterm=none guifg=#00aaaa guibg=#000000 gui=none
|
||||
highlight PreProc ctermfg=7 ctermbg=none cterm=bold guifg=#ffffff guibg=#000000 gui=none
|
||||
highlight Type ctermfg=6 ctermbg=none cterm=none guifg=#00aaaa guibg=#000000 gui=none
|
||||
highlight Special ctermfg=7 ctermbg=none cterm=bold guifg=#ffffff guibg=#000000 gui=none
|
||||
highlight Underlined ctermfg=2 ctermbg=none cterm=none guifg=#00aa00 guibg=#000000 gui=none
|
||||
highlight Ignore ctermfg=0 ctermbg=none cterm=bold guifg=#aaaaaa guibg=#000000 gui=none
|
||||
highlight Error ctermfg=1 ctermbg=none cterm=bold guibg=#ff0000 guibg=#000000 gui=none
|
||||
highlight Todo ctermfg=3 ctermbg=none cterm=none guifg=#aaaa00 guibg=#000000 gui=none
|
||||
|
||||
" set syntax-specific groups
|
||||
" I'd like to avoid using these, but the default settings for these two are
|
||||
" just no good. Seeing italic text in Vim is just plain wrong.
|
||||
|
||||
highlight htmlBold ctermfg=7 ctermbg=none cterm=bold guifg=#ffffff guibg=#000000 gui=none
|
||||
highlight htmlItalic ctermfg=5 ctermbg=none cterm=bold guifg=#ff00ff guibg=#000000 gui=none
|
|
@ -0,0 +1,102 @@
|
|||
" Vim color file
|
||||
" Maintainer: Michael Brailsford <brailsmt@yahoo.com>
|
||||
" Date: $Date: 2002/11/25 20:25:54 $
|
||||
" Version: $Revision: 1.1 $
|
||||
" Inspiration: This colorscheme was inspired by midnight.vim. It is a darker
|
||||
" version of it. With some colors tweaked.
|
||||
"
|
||||
" Thanks: Thanks go to Hans Fugal for creating the colorscheme template.
|
||||
" Without it I would have been lost creating the original midnight.vim
|
||||
" Thanks to Mark Lodato for providing vim7 updates.
|
||||
"
|
||||
" Note: If you do not like the dark look of the colorscheme, you can
|
||||
" easily lighten things up with the following line:
|
||||
" :%s/\(\w\)3/\12/g
|
||||
" It is easily pasteable into the command line. you can also
|
||||
" change "\12" to "\11", "\1" or "\14" (if you want things even
|
||||
" darker). If you do use the "\14" replacement, then it looks
|
||||
" like your monitor in a fog bank. :)
|
||||
|
||||
" your pick:
|
||||
set background=dark
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name="midnight2"
|
||||
|
||||
hi Normal guifg=slategray3 guibg=#000029 ctermfg=14
|
||||
|
||||
"Toggle semicolon matching at the end of lines
|
||||
nmap <silent> <leader>; :call ToggleSemicolonHighlighting()<cr>
|
||||
"{{{
|
||||
function! ToggleSemicolonHighlighting()
|
||||
if exists("b:semicolon")
|
||||
unlet b:semicolon
|
||||
hi semicolon guifg=NONE gui=NONE ctermfg=NONE
|
||||
else
|
||||
syn match semicolon #;$#
|
||||
hi semicolon guifg=red3 gui=bold ctermfg=1
|
||||
let b:semicolon = 1
|
||||
endif
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
hi Cursor guifg=bg guibg=fg ctermfg=0 ctermbg=11
|
||||
"hi CursorIM
|
||||
hi Directory gui=bold
|
||||
hi DiffAdd guifg=yellow3 guibg=darkgreen ctermbg=0
|
||||
"hi DiffChange
|
||||
"hi DiffDelete green
|
||||
"hi DiffText
|
||||
hi ErrorMsg guibg=red3 ctermfg=1
|
||||
"hi VertSplit
|
||||
hi Folded guibg=#00001a guifg=yellow3 ctermbg=4 ctermfg=11 gui=NONE
|
||||
hi FoldColumn guibg=steelblue3 ctermbg=14 guifg=navyblue ctermfg=11 gui=bold
|
||||
"hi SignColumn
|
||||
"hi IncSearch
|
||||
hi LineNr guifg=yellow3 ctermfg=3
|
||||
hi MatchParen guibg=navyblue gui=italic
|
||||
hi ModeMsg guifg=yellow3 gui=bold ctermfg=3
|
||||
"hi MoreMsg( )
|
||||
"hi NonText
|
||||
hi Pmenu guibg=steelblue3 guifg=bg ctermfg=7 ctermbg=4 cterm=bold
|
||||
hi PmenuSel guibg=fg guifg=bg gui=bold ctermfg=4 ctermbg=7 cterm=bold
|
||||
hi link PmenuSbar Pmenu
|
||||
"hi PmenuThumb
|
||||
"hi Question
|
||||
hi Search guibg=yellow3 guifg=bg
|
||||
"hi SpecialKey
|
||||
"hi SpellBad
|
||||
"hi SpellCap
|
||||
"hi SpellLocal
|
||||
"hi SpellRare
|
||||
hi StatusLine guifg=steelblue3
|
||||
hi StatusLineNC guifg=steelblue4
|
||||
"hi TabLine
|
||||
"hi TabLineFill
|
||||
"hi TabLineSel
|
||||
"hi Title
|
||||
hi Visual guifg=bg guibg=fg
|
||||
"hi VisualNOS
|
||||
"hi WarningMsg
|
||||
"hi WildMenu
|
||||
"hi Menu
|
||||
"hi Scrollbar
|
||||
"hi Tooltip
|
||||
|
||||
" syntax highlighting groups
|
||||
hi Comment guifg=chartreuse3 ctermfg=10
|
||||
hi Constant guifg=plum3 gui=bold ctermfg=13
|
||||
hi String guifg=indianred3 ctermfg=5
|
||||
hi Character guifg=mediumpurple3 ctermfg=5
|
||||
hi Number guifg=turquoise3 ctermfg=5
|
||||
"hi Identifier
|
||||
hi Statement guifg=khaki3 gui=bold ctermfg=15 cterm=underline
|
||||
hi PreProc guifg=firebrick3 gui=italic ctermfg=9
|
||||
hi Type guifg=gold3 gui=bold ctermfg=3
|
||||
hi Special guifg=orange ctermfg=208
|
||||
hi Underlined ctermfg=white cterm=underline
|
||||
"hi Ignore
|
||||
"hi Error
|
||||
hi Todo guifg=yellow3 guibg=blue3 gui=bold ctermfg=3
|
|
@ -0,0 +1,96 @@
|
|||
" 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
|
|
@ -0,0 +1,814 @@
|
|||
*vcscommand.txt* vcscommand
|
||||
Copyright (c) 2007 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.
|
||||
|
||||
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.
|
||||
|
||||
The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate',
|
||||
'SVNAnnotate', or 'SVKAnnotate' as appropriate, to take advantage of the
|
||||
bundled syntax files.
|
||||
|
||||
: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) can be used in the log message buffer 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>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|
|
||||
|VCSCommandEdit|
|
||||
|VCSCommandEnableBufferSetup|
|
||||
|VCSCommandMappings|
|
||||
|VCSCommandMapPrefix|
|
||||
|VCSCommandResultBufferNameExtension|
|
||||
|VCSCommandResultBufferNameFunction|
|
||||
|VCSCommandSplit|
|
||||
|VCSCommandSVKExec|
|
||||
|VCSCommandSVNDiffExt|
|
||||
|VCSCommandSVNDiffOpt|
|
||||
|VCSCommandSVNExec|
|
||||
|VCSCommandVCSTypeOverride|
|
||||
|
||||
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'.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
11
vim/gvimrc
11
vim/gvimrc
|
@ -4,10 +4,9 @@
|
|||
" $Id$
|
||||
set guifont=Monaco:h13
|
||||
set anti
|
||||
set lines=65
|
||||
set columns=150
|
||||
set nomousefocus
|
||||
set ruler
|
||||
set lines=50
|
||||
set columns=132
|
||||
set mousefocus
|
||||
set errorbells
|
||||
set visualbell
|
||||
set showtabline=2
|
||||
|
@ -28,3 +27,7 @@ endif
|
|||
"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
|
||||
|
|
|
@ -1,196 +1,193 @@
|
|||
" Python indent file
|
||||
" Language: Python
|
||||
" Maintainer: Eric Mc Sween <em@tomcom.de>
|
||||
" Original Author: David Bustos <bustos@caltech.edu>
|
||||
" Last Change: 2004 Jun 07
|
||||
" 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
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal expandtab
|
||||
setlocal nolisp
|
||||
setlocal autoindent
|
||||
" 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=!^F,o,O,<:>,0),0],0},=elif,=except
|
||||
setlocal indentkeys+=<:>,=elif,=except,0#
|
||||
|
||||
let s:maxoff = 50
|
||||
" Only define the function once.
|
||||
if exists("*GetPythonIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Find backwards the closest open parenthesis/bracket/brace.
|
||||
function! s:SearchParensPair()
|
||||
let line = line('.')
|
||||
let col = col('.')
|
||||
|
||||
" Skip strings and comments and don't look too far
|
||||
let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
|
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
|
||||
\ '"string\\|comment"'
|
||||
" Come here when loading the script the first time.
|
||||
|
||||
" Search for parentheses
|
||||
call cursor(line, col)
|
||||
let parlnum = searchpair('(', '', ')', 'bW', skip)
|
||||
let parcol = col('.')
|
||||
let s:maxoff = 50 " maximum number of lines to look backwards for ()
|
||||
|
||||
" Search for brackets
|
||||
call cursor(line, col)
|
||||
let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
|
||||
let par2col = col('.')
|
||||
function GetPythonIndent(lnum)
|
||||
|
||||
" Search for braces
|
||||
call cursor(line, col)
|
||||
let par3lnum = searchpair('{', '', '}', 'bW', skip)
|
||||
let par3col = col('.')
|
||||
|
||||
" Get the closest match
|
||||
if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
|
||||
let parlnum = par2lnum
|
||||
let parcol = par2col
|
||||
" 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
|
||||
if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
|
||||
let parlnum = par3lnum
|
||||
let parcol = par3col
|
||||
endif
|
||||
return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2))
|
||||
endif
|
||||
|
||||
" Put the cursor on the match
|
||||
if parlnum > 0
|
||||
call cursor(parlnum, parcol)
|
||||
endif
|
||||
return parlnum
|
||||
endfunction
|
||||
|
||||
" Find the start of a multi-line statement
|
||||
function! s:StatementStart(lnum)
|
||||
let lnum = a:lnum
|
||||
while 1
|
||||
if getline(lnum - 1) =~ '\\$'
|
||||
let lnum = lnum - 1
|
||||
else
|
||||
call cursor(lnum, 1)
|
||||
let maybe_lnum = s:SearchParensPair()
|
||||
if maybe_lnum < 1
|
||||
return lnum
|
||||
else
|
||||
let lnum = maybe_lnum
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Find the block starter that matches the current line
|
||||
function! s:BlockStarter(lnum, block_start_re)
|
||||
let lnum = a:lnum
|
||||
let maxindent = 10000 " whatever
|
||||
while lnum > 1
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if indent(lnum) < maxindent
|
||||
if getline(lnum) =~ a:block_start_re
|
||||
return lnum
|
||||
else
|
||||
let maxindent = indent(lnum)
|
||||
" It's not worth going further if we reached the top level
|
||||
if maxindent == 0
|
||||
return -1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
" 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
|
||||
|
||||
function! GetPythonIndent(lnum)
|
||||
|
||||
" First line has indent 0
|
||||
if a:lnum == 1
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If we can find an open parenthesis/bracket/brace, line up with it.
|
||||
call cursor(a:lnum, 1)
|
||||
let parlnum = s:SearchParensPair()
|
||||
if parlnum > 0
|
||||
let parcol = col('.')
|
||||
let closing_paren = match(getline(a:lnum), '^\s*[])}]') != -1
|
||||
if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
|
||||
if closing_paren
|
||||
return indent(parlnum)
|
||||
else
|
||||
return indent(parlnum) + &shiftwidth
|
||||
endif
|
||||
else
|
||||
if closing_paren
|
||||
return parcol - 1
|
||||
else
|
||||
return parcol
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" Examine this line
|
||||
let thisline = getline(a:lnum)
|
||||
let thisindent = indent(a:lnum)
|
||||
|
||||
" If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
|
||||
if thisline =~ '^\s*\(elif\|else\)\>'
|
||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
|
||||
if bslnum > 0
|
||||
return indent(bslnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endif
|
||||
|
||||
" If the line starts with 'except' or 'finally', line up with 'try'
|
||||
" or 'except'
|
||||
if thisline =~ '^\s*\(except\|finally\)\>'
|
||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
|
||||
if bslnum > 0
|
||||
return indent(bslnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endif
|
||||
|
||||
" Examine previous line
|
||||
let plnum = a:lnum - 1
|
||||
let pline = getline(plnum)
|
||||
let sslnum = s:StatementStart(plnum)
|
||||
|
||||
" If the previous line is blank, keep the same indentation
|
||||
if pline =~ '^\s*$'
|
||||
return -1
|
||||
endif
|
||||
|
||||
" If this line is explicitly joined, try to find an indentation that looks
|
||||
" good.
|
||||
if pline =~ '\\$'
|
||||
let compound_statement = '^\s*\(if\|while\|for\s.*\sin\|except\)\s*'
|
||||
let maybe_indent = matchend(getline(sslnum), compound_statement)
|
||||
if maybe_indent != -1
|
||||
return maybe_indent
|
||||
else
|
||||
return indent(sslnum) + &sw * 2
|
||||
endif
|
||||
endif
|
||||
|
||||
" If the previous line ended with a colon, indent relative to
|
||||
" statement start.
|
||||
if pline =~ ':\s*$'
|
||||
return indent(sslnum) + &sw
|
||||
endif
|
||||
|
||||
" If the previous line was a stop-execution statement or a pass
|
||||
if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||
" See if the user has already dedented
|
||||
if indent(a:lnum) > indent(sslnum) - &sw
|
||||
" If not, recommend one dedent
|
||||
return indent(sslnum) - &sw
|
||||
endif
|
||||
" Otherwise, trust the user
|
||||
return -1
|
||||
endif
|
||||
|
||||
" In all other cases, line up with the start of the previous statement.
|
||||
return indent(sslnum)
|
||||
endfunction
|
||||
" vim:sw=2
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
setlocal indentkeys+=0#
|
|
@ -0,0 +1,982 @@
|
|||
" Vim support file to define the default menus
|
||||
" You can also use this as a start for your own set of menus.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2004 May 26
|
||||
|
||||
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
|
||||
" in all modes and avoid side effects from mappings defined by the user.
|
||||
|
||||
" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
|
||||
" <CR> would not be recognized. See ":help 'cpoptions'".
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Avoid installing the menus twice
|
||||
if !exists("did_install_default_menus")
|
||||
let did_install_default_menus = 1
|
||||
|
||||
|
||||
if exists("v:lang") || &langmenu != ""
|
||||
" Try to find a menu translation file for the current language.
|
||||
if &langmenu != ""
|
||||
if &langmenu =~ "none"
|
||||
let s:lang = ""
|
||||
else
|
||||
let s:lang = &langmenu
|
||||
endif
|
||||
else
|
||||
let s:lang = v:lang
|
||||
endif
|
||||
" A language name must be at least two characters, don't accept "C"
|
||||
if strlen(s:lang) > 1
|
||||
" When the language does not include the charset add 'encoding'
|
||||
if s:lang =~ '^\a\a$\|^\a\a_\a\a$'
|
||||
let s:lang = s:lang . '.' . &enc
|
||||
endif
|
||||
|
||||
" We always use a lowercase name.
|
||||
" Change "iso-8859" to "iso_8859" and "iso8859" to "iso_8859", some
|
||||
" systems appear to use this.
|
||||
" Change spaces to underscores.
|
||||
let s:lang = substitute(tolower(s:lang), '\.iso-', ".iso_", "")
|
||||
let s:lang = substitute(s:lang, '\.iso8859', ".iso_8859", "")
|
||||
let s:lang = substitute(s:lang, " ", "_", "g")
|
||||
" Remove "@euro", otherwise "LC_ALL=de_DE@euro gvim" will show English menus
|
||||
let s:lang = substitute(s:lang, "@euro", "", "")
|
||||
" Change "iso_8859-1" and "iso_8859-15" to "latin1", we always use the
|
||||
" same menu file for them.
|
||||
let s:lang = substitute(s:lang, 'iso_8859-15\=$', "latin1", "")
|
||||
menutrans clear
|
||||
exe "runtime! lang/menu_" . s:lang . ".vim"
|
||||
|
||||
if !exists("did_menu_trans")
|
||||
" There is no exact match, try matching with a wildcard added
|
||||
" (e.g. find menu_de_de.iso_8859-1.vim if s:lang == de_DE).
|
||||
let s:lang = substitute(s:lang, '\.[^.]*', "", "")
|
||||
exe "runtime! lang/menu_" . s:lang . "*.vim"
|
||||
|
||||
if !exists("did_menu_trans") && strlen($LANG) > 1
|
||||
" On windows locale names are complicated, try using $LANG, it might
|
||||
" have been set by set_init_1().
|
||||
exe "runtime! lang/menu_" . tolower($LANG) . "*.vim"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
" Help menu
|
||||
an 9999.10 &Help.&Overview<Tab><F1> :help<CR>
|
||||
an 9999.20 &Help.&User\ Manual :help usr_toc<CR>
|
||||
an 9999.30 &Help.&How-to\ links :help how-to<CR>
|
||||
an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR>
|
||||
an 9999.45 &Help.-sep1- <Nop>
|
||||
an 9999.50 &Help.&Credits :help credits<CR>
|
||||
an 9999.60 &Help.Co&pying :help copying<CR>
|
||||
an 9999.70 &Help.&Sponsor/Register :help sponsor<CR>
|
||||
an 9999.70 &Help.O&rphans :help kcc<CR>
|
||||
an 9999.75 &Help.-sep2- <Nop>
|
||||
an 9999.80 &Help.&Version :version<CR>
|
||||
an 9999.90 &Help.&About :intro<CR>
|
||||
|
||||
fun! s:Helpfind()
|
||||
if !exists("g:menutrans_help_dialog")
|
||||
let g:menutrans_help_dialog = "Enter a command or word to find help on:\n\nPrepend i_ for Input mode commands (e.g.: i_CTRL-X)\nPrepend c_ for command-line editing commands (e.g.: c_<Del>)\nPrepend ' for an option name (e.g.: 'shiftwidth')"
|
||||
endif
|
||||
let h = inputdialog(g:menutrans_help_dialog)
|
||||
if h != ""
|
||||
let v:errmsg = ""
|
||||
silent! exe "help " . h
|
||||
if v:errmsg != ""
|
||||
echo v:errmsg
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" File menu
|
||||
an 10.310 &File.&Open\.\.\.<Tab>:e :browse confirm e<CR>
|
||||
an 10.320 &File.Sp&lit-Open\.\.\.<Tab>:sp :browse sp<CR>
|
||||
an 10.325 &File.&New<Tab>:enew :confirm enew<CR>
|
||||
an <silent> 10.330 &File.&Close<Tab>:close
|
||||
\ :if winheight(2) < 0 <Bar>
|
||||
\ confirm enew <Bar>
|
||||
\ else <Bar>
|
||||
\ confirm close <Bar>
|
||||
\ endif<CR>
|
||||
an 10.335 &File.-SEP1- <Nop>
|
||||
an <silent> 10.340 &File.&Save<Tab>:w :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
|
||||
an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR>
|
||||
|
||||
if has("diff")
|
||||
an 10.400 &File.-SEP2- <Nop>
|
||||
an 10.410 &File.Split\ &Diff\ with\.\.\. :browse vert diffsplit<CR>
|
||||
an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR>
|
||||
endif
|
||||
|
||||
if has("printer")
|
||||
an 10.500 &File.-SEP3- <Nop>
|
||||
an 10.510 &File.&Print :hardcopy<CR>
|
||||
vunmenu &File.&Print
|
||||
vnoremenu &File.&Print :hardcopy<CR>
|
||||
an 10.520 &File.-SEP3- <Nop>
|
||||
an 10.530 &File.&ToPDF :call ToPDF()<CR>
|
||||
vunmenu &File.&ToPDF
|
||||
vnoremenu &File.&ToPDF :call ToPDF()<CR>
|
||||
elseif has("unix")
|
||||
an 10.500 &File.-SEP3- <Nop>
|
||||
an 10.510 &File.&Print :w !lpr<CR>
|
||||
vunmenu &File.&Print
|
||||
vnoremenu &File.&Print :w !lpr<CR>
|
||||
an 10.520 &File.-SEP3- <Nop>
|
||||
an 10.530 &File.&ToPDF :call ToPDF()<CR>
|
||||
vunmenu &File.&ToPDF
|
||||
vnoremenu &File.&ToPDF :call ToPDF()<CR>
|
||||
endif
|
||||
an 10.600 &File.-SEP4- <Nop>
|
||||
an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR>
|
||||
an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
|
||||
|
||||
" Pasting blockwise and linewise selections is not possible in Insert and
|
||||
" Visual mode without the +virtualedit feature. They are pasted as if they
|
||||
" were characterwise instead. Add to that some tricks to leave the cursor in
|
||||
" the right position, also for "gi".
|
||||
" Note: the same stuff appears in mswin.vim.
|
||||
if has("virtualedit")
|
||||
nnoremap <silent> <script> <SID>Paste :call <SID>Paste()<CR>
|
||||
func! <SID>Paste()
|
||||
let ove = &ve
|
||||
set ve=all
|
||||
normal `^
|
||||
if @+ != ''
|
||||
normal "+gP
|
||||
endif
|
||||
let c = col(".")
|
||||
normal i
|
||||
if col(".") < c " compensate for i<ESC> moving the cursor left
|
||||
normal l
|
||||
endif
|
||||
let &ve = ove
|
||||
endfunc
|
||||
else
|
||||
nnoremap <silent> <script> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
|
||||
endif
|
||||
|
||||
" Use maps for items that are present both in Edit, Popup and Toolbar menu.
|
||||
if has("virtualedit")
|
||||
vnoremap <script> <SID>vPaste "-c<Esc><SID>Paste
|
||||
inoremap <script> <SID>iPaste <Esc><SID>Pastegi
|
||||
else
|
||||
vnoremap <script> <SID>vPaste "-c<Esc>gix<Esc><SID>Paste"_x
|
||||
inoremap <script> <SID>iPaste x<Esc><SID>Paste"_s
|
||||
endif
|
||||
|
||||
func! <SID>SelectAll()
|
||||
exe "norm gg" . (&slm == "" ? "VG" : "gH\<C-O>G")
|
||||
endfunc
|
||||
|
||||
|
||||
" Edit menu
|
||||
an 20.310 &Edit.&Undo<Tab>u u
|
||||
an 20.320 &Edit.&Redo<Tab>^R <C-R>
|
||||
an 20.330 &Edit.Rep&eat<Tab>\. .
|
||||
|
||||
an 20.335 &Edit.-SEP1- <Nop>
|
||||
vnoremenu 20.340 &Edit.Cu&t<Tab>"+x "+x
|
||||
vnoremenu 20.350 &Edit.&Copy<Tab>"+y "+y
|
||||
cnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-Y>
|
||||
nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP
|
||||
cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+
|
||||
vnoremenu <script> &Edit.&Paste<Tab>"+gP <SID>vPaste
|
||||
inoremenu <script> &Edit.&Paste<Tab>"+gP <SID>iPaste
|
||||
nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p
|
||||
inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p
|
||||
nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p
|
||||
inoremenu &Edit.Put\ &After<Tab>]p <C-O>]p
|
||||
if has("win32") || has("win16")
|
||||
vnoremenu 20.390 &Edit.&Delete<Tab>x x
|
||||
endif
|
||||
noremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG :<C-U>call <SID>SelectAll()<CR>
|
||||
inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>SelectAll()<CR>
|
||||
cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR>
|
||||
|
||||
an 20.405 &Edit.-SEP2- <Nop>
|
||||
if has("win32") || has("win16") || has("gui_gtk") || has("gui_motif")
|
||||
an 20.410 &Edit.&Find\.\.\. :promptfind<CR>
|
||||
vunmenu &Edit.&Find\.\.\.
|
||||
vnoremenu &Edit.&Find\.\.\. y:promptfind <C-R>"<CR>
|
||||
an 20.420 &Edit.Find\ and\ Rep&lace\.\.\. :promptrepl<CR>
|
||||
vunmenu &Edit.Find\ and\ Rep&lace\.\.\.
|
||||
vnoremenu &Edit.Find\ and\ Rep&lace\.\.\. y:promptrepl <C-R>"<CR>
|
||||
else
|
||||
an 20.410 &Edit.&Find<Tab>/ /
|
||||
an 20.420 &Edit.Find\ and\ Rep&lace<Tab>:%s :%s/
|
||||
vunmenu &Edit.Find\ and\ Rep&lace<Tab>:%s
|
||||
vnoremenu &Edit.Find\ and\ Rep&lace<Tab>:s :s/
|
||||
endif
|
||||
|
||||
an 20.425 &Edit.-SEP3- <Nop>
|
||||
an 20.430 &Edit.Settings\ &Window :options<CR>
|
||||
|
||||
" Edit/Global Settings
|
||||
an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight<Tab>:set\ hls! :set hls! hls?<CR>
|
||||
an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignore-case<Tab>:set\ ic! :set ic! ic?<CR>
|
||||
an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showmatch<Tab>:set\ sm! :set sm! sm?<CR>
|
||||
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 1\ :set so=1<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 2\ :set so=2<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 3\ :set so=3<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 4\ :set so=4<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 5\ :set so=5<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 7\ :set so=7<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 10\ :set so=10<CR>
|
||||
an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 100\ :set so=100<CR>
|
||||
|
||||
an 20.440.130.40 &Edit.&Global\ Settings.&Virtual\ Edit.Never :set ve=<CR>
|
||||
an 20.440.130.50 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ Selection :set ve=block<CR>
|
||||
an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ mode :set ve=insert<CR>
|
||||
an 20.440.130.70 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ and\ Insert :set ve=block,insert<CR>
|
||||
an 20.440.130.80 &Edit.&Global\ Settings.&Virtual\ Edit.Always :set ve=all<CR>
|
||||
an 20.440.140 &Edit.&Global\ Settings.Toggle\ Insert\ &Mode<Tab>:set\ im! :set im!<CR>
|
||||
an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatible<Tab>:set\ cp! :set cp!<CR>
|
||||
an <silent> 20.440.150 &Edit.&Global\ Settings.Search\ &Path\.\.\. :call <SID>SearchP()<CR>
|
||||
an <silent> 20.440.160 &Edit.&Global\ Settings.Ta&g\ Files\.\.\. :call <SID>TagFiles()<CR>
|
||||
"
|
||||
" GUI options
|
||||
an 20.440.300 &Edit.&Global\ Settings.-SEP1- <Nop>
|
||||
an <silent> 20.440.310 &Edit.&Global\ Settings.Toggle\ &Toolbar :call <SID>ToggleGuiOption("T")<CR>
|
||||
an <silent> 20.440.320 &Edit.&Global\ Settings.Toggle\ &Bottom\ Scrollbar :call <SID>ToggleGuiOption("b")<CR>
|
||||
an <silent> 20.440.330 &Edit.&Global\ Settings.Toggle\ &Left\ Scrollbar :call <SID>ToggleGuiOption("l")<CR>
|
||||
an <silent> 20.440.340 &Edit.&Global\ Settings.Toggle\ &Right\ Scrollbar :call <SID>ToggleGuiOption("r")<CR>
|
||||
|
||||
fun! s:SearchP()
|
||||
if !exists("g:menutrans_path_dialog")
|
||||
let g:menutrans_path_dialog = "Enter search path for files.\nSeparate directory names with a comma."
|
||||
endif
|
||||
let n = inputdialog(g:menutrans_path_dialog, substitute(&path, '\\ ', ' ', 'g'))
|
||||
if n != ""
|
||||
let &path = substitute(n, ' ', '\\ ', 'g')
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:TagFiles()
|
||||
if !exists("g:menutrans_tags_dialog")
|
||||
let g:menutrans_tags_dialog = "Enter names of tag files.\nSeparate the names with a comma."
|
||||
endif
|
||||
let n = inputdialog(g:menutrans_tags_dialog, substitute(&tags, '\\ ', ' ', 'g'))
|
||||
if n != ""
|
||||
let &tags = substitute(n, ' ', '\\ ', 'g')
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:ToggleGuiOption(option)
|
||||
" If a:option is already set in guioptions, then we want to remove it
|
||||
if match(&guioptions, "\\C" . a:option) > -1
|
||||
exec "set go-=" . a:option
|
||||
else
|
||||
exec "set go+=" . a:option
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Edit/File Settings
|
||||
|
||||
" Boolean options
|
||||
an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu! :set nu! nu?<CR>
|
||||
an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list! :set list! list?<CR>
|
||||
an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrap<Tab>:set\ wrap! :set wrap! wrap?<CR>
|
||||
an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rap\ at\ word<Tab>:set\ lbr! :set lbr! lbr?<CR>
|
||||
an 20.440.160 &Edit.F&ile\ Settings.Toggle\ &expand-tab<Tab>:set\ et! :set et! et?<CR>
|
||||
an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &auto-indent<Tab>:set\ ai! :set ai! ai?<CR>
|
||||
an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-indenting<Tab>:set\ cin! :set cin! cin?<CR>
|
||||
|
||||
" other options
|
||||
an 20.440.600 &Edit.F&ile\ Settings.-SEP2- <Nop>
|
||||
an 20.440.610.20 &Edit.F&ile\ Settings.&Shiftwidth.2 :set sw=2 sw?<CR>
|
||||
an 20.440.610.30 &Edit.F&ile\ Settings.&Shiftwidth.3 :set sw=3 sw?<CR>
|
||||
an 20.440.610.40 &Edit.F&ile\ Settings.&Shiftwidth.4 :set sw=4 sw?<CR>
|
||||
an 20.440.610.50 &Edit.F&ile\ Settings.&Shiftwidth.5 :set sw=5 sw?<CR>
|
||||
an 20.440.610.60 &Edit.F&ile\ Settings.&Shiftwidth.6 :set sw=6 sw?<CR>
|
||||
an 20.440.610.80 &Edit.F&ile\ Settings.&Shiftwidth.8 :set sw=8 sw?<CR>
|
||||
|
||||
an 20.440.620.20 &Edit.F&ile\ Settings.Soft\ &Tabstop.2 :set sts=2 sts?<CR>
|
||||
an 20.440.620.30 &Edit.F&ile\ Settings.Soft\ &Tabstop.3 :set sts=3 sts?<CR>
|
||||
an 20.440.620.40 &Edit.F&ile\ Settings.Soft\ &Tabstop.4 :set sts=4 sts?<CR>
|
||||
an 20.440.620.50 &Edit.F&ile\ Settings.Soft\ &Tabstop.5 :set sts=5 sts?<CR>
|
||||
an 20.440.620.60 &Edit.F&ile\ Settings.Soft\ &Tabstop.6 :set sts=6 sts?<CR>
|
||||
an 20.440.620.80 &Edit.F&ile\ Settings.Soft\ &Tabstop.8 :set sts=8 sts?<CR>
|
||||
|
||||
an <silent> 20.440.630 &Edit.F&ile\ Settings.Te&xt\ Width\.\.\. :call <SID>TextWidth()<CR>
|
||||
an <silent> 20.440.640 &Edit.F&ile\ Settings.&File\ Format\.\.\. :call <SID>FileFormat()<CR>
|
||||
fun! s:TextWidth()
|
||||
if !exists("g:menutrans_textwidth_dialog")
|
||||
let g:menutrans_textwidth_dialog = "Enter new text width (0 to disable formatting): "
|
||||
endif
|
||||
let n = inputdialog(g:menutrans_textwidth_dialog, &tw)
|
||||
if n != ""
|
||||
" remove leading zeros to avoid it being used as an octal number
|
||||
let &tw = substitute(n, "^0*", "", "")
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:FileFormat()
|
||||
if !exists("g:menutrans_fileformat_dialog")
|
||||
let g:menutrans_fileformat_dialog = "Select format for writing the file"
|
||||
endif
|
||||
if !exists("g:menutrans_fileformat_choices")
|
||||
let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Cancel"
|
||||
endif
|
||||
if &ff == "dos"
|
||||
let def = 2
|
||||
elseif &ff == "mac"
|
||||
let def = 3
|
||||
else
|
||||
let def = 1
|
||||
endif
|
||||
let n = confirm(g:menutrans_fileformat_dialog, g:menutrans_fileformat_choices, def, "Question")
|
||||
if n == 1
|
||||
set ff=unix
|
||||
elseif n == 2
|
||||
set ff=dos
|
||||
elseif n == 3
|
||||
set ff=mac
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Setup the Edit.Color Scheme submenu
|
||||
let s:n = globpath(&runtimepath, "colors/*.vim")
|
||||
let s:idx = 100
|
||||
while strlen(s:n) > 0
|
||||
let s:i = stridx(s:n, "\n")
|
||||
if s:i < 0
|
||||
let s:name = s:n
|
||||
let s:n = ""
|
||||
else
|
||||
let s:name = strpart(s:n, 0, s:i)
|
||||
let s:n = strpart(s:n, s:i + 1, 19999)
|
||||
endif
|
||||
" Ignore case for VMS and windows
|
||||
let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
|
||||
exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>"
|
||||
unlet s:name
|
||||
unlet s:i
|
||||
let s:idx = s:idx + 10
|
||||
endwhile
|
||||
unlet s:n
|
||||
unlet s:idx
|
||||
|
||||
" Setup the Edit.Keymap submenu
|
||||
if has("keymap")
|
||||
let s:n = globpath(&runtimepath, "keymap/*.vim")
|
||||
if s:n != ""
|
||||
let s:idx = 100
|
||||
an 20.460.90 &Edit.&Keymap.None :set keymap=<CR>
|
||||
while strlen(s:n) > 0
|
||||
let s:i = stridx(s:n, "\n")
|
||||
if s:i < 0
|
||||
let s:name = s:n
|
||||
let s:n = ""
|
||||
else
|
||||
let s:name = strpart(s:n, 0, s:i)
|
||||
let s:n = strpart(s:n, s:i + 1, 19999)
|
||||
endif
|
||||
" Ignore case for VMS and windows
|
||||
let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '')
|
||||
exe "an 20.460." . s:idx . ' &Edit.&Keymap.' . s:name . " :set keymap=" . s:name . "<CR>"
|
||||
unlet s:name
|
||||
unlet s:i
|
||||
let s:idx = s:idx + 10
|
||||
endwhile
|
||||
unlet s:idx
|
||||
endif
|
||||
unlet s:n
|
||||
endif
|
||||
if has("win32") || has("win16") || has("gui_gtk") || has("gui_photon")
|
||||
an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR>
|
||||
endif
|
||||
|
||||
" Programming menu
|
||||
if !exists("g:ctags_command")
|
||||
if has("vms")
|
||||
let g:ctags_command = "mc vim:ctags ."
|
||||
else
|
||||
let g:ctags_command = "ctags -R ."
|
||||
endif
|
||||
endif
|
||||
|
||||
an 40.300 &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]>
|
||||
vunmenu &Tools.&Jump\ to\ this\ tag<Tab>g^]
|
||||
vnoremenu &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]>
|
||||
an 40.310 &Tools.Jump\ &back<Tab>^T <C-T>
|
||||
an 40.320 &Tools.Build\ &Tags\ File :exe "!" . g:ctags_command<CR>
|
||||
|
||||
" Tools.Fold Menu
|
||||
if has("folding")
|
||||
an 40.330 &Tools.-SEP1- <Nop>
|
||||
" open close folds
|
||||
an 40.340.110 &Tools.&Folding.&Enable/Disable\ folds<Tab>zi zi
|
||||
an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv zv
|
||||
an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx zMzx
|
||||
an 40.340.130 &Tools.&Folding.C&lose\ more\ folds<Tab>zm zm
|
||||
an 40.340.140 &Tools.&Folding.&Close\ all\ folds<Tab>zM zM
|
||||
an 40.340.150 &Tools.&Folding.O&pen\ more\ folds<Tab>zr zr
|
||||
an 40.340.160 &Tools.&Folding.&Open\ all\ folds<Tab>zR zR
|
||||
" fold method
|
||||
an 40.340.200 &Tools.&Folding.-SEP1- <Nop>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.M&anual :set fdm=manual<CR>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.I&ndent :set fdm=indent<CR>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.E&xpression :set fdm=expr<CR>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.S&yntax :set fdm=syntax<CR>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.&Diff :set fdm=diff<CR>
|
||||
an 40.340.210 &Tools.&Folding.Fold\ Met&hod.Ma&rker :set fdm=marker<CR>
|
||||
" create and delete folds
|
||||
vnoremenu 40.340.220 &Tools.&Folding.Create\ &Fold<Tab>zf zf
|
||||
an 40.340.230 &Tools.&Folding.&Delete\ Fold<Tab>zd zd
|
||||
an 40.340.240 &Tools.&Folding.Delete\ &All\ Folds<Tab>zD zD
|
||||
" moving around in folds
|
||||
an 40.340.300 &Tools.&Folding.-SEP2- <Nop>
|
||||
an 40.340.310.10 &Tools.&Folding.Fold\ col&umn\ width.\ &0\ :set fdc=0<CR>
|
||||
an 40.340.310.20 &Tools.&Folding.Fold\ col&umn\ width.\ &2\ :set fdc=2<CR>
|
||||
an 40.340.310.30 &Tools.&Folding.Fold\ col&umn\ width.\ &3\ :set fdc=3<CR>
|
||||
an 40.340.310.40 &Tools.&Folding.Fold\ col&umn\ width.\ &4\ :set fdc=4<CR>
|
||||
an 40.340.310.50 &Tools.&Folding.Fold\ col&umn\ width.\ &5\ :set fdc=5<CR>
|
||||
an 40.340.310.60 &Tools.&Folding.Fold\ col&umn\ width.\ &6\ :set fdc=6<CR>
|
||||
an 40.340.310.70 &Tools.&Folding.Fold\ col&umn\ width.\ &7\ :set fdc=7<CR>
|
||||
an 40.340.310.80 &Tools.&Folding.Fold\ col&umn\ width.\ &8\ :set fdc=8<CR>
|
||||
endif " has folding
|
||||
|
||||
if has("diff")
|
||||
an 40.350.100 &Tools.&Diff.&Update :diffupdate<CR>
|
||||
an 40.350.110 &Tools.&Diff.&Get\ Block :diffget<CR>
|
||||
vunmenu &Tools.&Diff.&Get\ Block
|
||||
vnoremenu &Tools.&Diff.&Get\ Block :diffget<CR>
|
||||
an 40.350.120 &Tools.&Diff.&Put\ Block :diffput<CR>
|
||||
vunmenu &Tools.&Diff.&Put\ Block
|
||||
vnoremenu &Tools.&Diff.&Put\ Block :diffput<CR>
|
||||
endif
|
||||
|
||||
an 40.358 &Tools.-SEP2- <Nop>
|
||||
an 40.360 &Tools.&Make<Tab>:make :make<CR>
|
||||
an 40.370 &Tools.&List\ Errors<Tab>:cl :cl<CR>
|
||||
an 40.380 &Tools.L&ist\ Messages<Tab>:cl! :cl!<CR>
|
||||
an 40.390 &Tools.&Next\ Error<Tab>:cn :cn<CR>
|
||||
an 40.400 &Tools.&Previous\ Error<Tab>:cp :cp<CR>
|
||||
an 40.410 &Tools.&Older\ List<Tab>:cold :colder<CR>
|
||||
an 40.420 &Tools.N&ewer\ List<Tab>:cnew :cnewer<CR>
|
||||
an 40.430.50 &Tools.Error\ &Window.&Update<Tab>:cwin :cwin<CR>
|
||||
an 40.430.60 &Tools.Error\ &Window.&Open<Tab>:copen :copen<CR>
|
||||
an 40.430.70 &Tools.Error\ &Window.&Close<Tab>:cclose :cclose<CR>
|
||||
|
||||
an 40.520 &Tools.-SEP3- <Nop>
|
||||
an <silent> 40.530 &Tools.&Convert\ to\ HEX<Tab>:%!xxd
|
||||
\ :call <SID>XxdConv()<CR>
|
||||
an <silent> 40.540 &Tools.Conve&rt\ back<Tab>:%!xxd\ -r
|
||||
\ :call <SID>XxdBack()<CR>
|
||||
|
||||
" Use a function to do the conversion, so that it also works with 'insertmode'
|
||||
" set.
|
||||
func! s:XxdConv()
|
||||
let mod = &mod
|
||||
if has("vms")
|
||||
%!mc vim:xxd
|
||||
else
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '"'
|
||||
endif
|
||||
if getline(1) =~ "^0000000:" " only if it worked
|
||||
set ft=xxd
|
||||
endif
|
||||
let &mod = mod
|
||||
endfun
|
||||
|
||||
func! s:XxdBack()
|
||||
let mod = &mod
|
||||
if has("vms")
|
||||
%!mc vim:xxd -r
|
||||
else
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '" -r'
|
||||
endif
|
||||
set ft=
|
||||
doautocmd filetypedetect BufReadPost
|
||||
let &mod = mod
|
||||
endfun
|
||||
|
||||
func! s:XxdFind()
|
||||
if !exists("g:xxdprogram")
|
||||
" On the PC xxd may not be in the path but in the install directory
|
||||
if (has("win32") || has("dos32")) && !executable("xxd")
|
||||
let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe"
|
||||
else
|
||||
let g:xxdprogram = "xxd"
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Setup the Tools.Compiler submenu
|
||||
let s:n = globpath(&runtimepath, "compiler/*.vim")
|
||||
let s:idx = 100
|
||||
while strlen(s:n) > 0
|
||||
let s:i = stridx(s:n, "\n")
|
||||
if s:i < 0
|
||||
let s:name = s:n
|
||||
let s:n = ""
|
||||
else
|
||||
let s:name = strpart(s:n, 0, s:i)
|
||||
let s:n = strpart(s:n, s:i + 1, 19999)
|
||||
endif
|
||||
" Ignore case for VMS and windows
|
||||
let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
|
||||
exe "an 30.440." . s:idx . ' &Tools.&Set\ Compiler.' . s:name . " :compiler " . s:name . "<CR>"
|
||||
unlet s:name
|
||||
unlet s:i
|
||||
let s:idx = s:idx + 10
|
||||
endwhile
|
||||
unlet s:n
|
||||
unlet s:idx
|
||||
|
||||
if !exists("no_buffers_menu")
|
||||
|
||||
" Buffer list menu -- Setup functions & actions
|
||||
|
||||
" wait with building the menu until after loading 'session' files. Makes
|
||||
" startup faster.
|
||||
let s:bmenu_wait = 1
|
||||
|
||||
if !exists("bmenu_priority")
|
||||
let bmenu_priority = 60
|
||||
endif
|
||||
|
||||
func! s:BMAdd()
|
||||
if s:bmenu_wait == 0
|
||||
" when adding too many buffers, redraw in short format
|
||||
if s:bmenu_count == &menuitems && s:bmenu_short == 0
|
||||
call s:BMShow()
|
||||
else
|
||||
call <SID>BMFilename(expand("<afile>"), expand("<abuf>"))
|
||||
let s:bmenu_count = s:bmenu_count + 1
|
||||
endif
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func! s:BMRemove()
|
||||
if s:bmenu_wait == 0
|
||||
let name = expand("<afile>")
|
||||
if isdirectory(name)
|
||||
return
|
||||
endif
|
||||
let munge = <SID>BMMunge(name, expand("<abuf>"))
|
||||
|
||||
if s:bmenu_short == 0
|
||||
exe 'silent! aun &Buffers.' . munge
|
||||
else
|
||||
exe 'silent! aun &Buffers.' . <SID>BMHash2(munge) . munge
|
||||
endif
|
||||
let s:bmenu_count = s:bmenu_count - 1
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Create the buffer menu (delete an existing one first).
|
||||
func! s:BMShow(...)
|
||||
let s:bmenu_wait = 1
|
||||
let s:bmenu_short = 1
|
||||
let s:bmenu_count = 0
|
||||
"
|
||||
" get new priority, if exists
|
||||
if a:0 == 1
|
||||
let g:bmenu_priority = a:1
|
||||
endif
|
||||
|
||||
" remove old menu, if exists; keep one entry to avoid a torn off menu to
|
||||
" disappear.
|
||||
silent! unmenu &Buffers
|
||||
exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l"
|
||||
silent! unmenu! &Buffers
|
||||
|
||||
" create new menu; set 'cpo' to include the <CR>
|
||||
let cpo_save = &cpo
|
||||
set cpo&vim
|
||||
exe 'an <silent> ' . g:bmenu_priority . ".2 &Buffers.&Refresh\\ menu :call <SID>BMShow()<CR>"
|
||||
exe 'an ' . g:bmenu_priority . ".4 &Buffers.&Delete :confirm bd<CR>"
|
||||
exe 'an ' . g:bmenu_priority . ".6 &Buffers.&Alternate :confirm b #<CR>"
|
||||
exe 'an ' . g:bmenu_priority . ".7 &Buffers.&Next :confirm bnext<CR>"
|
||||
exe 'an ' . g:bmenu_priority . ".8 &Buffers.&Previous :confirm bprev<CR>"
|
||||
exe 'an ' . g:bmenu_priority . ".9 &Buffers.-SEP- :"
|
||||
let &cpo = cpo_save
|
||||
unmenu &Buffers.Dummy
|
||||
|
||||
" figure out how many buffers there are
|
||||
let buf = 1
|
||||
while buf <= bufnr('$')
|
||||
if bufexists(buf) && !isdirectory(bufname(buf)) && buflisted(buf)
|
||||
\ && !getbufvar(buf, "&bufsecret")
|
||||
let s:bmenu_count = s:bmenu_count + 1
|
||||
endif
|
||||
let buf = buf + 1
|
||||
endwhile
|
||||
if s:bmenu_count <= &menuitems
|
||||
let s:bmenu_short = 0
|
||||
endif
|
||||
|
||||
" iterate through buffer list, adding each buffer to the menu:
|
||||
let buf = 1
|
||||
while buf <= bufnr('$')
|
||||
if bufexists(buf) && !isdirectory(bufname(buf)) && buflisted(buf)
|
||||
\ && !getbufvar(buf, "&bufsecret")
|
||||
call <SID>BMFilename(bufname(buf), buf)
|
||||
endif
|
||||
let buf = buf + 1
|
||||
endwhile
|
||||
let s:bmenu_wait = 0
|
||||
aug buffer_list
|
||||
au!
|
||||
au BufCreate,BufFilePost * call <SID>BMAdd()
|
||||
au BufDelete,BufFilePre * call <SID>BMRemove()
|
||||
aug END
|
||||
endfunc
|
||||
|
||||
func! s:BMHash(name)
|
||||
" Make name all upper case, so that chars are between 32 and 96
|
||||
let nm = substitute(a:name, ".*", '\U\0', "")
|
||||
if has("ebcdic")
|
||||
" HACK: Replace all non alphabetics with 'Z'
|
||||
" Just to make it work for now.
|
||||
let nm = substitute(nm, "[^A-Z]", 'Z', "g")
|
||||
let sp = char2nr('A') - 1
|
||||
else
|
||||
let sp = char2nr(' ')
|
||||
endif
|
||||
" convert first six chars into a number for sorting:
|
||||
return (char2nr(nm[0]) - sp) * 0x800000 + (char2nr(nm[1]) - sp) * 0x20000 + (char2nr(nm[2]) - sp) * 0x1000 + (char2nr(nm[3]) - sp) * 0x80 + (char2nr(nm[4]) - sp) * 0x20 + (char2nr(nm[5]) - sp)
|
||||
endfunc
|
||||
|
||||
func! s:BMHash2(name)
|
||||
let nm = substitute(a:name, ".", '\L\0', "")
|
||||
" Not exactly right for EBCDIC...
|
||||
if nm[0] < 'a' || nm[0] > 'z'
|
||||
return '&others.'
|
||||
elseif nm[0] <= 'd'
|
||||
return '&abcd.'
|
||||
elseif nm[0] <= 'h'
|
||||
return '&efgh.'
|
||||
elseif nm[0] <= 'l'
|
||||
return '&ijkl.'
|
||||
elseif nm[0] <= 'p'
|
||||
return '&mnop.'
|
||||
elseif nm[0] <= 't'
|
||||
return '&qrst.'
|
||||
else
|
||||
return '&u-z.'
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" insert a buffer name into the buffer menu:
|
||||
func! s:BMFilename(name, num)
|
||||
if isdirectory(a:name)
|
||||
return
|
||||
endif
|
||||
let munge = <SID>BMMunge(a:name, a:num)
|
||||
let hash = <SID>BMHash(munge)
|
||||
if s:bmenu_short == 0
|
||||
let name = 'an ' . g:bmenu_priority . '.' . hash . ' &Buffers.' . munge
|
||||
else
|
||||
let name = 'an ' . g:bmenu_priority . '.' . hash . '.' . hash . ' &Buffers.' . <SID>BMHash2(munge) . munge
|
||||
endif
|
||||
" set 'cpo' to include the <CR>
|
||||
let cpo_save = &cpo
|
||||
set cpo&vim
|
||||
exe name . ' :confirm b' . a:num . '<CR>'
|
||||
let &cpo = cpo_save
|
||||
endfunc
|
||||
|
||||
" Truncate a long path to fit it in a menu item.
|
||||
if !exists("g:bmenu_max_pathlen")
|
||||
let g:bmenu_max_pathlen = 35
|
||||
endif
|
||||
func! s:BMTruncName(fname)
|
||||
let name = a:fname
|
||||
if g:bmenu_max_pathlen < 5
|
||||
let name = ""
|
||||
else
|
||||
let len = strlen(name)
|
||||
if len > g:bmenu_max_pathlen
|
||||
let amountl = (g:bmenu_max_pathlen / 2) - 2
|
||||
let amountr = g:bmenu_max_pathlen - amountl - 3
|
||||
let pattern = '^\(.\{,' . amountl . '}\).\{-}\(.\{,' . amountr . '}\)$'
|
||||
let left = substitute(name, pattern, '\1', '')
|
||||
let right = substitute(name, pattern, '\2', '')
|
||||
if strlen(left) + strlen(right) < len
|
||||
let name = left . '...' . right
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return name
|
||||
endfunc
|
||||
|
||||
func! s:BMMunge(fname, bnum)
|
||||
let name = a:fname
|
||||
if name == ''
|
||||
if !exists("g:menutrans_no_file")
|
||||
let g:menutrans_no_file = "[No file]"
|
||||
endif
|
||||
let name = g:menutrans_no_file
|
||||
else
|
||||
let name = fnamemodify(name, ':p:~')
|
||||
endif
|
||||
" detach file name and separate it out:
|
||||
let name2 = fnamemodify(name, ':t')
|
||||
if a:bnum >= 0
|
||||
let name2 = name2 . ' (' . a:bnum . ')'
|
||||
endif
|
||||
let name = name2 . "\t" . <SID>BMTruncName(fnamemodify(name,':h'))
|
||||
let name = escape(name, "\\. \t|")
|
||||
let name = substitute(name, "&", "&&", "g")
|
||||
let name = substitute(name, "\n", "^@", "g")
|
||||
return name
|
||||
endfunc
|
||||
|
||||
" When just starting Vim, load the buffer menu later
|
||||
if has("vim_starting")
|
||||
augroup LoadBufferMenu
|
||||
au! VimEnter * if !exists("no_buffers_menu") | call <SID>BMShow() | endif
|
||||
au VimEnter * au! LoadBufferMenu
|
||||
augroup END
|
||||
else
|
||||
call <SID>BMShow()
|
||||
endif
|
||||
|
||||
endif " !exists("no_buffers_menu")
|
||||
|
||||
" Window menu
|
||||
an 70.300 &Window.&New<Tab>^Wn <C-W>n
|
||||
an 70.310 &Window.S&plit<Tab>^Ws <C-W>s
|
||||
an 70.320 &Window.Sp&lit\ To\ #<Tab>^W^^ <C-W><C-^>
|
||||
an 70.330 &Window.Split\ &Vertically<Tab>^Wv <C-W>v
|
||||
if has("vertsplit")
|
||||
an <silent> 70.332 &Window.Split\ File\ E&xplorer :call MenuExplOpen()<CR>
|
||||
if !exists("*MenuExplOpen")
|
||||
fun MenuExplOpen()
|
||||
if @% == ""
|
||||
20vsp .
|
||||
else
|
||||
exe "20vsp " . expand("%:p:h")
|
||||
endif
|
||||
endfun
|
||||
endif
|
||||
endif
|
||||
an 70.335 &Window.-SEP1- <Nop>
|
||||
an 70.340 &Window.&Close<Tab>^Wc :confirm close<CR>
|
||||
an 70.345 &Window.Close\ &Other(s)<Tab>^Wo :confirm only<CR>
|
||||
an 70.350 &Window.-SEP2- <Nop>
|
||||
an 70.355 &Window.Move\ &To.&Top<Tab>^WK <C-W>K
|
||||
an 70.355 &Window.Move\ &To.&Bottom<Tab>^WJ <C-W>J
|
||||
an 70.355 &Window.Move\ &To.&Left\ side<Tab>^WH <C-W>H
|
||||
an 70.355 &Window.Move\ &To.&Right\ side<Tab>^WL <C-W>L
|
||||
an 70.360 &Window.Rotate\ &Up<Tab>^WR <C-W>R
|
||||
an 70.362 &Window.Rotate\ &Down<Tab>^Wr <C-W>r
|
||||
an 70.365 &Window.-SEP3- <Nop>
|
||||
an 70.370 &Window.&Equal\ Size<Tab>^W= <C-W>=
|
||||
an 70.380 &Window.&Max\ Height<Tab>^W_ <C-W>_
|
||||
an 70.390 &Window.M&in\ Height<Tab>^W1_ <C-W>1_
|
||||
an 70.400 &Window.Max\ &Width<Tab>^W\| <C-W>\|
|
||||
an 70.410 &Window.Min\ Widt&h<Tab>^W1\| <C-W>1\|
|
||||
|
||||
" The popup menu
|
||||
an 1.10 PopUp.&Undo u
|
||||
an 1.15 PopUp.-SEP1- <Nop>
|
||||
vnoremenu 1.20 PopUp.Cu&t "+x
|
||||
vnoremenu 1.30 PopUp.&Copy "+y
|
||||
cnoremenu 1.30 PopUp.&Copy <C-Y>
|
||||
nnoremenu 1.40 PopUp.&Paste "+gP
|
||||
cnoremenu 1.40 PopUp.&Paste <C-R>+
|
||||
vnoremenu <script> 1.40 PopUp.&Paste <SID>vPaste
|
||||
inoremenu <script> 1.40 PopUp.&Paste <SID>iPaste
|
||||
vnoremenu 1.50 PopUp.&Delete x
|
||||
an 1.55 PopUp.-SEP2- <Nop>
|
||||
vnoremenu 1.60 PopUp.Select\ Blockwise <C-V>
|
||||
an 1.70 PopUp.Select\ &Word vaw
|
||||
an 1.80 PopUp.Select\ &Line V
|
||||
an 1.90 PopUp.Select\ &Block <C-V>
|
||||
noremenu <script> <silent> 1.100 PopUp.Select\ &All :<C-U>call <SID>SelectAll()<CR>
|
||||
inoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-O>:call <SID>SelectAll()<CR>
|
||||
cnoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-U>call <SID>SelectAll()<CR>
|
||||
|
||||
|
||||
" The GUI toolbar (for MS-Windows and GTK)
|
||||
if has("toolbar")
|
||||
an 1.10 ToolBar.Open :browse confirm e<CR>
|
||||
an <silent> 1.20 ToolBar.Save :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
|
||||
an 1.30 ToolBar.SaveAll :browse confirm wa<CR>
|
||||
|
||||
if has("printer")
|
||||
an 1.40 ToolBar.Print :hardcopy<CR>
|
||||
vunmenu ToolBar.Print
|
||||
vnoremenu ToolBar.Print :hardcopy<CR>
|
||||
elseif has("unix")
|
||||
an 1.40 ToolBar.Print :w !lpr<CR>
|
||||
vunmenu ToolBar.Print
|
||||
vnoremenu ToolBar.Print :w !lpr<CR>
|
||||
endif
|
||||
|
||||
an 1.45 ToolBar.-sep1- <Nop>
|
||||
an 1.50 ToolBar.Undo u
|
||||
an 1.60 ToolBar.Redo <C-R>
|
||||
|
||||
an 1.65 ToolBar.-sep2- <Nop>
|
||||
vnoremenu 1.70 ToolBar.Cut "+x
|
||||
vnoremenu 1.80 ToolBar.Copy "+y
|
||||
cnoremenu 1.80 ToolBar.Copy <C-Y>
|
||||
nnoremenu 1.90 ToolBar.Paste "+gP
|
||||
cnoremenu ToolBar.Paste <C-R>+
|
||||
vnoremenu <script> ToolBar.Paste <SID>vPaste
|
||||
inoremenu <script> ToolBar.Paste <SID>iPaste
|
||||
|
||||
if !has("gui_athena")
|
||||
an 1.95 ToolBar.-sep3- <Nop>
|
||||
an 1.100 ToolBar.Find :promptfind<CR>
|
||||
vunmenu ToolBar.Find
|
||||
vnoremenu ToolBar.Find y:promptfind <C-R>"<CR>
|
||||
an 1.110 ToolBar.FindNext n
|
||||
an 1.120 ToolBar.FindPrev N
|
||||
an 1.130 ToolBar.Replace :promptrepl<CR>
|
||||
vunmenu ToolBar.Replace
|
||||
vnoremenu ToolBar.Replace y:promptrepl <C-R>"<CR>
|
||||
endif
|
||||
|
||||
if 0 " disabled; These are in the Windows menu
|
||||
an 1.135 ToolBar.-sep4- <Nop>
|
||||
an 1.140 ToolBar.New <C-W>n
|
||||
an 1.150 ToolBar.WinSplit <C-W>s
|
||||
an 1.160 ToolBar.WinMax :resize 200<CR>
|
||||
an 1.170 ToolBar.WinMin :resize 1<CR>
|
||||
an 1.180 ToolBar.WinVSplit <C-W>v
|
||||
an 1.190 ToolBar.WinMaxWidth <C-W>500>
|
||||
an 1.200 ToolBar.WinMinWidth <C-W>1\|
|
||||
an 1.210 ToolBar.WinClose :close<CR>
|
||||
endif
|
||||
|
||||
an 1.215 ToolBar.-sep5- <Nop>
|
||||
an <silent> 1.220 ToolBar.LoadSesn :call <SID>LoadVimSesn()<CR>
|
||||
an <silent> 1.230 ToolBar.SaveSesn :call <SID>SaveVimSesn()<CR>
|
||||
an 1.240 ToolBar.RunScript :browse so<CR>
|
||||
|
||||
an 1.245 ToolBar.-sep6- <Nop>
|
||||
an 1.250 ToolBar.Make :make<CR>
|
||||
an 1.270 ToolBar.RunCtags :exe "!" . g:ctags_command<CR>
|
||||
an 1.280 ToolBar.TagJump g<C-]>
|
||||
|
||||
an 1.295 ToolBar.-sep7- <Nop>
|
||||
an 1.300 ToolBar.Help :help<CR>
|
||||
an <silent> 1.310 ToolBar.FindHelp :call <SID>Helpfind()<CR>
|
||||
|
||||
" Only set the tooltips here if not done in a language menu file
|
||||
if exists("*Do_toolbar_tmenu")
|
||||
call Do_toolbar_tmenu()
|
||||
else
|
||||
let did_toolbar_tmenu = 1
|
||||
tmenu ToolBar.Open Open file
|
||||
tmenu ToolBar.Save Save current file
|
||||
tmenu ToolBar.SaveAll Save all files
|
||||
tmenu ToolBar.Print Print
|
||||
tmenu ToolBar.Undo Undo
|
||||
tmenu ToolBar.Redo Redo
|
||||
tmenu ToolBar.Cut Cut to clipboard
|
||||
tmenu ToolBar.Copy Copy to clipboard
|
||||
tmenu ToolBar.Paste Paste from Clipboard
|
||||
if !has("gui_athena")
|
||||
tmenu ToolBar.Find Find...
|
||||
tmenu ToolBar.FindNext Find Next
|
||||
tmenu ToolBar.FindPrev Find Previous
|
||||
tmenu ToolBar.Replace Find / Replace...
|
||||
endif
|
||||
if 0 " disabled; These are in the Windows menu
|
||||
tmenu ToolBar.New New Window
|
||||
tmenu ToolBar.WinSplit Split Window
|
||||
tmenu ToolBar.WinMax Maximise Window
|
||||
tmenu ToolBar.WinMin Minimise Window
|
||||
tmenu ToolBar.WinVSplit Split Window Vertically
|
||||
tmenu ToolBar.WinMaxWidth Maximise Window Width
|
||||
tmenu ToolBar.WinMinWidth Minimise Window Width
|
||||
tmenu ToolBar.WinClose Close Window
|
||||
endif
|
||||
tmenu ToolBar.LoadSesn Load session
|
||||
tmenu ToolBar.SaveSesn Save current session
|
||||
tmenu ToolBar.RunScript Run a Vim Script
|
||||
tmenu ToolBar.Make Make current project
|
||||
tmenu ToolBar.RunCtags Build tags in current directory tree
|
||||
tmenu ToolBar.TagJump Jump to tag under cursor
|
||||
tmenu ToolBar.Help Vim Help
|
||||
tmenu ToolBar.FindHelp Search Vim Help
|
||||
endif
|
||||
|
||||
" Select a session to load; default to current session name if present
|
||||
fun! s:LoadVimSesn()
|
||||
if strlen(v:this_session) > 0
|
||||
let name = v:this_session
|
||||
else
|
||||
let name = "Session.vim"
|
||||
endif
|
||||
execute "browse so " . name
|
||||
endfun
|
||||
|
||||
" Select a session to save; default to current session name if present
|
||||
fun! s:SaveVimSesn()
|
||||
if strlen(v:this_session) == 0
|
||||
let v:this_session = "Session.vim"
|
||||
endif
|
||||
execute "browse mksession! " . v:this_session
|
||||
endfun
|
||||
|
||||
endif
|
||||
|
||||
endif " !exists("did_install_default_menus")
|
||||
|
||||
" Define these items always, so that syntax can be switched on when it wasn't.
|
||||
" But skip them when the Syntax menu was disabled by the user.
|
||||
if !exists("did_install_syntax_menu")
|
||||
an 50.212 &Syntax.&Manual :syn manual<CR>
|
||||
an 50.214 &Syntax.A&utomatic :syn on<CR>
|
||||
an <silent> 50.216 &Syntax.on/off\ for\ &This\ file :call <SID>SynOnOff()<CR>
|
||||
if !exists("*s:SynOnOff")
|
||||
fun s:SynOnOff()
|
||||
if has("syntax_items")
|
||||
syn clear
|
||||
else
|
||||
if !exists("g:syntax_on")
|
||||
syn manual
|
||||
endif
|
||||
set syn=ON
|
||||
endif
|
||||
endfun
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
" Install the Syntax menu only when filetype.vim has been loaded or when
|
||||
" manual syntax highlighting is enabled.
|
||||
" Avoid installing the Syntax menu twice.
|
||||
if (exists("did_load_filetypes") || exists("syntax_on"))
|
||||
\ && !exists("did_install_syntax_menu")
|
||||
let did_install_syntax_menu = 1
|
||||
|
||||
" Skip setting up the individual syntax selection menus unless
|
||||
" do_syntax_sel_menu is defined (it takes quite a bit of time).
|
||||
if exists("do_syntax_sel_menu")
|
||||
runtime! synmenu.vim
|
||||
else
|
||||
an 50.10 &Syntax.&Show\ filetypes\ in\ menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ filetypes\ in\ menu<CR>
|
||||
an 50.195 &Syntax.-SEP1- <Nop>
|
||||
endif
|
||||
|
||||
an 50.210 &Syntax.&Off :syn off<CR>
|
||||
an 50.700 &Syntax.-SEP3- <Nop>
|
||||
an 50.710 &Syntax.Co&lor\ test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR>
|
||||
an 50.720 &Syntax.&Highlight\ test :runtime syntax/hitest.vim<CR>
|
||||
an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR>
|
||||
|
||||
endif " !exists("did_install_syntax_menu")
|
||||
|
||||
" Restore the previous value of 'cpoptions'.
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: set sw=2 :
|
|
@ -4,8 +4,6 @@
|
|||
"
|
||||
" Synopsis: Templating system for vim
|
||||
"
|
||||
" $Id$
|
||||
"
|
||||
" Remember to define in your vimrc the following var
|
||||
" let g:fullname = 'Your Full Name'
|
||||
" let g:email = 'your.email@address'
|
||||
|
@ -16,10 +14,11 @@
|
|||
" @@EMAIL@@ - replaced by g:email
|
||||
" @@DESCR@@ - Synopsis of file (asked by this plugin
|
||||
" @@crdate@@ - replaced by creation date
|
||||
" @@lmdate@@ - replaced by last modification date
|
||||
" 2009-04-03T12:56 CEST (+0200) - replaced by last modification date
|
||||
|
||||
" Define template directory
|
||||
let g:skeletons = '~/.vim/templates'
|
||||
let s:timeFormat= "%FT%H:%M %Z (%z)"
|
||||
|
||||
" Preserve template files
|
||||
augroup newfiles
|
||||
|
@ -51,8 +50,8 @@ function! LastMod()
|
|||
else
|
||||
let l = line("$")
|
||||
endif
|
||||
execute "1," . l . "s/@@lmdate@@/" .
|
||||
\ strftime("%FT%X %Z") . "/e"
|
||||
execute "1," . l . "s/Last modified: .*/Last modified: " .
|
||||
\ strftime(s:timeFormat) . "/e"
|
||||
endfunction
|
||||
|
||||
" Function to open a file and set some defaults
|
||||
|
@ -71,7 +70,7 @@ function! OpenFile()
|
|||
execute "1," . l . "s/@@DESCR@@/" .
|
||||
\ s:syn
|
||||
execute "1," . l . "s/@@crdate@@/" .
|
||||
\ strftime("%FT%X %Z") . "/e"
|
||||
\ strftime(s:timeFormat) . "/e"
|
||||
execute "1," . l . "s/@@LONGNAME@@/" .
|
||||
\ g:fullname . "/e"
|
||||
execute "1," . l . "s/@@EMAIL@@/" .
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,441 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" CVS extension for VCSCommand.
|
||||
"
|
||||
" Version: VCS development
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) 2007 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
|
||||
|
||||
runtime plugin/vcscommand.vim
|
||||
|
||||
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: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 = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
|
||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||
else
|
||||
throw 'CVS VCSCommand plugin called on non-CVS item.'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: GetRevision() {{{2
|
||||
" Function for retrieving the current buffer's revision number.
|
||||
" Returns: Revision number or an empty string if an error occurs.
|
||||
|
||||
function! 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' . 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
|
||||
set filetype=CVSAnnotate
|
||||
" 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
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||
if resultBuffer > 0
|
||||
set filetype=diff
|
||||
else
|
||||
echomsg 'No differences found'
|
||||
endif
|
||||
return resultBuffer
|
||||
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=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' 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
|
||||
|
||||
let resultBuffer=s:DoCommand(join(['log'] + options), 'log', caption, {})
|
||||
if resultBuffer > 0
|
||||
set filetype=rcslog
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
|
||||
let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
|
||||
if resultBuffer > 0
|
||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
|
||||
" 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 = {}
|
||||
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
|
||||
|
||||
" Section: Menu items {{{1
|
||||
silent! aunmenu Plugin.VCS.CVS
|
||||
amenu <silent> &Plugin.VCS.CVS.&Edit <Plug>CVSEdit
|
||||
amenu <silent> &Plugin.VCS.CVS.Ed&itors <Plug>CVSEditors
|
||||
amenu <silent> &Plugin.VCS.CVS.Unedi&t <Plug>CVSUnedit
|
||||
amenu <silent> &Plugin.VCS.CVS.&Watchers <Plug>CVSWatchers
|
||||
amenu <silent> &Plugin.VCS.CVS.WatchAdd <Plug>CVSWatchAdd
|
||||
amenu <silent> &Plugin.VCS.CVS.WatchOn <Plug>CVSWatchOn
|
||||
amenu <silent> &Plugin.VCS.CVS.WatchOff <Plug>CVSWatchOff
|
||||
amenu <silent> &Plugin.VCS.CVS.WatchRemove <Plug>CVSWatchRemove
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
call VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -0,0 +1,258 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" git extension for VCSCommand.
|
||||
"
|
||||
" Version: VCS development
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) 2008 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
|
||||
|
||||
runtime plugin/vcscommand.vim
|
||||
|
||||
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: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 = VCSCommandGetOption('VCSCommandGitExec', 'git',) . ' ' . 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 system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' 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
|
||||
|
||||
let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options, {})
|
||||
if resultBuffer > 0
|
||||
normal 1G
|
||||
set filetype=gitAnnotate
|
||||
endif
|
||||
return resultBuffer
|
||||
endfunction
|
||||
|
||||
" Function: s:gitFunctions.Commit(argList) {{{2
|
||||
function! s:gitFunctions.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: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
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
|
||||
if resultBuffer > 0
|
||||
set filetype=diff
|
||||
else
|
||||
echomsg 'No differences found'
|
||||
endif
|
||||
return resultBuffer
|
||||
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(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' 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(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' 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)
|
||||
let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
|
||||
if resultBuffer > 0
|
||||
set filetype=gitlog
|
||||
endif
|
||||
return resultBuffer
|
||||
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 = system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --show-prefix')
|
||||
finally
|
||||
call VCSCommandChdir(oldCwd)
|
||||
endtry
|
||||
|
||||
let prefix = substitute(prefix, '\n$', '', '')
|
||||
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
|
||||
let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {})
|
||||
if resultBuffer > 0
|
||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
call VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -0,0 +1,262 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" SVK extension for VCSCommand.
|
||||
"
|
||||
" Version: VCS development
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) 2007 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
|
||||
|
||||
runtime plugin/vcscommand.vim
|
||||
|
||||
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: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 = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . 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 = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
|
||||
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
|
||||
set filetype=SVKAnnotate
|
||||
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
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
|
||||
if resultBuffer > 0
|
||||
set filetype=diff
|
||||
else
|
||||
echomsg 'No differences found'
|
||||
endif
|
||||
return resultBuffer
|
||||
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 = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' 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
|
||||
|
||||
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||
if resultBuffer > 0
|
||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
call VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -0,0 +1,288 @@
|
|||
" vim600: set foldmethod=marker:
|
||||
"
|
||||
" SVN extension for VCSCommand.
|
||||
"
|
||||
" Version: VCS development
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" License:
|
||||
" Copyright (c) 2007 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
|
||||
|
||||
runtime plugin/vcscommand.vim
|
||||
|
||||
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: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 = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . 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 fileName = resolve(bufname(a:buffer))
|
||||
if isdirectory(fileName)
|
||||
let directoryName = fileName
|
||||
else
|
||||
let directoryName = fnamemodify(fileName, ':h')
|
||||
endif
|
||||
if strlen(directoryName) > 0
|
||||
let svnDir = directoryName . '/.svn'
|
||||
else
|
||||
let svnDir = '.svn'
|
||||
endif
|
||||
if isdirectory(svnDir)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
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
|
||||
|
||||
let resultBuffer = s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
|
||||
if resultBuffer > 0
|
||||
set filetype=SVNAnnotate
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
|
||||
let resultBuffer = s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||
if resultBuffer > 0
|
||||
set filetype=diff
|
||||
else
|
||||
if svnDiffExt == ''
|
||||
echomsg 'No differences found'
|
||||
endif
|
||||
endif
|
||||
return resultBuffer
|
||||
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 = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status --non-interactive -vu "' . fileName . '"')
|
||||
if(v:shell_error)
|
||||
return []
|
||||
endif
|
||||
|
||||
" File not under SVN control.
|
||||
if statusText =~ '^?'
|
||||
return ['Unknown']
|
||||
endif
|
||||
|
||||
let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\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: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
|
||||
|
||||
let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
|
||||
if resultBuffer > 0
|
||||
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
||||
endif
|
||||
return resultBuffer
|
||||
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
|
||||
|
||||
" Section: Plugin Registration {{{1
|
||||
call VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
|
||||
|
||||
let &cpo = s:save_cpo
|
|
@ -0,0 +1,45 @@
|
|||
" Vim syntax file
|
||||
" Language: CVS annotate output
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" Remark: Used by the cvscommand plugin. Originally written by Mathieu
|
||||
" Clabaut
|
||||
" License:
|
||||
" Copyright (c) 2007 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.
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn match cvsDate /\d\d-...-\d\d/ contained
|
||||
syn match cvsName /(\S* /hs=s+1,he=e-1 contained nextgroup=cvsDate
|
||||
syn match cvsVer /^\d\+\(\.\d\+\)\+/ contained nextgroup=cvsName
|
||||
syn region cvsHead start="^\d\+\.\d\+" end="):" contains=cvsVer,cvsName,cvsDate
|
||||
|
||||
if !exists("did_cvsannotate_syntax_inits")
|
||||
let did_cvsannotate_syntax_inits = 1
|
||||
hi link cvsDate Comment
|
||||
hi link cvsName Type
|
||||
hi link cvsVer Statement
|
||||
endif
|
||||
|
||||
let b:current_syntax="CVSAnnotate"
|
|
@ -0,0 +1,42 @@
|
|||
" Vim syntax file
|
||||
" Language: SVK annotate output
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" Remark: Used by the vcscommand plugin.
|
||||
" License:
|
||||
" Copyright (c) 2007 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.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn match svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained
|
||||
syn match svkName /(\s*\zs\S\+/ contained nextgroup=svkDate skipwhite
|
||||
syn match svkVer /^\s*\d\+/ contained nextgroup=svkName skipwhite
|
||||
syn region svkHead start=/^/ end="):" contains=svkVer,svkName,svkDate oneline
|
||||
|
||||
if !exists("did_svkannotate_syntax_inits")
|
||||
let did_svkannotate_syntax_inits = 1
|
||||
hi link svkName Type
|
||||
hi link svkDate Comment
|
||||
hi link svkVer Statement
|
||||
endif
|
||||
|
||||
let b:current_syntax="svkAnnotate"
|
|
@ -0,0 +1,40 @@
|
|||
" Vim syntax file
|
||||
" Language: SVN annotate output
|
||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
" Remark: Used by the vcscommand plugin.
|
||||
" License:
|
||||
" Copyright (c) 2007 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.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn match svnName /\S\+/ contained
|
||||
syn match svnVer /^\s\+\zs\d\+/ contained nextgroup=svnName skipwhite
|
||||
syn match svnHead /^\s\+\d\+\s\+\S\+/ contains=svnVer,svnName
|
||||
|
||||
if !exists("did_svnannotate_syntax_inits")
|
||||
let did_svnannotate_syntax_inits = 1
|
||||
hi link svnName Type
|
||||
hi link svnVer Statement
|
||||
endif
|
||||
|
||||
let b:current_syntax="svnAnnotate"
|
|
@ -2,10 +2,10 @@
|
|||
" Language: Python
|
||||
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
|
||||
" URL: http://www.hlabs.spb.ru/vim/python.vim
|
||||
" Last Change: $Date$
|
||||
" Last Change: $Date: 2009-04-01 09:51:12 +0200 (Mer, 01 Apr 2009) $
|
||||
" Filenames: *.py
|
||||
" Version: 2.5.5
|
||||
" $Rev$
|
||||
" $Rev: 6 $
|
||||
"
|
||||
" Based on python.vim (from Vim 6.1 distribution)
|
||||
" by Neil Schemenauer <nas@python.ca>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
" Vim syntax file
|
||||
" Language: VCS commit file
|
||||
" Maintainer: Bob Hiestand (bob.hiestand@gmail.com)
|
||||
" License:
|
||||
" Copyright (c) 2007 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.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax region vcsComment start="^VCS: " end="$"
|
||||
highlight link vcsComment Comment
|
||||
let b:current_syntax = "vcscommit"
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
Copyright by @@LONGNAME@@ <@@EMAIL@@>
|
||||
First version: @@crdate@@
|
||||
Last modified: @@lmdate@@
|
||||
Last modified: 2009-04-03T13:01 CEST (+0200)
|
||||
|
||||
Synopsis: @@DESCR@@
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
63
vim/vimrc
63
vim/vimrc
|
@ -1,28 +1,30 @@
|
|||
"
|
||||
" General Setup
|
||||
"
|
||||
" $Id$
|
||||
"
|
||||
|
||||
set nocompatible " Use Vim defaults (much better!)
|
||||
set backspace=indent,eol,start " allow backspacing over everything
|
||||
set noautoindent
|
||||
set textwidth=78
|
||||
set backup
|
||||
set viminfo='20,\"50,f10
|
||||
set history=50
|
||||
set nohlsearch
|
||||
set paste
|
||||
"set paste
|
||||
|
||||
set ruler
|
||||
set cmdheight=1
|
||||
set laststatus=2
|
||||
set shiftwidth=2
|
||||
set nofoldenable
|
||||
" Following are good for python
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set smarttab
|
||||
set expandtab
|
||||
set softtabstop=4
|
||||
set autoindent
|
||||
set smartindent
|
||||
" End Python settings
|
||||
|
||||
set nofoldenable
|
||||
set background=dark
|
||||
set title
|
||||
|
||||
|
@ -50,26 +52,36 @@ colorscheme inkpot
|
|||
" """""""""
|
||||
" User Info
|
||||
" """""""""
|
||||
let g:fullname = 'Andrea Mistrali'
|
||||
let g:email = 'am@am.cx'
|
||||
|
||||
let g:shortname = 'andre'
|
||||
let g:fullname = 'Andrea Mistrali'
|
||||
let g:email = 'am@am.cx'
|
||||
|
||||
" """""""""""""""""""""""""
|
||||
" COMPLETION & INDENTATION
|
||||
" """""""""""""""""""""""""
|
||||
set completeopt=longest,menu
|
||||
" Map C-Tab to complete
|
||||
inoremap <silent> <C-tab> ^N
|
||||
|
||||
" Function that returns tab if called on an "empty" line
|
||||
" C-N elsewhere
|
||||
function! CleverTab()
|
||||
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
|
||||
return "\<Tab>"
|
||||
else
|
||||
return "\<C-N>"
|
||||
endfunction
|
||||
" map the function to Tab
|
||||
" inoremap <C-\> <C-R>=CleverTab()<CR>
|
||||
inoremap <C-\> <C-N>
|
||||
|
||||
|
||||
" 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
|
||||
" Not in python, there it is managed by GetPythonIndent
|
||||
set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
|
||||
set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
|
||||
|
||||
" Suffixes that get lower priority when doing tab completion for filenames.
|
||||
"" These are files we are not likely to want to edit or read.
|
||||
" These are files we are not likely to want to edit or read.
|
||||
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
|
||||
|
||||
|
||||
" """""""""""""""
|
||||
" TagLIST support
|
||||
" """""""""""""""
|
||||
|
@ -93,10 +105,15 @@ let NERDTreeShowBookmarks=1
|
|||
let g:bufExplorerSplitBelow=1
|
||||
let g:bufExplorerResize=1
|
||||
|
||||
" """"""""""""""
|
||||
" NERD Commenter
|
||||
" """"""""""""""
|
||||
let NERDSpaceDelims=1
|
||||
let NERDCreateDefaultMappings=1
|
||||
|
||||
" """""""""""""""""""""
|
||||
" Map keys to functions
|
||||
" """""""""""""""""""""
|
||||
" """""""""""
|
||||
" Keymappings
|
||||
" """""""""""
|
||||
let mapleader = "\\"
|
||||
"let mapleader = ","
|
||||
nnoremap <silent> <Leader>l :set list!<CR>
|
||||
|
@ -214,3 +231,9 @@ set statusline+=%02c, "cursor column
|
|||
set statusline+=%03l/%03L "cursor line/total lines
|
||||
set statusline+=\ hex:\ 0x%02B
|
||||
set statusline+=\ %P "percent through file
|
||||
|
||||
" User customizations are held in file ~/.vim/vimrc.local
|
||||
if filereadable($HOME."/.vim/vimrc.local")
|
||||
source $HOME/.vim/vimrc.local
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue