-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeymaps.lua
More file actions
54 lines (46 loc) · 1.9 KB
/
keymaps.lua
File metadata and controls
54 lines (46 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-- @brief Keymaps user config for hammerill.nvim
--
-- Assumes the plugin manager was loaded.
-- Editor keymaps
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Keep cursor in center when scroll up" })
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Keep cursor in center when scroll down" })
vim.keymap.set("n", "n", "nzz", { desc = "Keep cursor in center when search next" })
vim.keymap.set("n", "N", "Nzz", { desc = "Keep cursor in center when search prev" })
-- LSP keymaps
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename, { desc = "LSP rename a symbol" })
-- Telescope keymaps
local telescope = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", telescope.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fg", telescope.live_grep, { desc = "Telescope live grep" })
vim.keymap.set("n", "<leader>fb", telescope.buffers, { desc = "Telescope buffers" })
vim.keymap.set("n", "<leader>fh", telescope.help_tags, { desc = "Telescope help tags" })
-- File tree keymaps
local tree = require("nvim-tree.api").tree
vim.keymap.set("n", "<leader>to", tree.open, { desc = "File tree open" })
vim.keymap.set("n", "<leader>tc", tree.close, { desc = "File tree close" })
vim.keymap.set("n", "<leader>tt", tree.toggle, { desc = "File tree toggle" })
vim.keymap.set("n", "<leader>tf", tree.focus, { desc = "File tree focus" })
vim.keymap.set("n", "<leader>tr", tree.reload, { desc = "File tree reload" })
-- Define the object containing methods to export
local exported = {}
-- Export autocompletion plugin mapping
function exported.exportCmpMapping(cmp)
return {
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
}
end
-- Export the defined object
return exported