Updated nvim config

This commit is contained in:
Christoffer Martinsson 2024-03-03 22:58:39 +01:00
parent 1674811bdf
commit ebdc447125

View File

@ -52,6 +52,11 @@ vim.o.showtabline = 0
vim.o.wrap = true vim.o.wrap = true
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.nofoldenable = true
vim.o.foldlevelstart = 99
-- show cursor line only in active window -- show cursor line only in active window
local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true }) local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true })
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
@ -63,6 +68,7 @@ vim.api.nvim_create_autocmd(
{ pattern = "*", command = "set nocursorline", group = cursorLineGrp } { pattern = "*", command = "set nocursorline", group = cursorLineGrp }
) )
-- Auto format on save -- Auto format on save
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
@ -109,11 +115,18 @@ require('lazy').setup({
}, },
}, },
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp"
},
{ {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
dependencies = { dependencies = {
'onsails/lspkind.nvim', 'onsails/lspkind.nvim',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'rafamadriz/friendly-snippets', 'rafamadriz/friendly-snippets',
@ -123,23 +136,23 @@ require('lazy').setup({
}, },
}, },
-- { {
-- 'zbirenbaum/copilot-cmp', 'zbirenbaum/copilot-cmp',
-- event = { 'BufRead', 'BufNewFile' }, event = { 'BufRead', 'BufNewFile' },
-- dependencies = { dependencies = {
-- { {
-- 'zbirenbaum/copilot.lua', 'zbirenbaum/copilot.lua',
-- config = function() config = function()
-- require('copilot').setup { require('copilot').setup {
-- suggestion = { enabled = false }, suggestion = { enabled = false },
-- panel = { enabled = false }, panel = { enabled = false },
-- filetypes = { markdown = true }, filetypes = { markdown = true },
-- } }
-- end, end,
-- }, },
-- }, },
-- config = function() require('copilot_cmp').setup() end, config = function() require('copilot_cmp').setup() end,
-- }, },
{ {
-- Highlight, edit, and navigate code -- Highlight, edit, and navigate code
@ -415,12 +428,11 @@ require('lazy').setup({
{ {
-- Add indentation guides even on blank lines -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
main = "ibl",
opts = { opts = {
show_trailing_blankline_indent = false, scope = {
use_treesitter = true, show_end = false,
char = "", }
context_char = "",
show_current_context = true,
} }
}, },
@ -822,7 +834,6 @@ require('nvim-treesitter.configs').setup {
}, },
} }
-- resizing splits -- resizing splits
vim.keymap.set({ 'n', 't' }, '<A-h>', require('smart-splits').resize_left, { desc = 'Resize left' }) vim.keymap.set({ 'n', 't' }, '<A-h>', require('smart-splits').resize_left, { desc = 'Resize left' })
vim.keymap.set({ 'n', 't' }, '<A-j>', require('smart-splits').resize_down, { desc = 'Resize down' }) vim.keymap.set({ 'n', 't' }, '<A-j>', require('smart-splits').resize_down, { desc = 'Resize down' })