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() ...@@ -50,6 +50,7 @@ local function basic_configuration()
ttimeout = true; ttimeout = true;
timeoutlen = 100; timeoutlen = 100;
ttimeoutlen = 10; ttimeoutlen = 10;
updatetime = 400;
shiftround = true; shiftround = true;
encoding = "utf-8"; encoding = "utf-8";
magic = true; magic = true;
......
...@@ -15,27 +15,32 @@ end ...@@ -15,27 +15,32 @@ end
--- move to prev/next item in completion menuone --- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder --- jump to prev/next snippet's placeholder
_G.tab_complete = function() _G.tab_complete = function()
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
return t "<C-n>" return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)" return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then elseif check_back_space() then
return t "<Tab>" return t "<Tab>"
else else
return vim.fn['compe#complete']() return vim.fn['compe#complete']()
end end
end end
_G.s_tab_complete = function() _G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
return t "<C-p>" return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)" return t "<Plug>(vsnip-jump-prev)"
else else
return t "<S-Tab>" return t "<S-Tab>"
end end
end end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) 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("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("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}) 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{ ...@@ -10,3 +10,12 @@ lsp_config.gopls.setup{
lsp_config.rust_analyzer.setup{ lsp_config.rust_analyzer.setup{
capabilities = capabilities, 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() ...@@ -2,21 +2,16 @@ return require('packer').startup(function()
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
-- Color schemes -- Color schemes
use { use 'morhetz/gruvbox'
'morhetz/gruvbox',
-- config = function()
-- vim.cmd[[colo gruvbox]]
-- end
}
use 'icymind/NeoSolarized' use 'icymind/NeoSolarized'
use 'romgrk/doom-one.vim'
use { use {
'romgrk/doom-one.vim', 'tjdevries/gruvbuddy.nvim',
-- config = function() requires = {'tjdevries/colorbuddy.vim'},
-- vim.cmd[[colo doom-one]] config = function()
-- end require('colorbuddy').colorscheme('gruvbuddy')
end
} }
-- UI -- UI
...@@ -40,43 +35,6 @@ return require('packer').startup(function() ...@@ -40,43 +35,6 @@ return require('packer').startup(function()
requires = {'kyazdani42/nvim-web-devicons'} requires = {'kyazdani42/nvim-web-devicons'}
} }
use 'liuchengxu/vista.vim' 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 'kyazdani42/nvim-tree.lua'
use { use {
'AckslD/nvim-whichkey-setup.lua', 'AckslD/nvim-whichkey-setup.lua',
...@@ -85,7 +43,6 @@ return require('packer').startup(function() ...@@ -85,7 +43,6 @@ return require('packer').startup(function()
-- Utilities -- Utilities
use 'editorconfig/editorconfig-vim' use 'editorconfig/editorconfig-vim'
use 'tjdevries/colorbuddy.vim'
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
...@@ -96,13 +53,6 @@ return require('packer').startup(function() ...@@ -96,13 +53,6 @@ return require('packer').startup(function()
'nvim-treesitter/nvim-treesitter-textobjects' 'nvim-treesitter/nvim-treesitter-textobjects'
}, },
} }
use {
'tjdevries/gruvbuddy.nvim',
config = function()
require('colorbuddy').colorscheme('gruvbuddy')
end
}
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
...@@ -122,16 +72,56 @@ return require('packer').startup(function() ...@@ -122,16 +72,56 @@ return require('packer').startup(function()
'Shougo/echodoc.vim', 'Shougo/echodoc.vim',
config = function() config = function()
vim.cmd([[let g:echodoc#enable_at_startup = 1]]) vim.cmd [[let g:echodoc#enable_at_start=1]]
end 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 -- LSP
use 'neovim/nvim-lspconfig' use 'neovim/nvim-lspconfig'
use { use {
'RishabhRD/nvim-lsputils', 'RishabhRD/nvim-lsputils',
requires = {'RishabhRD/popfix'} requires = {'RishabhRD/popfix'},
disable = true
} }
use { use {
'glepnir/lspsaga.nvim', 'glepnir/lspsaga.nvim',
...@@ -139,44 +129,52 @@ return require('packer').startup(function() ...@@ -139,44 +129,52 @@ return require('packer').startup(function()
requires = {'neovim/nvim-lspconfig'}, requires = {'neovim/nvim-lspconfig'},
config = function() 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 end
} }
use { use {
'kosayoda/nvim-lightbulb', 'nvim-lua/lsp_extensions.nvim',
requires = {'neovim/nvim-lspconfig'},
disable = true,
config = function() config = function()
require('nvim-lightbulb').update_lightbulb { require('lsp_extensions').inlay_hints{
sign = { highlight = "Comment",
enabled = true, prefix = " » ",
-- Priority of the gutter sign aligned = true,
priority = 10, only_current_line = false,
}, enabled = { "ChainingHint" }
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 = "💡",
}
} }
end 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