Skip to content

Repository files navigation

CircleCIPowered by vital.vim

vim-http

Simple wrapper over curl and http syntax highlighting.

asciicast

Usage

Write a raw http request

GET http://httpbin.org/get HTTP/1.1Host: httpbin.orgAccept: application/json

:Http will execute the request and display the response in a new buffer.

:Http! will execute the request as above and follow any redirects.

:HttpShowCurl displays the curl request that the plugin executes under the hood

:HttpShowRequest displays the internal object representing the request

:HttpClean will add Host and Content-Length headers

:HttpAuth will prompt for authorization credentials

Configuration

g:vim_http_clean_before_do if set to 1 (default) will clean a request before sending it to curl. Disable this by setting this global to 0

g:vim_http_additional_curl_args can be used to provide additional arguments to curl.

g:vim_http_split_vertically when set to 1 will split the window vertically on response rather than horizontally (the default).

g:vim_http_right_below when set to 1 split window will be open on the right (for vertical) or below (for horizontal).

g:vim_http_tempbuffer when set to 1 response buffers will overwrite each other instead of persisting forever.

Helper Methods

http#remove_header(header) removes all occurances of the given header in the current buffer.

http#set_header(header, value) sets the header to the given value in the current buffer, removes duplicates

Examples for your vimrc:

function!s:set_json_header() abortcallhttp#set_header('Content-Type', 'application/json')
endfunctionfunction!s:clean_personal_stuff() abortcallhttp#remove_header('Cookie')
callhttp#remove_header('Accept')
callhttp#remove_header('User-Agent')
callhttp#remove_header('Accept-Language')
endfunctionfunction!s:add_compression() abortcallhttp#set_header('Accept-Encoding', 'deflate, gzip')
letg:vim_http_additional_curl_args='--compressed'endfunctioncommand! JSON calls:set_json_header()
command! Anon calls:clean_personal_stuff()
command! Compression calls:add_compression()

About

simple vim plugin to make http requests from buffers

Topics

Resources

Contributing

Stars

138 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages