Skip to content

Latest commit

 

History

History
94 lines (72 loc) · 4.71 KB

README.md

File metadata and controls

94 lines (72 loc) · 4.71 KB

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