drmikehenry/vimfiles — pull request #44 by jszakmeister (2013-01-27 14:59:02+00:00)
Title: Add textobj-diff to the configuration.

Originally, I wanted something that recognized diff files and would allow `]]` and `[[` to move between hunks. There is another plugin called diff_movement and a depenedency called CountJumps that supports this as well. I didn't like the plugin as much though--it was a little too convoluted.

Kana had this plugin, textobj-diff, that was most of the way there. It just needed the extra mappings to allow `]]` and `[[` to work.

The only question I have here are the movement mappings that textobj-diff brings. It has 8 `d` mappings and I'm just to sure we'll use them. If we don't want them, we can drop this into the vimrc:

```vim
" -------------------------------------------------------------
" textobj-diff
" -------------------------------------------------------------
let g:textobj_diff_no_default_key_mappings = 1

function! s:SetTextobjDiffGlobalMappings()
for m in ['x', 'o']
let cmd = 'silent! ' . m . 'map '
execute l:cmd . 'adH (textobj-diff-file)'
execute l:cmd . 'adf (textobj-diff-file)'
execute l:cmd . 'idH (textobj-diff-file)'
execute l:cmd . 'idf (textobj-diff-file)'
execute l:cmd . 'adh (textobj-diff-hunk)'
execute l:cmd . 'idh (textobj-diff-hunk)'
endfor
endfunction
call s:SetTextobjDiffGlobalMappings()
```

That will prevent textobj-diff from adding any mappings, and then add back in the ones for selecting the diff objects. I can update the pull request with this change, if you think it's better to drop the leader mappings. I'm pretty sure I'm not going to use them... just my 2 cents.