2023-10-08 14:57:57 +00:00
|
|
|
--[ GLOBAL ]--
|
|
|
|
|
|
|
|
vim.o.background = "dark"
|
|
|
|
vim.cmd([[colorscheme gruvbox]])
|
|
|
|
vim.g.mapleader = ";"
|
|
|
|
vim.o.signcolumn = "yes"
|
|
|
|
vim.wo.number = true
|
|
|
|
vim.wo.relativenumber = true
|
|
|
|
vim.wo.cursorline = true
|
2023-10-23 17:44:56 +00:00
|
|
|
vim.opt.termguicolors = true
|
2023-10-23 19:33:27 +00:00
|
|
|
vim.o.mousemoveevent = true
|
2023-10-08 14:57:57 +00:00
|
|
|
|
|
|
|
--[ LSPCONFIG ]--
|
|
|
|
|
|
|
|
local on_attach = function(_, bufnr)
|
|
|
|
|
|
|
|
local bufmap = function(keys, func)
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = bufnr })
|
|
|
|
end
|
|
|
|
|
|
|
|
bufmap('<leader>r', vim.lsp.buf.rename)
|
|
|
|
bufmap('<leader>a', vim.lsp.buf.code_action)
|
|
|
|
|
|
|
|
bufmap('gd', vim.lsp.buf.definition)
|
|
|
|
bufmap('gD', vim.lsp.buf.declaration)
|
|
|
|
bufmap('gI', vim.lsp.buf.implementation)
|
|
|
|
bufmap('<leader>D', vim.lsp.buf.type_definition)
|
|
|
|
|
|
|
|
bufmap('gr', require('telescope.builtin').lsp_references)
|
|
|
|
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
|
|
|
|
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
|
|
|
|
|
|
|
bufmap('K', vim.lsp.buf.hover)
|
|
|
|
|
|
|
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
|
|
vim.lsp.buf.format()
|
|
|
|
end, {})
|
|
|
|
end
|
|
|
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
|
|
|
|
require('neodev').setup()
|
|
|
|
require'lspconfig'.nil_ls.setup{ on_attach = on_attach, capabilities = capabilities }
|
|
|
|
require'lspconfig'.pyright.setup{ on_attach = on_attach, capabilities = capabilities }
|
|
|
|
require'lspconfig'.gopls.setup{ on_attach = on_attach, capabilities = capabilities }
|
2023-10-13 08:08:32 +00:00
|
|
|
require'lspconfig'.terraformls.setup{ on_attach = on_attach, capabilities = capabilities }
|
2023-10-08 14:57:57 +00:00
|
|
|
|
|
|
|
--[ LEAP ]--
|
|
|
|
|
|
|
|
require('leap').add_default_mappings()
|
|
|
|
-- Don't remap 'x' in visual mode.
|
|
|
|
vim.keymap.del({'x', 'o'}, 'x')
|
|
|
|
vim.keymap.del({'x', 'o'}, 'X')
|
|
|
|
|
|
|
|
--[ TELESCOPE ]--
|
|
|
|
|
|
|
|
local builtin = require('telescope.builtin')
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
|
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
|
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
|
|
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
|
|
|
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
|
|
|
|
|
|
|
|
require('telescope').setup{
|
|
|
|
pickers = {
|
|
|
|
find_files = {
|
|
|
|
theme = "dropdown"
|
|
|
|
},
|
|
|
|
live_grep = {
|
|
|
|
theme = "dropdown"
|
|
|
|
},
|
|
|
|
buffers = {
|
|
|
|
theme = "dropdown"
|
|
|
|
},
|
|
|
|
lsp_references = {
|
|
|
|
theme = "dropdown"
|
|
|
|
},
|
|
|
|
lsp_document_symbols = {
|
|
|
|
theme = "dropdown"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--[ COMMENTARY ]--
|
2023-10-13 08:08:32 +00:00
|
|
|
|
2023-10-08 14:57:57 +00:00
|
|
|
vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
|
|
|
|
|
|
|
|
--[ GITSIGNS ]--
|
2023-10-13 08:08:32 +00:00
|
|
|
|
2023-10-08 14:57:57 +00:00
|
|
|
require("gitsigns").setup()
|
|
|
|
|
|
|
|
--[ CMP ]--
|
|
|
|
|
|
|
|
local cmp = require('cmp')
|
2023-10-13 10:26:56 +00:00
|
|
|
local luasnip = require('luasnip')
|
|
|
|
|
|
|
|
require('luasnip.loaders.from_vscode').lazy_load()
|
|
|
|
luasnip.config.setup {}
|
2023-10-08 14:57:57 +00:00
|
|
|
|
|
|
|
cmp.setup {
|
2023-10-13 10:26:56 +00:00
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
luasnip.lsp_expand(args.body)
|
|
|
|
end,
|
|
|
|
},
|
2023-10-08 14:57:57 +00:00
|
|
|
mapping = cmp.mapping.preset.insert {
|
|
|
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
|
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
['<C-Space>'] = cmp.mapping.complete {},
|
|
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
select = true,
|
|
|
|
},
|
|
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_next_item()
|
2023-10-13 10:26:56 +00:00
|
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
|
|
luasnip.expand_or_jump()
|
2023-10-08 14:57:57 +00:00
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_prev_item()
|
2023-10-13 10:26:56 +00:00
|
|
|
elseif luasnip.locally_jumpable(-1) then
|
|
|
|
luasnip.jump(-1)
|
2023-10-08 14:57:57 +00:00
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
},
|
|
|
|
sources = {
|
|
|
|
{ name = 'nvim_lsp' },
|
2023-10-13 10:26:56 +00:00
|
|
|
{ name = 'luasnip' },
|
2023-10-08 14:57:57 +00:00
|
|
|
},
|
|
|
|
}
|
2023-10-16 16:53:25 +00:00
|
|
|
|
2023-10-23 17:44:56 +00:00
|
|
|
--[ TREESITTER ]--
|
|
|
|
|
2023-10-16 16:53:25 +00:00
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
ensure_installed = {},
|
|
|
|
|
|
|
|
auto_install = false,
|
|
|
|
|
|
|
|
highlight = { enable = true },
|
|
|
|
|
|
|
|
indent = { enable = true },
|
|
|
|
}
|
2023-10-23 17:44:56 +00:00
|
|
|
|
|
|
|
--[ BUFFERLINE ]--
|
|
|
|
|
2023-10-23 19:33:27 +00:00
|
|
|
require("bufferline").setup{
|
|
|
|
options = {
|
|
|
|
diagnostics = 'nvim_lsp',
|
|
|
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
|
|
|
local icon = level:match("error") and " " or " "
|
|
|
|
return " " .. icon .. count
|
|
|
|
end,
|
|
|
|
separator_style = "slant",
|
|
|
|
hover = {
|
|
|
|
enabled = true,
|
|
|
|
reveal = {'close'},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
require("bufferline").seperator_style = "slanted"
|