/
mappings.lua
130 lines (123 loc) · 2.43 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
---@type MappingsTable
local M = {}
M.general = {
n = {
[";"] = { ":", "enter command mode", opts = { nowait = true } },
},
v = {
[">"] = { ">gv", "indent" },
},
}
M.dap = {
plugin = true,
n = {
["<leader>db"] = {
"<cmd> DapToggleBreakpoint <CR>",
"Add breakpoint at line",
},
["<leader>dus"] = {
function()
local widgets = require "dap.ui.widgets"
local sidebar = widgets.sidebar(widgets.scopes)
sidebar.open()
end,
"Open debugging sidebar",
},
},
}
M.dap_go = {
plugin = true,
n = {
["<leader>dgt"] = {
function()
require("dap-go").debug_test()
end,
"Debug go test",
},
["<leader>dgl"] = {
function()
require("dap-go").debug_last()
end,
"Debug last go test",
},
},
}
M.gopher = {
plugin = true,
n = {
["<leader>gsj"] = {
"<cmd> GoTagAdd json <CR>",
"Add json struct tags",
},
["<leader>gsy"] = {
"<cmd> GoTagAdd yaml <CR>",
"Add yaml struct tags",
},
},
}
M.tabufline = {
plugin = true,
n = {
["<leader>tg"] = {
function()
local tabline = require "nvchad.tabufline"
local t_idx_str = vim.fn.input "Enter Tab number: "
local tidx = tonumber(t_idx_str)
local bufs = tabline.bufilter() or {}
if tidx > #bufs or tidx < 1 then
print("Invalid tab number input is " .. tidx .. " len is " .. #bufs)
return
end
vim.cmd("b" .. bufs[tidx])
end,
"Goto assign tab",
},
["<leader>tl"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
"Goto next tab",
},
["<leader>th"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto pre tab",
},
["<leader>txr"] = {
function()
require("nvchad.tabufline").closeBufs_at_direction "right"
end,
"Close tab to right",
},
["<leader>txo"] = {
function()
require("nvchad.tabufline").closeOtherBufs()
end,
"Close other tab",
},
},
}
M.nvim_window = {
n = {
["<leader>wp"] = {
function()
require("nvim-window").pick()
end,
"Pick window",
},
["<C-w>p"] = {
function()
require("nvim-window").pick()
end,
"Pick window",
},
},
}
M.disabled = {
n = {
["<tab>"] = "",
["<S-tab>"] = "",
},
}
return M