Add a template and a function for LaTeX Makefile
authorLukáš Jiřiště <lukas.jiriste@datapartner.cz>
Tue, 18 Nov 2025 09:52:34 +0000 (10:52 +0100)
committerLukáš Jiřiště <lukas.jiriste@datapartner.cz>
Tue, 18 Nov 2025 09:53:45 +0000 (10:53 +0100)
Also remove any function tied to 42 and comment out the Plugin manager.

vim/.vimrc
vim/templates/Makefile_latex [new file with mode: 0644]

index 1b75e75a7b33cfd7990bc3c956f03e4d67120765..7748a0e5498b190a8a4ae7dd8b336886d85fb0b4 100644 (file)
@@ -1,23 +1,15 @@
-" Plugins will be downloaded under the specified directory.
-" The Plugin manager project is on https://github.com/junegunn/vim-plug
-call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
-
-" Declare the list of plugins.
-" 42 Header on F1
-Plug 'https://github.com/42Paris/42header'
-
-Plug 'vim-latex/vim-latex'
-
-" List ends here. Plugins become visible to Vim after this call.
-call plug#end()
+"" Plugins will be downloaded under the specified directory.
+"" The Plugin manager project is on https://github.com/junegunn/vim-plug
+"call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
+"
+"Plug 'vim-latex/vim-latex'
+"
+"" List ends here. Plugins become visible to Vim after this call.
+"call plug#end()
 
 " May be useful for vim-latex?
 let g:tex_flavor='latex'
 
-" Defining name and email for the 42 header
-let g:user42 = 'ljiriste'
-let g:mail42 = 'ljiriste@student.42prague.com'
-
 set nocompatible
 set tabstop=4
 set shiftwidth=0
@@ -39,7 +31,7 @@ syntax on
 filetype plugin indent on " redundant after syntax on
 
 autocmd FileType gitcommit set spell spelllang=en_us
-autocmd FileType tex set spell spelllang=en_us
+autocmd FileType tex set spell spelllang=en_us,cs
 
 function Cpp_class(classname)
        let skel = join(readfile(glob('~/.vim/templates/class_skeleton.h')), "\n")
@@ -47,3 +39,9 @@ function Cpp_class(classname)
        let skel = substitute(skel, 'CLASSNAME_H', toupper(a:classname) . "_H", 'g')
        put! =skel
 endfunction
+
+function Make_latex(target)
+       let skel = join(readfile(glob('~/.vim/templates/Makefile_latex')), "\n")
+       let skel = substitute(skel, 'target.pdf', a:target . '.pdf', 'g')
+       put! =skel
+endfunction
diff --git a/vim/templates/Makefile_latex b/vim/templates/Makefile_latex
new file mode 100644 (file)
index 0000000..7d7adfc
--- /dev/null
@@ -0,0 +1,32 @@
+
+TARGETS := target.pdf
+
+DEPS_DIR := .deps
+
+LATEXMK := latexmk \
+                       -recorder \
+                       -use-make \
+                       -deps \
+                       -e 'warn qq(In Makefile, turn off custion dependencies\n);' \
+                       -e '@cus_dep_list=();' \
+                       -e 'show_cus_dep()' \
+
+.PHONY : clean fclean re
+
+all : $(TARGETS)
+
+$(DEPS_DIR):
+       mkdir $@
+
+%.pdf : %.tex | $(DEPS_DIR)
+       $(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@.dep $<
+
+clean :
+       $(LATEXMK) -c
+
+fclean :
+       $(LATEXMK) -C
+       rm -rf $(DEPS_DIR)
+
+re : fclean
+       $(MAKE)