tweaked keybinds

This commit is contained in:
MasterGordon 2022-10-22 22:58:30 +02:00
parent d1dc610a6e
commit 81c09df8b7
2 changed files with 58 additions and 30 deletions

View File

@ -18,23 +18,67 @@ dap.adapters.coreclr = {
args = {"--interpreter=vscode"}
}
dap.configurations.cs = {
vim.g.dotnet_build_project = function()
local default_path = vim.fn.getcwd() .. "/"
if vim.g["dotnet_last_proj_path"] ~= nil then
default_path = vim.g["dotnet_last_proj_path"]
end
local cmd = "dotnet build -c Debug > /dev/null"
print("")
print("Cmd to execute: " .. cmd)
local f = os.execute(cmd)
if f == 0 then
print("\nBuild: ✔️ ")
else
print("\nBuild: ❌ (code: " .. f .. ")")
end
end
vim.g.dotnet_get_dll_path = function()
local cwd = vim.fn.getcwd()
local solution = vim.fn.glob(cwd .. "/*.csproj")
local projectName = vim.fn.fnamemodify(solution, ":t:r")
local dll = cwd .. "/bin/Debug/net6.0/" .. projectName .. ".dll"
return dll
end
local config = {
{
type = "coreclr",
name = "launch - netcoredbg",
request = "launch",
program = function()
local cwd = vim.fn.getcwd()
local solution = vim.fn.glob(cwd .. "/*.csproj")
local projectName = vim.fn.fnamemodify(solution, ":t:r")
local proj = cwd .. "/bin/Debug/net6.0/" .. projectName .. ".dll"
print(proj)
return proj
-- return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file")
if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then
vim.g.dotnet_build_project()
end
return vim.g.dotnet_get_dll_path()
end
}
}
dap.configurations.cs = config
-- keybindings
vim.api.nvim_set_keymap("n", "<leader>db", ":lua require'dap'.toggle_breakpoint()<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", "<leader>dc", ":lua require'dap'.continue()<CR>", {noremap = true, silent = true})
local api = vim.api
local keymap_restore = {}
dap.listeners.after["event_initialized"]["me"] = function()
for _, buf in pairs(api.nvim_list_bufs()) do
local keymaps = api.nvim_buf_get_keymap(buf, "n")
for _, keymap in pairs(keymaps) do
if keymap.lhs == "K" then
table.insert(keymap_restore, keymap)
api.nvim_buf_del_keymap(buf, "n", "K")
end
end
end
api.nvim_set_keymap("n", "K", '<Cmd>lua require("dap.ui.widgets").hover()<CR>', {silent = true})
end
dap.listeners.after["event_terminated"]["me"] = function()
for _, keymap in pairs(keymap_restore) do
api.nvim_buf_set_keymap(keymap.buffer, keymap.mode, keymap.lhs, keymap.rhs, {silent = keymap.silent == 1})
end
keymap_restore = {}
end
api.nvim_set_keymap("n", "<leader>B", ":lua require'dap'.toggle_breakpoint()<CR>", {noremap = true, silent = true})
api.nvim_set_keymap("n", "<f5>", ":lua require'dap'.continue()<CR>", {noremap = true, silent = true})

View File

@ -95,51 +95,35 @@ require("neo-tree").setup(
mappings = {
["<space>"] = {
"toggle_node",
nowait = false -- disable `nowait` if you have existing combos starting with this char that you want to use
nowait = false
},
-- ["<2-LeftMouse>"] = "open",
-- ["<cr>"] = "open",
["<esc>"] = "revert_preview",
["P"] = {"toggle_preview", config = {use_float = true}},
-- ["s"] = "open_split",
-- ["v"] = "open_vsplit",
["s"] = "split_with_window_picker",
["v"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
-- ["<cr>"] = "open_drop",
-- ["t"] = "open_tab_drop",
["<cr>"] = "open_with_window_picker",
["<2-LeftMouse>"] = "open_with_window_picker",
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
["C"] = "close_node",
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["a"] = {
"add",
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "absolute" -- "none", "relative", "absolute"
show_path = "absolute"
}
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add".
["d"] = "delete",
["r"] = "rename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
-- ["c"] = {
-- "copy",
-- config = {
-- show_path = "none" -- "none", "relative", "absolute"
-- }
--}
["c"] = "copy",
["m"] = {
"move",
config = {
show_path = "absoulte"
}
}, -- takes text input for destination, also accepts the optional config.show_path option like "add".
},
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",