From 8317381ebc8ffc75b76d831504c94daddb0ecc52 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Mon, 10 Apr 2023 05:35:59 +0200 Subject: [PATCH] Added peek to preview markdown files --- nvim/.config/nvim/lazy-lock.json | 1 + nvim/.config/nvim/lua/plugins/peek.lua | 34 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nvim/.config/nvim/lua/plugins/peek.lua diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 4027ec4..481c173 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -33,6 +33,7 @@ "nvim-treesitter-context": { "branch": "master", "commit": "38203f5e6c62617b3c07662dc71ce3047ecd90d3" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "b55fe6175f0001347a433c9df358c8cbf8a4e90f" }, "nvim-ts-autotag": { "branch": "main", "commit": "25698e4033cd6cd3745454bfc837dd670eba0480" }, + "peek.nvim": { "branch": "master", "commit": "67752e7581f88da6899838985a05705b008e4185" }, "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, diff --git a/nvim/.config/nvim/lua/plugins/peek.lua b/nvim/.config/nvim/lua/plugins/peek.lua new file mode 100644 index 0000000..e722599 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/peek.lua @@ -0,0 +1,34 @@ +-- https://github.com/toppair/peek.nvim +return { + 'toppair/peek.nvim', + build = 'deno task --quiet build:fast', + cond = function() + return vim.fn.executable 'deno' == 1 + end, + lazy = true, + cmds = { "PeekOpen", "PeekClose" }, + init = function() + vim.api.nvim_create_user_command('PeekOpen', function() require('peek').open() end, {}) + vim.api.nvim_create_user_command('PeekClose', function() require('peek').close() end, {}) + + local augroup = vim.api.nvim_create_augroup('Peek', { clear = true }) + + -- Automatically open a markdown preview window + vim.api.nvim_create_autocmd({ "FileType"}, { + callback = function() + require('peek').open() + end, + group = augroup, + pattern = "markdown", + }) + end, + opts = {}, + -- config = function() + -- local peek = require('peek'); + -- + -- + -- peek.setup { + -- + -- } + -- end +}