Browse files

add commandline command

  • Loading branch information...
1 parent 87e5493 commit f49644874601ced18d8051674071b9a42a77dac8 @lucapette committed Feb 11, 2012
Showing with 34 additions and 24 deletions.
  1. +3 −17 README.markdown
  2. +14 −1 autoload/jquerydoc.vim
  3. +15 −6 doc/jquery-doc.txt
  4. +2 −0 plugin/jquery-doc.vim
20 README.markdown
@@ -35,24 +35,10 @@ Furthermore you can choose your own mapping in the following way:
let g:jquery_doc_mapping='KK'
+Furthermore, the plugin defines the following command to search on the
-The only feature I've already planned to add is commands for searching
-arbitrary stuff. Something like `:JqueryDoc foo` for example. I'd like to add
-support for Windows but I'm not going to do it. So pull-requests are more than
-welcome. If you have suggestion, I'll be glad to hear it from you.
-Know Issues
-At this very moment, the plugins works only with GUI versions of Vim. I've
-planned to fix that. Actually, there is a specific
-[branch]( in
-[vim-ruby-doc]( and if you want to
-help I suggest you to take a look at mentioned branch because both projects
-have a very similar codebase. If you run into other issues, please open one
-here on github.
+- `JQueryDoc`
15 autoload/jquerydoc.vim
@@ -1,4 +1,17 @@
+function! s:execute(cmd)
+ let cmd = a:cmd
+ if has("gui_win32")
+ exe "!start ".cmd
+ elseif !has("gui_running")
+ silent exe '!'.cmd.' 2>&1 > /dev/null'
+ exec ':redraw!'
+ else
+ silent exe '!'.cmd.' 2>&1 > /dev/null &'
+ endif
+ return v:shell_error
function! jquerydoc#search(keyword)
let url = ''.a:keyword
- exec ':silent !'.g:jquery_doc_command.' '.url.' &'
+ call s:execute(g:jquery_doc_command.' '.url)
21 doc/jquery-doc.txt
@@ -1,28 +1,37 @@
*jquery-doc.txt* jquery-doc plugin documentation
-|jquery-doc-introduction| Introduction
-|jquery-doc-configuration| Configuration
-|jquery-doc-copyright| Copyright
+1. Introduction |jquery-doc-introduction|
+2. Confiuguration |jquery-doc-configuration|
+3. Copyright |jquery-doc-copyright|
-Introduction *jquery-doc-introduction*
+1. Introduction *jquery-doc-introduction*
When your cursor is on a jQuery method, type `JJ` (or your mapping, see
settings for that) and the plugin will open a new tab in your browser (or a
new instance of the browser) to the related docs. That's all.
-Configuration *jquery-doc-configuration* *g:jquery_doc_command* *g:jquery_doc_mapping*
+2. Configuration *jquery-doc-configuration*
By default, the plugin uses the xdg-open command to look up the docs but you
can easily change the command. For example, if you are OSX you would like to
change it to:
+ *jquery_doc_command* >
let g:jquery_doc_command='open'
Furthermore you can choose your own mapping in the following way:
+ *jquery_doc_mapping* >
let g:jquery_doc_mapping='PP'
-Copyright *vim-jquery-doc*
+The plugin adds a command-line too:
+ *:JQueryDoc* >
+ :JQueryDoc each
+3. Copyright *jquery-doc-copyright*
Copyright (c) Luca Pette. Distributed under the same terms as Vim itself.
See |license|.
+ vim:tw=78:ts=8:ft=help:norl:
2 plugin/jquery-doc.vim
@@ -16,3 +16,5 @@ if !exists('g:jquery_doc_mapping')
execute "noremap <silent> ".g:jquery_doc_mapping." :call jquerydoc#search(expand('<cword>'))<CR>"
+command! -narg=1 JQueryDoc call jquerydoc#search(<q-args>)

0 comments on commit f496448

Please sign in to comment.