|
|
|
@ -2,6 +2,7 @@ require('keymap')
|
|
|
|
|
require('plugins')
|
|
|
|
|
require('calcurse')
|
|
|
|
|
require('i3conf')
|
|
|
|
|
require('go')
|
|
|
|
|
|
|
|
|
|
-- prevent cursor override
|
|
|
|
|
vim.cmd('set guicursor=')
|
|
|
|
@ -9,6 +10,11 @@ vim.cmd('set guicursor=')
|
|
|
|
|
vim.cmd('filetype plugin indent on')
|
|
|
|
|
vim.cmd('set ts=4 sts=4 sw=4 expandtab')
|
|
|
|
|
|
|
|
|
|
-- clipboard
|
|
|
|
|
vim.cmd('set clipboard+=unnamedplus')
|
|
|
|
|
vim.keymap.set('n', '<leader>Y', '"+y')
|
|
|
|
|
vim.keymap.set('n', '<leader>P', '"+p')
|
|
|
|
|
|
|
|
|
|
-- hybrid numbering
|
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
|
vim.opt.number = true
|
|
|
|
@ -33,6 +39,7 @@ Transparent = true
|
|
|
|
|
-- timeouts
|
|
|
|
|
vim.opt.ttimeout = true
|
|
|
|
|
vim.opt.ttimeoutlen = 100
|
|
|
|
|
vim.o.updatetime = 250
|
|
|
|
|
|
|
|
|
|
-- nvim tree basics
|
|
|
|
|
|
|
|
|
@ -50,7 +57,7 @@ local lspconfig = require('lspconfig')
|
|
|
|
|
|
|
|
|
|
-- Go
|
|
|
|
|
lspconfig.gopls.setup{
|
|
|
|
|
cmd = {"gopls", "server"},
|
|
|
|
|
cmd = {"gopls", "serve"},
|
|
|
|
|
filetypes = {"go", "gomod"},
|
|
|
|
|
settings = {
|
|
|
|
|
gopls = {
|
|
|
|
@ -86,8 +93,45 @@ lspconfig.pylsp.setup{}
|
|
|
|
|
-- TypeScript
|
|
|
|
|
lspconfig.tsserver.setup{}
|
|
|
|
|
|
|
|
|
|
-- lsp mappingsd
|
|
|
|
|
-- Fix virtual text going off screen
|
|
|
|
|
vim.diagnostic.config({
|
|
|
|
|
virtual_text = false,
|
|
|
|
|
signs = true,
|
|
|
|
|
underline = true,
|
|
|
|
|
update_in_insert = false,
|
|
|
|
|
severity_sort = false,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
|
callback = function(ev)
|
|
|
|
|
-- custom colors
|
|
|
|
|
vim.cmd('hi DiagnosticUnderlineError cterm=undercurl guisp=Red')
|
|
|
|
|
-- key mappings
|
|
|
|
|
local opts = { buffer = ev.buf,}
|
|
|
|
|
-- error viewing
|
|
|
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>[d', vim.diagnostic.goto_prev, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>]d', vim.diagnostic.goto_next, opts)
|
|
|
|
|
-- def viewing/rename
|
|
|
|
|
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>H', vim.lsp.buf.hover, opts)
|
|
|
|
|
-- auto hover for error viewing
|
|
|
|
|
vim.api.nvim_create_autocmd("CursorHold", {
|
|
|
|
|
callback = function()
|
|
|
|
|
opts = {
|
|
|
|
|
buffer = ev.buf,
|
|
|
|
|
focusable = false,
|
|
|
|
|
border = 'rounded',
|
|
|
|
|
source = 'always',
|
|
|
|
|
prefix = ' ',
|
|
|
|
|
scope = 'cursor',
|
|
|
|
|
close_events = { "BufLeave","CursorMoved","InsertEnter","FocusLost" },
|
|
|
|
|
}
|
|
|
|
|
vim.diagnostic.open_float(nil, opts)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|