Compare commits
1 Commits
wip
...
13d2110155
| Author | SHA1 | Date | |
|---|---|---|---|
| 13d2110155 |
@@ -7,6 +7,7 @@ require("plugins.auto-session")
|
||||
require("plugins.colorscheme")
|
||||
require("plugins.conform")
|
||||
require("plugins.flash")
|
||||
require("plugins.luasnip")
|
||||
require("plugins.multicursor")
|
||||
require("plugins.nvim-various-textobjs")
|
||||
require("plugins.oil")
|
||||
|
||||
48
nvim/.config/nvim/lua/plugins/luasnip.lua
Normal file
48
nvim/.config/nvim/lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
vim.api.nvim_create_autocmd("PackChanged", {
|
||||
group = vim.api.nvim_create_augroup("luasnip-update", { clear = true }),
|
||||
callback = function(ev)
|
||||
local name, kind = ev.data.spec.name, ev.data.kind
|
||||
if name == "luasnip" and (kind == "install" or kind == "update") then
|
||||
vim.system({ "make install_jsregexp" }, { cwd = ev.data.path }):wait()
|
||||
print("luasnip make done.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.pack.add({ { src = "https://github.com/L3MON4D3/LuaSnip", version = vim.version.range("^2.0.0") } })
|
||||
local ok, ls = pcall(require, "luasnip")
|
||||
|
||||
if ok then
|
||||
vim.keymap.set({ "i" }, "<C-K>", function()
|
||||
ls.expand()
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ "i", "s" }, "<C-L>", function(fallback)
|
||||
if ls.locally_jumpable() then
|
||||
ls.jump(1)
|
||||
else
|
||||
local key = vim.api.nvim_replace_termcodes("<C-L>", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "n", false)
|
||||
end
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ "i", "s" }, "<C-J>", function()
|
||||
if ls.locally_jumpable() then
|
||||
ls.jump(-1)
|
||||
else
|
||||
local key = vim.api.nvim_replace_termcodes("<C-J>", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "n", false)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<C-E>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
else
|
||||
local key = vim.api.nvim_replace_termcodes("<C-E>", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "n", false)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
require("luasnip.loaders.from_lua").load({ paths = vim.fs.joinpath(vim.fn.stdpath("config"), "lua", "snippets") })
|
||||
else
|
||||
print("plugin luasnip missing")
|
||||
end
|
||||
33
nvim/.config/nvim/lua/snippets/go.lua
Normal file
33
nvim/.config/nvim/lua/snippets/go.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
s(
|
||||
"ife",
|
||||
fmt(
|
||||
[[
|
||||
if err != nil {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
},
|
||||
{ delimiters = "<>" }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"ifse",
|
||||
fmt(
|
||||
[[
|
||||
if <>err = <>; err != nil {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
i(0),
|
||||
},
|
||||
{ delimiters = "<>" }
|
||||
)
|
||||
),
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"plugins": {
|
||||
"LuaSnip": {
|
||||
"rev": "5a1e39223db9a0498024a77b8441169d260c8c25",
|
||||
"src": "https://github.com/L3MON4D3/LuaSnip",
|
||||
"version": "2.0.0 - 3.0.0"
|
||||
},
|
||||
"arrow.nvim": {
|
||||
"rev": "6e0f726f55f99332dd726a53effd6813786b6d49",
|
||||
"src": "https://github.com/otavioschwanck/arrow.nvim"
|
||||
|
||||
Reference in New Issue
Block a user