Permalink
Browse files

Merge remote-tracking branch 'bhenderson/master' into from_bhenderson

* bhenderson/master:
  Make setting of omnifunc conditional. Change strlen to len.
  Update README.
  Set omnifunc default for mail file types.
  Make query command default to mutt setting.
  Fix examples typo.
  • Loading branch information...
2 parents 710c8f0 + 74873cf commit 7d47f3eb1cb99a72b6bdec082c9be3932626a495 @caio committed Sep 17, 2012
Showing with 15 additions and 2 deletions.
  1. +1 −0 README
  2. +14 −2 plugin/querycommandcomplete.vim
View
1 README
@@ -25,6 +25,7 @@ Setup:
Settings:
g:qcc_query_command
External command that queries for contacts
+ default: `mutt -Q query_command`
g:qcc_line_separator
Separator for each entry in the result from the query
@@ -25,6 +25,7 @@
" Settings:
" g:qcc_query_command
" External command that queries for contacts
+" default: `mutt -Q query_command`
"
" g:qcc_line_separator
" Separator for each entry in the result from the query
@@ -43,9 +44,17 @@ if exists("g:loaded_QueryCommandComplete") || &cp
finish
endif
+" use mutt query command as default
if !exists("g:qcc_query_command")
- echoerr "QueryCommandComplete: g:qcc_query_command not set!"
- finish
+ let s:querycmd = system('mutt -Q query_command 2>/dev/null')
+ let s:querycmd = substitute(s:querycmd, '^query_command=\"\(.*\) .%s.\"\n', '\1','')
+
+ if len(s:querycmd)
+ let g:qcc_query_command = s:querycmd
+ else
+ echoerr "QueryCommandComplete: g:qcc_query_command not set!"
+ finish
+ endif
endif
let g:loaded_QueryCommandComplete = 1
@@ -133,4 +142,7 @@ function! QueryCommandComplete(findstart, base)
endif
endfunction
+" only set omnifunc if not already set
+autocmd FileType mail if !len(&omnifunc) | setlocal omnifunc=QueryCommandComplete | endif
+
let &cpo = s:save_cpo

0 comments on commit 7d47f3e

Please sign in to comment.