2022-06-19 04:13:11 -04:00
|
|
|
-- n, v, i, t = mode names
|
2021-08-22 03:49:15 -04:00
|
|
|
|
2022-04-27 11:42:28 -04:00
|
|
|
local M = {}
|
|
|
|
|
2022-05-12 08:56:01 -04:00
|
|
|
M.general = {
|
2022-07-22 12:00:00 -04:00
|
|
|
i = {
|
|
|
|
-- go to beginning and end
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-b>"] = { "<ESC>^i", "Beginning of line" },
|
|
|
|
["<C-e>"] = { "<End>", "End of line" },
|
2023-01-07 03:11:43 -05:00
|
|
|
|
|
|
|
-- navigate within insert mode
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-h>"] = { "<Left>", "Move left" },
|
|
|
|
["<C-l>"] = { "<Right>", "Move right" },
|
|
|
|
["<C-j>"] = { "<Down>", "Move down" },
|
|
|
|
["<C-k>"] = { "<Up>", "Move up" },
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
n = {
|
2023-10-22 08:52:38 -04:00
|
|
|
["<Esc>"] = { "<cmd> noh <CR>", "Clear highlights" },
|
2022-07-22 12:00:00 -04:00
|
|
|
-- switch between windows
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-h>"] = { "<C-w>h", "Window left" },
|
|
|
|
["<C-l>"] = { "<C-w>l", "Window right" },
|
|
|
|
["<C-j>"] = { "<C-w>j", "Window down" },
|
|
|
|
["<C-k>"] = { "<C-w>k", "Window up" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- save
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-s>"] = { "<cmd> w <CR>", "Save file" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- Copy all
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- line numbers
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
|
|
|
|
["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
|
|
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
|
|
|
-- empty mode is same as using <cmd> :map
|
|
|
|
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
2023-05-13 05:58:50 -04:00
|
|
|
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
|
|
|
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
|
|
|
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
|
|
|
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
2022-08-04 10:32:16 -04:00
|
|
|
-- new buffer
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
2023-03-11 02:09:13 -05:00
|
|
|
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
|
2023-06-28 19:48:18 -04:00
|
|
|
|
|
|
|
["<leader>fm"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.format { async = true }
|
|
|
|
end,
|
|
|
|
"LSP formatting",
|
|
|
|
},
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-03-08 08:27:54 -05:00
|
|
|
t = {
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
|
2023-03-08 08:27:54 -05:00
|
|
|
},
|
2022-08-04 10:32:16 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
v = {
|
2023-05-13 05:58:50 -04:00
|
|
|
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
|
|
|
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
2023-09-16 02:18:10 -04:00
|
|
|
["<"] = { "<gv", "Indent line" },
|
|
|
|
[">"] = { ">gv", "Indent line" },
|
2022-09-08 06:45:35 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
x = {
|
2023-05-13 05:58:50 -04:00
|
|
|
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
|
|
|
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
2022-07-22 12:00:00 -04:00
|
|
|
-- Don't copy the replaced text after pasting in visual mode
|
|
|
|
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
2023-05-13 05:58:50 -04:00
|
|
|
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
2022-06-24 09:54:59 -04:00
|
|
|
M.tabufline = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
n = {
|
|
|
|
-- cycle through buffers
|
2023-04-05 12:37:36 -04:00
|
|
|
["<tab>"] = {
|
2022-08-02 10:51:40 -04:00
|
|
|
function()
|
2023-08-09 10:52:46 -04:00
|
|
|
require("nvchad.tabufline").tabuflineNext()
|
2022-08-02 10:51:40 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Goto next buffer",
|
2022-08-02 10:51:40 -04:00
|
|
|
},
|
2022-07-22 12:00:00 -04:00
|
|
|
|
2023-04-05 12:37:36 -04:00
|
|
|
["<S-tab>"] = {
|
2022-08-02 10:51:40 -04:00
|
|
|
function()
|
2023-08-09 10:52:46 -04:00
|
|
|
require("nvchad.tabufline").tabuflinePrev()
|
2022-08-02 10:51:40 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Goto prev buffer",
|
2022-08-02 10:51:40 -04:00
|
|
|
},
|
2022-07-22 12:00:00 -04:00
|
|
|
|
2022-09-14 22:21:13 -04:00
|
|
|
-- close buffer + hide terminal buffer
|
|
|
|
["<leader>x"] = {
|
|
|
|
function()
|
2023-08-09 10:52:46 -04:00
|
|
|
require("nvchad.tabufline").close_buffer()
|
2022-09-14 22:21:13 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Close buffer",
|
2022-09-14 22:21:13 -04:00
|
|
|
},
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
M.comment = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
-- toggle comment in both modes
|
|
|
|
n = {
|
|
|
|
["<leader>/"] = {
|
|
|
|
function()
|
2022-08-12 20:22:33 -04:00
|
|
|
require("Comment.api").toggle.linewise.current()
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Toggle comment",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
v = {
|
|
|
|
["<leader>/"] = {
|
2022-08-12 20:22:33 -04:00
|
|
|
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
2023-05-13 05:58:50 -04:00
|
|
|
"Toggle comment",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
M.lspconfig = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
|
|
|
|
|
|
|
|
n = {
|
|
|
|
["gD"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.declaration()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP declaration",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["gd"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.definition()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP definition",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["K"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.hover()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP hover",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["gi"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.implementation()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP implementation",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>ls"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.signature_help()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP signature help",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>D"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.type_definition()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP definition type",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>ra"] = {
|
|
|
|
function()
|
2023-08-09 10:52:46 -04:00
|
|
|
require("nvchad.renamer").open()
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP rename",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>ca"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.code_action()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP code action",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["gr"] = {
|
|
|
|
function()
|
2022-08-08 04:28:49 -04:00
|
|
|
vim.lsp.buf.references()
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"LSP references",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-10-16 07:32:31 -04:00
|
|
|
["<leader>lf"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-03-30 20:19:45 -04:00
|
|
|
vim.diagnostic.open_float { border = "rounded" }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Floating diagnostic",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["[d"] = {
|
|
|
|
function()
|
2023-06-28 19:48:18 -04:00
|
|
|
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Goto prev",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2022-11-15 08:12:15 -05:00
|
|
|
["]d"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-06-28 19:48:18 -04:00
|
|
|
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Goto next",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>q"] = {
|
|
|
|
function()
|
|
|
|
vim.diagnostic.setloclist()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Diagnostic setloclist",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>wa"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.add_workspace_folder()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Add workspace folder",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>wr"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.remove_workspace_folder()
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Remove workspace folder",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<leader>wl"] = {
|
|
|
|
function()
|
|
|
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"List workspace folders",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
2023-09-02 07:30:02 -04:00
|
|
|
|
|
|
|
v = {
|
|
|
|
["<leader>ca"] = {
|
|
|
|
function()
|
|
|
|
vim.lsp.buf.code_action()
|
|
|
|
end,
|
|
|
|
"LSP code action",
|
|
|
|
},
|
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
M.nvimtree = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
n = {
|
|
|
|
-- toggle
|
2023-05-13 05:58:50 -04:00
|
|
|
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
|
2022-05-12 08:56:01 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
-- focus
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
M.telescope = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
n = {
|
|
|
|
-- find
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
|
|
|
|
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
|
|
|
|
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
|
|
|
|
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
|
|
|
|
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
|
|
|
|
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
|
|
|
|
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- git
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
|
|
|
|
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- pick a hidden term
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
|
2022-07-22 12:00:00 -04:00
|
|
|
|
|
|
|
-- theme switcher
|
2023-05-13 05:58:50 -04:00
|
|
|
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
2023-05-18 02:15:02 -04:00
|
|
|
|
2023-05-18 08:45:51 -04:00
|
|
|
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
M.terminal = {
|
|
|
|
n = {
|
|
|
|
-- spawn new terms
|
|
|
|
["<leader>h"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").new { pos = "sp", size = 0.3 }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"New horizontal term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
["<leader>v"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").new { pos = "vsp", size = 0.3 }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"New vertical term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
-- toggle terms
|
2022-07-22 12:00:00 -04:00
|
|
|
["<A-v>"] = {
|
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm", size = 0.3 }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"New vertical term",
|
|
|
|
},
|
|
|
|
|
|
|
|
["<A-h>"] = {
|
|
|
|
function()
|
|
|
|
require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm", size = 0.2 }
|
|
|
|
end,
|
|
|
|
"New vertical term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<A-i>"] = {
|
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").toggle { pos = "float", id = "floatTerm" }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"Toggleable Floating term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
2023-09-25 02:58:05 -04:00
|
|
|
},
|
2022-07-22 12:00:00 -04:00
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
-- toggle terms in terminal mode
|
|
|
|
t = {
|
|
|
|
["<ESC>"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
local win = vim.api.nvim_get_current_win()
|
|
|
|
vim.api.nvim_win_close(win, true)
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"close term in terminal mode",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
["<A-v>"] = {
|
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm" }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"New vertical term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
["<A-h>"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"New vertical term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
|
2023-09-25 02:58:05 -04:00
|
|
|
["<A-i>"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2023-09-25 02:58:05 -04:00
|
|
|
require("nvchad.term").toggle { pos = "float", id = "floatTerm" }
|
2022-07-22 12:00:00 -04:00
|
|
|
end,
|
2023-09-25 02:58:05 -04:00
|
|
|
"Toggleable Floating term",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
2022-05-12 08:56:01 -04:00
|
|
|
}
|
2021-08-22 03:49:15 -04:00
|
|
|
|
2022-05-12 16:13:00 -04:00
|
|
|
M.whichkey = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
n = {
|
|
|
|
["<leader>wK"] = {
|
|
|
|
function()
|
|
|
|
vim.cmd "WhichKey"
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Which-key all keymaps",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
["<leader>wk"] = {
|
|
|
|
function()
|
|
|
|
local input = vim.fn.input "WhichKey: "
|
|
|
|
vim.cmd("WhichKey " .. input)
|
|
|
|
end,
|
2023-05-13 05:58:50 -04:00
|
|
|
"Which-key query lookup",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
2022-05-12 16:13:00 -04:00
|
|
|
}
|
|
|
|
|
2022-06-18 00:27:17 -04:00
|
|
|
M.blankline = {
|
2022-08-04 10:32:16 -04:00
|
|
|
plugin = true,
|
2022-08-08 21:19:38 -04:00
|
|
|
|
2022-07-22 12:00:00 -04:00
|
|
|
n = {
|
2022-08-23 09:24:04 -04:00
|
|
|
["<leader>cc"] = {
|
2022-07-22 12:00:00 -04:00
|
|
|
function()
|
2024-02-22 21:28:59 -05:00
|
|
|
local config = { scope = {} }
|
|
|
|
config.scope.exclude = { language = {}, node_type = {} }
|
|
|
|
config.scope.include = { node_type = {} }
|
|
|
|
|
|
|
|
local node = require("ibl.scope").get(vim.api.nvim_get_current_buf(), config)
|
|
|
|
|
|
|
|
if node then
|
|
|
|
local start_row, _, end_row, _ = node:range()
|
|
|
|
|
|
|
|
if start_row ~= end_row then
|
|
|
|
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start_row + 1, 0 })
|
|
|
|
vim.api.nvim_feedkeys("_", "n", true)
|
|
|
|
end
|
2022-07-22 12:00:00 -04:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2023-05-13 05:58:50 -04:00
|
|
|
"Jump to current context",
|
2022-07-22 12:00:00 -04:00
|
|
|
},
|
|
|
|
},
|
2022-06-18 00:27:17 -04:00
|
|
|
}
|
|
|
|
|
2022-09-26 19:29:39 -04:00
|
|
|
M.gitsigns = {
|
|
|
|
plugin = true,
|
|
|
|
|
|
|
|
n = {
|
2022-10-03 21:07:48 -04:00
|
|
|
-- Navigation through hunks
|
2022-09-26 19:29:39 -04:00
|
|
|
["]c"] = {
|
|
|
|
function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
return "]c"
|
|
|
|
end
|
|
|
|
vim.schedule(function()
|
|
|
|
require("gitsigns").next_hunk()
|
|
|
|
end)
|
|
|
|
return "<Ignore>"
|
|
|
|
end,
|
|
|
|
"Jump to next hunk",
|
|
|
|
opts = { expr = true },
|
|
|
|
},
|
2022-10-03 21:07:48 -04:00
|
|
|
|
2022-09-26 19:29:39 -04:00
|
|
|
["[c"] = {
|
|
|
|
function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
return "[c"
|
|
|
|
end
|
|
|
|
vim.schedule(function()
|
|
|
|
require("gitsigns").prev_hunk()
|
|
|
|
end)
|
|
|
|
return "<Ignore>"
|
|
|
|
end,
|
|
|
|
"Jump to prev hunk",
|
|
|
|
opts = { expr = true },
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Actions
|
2022-10-03 21:07:48 -04:00
|
|
|
["<leader>rh"] = {
|
2022-09-26 19:29:39 -04:00
|
|
|
function()
|
|
|
|
require("gitsigns").reset_hunk()
|
|
|
|
end,
|
|
|
|
"Reset hunk",
|
|
|
|
},
|
2022-10-03 21:07:48 -04:00
|
|
|
|
|
|
|
["<leader>ph"] = {
|
2022-09-26 19:29:39 -04:00
|
|
|
function()
|
|
|
|
require("gitsigns").preview_hunk()
|
|
|
|
end,
|
|
|
|
"Preview hunk",
|
|
|
|
},
|
2022-10-03 21:07:48 -04:00
|
|
|
|
|
|
|
["<leader>gb"] = {
|
2022-09-26 19:29:39 -04:00
|
|
|
function()
|
2022-10-03 21:07:48 -04:00
|
|
|
package.loaded.gitsigns.blame_line()
|
2022-09-26 19:29:39 -04:00
|
|
|
end,
|
|
|
|
"Blame line",
|
|
|
|
},
|
2022-10-03 21:07:48 -04:00
|
|
|
|
2022-09-26 19:29:39 -04:00
|
|
|
["<leader>td"] = {
|
|
|
|
function()
|
|
|
|
require("gitsigns").toggle_deleted()
|
|
|
|
end,
|
|
|
|
"Toggle deleted",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-08-22 03:49:15 -04:00
|
|
|
return M
|