From a56b8f7029b27bb1086a775c7389ca2932f1987c Mon Sep 17 00:00:00 2001 From: Fabian Schmidt Date: Wed, 16 Oct 2024 15:56:59 +0200 Subject: [PATCH] Try folds and some other changes --- init.lua | 5 +++++ lua/plugins/dap.lua | 3 +++ lua/plugins/lsp.lua | 21 +++++++++++++++------ lua/plugins/navigation.lua | 20 +++++++++++--------- lua/plugins/style.lua | 36 +++++++++++++++--------------------- 5 files changed, 49 insertions(+), 36 deletions(-) diff --git a/init.lua b/init.lua index 0460980..17427f1 100644 --- a/init.lua +++ b/init.lua @@ -42,5 +42,10 @@ vim.opt.expandtab = false vim.opt.autoindent = true vim.opt.smartindent = true vim.opt.completeopt = { "menu", "menuone", "noselect" } +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.foldtext = "" +vim.opt.foldlevelstart = 1 +vim.opt.foldnestmax = 2 -- TODO replace config with opts in every plugin diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 2446521..f1e3c56 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,6 +1,7 @@ return { { 'mfussenegger/nvim-dap', + lazy = true, dependencies = { 'nvim-lua/plenary.nvim' }, config = function() local wk = require("which-key") @@ -17,6 +18,7 @@ return { }, { 'rcarriga/nvim-dap-ui', + lazy = true, config = function() local dapui = require("dapui") dapui.setup() @@ -29,6 +31,7 @@ return { }, { 'theHamsta/nvim-dap-virtual-text', + lazy = true, config = true } } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 9e65b9e..f1befb2 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,18 +1,26 @@ local lsp_attach = function(client, buf) - vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()") - vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc") + vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf }) + vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf }) + vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf }) vim.lsp.inlay_hint.enable(true, nil) local bufopts = { noremap = true, silent = true, buffer = buf } local wk = require("which-key") + local diag_next = function() + vim.diagnostic.jump({ count = 1, float = true }) + end + + local diag_prev = function() + vim.diagnostic.jump({ count = -1, float = true }) + end + wk.add({ - { 'e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" }, { '', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" }, - { 'd', vim.diagnostic.goto_prev, bufopts }, - { 'd', vim.diagnostic.goto_next, bufopts }, + { 'e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" }, + { '[d', diag_prev, bufopts }, + { ']d', diag_next, bufopts }, { 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" }, { 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" }, @@ -36,6 +44,7 @@ return { -- lsp { 'williamboman/mason.nvim', + lazy = true, config = true }, { diff --git a/lua/plugins/navigation.lua b/lua/plugins/navigation.lua index f9b8487..563d4d5 100644 --- a/lua/plugins/navigation.lua +++ b/lua/plugins/navigation.lua @@ -7,15 +7,17 @@ return { local telescope = require("telescope.builtin") local wk = require("which-key") wk.add({ - { "gh", telescope.git_bcommits, { noremap = true, silent = true, group = "git", desc = "View commits of current buffer" } }, - { "gb", telescope.git_branches, { noremap = true, silent = true, group = "git", desc = "View git branches" } }, - { "gs", telescope.git_status, { noremap = true, silent = true, group = "git", desc = "View git status" } }, - { 'ff', telescope.git_files, { noremap = true, silent = true, desc = "Search files" } }, - { 'fg', telescope.live_grep, { noremap = true, silent = true, desc = "Search in files" } }, - { 'fb', telescope.buffers, { noremap = true, silent = true, desc = "Search in buffers" } }, - { 'fh', telescope.help_tags, { noremap = true, silent = true, desc = "Search in help" } }, - { 'fk', telescope.keymaps, { noremap = true, silent = true, desc = "Search in keymaps" } }, - { 'cc', telescope.colorscheme, { desc = "Select colorscheme" } }, + { "g", group = "git" }, + { "gh", telescope.git_bcommits, { noremap = true, silent = true }, desc = "View commits of current buffer" }, + { "gb", telescope.git_branches, { noremap = true, silent = true }, desc = "View git branches" }, + { "gs", telescope.git_status, { noremap = true, silent = true }, desc = "View git status" }, + { "f", group = "find" }, + { 'ff', telescope.git_files, { noremap = true, silent = true }, desc = "Search files" }, + { 'fg', telescope.live_grep, { noremap = true, silent = true }, desc = "Search in files" }, + { 'fb', telescope.buffers, { noremap = true, silent = true }, desc = "Search in buffers" }, + { 'fh', telescope.help_tags, { noremap = true, silent = true }, desc = "Search in help" }, + { 'fk', telescope.keymaps, { noremap = true, silent = true }, desc = "Search in keymaps" }, + { 'cc', telescope.colorscheme, desc = "Select colorscheme" }, }) end }, diff --git a/lua/plugins/style.lua b/lua/plugins/style.lua index a36e4b5..be8bd1b 100644 --- a/lua/plugins/style.lua +++ b/lua/plugins/style.lua @@ -5,20 +5,21 @@ return { vim.opt.guifont = 'Source Code Pro for Powerline' vim.cmd('set termguicolors') vim.opt.syntax = 'on' - require('kanagawa').setup({ - colors = { - palette = { - lotusGray = "#F8F7F4", - lotusWhite0 = "#FBFBF9", - lotusWhite1 = "#F2F0E9", - lotusWhite2 = "#F8F7F2", - lotusWhite3 = "#F6F6F1", - lotusWhite4 = "#F4F1E6", - lotusWhite5 = "#FcFBF9", - } - } - }) - vim.cmd('colorscheme kanagawa-lotus') + -- require('kanagawa').setup({ + -- colors = { + -- palette = { + -- lotusGray = "#F8F7F4", + -- lotusWhite0 = "#FBFBF9", + -- lotusWhite1 = "#F2F0E9", + -- lotusWhite2 = "#F8F7F2", + -- lotusWhite3 = "#F6F6F1", + -- lotusWhite4 = "#F4F1E6", + -- lotusWhite5 = "#FcFBF9", + -- } + -- } + -- }) + -- vim.cmd('colorscheme kanagawa-lotus') + vim.cmd('colorscheme kanagawa') end }, { 'lunarvim/lunar.nvim' }, @@ -37,7 +38,6 @@ return { } } end, - dependencies = { 'nvim-treesitter/playground' } }, { "nvim-treesitter/nvim-treesitter-context", @@ -92,10 +92,4 @@ return { 'lewis6991/gitsigns.nvim', config = true }, - { - 'glepnir/dashboard-nvim', - event = 'VimEnter', - config = true, - dependencies = { 'nvim-tree/nvim-web-devicons' } - }, }