From 8c1ff008e528b6d86abef3b9f624d0980e820d1f Mon Sep 17 00:00:00 2001 From: Daniel Yrovas Date: Sat, 26 Mar 2022 00:57:49 +1100 Subject: [PATCH] lunarvim cmp keybind redesign --- .config/lvim/config.lua | 29 +++++++++++++++++--- .config/lvim/lua/conf/dap.lua | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 .config/lvim/lua/conf/dap.lua diff --git a/.config/lvim/config.lua b/.config/lvim/config.lua index b568813..14f9615 100644 --- a/.config/lvim/config.lua +++ b/.config/lvim/config.lua @@ -5,16 +5,35 @@ lvim.format_on_save = true lvim.builtin.alpha.mode = "startify" lvim.builtin.nvimtree.show_icons.git = 1 + local o = vim.opt o.timeoutlen = 300 o.shell = "/bin/sh" -- Keymappings -local delete = function () end lvim.leader = "space" + +local delete = function () end +local cmp_status_ok, cmp = pcall (require, 'cmp') +if cmp_status_ok then + lvim.builtin.cmp.formatting.kind_icons.Method = "m " + lvim.builtin.cmp.formatting.kind_icons.Module = " " + lvim.builtin.cmp.formatting.kind_icons.Variable = " " + lvim.builtin.cmp.formatting.kind_icons.Constant = " " + lvim.builtin.cmp.formatting.kind_icons.Interface = " " + lvim.builtin.cmp.formatting.kind_icons.Field = "ﰠ " + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = cmp.mapping.confirm { select = true} + lvim.builtin.cmp.mapping[""] = delete() + lvim.builtin.cmp.mapping[""] = cmp.mapping.scroll_docs(-4) +end lvim.keys.normal_mode[""] = ":w" -lvim.builtin.cmp.mapping[""] = delete() lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } lvim.builtin.which_key.mappings["t"] = { @@ -52,9 +71,13 @@ lvim.builtin.terminal.active = true lvim.builtin.dap.active = true lvim.plugins = { - { "folke/tokyonight.nvim", }, + { "folke/tokyonight.nvim", + config = function() + vim.cmd[[colorscheme tokyonight]] + end, }, { "nvim-neorg/neorg", config = req "conf.neorg", }, { "folke/trouble.nvim", cmd = "TroubleToggle", }, } require "conf.luasnip" +require "conf.dap" diff --git a/.config/lvim/lua/conf/dap.lua b/.config/lvim/lua/conf/dap.lua new file mode 100644 index 0000000..cc17155 --- /dev/null +++ b/.config/lvim/lua/conf/dap.lua @@ -0,0 +1,51 @@ +local status_ok, dap = pcall(require, 'dap') +if not status_ok then + return +end + +dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-vscode', -- adjust as needed + name = "lldb" +} + +dap.configurations.cpp = { + { + name = "Launch", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + + -- 💀 + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + + runInTerminal = false, + + -- 💀 + -- If you use `runInTerminal = true` and resize the terminal window, + -- lldb-vscode will receive a `SIGWINCH` signal which can cause problems + -- To avoid that uncomment the following option + -- See https://github.com/mfussenegger/nvim-dap/issues/236#issuecomment-1066306073 + postRunCommands = {'process handle -p true -s false -n false SIGWINCH'} + }, +} + + +-- If you want to use this for rust and c, add something like this: + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp