diff options
| author | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2021-11-02 19:47:25 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2021-11-02 19:47:25 +0100 |
| commit | ac3b516ea75b0cc8afedf31defa9f8e5117e35b1 (patch) | |
| tree | 76a53b1ef973a27c0684e0962217a2c94b07206f /lua | |
| parent | 3bb224410a3a08472e4abe71a881926940127803 (diff) | |
| download | nvim-conf-ac3b516ea75b0cc8afedf31defa9f8e5117e35b1.tar.gz nvim-conf-ac3b516ea75b0cc8afedf31defa9f8e5117e35b1.zip | |
add completition and snippets
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/alpha/completition.lua | 12 | ||||
| -rw-r--r-- | lua/alpha/snippets.lua | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lua/alpha/completition.lua b/lua/alpha/completition.lua index 1fff833..4ed9dc7 100644 --- a/lua/alpha/completition.lua +++ b/lua/alpha/completition.lua @@ -1,13 +1,23 @@ local lspkind = require "lspkind" lspkind.init() +local luasnip = require("luasnip") local cmp = require "cmp" cmp.setup { mapping = { ["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), - ["<C-e>"] = cmp.mapping.close(), + -- ["<C-e>"] = cmp.mapping.close(), + ["<C-e>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.close() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), ["<C-y>"] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Insert, select = true, diff --git a/lua/alpha/snippets.lua b/lua/alpha/snippets.lua index 9a42b6c..c326f72 100644 --- a/lua/alpha/snippets.lua +++ b/lua/alpha/snippets.lua @@ -11,6 +11,13 @@ ls.snippets = { php = { s("$", { t("$this->"), + }), + s("v", { + t({ "/**", " * @var " }), + i(1, "types"), + t({""," */", "private $"}), + i(2, "name"), + t(";", ""), }) } } |