vis-config

lua scripts to configure vis editor

git clone https://9o.is/git/vis-config.git

bindings.lua

(2462B)


      1 -- Copyright (c) 2021 Florian Fischer. All rights reserved.
      2 --
      3 -- This file is part of vis-lspc.
      4 --
      5 -- vis-lspc is free software: you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation, either version 3 of the License, or (at your option) any later
      8 -- version.
      9 --
     10 -- vis-lspc is distributed in the hope that it will be useful, but WITHOUT ANY
     11 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     12 -- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
     13 --
     14 -- You should have received a copy of the GNU General Public License along with
     15 -- vis-lspc found in the LICENSE file. If not, see <https://www.gnu.org/licenses/>.
     16 --
     17 -- vis-lspc default bindings
     18 vis:map(vis.modes.NORMAL, '<F2>', function()
     19   vis:command('lspc-start-server')
     20 end, 'lspc: start lsp server')
     21 
     22 vis:map(vis.modes.NORMAL, '<F3>', function()
     23   vis:command('lspc-open')
     24 end, 'lspc: open current file')
     25 
     26 vis:map(vis.modes.NORMAL, '<C-]>', function()
     27   vis:command('lspc-definition')
     28 end, 'lspc: jump to definition')
     29 
     30 vis:map(vis.modes.NORMAL, '<C-t>', function()
     31   vis:command('lspc-back')
     32 end, 'lspc: go back position stack')
     33 
     34 vis:map(vis.modes.NORMAL, '<C- >', function()
     35   vis:command('lspc-completion')
     36 end, 'lspc: completion')
     37 
     38 vis:map(vis.modes.INSERT, '<C- >', function()
     39   vis:command('lspc-completion')
     40   vis.mode = vis.modes.INSERT
     41 end, 'lspc: completion')
     42 
     43 -- bindings inspired by nvim
     44 -- https://github.com/neovim/nvim-lspconfig
     45 vis:map(vis.modes.NORMAL, 'gD', function()
     46   vis:command('lspc-declaration')
     47 end, 'lspc: jump to declaration')
     48 
     49 vis:map(vis.modes.NORMAL, 'gd', function()
     50   vis:command('lspc-definition')
     51 end, 'lspc: jump to definition')
     52 
     53 vis:map(vis.modes.NORMAL, 'gi', function()
     54   vis:command('lspc-implementation')
     55 end, 'lspc: jump to implementation')
     56 
     57 vis:map(vis.modes.NORMAL, 'gr', function()
     58   vis:command('lspc-references')
     59 end, 'lspc: show references')
     60 
     61 vis:map(vis.modes.NORMAL, ' D', function()
     62   vis:command('lspc-typeDefinition')
     63 end, 'lspc: jump to type definition')
     64 
     65 vis:map(vis.modes.NORMAL, ' e', function()
     66   vis:command('lspc-show-diagnostics')
     67 end, 'lspc: show diagnostic of current line')
     68 
     69 vis:map(vis.modes.NORMAL, 'K', function()
     70   vis:command('lspc-hover')
     71 end, 'lspc: hover over current position')
     72 
     73 vis:map(vis.modes.NORMAL, '<C-K>', function()
     74   vis:command('lspc-signature-help')
     75 end, 'lspc: signature help')