diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2012-02-13 17:04:40 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2012-02-13 17:04:40 +1300 |
commit | d397fb145a08ebd20ef4966f51206183a189d9dc (patch) | |
tree | dcc6a97036d9d068be2952b4f6458e93ddf3a758 | |
download | vim-kimble-d397fb145a08ebd20ef4966f51206183a189d9dc.tar.gz vim-kimble-d397fb145a08ebd20ef4966f51206183a189d9dc.zip |
First commit.
-rw-r--r-- | README | 36 | ||||
-rw-r--r-- | doc/kimble.txt | 50 | ||||
-rw-r--r-- | plugin/kimble.vim | 88 |
3 files changed, 174 insertions, 0 deletions
@@ -0,0 +1,36 @@ +kimble - Simple Subversion wrappers + +Author: Tom Ryder <tom@sanctum.geek.nz> +License: Same terms as Vim itself + +Some simple Subversion command wrappers to ease the pain of developing with +Subversion as a VCS. This is very experimental and will be developed more as I +have time and/or inclination. + +:Sstatus Runs 'svn status' and prints its output in a scratch buffer at + the bottom of the screen. + +:Scommit Runs 'svn commit' and prints its output in a scratch buffer at + the bottom of the screen. + +:Sinfo Runs 'svn info' and prints its output in a scratch buffer at + the bottom of the screen. + +:Supdate Runs 'svn update' and prints its output in a scratch buffer at + the bottom of the screen. + +:Sadd Runs 'svn add' and prints its output in a scratch buffer at the + bottom of the screen. Accepts an optional argument, otherwise + assumes you mean the current file. + +:Sblame Runs 'svn blame' and prints its output in a scratch buffer at + left of the screen. Accepts an optional argument, otherwise + assumes you mean the current file. + +:Sdiff Runs 'svn diff' and prints its output in a scratch buffer at + bottom of the screen. Accepts an optional argument, otherwise + assumes you mean the current file. + +:Slog Runs 'svn log' and prints its output in a scratch buffer at the + bottom of the screen. Accepts an optional argument, otherwise + assumes you mean the current file. diff --git a/doc/kimble.txt b/doc/kimble.txt new file mode 100644 index 0000000..65d6d72 --- /dev/null +++ b/doc/kimble.txt @@ -0,0 +1,50 @@ +*kimble.txt* Simple Subversion wrappers + +Author: Tom Ryder <tom@sanctum.geek.nz> +License: Same terms as Vim itself (see |license|) + +DESCRIPTION *kimble* + +Some simple Subversion command wrappers to ease the pain of developing with +Subversion as a VCS. This is very experimental and will be developed more as I +have time and/or inclination. + +COMMANDS *kimble-commands* + +:Sstatus *kimble-:Sstatus* + Runs 'svn status' and prints its output in a scratch + buffer at the bottom of the screen. + +:Scommit *kimble-:Scommit* + Runs 'svn commit' and prints its output in a scratch + buffer at the bottom of the screen. + +:Sinfo *kimble-:Sinfo* + Runs 'svn info' and prints its output in a scratch + buffer at the bottom of the screen. + +:Supdate *kimble-:Supdate* + Runs 'svn update' and prints its output in a scratch + buffer at the bottom of the screen. + +:Sadd *kimble-:Sadd* + Runs 'svn add' and prints its output in a scratch + buffer at the bottom of the screen. Accepts an optional + argument, otherwise assumes you mean the current file. + +:Sblame *kimble-:Sblame* + Runs 'svn blame' and prints its output in a scratch + buffer at the left of the screen. Accepts an optional + argument, otherwise assumes you mean the current file. + +:Sdiff *kimble-:Sdiff* + Runs 'svn diff' and prints its output in a scratch + buffer at the bottom of the screen. Accepts an optional + argument, otherwise assumes you mean the current file. + +:Slog *kimble-:Slog* + Runs 'svn log' and prints its output in a scratch + buffer at the bottom of the screen. Accepts an optional + argument, otherwise assumes you mean the current file. + + vim:tw=78:et:ft=help:norl: diff --git a/plugin/kimble.vim b/plugin/kimble.vim new file mode 100644 index 0000000..c06c91f --- /dev/null +++ b/plugin/kimble.vim @@ -0,0 +1,88 @@ +" +" kimble.vim - Some commands to make the lives of those compelled to use +" Subversion just a bit less painful. Inspired by fugitive.vim, but not nearly +" as comprehensive in scope. +" +" Maintainer: Tom Ryder <http://www.sanctum.geek.nz/> +" + +" +" Wrapper to prevent overloading and signal our presence, and check we're not +" in compatible mode or running a version of Vim that's too old. +" +if exists('g:loaded_kimble') || &compatible || v:version < 700 + finish +endif +let g:loaded_kimble = 1 + +" +" Convenience function for running a command and opening its output in a new +" scratch buffer on a specified side of the screen. +" +function! s:Open(commandline, side) + let expanded_commandline = a:commandline + for part in split(a:commandline, ' ') + if part[0] =~ '\v[%#<]' + let expanded_part = fnameescape(expand(part)) + let expanded_commandline = substitute(expanded_commandline, part, expanded_part, '') + endif + endfor + if (a:side == 'left') + vertical topleft 32 new + elseif (a:side == 'right') + vertical belowright 32 new + elseif (a:side == 'top') + topleft 12 new + elseif (a:side == 'bottom') + botright 12 new + endif + silent! execute '0 read !'. expanded_commandline + normal gg + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap nomodifiable +endfunction + +" +" Define function wrappers for svn binary calls, with appropriate sides for +" loading output. +" +function! s:Commit() + call s:Open('svn commit', 'bottom') +endfunction +function! s:Info() + call s:Open('svn info', 'bottom') +endfunction +function! s:Status() + call s:Open('svn status', 'bottom') +endfunction +function! s:Update() + call s:Open('svn update', 'bottom') +endfunction +function! s:Add(...) + let l:filename = a:0 ? a:1 : expand("%") + call s:Open('svn add ' . fnameescape(l:filename), 'bottom') +endfunction +function! s:Blame(...) + let l:filename = a:0 ? a:1 : expand("%") + call s:Open('svn blame ' . fnameescape(l:filename), 'left') +endfunction +function! s:Diff(...) + let l:filename = a:0 ? a:1 : expand("%") + call s:Open('svn diff ' . fnameescape(l:filename), 'bottom') +endfunction +function! s:Log(...) + let l:filename = a:0 ? a:1 : expand("%") + call s:Open('svn log ' . fnameescape(l:filename), 'bottom') +endfunction + +" +" Define commands. +" +command! Sstatus call <SID>Status() +command! Scommit call <SID>Commit() +command! Sinfo call <SID>Info() +command! Supdate call <SID>Update() +command! -nargs=? -complete=file Sadd call <SID>Add(<f-args>) +command! -nargs=? -complete=file Sblame call <SID>Blame(<f-args>) +command! -nargs=? -complete=file Sdiff call <SID>Diff(<f-args>) +command! -nargs=? -complete=file Slog call <SID>Log(<f-args>) + |