From 3dfe00f79c42ae01cfa2ec04368d57fe10aa32cb Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Tue, 4 Apr 2023 02:16:54 -0500 Subject: [PATCH] markdown preview --- mappings.lua | 1 + plugins/core.lua | 230 ++++++++++++++++++++++++++++++----------------- plugins/user.lua | 13 +-- 3 files changed, 155 insertions(+), 89 deletions(-) diff --git a/mappings.lua b/mappings.lua index 4964b22..e206922 100644 --- a/mappings.lua +++ b/mappings.lua @@ -3,6 +3,7 @@ return { [""] = { "zz", desc = "Vertical half page down and center cursor" }, [""] = { "zz", desc = "Vertical half page up and center cursor" }, ["gf"] = { ":OpenInGHFile ", desc = "Open in github" }, + ["mp"] = { ":Glow ", desc = "Markdown preview" } }, v = { ["gf"] = { ":OpenInGHFile ", desc = "Open in github" }, diff --git a/plugins/core.lua b/plugins/core.lua index acb6593..a56d4f2 100644 --- a/plugins/core.lua +++ b/plugins/core.lua @@ -1,86 +1,148 @@ return { - -- customize alpha options - { - "goolord/alpha-nvim", - opts = function(_, opts) - -- customize the dashboard header - -- opts.section.header.val = { - -- ".-------. .-./`) ,---. .--. .-_'''-. ,-----. ________ .-'''-. ,---------. ,-----. .-------. ,---. ,---. .-'''-. ", - -- "| _ _ \\ \\ .-.')| \\ | | '_( )_ \\ .' .-, '. | | / _ \\\\ \\ .' .-, '. | _ _ \\ | \\ / | / _ \\", - -- "| ( ' ) | / `-' \\| , \\ | ||(_ o _)| ' / ,-.| \\ _ \\ | .----' (`' )/`--' `--. ,---'/ ,-.| \\ _ \\ | ( ' ) | | , \\/ , | (`' )/`--'", - -- "|(_ o _) / `-'`\"`| |\\_ \\| |. (_,_)/___| ; \\ '_ / | :| _|____ (_ o _). | \\ ; \\ '_ / | :|(_ o _) / | |\\_ /| |(_ o _). ", - -- "| (_,_).' __ .---. | _( )_\\ || | .-----.| _`,/ \\ _/ ||_( )_ | (_,_). '. :_ _: | _`,/ \\ _/ || (_,_).' __ | _( )_/ | | (_,_). '. ", - -- "| |\\ \\ | || | | (_ o _) |' \\ '- .': ( '\\_/ \\ ;(_ o._)__|.---. \\ : (_I_) : ( '\\_/ \\ ;| |\\ \\ | || (_ o _) | |.---. \\ :", - -- "| | \\ `' /| | | (_,_)\\ | \\ `-'` | \\ `\"/ \\ ) / |(_,_) \\ `-' | (_(=)_) \\ `\"/ \\ ) / | | \\ `' /| (_,_) | |\\ `-' |", - -- "| | \\ / | | | | | | \\ / '. \\_/``\".' | | \\ / (_I_) '. \\_/``\".' | | \\ / | | | | \\ / ", - -- "''-' `'-' '---' '--' '--' `'-...-' '-----' '---' `-...-' '---' '-----' ''-' `'-' '--' '--' `-...-' ", - -- " ██╗ ██████╗ ███████╗██╗ ██╗", - -- " ██║██╔═══██╗██╔════╝██║ ██║", - -- " ██║██║ ██║███████╗███████║", - -- " ██ ██║██║ ██║╚════██║██╔══██║", - -- " ╚█████╔╝╚██████╔╝███████║██║ ██║", - -- " ╚════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝", - -- } - - opts.section.header.val = { - "", - } - - return opts - end, - }, - -- You can disable default plugins as follows: - -- { "max397574/better-escape.nvim", enabled = false }, - -- - -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call - -- { - -- "L3MON4D3/LuaSnip", - -- config = function(plugin, opts) - -- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom luasnip configuration such as filetype extend or custom snippets - -- local luasnip = require "luasnip" - -- luasnip.filetype_extend("javascript", { "javascriptreact" }) - -- end, - -- }, - -- { - -- "windwp/nvim-autopairs", - -- config = function(plugin, opts) - -- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom autopairs configuration such as custom rules - -- local npairs = require "nvim-autopairs" - -- local Rule = require "nvim-autopairs.rule" - -- local cond = require "nvim-autopairs.conds" - -- npairs.add_rules( - -- { - -- Rule("$", "$", { "tex", "latex" }) - -- -- don't add a pair if the next character is % - -- :with_pair(cond.not_after_regex "%%") - -- -- don't add a pair if the previous character is xxx - -- :with_pair( - -- cond.not_before_regex("xxx", 3) - -- ) - -- -- don't move right when repeat character - -- :with_move(cond.none()) - -- -- don't delete if the next character is xx - -- :with_del(cond.not_after_regex "xx") - -- -- disable adding a newline when you press - -- :with_cr(cond.none()), - -- }, - -- -- disable for .vim files, but it work for another filetypes - -- Rule("a", "a", "-vim") - -- ) - -- end, - -- }, - -- By adding to the which-key config and using our helper function you can add more which-key registered bindings - -- { - -- "folke/which-key.nvim", - -- config = function(plugin, opts) - -- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- Add bindings which show up as group name - -- local wk = require "which-key" - -- wk.register({ - -- b = { name = "Buffer" }, - -- }, { mode = "n", prefix = "" }) - -- end, - -- }, + -- customize alpha options + { + "goolord/alpha-nvim", + -- config = function() + -- local alpha = require("alpha") + -- local dashboard = require("alpha.themes.dashboard") + -- require("alpha.term") + -- + -- local header = { + -- type = "terminal", + -- command = "curl -s https://textart.sh/topic/bonsai/more\\?skip\\=$(if command -v jot >/dev/null 2>&l; then jot -r 1 127; else shuf -i 0-271 -n 1; fi)\\&limit\\=1 | sed -n '//p' | sed 's/^.*>//gm'", + -- width = 180, + -- height = 80, + -- opts = { + -- position = "center", + -- hl = "String", + -- }, + -- } + -- + -- local buttons = { + -- type = "group", + -- val = { + -- { type = "text", val = "Joshua Bell :: RingOfStorms", opts = { hl = "SpecialComment", position = "center" } }, + -- { type = "padding", val = 1 }, + -- dashboard.button("SPC n", " " .. " New File"), + -- dashboard.button("SPC f f", " " .. " Find File"), + -- dashboard.button("SPC f w", " " .. " Find Word"), + -- -- dashboard.button("SPC q", " " .. " Quit", ":qa"), + -- }, + -- } + -- + -- local top_padding = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) + -- + -- local config = { + -- layout = { + -- { type = "padding", val = top_padding }, + -- header, + -- { type = "padding", val = 14 }, + -- { type = "padding", val = 2 }, + -- buttons, + -- }, + -- } + -- + -- alpha.setup(config) + -- end, + opts = function(_, opts) + -- customize the dashboard header + opts.section.header.val = { + " ▒▒▒▒▒▒ ", + " ▒▒▓▓▓▓▒▒▒▒▒▒▒▒ ", + " ▓▓▒▒▒▒▒▒▒▒░░ ▓▓ ", + " ▒▒▓▓▓▓▓▓▓▓▓▓▓▓░░░░ ▒▒▒▒▓▓▒▒▒▒ ", + " ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ ▒▒▓▓▓▓▓▓▒▒▒▒▒▒ ", + " ▓▓▓▓▓▓▓▓▓▓ ██▓▓▓▓▓▓▓▓ ▒▒▒▒ ██ ", + " ██▓▓▓▓ ▓▓████▓▓▓▓ ▒▒▒▒▒▒▒▒▓▓██▓▓ ▒▒▒▒▒▒ ", + " ██ ██ ▒▒▒▒▒▒░░░░ ▒▒▒▒▒▒ ▓▓▓▓▓▓ ▒▒▒▒▓▓▓▓██▓▓▒▒▒▒██▒▒▒▒▒▒▒▒▒▒ ", + " ▒▒▒▒▓▓ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒░░ ░░▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒ ██▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒ ▓▓ ▒▒ ", + " ▒▒▓▓▓▓██▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ▒▒▓▓▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░██▓▓ ██▓▓ ▒▒ ▒▒▒▒▓▓▒▒▒▒▓▓ ▒▒ ▒▒ ", + " ▒▒▓▓▓▓▓▓██▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓ ▒▒ ▒▒▒▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██▓▓▓▓▓▓▓▓ ████▓▓▓▓▓▓▒▒ ██▒▒██▒▒▓▓▓▓▒▒▓▓▓▓▒▒▓▓▓▓██▓▓ ", + " ▓▓▓▓▓▓▓▓██▓▓██ ████ ▓▓▓▓▓▓▓▓ ▒▒▒▒▒▒▒▒▒▒ ▒▒▓▓▒▒ ▒▒▒▒▒▒ ░░██ ▓▓▓▓▓▓▓▓██▓▓ ▓▓██▓▓ ▓▓ ▒▒▒▒▒▒▒▒▒▒▒▒ ██▓▓ ██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▒▒▓▓▓▓▒▒▓▓", + " ░░▓▓▓▓░░░░████████░░ ░░▓▓▓▓░░ ░░▒▒▒▒▒▒▒▒░░▒▒▓▓▒▒░░▒▒▒▒░░ ░░██ ▓▓░░▓▓░░░░▓▓ ▓▓░░▓▓▒▒▓▓ ▒▒▓▓▓▓▓▓▓▓▒▒▒▒░░▒▒▓▓░░ ██▓▓▓▓▓▓██▓▓██░░██▓▓▓▓▓▓▒▒▓▓", + " ░░░░ ░░██▓▓░░ ░░░░ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░██ ▓▓ ▓▓ ▓▓ ░░ ▓▓▓▓░░░░ ░░░░░░░░░░▓▓▓▓▒▒██░░ ░░░░░░ ▒▒░░▓▓▓▓▓▓██░░██▒▒░░▓▓██▓▓▓▓░░", + " ██▓▓ ▒▒ ▒▒▒▒▒▒▒▒ ▓▓▓▓▒▒▒▒▒▒▒▒ ░░ ▓▓ ▓▓ ██ ▓▓▓▓▓▓ ▓▓ ▓▓██▓▓▓▓ ▒▒▒▒▒▒▒▒▒▒ ██░░██ ██▓▓████ ░░ ", + " ██▓▓ ░░ ▒▒░░▓▓░░ ▓▓▒▒░░▒▒░░▒▒ ▓▓ ██ ░░ ▒▒▓▓░░▓▓ ▓▓ ░░░░████▒▒▓▓▓▓▓▓▒▒▒▒░░ ░░ ░░ ██▓▓░░░░ ", + " ██▓▓ ▒▒▒▒▒▒ ▓▓ ██▓▓ ██ ██ ████▓▓██ ▓▓ ▓▓▒▒ ████ ", + " ▓▓▓▓██▓▓▓▓▓▓ ▓▓▒▒ ▓▓▓▓ ██▓▓ ▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓ ", + " ████▓▓██████▓▓▓▓████ ▓▓▓▓▓▓▓▓▓▓▒▒▓▓▓▓██▓▓ ████████▓▓▓▓████████ ██████▓▓████ ██▒▒▓▓▓▓██████▓▓▓▓▒▒██ ", + " ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▓▓▓▓▓▓▓▓ ▓▓▒▒▓▓██████▓▓▓▓▓▓▓▓▒▒██ ▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓ ▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒██ ", + " ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ", + " ▓▓▓▓▓▓▓▓▒▒▓▓▓▓▓▓▓▓▒▒▒▒▓▓ ▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓ ██▓▓▒▒▒▒▓▓▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒██ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒██ ", + " ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▒▒▒▒░░░░░░░░░░░░░░░░▓▓ ░░██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ▓▓▓▓▓▓▒▒▒▒▒▒▓▓▒▒▒▒▓▓ ░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ", + " ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░████████████████████░░ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ ░░ ████▓▓▓▓▓▓▓▓▓▓████░░", + -- " .-------. .-./`) ,---. .--. .-_'''-. ,-----. ________ .-'''-. ,---------. ,-----. .-------. ,---. ,---. .-'''-. ", + -- " | _ _ \\ \\ .-.')| \\ | | '_( )_ \\ .' .-, '. | | / _ \\\\ \\ .' .-, '. | _ _ \\ | \\ / | / _ \\", + -- " | ( ' ) | / `-' \\| , \\ | ||(_ o _)| ' / ,-.| \\ _ \\ | .----' (`' )/`--' `--. ,---'/ ,-.| \\ _ \\ | ( ' ) | | , \\/ , | (`' )/`--'", + -- " |(_ o _) / `-'`\"`| |\\_ \\| |. (_,_)/___| ; \\ '_ / | :| _|____ (_ o _). | \\ ; \\ '_ / | :|(_ o _) / | |\\_ /| |(_ o _). ", + -- " | (_,_).' __ .---. | _( )_\\ || | .-----.| _`,/ \\ _/ ||_( )_ | (_,_). '. :_ _: | _`,/ \\ _/ || (_,_).' __ | _( )_/ | | (_,_). '. ", + -- " | |\\ \\ | || | | (_ o _) |' \\ '- .': ( '\\_/ \\ ;(_ o._)__|.---. \\ : (_I_) : ( '\\_/ \\ ;| |\\ \\ | || (_ o _) | |.---. \\ :", + -- " | | \\ `' /| | | (_,_)\\ | \\ `-'` | \\ `\"/ \\ ) / |(_,_) \\ `-' | (_(=)_) \\ `\"/ \\ ) / | | \\ `' /| (_,_) | |\\ `-' |", + -- " | | \\ / | | | | | | \\ / '. \\_/``\".' | | \\ / (_I_) '. \\_/``\".' | | \\ / | | | | \\ / ", + -- " ''-' `'-' '---' '--' '--' `'-...-' '-----' '---' `-...-' '---' '-----' ''-' `'-' '--' '--' `-...-' ", + "", + " ██╗ ██████╗ ███████╗██╗ ██╗", + " ██║██╔═══██╗██╔════╝██║ ██║", + " ██║██║ ██║███████╗███████║", + " ██ ██║██║ ██║╚════██║██╔══██║", + " ╚█████╔╝╚██████╔╝███████║██║ ██║", + " ╚════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝", + } + return opts + end, + }, + -- You can disable default plugins as follows: + -- { "max397574/better-escape.nvim", enabled = false }, + -- + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + -- { + -- "L3MON4D3/LuaSnip", + -- config = function(plugin, opts) + -- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call + -- -- add more custom luasnip configuration such as filetype extend or custom snippets + -- local luasnip = require "luasnip" + -- luasnip.filetype_extend("javascript", { "javascriptreact" }) + -- end, + -- }, + -- { + -- "windwp/nvim-autopairs", + -- config = function(plugin, opts) + -- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call + -- -- add more custom autopairs configuration such as custom rules + -- local npairs = require "nvim-autopairs" + -- local Rule = require "nvim-autopairs.rule" + -- local cond = require "nvim-autopairs.conds" + -- npairs.add_rules( + -- { + -- Rule("$", "$", { "tex", "latex" }) + -- -- don't add a pair if the next character is % + -- :with_pair(cond.not_after_regex "%%") + -- -- don't add a pair if the previous character is xxx + -- :with_pair( + -- cond.not_before_regex("xxx", 3) + -- ) + -- -- don't move right when repeat character + -- :with_move(cond.none()) + -- -- don't delete if the next character is xx + -- :with_del(cond.not_after_regex "xx") + -- -- disable adding a newline when you press + -- :with_cr(cond.none()), + -- }, + -- -- disable for .vim files, but it work for another filetypes + -- Rule("a", "a", "-vim") + -- ) + -- end, + -- }, + -- By adding to the which-key config and using our helper function you can add more which-key registered bindings + -- { + -- "folke/which-key.nvim", + -- config = function(plugin, opts) + -- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call + -- -- Add bindings which show up as group name + -- local wk = require "which-key" + -- wk.register({ + -- b = { name = "Buffer" }, + -- }, { mode = "n", prefix = "" }) + -- end, + -- }, } diff --git a/plugins/user.lua b/plugins/user.lua index ab7b770..7f6a682 100644 --- a/plugins/user.lua +++ b/plugins/user.lua @@ -22,11 +22,6 @@ return { { "Pocco81/auto-save.nvim", event = "BufEnter", - config = function() - require("auto-save").setup { - -- config - } - end, }, { "Almo7aya/openingh.nvim", @@ -36,6 +31,14 @@ return { "gioele/vim-autoswap", event = "BufEnter", }, + { + "lnc3l0t/glow.nvim", + branch = "advanced_window", + config = { + default_type = "keep" + }, + cmd = "Glow" + } -- { -- "simrat39/inlay-hints.nvim", -- },