-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.lua
142 lines (139 loc) · 5 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
---@type MappingsTable
local M = {}
M.general = {
n = {
-- tmux
["<C-h>"] = { "<cmd> TmuxNavigateLeft<CR>", "window left", opts = { nowait = true } },
["<C-l>"] = { "<cmd> TmuxNavigateRight<CR>", "window right", opts = { nowait = true } },
["<C-j>"] = { "<cmd> TmuxNavigateDown<CR>", "window Down", opts = { nowait = true } },
["<C-k>"] = { "<cmd> TmuxNavigateUp", "window Up", opts = { nowait = true } },
--noh:
[";"] = { ":", "enter command mode", opts = { nowait = true } },
-- copy - paster - select all
["<C-a>"] = { "gg<S-v>G", "Select all", opts = { nowait = true, silent = true } },
["<c-c>"] = { '"+y', "copy", opts = { nowait = true } },
["<c-v>"] = { '"+p', "paster", opts = { nowait = true } },
["<S-Down>"] = { "<cmd>t.<cr>", " ", opts = { nowait = true } },
["<S-Up>"] = { "<cmd>t -1<cr>", " ", opts = { nowait = true } },
["<M-J>"] = { "<cmd>t.<cr>", " ", opts = { nowait = true } },
["<M-K>"] = { "<cmd>t -1<cr>", " ", opts = { nowait = true } },
-- Move
["<M-Down>"] = { "<cmd>m+<cr>", " ", opts = { nowait = true } },
["<M-Up>"] = { "<cmd>m-2<cr>", " ", opts = { nowait = true } },
["<M-j>"] = { "<cmd>m+<cr>", " ", opts = { nowait = true } },
["<M-k>"] = { "<cmd>m-2<cr>", " ", opts = { nowait = true } },
-- formater
["<C-f>"] = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", " ", opts = { nowait = true } },
["q"] = { "<cmd>q<cr>", " quit ", opts = { nowait = true } },
["<leader>bb"] = { "<cmd>tabnew<cr>", "new tab", opts = { nowait = true } },
["<leader>bc"] = { "<cmd>BufferLinePickClose<cr>", "pick close ", opts = { nowait = true } },
["<leader>bj"] = { "<cmd>BufferLinePick<cr>", "pick", opts = { nowait = true } },
["<leader>bt"] = { "<cmd>BufferLineSortByTabs<cr>", "Sort by tabs", opts = { nowait = true } },
-- redo, undo
["<C-z>"] = { "<cmd>redo<cr>", "redo", opts = { nowait = true, silent = true } },
-- New tab
["<leader>te"] = { ":tabedit<Return>", "new tab buffer", opts = { noremap = true, nowait = true, silent = true } },
["<leader>tn"] = { ":tabNext<Return>", "Next tab buffer", opts = { noremap = true, nowait = true, silent = true } },
["<leader>tp"] = { ":tabprev<Return>", "Prev tab buffer", opts = { noremap = true, nowait = true, silent = true } },
-- Split window
["<C-w><left>"] = { "<cmd>vertical resize +5<cr>", "Vertical size +5", opts = { nowait = true } },
["<C-w><right>"] = { "<cmd>vertical resize -5<cr>", "Vertical size -5", opts = { nowait = true } },
-- For a more complex keymap
["<leader>tt"] = {
function()
require("base46").toggle_transparency()
end,
"toggle transparency",
},
-- rust-tools
["<leader>rca"] = {
"<cmd> RustCodeAction <CR>",
"RustCodeActions",
opts = {},
},
["<leader>rch"] = {
"<cmd> RustHoverActions <CR>",
"RustHoverActions",
opts = { buffer = false },
},
["<leader>rcc"] = {
"<cmd> RustRunnables <CR>",
"RustRunnables",
opts = {},
},
["<leader>rcp"] = {
"<cmd> RustOpenCargo <CR>",
"RustOpenCargo",
opts = {},
},
["<leader>rcr"] = {
"<cmd> RustRun <CR>",
"RustRun",
opts = {},
},
["<leader>rct"] = {
"<cmd> RustTest <CR>",
"RustTest",
opts = {},
},
},
v = {
[">"] = { ">gv", "indent" },
["<A-j>"] = { ":m .+1<CR>==", "Alt up ", opts = { nowait = true } },
["<A-k>"] = { ":m .-2<CR>==", "Alt down", opts = { nowait = true } },
["p"] = { '"_dP', " ", opts = { nowait = true } },
["<c-c>"] = { '"+y', "coppy", opts = { nowait = true } },
["<c-v>"] = { '"+p', "paster", opts = { nowait = true } },
-- code Actions
["<leader>ca"] = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "code action", opts = { nowait = true } },
},
i = {
["<S-Down>"] = { "<cmd>t.<cr>", " ", opts = { nowait = true } },
["<M-Down>"] = { "<cmd>m+<cr>", " ", opts = { nowait = true } },
["<S-Up>"] = { "<cmd>t -1<cr>", " ", opts = { nowait = true } },
["<M-Up>"] = { "<cmd>m-2<cr>", " ", opts = { nowait = true } },
["<C-s>"] = { "<cmd>w<cr>", " ", opts = { nowait = true } },
-- ["<C-l>"] = { "<cmd>LiveServer start<cr><cr>", " ", opts = { nowait = true }},
["<C-f>"] = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", "Formatter", opts = { nowait = true } },
},
}
-- => debugger
M.dap = {
plugin = true,
n = {
["<leader>db"] = {
"<cmd> DapToggleBreakpoint <CR>",
"Add breakpoint at line",
},
["<leader>dr"] = {
"<cmd> DapContinue <CR>",
"Start or continue the debugger",
},
},
}
-- => debugger for python
M.dap_python = {
plugin = true,
n = {
["<leader>dpr"] = {
function()
require("dap-python").test_method()
end,
"test_method",
},
},
}
M.rust_tool = {
plugin = true,
n = {
["<leader>rca"] = {
"<cmd> RustHoverActions <CR>",
"Actions",
},
["<leader>rch"] = {
"<cmd> RustHoverRange <CR>",
"Actions",
},
},
}
return M