init
This commit is contained in:
commit
1e2ca5a6fc
71 changed files with 3330 additions and 0 deletions
102
config/plugins/luasnip/luasnip.nix
Normal file
102
config/plugins/luasnip/luasnip.nix
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
{ helpers, ... }:
|
||||
let
|
||||
inherit (helpers) mkRaw;
|
||||
in
|
||||
{
|
||||
plugins.luasnip = {
|
||||
enable = true;
|
||||
filetypeExtend = {
|
||||
lua = [
|
||||
"c"
|
||||
"cpp"
|
||||
];
|
||||
};
|
||||
settings = {
|
||||
# https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#config-options
|
||||
enable_autosnippets = true;
|
||||
# https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#variables
|
||||
cut_selection_keys = "<Tab>";
|
||||
update_events = "TextChanged,TextChangedI";
|
||||
};
|
||||
# https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#lua
|
||||
fromLua = [
|
||||
{ paths = ./snippets; } # snippts attached to nixvim repo
|
||||
{ paths = "~/snippets"; } # snippts in home dir
|
||||
];
|
||||
};
|
||||
extraFiles = {
|
||||
"lua/luasnip-helper-funcs.lua".source = ./helpers/luasnip-helper-funcs.lua;
|
||||
};
|
||||
# https://github.com/L3MON4D3/LuaSnip/wiki/Nice-Configs#hint-node-type-with-virtual-text
|
||||
extraConfigLua = ''
|
||||
local types = require("luasnip.util.types")
|
||||
require'luasnip'.config.setup({
|
||||
ext_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
-- virt_text = {{"●", "GruvboxOrange"}}
|
||||
-- see ":h group-name" (syntax highlighting)
|
||||
virt_text = {{ '««« Choice Node', 'Constant', }}
|
||||
}
|
||||
},
|
||||
[types.insertNode] = {
|
||||
active = {
|
||||
-- virt_text = {{"●", "GruvboxBlue"}}
|
||||
-- see ":h group-name" (syntax highlighting)
|
||||
virt_text = {{ '««« Insert Node', 'Comment', }}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
mode = [
|
||||
"i"
|
||||
"s"
|
||||
];
|
||||
key = "<C-j>";
|
||||
action = mkRaw ''
|
||||
function()
|
||||
local ls = require('luasnip')
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"i"
|
||||
"s"
|
||||
];
|
||||
key = "<C-k>";
|
||||
action = mkRaw ''
|
||||
function()
|
||||
local ls = require('luasnip')
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"i"
|
||||
"s"
|
||||
];
|
||||
key = "<C-e>";
|
||||
action = mkRaw ''
|
||||
function()
|
||||
local ls = require('luasnip')
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue