2024-03-12 01:28:22 -04:00
|
|
|
local tb = require("telescope.builtin")
|
2024-05-17 19:07:18 -04:00
|
|
|
|
|
|
|
vim.g.mapleader = " "
|
2024-03-12 01:28:22 -04:00
|
|
|
-- find Files
|
|
|
|
vim.keymap.set("n", "<C-f>f", tb.find_files, {})
|
|
|
|
-- find Text
|
|
|
|
vim.keymap.set("n", "<C-f>t", tb.live_grep, {})
|
|
|
|
-- find Buffers
|
|
|
|
vim.keymap.set("n", "<C-f>b", tb.buffers, {})
|
|
|
|
-- find keyMaps
|
|
|
|
vim.keymap.set("n", "<C-f>m", tb.keymaps, {})
|
|
|
|
-- find Command
|
|
|
|
vim.keymap.set("n", "<C-f>c", tb.commands, {})
|
|
|
|
-- find Documentation
|
|
|
|
vim.keymap.set("n", "<C-f>d", tb.man_pages, {})
|
|
|
|
-- open tree
|
|
|
|
vim.keymap.set({ "i", "n" }, "<C-t>", vim.cmd.NvimTreeFocus, {})
|
|
|
|
-- move and copy lines
|
2024-03-12 15:22:20 -04:00
|
|
|
vim.keymap.set({ "i", "n" }, "<A-Up>", function()
|
|
|
|
vim.api.nvim_feedkeys("ddkP", "x", false)
|
|
|
|
end, {})
|
|
|
|
vim.keymap.set({ "i", "n" }, "<A-Down>", function()
|
|
|
|
vim.api.nvim_feedkeys("ddp", "x", false)
|
|
|
|
end, {})
|
|
|
|
vim.keymap.set({ "i", "n" }, "<A-S-Up>", function()
|
|
|
|
vim.api.nvim_feedkeys("yyP", "x", false)
|
|
|
|
end, {})
|
|
|
|
vim.keymap.set({ "i", "n" }, "<A-S-Down>", function()
|
|
|
|
vim.api.nvim_feedkeys("yyp", "x", false)
|
|
|
|
end, {})
|
2024-03-12 01:28:22 -04:00
|
|
|
-- on <C-Space> in normal, insert and start autoComp
|
|
|
|
vim.keymap.set("n", "<C-Space>", function()
|
|
|
|
vim.api.nvim_feedkeys("i", "m", false)
|
|
|
|
local key1 = vim.api.nvim_replace_termcodes("<C-Space>", true, false, true)
|
|
|
|
vim.api.nvim_feedkeys(key1, "m", false)
|
|
|
|
end, {})
|
2024-03-12 15:22:20 -04:00
|
|
|
-- toggle function signature
|
|
|
|
vim.keymap.set("i", "<C-S-Space>", function()
|
|
|
|
require("lsp_signature").toggle_float_win()
|
|
|
|
end, {})
|
|
|
|
-- format and vplit remaps
|
2024-03-12 01:28:22 -04:00
|
|
|
vim.keymap.set({ "n", "i" }, "<A-F>", vim.cmd.Format, {})
|
|
|
|
vim.keymap.set({ "i", "n" }, "<C-\\>", vim.cmd.vsplit, {})
|
|
|
|
-- vscode fold and unfold
|
2024-03-12 15:22:20 -04:00
|
|
|
vim.keymap.set("n", "<C-[>", "zc", {})
|
2024-03-12 01:28:22 -04:00
|
|
|
vim.keymap.set("n", "<C-]>", "zo", {})
|
2024-03-14 20:49:32 -04:00
|
|
|
-- clangd switch source/header
|
2024-05-19 17:13:54 -04:00
|
|
|
vim.keymap.set({ "i", "n" }, "<leader>o", vim.cmd.ClangdSwitchSourceHeader, { silent = true })
|
2024-03-15 15:05:44 -04:00
|
|
|
-- goto mappings
|
2024-03-21 15:49:14 -04:00
|
|
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
|
|
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, {})
|
|
|
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {})
|
|
|
|
vim.keymap.set("n", "<C-.>", vim.lsp.buf.code_action, {})
|
2024-03-17 23:49:54 -04:00
|
|
|
-- copy and paste
|
2024-05-17 19:07:18 -04:00
|
|
|
vim.keymap.set("v", "<A-c>", '"+y', {})
|
|
|
|
vim.keymap.set("n", "<A-c>", '"+yy', {})
|
|
|
|
vim.keymap.set("v", "<A-v>", '"+p', {})
|
|
|
|
vim.keymap.set("n", "<A-v>", '"+p', {})
|
2024-03-31 22:21:06 -04:00
|
|
|
-- lsp rename
|
|
|
|
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, {})
|
2024-05-17 19:07:18 -04:00
|
|
|
vim.keymap.set({ "n", "v" }, ";", ":")
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>/", ":call eregex#toggle()<CR>", {
|
|
|
|
noremap = true,
|
|
|
|
})
|
2024-05-18 15:38:58 -04:00
|
|
|
vim.keymap.set("n", "<leader>w", ":SudaWrite<CR>", {
|
|
|
|
noremap = true,
|
|
|
|
})
|
|
|
|
vim.keymap.set("n", "<leader>h", ":%S/", {
|
|
|
|
noremap = true,
|
|
|
|
})
|