From 03ce5748b133d6ca6203f44e3fdf3f7fa3fd2c0b Mon Sep 17 00:00:00 2001 From: Max Richter Date: Thu, 5 Jan 2023 16:16:28 +0100 Subject: [PATCH] feat: some stuff --- configs/nvim/ftplugin/symboltree.lua | 3 +- configs/nvim/lazy-lock.json | 56 +++++++++---------- configs/nvim/lua/max/configs/autocomplete.lua | 1 + configs/nvim/lua/max/configs/tree.lua | 1 + configs/nvim/lua/max/core/autocommands.lua | 32 ++++++++--- configs/nvim/lua/max/core/keymappings.lua | 15 +++-- configs/nvim/lua/max/core/plugins.lua | 8 ++- 7 files changed, 70 insertions(+), 46 deletions(-) diff --git a/configs/nvim/ftplugin/symboltree.lua b/configs/nvim/ftplugin/symboltree.lua index db01a74..880883a 100644 --- a/configs/nvim/ftplugin/symboltree.lua +++ b/configs/nvim/ftplugin/symboltree.lua @@ -1 +1,2 @@ -vim.api.nvim_set_keymap("n", "I", "zo", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "I", "zo", { noremap = true, silent = true, buffer = 0 }) +vim.api.nvim_set_keymap("n", "", "zo", { noremap = true, silent = true, buffer = 0 }) diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index 6829523..b84cf5d 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -1,25 +1,25 @@ { - "ChatGPT.nvim": { "branch": "main", "commit": "e9feafe55e3b42f2b23dff74c5f975a93cc9967a" }, - "Comment.nvim": { "branch": "master", "commit": "5f01c1a89adafc52bf34e3bf690f80d9d726715d" }, + "ChatGPT.nvim": { "branch": "main", "commit": "6c7e326add8fbb8c6662d92dd6bd9e1eb15f7c5a" }, + "Comment.nvim": { "branch": "master", "commit": "ab00bcf5aa979c53f2f40dc2655c03e24f4ef50f" }, "FixCursorHold.nvim": { "branch": "master", "commit": "70a9516a64668cbfe59f31b66d0a21678c5e9b12" }, "LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" }, "alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" }, - "autolist.nvim": { "branch": "main", "commit": "f600383a7ad97de236e7d968a74a4c4f847ae03d" }, + "autolist.nvim": { "branch": "main", "commit": "22e69de24e83230955d673d34c1bdebeed3f17ba" }, "boole.nvim": { "branch": "main", "commit": "d059fd7da634aaaabddbb280709f92effd9f2dba" }, - "catppuccin": { "branch": "main", "commit": "55f43a952856bc0029e6cef066297c6cfab3451d" }, + "catppuccin": { "branch": "main", "commit": "3020af75aae098a77737d91ee37c7147c8450d99" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" }, "cmp-nvim-lua": { "branch": "main", "commit": "d276254e7198ab7d00f117e88e223b4bd8c02d21" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "editorconfig-vim": { "branch": "master", "commit": "30ddc057f71287c3ac2beca876e7ae6d5abe26a0" }, - "friendly-snippets": { "branch": "main", "commit": "1a6a02350568d6830bcfa167c72f9b6e75e454ae" }, + "friendly-snippets": { "branch": "main", "commit": "484fb38b8f493ceeebf4e6fc499ebe41e10aae25" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, - "fzf": { "branch": "master", "commit": "73162a4bc3403e3532afa8a95008a3b4a00d554a" }, - "git-conflict.nvim": { "branch": "main", "commit": "77faa75c09a6af88e7b54d8d456327e06611f7ea" }, - "gitsigns.nvim": { "branch": "main", "commit": "2ab3bdf0a40bab53033048c6be75bda86316b55d" }, - "lazy.nvim": { "branch": "main", "commit": "e5dcc871491eadc5ed98e633afc519670e71c4a1" }, - "leap.nvim": { "branch": "main", "commit": "a5c9504290832e6bdbbb6265fd1ff02fc6485d20" }, + "fzf": { "branch": "master", "commit": "ee5cdb9713715883ac6d2cd87bc8a091ff7c8361" }, + "git-conflict.nvim": { "branch": "main", "commit": "cbefa7075b67903ca27f6eefdc9c1bf0c4881017" }, + "gitsigns.nvim": { "branch": "main", "commit": "d4f8c01280413919349f5df7daccd0c172143d7c" }, + "lazy.nvim": { "branch": "main", "commit": "d3b0d3e851b5609a2630e0307e18dc852efd0bd0" }, + "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, "litee-calltree.nvim": { "branch": "main", "commit": "e2dffec35740032258fee3a3c7f30123226f2271" }, "litee-symboltree.nvim": { "branch": "main", "commit": "488a660afcfd54644e6b755256907d3c7d8cf8d0" }, "litee.nvim": { "branch": "main", "commit": "bf366a1414fd0f9401631ac8884f2f9fa4bf18d2" }, @@ -29,36 +29,36 @@ "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, "lspsaga.nvim": { "branch": "main", "commit": "b7b4777369b441341b2dcd45c738ea4167c11c9e" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, - "lualine.nvim": { "branch": "master", "commit": "fffbcb829288c3ca366f17cdb8d46aefb5c1d6f3" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "5bea0e851b8f48479d2cb927cd26733b4058b2b3" }, - "mason.nvim": { "branch": "main", "commit": "e6f6f901959d39d112b096d26b909c65723981d3" }, - "neotest": { "branch": "master", "commit": "de2f68fb13a05c361e0c096e167f7f79712f3a5c" }, + "lualine.nvim": { "branch": "master", "commit": "d8c392dd75778d6258da4e7c55522e94ac389732" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "aa25b4153d2f2636c3b3a8c8360349d2b29e7ae3" }, + "mason.nvim": { "branch": "main", "commit": "38f0d1e467d1d3c22724c467efab8a4671a3b7bb" }, + "neotest": { "branch": "master", "commit": "414b43f99da0a827c3ce897161fc67c3bb6a5d83" }, "neotest-jest": { "branch": "main", "commit": "8b8926480865e56053681d0c56e3be0a3b5e716c" }, "neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" }, - "nui.nvim": { "branch": "main", "commit": "b12db5321c194c10eb34e610fb76ce2c058853fc" }, - "nvim-cmp": { "branch": "main", "commit": "8868cf9a09e5f3c2612a22ccb82dcc6d9f0d0d35" }, - "nvim-dap": { "branch": "master", "commit": "6f2ea9e33b48a51849ec93c6c38148a5372018e4" }, - "nvim-dap-ui": { "branch": "master", "commit": "54365d2eb4cb9cfab0371306c6a76c913c5a67e3" }, + "nui.nvim": { "branch": "main", "commit": "257da38029d3859ed111804f9d4e95b0fa993a31" }, + "nvim-cmp": { "branch": "main", "commit": "c49ad26e894e137e401b1d294948c46327877eaf" }, + "nvim-dap": { "branch": "master", "commit": "1077a86c83f75a6eec36c91f91d6b728e2b02130" }, + "nvim-dap-ui": { "branch": "master", "commit": "f2206de65ea39093e3f13992507fc985c17aa763" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, "nvim-lastplace": { "branch": "main", "commit": "ecced899435c6bcdd81becb5efc6d5751d0dc4c8" }, - "nvim-lspconfig": { "branch": "master", "commit": "25f0c65bd8fddadbafd0048a68560bf160ceb98c" }, + "nvim-lspconfig": { "branch": "master", "commit": "e69978a39e4d3262b09ce6a316beff384f443e3b" }, "nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" }, - "nvim-scrollbar": { "branch": "main", "commit": "f45aecbba9c402282dfc99721e0ad4c08710907c" }, + "nvim-scrollbar": { "branch": "main", "commit": "6e704cdeb7114385b4b19f9dc4b8f0c442019edc" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "b02a1674bd0010d7982b056fd3df4f717ff8a57a" }, - "nvim-tree.lua": { "branch": "master", "commit": "e14c2895b4f36a22001f7773244041c173dcf867" }, - "nvim-treesitter": { "branch": "master", "commit": "895d4a1202f36df561ba032c93b9deb72e1edee8" }, + "nvim-tree.lua": { "branch": "master", "commit": "bac962caf472a4404ed3ce1ba2fcaf32f8002951" }, + "nvim-treesitter": { "branch": "master", "commit": "b1569394614804aaad4e994731161f253ff61bcc" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "d816761ec1ea4a605689bc5f4111088459cf74d4" }, "nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" }, "persisted.nvim": { "branch": "main", "commit": "558fc4b9f48e16008782240521cb72455d93b835" }, - "plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" }, + "plenary.nvim": { "branch": "master", "commit": "bb444796dc5746d969f0718913a31c8075741e36" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, - "sniprun": { "branch": "master", "commit": "c37086a0d12b2053bf147c2f4643c0c92318c0c2" }, - "telescope.nvim": { "branch": "master", "commit": "e960efa60e97df58e089b00270f09d60f27202c8" }, + "sniprun": { "branch": "master", "commit": "79806dad094770a1563ac0227c9692f7592df744" }, + "telescope.nvim": { "branch": "master", "commit": "a606bd10c79ec5989c76c49cc6f736e88b63f0da" }, "translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" }, - "trouble.nvim": { "branch": "main", "commit": "897542f90050c3230856bc6e45de58b94c700bbf" }, + "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, "undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" }, - "vim-dadbod": { "branch": "master", "commit": "34151ccce9f5ff16229b8e482a97e46997914cb3" }, - "vim-dadbod-ui": { "branch": "master", "commit": "6a2b841d2f0b82386c637ce4e9954ae12c7eaee8" }, + "vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" }, + "vim-dadbod-ui": { "branch": "master", "commit": "ecf07480687a13fe1bd3899270a6c9c99de51f4b" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "which-key.nvim": { "branch": "main", "commit": "b7e0b1f16c20bc1ea0515851bc5740d1c1f18444" } } \ No newline at end of file diff --git a/configs/nvim/lua/max/configs/autocomplete.lua b/configs/nvim/lua/max/configs/autocomplete.lua index 3c9cdcb..20a5ca4 100644 --- a/configs/nvim/lua/max/configs/autocomplete.lua +++ b/configs/nvim/lua/max/configs/autocomplete.lua @@ -23,6 +23,7 @@ local check_backspace = function() return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") end + cmp.setup({ window = { documentation = cmp.config.window.bordered(), diff --git a/configs/nvim/lua/max/configs/tree.lua b/configs/nvim/lua/max/configs/tree.lua index ff5e900..a360551 100644 --- a/configs/nvim/lua/max/configs/tree.lua +++ b/configs/nvim/lua/max/configs/tree.lua @@ -39,3 +39,4 @@ require("nvim-tree").setup({ }) vim.cmd("NvimTreeOpen") +vim.api.nvim_input("") diff --git a/configs/nvim/lua/max/core/autocommands.lua b/configs/nvim/lua/max/core/autocommands.lua index 1891652..4678dcc 100644 --- a/configs/nvim/lua/max/core/autocommands.lua +++ b/configs/nvim/lua/max/core/autocommands.lua @@ -1,3 +1,6 @@ +local autocmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup + local config_group = vim.api.nvim_create_augroup("Config", {}) vim.api.nvim_create_autocmd({ "TextYankPost" }, { @@ -7,18 +10,29 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, { end, }) -local rememberFoldsGroup = vim.api.nvim_create_augroup("RememberFolds", { clear = true }) -vim.api.nvim_create_autocmd({ "BufWinLeave", "BufLeave" }, { - pattern = "*", - group = rememberFoldsGroup, - command = "mkview", +vim.api.nvim_create_autocmd({ "BufReadPost" }, { + group = config_group, + callback = function() + vim.cmd("filetype detect") + end, }) -vim.api.nvim_create_autocmd("BufWinEnter", { - pattern = "*", - group = rememberFoldsGroup, - command = "silent! loadview", + +local save_fold = augroup("Persistent Folds", { clear = true }) +autocmd("BufWinLeave", { + pattern = "*.*", + callback = function() + vim.cmd.mkview() + end, + group = save_fold, +}) +autocmd("BufWinEnter", { + pattern = "*.*", + callback = function() + vim.cmd.loadview({ mods = { emsg_silent = true } }) + end, + group = save_fold, }) vim.cmd([[ diff --git a/configs/nvim/lua/max/core/keymappings.lua b/configs/nvim/lua/max/core/keymappings.lua index 37a73b9..09cffeb 100644 --- a/configs/nvim/lua/max/core/keymappings.lua +++ b/configs/nvim/lua/max/core/keymappings.lua @@ -13,8 +13,6 @@ map("n", "", ":Telescope find_files preview={timeout=1000}", opts) map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", opts) map("n", "", "za", opts) -map("n", "is", "lua require('litee.lib.lsp.wrappers').buf_document_symbol()", opts) -map("n", "io", "LSoutlineToggle", opts) map("v", ">", ">gv", opts) map("v", "<", "e", "lua vim.lsp.buf.hover()", { silent = true }) map("n", "rn", "lua vim.lsp.buf.rename()", opts) map({ "n", "v" }, "c", "Lspsaga code_action", { silent = true }) map({ "n", "v" }, "gr", "Lspsaga lsp_finder", opts) -map("n", "", ":UndotreeToggle", opts) +map("n", "u", ":UndotreeToggle", opts) + +-- This is my [i]nspect section, [i]nspect [s]ymbols, [ +map("n", "is", "lua require('litee.lib.lsp.wrappers').buf_document_symbol()", opts) +map("n", "io", "Lspsaga outline", opts) map("n", "ip", ":TroubleToggle", opts) map({ "n", "v" }, "t", translate, opts) @@ -79,11 +81,14 @@ map("n", "j", "}", opts) -- Move lines vscode style map("n", "", "move +1", opts) map("n", "", "move -2", opts) +map("n", "", "yyP", opts) +map("n", "", "yyp", opts) map("i", "", "move +1", opts) map("i", "", "move -2", opts) map("v", "", ":m '>+1gv=gv", opts) map("v", "", ":m '<-2gv=gv", opts) +-- If i paste with p, the replaced content doesnt replace my clipboard map("v", "p", '"_dP', opts) -- Faster git merge @@ -107,8 +112,8 @@ map("v", "r", ":'<,'>SnipRun", opts) -- Close on q local function closeAll() - vim.cmd("SessionSave") - vim.cmd("qall") + vim.cmd("SessionSave") + vim.cmd("qall") end map("n", "q", ":q", opts) diff --git a/configs/nvim/lua/max/core/plugins.lua b/configs/nvim/lua/max/core/plugins.lua index 81fe425..5f837e4 100644 --- a/configs/nvim/lua/max/core/plugins.lua +++ b/configs/nvim/lua/max/core/plugins.lua @@ -113,9 +113,11 @@ local plugins = { -- Lsp Setup -- --------------- + { "glepnir/lspsaga.nvim", + command = "Lspsaga" + }, -- better windows for lsp replace, goto definition etc... { "VonHeikemen/lsp-zero.nvim", dependencies = { - "glepnir/lspsaga.nvim", -- better windows for lsp replace, goto definition etc... "neovim/nvim-lspconfig", "arkav/lualine-lsp-progress", "williamboman/mason.nvim", @@ -131,7 +133,7 @@ local plugins = { "rafamadriz/friendly-snippets", { "lukas-reineke/lsp-format.nvim", config = true }, }, - event = "InsertEnter", + lazy = false, config = function() local lsp = require("lsp-zero") lsp.preset("recommended") @@ -145,7 +147,7 @@ local plugins = { end }, { "folke/trouble.nvim", - event = "BufRead", + command = "TroubleToggle", dependencies = "kyazdani42/nvim-web-devicons", config = function() require("trouble").setup({})