blob: bd911f9ec08ede4f5fc518000fe15c488201bf0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
" Echoes longest line number and lenght.
function! LongestLineLength ( )
let maxlength = 0
let linenumber= 1
while linenumber <= line("$")
exe ":".linenumber
let linelength = virtcol("$")
if maxlength < linelength
let maxlength = linelength
let maxlinenumber = linenumber
endif
let linenumber = linenumber+1
endwhile
"exe ':0'
"exe 'normal O'
"exe 'normal 0C'.maxlength
exe "normal" . maxlinenumber . "G"
exe ":echo \"" . maxlinenumber . ": " . maxlength . "\""
endfunction
command LongestLineLength call LongestLineLength()
" Save markdown document and export to pdf using pandoc.
"
" It would be nicer if a default document would be used but I coulnd't made it
" to work even after reading that manual section like 2 times. Also, there are
" variables that are lists of other variables that I don't know how to make them
" work (e.g. geometry=[top=1in, bottom=1in, heightrounded])
function! Md2Pdf ( )
exe ":w"
"-N for numbered headers
exe ":! pandoc -o \"" . expand("%:r") . ".pdf\" -t latex --variable classoption=twosides --variable papersize=a4 --variable margin-left=1in --variable margin-right=1in --variable margin-top=1in --variable margin-bottom=1in --variable links-as-notes --variable colorlinks --variable pagestyle=plain --variable documentclass=article -f markdown-implicit_figures \"" . expand("%") . "\""
echo "pdf saved as \"" . expand("%:p:r") . ".pdf\""
endfunction
function! Md2Pdfms ( )
exe ":w"
exe ":! pandoc -o " . expand("%:r") . ".pdf" . " -t ms -f markdown-implicit_figures \"" . expand("%") . "\""
echo "pdf saved as " . expand("%:p:r") . ".pdf"
endfunction
command Md2Pdf call Md2Pdf()
command Md2Pdfms call Md2Pdfms()
" Save markdown document and export to html using pandoc
function! Md2Html ( )
exe ":w"
"exe ":! pandoc -s --toc -H ~/mahcode/markdown/pandoc/pandoc_style.html --highlight-style tango -o \"" . expand("%:r") . ".html\"" . " \"" . expand("%") . "\""
exe ":! pandoc --highlight-style tango -o \"" . expand("%:r") . ".html\"" . " \"" . expand("%") . "\""
echo "html saved as " . expand("%:p:r") . ".html"
endfunction
command Md2Html call Md2Html()
" Save markdown as ODT file (.docx is also possible)
function! Md2Odt ( )
exe ":w"
exe ":! pandoc -s --toc -H ~/mahcode/markdown/pandoc/pandoc_style.html --highlight-style tango -o \"" . expand("%:r") . ".odt\"" . " \"" . expand("%") . "\""
echo "ODT saved as " . expand("%:p:r") . ".odt"
endfunction
command Md2Odt call Md2Odt()
" Compiles and Runs a C++ project
" TODO: how to add program's arguments or file redirectioning from command.
function! CompRunProj ( )
exe ":w"
exe ":! g++ -o " . expand("%:r") . "-g *.cpp"
exe ":! ./" . expand("%:r")
endfunction
command CompRunProj call CompRunProj()
" Function made to give feedback to students code in 1INF01
" export C code to syntax highlighted pdf
function! C2Pdf ( )
exe ":set ts=4"
exe ":w"
exe ":ha > %.ps"
exe ":!ps2pdf %.ps"
exe ":!rm %.ps"
endfunction
command C2Pdf call C2Pdf()
|