initial commit of my dotfiles, now with all sensitive stuff outside the repo, yay
This commit is contained in:
parent
2e631bfbdc
commit
729a63775e
12 changed files with 3062 additions and 0 deletions
1117
vim/colors/solarized.vim
Normal file
1117
vim/colors/solarized.vim
Normal file
File diff suppressed because it is too large
Load diff
142
vim/colors/xoria256.vim
Normal file
142
vim/colors/xoria256.vim
Normal file
|
@ -0,0 +1,142 @@
|
|||
" Vim color file
|
||||
"
|
||||
" Name: xoria256.vim
|
||||
" Version: 1.5
|
||||
" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
|
||||
"
|
||||
" Should work in recent 256 color terminals. 88-color terms like urxvt are
|
||||
" NOT supported.
|
||||
"
|
||||
" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
|
||||
" similar value.
|
||||
"
|
||||
" Color numbers (0-255) see:
|
||||
" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
||||
"
|
||||
" For a specific filetype highlighting rules issue :syntax list when a file of
|
||||
" that type is opened.
|
||||
|
||||
" Initialization {{{
|
||||
if &t_Co != 256 && ! has("gui_running")
|
||||
echomsg ""
|
||||
echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
|
||||
echomsg ""
|
||||
finish
|
||||
endif
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "xoria256"
|
||||
"}}}
|
||||
" Colours {{{1
|
||||
"" General {{{2
|
||||
hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
|
||||
hi Cursor ctermbg=214 guibg=#ffaf00
|
||||
hi CursorColumn ctermbg=238 guibg=#444444
|
||||
hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
|
||||
hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
|
||||
" TODO
|
||||
" hi MoreMsg
|
||||
hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
|
||||
hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
|
||||
hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
|
||||
hi PmenuSbar ctermbg=252 guibg=#d0d0d0
|
||||
hi PmenuThumb ctermfg=243 guifg=#767676
|
||||
hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
|
||||
hi SignColumn ctermfg=248 guifg=#a8a8a8
|
||||
hi SpecialKey ctermfg=77 guifg=#5fdf5f
|
||||
hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
|
||||
hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
|
||||
hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
|
||||
hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" FIXME
|
||||
hi Title ctermfg=225 guifg=#ffdfff
|
||||
hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
|
||||
hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
|
||||
hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
|
||||
" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
|
||||
hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
|
||||
" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
|
||||
hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
|
||||
|
||||
"" Syntax highlighting {{{2
|
||||
hi Comment ctermfg=244 guifg=#808080
|
||||
hi Constant ctermfg=229 guifg=#ffffaf
|
||||
hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
|
||||
hi Ignore ctermfg=238 guifg=#444444
|
||||
hi Number ctermfg=180 guifg=#dfaf87
|
||||
hi PreProc ctermfg=150 guifg=#afdf87
|
||||
hi Special ctermfg=174 guifg=#df8787
|
||||
hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
|
||||
hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
|
||||
|
||||
"" Special {{{2
|
||||
""" .diff {{{3
|
||||
hi diffAdded ctermfg=150 guifg=#afdf87
|
||||
hi diffRemoved ctermfg=174 guifg=#df8787
|
||||
""" vimdiff {{{3
|
||||
hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
|
||||
"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
|
||||
hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
|
||||
hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
|
||||
hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
|
||||
""" HTML {{{3
|
||||
" hi htmlTag ctermfg=146 guifg=#afafdf
|
||||
" hi htmlEndTag ctermfg=146 guifg=#afafdf
|
||||
hi htmlTag ctermfg=244
|
||||
hi htmlEndTag ctermfg=244
|
||||
hi htmlArg ctermfg=182 guifg=#dfafdf
|
||||
hi htmlValue ctermfg=187 guifg=#dfdfaf
|
||||
hi htmlTitle ctermfg=254 ctermbg=95
|
||||
" hi htmlArg ctermfg=146
|
||||
" hi htmlTagName ctermfg=146
|
||||
" hi htmlString ctermfg=187
|
||||
""" django {{{3
|
||||
hi djangoVarBlock ctermfg=180
|
||||
hi djangoTagBlock ctermfg=150
|
||||
hi djangoStatement ctermfg=146
|
||||
hi djangoFilter ctermfg=174
|
||||
""" python {{{3
|
||||
hi pythonExceptions ctermfg=174
|
||||
""" NERDTree {{{3
|
||||
hi Directory ctermfg=110 guifg=#87afdf
|
||||
hi treeCWD ctermfg=180 guifg=#dfaf87
|
||||
hi treeClosable ctermfg=174 guifg=#df8787
|
||||
hi treeOpenable ctermfg=150 guifg=#afdf87
|
||||
hi treePart ctermfg=244 guifg=#808080
|
||||
hi treeDirSlash ctermfg=244 guifg=#808080
|
||||
hi treeLink ctermfg=182 guifg=#dfafdf
|
||||
|
||||
""" VimDebug {{{3
|
||||
" FIXME
|
||||
" you may want to set SignColumn highlight in your .vimrc
|
||||
" :help sign
|
||||
" :help SignColumn
|
||||
|
||||
" hi currentLine term=reverse cterm=reverse gui=reverse
|
||||
" hi breakPoint term=NONE cterm=NONE gui=NONE
|
||||
" hi empty term=NONE cterm=NONE gui=NONE
|
||||
|
||||
" sign define currentLine linehl=currentLine
|
||||
" sign define breakPoint linehl=breakPoint text=>>
|
||||
" sign define both linehl=currentLine text=>>
|
||||
" sign define empty linehl=empty
|
||||
|
438
vim/plugins/svndiff.vim
Normal file
438
vim/plugins/svndiff.vim
Normal file
|
@ -0,0 +1,438 @@
|
|||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" svndiff (C) 2007 Ico Doornekamp
|
||||
"
|
||||
" This program is free software; you can redistribute it and/or modify it
|
||||
" under the terms of the GNU General Public License as published by the Free
|
||||
" Software Foundation; either version 2 of the License, or (at your option)
|
||||
" any later version.
|
||||
"
|
||||
" This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
" more details.
|
||||
"
|
||||
" Introduction
|
||||
" ------------
|
||||
"
|
||||
" NOTE: This plugin is unix-only!
|
||||
"
|
||||
" An small vim 7.0 plugin for showing RCS diff information in a file while
|
||||
" editing. This plugin runs a diff between the current buffer and the original
|
||||
" file from the version control system, and shows coloured signs indicating
|
||||
" where the buffer differs from the original file from the repository. The
|
||||
" original text is not shown, only signs are used to indicate where changes were
|
||||
" made. With proper key bindings configured, fast navigation between changed
|
||||
" blocks is also provided.
|
||||
"
|
||||
" Despite the name 'svndiff' this plugin supports the following RCS systems:
|
||||
"
|
||||
" - CVS
|
||||
" - Fossil
|
||||
" - Git
|
||||
" - Mercurial
|
||||
" - Perforce / p4
|
||||
" - Subversion
|
||||
"
|
||||
" The type of RCS will be detected when first issuing a svndiff command on
|
||||
" the file.
|
||||
"
|
||||
" The following symbols and syntax highlight groups are used for the signs:
|
||||
"
|
||||
" > DiffAdd: Newly added lines. (default=blue)
|
||||
"
|
||||
" ! DiffChange: Lines which are changed from the original. (default=cyan)
|
||||
"
|
||||
" < DiffDel: Applied to the lines directly above and below a deleted block
|
||||
" (default=magenta)
|
||||
"
|
||||
" Usage
|
||||
" -----
|
||||
"
|
||||
" The plugin defines one function: Svndiff(). This function figures out the
|
||||
" difference between the current buffer and it's RCS original, and adds the
|
||||
" signs at the places where the buffer differs from the original file from svn
|
||||
" or git. You'll need to call this function after making changes to update the
|
||||
" highlighting.
|
||||
"
|
||||
" The function takes one argument specifying an additional action to perform:
|
||||
"
|
||||
" "prev" : jump to the previous different block
|
||||
" "next" : jump to the next different block
|
||||
" "clear" : clean up all signs
|
||||
"
|
||||
" You might want to map some keys to run the Svndiff function. For
|
||||
" example, add to your .vimrc:
|
||||
"
|
||||
" noremap <F3> :call Svndiff("prev")<CR>
|
||||
" noremap <F4> :call Svndiff("next")<CR>
|
||||
" noremap <F5> :call Svndiff("clear")<CR>
|
||||
"
|
||||
"
|
||||
" Configuration
|
||||
" -------------
|
||||
"
|
||||
" The following configuration variables are availabe:
|
||||
"
|
||||
" * g:svndiff_autoupdate
|
||||
"
|
||||
" If this variable is defined, svndiff will automatically update the signs
|
||||
" when the user stops typing for a short while, and when leaving insert
|
||||
" mode. This might slow things down on large files, so use with caution.
|
||||
" The vim variable 'updatetime' can be used to set the auto-update interval,
|
||||
" but note that changing this variable other effects as well. (refer to the
|
||||
" vim docs for more info)
|
||||
" To use, add to your .vimrc:
|
||||
"
|
||||
" let g:svndiff_autoupdate = 1
|
||||
"
|
||||
" * g:svndiff_one_sign_delete
|
||||
"
|
||||
" Normally, two 'delete' signs are placed around the location where
|
||||
" text was deleted. When this variable is defined, only one sign is
|
||||
" placed, above the location of the deleted text.
|
||||
" To use, add to your .vimrc:
|
||||
"
|
||||
" let g:svndiff_one_sign_delete = 1
|
||||
"
|
||||
" Colors
|
||||
" ------
|
||||
"
|
||||
" Personally, I find the following colours more intuitive for diff colours:
|
||||
" red=deleted, green=added, yellow=changed. If you want to use these colours,
|
||||
" try adding the following lines to your .vimrc
|
||||
"
|
||||
" hi DiffAdd ctermfg=0 ctermbg=2 guibg='green'
|
||||
" hi DiffDelete ctermfg=0 ctermbg=1 guibg='red'
|
||||
" hi DiffChange ctermfg=0 ctermbg=3 guibg='yellow'
|
||||
"
|
||||
" Changelog
|
||||
" ---------
|
||||
"
|
||||
" 1.0 2007-04-02 Initial version
|
||||
"
|
||||
" 1.1 2007-04-02 Added goto prev/next diffblock commands
|
||||
"
|
||||
" 1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
|
||||
"
|
||||
" 2.0 2007-08-16 Changed from syntax highlighting to using signs, thanks
|
||||
" to Noah Spurrier for the idea. NOTE: the name of the
|
||||
" function changed from Svndiff_show() to Svndiff(), so
|
||||
" you might need to update your .vimrc mappings!
|
||||
"
|
||||
" 3.0 2008-02-02 Redesign with some ideas from Jan Bezdekovsky. The
|
||||
" diff is only updated when the buffer actually changes,
|
||||
" cleanup of signs is now done properly and some info
|
||||
" about each diff block is printed in the status line.
|
||||
"
|
||||
" 3.1 2008-02-04 Fixed bug that broke plugin in non-english locales, thanks
|
||||
" to Bernhard Walle for the patch
|
||||
"
|
||||
" 3.2 2008-02-27 The latest rewrite broke vim 6 compatiblity. The plugin
|
||||
" is now simply disabled for older vim versions to avoid
|
||||
" a lot of warnings when loading.
|
||||
"
|
||||
" 4.0 2008-11-24 Added GIT support. The RCS type is now detected (svn/git)
|
||||
"
|
||||
" 4.1 2008-11-25 Added CVS support.
|
||||
"
|
||||
" 4.2 2009-07-31 Added support for proper handling of non-unix file formats
|
||||
" which use different newline conventions (dos, mac)
|
||||
"
|
||||
" 4.3 2010-05-08 Added support for Mercurial, fixed git support (thanks
|
||||
" Frankovskyi Bogdan)
|
||||
"
|
||||
" 4.4 2011-03-30 Added support for perforce/p4 (thanks, Timandahaf)
|
||||
"
|
||||
" 4.5 2011-10-09 Bugfix when trying to use svndiff in a new fileless buffer
|
||||
" (Frankovskyi Bogdan)
|
||||
"
|
||||
" 4.6 2012-06-02 Added support for the Fossil SCM (Andrea Federico
|
||||
" Grisotto)
|
||||
"
|
||||
" 4.7 2013-04-25 Fixed git diff when not in top git directory
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
if v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
" Globals for this plugin
|
||||
|
||||
let s:sign_base = 200000 " Base for our sign id's, hoping to avoid colisions
|
||||
let s:is_active = {} " dictionary with buffer names that have svndiff active
|
||||
let s:rcs_type = {} " RCS type, will be autodetected to one of svn/git/hg/cvs/p4
|
||||
let s:rcs_cmd = {} " Shell command to execute to get contents of clean file from RCS
|
||||
let s:diff_signs = {} " dict with list of ids of all signs, per file
|
||||
let s:diff_blocks = {} " dict with list of ids of first line of each diff block, per file
|
||||
let s:changedtick = {} " dict with changedticks of each buffer since last invocation
|
||||
let s:newline = {} " dict with newline character of each buffer
|
||||
|
||||
" Commands to execute to get current file contents in various rcs systems
|
||||
|
||||
let s:rcs_cmd_svn = "svn cat '%s'"
|
||||
let s:rcs_cmd_git = "git cat-file -p HEAD:$(git ls-files --full-name '%s')"
|
||||
let s:rcs_cmd_hg = "hg cat '%s'"
|
||||
let s:rcs_cmd_cvs = "cvs -q update -p '%s'"
|
||||
let s:rcs_cmd_p4 = "p4 print '%s'"
|
||||
let s:rcs_cmd_fossil = "fossil finfo -p '%s'"
|
||||
|
||||
"
|
||||
" Do the diff and update signs.
|
||||
"
|
||||
|
||||
function s:Svndiff_update(...)
|
||||
|
||||
let fname = bufname("%")
|
||||
|
||||
if ! exists("s:is_active[fname]")
|
||||
return 0
|
||||
end
|
||||
|
||||
" Guess RCS type for this file
|
||||
|
||||
if ! has_key(s:rcs_type, fname)
|
||||
|
||||
" skip new files created in vim buffer
|
||||
|
||||
if ! filereadable(fname)
|
||||
return 0
|
||||
end
|
||||
|
||||
let info = system("LANG=C svn info " . fname)
|
||||
if match(info, "Path") != -1
|
||||
let s:rcs_type[fname] = "svn"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_svn
|
||||
end
|
||||
|
||||
let info = system("git status " . fname)
|
||||
if v:shell_error == 0
|
||||
let s:rcs_type[fname] = "git"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_git
|
||||
end
|
||||
|
||||
let info = system("fossil status " . fname)
|
||||
if v:shell_error == 0
|
||||
let s:rcs_type[fname] = "fossil"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_fossil
|
||||
end
|
||||
|
||||
let info = system("cvs st " . fname)
|
||||
if v:shell_error == 0
|
||||
let s:rcs_type[fname] = "cvs"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_cvs
|
||||
end
|
||||
|
||||
let info = system("hg status " . fname)
|
||||
if v:shell_error == 0
|
||||
let s:rcs_type[fname] = "hg"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_hg
|
||||
end
|
||||
|
||||
let info = system("p4 fstat " . fname)
|
||||
if match(info, "depotFile") != -1
|
||||
let s:rcs_type[fname] = "p4"
|
||||
let s:rcs_cmd[fname] = s:rcs_cmd_p4
|
||||
end
|
||||
end
|
||||
|
||||
" Could not detect RCS type, print message and exit
|
||||
|
||||
if ! has_key(s:rcs_type, fname)
|
||||
echom "Svndiff: Warning, file " . fname . " is not managed by a supported versioning system!"
|
||||
unlet s:is_active[fname]
|
||||
return
|
||||
end
|
||||
|
||||
" Find newline characters for the current file
|
||||
|
||||
if ! has_key(s:newline, fname)
|
||||
let l:ff_to_newline = { "dos": "\r\n", "unix": "\n", "mac": "\r" }
|
||||
let s:newline[fname] = l:ff_to_newline[&l:fileformat]
|
||||
echom s:newline[fname]
|
||||
end
|
||||
|
||||
" Check if the changedticks changed since the last invocation of this
|
||||
" function. If nothing changed, there's no need to update the signs.
|
||||
|
||||
if exists("s:changedtick[fname]") && s:changedtick[fname] == b:changedtick
|
||||
return 1
|
||||
end
|
||||
let s:changedtick[fname] = b:changedtick
|
||||
|
||||
" The diff has changed since the last time, so we need to update the signs.
|
||||
" This is where the magic happens: pipe the current buffer contents to a
|
||||
" shell command calculating the diff in a friendly parsable format.
|
||||
|
||||
let contents = join(getbufline("%", 1, "$"), s:newline[fname])
|
||||
let diff = system("diff -U0 <(" . substitute(s:rcs_cmd[fname], "%s", fname, "") . ") <(cat;echo)", contents)
|
||||
|
||||
" clear the old signs
|
||||
|
||||
call s:Svndiff_clear()
|
||||
|
||||
" Parse the output of the diff command and put signs at changed, added and
|
||||
" removed lines
|
||||
|
||||
for line in split(diff, '\n')
|
||||
|
||||
let part = matchlist(line, '@@ -\([0-9]*\),*\([0-9]*\) +\([0-9]*\),*\([0-9]*\) @@')
|
||||
|
||||
if ! empty(part)
|
||||
let old_from = part[1]
|
||||
let old_count = part[2] == '' ? 1 : part[2]
|
||||
let new_from = part[3]
|
||||
let new_count = part[4] == '' ? 1 : part[4]
|
||||
|
||||
" Figure out if text was added, removed or changed.
|
||||
|
||||
if old_count == 0
|
||||
let from = new_from
|
||||
let to = new_from + new_count - 1
|
||||
let name = 'svndiff_add'
|
||||
let info = new_count . " lines added"
|
||||
elseif new_count == 0
|
||||
let from = new_from
|
||||
let to = new_from
|
||||
let name = 'svndiff_delete'
|
||||
let info = old_count . " lines deleted"
|
||||
if ! exists("g:svndiff_one_sign_delete")
|
||||
let to += 1
|
||||
endif
|
||||
else
|
||||
let from = new_from
|
||||
let to = new_from + new_count - 1
|
||||
let name = 'svndiff_change'
|
||||
let info = new_count . " lines changed"
|
||||
endif
|
||||
|
||||
let id = from + s:sign_base
|
||||
let s:diff_blocks[fname] += [{ 'id': id, 'info': info }]
|
||||
|
||||
" Add signs to mark the changed lines
|
||||
|
||||
let line = from
|
||||
while line <= to
|
||||
let id = line + s:sign_base
|
||||
exec 'sign place ' . id . ' line=' . line . ' name=' . name . ' file=' . fname
|
||||
let s:diff_signs[fname] += [id]
|
||||
let line = line + 1
|
||||
endwhile
|
||||
|
||||
endif
|
||||
endfor
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Remove all signs we placed earlier
|
||||
"
|
||||
|
||||
function s:Svndiff_clear(...)
|
||||
let fname = bufname("%")
|
||||
if exists("s:diff_signs[fname]")
|
||||
for id in s:diff_signs[fname]
|
||||
exec 'sign unplace ' . id . ' file=' . fname
|
||||
endfor
|
||||
end
|
||||
let s:diff_blocks[fname] = []
|
||||
let s:diff_signs[fname] = []
|
||||
endfunction
|
||||
|
||||
|
||||
"
|
||||
" Jump to previous diff block sign above the current line
|
||||
"
|
||||
|
||||
function s:Svndiff_prev(...)
|
||||
let fname = bufname("%")
|
||||
let diff_blocks_reversed = reverse(copy(s:diff_blocks[fname]))
|
||||
for block in diff_blocks_reversed
|
||||
let line = block.id - s:sign_base
|
||||
if line < line(".")
|
||||
call setpos(".", [ 0, line, 1, 0 ])
|
||||
echom 'svndiff: ' . block.info
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
echom 'svndiff: no more diff blocks above cursor'
|
||||
endfunction
|
||||
|
||||
|
||||
"
|
||||
" Jump to next diff block sign below the current line
|
||||
"
|
||||
|
||||
function s:Svndiff_next(...)
|
||||
let fname = bufname("%")
|
||||
for block in s:diff_blocks[fname]
|
||||
let line = block.id - s:sign_base
|
||||
if line > line(".")
|
||||
call setpos(".", [ 0, line, 1, 0 ])
|
||||
echom 'svndiff: ' . block.info
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
echom 'svndiff: no more diff blocks below cursor'
|
||||
endfunction
|
||||
|
||||
|
||||
"
|
||||
" Wrapper function: Takes one argument, which is the action to perform:
|
||||
" {next|prev|clear}
|
||||
"
|
||||
|
||||
function Svndiff(...)
|
||||
|
||||
let cmd = exists("a:1") ? a:1 : ''
|
||||
let fname = bufname("%")
|
||||
if fname == ""
|
||||
echom "Buffer has no file name, can not do a diff"
|
||||
return
|
||||
endif
|
||||
|
||||
if cmd == 'clear'
|
||||
let s:changedtick[fname] = 0
|
||||
if exists("s:is_active[fname]")
|
||||
unlet s:is_active[fname]
|
||||
endif
|
||||
call s:Svndiff_clear()
|
||||
end
|
||||
|
||||
if cmd == 'prev'
|
||||
let s:is_active[fname] = 1
|
||||
let ok = s:Svndiff_update()
|
||||
if ok
|
||||
call s:Svndiff_prev()
|
||||
endif
|
||||
endif
|
||||
|
||||
if cmd == 'next'
|
||||
let s:is_active[fname] = 1
|
||||
let ok = s:Svndiff_update()
|
||||
if ok
|
||||
call s:Svndiff_next()
|
||||
endif
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
" Define sign characters and colors
|
||||
|
||||
sign define svndiff_add text=+ texthl=diffAdd
|
||||
sign define svndiff_delete text=- texthl=diffDelete
|
||||
sign define svndiff_change text=~ texthl=diffChange
|
||||
|
||||
|
||||
" Define autocmds if autoupdate is enabled
|
||||
|
||||
if exists("g:svndiff_autoupdate")
|
||||
autocmd CursorHold,CursorHoldI * call s:Svndiff_update()
|
||||
autocmd InsertLeave * call s:Svndiff_update()
|
||||
endif
|
||||
|
||||
" vi: ts=2 sw=2
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue