[ANNOUNCE] VIM syntax script for highlighting BZR commit files
Marius Gedminas
marius at pov.lt
Tue Feb 6 14:49:20 GMT 2007
On Tue, Feb 06, 2007 at 06:11:02PM +1100, Martin Pool wrote:
> On 6 Feb 2007, Dmitry Vasiliev <dima at hlabs.spb.ru> wrote:
> > I've created VIM syntax script for highlighting Bazaar's commit files.
> > You can download the script at http://hlabs.spb.ru/vim/en#bzr.vim and it
> > will be included in the VIM distribution soon.
>
> That's pretty cool, I just installed it.
>
> I often do things like
>
> !bzr diff % >diff.tmp
> :view diff.tmp
>
> or 'bzr cat' and then vimdiff. It would be nice to get vim functions
> that did that automatically - or maybe even brought up a list of all
> changed files in a quickfix kind of setup.
I use a ftplugin to show me the output of bzr diff in a split window
when I'm typing the commit message. It's based on svn.vim by Michael
Scherer. Attached.
Marius Gedminas
--
[...] the basic "your gun, your foot, your choice" memory model.
-- jtv on lkml
-------------- next part --------------
" Vim plugin for editing Bazaar (http://bazaar-vcs.org/) commit messages:
" shows a diff in a second window.
"
" Early version, probably doesn't work in all cases
"
" Based on svn.vim by Michael Scherer (misc at mandrake.org) and others.
"
" Place this file in ~/.vim/plugins/, and create a new file in ~/.vim/ftdetect,
" called bzr.vim, with the following line inside:
" au BufRead,BufNewFile bzr_log.* set filetype=bzr
function! Bzr_diff_windows()
let i = 0
let add = 0
let list_of_files = ''
while i <= line('$')
let line = getline(i)
if line =~ '^modified:\|^added:'
let add = 1
elseif line =~ '^\S'
let add = 0
elseif line =~ '^ ' && add
let file = substitute(line, "[*]$", "", "")
let list_of_files = list_of_files . ' ' . file
endif
let i = i + 1
endwhile
if list_of_files == ""
return
endif
new
silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile
exe 'normal :r!LANG=C cd `bzr root` && bzr diff ' . list_of_files . "\n"
setlocal nomodifiable
goto 1
redraw!
syn on
endfunction
setlocal nowarn
call Bzr_diff_windows()
setlocal nowb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070206/faaed6d8/attachment.pgp
More information about the bazaar
mailing list