Moved statusline def into a separate file

Added guitablabel def
Updated VCS plugin
Added keymap for choosing tabs (Cmd-1, Cmd-2, ...)
This commit is contained in:
Andrea Mistrali 2010-04-28 13:03:35 +00:00
parent 5dbae34bce
commit 36e50ec66d
20 changed files with 2220 additions and 218 deletions

601
vim/colors/peaksea.vim Normal file
View File

@ -0,0 +1,601 @@
" Vim color file --- psc (peak sea color) "Lite version"
" Maintainer: Pan, Shi Zhu <Go to the following URL for my email>
" URL: http://vim.sourceforge.net/scripts/script.php?script_id=760
" Last Change: 5 Feb 2010
" Version: 3.4
"
" Comments and e-mails are welcomed, thanks.
"
" The peaksea color is simply a colorscheme with the default settings of
" the original ps_color. Lite version means there's no custom settings
" and fancy features such as integration with reloaded.vim
"
" The full version of ps_color.vim will be maintained until Vim 8.
" By then there will be only the lite version: peaksea.vim
"
" Note: Please set the background option in your .vimrc and/or .gvimrc
"
" It is much better *not* to set 'background' option inside
" a colorscheme file. because ":set background" improperly
" may cause colorscheme be sourced twice
"
" Color Scheme Overview:
" :ru syntax/hitest.vim
"
" Relevant Help:
" :h highlight-groups
" :h psc-cterm-color-table
"
" Colors Order:
" #rrggbb
"
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = expand("<sfile>:t:r")
" I don't want to abuse folding, but here folding is used to avoid confusion.
if &background=='light'
" for background=light {{{2
" LIGHT COLOR DEFINE START
hi Normal guifg=#000000 guibg=#e0e0e0 gui=NONE
hi Search guifg=NONE guibg=#f8f8f8 gui=NONE
hi Visual guifg=NONE guibg=#a6caf0 gui=NONE
hi Cursor guifg=#f0f0f0 guibg=#008000 gui=NONE
" The idea of CursorIM is pretty good, however, the feature is still buggy
" in the current version (Vim 7.0).
" The following line will be kept commented until the bug fixed.
"
" hi CursorIM guifg=#f0f0f0 guibg=#800080
hi Special guifg=#907000 guibg=NONE gui=NONE
hi Comment guifg=#606000 guibg=NONE gui=NONE
hi Number guifg=#907000 guibg=NONE gui=NONE
hi Constant guifg=#007068 guibg=NONE gui=NONE
hi StatusLine guifg=fg guibg=#a6caf0 gui=NONE
hi LineNr guifg=#686868 guibg=NONE gui=NONE
hi Question guifg=fg guibg=#d0d090 gui=NONE
hi PreProc guifg=#009030 guibg=NONE gui=NONE
hi Statement guifg=#2060a8 guibg=NONE gui=NONE
hi Type guifg=#0850a0 guibg=NONE gui=NONE
hi Todo guifg=#800000 guibg=#e0e090 gui=NONE
" NOTE THIS IS IN THE WARM SECTION
hi Error guifg=#c03000 guibg=NONE gui=NONE
hi Identifier guifg=#a030a0 guibg=NONE gui=NONE
hi ModeMsg guifg=fg guibg=#b0b0e0 gui=NONE
hi VisualNOS guifg=fg guibg=#b0b0e0 gui=NONE
hi SpecialKey guifg=#1050a0 guibg=NONE gui=NONE
hi NonText guifg=#002090 guibg=#d0d0d0 gui=NONE
hi Directory guifg=#a030a0 guibg=NONE gui=NONE
hi ErrorMsg guifg=fg guibg=#f0b090 gui=NONE
hi MoreMsg guifg=#489000 guibg=NONE gui=NONE
hi Title guifg=#a030a0 guibg=NONE gui=NONE
hi WarningMsg guifg=#b02000 guibg=NONE gui=NONE
hi WildMenu guifg=fg guibg=#d0d090 gui=NONE
hi Folded guifg=NONE guibg=#b0e0b0 gui=NONE
hi FoldColumn guifg=fg guibg=#90e090 gui=NONE
hi DiffAdd guifg=NONE guibg=#b0b0e0 gui=NONE
hi DiffChange guifg=NONE guibg=#e0b0e0 gui=NONE
hi DiffDelete guifg=#002090 guibg=#d0d0d0 gui=NONE
hi DiffText guifg=NONE guibg=#c0e080 gui=NONE
hi SignColumn guifg=fg guibg=#90e090 gui=NONE
hi IncSearch guifg=#f0f0f0 guibg=#806060 gui=NONE
hi StatusLineNC guifg=fg guibg=#c0c0c0 gui=NONE
hi VertSplit guifg=fg guibg=#c0c0c0 gui=NONE
hi Underlined guifg=#6a5acd guibg=NONE gui=underline
hi Ignore guifg=bg guibg=NONE
" NOTE THIS IS IN THE WARM SECTION
if v:version >= 700
if has('spell')
hi SpellBad guifg=NONE guibg=NONE guisp=#c03000
hi SpellCap guifg=NONE guibg=NONE guisp=#2060a8
hi SpellRare guifg=NONE guibg=NONE guisp=#a030a0
hi SpellLocal guifg=NONE guibg=NONE guisp=#007068
endif
hi Pmenu guifg=fg guibg=#e0b0e0
hi PmenuSel guifg=#f0f0f0 guibg=#806060 gui=NONE
hi PmenuSbar guifg=fg guibg=#c0c0c0 gui=NONE
hi PmenuThumb guifg=fg guibg=#c0e080 gui=NONE
hi TabLine guifg=fg guibg=#c0c0c0 gui=NONE
hi TabLineFill guifg=fg guibg=#c0c0c0 gui=NONE
hi TabLineSel guifg=fg guibg=NONE gui=NONE
hi CursorColumn guifg=NONE guibg=#f0b090
hi CursorLine guifg=NONE guibg=NONE gui=underline
hi MatchParen guifg=NONE guibg=#c0e080
endif
" LIGHT COLOR DEFINE END
" Vim 7 added stuffs
if v:version >= 700
hi Ignore gui=NONE
" the gui=undercurl guisp could only support in Vim 7
if has('spell')
hi SpellBad gui=undercurl
hi SpellCap gui=undercurl
hi SpellRare gui=undercurl
hi SpellLocal gui=undercurl
endif
hi TabLine gui=underline
hi TabLineFill gui=underline
hi CursorLine gui=underline
endif
" For reversed stuffs, clear the reversed prop and set the bold prop again
hi IncSearch gui=bold
hi StatusLine gui=bold
hi StatusLineNC gui=bold
hi VertSplit gui=bold
hi Visual gui=bold
" Enable the bold property
hi Question gui=bold
hi DiffText gui=bold
hi Statement gui=bold
hi Type gui=bold
hi MoreMsg gui=bold
hi ModeMsg gui=bold
hi NonText gui=bold
hi Title gui=bold
hi DiffDelete gui=bold
hi TabLineSel gui=bold
" gui define for background=light end here
" generally, a dumb terminal is dark, we assume the light terminal has 256
" color support.
if &t_Co==8 || &t_Co==16
set t_Co=256
endif
if &t_Co==256
" 256color light terminal support here
hi Normal ctermfg=16 ctermbg=254 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi Normal ctermfg=16 ctermbg=NONE cterm=NONE
hi Search ctermfg=NONE ctermbg=231 cterm=NONE
hi Visual ctermfg=NONE ctermbg=153 cterm=NONE
hi Cursor ctermfg=255 ctermbg=28 cterm=NONE
" hi CursorIM ctermfg=255 ctermbg=90
hi Special ctermfg=94 ctermbg=NONE cterm=NONE
hi Comment ctermfg=58 ctermbg=NONE cterm=NONE
hi Number ctermfg=94 ctermbg=NONE cterm=NONE
hi Constant ctermfg=23 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=fg ctermbg=153 cterm=NONE
hi LineNr ctermfg=242 ctermbg=NONE cterm=NONE
hi Question ctermfg=fg ctermbg=186 cterm=NONE
hi PreProc ctermfg=29 ctermbg=NONE cterm=NONE
hi Statement ctermfg=25 ctermbg=NONE cterm=NONE
hi Type ctermfg=25 ctermbg=NONE cterm=NONE
hi Todo ctermfg=88 ctermbg=186 cterm=NONE
" NOTE THIS IS IN THE WARM SECTION
hi Error ctermfg=130 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=133 ctermbg=NONE cterm=NONE
hi ModeMsg ctermfg=fg ctermbg=146 cterm=NONE
hi VisualNOS ctermfg=fg ctermbg=146 cterm=NONE
hi SpecialKey ctermfg=25 ctermbg=NONE cterm=NONE
hi NonText ctermfg=18 ctermbg=252 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi NonText ctermfg=18 ctermbg=NONE cterm=NONE
hi Directory ctermfg=133 ctermbg=NONE cterm=NONE
hi ErrorMsg ctermfg=fg ctermbg=216 cterm=NONE
hi MoreMsg ctermfg=64 ctermbg=NONE cterm=NONE
hi Title ctermfg=133 ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=124 ctermbg=NONE cterm=NONE
hi WildMenu ctermfg=fg ctermbg=186 cterm=NONE
hi Folded ctermfg=NONE ctermbg=151 cterm=NONE
hi FoldColumn ctermfg=fg ctermbg=114 cterm=NONE
hi DiffAdd ctermfg=NONE ctermbg=146 cterm=NONE
hi DiffChange ctermfg=NONE ctermbg=182 cterm=NONE
hi DiffDelete ctermfg=18 ctermbg=252 cterm=NONE
hi DiffText ctermfg=NONE ctermbg=150 cterm=NONE
hi SignColumn ctermfg=fg ctermbg=114 cterm=NONE
hi IncSearch ctermfg=255 ctermbg=95 cterm=NONE
hi StatusLineNC ctermfg=fg ctermbg=250 cterm=NONE
hi VertSplit ctermfg=fg ctermbg=250 cterm=NONE
hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
hi Ignore ctermfg=bg ctermbg=NONE
" NOTE THIS IS IN THE WARM SECTION
if v:version >= 700
if has('spell')
if 0
" ctermsp is not supported in Vim7, we ignore it.
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=130
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=25
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=133
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=23
else
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE
endif
endif
hi Pmenu ctermfg=fg ctermbg=182
hi PmenuSel ctermfg=255 ctermbg=95 cterm=NONE
hi PmenuSbar ctermfg=fg ctermbg=250 cterm=NONE
hi PmenuThumb ctermfg=fg ctermbg=150 cterm=NONE
hi TabLine ctermfg=fg ctermbg=250 cterm=NONE
hi TabLineFill ctermfg=fg ctermbg=250 cterm=NONE
hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=216
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi MatchParen ctermfg=NONE ctermbg=150
endif
hi TabLine cterm=underline
hi TabLineFill cterm=underline
hi CursorLine cterm=underline
" For reversed stuffs, clear the reversed prop and set the bold prop again
hi IncSearch cterm=bold
hi StatusLine cterm=bold
hi StatusLineNC cterm=bold
hi VertSplit cterm=bold
hi Visual cterm=bold
hi NonText cterm=bold
hi Question cterm=bold
hi Title cterm=bold
hi DiffDelete cterm=bold
hi DiffText cterm=bold
hi Statement cterm=bold
hi Type cterm=bold
hi MoreMsg cterm=bold
hi ModeMsg cterm=bold
hi TabLineSel cterm=bold
"hi lCursor ctermfg=bg ctermbg=fg cterm=NONE
endif " t_Co==256
" }}}2
elseif &background=='dark'
" for background=dark {{{2
" DARK COLOR DEFINE START
hi Normal guifg=#d0d0d0 guibg=#202020 gui=NONE
hi Comment guifg=#d0d090 guibg=NONE gui=NONE
hi Constant guifg=#80c0e0 guibg=NONE gui=NONE
hi Number guifg=#e0c060 guibg=NONE gui=NONE
hi Identifier guifg=#f0c0f0 guibg=NONE gui=NONE
hi Statement guifg=#c0d8f8 guibg=NONE gui=NONE
hi PreProc guifg=#60f080 guibg=NONE gui=NONE
hi Type guifg=#b0d0f0 guibg=NONE gui=NONE
hi Special guifg=#e0c060 guibg=NONE gui=NONE
hi Error guifg=#f08060 guibg=NONE gui=NONE
hi Todo guifg=#800000 guibg=#d0d090 gui=NONE
hi Search guifg=NONE guibg=#800000 gui=NONE
hi Visual guifg=#000000 guibg=#a6caf0 gui=NONE
hi Cursor guifg=#000000 guibg=#00f000 gui=NONE
" NOTE THIS IS IN THE COOL SECTION
" hi CursorIM guifg=#000000 guibg=#f000f0 gui=NONE
hi StatusLine guifg=#000000 guibg=#a6caf0 gui=NONE
hi LineNr guifg=#b0b0b0 guibg=NONE gui=NONE
hi Question guifg=#000000 guibg=#d0d090 gui=NONE
hi ModeMsg guifg=fg guibg=#000080 gui=NONE
hi VisualNOS guifg=fg guibg=#000080 gui=NONE
hi SpecialKey guifg=#b0d0f0 guibg=NONE gui=NONE
hi NonText guifg=#6080f0 guibg=#101010 gui=NONE
hi Directory guifg=#80c0e0 guibg=NONE gui=NONE
hi ErrorMsg guifg=#d0d090 guibg=#800000 gui=NONE
hi MoreMsg guifg=#c0e080 guibg=NONE gui=NONE
hi Title guifg=#f0c0f0 guibg=NONE gui=NONE
hi WarningMsg guifg=#f08060 guibg=NONE gui=NONE
hi WildMenu guifg=#000000 guibg=#d0d090 gui=NONE
hi Folded guifg=NONE guibg=#004000 gui=NONE
hi FoldColumn guifg=#e0e0e0 guibg=#008000 gui=NONE
hi DiffAdd guifg=NONE guibg=#000080 gui=NONE
hi DiffChange guifg=NONE guibg=#800080 gui=NONE
hi DiffDelete guifg=#6080f0 guibg=#202020 gui=NONE
hi DiffText guifg=#000000 guibg=#c0e080 gui=NONE
hi SignColumn guifg=#e0e0e0 guibg=#008000 gui=NONE
hi IncSearch guifg=#000000 guibg=#d0d0d0 gui=NONE
hi StatusLineNC guifg=#000000 guibg=#c0c0c0 gui=NONE
hi VertSplit guifg=#000000 guibg=#c0c0c0 gui=NONE
hi Underlined guifg=#80a0ff guibg=NONE gui=underline
hi Ignore guifg=#000000 guibg=NONE
" NOTE THIS IS IN THE COOL SECTION
if v:version >= 700
if has('spell')
" the guisp= could only support in Vim 7
hi SpellBad guifg=NONE guibg=NONE guisp=#f08060
hi SpellCap guifg=NONE guibg=NONE guisp=#6080f0
hi SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0
hi SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8
endif
hi Pmenu guifg=fg guibg=#800080
hi PmenuSel guifg=#000000 guibg=#d0d0d0 gui=NONE
hi PmenuSbar guifg=fg guibg=#000080 gui=NONE
hi PmenuThumb guifg=fg guibg=#008000 gui=NONE
hi TabLine guifg=fg guibg=#008000 gui=NONE
hi TabLineFill guifg=fg guibg=#008000 gui=NONE
hi TabLineSel guifg=fg guibg=NONE gui=NONE
hi CursorColumn guifg=NONE guibg=#800000 gui=NONE
hi CursorLine guifg=NONE guibg=NONE gui=underline
hi MatchParen guifg=NONE guibg=#800080
endif
" DARK COLOR DEFINE END
" Vim 7 added stuffs
if v:version >= 700
hi Ignore gui=NONE
" the gui=undercurl could only support in Vim 7
if has('spell')
hi SpellBad gui=undercurl
hi SpellCap gui=undercurl
hi SpellRare gui=undercurl
hi SpellLocal gui=undercurl
endif
hi TabLine gui=underline
hi TabLineFill gui=underline
hi Underlined gui=underline
hi CursorLine gui=underline
endif
" gui define for background=dark end here
if &t_Co==8 || &t_Co==16
" for 8-color and 16-color term
hi Normal ctermfg=LightGrey ctermbg=Black
hi Special ctermfg=Yellow ctermbg=bg
hi Comment ctermfg=DarkYellow ctermbg=bg
hi Constant ctermfg=Blue ctermbg=bg
hi Number ctermfg=Yellow ctermbg=bg
hi LineNr ctermfg=DarkGrey ctermbg=bg
hi PreProc ctermfg=Green ctermbg=bg
hi Statement ctermfg=Cyan ctermbg=bg
hi Type ctermfg=Cyan ctermbg=bg
hi Error ctermfg=Red ctermbg=bg
hi Identifier ctermfg=Magenta ctermbg=bg
hi SpecialKey ctermfg=Cyan ctermbg=bg
hi NonText ctermfg=Blue ctermbg=bg
hi Directory ctermfg=Blue ctermbg=bg
hi MoreMsg ctermfg=Green ctermbg=bg
hi Title ctermfg=Magenta ctermbg=bg
hi WarningMsg ctermfg=Red ctermbg=bg
hi DiffDelete ctermfg=Blue ctermbg=bg
hi Search ctermfg=NONE ctermbg=DarkRed
hi Visual ctermfg=Black ctermbg=DarkCyan
hi Cursor ctermfg=Black ctermbg=Green
hi StatusLine ctermfg=Black ctermbg=DarkCyan
hi Question ctermfg=Black ctermbg=DarkYellow
hi Todo ctermfg=DarkRed ctermbg=DarkYellow
hi Folded ctermfg=White ctermbg=DarkGreen
hi ModeMsg ctermfg=Grey ctermbg=DarkBlue
hi VisualNOS ctermfg=Grey ctermbg=DarkBlue
hi ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed
hi WildMenu ctermfg=Black ctermbg=DarkYellow
hi FoldColumn ctermfg=White ctermbg=DarkGreen
hi SignColumn ctermfg=White ctermbg=DarkGreen
hi DiffText ctermfg=Black ctermbg=DarkYellow
if v:version >= 700
if has('spell')
hi SpellBad ctermfg=NONE ctermbg=DarkRed
hi SpellCap ctermfg=NONE ctermbg=DarkBlue
hi SpellRare ctermfg=NONE ctermbg=DarkMagenta
hi SpellLocal ctermfg=NONE ctermbg=DarkGreen
endif
hi Pmenu ctermfg=fg ctermbg=DarkMagenta
hi PmenuSel ctermfg=Black ctermbg=fg
hi PmenuSbar ctermfg=fg ctermbg=DarkBlue
hi PmenuThumb ctermfg=fg ctermbg=DarkGreen
hi TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline
hi TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline
hi CursorColumn ctermfg=NONE ctermbg=DarkRed
hi TabLineSel ctermfg=fg ctermbg=bg
hi CursorLine ctermfg=NONE ctermbg=bg cterm=underline
hi MatchParen ctermfg=NONE ctermbg=DarkMagenta
endif
if &t_Co==8
" 8 colour terminal support, this assumes 16 colour is available through
" setting the 'bold' attribute, will get bright foreground colour.
" However, the bright background color is not available for 8-color terms.
"
" You can manually set t_Co=16 in your .vimrc to see if your terminal
" supports 16 colours,
hi DiffText cterm=none
hi Visual cterm=none
hi Cursor cterm=none
hi Comment cterm=none
hi Todo cterm=none
hi StatusLine cterm=none
hi Question cterm=none
hi DiffChange cterm=none
hi ModeMsg cterm=none
hi VisualNOS cterm=none
hi ErrorMsg cterm=none
hi WildMenu cterm=none
hi DiffAdd cterm=none
hi Folded cterm=none
hi DiffDelete cterm=none
hi Normal cterm=none
hi PmenuThumb cterm=none
hi Search cterm=bold
hi Special cterm=bold
hi Constant cterm=bold
hi Number cterm=bold
hi LineNr cterm=bold
hi PreProc cterm=bold
hi Statement cterm=bold
hi Type cterm=bold
hi Error cterm=bold
hi Identifier cterm=bold
hi SpecialKey cterm=bold
hi NonText cterm=bold
hi MoreMsg cterm=bold
hi Title cterm=bold
hi WarningMsg cterm=bold
hi FoldColumn cterm=bold
hi SignColumn cterm=bold
hi Directory cterm=bold
hi DiffDelete cterm=bold
else
" Background > 7 is only available with 16 or more colors
hi WarningMsg cterm=none
hi Search cterm=none
hi Visual cterm=none
hi Cursor cterm=none
hi Special cterm=none
hi Comment cterm=none
hi Constant cterm=none
hi Number cterm=none
hi LineNr cterm=none
hi PreProc cterm=none
hi Todo cterm=none
hi Error cterm=none
hi Identifier cterm=none
hi Folded cterm=none
hi SpecialKey cterm=none
hi Directory cterm=none
hi ErrorMsg cterm=none
hi Normal cterm=none
hi PmenuThumb cterm=none
hi WildMenu cterm=none
hi FoldColumn cterm=none
hi SignColumn cterm=none
hi DiffAdd cterm=none
hi DiffChange cterm=none
hi Question cterm=none
hi StatusLine cterm=none
hi DiffText cterm=none
hi IncSearch cterm=reverse
hi StatusLineNC cterm=reverse
hi VertSplit cterm=reverse
" Well, well, bold font with color 0-7 is not possible.
" So, the Question, StatusLine, DiffText cannot act as expected.
hi Statement cterm=none
hi Type cterm=none
hi MoreMsg cterm=none
hi ModeMsg cterm=none
hi NonText cterm=none
hi Title cterm=none
hi VisualNOS cterm=none
hi DiffDelete cterm=none
hi TabLineSel cterm=none
endif
elseif &t_Co==256
" 256color dark terminal support here
hi Normal ctermfg=252 ctermbg=234 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi Normal ctermfg=252 ctermbg=NONE cterm=NONE
hi Comment ctermfg=186 ctermbg=NONE cterm=NONE
hi Constant ctermfg=110 ctermbg=NONE cterm=NONE
hi Number ctermfg=179 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=219 ctermbg=NONE cterm=NONE
hi Statement ctermfg=153 ctermbg=NONE cterm=NONE
hi PreProc ctermfg=84 ctermbg=NONE cterm=NONE
hi Type ctermfg=153 ctermbg=NONE cterm=NONE
hi Special ctermfg=179 ctermbg=NONE cterm=NONE
hi Error ctermfg=209 ctermbg=NONE cterm=NONE
hi Todo ctermfg=88 ctermbg=186 cterm=NONE
hi Search ctermfg=NONE ctermbg=88 cterm=NONE
hi Visual ctermfg=16 ctermbg=153 cterm=NONE
hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
" NOTE THIS IS IN THE COOL SECTION
" hi CursorIM ctermfg=16 ctermbg=201 cterm=NONE
hi StatusLine ctermfg=16 ctermbg=153 cterm=NONE
hi LineNr ctermfg=249 ctermbg=NONE cterm=NONE
hi Question ctermfg=16 ctermbg=186 cterm=NONE
hi ModeMsg ctermfg=fg ctermbg=18 cterm=NONE
hi VisualNOS ctermfg=fg ctermbg=18 cterm=NONE
hi SpecialKey ctermfg=153 ctermbg=NONE cterm=NONE
hi NonText ctermfg=69 ctermbg=233 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi NonText ctermfg=69 ctermbg=NONE cterm=NONE
hi Directory ctermfg=110 ctermbg=NONE cterm=NONE
hi ErrorMsg ctermfg=186 ctermbg=88 cterm=NONE
hi MoreMsg ctermfg=150 ctermbg=NONE cterm=NONE
hi Title ctermfg=219 ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=209 ctermbg=NONE cterm=NONE
hi WildMenu ctermfg=16 ctermbg=186 cterm=NONE
hi Folded ctermfg=NONE ctermbg=22 cterm=NONE
hi FoldColumn ctermfg=254 ctermbg=28 cterm=NONE
hi DiffAdd ctermfg=NONE ctermbg=18 cterm=NONE
hi DiffChange ctermfg=NONE ctermbg=90 cterm=NONE
hi DiffDelete ctermfg=69 ctermbg=234 cterm=NONE
hi DiffText ctermfg=16 ctermbg=150 cterm=NONE
hi SignColumn ctermfg=254 ctermbg=28 cterm=NONE
hi IncSearch ctermfg=16 ctermbg=252 cterm=NONE
hi StatusLineNC ctermfg=16 ctermbg=250 cterm=NONE
hi VertSplit ctermfg=16 ctermbg=250 cterm=NONE
hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
hi Ignore ctermfg=16 ctermbg=NONE
" NOTE THIS IS IN THE COOL SECTION
if v:version >= 700
if has('spell')
" the ctermsp= is not supported in Vim 7 we simply ignored
if 0
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=209
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=69
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=219
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=153
else
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE
endif
endif
hi Pmenu ctermfg=fg ctermbg=90
hi PmenuSel ctermfg=16 ctermbg=252 cterm=NONE
hi PmenuSbar ctermfg=fg ctermbg=18 cterm=NONE
hi PmenuThumb ctermfg=fg ctermbg=28 cterm=NONE
hi TabLine ctermfg=fg ctermbg=28 cterm=NONE
hi TabLineFill ctermfg=fg ctermbg=28 cterm=NONE
hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=88 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi MatchParen ctermfg=NONE ctermbg=90
hi TabLine cterm=underline
hi TabLineFill cterm=underline
hi Underlined cterm=underline
hi CursorLine cterm=underline
endif
endif " t_Co
" }}}2
endif
" Links:
"
" COLOR LINKS DEFINE START
hi link String Constant
" Character must be different from strings because in many languages
" (especially C, C++) a 'char' variable is scalar while 'string' is pointer,
" mistaken a 'char' for a 'string' will cause disaster!
hi link Character Number
hi link SpecialChar LineNr
hi link Tag Identifier
hi link cCppOut LineNr
" The following are not standard hi links,
" these are used by DrChip
hi link Warning MoreMsg
hi link Notice Constant
" these are used by Calendar
hi link CalToday PreProc
" these are used by TagList
hi link MyTagListTagName IncSearch
hi link MyTagListTagScope Constant
" COLOR LINKS DEFINE END
" vim:et:nosta:sw=2:ts=8:
" vim600:fdm=marker:fdl=1:

