-
Notifications
You must be signed in to change notification settings - Fork 0
/
mappings.lua
191 lines (176 loc) · 5.21 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
local M = {}
-- add this table only when you want to disable default keys
M.disabled = {
n = {
["<C-n>"] = "",
["<leader>n"] = "",
-- default lsp mappings
["<leader>f"] = "",
["<leader>q"] = "",
["[d"] = "",
["d]"] = "",
["gD"] = "",
["gd"] = "",
["gi"] = "",
["gr"] = "",
}
}
M.convenience = {
n = {
[";"] = { ":", ":" }, -- let's try to switch ; and :
[":"] = { ";", ";" } -- let's try to switch ; and :
},
v = {
[";"] = { ":", ":" }, -- let's try to switch ; and :
[":"] = { ";", ";" } -- let's try to switch ; and :
},
i = {
["jk"] = { "<esc>l", "escape to normal mode"}
},
}
M.navigation = {
n = {
["H"] = { "^", "beginning of line" },
["L"] = { "$", "end of line" },
},
v = {
["H"] = { "^", "beginning of line" },
["L"] = { "$", "end of line" },
},
}
M.windows = {
n = {
["<leader>w|"] = { "<cmd>:vsplit<cr>", "split window vertically" },
["<leader>w-"] = { "<cmd>:split<cr>", "split window horizontally" },
["<leader>wq"] = { "<cmd>:q<cr>", "quit" },
["<leader>wQ"] = { "<cmd>:q!<cr>", "quit!" },
["<leader>ws"] = { "<cmd>:w<cr>", "save" },
}
}
M.lsp = {
n = {
["<leader>lj"] = { "<cmd>:vsplit<cr>", "split window vertically" },
["<leader>lk"] = { "<cmd>:split<cr>", "split window horizontally" },
}
}
M.toggle = {
n = {
["<leader>oN"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" },
["<leader>on"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" },
["<leader>or"] = { "<cmd> set rnu! <CR>", "toggle relative number" },
["<leader>ot"] = {
function()
require("base46").toggle_theme()
end,
"toggle theme",
},
["<leader>ogm"] = { "<cmd> TZMinimalist <CR>", "toggle zen-minimal" },
["<leader>ogf"] = { "<cmd> TZFocus <CR>", "toggle zen-focus" },
["<leader>oga"] = { "<cmd> TZAtaraxis<CR>", "toggle zen-artar" },
["Z"] = { "<cmd> TZFocus <CR>", "toggle zen-focus" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<leader>tf"] = { "<cmd> Telescope find_files <CR>", "find files" },
["<leader>ta"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "find all" },
["<leader>tw"] = { "<cmd> Telescope live_grep <CR>", "live grep" },
["<leader>tb"] = { "<cmd> Telescope buffers <CR>", "find buffers" },
["<leader>td"] = { "<cmd> Telescope diagnostics <CR>", "find diagnostics" },
-- ["<leader>th"] = { "<cmd> Telescope help_tags <CR>", "help page" },
["<leader>to"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" },
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", "show keys" },
-- git
["<leader>tm"] = { "<cmd> Telescope git_commits <CR>", "git commits" },
["<leader>tg"] = { "<cmd> Telescope git_status <CR>", "git status" },
-- pick a hidden term
["<leader>tt"] = { "<cmd> Telescope terms <CR>", "pick hidden term" },
-- theme switcher
["<leader>th"] = { "<cmd> Telescope themes <CR>", "nvchad themes" },
},
}
M.packer = {
n = {
["<leader>pi"] = { "<cmd> PackerStatus <CR>", "packer status" },
["<leader>pc"] = { "<cmd> PackerCompile <CR>", "packer compile" },
["<leader>ps"] = { "<cmd> PackerSync <CR>", "packer sync" },
},
}
M.easymotion = {
n = {
["<leader>ml"] = { "<cmd> HopLineMW <CR>", "hop to line" },
["<leader>ma"] = { "<cmd> HopAnywhereMW <CR>", "hop to anywhere" },
["<leader>mw"] = { "<cmd> HopWordMW <CR>", "hop to word" },
},
}
M.lspconfig = {
plugin = true,
n = {
["<leader>lk"] = {
function()
vim.diagnostic.goto_prev({ float = { border = 'rounded' }})
end,
"lsp goto_prev",
},
["<leader>lj"] = {
function()
vim.diagnostic.goto_next({ float = { border = 'rounded' }})
end,
"lsp goto_next",
},
["<leader>ls"] = {
function()
vim.diagnostic.open_float({ border = 'rounded' })
end,
"lsp show",
},
["<leader>lr"] = {
function()
vim.lsp.buf.references()
end,
"lsp references",
},
["<leader>lf"] = {
function()
vim.lsp.buf.formatting {}
end,
"lsp formatting",
},
["<leader>lq"] = {
function()
vim.diagnostic.setloclist()
end,
"lsp setloclist",
},
["<leader>lD"] = {
function()
vim.lsp.buf.declaration()
end,
"lsp declaration",
},
["<leader>ld"] = {
function()
vim.lsp.buf.definition()
end,
"lsp definition",
},
["<leader>li"] = {
function()
vim.lsp.buf.implementation()
end,
"lsp implementation",
},
},
}
local opts_sn = {silent = true, noremap = true,}
M.tmux_vim_nav = {
n = {
["<C-h>"] = {":lua require'nvim-tmux-navigation'.NvimTmuxNavigateLeft() <cr>", "vim-tmux-left", opts=opts_sn},
["<C-j>"] = {":lua require'nvim-tmux-navigation'.NvimTmuxNavigateDown() <cr>", "vim-tmux-down", opts=opts_sn},
["<C-k>"] = {":lua require'nvim-tmux-navigation'.NvimTmuxNavigateUp() <cr>", "vim-tmux-up", opts=opts_sn},
["<C-l>"] = {":lua require'nvim-tmux-navigation'.NvimTmuxNavigateRight()<cr>", "vim-tmux-right", opts=opts_sn},
},
}
return M