diff --git a/init.lua b/init.lua index b4fef1d..c439cc8 100644 --- a/init.lua +++ b/init.lua @@ -34,6 +34,11 @@ vim.diagnostic.config({ vim.cmd([[au CursorHold * lua vim.diagnostic.open_float(0,{scope = "cursor"})]]) vim.g.mapleader = " "; vim.g['cph#dir'] = '/home/user/RustIsBestLang/'; +vim.filetype.add({ + extension = { + ct = 'cpp', + }, +}) local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then @@ -439,6 +444,8 @@ local plugins = { }, config = true }, + { 'Exafunction/codeium.vim' }, + { "mistricky/codesnap.nvim", build = "make" }, } local opts = { } @@ -540,6 +547,9 @@ cmp.setup({ [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.confirm({ select = true }) + elseif vim.fn.exists('b:_codeium_completions') ~= 0 then + vim.fn['codeium#Accept']() + fallback() elseif luasnip_status and luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then @@ -580,7 +590,7 @@ lspconfig.clangd.setup { capabilities = capabilities, cmd = { "clangd", - "--header-insertion=never" + -- "--header-insertion=never" } } lspconfig.pyright.setup { @@ -679,6 +689,8 @@ vim.keymap.set('n', '3', 'r ~/RustIsBestLang/src/bin/template.cc', 'BufferPick', {noremap=true}); vim.keymap.set('n', 'p', 'Telescope menu git', {noremap=true}); vim.keymap.set('n', 'g', 'Neogit kind=split_above', {noremap=true}); +vim.keymap.set('n', 'y', '!ctext -i $(gcc -xc++ /dev/null -E -Wp,-v 2>&1 | sed -n "s,^ ,,p" | tr "\\n" ",") < % > ctext_out.ccsplit ctext_out.cc:%%y+q') +vim.keymap.set({'v', 'x'}, 'cc', 'CodeSnap', {noremap=true}); require("nvim-treesitter.configs").setup { incremental_selection = { @@ -693,7 +705,7 @@ require("nvim-treesitter.configs").setup { vim.api.nvim_create_autocmd("FileType", { pattern = "cpp", callback = function() - vim.api.nvim_buf_set_keymap(0, 'n', "b", "10spte clang++ -std=c++17 -DONLINE_JUDGE -Wl,-z,stack-size=268435456 -Wall -Ofast -g -fsanitize=address -fsanitize=undefined % && ./a.out < std.ini", { + vim.api.nvim_buf_set_keymap(0, 'n', "b", '10spte ctext -i $(gcc -xc++ /dev/null -E -Wp,-v 2>&1 | sed -n "s,^ ,,p" | tr "\\n" ",") < % > ctext_out.cc && clang++ -std=c++17 -DONLINE_JUDGE -Wl,-z,stack-size=268435456 -Wall -Ofast -g -fsanitize=address -fsanitize=undefined ctext_out.cc && ./a.out < std.ini', { silent = true, noremap = true }) @@ -1291,3 +1303,8 @@ require("telescope").setup { } require("telescope").load_extension("menu") + +require('codesnap').setup { + code_font_family = "Fira Code", + has_line_number = true, +}