GithubHelp home page GithubHelp logo

qq.vim's Introduction

Build Status Stories in Ready QQ

QQ is a wrapper over curl for making remote calls inside vim.

GIFS!

NOTE

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:

https://github.com/baverman/vial-http

https://github.com/diepm/vim-rest-console

(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.

Usage

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.

Request format

Requests are defined in the following formats:

<option name>: <option value> 
<option name>: :<option key>: <option value>

Request options

These are the current accepted request options

URL: <url>

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 information.

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

METHOD: <method>

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-print passes response through a JSON pretty printer.
  • follow if this option is set to true the response will follow all redirects, otherwise will only return the first response
  • insecure if 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: <body>

Body, sends everything after this as raw POST body.

Key binds

from a normal/any buffer

  • QQ opens a new request window
  • QH opens the recent request history
  • QCO opens the collection list
  • QCC change current collection
  • QCN add a new collection
  • QG opens a new request window with URL under cursor as URL

from a REQUEST buffer

  • QQ executes the current request as defined in the buffer
  • QP adds the JSON pretty-printing option to the current request
  • QF adds the follow option to current request (follows HTTP redirects)
  • QAB adds basic authentication to the current request
  • QAO adds oAuth2 to the current request

from a RESPONSE buffer

  • QQ returns to the previous REQUEST buffer
  • q closes the buffer

from a HISTORY buffer

  • <CR> loads previous request into REQUEST buffer
  • q closes the buffer

from a COLLECTIONS buffer

  • <CR> open collection under cursor and set as current
  • q closes the buffer

Example request

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: [email protected]
FORM: :name: Bob McBobson
FORM-FILE: :photo: ~/Photos/notporn.jpg

Options

List of configurable options for the plugin:

  • g:QQ_curl_executable the executable to run request's with. default 'curl'
  • g:QQ_python_executable the executable preferred python2 executable 'python'
  • g:QQ_default_collection location of the default history collection. default: '~/.QQ.default.collection'
  • g:QQ_current_collection location of the loaded collection. default g:QQ_default_collection g:QQ_collection_list location of the collection list, default ~/.QQ.collections
  • g:QQ_collection_window_location position of the collection window, acceptable values are 'top' and 'bottom'. default 'top'
  • g:QQ_collection_window_height height of collection window. default 10
  • g:QQ_buffer_prefix buffer prefix of all QQ buffers, avoids naming clashes default '[QQ]'
  • g:QQ_map_prefix the prefix to key maps, default Q
  • g:QQ_map_defaults if you want to turn the default mappings off, default 0

Tests

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!

Notes

  • 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.
  • Yes Q is 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)

qq.vim's People

Contributors

nicwest avatar sunnypp avatar jargv avatar waffle-iron avatar qazwsxpawel avatar

Stargazers

 avatar Pedro Vinícius avatar  avatar ebigram avatar thiagoscherrer avatar Alex ODonnell avatar  avatar Mike ☕ avatar Zev Averbach avatar micah avatar Taylor Bartlett avatar Silviya Koleva avatar Tamás Németh avatar Sarasa Kisaragi avatar Albert avatar Mike Wabst avatar Nicolas Oga avatar Suchan An avatar Sam Holmes avatar Adelar da Silva Queiróz avatar Jacky Alciné avatar Bruno Sutic avatar Angus H. avatar Jon de la Motte avatar Mike Dillion avatar  avatar Conor Heine avatar Andrea Cedraro avatar Francisco Lopes avatar Jamie Schembri avatar Niels Henrik Hagen avatar Chris Peterson avatar Evgeni Kolev avatar Stefan Morgenthaler avatar Maksim Gramin avatar Dan Wierenga avatar Moddus avatar Daniel Hahler avatar  avatar Ian Ker-Seymer avatar somename123 avatar Justyn Shull avatar Phil Pirozhkov avatar Gavin Gilmour avatar Mason D. avatar Stobenski avatar Damon Kelley avatar John Weir avatar Egor Kovetskiy avatar Andrii Tytar avatar Rob Warner avatar Julie Engel avatar Ferran Pelayo Monfort avatar Skurikhin Alexander avatar  avatar Ya Zhuang avatar Wilson Y. Wong avatar Kevin Hanselman avatar Ryan Carter avatar Drew Fradette avatar Nils Uliczka avatar Giacomo Mantani avatar  avatar Arturo Volpe avatar Dmitry Mazuro avatar Jon Banafato avatar Carlos Rosquillas avatar Oliver Caldwell avatar Mike Funk avatar Michał Darda avatar Reilly Tucker Siemens avatar Pablo Acuna avatar ᖇiᑕᕼᗩᖇᗪ avatar Chris Scharf avatar Michal Chalupczak avatar Nazeeruddin Ikram avatar Mark Bahnman avatar Felix Riedel avatar Adam Jimerson avatar Morton Fox avatar  avatar Wade Simmons avatar Serg Nesterov avatar Fabio S. avatar Tyler Benziger avatar Mark Feltner avatar Alex Paulson avatar Allan Hasegawa avatar Rodrigo Guzmán avatar Edward Delaporte avatar Aldiantoro Nugroho avatar Oliver Uvman avatar John Miller avatar  avatar Justin Campbell avatar Juan M. Jiménez avatar

Watchers

Skurikhin Alexander avatar  avatar  avatar James Cloos avatar  avatar Shezad Khan avatar  avatar

qq.vim's Issues

doc.txt

vim readable documentation

Config for turning off SSL Cert Verification

I am using Postman for testing API calls to a local VM machine. I am switching to use (neo)Vim and found this plugin yet I always receive "No response", though the sample call in README.md does give me a response (in HTML though).

Incidentally I also switched from Chrome App Postman to Native App Postman (on macOS). Suddenly Postman also gave me "No Response" and I saw the suggestion about turning off SSL Certificate Verification there. I turned it off and I got back the API response from my VM.

I'd like to know if that is possible with QQ.vim?

windows

There are lots of places that do system calls to commands that may or may not be on windows.

needs to be investigated/fixed

No check for files existance before uploading.

Currently there is no check to see if the file exists before uploading. Would be cool to return this as an error in the response buffer.

Also I have no idea what curl does if the file specified doesn't exist... it kind of looks like it's still uploading something. I have been using http://imgur.com/upload for testing Filedata is the feild required.

response not split correctly with follow option,

screen shot 2014-08-03 at 23 24 03

headers are split normally by the pattern \r\n\r\n which seems to be the default in the curl response. sadly on 302, 301, and 100 response codes there doesn't seem to be any \r's. this makes me sad. I think it will probably work with (\r\n\r\n|\n\n) maybe but that is far to much escaping to be doing late at night.

QQ clears default yank buffer when transitioning from response to request

I am attempting to yank something from my response. I yank it, then open a new request by running QQ. When I am in the new request, I now cannot paste what I yanked from the previous response buffer. Is this default behavior/cam I stop QQ from doing this?

Thanks in advance! QQ has proved to be invaluable so far.

Can't find pprint.py to pretty print

QQ appears to be searching in the current directory for the python script to pretty print. I'm getting this error every time I try to use pretty printing:

python: can't open file '/Users/jonathangeddes/pprint.py': [Errno 2] No such file or directory

It doesn't matter what the current directory is (in this case I'm in /Users/jonathangeddes), it tries to look there for the python file.

Really Cool plugin otherwise! I can see this being a massive time saver.

Error detected while processing function QQ#request#open

Error detected while processing function QQ#request#open:
line    2:
E117: Unknown function: and
E15: Invalid expression: and(!bufexists(s:B.request), !bufexists(s:B.response))

Using latest master branch (as of 12/26/2014).

OS X 10.10.1
Vim 7.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.