Skip to content

Instantly share code, notes, and snippets.

@andlrc
Created May 11, 2023 08:47
Show Gist options
  • Save andlrc/45ca375ce09be654328c9360cd0b36e4 to your computer and use it in GitHub Desktop.
Save andlrc/45ca375ce09be654328c9360cd0b36e4 to your computer and use it in GitHub Desktop.
" gitsendmail.vim - gitsendmail after ftplugin
" Author: Andreas Louv <andreas@louv.dk>
" Last Change: Jan 04, 2013
setlocal includeexpr=GitSendMailIncludeExpr(v:fname)
function! GitSendMailIncludeExpr(fname) abort
let m = matchlist(a:fname, '^\%(a\|b\)/\(\f\+\)$')
if !empty(m)
let file = m[1]
let git_root = systemlist('git rev-parse --show-toplevel 2> /dev/null')
return join([git_root[0], file], '/')
endif
return a:fname
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment