This repository was archived by the owner on Sep 8, 2023. It is now read-only.
generated from AstroNvim/user_example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.lua
154 lines (132 loc) · 4.63 KB
/
mappings.lua
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)
return {
-- first key is the mode
n = {
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(
function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
vim.keymap.set("n", "<leader>r", "<cmd>lua vim.lsp.buf.rename()<cr>", {
desc = "replace variable under cursor",
}),
vim.keymap.set("n", "<leader>i", "<cmd>lua vim.lsp.buf.hover()<cr>", {}),
-- vim.keymap.set("n", "<leader>r", "<cmd>LspRename()<CR>", {
-- desc = "Replace variable under cursor",
-- }),
-- tables with the `name` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { name = "Buffers" },
-- ["<leader>t"] = { "<cmd>TestFile<cr>" },
-- ["<leader>t"] = {
-- function() require("neotest").run.run(vim.fn.expand "%") end,
-- },
["<leader>t"] = {
function() require("neotest").run.run { strategy = "dap" } end,
},
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
-- Harpoon
["<leader>h"] = false,
["<leader>ha"] = {
function() require("harpoon.mark").add_file() end,
},
["<leader>hm"] = {
function() require("harpoon.ui").toggle_quick_menu() end,
},
["<leader>hj"] = {
function() require("harpoon.ui").nav_next() end,
},
["<leader>hf"] = {
function() require("harpoon.ui").nav_prev() end,
},
["<leader>h1"] = {
function() require("harpoon.ui").nav_file(1) end,
},
["<leader>h2"] = {
function() require("harpoon.ui").nav_file(2) end,
},
["<leader>h3"] = {
function() require("harpoon.ui").nav_file(3) end,
},
["<leader>h4"] = {
function() require("harpoon.ui").nav_file(4) end,
},
["<leader>h5"] = {
function() require("harpoon.ui").nav_file(5) end,
},
["<leader>h6"] = {
function() require("harpoon.ui").nav_file(6) end,
},
["<leader>h7"] = {
function() require("harpoon.ui").nav_file(7) end,
},
["<leader>h8"] = {
function() require("harpoon.ui").nav_file(8) end,
},
["<leader>h9"] = {
function() require("harpoon.ui").nav_file(9) end,
},
["<leader>h0"] = {
function() require("harpoon.ui").nav_file(10) end,
},
-- for i=1,9,+1 do
-- ["<leader>h" .. i] = {
-- function()
-- require("harpoon.ui").nav_file(i)
-- end
-- },
-- end
["<leader>fH"] = { "<cmd>Telescope harpoon marks<cr>" },
-- Navbuddy
["<leader>N"] = { "<cmd>Navbuddy<cr>" }, -- change description but the same command
-- lsp-lines
["<leader>L"] = {
function() require("lsp_lines").toggle() end,
desc = "Toggle lsp_lines",
},
-- vs-tasks
["<leader>fv"] = { "<cmd>lua require('telescope').extensions.vstask.launch()<cr>" },
-- Spectre
vim.keymap.set("n", "<leader>s", '<cmd>lua require("spectre").open()<CR>', {
desc = "Open Spectre",
}),
vim.keymap.set("n", "<leader>sw", '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = "Search current word",
}),
vim.keymap.set("v", "<leader>sw", '<esc><cmd>lua require("spectre").open_visual()<CR>', {
desc = "Search current word",
}),
vim.keymap.set("n", "<leader>sp", '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = "Search on current file",
}),
--
["<leader>fp"] = {
function() require("telescope").extensions.project.project {} end,
},
["<leader>ft"] = { "<cmd>TodoTelescope<cr>" },
-- [z<leader>fr"] = {
--
-- }
-- goto-preview
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<cr>" },
["gpt"] = { "<cmd>lua require('goto-preview').goto_preview_type_definition()<cr>" },
["gpi"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<cr>" },
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<cr>" },
["gP"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<cr>" },
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
}