From cf358c74d63a12904c8659fcabd761f1fa3f1d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 25 Aug 2023 22:44:42 +0200 Subject: [PATCH] Switch to Snippy --- nvim/lazy-lock.json | 6 +----- nvim/lua/lsp_config.lua | 9 +++++++++ nvim/lua/plugins.lua | 4 +--- nvim/lua/telescope_config.lua | 23 +++++++++++++++++++++++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index ad89741..535db6e 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -6,9 +6,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "diffview.nvim": { "branch": "main", "commit": "db97e667e03294bfa9f15e544e78f3082247bf79" }, - "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, "formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" }, - "friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" }, "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, "leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, @@ -23,14 +21,12 @@ "nvim-treesitter": { "branch": "master", "commit": "add1864bbf2d3b8e789ec6b4715bb5a4073e3b60" }, "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, - "supertab": { "branch": "master", "commit": "f0093ae12a9115498f887199809a6114659fc858" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope-undo.nvim": { "branch": "main", "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" }, "telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }, "trim.nvim": { "branch": "master", "commit": "2df124c2c2844d3143091ebd3ae8b49bbe06bc5e" }, "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, - "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, "vim-bracketed-paste": { "branch": "master", "commit": "45411da73cc159e4fc2138d930553d247bbfbcdc" }, - "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, "vim-rooter": { "branch": "master", "commit": "4f52ca556a0b9e257bf920658714470ea0320b7a" }, "vim-vsnip": { "branch": "master", "commit": "7753ba9c10429c29d25abfd11b4c60b76718c438" }, "vim-vsnip-integ": { "branch": "master", "commit": "1914e72cf3de70df7f5dde476cd299aba2440aef" }, diff --git a/nvim/lua/lsp_config.lua b/nvim/lua/lsp_config.lua index ee146ca..304fcec 100644 --- a/nvim/lua/lsp_config.lua +++ b/nvim/lua/lsp_config.lua @@ -54,6 +54,15 @@ cmp.setup({ }) }) +require('snippy').setup({ + mappings = { + is = { + [''] = 'expand_or_advance', + [''] = 'previous', + }, + }, +}) + -- Set configuration for specific filetype. cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 247e1d2..011e8ef 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -13,16 +13,14 @@ end vim.opt.rtp:prepend(lazypath) require('lazy').setup({ - "rafamadriz/friendly-snippets", 'ConradIrwin/vim-bracketed-paste', 'airblade/vim-rooter', 'cappyzawa/trim.nvim', 'ggandor/leap.nvim', 'mhartington/formatter.nvim', - 'gpanders/editorconfig.nvim', 'intrntbrn/awesomewm-vim-tmux-navigator', - 'mbbill/undotree', 'numToStr/Comment.nvim', + 'debugloop/telescope-undo.nvim', {'vimwiki/vimwiki'}, 'windwp/nvim-autopairs', {'lervag/vimtex', ft='latex'}, diff --git a/nvim/lua/telescope_config.lua b/nvim/lua/telescope_config.lua index b8aaf9a..f0f658c 100644 --- a/nvim/lua/telescope_config.lua +++ b/nvim/lua/telescope_config.lua @@ -40,11 +40,34 @@ require("telescope").setup{ [""] = actions.move_selection_previous, }, }, + }, + extensions = { + undo = { + side_by_side = true, + layout_strategy = "vertical", + layout_config = { + preview_height = 0.5, + }, + mappings = { + i = { + -- IMPORTANT: Note that telescope-undo must be available when telescope is configured if + -- you want to replicate these defaults and use the following actions. This means + -- installing as a dependency of telescope in it's `requirements` and loading this + -- extension from there instead of having the separate plugin definition as outlined + -- above. + [""] = require("telescope-undo.actions").restore, + [""] = require("telescope-undo.actions").yank_additions, + }, + }, + + } } } +telescope.load_extension("undo") telescope.load_extension('fzf') + vim.api.nvim_set_keymap("n", "", "lua require'telescope_config'.project_files()", {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "", "lua require('telescope_config').buffers()", { silent = true, noremap = true }) vim.api.nvim_set_keymap("n", "", "lua require('telescope.builtin').live_grep{ cwd = vim.fn.systemlist(\"git rev-parse --show-toplevel 2> /dev/null || pwd\")[1] }", { silent = true, noremap = true })