feat(nvim): setup autopairs with coq
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
b034a294cb
commit
0a3464bb12
1 changed files with 39 additions and 1 deletions
|
@ -28,7 +28,12 @@ in {
|
|||
*/
|
||||
''
|
||||
-- Start completion / snippet stuff
|
||||
vim.g.coq_settings = { auto_start = 'shut-up' };
|
||||
vim.g.coq_settings = {
|
||||
auto_start = 'shut-up',
|
||||
keymap = {
|
||||
recommended = false,
|
||||
},
|
||||
};
|
||||
|
||||
-- Add formatting cmd
|
||||
vim.api.nvim_create_user_command(
|
||||
|
@ -58,7 +63,38 @@ in {
|
|||
});
|
||||
|
||||
require('lsp_lines').setup();
|
||||
|
||||
-- Autopairs with coq
|
||||
local remap = vim.api.nvim_set_keymap
|
||||
local npairs = require('nvim-autopairs')
|
||||
|
||||
npairs.setup({ map_bs = false, map_cr = false })
|
||||
|
||||
_G.MUtils= {}
|
||||
|
||||
MUtils.CR = function()
|
||||
if vim.fn.pumvisible() ~= 0 then
|
||||
if vim.fn.complete_info({ 'selected' }).selected ~= -1 then
|
||||
return npairs.esc('<c-y>');
|
||||
else
|
||||
return npairs.esc('<c-e>') .. npairs.autopairs_cr();
|
||||
end
|
||||
else
|
||||
return npairs.autopairs_cr();
|
||||
end
|
||||
end
|
||||
remap('i', '<cr>', 'v:lua.MUtils.CR()', { expr = true, noremap = true });
|
||||
|
||||
MUtils.BS = function()
|
||||
if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then
|
||||
return npairs.esc('<c-e>') .. npairs.autopairs_bs();
|
||||
else
|
||||
return npairs.autopairs_bs();
|
||||
end
|
||||
end
|
||||
remap('i', '<bs>', 'v:lua.MUtils.BS()', { expr = true, noremap = true });
|
||||
'';
|
||||
|
||||
plugins = [
|
||||
vimPlugins.nvim-lspconfig
|
||||
|
||||
|
@ -66,6 +102,8 @@ in {
|
|||
vimPlugins.coq-artifacts
|
||||
vimPlugins.coq-thirdparty
|
||||
|
||||
vimPlugins.nvim-autopairs
|
||||
|
||||
vimPlugins.lsp-status-nvim
|
||||
vimPlugins.lsp_lines-nvim
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue