Tips and Tricks

This plugin is suited for advanced vim users that already understand how to use windows and folds effectively. Here are some suggested help file tags

  • :he windows.txt
  • :he fold
  • :he .vimrc

Make the most use of folds

The ticketing system collapses comments and descriptions nicely using foldmethod=indent (set locally to buffers)

:he fold.txt for details

Create your own custom filters

Add something like this in your vimrc to Quickly open a filtered view of your tickets

    "Trac Plugin Custom Filter
    com! -nargs=? -complete=customlist,ComType        TTFilterMyPriority call FilterMyPriority()       
    fun! FilterMyPriority()
        "Note arg 2 is whitelist(True)/blacklist(False), arg 3 is True if you
        "want the ticket view open (stick it on the last filter)
        python trac.ticket.filter.add('michael', 'owner', True, False)
        python trac.ticket.filter.add('trivial', 'priority', False, False)
        python trac.ticket.filter.add('minor', 'priority', False, True)
    endfun

Create Quick issue options

In your vimrc add some QuickTicket? commands

    "QuickTicket Option (modify this command for your own servers) - Note Ticket #12 
    com! -nargs=+ TQTaskOnVimTrac    python trac.ticket.create(<q-args> , 'task'        , '<server name>')
    com! -nargs=+ TQDefectOnVimTrac  python trac.ticket.create(<q-args> , 'defect'      , '<server name>')
    com! -nargs=+ TQEnhanceOnVimTrac python trac.ticket.create(<q-args> , 'enhancement' , '<server name>')

where <server name> is the name of the server on your g:tracServerList

Note: Eventually I might automate creating :TQTaskon<server name> but it's possibly not neccessary as you might only want this feature on a few of your sites

Set wildmenu option or wildmode options

This plugin has a lot of :Commands to memorize. The default command tabbing option vim offers can be improved to make life easier.

In your vimrc you can either set wildmenu which makes tabbing through options easier. I like this setup it makes...

  • the first tab complete as much as possible
  • the second tab show a list
  • the third tab start cycling through the options
    set wildmode=longest,list,full
    set wildmenu

Alternatively if you like lists and no tab cycling

    set wildmode=longest,list

Adding comments straight from terminal output

I use :r! to output an error message from some log file straight into the TICKET_COMMENT window eg.

    add {{{ brackets ...
    :r! tail -n 5 /var/log/mysql_slow_query_log 
    add }} brackets

Resizing of windows

Resizing windows is possibly most comfortable using a mouse. For my xterm imitating putty terminal I have the following in my vimrc to toggle mouse control

"Mouse handler (toggle for putty functionality)
let g:mouseOn = 0
map <leader>m :call ToggleMouse()<cr>
fun! ToggleMouse()
    if g:mouseOn == 0
        exe 'set mouse=a'
        let g:mouseOn = 1
    else
        exe 'set mouse='
        let g:mouseOn = 0
    endif
endfun

As of writing Fri Jun 6 12:59:18 EST 2008 the trunk has better mouse support than version 0.3.2 published on vim.org