Skip to content

Commit

Permalink
Merge branch 'from_bhenderson'
Browse files Browse the repository at this point in the history
* 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
caio committed Sep 17, 2012
2 parents 710c8f0 + 692607d commit 6a406a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions README
Expand Up @@ -25,6 +25,7 @@ Setup:
Settings: Settings:
g:qcc_query_command g:qcc_query_command
External command that queries for contacts External command that queries for contacts
default: `mutt -Q query_command`


g:qcc_line_separator g:qcc_line_separator
Separator for each entry in the result from the query Separator for each entry in the result from the query
Expand Down
14 changes: 12 additions & 2 deletions plugin/querycommandcomplete.vim
Expand Up @@ -25,6 +25,7 @@
" Settings: " Settings:
" g:qcc_query_command " g:qcc_query_command
" External command that queries for contacts " External command that queries for contacts
" default: `mutt -Q query_command`
" "
" g:qcc_line_separator " g:qcc_line_separator
" Separator for each entry in the result from the query " Separator for each entry in the result from the query
Expand All @@ -43,9 +44,18 @@ if exists("g:loaded_QueryCommandComplete") || &cp
finish finish
endif endif


" use mutt query command as default
if !exists("g:qcc_query_command") if !exists("g:qcc_query_command")
echoerr "QueryCommandComplete: g:qcc_query_command not set!" let s:querycmd = system('mutt -Q query_command 2>/dev/null')
finish 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 endif


let g:loaded_QueryCommandComplete = 1 let g:loaded_QueryCommandComplete = 1
Expand Down

0 comments on commit 6a406a9

Please sign in to comment.