-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
109 lines (99 loc) · 3.69 KB
/
init.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
require('keymap.remap')
local keymap = require('core.keymap')
local nmap, imap, xmap = keymap.nmap, keymap.imap, keymap.xmap
local silent, noremap, expr, remap = keymap.silent, keymap.noremap, keymap.expr, keymap.remap
local opts = keymap.new_opts
local cmd, cu = keymap.cmd, keymap.cu
nmap({
-- packer
{ '<Leader>pu', cmd('Lazy update') },
{ '<Leader>pi', cmd('Lazy install') },
-- Lsp
{ '<Leader>li', cmd('LspInfo') },
{ '<Leader>ll', cmd('LspLog') },
{ '<Leader>lr', cmd('LspRestart') },
-- Lspsaga
{ '[e', cmd('Lspsaga diagnostic_jump_next') },
{ ']e', cmd('Lspsaga diagnostic_jump_prev') },
{ '[c', cmd('lspsaga show_cursor_diagnostics') },
{ 'K', cmd('Lspsaga hover_doc') },
{ 'ga', cmd('Lspsaga code_action') },
{ 'gd', cmd('Lspsaga peek_definition') },
{ 'gp', cmd('Lspsaga goto_definition') },
{ 'gs', cmd('Lspsaga signature_help') },
{ 'gr', cmd('Lspsaga rename') },
{ 'gf', cmd('Lspsaga finder') },
{ 'gh', cmd('!Open -a Arc https://github.com/RakerZh') },
-- { '<Leader>g', cmd('Lspsaga term_toggle lazygit') },
{ '<Leader>o', cmd('Lspsaga outline') },
-- dashboard create file
{ '<Leader>n', cmd('DashboardNewFile') },
{ '<Leader>ll', cmd('Lspsaga show_line_diagnostics') },
{ '<Leader>ci', cmd('Lspsaga incoming_calls') },
{ '<Leader>co', cmd('Lspsaga outgoing_calls') },
{ '<Leader>ss', cmd('SessionSave') },
{ '<Leader>sl', cmd('SessionLoad') },
-- nvimtree
--{'<Leader>kh',cmd('NvimTreeResize -10'),opts(noremap,silent)},
--{'<Leader>kl',cmd('NvimTreeResize +2'),opts(noremap,silent)},
{ '<Leader>d', cmd('DiffviewOpen') },
{ '<Leader>e', cmd('Neotree toggle') },
-- Telescope
{ '<Leader>tb', cmd('Telescope buffers') },
{ '<Leader>fa', cmd('Telescope live_grep') },
-- { '<Leader>fb', cmd('Telescope file_browser') },
{ '<Leader>ff', cmd('Telescope find_files') },
{ '<Leader>fs', cmd('Telescope git_status') },
{ '<Leader>fk', cmd('Telescope keymaps') },
{ '<Leader>fw', cmd('Telescope grep_string') },
{ '<Leader>fo', cmd('Telescope oldfiles') },
{ '<Leader>ft', cmd('Telescope help_tags') },
{ '<Leader>fg', cmd('Telescope git_commits') },
-- zoxide
{ '<Leader>fq', cmd('Telescope zoxide list') },
{ '<Leader>r', cmd('Rapid') },
-- TrailBlazer
{ 'mn', cmd('TrailBlazerNewTrailMark') },
{ '<Leader>k', cmd('TrailBlazerPeekMovePreviousUp') },
{ '<Leader>j', cmd('TrailBlazerPeekMoveNextDown') },
{ '<Leader>md', cmd('TrailBlazerDeleteAllTrailMarks') },
{ '<Leader>ml', cmd('TrailBlazerToggleTrailMarkList') },
{ '<Leader>ms', cmd('TrailBlazerSaveSession') },
{ '<Leader>mls', cmd('TrailBlazerLoadSession') },
{ '<Leader>mds', cmd('TrailBlazerDeleteSession') },
{ '<Leader>b', cmd('FlyBuf') },
{
'<Leader>tm',
function()
return ':Template '
end,
opts(expr),
},
-- { '<Leader>fn', cmd('Navbuddy') },
})
-- coman
nmap({ 'gcc', '<cmd>ComComment<cr>' })
xmap({ 'gcc', ':ComComment<CR>' })
nmap({ 'gcj', '<cmd>ComAnnotation<Cr>' })
-- Lspsaga floaterminal
nmap({ '<A-d>', cmd('Lspsaga open_floaterm') })
vim.keymap.set({ 'n', 't' }, '<A-d>', cmd('Lspsaga term_toggle'))
vim.keymap.set({ 'n' }, '<Leader>g', cmd('Lspsaga term_toggle lazygit'))
vim.keymap.set({ 'n', 'x' }, '<leader>sr', function()
require('ssr').open()
end)
-- For using enter as completion, may conflict with some autopair plugin
vim.keymap.set('i', '<cr>', function()
if vim.fn.pumvisible() == 1 then
return '<C-y>'
end
return '<cr>'
end, { expr = true, noremap = true })
-- nvim-autopair compatibility
vim.keymap.set('i', '<cr>', function()
if vim.fn.pumvisible() == 1 then
return '<C-y>'
end
return require('nvim-autopairs').autopairs_cr()
end, { expr = true, noremap = true })
xmap({ 'ga', cmd('Lspsaga code_action') })