Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native implementation of zv_keep_focus #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions autoload/zeavim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,17 @@ function! s:Zeal(docset, query) abort " {{{1
let l:docset = !empty(l:docset) ? l:docset[0:-2] . ':' : ''
let l:query = !empty(a:query) ? escape(a:query, '#%') : ''

if g:zv_keep_focus
let l:prevent_activation = 'true'
else
let l:prevent_activation = 'false'
endif

let l:cmd = has('unix') ? [''] : ['start']
call add(l:cmd, shellescape(g:zv_zeal_executable))
call add(l:cmd, g:zv_zeal_args)
call add(l:cmd, shellescape(l:docset . l:query))
call add(l:cmd, shellescape('dash-plugin://query=' . l:docset . l:query . '&prevent_activation=' . l:prevent_activation))
call add(l:cmd, s:black_hole)
if g:zv_keep_focus && has('unix') && executable('wmctrl') && v:windowid !=# 0
call add(l:cmd, printf('&& wmctrl -ia %s %s', v:windowid, s:black_hole))
endif
silent execute '!' . join(filter(copy(l:cmd), '!empty(v:val)')) . ' &'
redraw!
endfunction
Expand Down