nvim: Overhaul prose preview keys
This commit is contained in:
parent
9421ef807d
commit
50d78cbb2f
5 changed files with 56 additions and 32 deletions
|
|
@ -32,18 +32,18 @@ if require("core.util").is_available("which-key") then
|
|||
require("which-key").add({ "<localleader>p", group = "prose" })
|
||||
end
|
||||
-- show nice md preview in browser (auto-syncs scrolling)
|
||||
local peek_key = "<localleader>po"
|
||||
if require("core.util").is_available("peek") then
|
||||
local peek = require("peek")
|
||||
local function togglePeek()
|
||||
map("n", peek_key, function()
|
||||
local peek = require("peek")
|
||||
if peek.is_open() then
|
||||
peek.close()
|
||||
else
|
||||
peek.open()
|
||||
end
|
||||
end
|
||||
map("n", "<leader>po", togglePeek, { desc = "show md preview" })
|
||||
else
|
||||
map("n", "<leader>po", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
|
||||
end, { desc = "show md preview" })
|
||||
elseif vim.fn.exists(":MarkdownPreviewToggle") > 0 then
|
||||
map("n", peek_key, "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
|
||||
end
|
||||
|
||||
-- create mindmaps directly from markdown! requires external executable
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
if require("core.util").is_available("quarto") then
|
||||
vim.keymap.set("n", "<localleader>po", require("quarto").quartoPreview, { desc = "show quarto preview" })
|
||||
end
|
||||
|
||||
local default_buffer_session = function()
|
||||
local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
|
||||
local temp_path = vim.fn.stdpath("run") .. "/molten-sessions" .. buffer_path .. ".json"
|
||||
|
|
@ -34,7 +38,6 @@ local startsession = function(opts)
|
|||
|
||||
-- simply attach to existing if exists
|
||||
if vim.fn.filereadable(kernel_filen) == 1 then
|
||||
print(kernel_filen)
|
||||
vim.cmd("MoltenInit " .. kernel_filen)
|
||||
return
|
||||
end
|
||||
|
|
|
|||
3
nvim/.config/nvim/after/ftplugin/typst.lua
Normal file
3
nvim/.config/nvim/after/ftplugin/typst.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if vim.fn.exists(":TypstPreviewToggle") > 0 then
|
||||
vim.keymap.set("n", "<localleader>po", "<cmd>TypstPreviewToggle<cr>", { desc = "show typst preview" })
|
||||
end
|
||||
|
|
@ -74,6 +74,7 @@
|
|||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "c1100e8788baabe8ca8f8cd7fd63d3d479e49e36" },
|
||||
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
|
||||
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
|
||||
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ local prose_plugs = {
|
|||
cmd = "RenderMarkdown",
|
||||
keys = {
|
||||
{
|
||||
"<leader>pp",
|
||||
"<localleader>pm",
|
||||
function()
|
||||
require("render-markdown").toggle()
|
||||
end,
|
||||
|
|
@ -106,29 +106,43 @@ local prose_plugs = {
|
|||
},
|
||||
},
|
||||
},
|
||||
--- PREVIEW SECTION
|
||||
-- generate an auto-updating html preview for md files
|
||||
-- uses the very nice peek if deno is available, otherwise falls back to markdown-preview
|
||||
{
|
||||
"toppair/peek.nvim",
|
||||
event = { "VeryLazy" },
|
||||
cond = vim.fn.executable("deno") == 1,
|
||||
build = "deno task --quiet build:fast",
|
||||
ft = md_like,
|
||||
config = function()
|
||||
require("peek").setup()
|
||||
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
|
||||
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
event = { "VeryLazy" },
|
||||
cond = vim.fn.executable("deno") == 0,
|
||||
build = function()
|
||||
vim.fn["mkdp#util#install"]()
|
||||
end,
|
||||
version = false,
|
||||
ft = md_like,
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
},
|
||||
{
|
||||
"chomosuke/typst-preview.nvim",
|
||||
ft = { "typst" },
|
||||
opts = { -- to use mason-managed binary
|
||||
dependencies_bin = { ["tinymist"] = "tinymist" },
|
||||
},
|
||||
cmd = {
|
||||
"TypstPreview",
|
||||
"TypstPreviewUpdate",
|
||||
"TypstPreviewStop",
|
||||
"TypstPreviewToggle",
|
||||
"TypstPreviewFollowCursor",
|
||||
"TypstPreviewNoFollowCursor",
|
||||
"TypstPreviewFollowCursorToggle",
|
||||
},
|
||||
},
|
||||
--- END PREVIEW SECTION
|
||||
|
||||
-- easy copy paste of images into markup files
|
||||
{
|
||||
|
|
@ -145,7 +159,7 @@ local prose_plugs = {
|
|||
},
|
||||
cmd = { "PasteImage" },
|
||||
keys = {
|
||||
{ "<leader>pi", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
|
||||
{ "<localleader>pi", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
|
||||
},
|
||||
ft = prose_ft,
|
||||
},
|
||||
|
|
@ -244,22 +258,25 @@ local prose_plugs = {
|
|||
|
||||
-- cite as you write from papis databases
|
||||
-- ADDITIONAL DEPENDENCIES: papis and yq in shell env
|
||||
-- {
|
||||
-- "jghauser/papis.nvim",
|
||||
-- dependencies = {
|
||||
-- "kkharji/sqlite.lua",
|
||||
-- "MunifTanjim/nui.nvim",
|
||||
-- "pysan3/pathlib.nvim",
|
||||
-- "nvim-neotest/nvim-nio",
|
||||
-- "nvim-treesitter/nvim-treesitter",
|
||||
-- },
|
||||
-- cond = vim.fn.executable("papis") == 1 and vim.fn.executable("yq") == 1,
|
||||
-- ft = writing_ft,
|
||||
-- lazy = false,
|
||||
-- config = function()
|
||||
-- require("papis").setup({})
|
||||
-- end,
|
||||
-- },
|
||||
-- still same issues: slow, buggy, does not work for me
|
||||
{
|
||||
"jghauser/papis.nvim",
|
||||
dependencies = {
|
||||
"kkharji/sqlite.lua",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"pysan3/pathlib.nvim",
|
||||
"nvim-neotest/nvim-nio",
|
||||
-- if not already installed, you may also want:
|
||||
{ "nvim-telescope/telescope.nvim", optional = true },
|
||||
-- "hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
require("papis").setup({
|
||||
init_filetypes = prose_ft,
|
||||
})
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"barreiroleo/ltex_extra.nvim",
|
||||
branch = "dev",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue