diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/default-config.lua | 1 | ||||
-rw-r--r-- | lua/lv-snap/init.lua | 14 | ||||
-rw-r--r-- | lua/lv-which-key/init.lua | 19 | ||||
-rw-r--r-- | lua/plugins.lua | 9 |
4 files changed, 36 insertions, 7 deletions
diff --git a/lua/default-config.lua b/lua/default-config.lua index 88f2117d..a9a5d880 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -51,6 +51,7 @@ O = { codi = {active = false}, telescope_fzy = {active = false}, sanegx = {active = false}, + snap = {active = false}, ranger = {active = false}, todo_comments = {active = false}, lsp_colors = {active = false}, diff --git a/lua/lv-snap/init.lua b/lua/lv-snap/init.lua new file mode 100644 index 00000000..115b1eda --- /dev/null +++ b/lua/lv-snap/init.lua @@ -0,0 +1,14 @@ +local M = {} + +M.config = function() + local snap = require "snap" + local layout = snap.get"layout".bottom + local file = snap.config.file:with {consumer = "fzy", layout = layout} + local vimgrep = snap.config.vimgrep:with {layout = layout} + snap.register.command("find_files", file {producer = "ripgrep.file"}) + snap.register.command("buffers", file {producer = "vim.buffer"}) + snap.register.command("oldfiles", file {producer = "vim.oldfile"}) + snap.register.command("live_grep", vimgrep {}) +end + +return M diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 02d99ec8..3af04edf 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -68,9 +68,14 @@ vim.api.nvim_set_keymap('n', '<Leader>e', -- ":NvimTreeToggle<CR>", -- {noremap = true, silent = true}) --- telescope -vim.api.nvim_set_keymap('n', '<Leader>f', ':Telescope find_files<CR>', - {noremap = true, silent = true}) +-- telescope or snap +if O.plugin.snap.active then + vim.api.nvim_set_keymap('n', '<Leader>f', ':Snap find_files<CR>', + {noremap = true, silent = true}) +else + vim.api.nvim_set_keymap('n', '<Leader>f', ':Telescope find_files<CR>', + {noremap = true, silent = true}) +end -- dashboard vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', @@ -98,7 +103,7 @@ local mappings = { b = { name = "Buffers", j = {"<cmd>BufferPick<cr>", "jump to buffer"}, - f = {"<cmd>Telescope buffers<cr>", "Find buffer"}, + f = {O.plugin.snap.active and "<cmd>Snap buffers<cr>" or "<cmd>Telescope buffers<cr>", "Find buffer"}, w = {"<cmd>BufferWipeout<cr>", "wipeout buffer"}, e = { "<cmd>BufferCloseAllButCurrent<cr>", "close all but current buffer" @@ -226,13 +231,13 @@ local mappings = { -- "<cmd>Telescope lsp_workspace_diagnostics<cr>", -- "Workspace Diagnostics" -- }, - f = {"<cmd>Telescope find_files<cr>", "Find File"}, + f = {O.plugin.snap.active and "<cmd>Snap find_files<cr>" or "<cmd>Telescope find_files<cr>", "Find File"}, h = {"<cmd>Telescope help_tags<cr>", "Find Help"}, -- m = {"<cmd>Telescope marks<cr>", "Marks"}, M = {"<cmd>Telescope man_pages<cr>", "Man Pages"}, - r = {"<cmd>Telescope oldfiles<cr>", "Open Recent File"}, + r = {O.plugin.snap.active and "<cmd>Snap oldfiles<cr>" or "<cmd>Telescope oldfiles<cr>", "Open Recent File"}, R = {"<cmd>Telescope registers<cr>", "Registers"}, - t = {"<cmd>Telescope live_grep<cr>", "Text"} + t = {O.plugin.snap.active and "<cmd>Snap live_grep<cr>" or "<cmd>Telescope live_grep<cr>", "Text"} }, S = { name = "Session", diff --git a/lua/plugins.lua b/lua/plugins.lua index 6203c2f2..23e9365d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -45,6 +45,15 @@ return require("packer").startup(function(use) config = [[require('lv-telescope')]], cmd = "Telescope" } + -- Snap + use { + "camspiers/snap", + rocks = "fzy", + config = function() + require("lv-snap").config() + end, + disable = not O.plugin.snap.active, + } -- Autocomplete use { "hrsh7th/nvim-compe", |