QQ is a wrapper over curl for making remote calls inside vim.
This plugin is not being actively worked on by me.
I have moved to using https://github.com/nicwest/vim-http
Here are some alternatives:
(if there are better alternatives, email me, create an issue, or make a PR)
I will look into issues, and merge PR's if needed.
QQ works by specifying the a remote request in a REQUEST buffer. Once executed the response is returned in a RESPONSE buffer. All executed requests are stored in default collection file (~/.QQ.default.collection by default), and can be accessed via the HISTORY buffer.
Requests are defined in the following formats:
<option name>: <option value> <option name>: :<option key>: <option value>
These are the current accepted request options
Target URL, at present only the first URL option will be processed. URL's can
also make use of URL variable names in the format of
:<url variable name>:.
URL-VAR: :<url variable name>: <url variable value>
URL variable, this option will replace instances of
:<url variable name>:
present in the URL with the specified
<url variable value>. Only the name of
the variable is stored in the history this should be useful for sensitive
URL-PARAM: :<url parameter name>: <url parameter value>
URL parameter, this option will add GET parameters to a URL, e.g.
:test: foobar will append
?test=foobar to the end of the given URL
Request method, any method should be acceptable here but may be limited by your executable. At present only the first method will be processed
HEADER: :<header name>: <header value>
Header definition, all headers should be supported, you can have as many of these as you like
OPTION: :<option name>: <option value>
QQ option, these are used to alter the way that QQ handles storing requests and displaying response's. Current option options are:
pretty-printpasses response through a JSON pretty printer.
followif this option is set to true the response will follow all redirects, otherwise will only return the first response
insecureif this option is set to true then it explicitly allows curl to perform "insecure" SSL connections and transfers
FORM: :<field name>: <field value>
Data field, this is data sent to the URL, for example form field's sent as part of a post request
FORM-FILE: :<field name>: <file location>
File field, this file will be uploaded to the given URL with the specified name.
Body, sends everything after this as raw POST body.
from a normal/any buffer
QHopens the recent request history
QCOopens the collection list
QCCchange current collection
QCNadd a new collection
QGopens a new request window with URL under cursor as URL
from a REQUEST buffer
QPadds the JSON pretty-printing option to the current request
QFadds the follow option to current request (follows HTTP redirects)
QABadds basic authentication to the current request
QAOadds oAuth2 to the current request
from a RESPONSE buffer
qcloses the buffer
from a HISTORY buffer
<CR>loads previous request into REQUEST buffer
qcloses the buffer
from a COLLECTIONS buffer
<CR>open collection under cursor and set as current
qcloses the buffer
METHOD: POST URL: http://example.com/:test-var:/upload URL-VAR: :test-var: supersecretkey URL-PARAM: :format: json HEADER: :Cache-Control: no-cache OPTION: :pretty-print: True OPTION: :follow: True FORM: :email: firstname.lastname@example.org FORM: :name: Bob McBobson FORM-FILE: :photo: ~/Photos/notporn.jpg
List of configurable options for the plugin:
g:QQ_curl_executablethe executable to run request's with. default
g:QQ_python_executablethe executable preferred python2 executable
g:QQ_default_collectionlocation of the default history collection. default:
g:QQ_current_collectionlocation of the loaded collection. default
g:QQ_collection_listlocation of the collection list, default
g:QQ_collection_window_locationposition of the collection window, acceptable values are
g:QQ_collection_window_heightheight of collection window. default
g:QQ_buffer_prefixbuffer prefix of all QQ buffers, avoids naming clashes default
g:QQ_map_prefixthe prefix to key maps, default
g:QQ_map_defaultsif you want to turn the default mappings off, default
Tests are written for vim-themis
To run tests, clone vim-themis, and simply run the tests:
git clone https://github.com/thinca/vim-themis.git vim-themis/bin/themis --reporter dot test
If you want to add anything to QQ please think about writing a test for it!
- This is very much a work in progress, if anything breaks let us know at: https://github.com/nicwest/QQ.vim/issues
- It's also still missing features...
- And is more than a bit hacky in places.
- QQ is probably a working title.
Qis a useful key bind, some more and better thought will probably go into more intelligent binds later.
- QQ is modeled on Postman.
- QQ may or may not be windows compatible. (it almost certainly isn't)