Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add commandline command

  • Loading branch information...
commit f49644874601ced18d8051674071b9a42a77dac8 1 parent 87e5493
@lucapette authored
View
20 README.markdown
@@ -35,24 +35,10 @@ Furthermore you can choose your own mapping in the following way:
let g:jquery_doc_mapping='KK'
-Roadmap
--------
+Furthermore, the plugin defines the following command to search on the
+command-line:
-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](https://github.com/lucapette/vim-ruby-doc/tree/terminal-issue) in
-[vim-ruby-doc](https://github.com/lucapette/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`
License
-------
View
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
+endfunction
+
function! jquerydoc#search(keyword)
let url = 'http://api.jquery.com/'.a:keyword
- exec ':silent !'.g:jquery_doc_command.' '.url.' &'
+ call s:execute(g:jquery_doc_command.' '.url)
endfunction
View
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:
View
2  plugin/jquery-doc.vim
@@ -16,3 +16,5 @@ if !exists('g:jquery_doc_mapping')
endif
execute "noremap <silent> ".g:jquery_doc_mapping." :call jquerydoc#search(expand('<cword>'))<CR>"
+
+command! -narg=1 JQueryDoc call jquerydoc#search(<q-args>)
Please sign in to comment.
Something went wrong with that request. Please try again.