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" })
|
require("which-key").add({ "<localleader>p", group = "prose" })
|
||||||
end
|
end
|
||||||
-- show nice md preview in browser (auto-syncs scrolling)
|
-- show nice md preview in browser (auto-syncs scrolling)
|
||||||
|
local peek_key = "<localleader>po"
|
||||||
if require("core.util").is_available("peek") then
|
if require("core.util").is_available("peek") then
|
||||||
|
map("n", peek_key, function()
|
||||||
local peek = require("peek")
|
local peek = require("peek")
|
||||||
local function togglePeek()
|
|
||||||
if peek.is_open() then
|
if peek.is_open() then
|
||||||
peek.close()
|
peek.close()
|
||||||
else
|
else
|
||||||
peek.open()
|
peek.open()
|
||||||
end
|
end
|
||||||
end
|
end, { desc = "show md preview" })
|
||||||
map("n", "<leader>po", togglePeek, { desc = "show md preview" })
|
elseif vim.fn.exists(":MarkdownPreviewToggle") > 0 then
|
||||||
else
|
map("n", peek_key, "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
|
||||||
map("n", "<leader>po", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create mindmaps directly from markdown! requires external executable
|
-- 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 default_buffer_session = function()
|
||||||
local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
|
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"
|
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
|
-- simply attach to existing if exists
|
||||||
if vim.fn.filereadable(kernel_filen) == 1 then
|
if vim.fn.filereadable(kernel_filen) == 1 then
|
||||||
print(kernel_filen)
|
|
||||||
vim.cmd("MoltenInit " .. kernel_filen)
|
vim.cmd("MoltenInit " .. kernel_filen)
|
||||||
return
|
return
|
||||||
end
|
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" },
|
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
|
"trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
|
||||||
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
|
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
|
||||||
|
"typst-preview.nvim": { "branch": "master", "commit": "c1100e8788baabe8ca8f8cd7fd63d3d479e49e36" },
|
||||||
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
|
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
|
||||||
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
|
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
|
||||||
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
|
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ local prose_plugs = {
|
||||||
cmd = "RenderMarkdown",
|
cmd = "RenderMarkdown",
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>pp",
|
"<localleader>pm",
|
||||||
function()
|
function()
|
||||||
require("render-markdown").toggle()
|
require("render-markdown").toggle()
|
||||||
end,
|
end,
|
||||||
|
|
@ -106,29 +106,43 @@ local prose_plugs = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
--- PREVIEW SECTION
|
||||||
-- generate an auto-updating html preview for md files
|
-- generate an auto-updating html preview for md files
|
||||||
-- uses the very nice peek if deno is available, otherwise falls back to markdown-preview
|
-- uses the very nice peek if deno is available, otherwise falls back to markdown-preview
|
||||||
{
|
{
|
||||||
"toppair/peek.nvim",
|
"toppair/peek.nvim",
|
||||||
event = { "VeryLazy" },
|
|
||||||
cond = vim.fn.executable("deno") == 1,
|
cond = vim.fn.executable("deno") == 1,
|
||||||
build = "deno task --quiet build:fast",
|
build = "deno task --quiet build:fast",
|
||||||
ft = md_like,
|
ft = md_like,
|
||||||
config = function()
|
opts = {},
|
||||||
require("peek").setup()
|
|
||||||
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
|
|
||||||
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
event = { "VeryLazy" },
|
|
||||||
cond = vim.fn.executable("deno") == 0,
|
cond = vim.fn.executable("deno") == 0,
|
||||||
build = function()
|
build = function()
|
||||||
vim.fn["mkdp#util#install"]()
|
vim.fn["mkdp#util#install"]()
|
||||||
end,
|
end,
|
||||||
|
version = false,
|
||||||
ft = md_like,
|
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
|
-- easy copy paste of images into markup files
|
||||||
{
|
{
|
||||||
|
|
@ -145,7 +159,7 @@ local prose_plugs = {
|
||||||
},
|
},
|
||||||
cmd = { "PasteImage" },
|
cmd = { "PasteImage" },
|
||||||
keys = {
|
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,
|
ft = prose_ft,
|
||||||
},
|
},
|
||||||
|
|
@ -244,22 +258,25 @@ local prose_plugs = {
|
||||||
|
|
||||||
-- cite as you write from papis databases
|
-- cite as you write from papis databases
|
||||||
-- ADDITIONAL DEPENDENCIES: papis and yq in shell env
|
-- ADDITIONAL DEPENDENCIES: papis and yq in shell env
|
||||||
-- {
|
-- still same issues: slow, buggy, does not work for me
|
||||||
-- "jghauser/papis.nvim",
|
{
|
||||||
-- dependencies = {
|
"jghauser/papis.nvim",
|
||||||
-- "kkharji/sqlite.lua",
|
dependencies = {
|
||||||
-- "MunifTanjim/nui.nvim",
|
"kkharji/sqlite.lua",
|
||||||
-- "pysan3/pathlib.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
-- "nvim-neotest/nvim-nio",
|
"pysan3/pathlib.nvim",
|
||||||
-- "nvim-treesitter/nvim-treesitter",
|
"nvim-neotest/nvim-nio",
|
||||||
-- },
|
-- if not already installed, you may also want:
|
||||||
-- cond = vim.fn.executable("papis") == 1 and vim.fn.executable("yq") == 1,
|
{ "nvim-telescope/telescope.nvim", optional = true },
|
||||||
-- ft = writing_ft,
|
-- "hrsh7th/nvim-cmp",
|
||||||
-- lazy = false,
|
},
|
||||||
-- config = function()
|
config = function()
|
||||||
-- require("papis").setup({})
|
require("papis").setup({
|
||||||
-- end,
|
init_filetypes = prose_ft,
|
||||||
-- },
|
})
|
||||||
|
end,
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"barreiroleo/ltex_extra.nvim",
|
"barreiroleo/ltex_extra.nvim",
|
||||||
branch = "dev",
|
branch = "dev",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue