From 85e8aced46fecc5acbdf96bac5dc3af6217ba16e Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 2 Aug 2021 22:18:31 +0200 Subject: extract bindings into a seperate source file --- init.lua | 65 +++------------------------------------------------------------- 1 file changed, 3 insertions(+), 62 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index f7a38de..5ef81a0 100644 --- a/init.lua +++ b/init.lua @@ -1350,71 +1350,12 @@ vis.events.subscribe(vis.events.FILE_OPEN, function(file) lspc_open(ls, win, file) end) --- vis-lspc default bindings - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-start-server') -end, 'lspc: start lsp server') - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-open') -end, 'lspc: open current file') - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-definition') -end, 'lspc: jump to definition') - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-back') -end, 'lspc: go back position stack') - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-completion') -end, 'lspc: completion') - -vis:map(vis.modes.INSERT, '', 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, 'K', function() - vis:command('lspc-hover') -end, 'lspc: hover over current position') - -vis:map(vis.modes.NORMAL, '', function() - vis:command('lspc-signature-help') -end, 'lspc: signature help') - vis:option_register('lspc-highlight-diagnostics', 'bool', function(value) lspc.highlight_diagnostics = value return true end, 'Should lspc highlight diagnostics if available') +local source_str = debug.getinfo(1, 'S').source:sub(2) +local script_path = source_str:match('(.*/)') +dofile(script_path .. 'bindings.lua') return lspc -- cgit v1.2.3