114 lines
2.6 KiB
Lua
114 lines
2.6 KiB
Lua
local M = {}
|
|
|
|
M.general = {
|
|
i = {},
|
|
|
|
n = {
|
|
["<ESC>"] = { "<cmd> noh <CR>", "no highlight"},
|
|
|
|
-- switch between windows
|
|
["<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" },
|
|
|
|
-- new buffer
|
|
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
|
|
|
|
-- close buffer + hide terminal buffer
|
|
["<leader>x"] = {
|
|
function()
|
|
require("core.utils").close_buffer()
|
|
end,
|
|
"close buffer",
|
|
}
|
|
},
|
|
}
|
|
|
|
M.telescope = {
|
|
plugin = true,
|
|
|
|
n = {
|
|
-- find
|
|
["<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>tk"] = { "<cmd> Telescope keymaps <CR>", "show keys" },
|
|
|
|
-- git
|
|
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "git commits" },
|
|
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "git status" },
|
|
|
|
-- theme switcher
|
|
["<leader>th"] = { "<cmd> Telescope colorscheme<CR>", "colorthemes" },
|
|
},
|
|
}
|
|
|
|
M.whichkey = {
|
|
plugin = true,
|
|
|
|
n = {
|
|
["<leader>wK"] = {
|
|
function()
|
|
vim.cmd "WhichKey"
|
|
end,
|
|
"which-key all keymaps",
|
|
},
|
|
["<leader>wk"] = {
|
|
function()
|
|
local input = vim.fn.input "WhichKey: "
|
|
vim.cmd("WhichKey " .. input)
|
|
end,
|
|
"which-key query lookup",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.comment = {
|
|
plugin = true,
|
|
|
|
-- toggle comment in both modes
|
|
n = {
|
|
["<leader>/"] = {
|
|
function()
|
|
require("Comment.api").toggle.linewise.current()
|
|
end,
|
|
"toggle comment",
|
|
},
|
|
},
|
|
|
|
v = {
|
|
["<leader>/"] = {
|
|
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
|
"toggle comment",
|
|
},
|
|
},
|
|
}
|
|
|
|
M.blankline = {
|
|
plugin = true,
|
|
|
|
n = {
|
|
["<leader>cc"] = {
|
|
function()
|
|
local ok, start = require("indent_blankline.utils").get_current_context(
|
|
vim.g.indent_blankline_context_patterns,
|
|
vim.g.indent_blankline_use_treesitter_scope
|
|
)
|
|
|
|
if ok then
|
|
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
|
|
vim.cmd [[normal! _]]
|
|
end
|
|
end,
|
|
|
|
"Jump to current_context",
|
|
},
|
|
},
|
|
}
|
|
|
|
return M
|