From fb8c6c67c62566096091b3ddac5d049f851e56af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Tue, 18 Nov 2025 10:52:34 +0100 Subject: [PATCH] Add a template and a function for LaTeX Makefile Also remove any function tied to 42 and comment out the Plugin manager. --- vim/.vimrc | 32 +++++++++++++++----------------- vim/templates/Makefile_latex | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 vim/templates/Makefile_latex diff --git a/vim/.vimrc b/vim/.vimrc index 1b75e75..7748a0e 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -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 index 0000000..7d7adfc --- /dev/null +++ b/vim/templates/Makefile_latex @@ -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) -- 2.30.2