51
vim/colors/wombat.vim Normal file
View File

@ -0,0 +1,51 @@
" Maintainer: Lars H. Nielsen (dengmao@gmail.com)
" Last Change: January 22 2007
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "wombat"
" Vim >= 7.0 specific colors
if version >= 700
hi CursorLine guibg=#2d2d2d
hi CursorColumn guibg=#2d2d2d
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold
hi Pmenu guifg=#f6f3e8 guibg=#444444
hi PmenuSel guifg=#000000 guibg=#cae682
endif
" General colors
hi Cursor guifg=NONE guibg=#656565 gui=none
hi Normal guifg=#f6f3e8 guibg=#242424 gui=none
hi NonText guifg=#808080 guibg=#303030 gui=none
hi LineNr guifg=#857b6f guibg=#000000 gui=none
hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic
hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none
hi VertSplit guifg=#444444 guibg=#444444 gui=none
hi Folded guibg=#384048 guifg=#a0a8b0 gui=none
hi Title guifg=#f6f3e8 guibg=NONE gui=bold
hi Visual guifg=#f6f3e8 guibg=#444444 gui=none
hi SpecialKey guifg=#808080 guibg=#343434 gui=none
" Syntax highlighting
hi Comment guifg=#99968b gui=italic
hi Todo guifg=#8f8f8f gui=italic
hi Constant guifg=#e5786d gui=none
hi String guifg=#95e454 gui=italic
hi Identifier guifg=#cae682 gui=none
hi Function guifg=#cae682 gui=none
hi Type guifg=#cae682 gui=none
hi Statement guifg=#8ac6f2 gui=none
hi Keyword guifg=#8ac6f2 gui=none
hi PreProc guifg=#e5786d gui=none
hi Number guifg=#e5786d gui=none
hi Special guifg=#e7f6da gui=none

