Skip to content

A minimal 🤏 HTTP-client 🐼 interface 🖥️ for Neovim ❤️.

License

Notifications You must be signed in to change notification settings

t-eichmann/kulala.nvim

 
 

Repository files navigation

Kulala Logo

kulala.nvim

Lua GitHub release (latest by date) Discord

RequirementsInstallUsageHTTP File Spec

A minimal REST-Client Interface for Neovim.

Kulala is swahili for "rest" or "relax".

It allows you to make HTTP requests from within Neovim.

demo

Requirements

  • Neovim (tested with 0.10.0)
  • cURL (tested with 8.5.0)
  • jq (tested with 1.7) (Only required for formatted JSON responses)
  • xmllint (tested with libxml v20914) (Only required for formatted XML/HTML responses)

Optional requirements

To make things a lot easier, you can put this lua snippet somewhere in your configuration:

vim.filetype.add({
  extension = {
    ['http'] = 'http',
  },
})

This will make Neovim recognize files with the .http extension as HTTP files.

Install

Via lazy.nvim:

Simple configuration

require('lazy').setup({
  -- HTTP REST-Client Interface
  {
    'mistweaverco/kulala.nvim'
    config = function()
      require('kulala').setup({
        debug = false, -- Enable debug mode
        default_view = 'body', -- body or headers
      })
    end
  },
})

Public methods

require('kulala').run()

Run the current request.

require('kulala').toggle_view()

Toggles between the body and headers view of the last run request.

Persists across restarts.

require('kulala').jump_prev()

Jump to the previous request.

require('kulala').jump_next()

Jump to the next request.

Usage

The syntax highlighting for HTTP files on GitHub is not perfect.

It shows errors where there are none.

examples.http

# Make a request to the PokeAPI to get information about ditto
# Use HTTP/1.0 and the application/json content type as headers
GET https://pokeapi.co/api/v2/pokemon/ditto HTTP/1.0
accept: application/json

###

# Make a request to the Star Wars API to get information about all films
# Use a GraphQL query to get the title and episodeID of each film
# Use the application/json content type as the header and omit the HTTP version
# so it defaults to HTTP/1.1
GET https://swapi-graphql.netlify.app/.netlify/functions/index
accept: application/json

< ./starwars.graphql

###

POST https://swapi-graphql.netlify.app/.netlify/functions/index
accept: application/json
content-type: application/json

{
  "query": "{ allFilms { films { title } } }",
  "variables": {}
}

###

starwars.graphql

query {
  allFilms {
    films {
      title
      episodeID
    }
  }
}

Place the cursor on any item in the examples.http and run :lua require('kulala').run().

About

A minimal 🤏 HTTP-client 🐼 interface 🖥️ for Neovim ❤️.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 96.4%
  • Shell 3.5%
  • Makefile 0.1%