Commit c348c627 authored by Tim van Deurzen's avatar Tim van Deurzen

Updated keybindings, LSP diagnostics and a few plugins.

parent 7a218dbc
......@@ -50,6 +50,7 @@ local function basic_configuration()
ttimeout = true;
timeoutlen = 100;
ttimeoutlen = 10;
updatetime = 400;
shiftround = true;
encoding = "utf-8";
magic = true;
......
......@@ -15,27 +15,32 @@ end
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
_G.tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
return t "<S-Tab>"
end
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
return t "<S-Tab>"
end
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
local opts = {noremap = true, silent = true, expr = true}
vim.api.nvim_set_keymap("i", "<CR>", [[compe#confirm('<cr>')]], opts)
vim.api.nvim_set_keymap("i", "<c-c>", [[compe#complete()]], opts)
vim.api.nvim_set_keymap("i", "<c-e>", [[compe#close('<c-e>')]], opts)
local rhs_options = {}
vim.api.nvim_set_keymap("")
function rhs_options:new()
local instance = {
cmd = '',
options = {
noremap = false,
silent = false,
expr = false,
nowait = false,
}
}
setmetatable(instance,self)
self.__index = self
return instance
end
function rhs_options:map_cmd(cmd_string)
self.cmd = cmd_string
return self
end
function rhs_options:map_cr(cmd_string)
self.cmd = (":%s<CR>"):format(cmd_string)
return self
end
function rhs_options:map_args(cmd_string)
self.cmd = (":%s<Space>"):format(cmd_string)
return self
end
function rhs_options:map_cu(cmd_string)
self.cmd = (":<C-u>%s<CR>"):format(cmd_string)
return self
end
function rhs_options:with_silent()
self.options.silent = true
return self
end
function rhs_options:with_noremap()
self.options.noremap = true
return self
end
function rhs_options:with_expr()
self.options.expr = true
return self
end
function rhs_options:with_nowait()
self.options.nowait = true
return self
end
local pbind = {}
function pbind.map_cr(cmd_string)
local ro = rhs_options:new()
return ro:map_cr(cmd_string)
end
function pbind.map_cmd(cmd_string)
local ro = rhs_options:new()
return ro:map_cmd(cmd_string)
end
function pbind.map_cu(cmd_string)
local ro = rhs_options:new()
return ro:map_cu(cmd_string)
end
function pbind.map_args(cmd_string)
local ro = rhs_options:new()
return ro:map_args(cmd_string)
end
function pbind.nvim_load_mapping(mapping)
for key,value in pairs(mapping) do
local mode,keymap = key:match("([^|]*)|?(.*)")
if type(value) == 'table' then
local rhs = value.cmd
local options = value.options
vim.api.nvim_set_keymap(mode,keymap,rhs,options)
end
end
end
return pbind
......@@ -10,3 +10,12 @@ lsp_config.gopls.setup{
lsp_config.rust_analyzer.setup{
capabilities = capabilities,
}
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
virtual_text = false,
signs = true,
update_in_insert = true,
}
)
......@@ -2,21 +2,16 @@ return require('packer').startup(function()
use 'wbthomason/packer.nvim'
-- Color schemes
use {
'morhetz/gruvbox',
-- config = function()
-- vim.cmd[[colo gruvbox]]
-- end
}
use 'morhetz/gruvbox'
use 'icymind/NeoSolarized'
use 'romgrk/doom-one.vim'
use {
'romgrk/doom-one.vim',
'tjdevries/gruvbuddy.nvim',
-- config = function()
-- vim.cmd[[colo doom-one]]
-- end
requires = {'tjdevries/colorbuddy.vim'},
config = function()
require('colorbuddy').colorscheme('gruvbuddy')
end
}
-- UI
......@@ -40,43 +35,6 @@ return require('packer').startup(function()
requires = {'kyazdani42/nvim-web-devicons'}
}
use 'liuchengxu/vista.vim'
use {
'hrsh7th/nvim-compe',
config = function()
require('compe').setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = true;
buffer = true;
calc = true;
nvim_lsp = true;
nvim_lua = true;
vsnip = true;
};
}
end,
requires = {
{
'hrsh7th/vim-vsnip',
requires = {'hrsh7th/vim-vsnip-integ'}
}
}
}
use 'kyazdani42/nvim-tree.lua'
use {
'AckslD/nvim-whichkey-setup.lua',
......@@ -85,7 +43,6 @@ return require('packer').startup(function()
-- Utilities
use 'editorconfig/editorconfig-vim'
use 'tjdevries/colorbuddy.vim'
use {
'nvim-treesitter/nvim-treesitter',
......@@ -96,13 +53,6 @@ return require('packer').startup(function()
'nvim-treesitter/nvim-treesitter-textobjects'
},
}
use {
'tjdevries/gruvbuddy.nvim',
config = function()
require('colorbuddy').colorscheme('gruvbuddy')
end
}
use {
'nvim-telescope/telescope.nvim',
......@@ -122,16 +72,56 @@ return require('packer').startup(function()
'Shougo/echodoc.vim',
config = function()
vim.cmd([[let g:echodoc#enable_at_startup = 1]])
vim.cmd [[let g:echodoc#enable_at_start=1]]
end
}
-- Completion
use {
'hrsh7th/nvim-compe',
config = function()
require('compe').setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = true;
buffer = true;
calc = true;
nvim_lsp = true;
nvim_lua = true;
vsnip = true;
};
}
end,
requires = {
{
'hrsh7th/vim-vsnip',
requires = {'hrsh7th/vim-vsnip-integ'}
}
}
}
-- LSP
use 'neovim/nvim-lspconfig'
use {
'RishabhRD/nvim-lsputils',
requires = {'RishabhRD/popfix'}
requires = {'RishabhRD/popfix'},
disable = true
}
use {
'glepnir/lspsaga.nvim',
......@@ -139,44 +129,52 @@ return require('packer').startup(function()
requires = {'neovim/nvim-lspconfig'},
config = function()
require('lspsaga').init_lsp_saga()
require('lspsaga').init_lsp_saga {
error_sign = '•',
warn_sign = '•',
hint_sign = '•',
infor_sign = '•',
code_action_icon = '?',
border_style = 2,
code_action_prompt = {
enable = true,
sign = true,
sign_priority = 20,
virtual_text = false,
},
code_action_keys = {
quit = '<esc>',
exec = '<CR>'
},
finder_action_keys = {
open = 'o',
vsplit = 's',
split = 'i',
quit = '<esc>',
scroll_down = '<C-n>',
scroll_up = '<C-p>'
},
}
vim.api.nvim_command [[
autocmd CursorHold,CursorHoldI * :lua require('lspsaga.diagnostic').show_line_diagnostics()
]]
end
}
use {
'kosayoda/nvim-lightbulb',
'nvim-lua/lsp_extensions.nvim',
requires = {'neovim/nvim-lspconfig'},
disable = true,
config = function()
require('nvim-lightbulb').update_lightbulb {
sign = {
enabled = true,
-- Priority of the gutter sign
priority = 10,
},
float = {
enabled = true,
-- Text to show in the popup float
text = "💡",
-- Available keys for window options:
-- - height of floating window
-- - width of floating window
-- - wrap_at character to wrap at for computing height
-- - max_width maximal width of floating window
-- - max_height maximal height of floating window
-- - pad_left number of columns to pad contents at left
-- - pad_right number of columns to pad contents at right
-- - pad_top number of lines to pad contents at top
-- - pad_bottom number of lines to pad contents at bottom
-- - offset_x x-axis offset of the floating window
-- - offset_y y-axis offset of the floating window
-- - anchor corner of float to place at the cursor (NW, NE, SW, SE)
-- - winblend transparency of the window (0-100)
win_opts = {},
},
virtual_text = {
enabled = false,
-- Text to show at virtual text
text = "💡",
}
require('lsp_extensions').inlay_hints{
highlight = "Comment",
prefix = " » ",
aligned = true,
only_current_line = false,
enabled = { "ChainingHint" }
}
end
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment