Skip to content

Commit

Permalink
Add svelte and syntax highlight lua blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
joinemm committed Apr 27, 2024
1 parent 608736e commit 4b84d15
Showing 1 changed file with 62 additions and 40 deletions.
102 changes: 62 additions & 40 deletions home-modules/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -185,41 +185,57 @@
preselect = "None";
snippet.expand = "luasnip";
mapping = {
"<CR>" = ''
cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
"<CR>" =
/*
lua
*/
''
cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
})
'';

"<C-e>" =
/*
lua
*/
''cmp.mapping.abort()'';

"<Tab>" =
/*
lua
*/
''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
})
'';

"<C-e>" = "cmp.mapping.abort()";

"<Tab>" = ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { "i", "s" })
'';
end, { "i", "s" })
'';

"<S-Tab>" = ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" })
'';
"<S-Tab>" =
/*
lua
*/
''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" })
'';
};
};
};
Expand Down Expand Up @@ -288,6 +304,8 @@
hls.enable = true;
jsonls.enable = true;
terraformls.enable = true;
svelte.enable = true;
eslint.enable = true;
ruff-lsp = {
enable = true;
};
Expand All @@ -306,15 +324,19 @@
smartcolumn-nvim
];

extraConfigLua = ''
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
extraConfigLua =
/*
lua
*/
''
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
require("smartcolumn").setup()
'';
require("smartcolumn").setup()
'';
};
}

0 comments on commit 4b84d15

Please sign in to comment.