Added initial code.

This commit is contained in:
eplots 2024-07-03 21:06:41 +02:00
parent b20c62c46e
commit aa8e08afca
27 changed files with 565 additions and 8 deletions

View file

@ -0,0 +1,19 @@
function! ExportMarkdownToPDF()
let l:input_file = expand('%') " Hämtar det aktuella filnamnet
let l:output_file = input('Ange filnamn för PDF: ', expand('%:r') . '.pdf', 'file')
if l:output_file == ''
echo 'Inget filnamn angivet. Export avbruten.'
return
endif
let l:command = 'python3 /path/to/your/script/md_to_pdf.py ' . shellescape(l:input_file, 1) . ' ' . shellescape(l:output_file, 1)
execute '!' . l:command
echo 'PDF genererad: ' . l:output_file
" Lägg till ett kommando för att öppna PDF med Zathura
if filereadable(l:output_file)
silent execute '!zathura ' . shellescape(l:output_file, 1) . ' &'
redraw!
endif
endfunction
command! ExportToPDF call ExportMarkdownToPDF()
nnoremap <F7> :ExportToPDF<CR>

View file

@ -0,0 +1,2 @@
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!python3' shellescape(@%, 1)<CR>