Permalink
Browse files

Merge branch 'from_bhenderson'

* from_bhenderson:
  Only set omnifunc when no configuration present
  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 + 692607d commit 6a406a928ea19f2ba3ac9579730851bab3191c1f @caio committed Sep 17, 2012
Showing with 13 additions and 2 deletions.
  1. +1 −0 README
  2. +12 −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,18 @@ 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
+ autocmd FileType mail setlocal omnifunc=QueryCommandComplete
+ else
+ echoerr "QueryCommandComplete: g:qcc_query_command not set!"
+ finish
+ endif
endif
let g:loaded_QueryCommandComplete = 1

0 comments on commit 6a406a9

Please sign in to comment.