Stuff
git-svn-id: http://photonzero.com/dotfiles/trunk@27 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
8ef96f95b9
commit
fc5eee4948
7 changed files with 252 additions and 5 deletions
2
.gvimrc
2
.gvimrc
|
|
@ -1,5 +1,5 @@
|
|||
winsize 115 45
|
||||
set expandtab
|
||||
"set expandtab
|
||||
set guifont=DejaVu\ Sans\ Mono:h14.00
|
||||
|
||||
"call AppleTSetPath("~/work/client")
|
||||
|
|
|
|||
24
.vim/plugin/cscopemenu.vim
Normal file
24
.vim/plugin/cscopemenu.vim
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
" Add_Cscope_Menu
|
||||
" Adds a cscope menu
|
||||
" All the commands work on the word that is under the cursor
|
||||
function! s:Add_CScope_Menu(menu_clear)
|
||||
if has("gui_running")
|
||||
if (a:menu_clear)
|
||||
|
||||
silent! unmenu &Cscope
|
||||
silent! unmenu! &Cscope
|
||||
amenu <silent> &Cscope.Find\ functions\ calling\ this\ function :cs find c <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ functions\ called\ by\ this\ function :cs find d <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ this\ egrep\ pattern :cs find e <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ this\ file :cs find f <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ this\ definition :cs find g <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ files\ #including\ this\ file :cs find i <C-R>=expand("<cfile>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ this\ Symbol :cs find s <C-R>=expand("<cword>") <CR><CR>
|
||||
amenu <silent> &Cscope.Find\ assignments\ to :cs find t <C-R>=expand("<cword>") <CR><CR>
|
||||
endif
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
autocmd BufEnter * call s:Add_CScope_Menu(1)
|
||||
24
.vim/plugin/vim-scmdiff/NEWS
Normal file
24
.vim/plugin/vim-scmdiff/NEWS
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
2008-09-20
|
||||
* Changed the default diff key from C-d to <Leader>d (default would be \d)
|
||||
|
||||
2008-09-03
|
||||
* Add Enabled/Disabled messages when scmdiff is toggled
|
||||
* Fix highlighting on error messages so subsequent messages aren't highlighted
|
||||
|
||||
2008-08-25
|
||||
* Move Highlight colors out of code so they can be customized by user in .vimrc
|
||||
|
||||
2008-08-18
|
||||
* Initial support for mercurial auto-detection
|
||||
|
||||
2008-08-17
|
||||
* fix bug: Look for SCM directories based on path of file in current buffer, not on getcwd()
|
||||
|
||||
2008-08-15
|
||||
* Add auto-detection of svn, git, and cvs SCMs
|
||||
|
||||
2008-08-10
|
||||
|
||||
* Make C-d a toggle to turn the diff on/off
|
||||
* Avoid deleting unrelated buffers when turning diff off
|
||||
* Autorefresh now works properly
|
||||
22
.vim/plugin/vim-scmdiff/README
Normal file
22
.vim/plugin/vim-scmdiff/README
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
vim-scmdiff: A Vim script to show the differences from a base version in SCM.
|
||||
|
||||
Supported SCMs:
|
||||
* CVS
|
||||
* SVN
|
||||
* GIT
|
||||
* Mercurial
|
||||
* Bitkeeper
|
||||
|
||||
Installation:
|
||||
copy the scmdiff.vim script to your vim plugin path ie: "~/.vim/plugins". (system paths may vary)
|
||||
|
||||
Default commands:
|
||||
\d Toggle diff view on/off
|
||||
:D rev Difference between current and rev
|
||||
|
||||
This script is an evolution from the scripts posted at the following places:
|
||||
http://tekrat.com/2008/02/21/vim-diff/
|
||||
http://www.vim.org/scripts/script.php?script_id=2201
|
||||
http://playground.audioscrobbler.com/jonty/scmdiff.vim
|
||||
|
||||
11
.vim/plugin/vim-scmdiff/TODO
Normal file
11
.vim/plugin/vim-scmdiff/TODO
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Bugs
|
||||
|
||||
* After exiting (:q) a buffer that has diff enabled, subsequent diffs appear to fail.
|
||||
* Should restore options like 'wrap' to their original state when turning diff off
|
||||
* winsaveview() and winrestview() require Vim 7.x. Autodetect and degrade gracefully.
|
||||
|
||||
Features
|
||||
|
||||
* Option to show side-by-side diff (ie. don't hide original buffer)
|
||||
* Make it easier to customize colors and commands
|
||||
* Add a refresh or enable an auto-update feature so diff highlighting changes as changes are made.
|
||||
160
.vim/plugin/vim-scmdiff/scmdiff.vim
Normal file
160
.vim/plugin/vim-scmdiff/scmdiff.vim
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
" Vim script to show file differences from a base version in SCM.
|
||||
" Home: http://github.com/ghewgill/vim-scmdiff
|
||||
|
||||
" Default commands:
|
||||
" \d Toggle diff view on/off
|
||||
" :D rev Difference between current and rev
|
||||
"
|
||||
" You can change the highlighting by adding the following to your
|
||||
" .vimrc file and customizing as necessary. (or just uncomment them here):
|
||||
" highlight DiffAdd ctermbg=DarkBlue ctermfg=white cterm=NONE
|
||||
" highlight DiffChange ctermbg=DarkBlue ctermfg=white cterm=NONE
|
||||
" highlight DiffText ctermbg=DarkBlue ctermfg=white cterm=underline
|
||||
" highlight DiffDelete ctermbg=red ctermfg=white
|
||||
|
||||
if exists("loadedScmDiff") || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
let loadedScmDiff = 1
|
||||
|
||||
map <silent> <Leader>d :call <SID>scmToggle()<CR>
|
||||
noremap <unique> <script> <plug>Dh :call <SID>scmDiff("h")<CR>
|
||||
com! -bar -nargs=? D :call s:scmDiff(<f-args>)
|
||||
|
||||
let g:scmDiffRev = ''
|
||||
|
||||
function! s:scmToggle()
|
||||
|
||||
if exists('b:scmDiffOn') && b:scmDiffOn == 1
|
||||
let b:scmDiffOn = 0
|
||||
set nodiff
|
||||
exe 'bdelete ' . b:scmDiffTmpfile
|
||||
echohl DiffDelete | echon "scmdiff Disabled" | echohl None
|
||||
else
|
||||
call s:scmDiff()
|
||||
if exists('b:scmDiffOn') && b:scmDiffOn == 1
|
||||
echohl DiffAdd | echon "scmdiff Enabled" | echohl None
|
||||
endif
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:scmRefresh()
|
||||
|
||||
if exists('b:scmDiffOn') && b:scmDiffOn == 1
|
||||
call s:scmDiff()
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:detectSCM()
|
||||
|
||||
" Cache the results we find here to save time
|
||||
if exists("g:scmBufPath") && g:scmBufPath == expand("%:p:h") && exists("g:scmDiffCommand")
|
||||
return
|
||||
endif
|
||||
let g:scmBufPath = expand("%:p:h")
|
||||
|
||||
" Detect CVS, SCCS(bitkeeper) or .svn directories in current path
|
||||
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/.svn")
|
||||
let g:scmDiffCommand = "svn diff"
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/CVS")
|
||||
let g:scmDiffCommand = "cvs diff"
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/SCCS")
|
||||
let g:scmDiffCommand = "bk diffs"
|
||||
return
|
||||
endif
|
||||
|
||||
" Detect .git, SCCS(bitkeeper), .hg(mercurial) directories recursively in reverse
|
||||
let my_path = g:scmBufPath
|
||||
while my_path != "/"
|
||||
if !exists("g:scmDiffCommand") && isdirectory(my_path."/.git")
|
||||
let g:scmDiffCommand = "git diff"
|
||||
return
|
||||
endif
|
||||
if !exists("g:scmDiffCommand") && isdirectory(my_path."/.hg")
|
||||
let g:scmDiffCommand = "hg diff"
|
||||
return
|
||||
endif
|
||||
let my_path = simplify(my_path."/../")
|
||||
endwhile
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:scmDiff(...)
|
||||
|
||||
call s:detectSCM()
|
||||
if (!exists("g:scmDiffCommand"))
|
||||
echohl WarningMsg | echon "Could not find .git, .svn, .hg, SCCS, or CVS directories, are you under a supported SCM repository path?" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
if exists('b:scmDiffOn') && b:scmDiffOn == 1
|
||||
let b:scmDiffOn = 0
|
||||
set nodiff
|
||||
exe 'bdelete ' . b:scmDiffTmpfile
|
||||
endif
|
||||
|
||||
let b:scmDiffOn = 1
|
||||
let view = winsaveview()
|
||||
|
||||
if a:0 == 1
|
||||
if a:1 == 'none'
|
||||
let g:scmDiffRev = ''
|
||||
else
|
||||
let g:scmDiffRev = a:1
|
||||
endif
|
||||
endif
|
||||
|
||||
let ftype = &filetype
|
||||
let b:scmDiffTmpfile = tempname()
|
||||
let cmd = 'cat ' . bufname('%') . ' > ' . b:scmDiffTmpfile
|
||||
let cmdOutput = system(cmd)
|
||||
let tmpdiff = tempname()
|
||||
let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
|
||||
let cmdOutput = system(cmd)
|
||||
|
||||
if v:shell_error && cmdOutput != ''
|
||||
echohl WarningMsg | echon cmdOutput | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
let cmd = 'patch -R -p0 ' . b:scmDiffTmpfile . ' ' . tmpdiff
|
||||
let cmdOutput = system(cmd)
|
||||
|
||||
if v:shell_error && cmdOutput != ''
|
||||
echohl WarningMsg | echon cmdOutput | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
if a:0 > 0 && a:1 == 'h'
|
||||
exe 'diffsplit' . b:scmDiffTmpfile
|
||||
else
|
||||
exe 'vert diffsplit' . b:scmDiffTmpfile
|
||||
endif
|
||||
|
||||
exe 'set filetype=' . ftype
|
||||
|
||||
hide
|
||||
|
||||
set foldcolumn=0
|
||||
set foldlevel=100
|
||||
set diffopt= " removed filler so we don't show deleted lines
|
||||
set noscrollbind
|
||||
|
||||
call winrestview(view)
|
||||
|
||||
endfunction
|
||||
|
||||
autocmd CursorHold * call s:scmRefresh()
|
||||
|
||||
|
||||
" vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
|
||||
" vim<600: expandtab sw=4 ts=4 sts=4
|
||||
14
.vimrc
14
.vimrc
|
|
@ -4,17 +4,24 @@ syntax on
|
|||
colorscheme barak
|
||||
"set gfn=Monaco:h12:a
|
||||
set ts=4
|
||||
set softtabstop=4
|
||||
"set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
"set expandtab
|
||||
set nocompatible
|
||||
set smartcase
|
||||
set smartindent
|
||||
set hidden
|
||||
|
||||
set history=1000
|
||||
set wildmenu
|
||||
set wildmode=list:longest
|
||||
set ruler
|
||||
|
||||
"Sources
|
||||
source ~/.vim/supertab.vim
|
||||
source ~/.vim/charm.vim
|
||||
source ~/.vim/plugin/AppleT.vim
|
||||
runtime macros/matchit.vim
|
||||
"source ~/.vim/syntax/motd.vim
|
||||
|
||||
|
||||
|
|
@ -79,8 +86,7 @@ endif
|
|||
command SaveSession :mksession! ~/.vim_last_session
|
||||
command LoadSession :source ~/.vim_last_session
|
||||
|
||||
cd ~/work/gd/trunk
|
||||
|
||||
source ~/.vim/opt/*.vim
|
||||
"if has("cscope")
|
||||
" set csto=0
|
||||
" set cst
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue