diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-10 23:29:11 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-10 23:29:11 +0100 |
commit | dbde45cedec1e44d183c9507260ce93e23cd336d (patch) | |
tree | 43738a77d92b25feb124ae373d5651c0d670777e /config/essentials | |
parent | 5d7cb2848ddafd56d9b9267c495f57d405bb906c (diff) |
added more java snippets
Diffstat (limited to 'config/essentials')
-rw-r--r-- | config/essentials/nvim/after/plugin/luasnip.lua | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index bfedfcc..e119f6f 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -77,28 +77,52 @@ ls.add_snippets("html", { }) ls.add_snippets("java", { - s("gfn", fmt( - [[ - {}static void get_{} () {{ - return this.{}; - }} - ]], - { c(1, {t "", t "public ", t "private "}), i(2), rep(2) } - )), + -- function s("fn", fmt( - [[ - {}static {} {} ({}) {{ - {} - return ({}); - }} - ]], - { - c(1, {t "", t "public ", t "private "}), - i(2, "type"), - i(3, "\"name\""), - i(4), i(5), - rep(2) - } - )) + [[ + {}static {} {} ({}) {{ + {} + }} + ]], + { + c(1, {t "", t "public ", t "private "}), + i(2, "type"), + i(3, "f"), + i(4), i(0) + })), + -- setter function + s("sfn", fmt( + [[ + {}void set_{} ({}) {{ + this.{} = {}; + }} + ]], + { c(1, {t "", t "public ", t "private "}), + i(2), rep(2), rep(2), rep(2) })), + -- getter function + s("gfn", fmt( + [[ + {}void get_{} () {{ + return this.{}; + }} + ]], + { c(1, {t "", t "public ", t "private "}), i(2), rep(2) })), + s("psv", fmt( + [[ + public class Main + {{ + public static void main (String[] args) + {{ + {} + }} + }} + ]], + { i(0) })), + s("pt", fmt( + [[ + System.out.{}("{}"); + {} + ]], + { c(1, {t "print", t "println", t "printf"}), i(2), i(0) })), }) |