diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index 252723a..7040622 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -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', [[]], {noremap = true, silent = true}) @@ -130,7 +147,16 @@ wk.register({ D = {'tabclose', 'Close tab'}, J = {'tabprev', 'Previous tab'}, K = {'tabnext', 'Next tab'}, - N = {'tabnew', 'New tab'} + N = {'tabnew', '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 = { diff --git a/home/.config/nvim/lua/modules/completion.lua b/home/.config/nvim/lua/modules/completion.lua index e0f14b4..1b1d181 100644 --- a/home/.config/nvim/lua/modules/completion.lua +++ b/home/.config/nvim/lua/modules/completion.lua @@ -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..setup(...) --> lspconf..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..setup(...) --> lspconf..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({ diff --git a/home/.config/nvim/lua/modules/editor.lua b/home/.config/nvim/lua/modules/editor.lua index 74e2f9f..3598ed5 100644 --- a/home/.config/nvim/lua/modules/editor.lua +++ b/home/.config/nvim/lua/modules/editor.lua @@ -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() diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index a8ca6fb..c56b385 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -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 )