aboutsummaryrefslogtreecommitdiff
path: root/.config/vis/plugins/vis-lspc/bindings.lua
blob: 7859ebbbfb8f9ff6235544edc3cb481d4e2f500a (plain)
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
-- Copyright (c) 2021 Florian Fischer. All rights reserved.
--
-- This file is part of vis-lspc.
--
-- vis-lspc is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software
-- Foundation, either version 3 of the License, or (at your option) any later
-- version.
--
-- vis-lspc is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with
-- vis-lspc found in the LICENSE file. If not, see <https://www.gnu.org/licenses/>.
--
-- vis-lspc default bindings
vis:map(vis.modes.NORMAL, '<F2>', function()
  vis:command('lspc-start-server')
end, 'lspc: start lsp server')

vis:map(vis.modes.NORMAL, '<F3>', function()
  vis:command('lspc-open')
end, 'lspc: open current file')

vis:map(vis.modes.NORMAL, '<C-]>', function()
  vis:command('lspc-definition')
end, 'lspc: jump to definition')

vis:map(vis.modes.NORMAL, '<C-t>', function()
  vis:command('lspc-back')
end, 'lspc: go back position stack')

vis:map(vis.modes.NORMAL, '<C- >', function()
  vis:command('lspc-completion')
end, 'lspc: completion')

vis:map(vis.modes.INSERT, '<C- >', function()
  vis:command('lspc-completion')
  vis.mode = vis.modes.INSERT
end, 'lspc: completion')

-- bindings inspired by nvim
-- https://github.com/neovim/nvim-lspconfig
vis:map(vis.modes.NORMAL, 'gD', function()
  vis:command('lspc-declaration')
end, 'lspc: jump to declaration')

vis:map(vis.modes.NORMAL, 'gd', function()
  vis:command('lspc-definition')
end, 'lspc: jump to definition')

vis:map(vis.modes.NORMAL, 'gi', function()
  vis:command('lspc-implementation')
end, 'lspc: jump to implementation')

vis:map(vis.modes.NORMAL, 'gr', function()
  vis:command('lspc-references')
end, 'lspc: show references')

vis:map(vis.modes.NORMAL, ' D', function()
  vis:command('lspc-typeDefinition')
end, 'lspc: jump to type definition')

vis:map(vis.modes.NORMAL, ' e', function()
  vis:command('lspc-show-diagnostics')
end, 'lspc: show diagnostic of current line')

vis:map(vis.modes.NORMAL, ' n', function()
  vis:command('lspc-next-diagnostic')
end, 'lspc: jump to the next available diagnostic')

vis:map(vis.modes.NORMAL, ' N', function()
  vis:command('lspc-prev-diagnostic')
end, 'lspc: jump to the previous available diagnostic')

vis:map(vis.modes.NORMAL, 'K', function()
  vis:command('lspc-hover')
end, 'lspc: hover over current position')

vis:map(vis.modes.NORMAL, '<C-K>', function()
  vis:command('lspc-signature-help')
end, 'lspc: signature help')

vis:map(vis.modes.NORMAL, ' o', function()
  vis:command('lspc-navigate-symbols')
end, 'lspc: symbol navigation window')