devdocs.vim
devdocs.vim copied to clipboard
If devdocs.io is allready open in a tab in safari, use that tab
Is there a possibility to use an allready open tab in Safari instead of opening a new one each time?
I don't have any idea to reuse a tab already opened in a browser. If you know how to know that from shell command, please let me know.
I finally got it working with osascript
for macOS and Google Chrome. Although, Safari should be easy too. I created a npm package for that code and here is the instructions.
First install my package.
npm install --global reopen-cli
Create a vim command for that.
command! -nargs=* Docs call system(printf('reopen "https://devdocs.io/?q=%s"', <q-args>))
And set keywordprg
to that command.
set keywordprg=:Docs
Now, pressing K under any keyword (or e.g. :Docs child_process
) will bring DevDocs docs and repeating that would replace current open tab.