mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-24 16:28:22 -05:00
neovim: add a snippet for using pandoc
This commit is contained in:
parent
6f78887641
commit
a8e3fb728b
@ -1,6 +1,23 @@
|
||||
local api = vim.api
|
||||
local wk = require('which-key')
|
||||
|
||||
local function pandoc_convert(ofiletype)
|
||||
if ofiletype == nil then
|
||||
ofiletype = 'html'
|
||||
end
|
||||
|
||||
local ifilename = vim.fn.expand('%:p')
|
||||
local ofilename = vim.fn.expand('%:p:r') .. '.' .. ofiletype
|
||||
local cmd
|
||||
|
||||
if ofiletype == 'pdf' then
|
||||
cmd = string.format('pandoc %s -o %s --pdf-engine=xelatex -V "mainfont:Iosevka Etoile" -V "sansfont:Iosevka Aile" -V "monofont:Iosevka" -V "geometry:margin=1in"', ifilename, ofilename)
|
||||
else
|
||||
cmd = string.format('pandoc %s -o %s', ifilename, ofilename)
|
||||
end
|
||||
vim.fn.jobstart(cmd)
|
||||
end
|
||||
|
||||
-- No one likes Esc
|
||||
api.nvim_set_keymap('i', 'jk', [[<Esc>]], {noremap = true, silent = true})
|
||||
|
||||
@ -130,7 +147,16 @@ wk.register({
|
||||
D = {'<Cmd>tabclose<CR>', 'Close tab'},
|
||||
J = {'<Cmd>tabprev<CR>', 'Previous tab'},
|
||||
K = {'<Cmd>tabnext<CR>', 'Next tab'},
|
||||
N = {'<Cmd>tabnew<CR>', 'New tab'}
|
||||
N = {'<Cmd>tabnew<CR>', 'New tab'},
|
||||
v = {
|
||||
name = 'Convert',
|
||||
m = {function() pandoc_convert('md') end, 'To Markdown'},
|
||||
o = {function() pandoc_convert('org') end, 'To Org'},
|
||||
p = {function() pandoc_convert('pdf') end, 'To PDF'},
|
||||
r = {function() pandoc_convert('rst') end, 'To RST'},
|
||||
t = {function() pandoc_convert('tex') end, 'To LaTeX'},
|
||||
w = {function() pandoc_convert('html') end, 'To HTML'}
|
||||
}
|
||||
},
|
||||
|
||||
d = {
|
||||
|
@ -170,20 +170,20 @@ function M.snippets_conf()
|
||||
require('luasnip/loaders/from_vscode').load()
|
||||
end
|
||||
|
||||
function M.coq_conf()
|
||||
-- To add snippets from lsp servers, change lsp.lua:
|
||||
-----
|
||||
-- local coq = require('coq')
|
||||
-- lspconf.<server>.setup(...) --> lspconf.<server>.setup(coq.lsp_ensure_capabilities(...))
|
||||
vim.g.coq_settings = {
|
||||
auto_start = true,
|
||||
display = {
|
||||
icons = {
|
||||
mode = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
-- function M.coq_conf()
|
||||
-- -- To add snippets from lsp servers, change lsp.lua:
|
||||
-- -----
|
||||
-- -- local coq = require('coq')
|
||||
-- -- lspconf.<server>.setup(...) --> lspconf.<server>.setup(coq.lsp_ensure_capabilities(...))
|
||||
-- vim.g.coq_settings = {
|
||||
-- auto_start = true,
|
||||
-- display = {
|
||||
-- icons = {
|
||||
-- mode = 'none'
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- end
|
||||
|
||||
function M.autotag_conf()
|
||||
require('nvim-ts-autotag').setup({
|
||||
|
@ -113,7 +113,7 @@ function M.matchup_conf()
|
||||
end
|
||||
|
||||
function M.hop_conf()
|
||||
require('hop').setup{keys = 'etovxqpdygfblzhckisuran'}
|
||||
require('hop').setup {keys = 'etovxqpdygfblzhckisuran'}
|
||||
end
|
||||
|
||||
function M.eft_conf()
|
||||
|
@ -298,7 +298,7 @@ return require('packer').startup(
|
||||
}},
|
||||
config = tools.neogit_conf
|
||||
}
|
||||
use {
|
||||
use { -- TODO: replace with code_runner.nvim
|
||||
'skywind3000/asynctasks.vim',
|
||||
cmd = {
|
||||
'AsyncTask',
|
||||
@ -316,7 +316,7 @@ return require('packer').startup(
|
||||
use {
|
||||
'iamcco/markdown-preview.nvim',
|
||||
run = 'cd app && yarn install',
|
||||
ft = {'markdown', 'pandoc.markdown', 'rmd'},
|
||||
ft = {'markdown', 'rmd'},
|
||||
config = tools.markdown_preview_conf
|
||||
}
|
||||
use {
|
||||
@ -398,6 +398,6 @@ return require('packer').startup(
|
||||
-- use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
|
||||
|
||||
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*,
|
||||
-- vim-pandoc, nvim-bqf, nvim-comment-frame
|
||||
-- nvim-bqf, nvim-comment-frame, nvim-revJ.lua
|
||||
end
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user