Skip to content

Neovim plugin providing LuaSnip snippets for Kotlin and for an opinionated selection of Kotlin libraries

License

Notifications You must be signed in to change notification settings

franckrasolo/luasnip4k.nvim

Repository files navigation

LuaSnip snippets for Kotlin and select libraries

banner

Neovim v0.10.2 LuaSnip v2.3.0 Kotlin v2.0.21 MIT license

luasnip4k.nvim is a Neovim plugin providing LuaSnip snippets for Kotlin and an opinionated selection of Kotlin libraries only.

Starting with http4k and IntelliJ IDEA live templates for Kotlin, it will eventually cover some of the foundational libraries of forkhandles as the need arises.

The initial http4k snippets cover the same ground and are functionally identical to these live templates for IntelliJ IDEA.

Of particular note, required import statements are automatically inserted if they are not already present in the active Neovim buffer.

📦 Installation

For lazy.nvim, simply configure this plugin as follows:

return {
  "franckrasolo/luasnip4k.nvim"
}

🚀 Available Snippets

In all snippets below, the underscore character _ indicates the position of the cursor immediately after a snippet is expanded.

IntelliJ IDEA / JetBrains Fleet

We refer you to JetBrains Fleet's List of Kotlin live templates as luasnip4k.nvim already supports most of them out of the box.

http4k

General

Trigger Expands to Description
fil Filter { next -> { _; next(it) } } Template for a request/response filter
hh { req: Request -> Response(OK)_ } Snippet for a request/response handler

Requests

Trigger Expands to Description
head Request(HEAD, "/_") Template for a HEAD request
get Request(GET, "/_") Template for a GET request
post Request(POST, "/_") Template for a POST request
put Request(PUT, "/_") Template for a PUT request
delete Request(DELETE, "/_") Template for a DELETE request
options Request(OPTIONS, "/_") Template for a OPTIONS request
trace Request(TRACE, "/_") Template for a TRACE request
patch Request(PATCH, "/_") Template for a PATCH request
purge Request(PURGE, "/_") Template for a PURGE request

Responses

Trigger Expands to Description
100 Response(CONTINUE)_ Snippet for a HTTP 100 response
...
202 Response(ACCEPTED)_ Snippet for a HTTP 202 response
...
307 Response(TEMPORARY_REDIRECT)_ Snippet for a HTTP 307 response
...
401 Response(UNAUTHORIZED)_ Snippet for a HTTP 401 response
...
504 Response(GATEWAY_TIMEOUT)_ Snippet for a HTTP 504 response
...

About

Neovim plugin providing LuaSnip snippets for Kotlin and for an opinionated selection of Kotlin libraries

Topics

Resources

License

Stars

Watchers

Forks

Languages