302
vim/colors/wombat256.vim Normal file
View File

@ -0,0 +1,302 @@
" Vim color file
" Maintainer: David Liang (bmdavll at gmail dot com)
" Last Change: November 28 2008
"
" wombat256.vim - a modified version of Wombat by Lars Nielsen that also
" works on xterms with 88 or 256 colors. The algorithm for approximating the
" GUI colors with the xterm palette is from desert256.vim by Henry So Jr.
set background=dark
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
let g:colors_name = "wombat256"
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
finish
endif
" functions {{{
" returns an approximate grey index for the given grey level
fun <SID>grey_number(x)
if &t_Co == 88
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
elseif a:x < 127
return 3
elseif a:x < 150
return 4
elseif a:x < 173
return 5
elseif a:x < 196
return 6
elseif a:x < 219
return 7
elseif a:x < 243
return 8
else
return 9
endif
else
if a:x < 14
return 0
else
let l:n = (a:x - 8) / 10
let l:m = (a:x - 8) % 10
if l:m < 5
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" returns the actual grey level represented by the grey index
fun <SID>grey_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 46
elseif a:n == 2
return 92
elseif a:n == 3
return 115
elseif a:n == 4
return 139
elseif a:n == 5
return 162
elseif a:n == 6
return 185
elseif a:n == 7
return 208
elseif a:n == 8
return 231
else
return 255
endif
else
if a:n == 0
return 0
else
return 8 + (a:n * 10)
endif
endif
endfun
" returns the palette index for the given grey index
fun <SID>grey_color(n)
if &t_Co == 88
if a:n == 0
return 16
elseif a:n == 9
return 79
else
return 79 + a:n
endif
else
if a:n == 0
return 16
elseif a:n == 25
return 231
else
return 231 + a:n
endif
endif
endfun
" returns an approximate color index for the given color level
fun <SID>rgb_number(x)
if &t_Co == 88
if a:x < 69
return 0
elseif a:x < 172
return 1
elseif a:x < 230
return 2
else
return 3
endif
else
if a:x < 75
return 0
else
let l:n = (a:x - 55) / 40
let l:m = (a:x - 55) % 40
if l:m < 20
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" returns the actual color level for the given color index
fun <SID>rgb_level(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 139
elseif a:n == 2
return 205
else
return 255
endif
else
if a:n == 0
return 0
else
return 55 + (a:n * 40)
endif
endif
endfun
" returns the palette index for the given R/G/B color indices
fun <SID>rgb_color(x, y, z)
if &t_Co == 88
return 16 + (a:x * 16) + (a:y * 4) + a:z
else
return 16 + (a:x * 36) + (a:y * 6) + a:z
endif
endfun
" returns the palette index to approximate the given R/G/B color levels
fun <SID>color(r, g, b)
" get the closest grey
let l:gx = <SID>grey_number(a:r)
let l:gy = <SID>grey_number(a:g)
let l:gz = <SID>grey_number(a:b)
" get the closest color
let l:x = <SID>rgb_number(a:r)
let l:y = <SID>rgb_number(a:g)
let l:z = <SID>rgb_number(a:b)
if l:gx == l:gy && l:gy == l:gz
" there are two possibilities
let l:dgr = <SID>grey_level(l:gx) - a:r
let l:dgg = <SID>grey_level(l:gy) - a:g
let l:dgb = <SID>grey_level(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = <SID>rgb_level(l:gx) - a:r
let l:dg = <SID>rgb_level(l:gy) - a:g
let l:db = <SID>rgb_level(l:gz) - a:b
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
if l:dgrey < l:drgb
" use the grey
return <SID>grey_color(l:gx)
else
" use the color
return <SID>rgb_color(l:x, l:y, l:z)
endif
else
" only one possibility
return <SID>rgb_color(l:x, l:y, l:z)
endif
endfun
" returns the palette index to approximate the 'rrggbb' hex string
fun <SID>rgb(rgb)
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return <SID>color(l:r, l:g, l:b)
endfun
" sets the highlighting for the given group
fun <SID>X(group, fg, bg, attr)
if a:fg != ""
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
endif
if a:bg != ""
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>rgb(a:bg)
endif
if a:attr != ""
if a:attr == 'italic'
exec "hi ".a:group." gui=".a:attr." cterm=none"
else
exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
endif
endif
endfun
" }}}
call <SID>X("Normal", "cccccc", "242424", "none")
call <SID>X("Cursor", "222222", "ecee90", "none")
call <SID>X("CursorLine", "", "32322e", "none")
call <SID>X("CursorColumn", "", "2d2d2d", "")
"CursorIM
"Question
"IncSearch
call <SID>X("Search", "444444", "af87d7", "")
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
call <SID>X("Visual", "ecee90", "597418", "none")
call <SID>X("LineNr", "857b6f", "121212", "none")
call <SID>X("Folded", "a0a8b0", "404048", "none")
call <SID>X("Title", "f6f3e8", "", "bold")
call <SID>X("VertSplit", "444444", "444444", "none")
call <SID>X("StatusLine", "f6f3e8", "444444", "italic")
call <SID>X("StatusLineNC", "857b6f", "444444", "none")
"Scrollbar
"Tooltip
"Menu
"WildMenu
call <SID>X("Pmenu", "f6f3e8", "444444", "")
call <SID>X("PmenuSel", "121212", "caeb82", "")
call <SID>X("WarningMsg", "ff0000", "", "")
"ErrorMsg
"ModeMsg
"MoreMsg
"Directory
"DiffAdd
"DiffChange
"DiffDelete
"DiffText
" syntax highlighting
call <SID>X("Number", "e5786d", "", "none")
call <SID>X("Constant", "e5786d", "", "none")
call <SID>X("String", "95e454", "", "italic")
call <SID>X("Comment", "c0bc6c", "", "italic")
call <SID>X("Identifier", "caeb82", "", "none")
call <SID>X("Keyword", "87afff", "", "none")
call <SID>X("Statement", "87afff", "", "none")
call <SID>X("Function", "caeb82", "", "none")
call <SID>X("PreProc", "e5786d", "", "none")
call <SID>X("Type", "caeb82", "", "none")
call <SID>X("Special", "ffdead", "", "none")
call <SID>X("Todo", "857b6f", "", "italic")
"Underlined
"Error
"Ignore
hi! link VisualNOS Visual
hi! link NonText LineNr
hi! link FoldColumn Folded
" delete functions {{{
delf <SID>X
delf <SID>rgb
delf <SID>color
delf <SID>rgb_color
delf <SID>rgb_level
delf <SID>rgb_number
delf <SID>grey_color
delf <SID>grey_level
delf <SID>grey_number
" }}}
" vim:set ts=4 sw=4 noet fdm=marker:

71
vim/doc/open_terminal.txt Normal file
View File

@ -0,0 +1,71 @@
*open-terminal* Open Terminal, Filemanager for various platform
Open Terminal Help File
Introduction |open-terminal-introduction|
Commmands |open-terminal-commands|
Requires |open-terminal-requires|
Key map examples |open-terminal-keymap|
Changelog |open-terminal-changelog|
About |open-terminal-about|
==============================================================================
Introduction *open-terminal-introduction*
Some vim user want to shell like emacs's eshell. But vim don't support shell,
terminal interface in vim (at least 7.x version).
In this situation, I use native terminal software open script for my various
working platforms.
==============================================================================
Commmands *open-terminal-commands*
*OpenTerminal*
:OpenTerminal Open native terminal sw. Check |requires| list
*OpenFilemanager*
:OpenFilemanager Open native file manager. Check |requires| list
==============================================================================
Map key examples *open-terminal-keymap*
>
nnoremap <silent> <F9> :OpenTerminal<CR>
nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
<
==============================================================================
Requires (per platform) *open-terminal-requires*
I use Mac, Gnome, Windows(gvim). I don't test in KDE environment.
Platform Terminal File manager ~
>
Mac Terminal.app Finder
(with Applescript)
Gnome gnome-terminal nautilus
KDE konsole konqueror
Windows cmd explorer
(with start)
cygwin bash explorer
<
==============================================================================
Changelog *open-terminal-changelog*
0.1:
- First release used script for everyone.
==============================================================================
About *open-terminal-about*
Copyright (c) 2009 by neocoin ~
File: open_terminal.vim
Author: Sangmin Ryu (neocoin@gmail.com)
Date: Tue Dec 22 13:33:32 PST 2009
License: The MIT License
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -57,10 +57,6 @@
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
'loaded_nerd_comments' NERD_commenter.txt /*'loaded_nerd_comments'*
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
:AlignCenter textformat.txt /*:AlignCenter*
:AlignJustify textformat.txt /*:AlignJustify*
:AlignLeft textformat.txt /*:AlignLeft*
:AlignRight textformat.txt /*:AlignRight*
:CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors*
:CVSUnedit vcscommand.txt /*:CVSUnedit*
@ -193,6 +189,8 @@ NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
NERD_commenter.txt NERD_commenter.txt /*NERD_commenter.txt*
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
OpenFilemanager open_terminal.txt /*OpenFilemanager*
OpenTerminal open_terminal.txt /*OpenTerminal*
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
@ -242,6 +240,13 @@ g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*
open-terminal open_terminal.txt /*open-terminal*
open-terminal-about open_terminal.txt /*open-terminal-about*
open-terminal-changelog open_terminal.txt /*open-terminal-changelog*
open-terminal-commands open_terminal.txt /*open-terminal-commands*
open-terminal-introduction open_terminal.txt /*open-terminal-introduction*
open-terminal-keymap open_terminal.txt /*open-terminal-keymap*
open-terminal-requires open_terminal.txt /*open-terminal-requires*
taglist-commands taglist.txt /*taglist-commands*
taglist-debug taglist.txt /*taglist-debug*
taglist-extend taglist.txt /*taglist-extend*
@ -259,12 +264,6 @@ taglist-session taglist.txt /*taglist-session*
taglist-todo taglist.txt /*taglist-todo*
taglist-using taglist.txt /*taglist-using*
taglist.txt taglist.txt /*taglist.txt*
textformat-commands textformat.txt /*textformat-commands*
textformat-config textformat.txt /*textformat-config*
textformat-history textformat.txt /*textformat-history*
textformat-keymap textformat.txt /*textformat-keymap*
textformat-start textformat.txt /*textformat-start*
textformat.txt textformat.txt /*textformat.txt*
vcscommand vcscommand.txt /*vcscommand*
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*

View File

@ -81,7 +81,7 @@ 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>
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
@ -131,7 +131,7 @@ 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*
: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
@ -140,16 +140,20 @@ it uses the most recent version of the file (on the current branch, if under
CVS control). Additionally, if the current buffer is a VCSAnnotate buffer
already, the version number on the current line is used.
If '!' is used, the view of the annotated buffer is split so that the
annotation is in a separate window from the content, and each is highlighted
separately.
For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
will cause the above behavior to change. Instead of annotating the version on
the current line, the parent revision is used instead, crossing branches if
necessary.
The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate',
'SVNAnnotate', or 'SVKAnnotate' as appropriate, to take advantage of the
'SVNAnnotate', 'SVKAnnotate' or 'gitAnnotate' as appropriate, to take advantage of the
bundled syntax files.
:VCSBlame *:VCSBlame*
:VCSBlame[!] *:VCSBlame*
Alias for |:VCSAnnotate|.
@ -168,9 +172,10 @@ 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.
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
buffer in Normal mode to immediately commit. This is useful if the
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
commit-on-write behavior.
:VCSDelete *:VCSDelete*
@ -325,32 +330,33 @@ This command performs "cvs watchers" on the current file.
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
|<Leader>|ca VCSAdd
|<Leader>|cn VCSAnnotate
|<Leader>|cN VCSAnnotate!
|<Leader>|cc VCSCommit
|<Leader>|cD VCSDelete
|<Leader>|cd VCSDiff
|<Leader>|cg VCSGotoOriginal
|<Leader>|cG VCSGotoOriginal!
|<Leader>|ci VCSInfo
|<Leader>|cl VCSLog
|<Leader>|cL VCSLock
|<Leader>|cr VCSReview
|<Leader>|cs VCSStatus
|<Leader>|cu VCSUpdate
|<Leader>|cU VCSUnlock
|<Leader>|cv VCSVimDiff
Only for CVS buffers:
<Leader>ce CVSEdit
<Leader>cE CVSEditors
<Leader>ct CVSUnedit
<Leader>cwv CVSWatchers
<Leader>cwa CVSWatchAdd
<Leader>cwn CVSWatchOn
<Leader>cwf CVSWatchOff
<Leader>cwf CVSWatchRemove
|<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*

View File

@ -11,6 +11,9 @@ set errorbells
set visualbell
set showtabline=2
set guicursor=a:blinkon0
set showtabline=2
set guitablabel=%!GuiTabLabel()
set guitabtooltip=%!GuiTabToolTip()
set fuoptions=maxvert,maxhorz
set guioptions-=T
@ -21,11 +24,11 @@ if &background == "dark"
endif
" colorscheme zenburn
" colorscheme freya
colorscheme freya
" colorscheme moria
" colorscheme morning
" colorscheme desert
colorscheme macvim
" colorscheme macvim
" colorscheme inkpot
" Emacs like indenting. Pressing Tab indents line

View File

@ -0,0 +1,108 @@
"
" File: open_terminal.vim
"
" Requires:
" platform Terminal File manager
" Mac Terminal.app Finder
" (with Applescript)
" Gnome gnome-terminal nautilus
" KDE konsole konqueror
" Windows cmd explorer
" (with start)
" cygwin bash explorer
"
" Example:
" nnoremap <silent> <F9> :OpenTerminal<CR>
" nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
"
" Commands:
" OpenTerminal
" OpenFilemanager
"
" OpenTerminal {{{1
function! s:open_terminal()
let l:current_dir = getcwd()
execute("chdir " . escape(expand("%:p:h"), " \"'"))
if has("mac")
let l:cmd = "
\ tell application 'System Events' \n
\ set is_term_running to exists application process '$Terminal' \n
\ end tell \n
\
\ set cmd to 'cd $current_path' \n
\ tell application '$Terminal' \n
\ activate \n
\ if is_term_running is true then \n
\ do script with command cmd \n
\ else \n
\ do script with command cmd in window 1 \n
\ end if \n
\ end tell \n
\ "
let l:cmd = substitute(l:cmd, "'", '\\"', 'g')
let l:cmd = substitute( l:cmd, "$Terminal", "Terminal", "g" )
let l:cmd = substitute( l:cmd, "$current_path", "'" . expand("%:p:h") . "'" , "g")
call system('osascript -e " ' . l:cmd . '"')
elseif has("gui_gnome") && executable("gnome-terminal")
call system("gnome-terminal &")
elseif has("gui_gnome") && executable("konsole")
call system("konsole &")
elseif has("gui_win32")
try
call system("start cmd")
catch /E484:/
echo "Ignore E484 error in Windows platform"
endtry
elseif executable("bash")
!bash
elseif has("win32")
stop
endif
execute("chdir " . escape(l:current_dir, " \"'"))
endfunction
command! -nargs=0 -bar OpenTerminal call s:open_terminal()
"}}}1
" OpenFilemanager {{{1
function! s:open_filemanager()
let l:cmd = "$cmd ."
let l:current_dir = getcwd()
execute("chdir " . escape(expand("%:p:h"), " \"'"))
if has("mac")
call system("open .")
elseif has("gui_gnome") && executable("nautilus")
call system("nautilus .")
elseif has("gui_gnome") && executable("konqueror")
call system("konqueror .")
elseif has("gui_win32") || has("win32")
call system("explorer .")
elseif executable("bash")
!bash
endif
execute("chdir " . escape(l:current_dir, " \"'"))
endfunction
command! -nargs=0 -bar OpenFilemanager call s:open_filemanager()
" }}}1
" About file info {{{1
"=============================================================================
" Copyright (c) 2009 by neocoin
" File: open_terminal.vim
" Author: Sangmin Ryu (neocoin@gmail.com)
" Date: Tue Dec 22 13:33:32 PST 2009
" License: The MIT License
" Version: 0.1
"=============================================================================
" }}}1
" vim: set fdm=marker:

91
vim/plugin/statusline.vim Normal file
View File

@ -0,0 +1,91 @@
" """"""""""""
" Status Line
" """"""""""""
" Some useful functions
"return the syntax highlight group under the cursor ''
function! StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'),1),'name')
if name == ''
return ''
else
return '[' . name . ']'
endif
endfunction
"recalculate the tab warning flag when idle and after writing
autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning
"
"return '[&et]' if &et is set wrong
"return '[mixed-indenting]' if spaces and tabs are used to indent
"return an empty string if everything is fine
function! StatuslineTabWarning()
if !exists("b:statusline_tab_warning")
let tabs = search('^\t', 'nw') != 0
let spaces = search('^ ', 'nw') != 0
if tabs && spaces
let b:statusline_tab_warning = '[mixed-indenting]'
elseif (spaces && !&et) || (tabs && &et)
let b:statusline_tab_warning = '[&et]'
else
let b:statusline_tab_warning = ''
endif
endif
return b:statusline_tab_warning
endfunction
"recalculate the trailing whitespace warning when idle, and after saving
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
"return '[\s]' if trailing white space is detected
"return '' otherwise
function! StatuslineTrailingSpaceWarning()
if !exists("b:statusline_trailing_space_warning")
if search('\s\+$', 'nw') != 0
let b:statusline_trailing_space_warning = '[\s]'
else
let b:statusline_trailing_space_warning = ''
endif
endif
return b:statusline_trailing_space_warning
endfunction
" Real Status line definition
set statusline=%t\ "tail of the filename
"display a warning if fileformat isnt unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*
"display a warning if file encoding isnt utf-8
set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*
set statusline+=%h "help file flag
set statusline+=%y "filetype
set statusline+=%r "read only flag
set statusline+=%m "modified flag
"display a warning if &et is wrong, or we have mixed-indenting
set statusline+=%#error#
set statusline+=%{StatuslineTabWarning()}
set statusline+=%*
set statusline+=%{StatuslineTrailingSpaceWarning()}
"display a warning if &paste is set
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':'[nopaste]'}
set statusline+=%*
set statusline+=%= "left/right separator
set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
set statusline+=%02c, "cursor column
set statusline+=%03l/%03L "cursor line/total lines
set statusline+=\ hex:\ 0x%02B
set statusline+=\ %P "percent through file
" vim: set ts=4 sw=4 tw=78 ft=vim :

72
vim/plugin/tabline.vim Normal file
View File

@ -0,0 +1,72 @@
" set up tab labels with tab number, buffer name, number of windows
function! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Append the tab number
let label .= tabpagenr().': '
" Append the buffer name
let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
if name == ''
" give a name to no-name documents
if &buftype=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
else
" get only the file name
let name = fnamemodify(name,":t")
endif
let label .= name
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label .= ' [+]'
break
endif
endfor
return label
endfunction
" set up tab tooltips with every buffer name
function! GuiTabToolTip()
let tip = ''
let bufnrlist = tabpagebuflist(v:lnum)
for bufnr in bufnrlist
" separate buffer entries
if tip!=''
let tip .= ' | '
endif
" Add name of buffer
let name=bufname(bufnr)
if name == ''
" give a name to no name documents
if getbufvar(bufnr,'&buftype')=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
endif
let tip.=name
" add modified/modifiable flags
if getbufvar(bufnr, "&modified")
let tip .= ' [+]'
endif
if getbufvar(bufnr, "&modifiable")==0
let tip .= ' [-]'
endif
endfor
return tip
endfunction
set guitablabel=%!GuiTabLabel()
set guitabtooltip=%!GuiTabToolTip()
" vim: set ts=4 sw=4 tw=78 ft=vim :

268
vim/plugin/vcsbzr.vim Normal file
View File

@ -0,0 +1,268 @@
" vim600: set foldmethod=marker:
"
" BZR extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandBZRExec
" This variable specifies the BZR executable. If not set, it defaults to
" 'bzr' executed from the user's executable path.
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
" BZR is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:bzrFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke bzr suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'BZR'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'BZR VCSCommand plugin called on non-BZR item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:bzrFunctions.Identify(buffer) {{{2
function! s:bzrFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
if(v:shell_error)
return 0
else
return 1
endif
endfunction
" Function: s:bzrFunctions.Add() {{{2
function! s:bzrFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Annotate(argList) {{{2
function! s:bzrFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'BZRAnnotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=BZRAnnotate
endif
return resultBuffer
endfunction
" Function: s:bzrFunctions.Commit(argList) {{{2
function! s:bzrFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:bzrFunctions.Delete() {{{2
function! s:bzrFunctions.Delete(argList)
return s:DoCommand(join(['rm'] + a:argList, ' '), 'rm', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Diff(argList) {{{2
function! s:bzrFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, '..')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
endfunction
" Function: s:bzrFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository]
function! s:bzrFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"')
let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under BZR control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)')[1:2]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:bzrFunctions.Info(argList) {{{2
function! s:bzrFunctions.Info(argList)
return s:DoCommand(join(['version-info'] + a:argList, ' '), 'version-info', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Lock(argList) {{{2
function! s:bzrFunctions.Lock(argList)
echomsg 'bzr lock is not necessary'
endfunction
" Function: s:bzrFunctions.Log() {{{2
function! s:bzrFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:bzrFunctions.Revert(argList) {{{2
function! s:bzrFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:bzrFunctions.Review(argList) {{{2
function! s:bzrFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
endfunction
" Function: s:bzrFunctions.Status(argList) {{{2
function! s:bzrFunctions.Status(argList)
let options = ['-S']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:bzrFunctions.Unlock(argList) {{{2
function! s:bzrFunctions.Unlock(argList)
echomsg 'bzr unlock is not necessary'
endfunction
" Function: s:bzrFunctions.Update(argList) {{{2
function! s:bzrFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
let &cpo = s:save_cpo

View File

@ -4,7 +4,6 @@
" Control Systems, such as CVS, SVN, SVK, and git.
"
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Version: Beta 29
" License:
" Copyright (c) 2008 Bob Hiestand
"
@ -34,17 +33,16 @@
" output of the commands is captured in a new scratch window.
"
" This plugin needs additional extension plugins, each specific to a source
" control system, to function. Those plugins should be placed in a
" subdirectory of the standard plugin directory named 'vcscommand'. Several
" options include the name of the version control system in the option name.
" Such options use the placeholder text '{VCSType}', which would be replaced
" in actual usage with 'CVS' or 'SVN', for instance.
" control system, to function. Several options include the name of the
" version control system in the option name. Such options use the placeholder
" text '{VCSType}', which would be replaced in actual usage with 'CVS' or
" 'SVN', for instance.
"
" Command documentation {{{2
"
" VCSAdd Adds the current file to source control.
"
" VCSAnnotate Displays the current file with each line annotated with the
" VCSAnnotate[!] 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
@ -52,6 +50,10 @@
" Additionally, if the current buffer is a VCSAnnotate buffer
" already, the version number on the current line is used.
"
" If '!' is used, the view of the annotated buffer is split
" so that the annotation is in a separate window from the
" content, and each is highlighted separately.
"
" VCSBlame Alias for 'VCSAnnotate'.
"
" VCSCommit[!] Commits changes to the current file to source control.
@ -152,6 +154,7 @@
"
" <Leader>ca VCSAdd
" <Leader>cn VCSAnnotate
" <Leader>cN VCSAnnotate!
" <Leader>cc VCSCommit
" <Leader>cD VCSDelete
" <Leader>cd VCSDiff
@ -331,6 +334,9 @@ let g:VCSCOMMAND_IDENTIFY_INEXACT = -1
" Section: Script variable initialization {{{1
" Hidden functions for use by extensions
let s:VCSCommandUtility = {}
" plugin-specific information: {vcs -> [script, {command -> function}, {key -> mapping}]}
let s:plugins = {}
@ -359,6 +365,23 @@ function! s:ReportError(error)
echohl WarningMsg|echomsg 'VCSCommand: ' . a:error|echohl None
endfunction
" Function s:VCSCommandUtility.system(...) {{{2
" Replacement for system() function. This version protects the quoting in the
" command line on Windows systems.
function! s:VCSCommandUtility.system(...)
if (has("win32") || has("win64")) && &sxq !~ '"'
let save_sxq = &sxq
set sxq=\"
endif
try
return call('system', a:000)
finally
if exists("save_sxq")
let &sxq = save_sxq
endif
endtry
endfunction
" Function: s:CreateMapping(shortcut, expansion, display) {{{2
" Creates the given mapping by prepending the contents of
@ -480,15 +503,6 @@ endfunction
function! s:EditFile(command, originalBuffer, statusText)
let vcsType = getbufvar(a:originalBuffer, 'VCSCommandVCSType')
let nameExtension = VCSCommandGetOption('VCSCommandResultBufferNameExtension', '')
if nameExtension == ''
let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferName')
else
let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferNameWithExtension')
endif
let resultBufferName = call(nameFunction, [a:command, a:originalBuffer, vcsType, a:statusText])
" Protect against useless buffer set-up
let s:isEditFileRunning += 1
try
@ -503,26 +517,43 @@ function! s:EditFile(command, originalBuffer, statusText)
enew
call s:SetupScratchBuffer(a:command, vcsType, a:originalBuffer, a:statusText)
finally
let s:isEditFileRunning -= 1
endtry
endfunction
" Function: s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText) {{{2
" Creates convenience buffer variables and the name of a vcscommand result
" buffer.
function! s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText)
let nameExtension = VCSCommandGetOption('VCSCommandResultBufferNameExtension', '')
if nameExtension == ''
let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferName')
else
let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferNameWithExtension')
endif
let name = call(nameFunction, [a:command, a:originalBuffer, a:vcsType, a:statusText])
let b:VCSCommandCommand = a:command
let b:VCSCommandOriginalBuffer = a:originalBuffer
let b:VCSCommandSourceFile = bufname(a:originalBuffer)
let b:VCSCommandVCSType = vcsType
setlocal buftype=nofile
setlocal noswapfile
let &filetype = vcsType . a:command
let b:VCSCommandVCSType = a:vcsType
if a:statusText != ''
let b:VCSCommandStatusText = a:statusText
endif
setlocal buftype=nofile
setlocal noswapfile
let &filetype = a:vcsType . a:command
if VCSCommandGetOption('VCSCommandDeleteOnHide', 0)
setlocal bufhidden=delete
endif
silent noautocmd file `=resultBufferName`
finally
let s:isEditFileRunning -= 1
endtry
silent noautocmd file `=name`
endfunction
" Function: s:SetupBuffer() {{{2
@ -667,6 +698,43 @@ endfunction
" Section: Generic VCS command functions {{{1
" Function: s:VCSAnnotate(...) {{{2
function! s:VCSAnnotate(bang, ...)
try
let annotateBuffer = s:ExecuteVCSCommand('Annotate', a:000)
if annotateBuffer == -1
return -1
endif
if a:bang == '!' && VCSCommandGetOption('VCSCommandDisableSplitAnnotate', 0) == 0
let vcsType = VCSCommandGetVCSType(annotateBuffer)
let functionMap = s:plugins[vcsType][1]
let splitRegex = ''
if has_key(s:plugins[vcsType][1], 'AnnotateSplitRegex')
let splitRegex = s:plugins[vcsType][1]['AnnotateSplitRegex']
endif
let splitRegex = VCSCommandGetOption('VCSCommand' . vcsType . 'AnnotateSplitRegex', splitRegex)
if splitRegex == ''
return annotateBuffer
endif
let originalBuffer = VCSCommandGetOriginalBuffer(annotateBuffer)
let originalFileType = getbufvar(originalBuffer, '&ft')
let annotateFileType = getbufvar(annotateBuffer, '&ft')
execute "normal 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype'))
set scrollbind
leftabove vert new
normal 0P
execute "normal" . col('$') . "\<c-w>|"
call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header')
wincmd l
endif
return annotateBuffer
catch
call s:ReportError(v:exception)
return -1
endtry
endfunction
" Function: s:VCSCommit() {{{2
function! s:VCSCommit(bang, message)
try
@ -997,6 +1065,7 @@ function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
call s:CreateMapping(shortcut, expansion, a:name . " extension mapping " . shortcut)
endfor
endif
return s:VCSCommandUtility
endfunction
" Function: VCSCommandDoCommand(cmd, cmdName, statusText, [options]) {{{2
@ -1036,7 +1105,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
if match(a:cmd, '<VCSCOMMANDFILE>') > 0
let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
else
let fullCmd = a:cmd . ' "' . fileName . '"'
let fullCmd = a:cmd . ' -- "' . fileName . '"'
endif
" Change to the directory of the current buffer. This is done for CVS, but
@ -1044,7 +1113,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
let oldCwd = VCSCommandChangeToCurrentFileDir(path)
try
let output = system(fullCmd)
let output = s:VCSCommandUtility.system(fullCmd)
finally
call VCSCommandChdir(oldCwd)
endtry
@ -1163,8 +1232,8 @@ endfunction
" Section: Command definitions {{{1
" Section: Primary commands {{{2
com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', [<f-args>]))
com! -nargs=* VCSAnnotate call s:ExecuteVCSCommand('Annotate', [<f-args>])
com! -nargs=* VCSBlame call s:ExecuteVCSCommand('Annotate', [<f-args>])
com! -nargs=* -bang VCSAnnotate call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=* -bang VCSBlame call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=? -bang VCSCommit call s:VCSCommit(<q-bang>, <q-args>)
com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', [<f-args>])
com! -nargs=* VCSDiff call s:ExecuteVCSCommand('Diff', [<f-args>])
@ -1200,6 +1269,7 @@ nnoremap <silent> <Plug>VCSLock :VCSLock<CR>
nnoremap <silent> <Plug>VCSLog :VCSLog<CR>
nnoremap <silent> <Plug>VCSRevert :VCSRevert<CR>
nnoremap <silent> <Plug>VCSReview :VCSReview<CR>
nnoremap <silent> <Plug>VCSSplitAnnotate :VCSAnnotate!<CR>
nnoremap <silent> <Plug>VCSStatus :VCSStatus<CR>
nnoremap <silent> <Plug>VCSUnlock :VCSUnlock<CR>
nnoremap <silent> <Plug>VCSUpdate :VCSUpdate<CR>
@ -1217,6 +1287,7 @@ let s:defaultMappings = [
\['i', 'VCSInfo'],
\['L', 'VCSLock'],
\['l', 'VCSLog'],
\['N', 'VCSSplitAnnotate'],
\['n', 'VCSAnnotate'],
\['q', 'VCSRevert'],
\['r', 'VCSReview'],

View File

@ -106,23 +106,40 @@ let s:cvsFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke cvs suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'CVS'
let fullCmd = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
let fullCmd = s:Executable() . ' ' . a:cmd
let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
if ret > 0
if getline(line('$')) =~ '^cvs \w\+: closing down connection'
$d
1
endif
endif
return ret
else
throw 'CVS VCSCommand plugin called on non-CVS item.'
endif
endfunction
" Function: GetRevision() {{{2
" Function: s:GetRevision() {{{2
" Function for retrieving the current buffer's revision number.
" Returns: Revision number or an empty string if an error occurs.
function! GetRevision()
function! s:GetRevision()
if !exists('b:VCSCommandBufferInfo')
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
endif
@ -187,7 +204,7 @@ function! s:cvsFunctions.Annotate(argList)
" CVS defaults to pulling HEAD, regardless of current branch.
" Therefore, always pass desired revision.
let caption = ''
let options = ['-r' . GetRevision()]
let options = ['-r' . s:GetRevision()]
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
@ -284,7 +301,7 @@ function! s:cvsFunctions.GetBufferInfo()
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
try
let statusText=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' status "' . realFileName . '"')
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
if(v:shell_error)
return []
endif
@ -391,6 +408,9 @@ function! s:CVSWatchers()
return s:DoCommand('watchers', 'cvswatchers', '', {})
endfunction
" Annotate setting {{{2
let s:cvsFunctions.AnnotateSplitRegex = '): '
" Section: Command definitions {{{1
" Section: Primary commands {{{2
com! CVSEdit call s:CVSEdit()
@ -425,7 +445,6 @@ for [pluginName, commandText, shortCut] in mappingInfo
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
@ -436,6 +455,6 @@ 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 s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
let &cpo = s:save_cpo

View File

@ -65,12 +65,19 @@ let s:gitFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'git'
let fullCmd = VCSCommandGetOption('VCSCommandGitExec', 'git',) . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'git VCSCommand plugin called on non-git item.'
@ -85,7 +92,7 @@ endfunction
function! s:gitFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --is-inside-work-tree')
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
if(v:shell_error)
return 0
else
@ -116,7 +123,7 @@ function! s:gitFunctions.Annotate(argList)
let options = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options, {})
let resultBuffer = s:DoCommand('blame ' . options, 'annotate', options, {})
if resultBuffer > 0
normal 1G
set filetype=gitAnnotate
@ -177,7 +184,7 @@ endfunction
function! s:gitFunctions.GetBufferInfo()
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
try
let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref -q HEAD'), '\n$', '', '')
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
if v:shell_error
let branch = 'DETACHED'
else
@ -190,7 +197,7 @@ function! s:gitFunctions.GetBufferInfo()
if method != ''
let method = ' --' . method
endif
let tag = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe' . method), '\n$', '', '')
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
if !v:shell_error
call add(info, tag)
break
@ -227,7 +234,7 @@ function! s:gitFunctions.Review(argList)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
try
let prefix = system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --show-prefix')
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
finally
call VCSCommandChdir(oldCwd)
endtry
@ -251,8 +258,10 @@ function! s:gitFunctions.Update(argList)
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
endfunction
" Annotate setting {{{2
let s:gitFunctions.AnnotateSplitRegex = ') '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let &cpo = s:save_cpo

290
vim/plugin/vcshg.vim Normal file
View File

@ -0,0 +1,290 @@
" vim600: set foldmethod=marker:
"
" Mercurial extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandHGExec
" This variable specifies the mercurial executable. If not set, it defaults
" to 'hg' executed from the user's executable path.
"
" VCSCommandHGDiffExt
" This variable, if set, sets the external diff program used by Subversion.
"
" VCSCommandHGDiffOpt
" This variable, if set, determines the options passed to the hg diff
" command (such as 'u', 'w', or 'b').
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
" HG is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:hgFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke hg suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'HG'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'HG VCSCommand plugin called on non-HG item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:hgFunctions.Identify(buffer) {{{2
function! s:hgFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call s:VCSCommandUtility.system(s:Executable() . ' root')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:hgFunctions.Add() {{{2
function! s:hgFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2
function! s:hgFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'HGAnnotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ' -un'
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -un -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
set filetype=HGAnnotate
endif
return resultBuffer
endfunction
" Function: s:hgFunctions.Commit(argList) {{{2
function! s:hgFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -l "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:hgFunctions.Delete() {{{2
function! s:hgFunctions.Delete(argList)
return s:DoCommand(join(['remove'] + a:argList, ' '), 'remove', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.Diff(argList) {{{2
function! s:hgFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let hgDiffExt = VCSCommandGetOption('VCSCommandHGDiffExt', '')
if hgDiffExt == ''
let diffExt = []
else
let diffExt = ['--diff-cmd ' . hgDiffExt]
endif
let hgDiffOpt = VCSCommandGetOption('VCSCommandHGDiffOpt', '')
if hgDiffOpt == ''
let diffOptions = []
else
let diffOptions = ['-x -' . hgDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if hgDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
endfunction
" Function: s:hgFunctions.Info(argList) {{{2
function! s:hgFunctions.Info(argList)
return s:DoCommand(join(['log --limit 1'] + a:argList, ' '), 'log', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository, branch]
function! s:hgFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under HG control.
if statusText =~ '^?'
return ['Unknown']
endif
let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"')
let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"')
let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
if revision == ''
" Error
return ['Unknown']
elseif statusText =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:hgFunctions.Log(argList) {{{2
function! s:hgFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:hgFunctions.Revert(argList) {{{2
function! s:hgFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:hgFunctions.Review(argList) {{{2
function! s:hgFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
" let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
endfunction
" Function: s:hgFunctions.Status(argList) {{{2
function! s:hgFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:hgFunctions.Update(argList) {{{2
function! s:hgFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:hgFunctions.AnnotateSplitRegex = '\d\+: '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
let &cpo = s:save_cpo

View File

@ -60,12 +60,19 @@ let s:svkFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke SVK suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVK'
let fullCmd = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVK VCSCommand plugin called on non-SVK item.'
@ -82,7 +89,7 @@ function! s:svkFunctions.Identify(buffer)
else
let directoryName = fnamemodify(fileName, ':p:h')
endif
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
if(v:shell_error)
return 0
else
@ -167,7 +174,7 @@ endfunction
function! s:svkFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' status -v "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -257,6 +264,6 @@ function! s:svkFunctions.Update(argList)
endfunction
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let &cpo = s:save_cpo

View File

@ -67,12 +67,19 @@ let s:svnFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVN'
let fullCmd = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVN VCSCommand plugin called on non-SVN item.'
@ -193,7 +200,7 @@ endfunction
function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status --non-interactive -vu "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -277,12 +284,16 @@ endfunction
function! s:svnFunctions.Unlock(argList)
return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Update(argList) {{{2
function! s:svnFunctions.Update(argList)
return s:DoCommand('update --non-interactive', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let &cpo = s:save_cpo

40
vim/syntax/HGAnnotate.vim Normal file
View File

@ -0,0 +1,40 @@
" Vim syntax file
" Language: HG annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2010 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 hgVer /\d\+/ contained
syn match hgName /^\s*\S\+/ contained
syn match hgHead /^\s*\S\+\s\+\d\+:/ contains=hgVer,hgName
if !exists("did_hgannotate_syntax_inits")
let did_hgannotate_syntax_inits = 1
hi link hgName Type
hi link hgVer Statement
endif
let b:current_syntax="hgAnnotate"

View File

@ -0,0 +1,44 @@
" Vim syntax file
" Language: git annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2009 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 region gitName start="(\@<=" end="\( \d\d\d\d-\)\@=" contained
syn match gitCommit /^\^\?\x\+/ contained
syn match gitDate /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d/ contained
syn match gitLineNumber /\d\+)\@=/ contained
syn region gitAnnotation start="^" end=") " oneline keepend contains=gitCommit,gitLineNumber,gitDate,gitName
if !exists("did_gitannotate_syntax_inits")
let did_gitannotate_syntax_inits = 1
hi link gitName Type
hi link gitCommit Statement
hi link gitDate Comment
hi link gitLineNumber Label
endif
let b:current_syntax="gitAnnotate"

125
vim/vimrc
View File

@ -24,6 +24,18 @@ set expandtab
set softtabstop=4
set autoindent
set smartindent
" For highlighted numbers:
let python_highlight_numbers = 1
"
" For highlighted builtin functions:
let python_highlight_builtins = 1
"
" For highlighted standard exceptions:
let python_highlight_exceptions = 1
"
" Highlight erroneous whitespace:
let python_highlight_space_errors = 1
" End Python settings
set nofoldenable
@ -45,11 +57,13 @@ set ignorecase " Do case insensitive matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
" set statusline=%<%f\ %H%m%r%=%-14.(%l,%c%)\ %P\ Buf.%n
set showtabline=0
set backupcopy=yes
set fileformats=unix,mac,dos
set fileformat=unix
set mouse=a
colorscheme inkpot
set printfont=Monaco:h14
colorscheme wombat256
" """""""""
" User Info
@ -134,6 +148,22 @@ nnoremap <silent> <S-Up> V
vnoremap <silent> <S-Down> j
vnoremap <silent> <S-Up> k
" Terminal/Filemanager integration
nnoremap <silent> <F9> :OpenTerminal<CR>
nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
" Tab selection by number
nnoremap <silent> <D-1> 1gt
nnoremap <silent> <D-2> 2gt
nnoremap <silent> <D-3> 3gt
nnoremap <silent> <D-4> 4gt
nnoremap <silent> <D-5> 5gt
nnoremap <silent> <D-6> 6gt
nnoremap <silent> <D-7> 7gt
nnoremap <silent> <D-8> 8gt
nnoremap <silent> <D-9> 9gt
nnoremap <silent> <D-0> 10gt
" Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting
" by default uncomment the next three lines.
if has("syntax")
@ -152,100 +182,9 @@ if has("autocmd")
au BufNewFile,BufRead *.mako setf mako
endif
"recalculate the trailing whitespace warning when idle, and after saving
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
"return '[\s]' if trailing white space is detected
"return '' otherwise
function! StatuslineTrailingSpaceWarning()
if !exists("b:statusline_trailing_space_warning")
if search('\s\+$', 'nw') != 0
let b:statusline_trailing_space_warning = '[\s]'
else
let b:statusline_trailing_space_warning = ''
endif
endif
return b:statusline_trailing_space_warning
endfunction
" """"""""""""
" Status Line
" """"""""""""
" Some useful functions
"return the syntax highlight group under the cursor ''
function! StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'),1),'name')
if name == ''
return ''
else
return '[' . name . ']'
endif
endfunction
"recalculate the tab warning flag when idle and after writing
autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning
"return '[&et]' if &et is set wrong
"return '[mixed-indenting]' if spaces and tabs are used to indent
"return an empty string if everything is fine
function! StatuslineTabWarning()
if !exists("b:statusline_tab_warning")
let tabs = search('^\t', 'nw') != 0
let spaces = search('^ ', 'nw') != 0
if tabs && spaces
let b:statusline_tab_warning = '[mixed-indenting]'
elseif (spaces && !&et) || (tabs && &et)
let b:statusline_tab_warning = '[&et]'
else
let b:statusline_tab_warning = ''
endif
endif
return b:statusline_tab_warning
endfunction
" Real Status line definition
set statusline=%t\ "tail of the filename
"display a warning if fileformat isnt unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*
"display a warning if file encoding isnt utf-8
set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*
set statusline+=%h "help file flag
set statusline+=%y "filetype
set statusline+=%r "read only flag
set statusline+=%m "modified flag
"display a warning if &et is wrong, or we have mixed-indenting
set statusline+=%#error#
set statusline+=%{StatuslineTabWarning()}
set statusline+=%*
set statusline+=%{StatuslineTrailingSpaceWarning()}
"display a warning if &paste is set
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':'[nopaste]'}
set statusline+=%*
set statusline+=%= "left/right separator
set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
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
" vim: set ts=4 sw=4 tw=0 ft=vim :