nixos/home/editor/neovim/plugins.lua

166 lines
3.3 KiB
Lua
Raw Normal View History

2024-02-28 01:46:28 +00:00
-- Plugins
2024-02-28 02:40:13 +00:00
-- LSP stuff
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({buffer = bufnr})
end)
2024-03-05 21:33:29 +00:00
lsp_zero.format_on_save({
format_opts = {
async = false,
timeout_ms = 10000,
},
servers = {
['gopls'] = {'go'},
['nil_ls'] = {'nix'},
},
})
local lspconfig = require('lspconfig')
lspconfig.gopls.setup({
2024-02-28 02:40:13 +00:00
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
gofumpt = true,
}
}
})
2024-03-05 21:33:29 +00:00
lspconfig.nil_ls.setup({
autostart = true,
settings = {
['nil'] = {
formatting = {
command = { "nixpkgs-fmt" },
},
},
},
})
2024-02-28 02:40:13 +00:00
-- Telescope
require('telescope').setup({
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
},
})
2024-02-28 09:01:01 +00:00
-- Tresitter stuff
require('nvim-treesitter.configs').setup {
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
}
}
}
}
-- Lualine
require('lualine').setup({
options = {
icons_enabled = false,
component_separators = '|',
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = {
{
'filename',
file_status = true,
newfile_status = true,
path = 3,
shorting_target = 30,
symbols = {
modified = '[+]',
readonly = '[-]',
unnamed = '[No name]',
newfile = '[New]'
}
}
},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = { 'progress' },
lualine_z = { 'location' }
}
})
2024-03-05 07:26:26 +00:00
-- Copilot
require('copilot').setup({
suggestions = { enabled = false },
panel = { enabled = false},
})
require('copilot_cmp').setup()
-- Cmp
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
-- Enter to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
-- Ctrl+Space to open completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Move between snippet placeholders
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
-- Scroll in completion docs
['<C-k>'] = cmp.mapping.scroll_docs(-4),
['<C-j>'] = cmp.mapping.scroll_docs(4),
}),
sources = cmp.config.sources({
}, {
{ name = "copilot", group_index = 2 },
{ name = "luasnip" },
{ name = "buffer" },
})
})
-- Colorscheme
require('catppuccin').setup({
})
vim.cmd.colorscheme "catppuccin"