#zdep
### vim:ft=zsh:foldmethod=marker
###
### zsh modules
###   autoload/zmodload for modules, functions etc.
###
### Frank Terbeck <ft@bewatermyfriend.org>
### Last-Modified: Wed Dec 26 12:23:59 2007
###
### URI: <http://ft.bewatermyfriend.org/comp/zsh.html>
###

### load color definitions {{{

ZHAVE_COLORS=0
zrcautoload colors && colors && ZHAVE_COLORS=1

### }}}
### load completion system {{{

if zis_317 "atleast" ; then
    zmodload zsh/complist
    zrcautoload compinit && compinit
else
    zmodload zsh/compctl > /dev/null 2>&1 || zmodload compctl > /dev/null 2>&1
    function zstyle () { }
    function compdef () { }
fi

### }}}
### functions {{{
### zargs(), zmv(), run-help()

zrcautoload zargs
zrcautoload zmv
zrcautoload run-help

### }}}
### autoload function files in private part of $fpath {{{

local func
for func in ${ZRC_SOURCE_DIR}/functions/[^_]*[^~] ; do
    zrcautoload ${func:t}
done

### }}}
### exec_on_xclip setup {{{

### define recognized contexts
zstyle ':exec_on_xclip:*'           contexts                      \
                                        "0:uri_http"  'http://*'  \
                                        "1:file_gz"   '(/|~)*.gz' \
                                        "2:file"      '(/|~)*'

### and define some stages (different types off tools)
zstyle ':exec_on_xclip:*'             stages '0:nox' '1:x11'

### define x11 selection tool
zstyle ':exec_on_xclip:*'             xclip "xclip"

### and needed options to make it output the current selection
zstyle ':exec_on_xclip:*'             options "-o"

### the function is able to give information about itself,
### use a pager, so it doesn't scroll off the screen
zstyle ':exec_on_xclip:*'             pager "less -Mr"

### the 'operate' style lets you disable entire stages.
### don't use any X11 apps
#zstyle ':exec_on_xclip:x11:*'         operate false

### if using terminal apps, clear the screen after the command
zstyle ':exec_on_xclip:nox:*'         clearterm true

### application definitions (_eoxc_ is replaced by the x11 selection)
if   [[ -x $(which opera) ]] ; then
    zstyle ':exec_on_xclip:x11:uri_http'  app 'opera -remote openURL(_eoxc_)'
elif [[ -x $(which firefox) ]] ; then
    zstyle ':exec_on_xclip:x11:uri_http'  app 'firefox -new-tab _eoxc_'
else
    zstyle ':exec_on_xclip:x11:uri_http'  app false
fi
zstyle ':exec_on_xclip:*:uri_http'    app "${BROWSER:-w3m} _eoxc_"
zstyle ':exec_on_xclip:*:file_gz'     app "zless _eoxc_"
zstyle ':exec_on_xclip:*:file'        app "less _eoxc_"

### }}}