I'm french... sorry for my english
I try to compile files (.tex, .md ... using vim). I open terminal and make the compilation ; just before the compilation i save the file and put a marker in the place i am. But, after the compilation, the cursor is on first line and not at the place where i put the marker. I don't know how to do in order that the cursor is in the same place before and after the compilation. Can you help me ? the line for compilation in my .vimrc (for markdown --> pdf for example) :
nnoremap \p mz:w<CR>:terminal<CR><C-w>J<C-w>24-file=$(ls -1t \| head -1)<CR>name=${file%.*}<CR>pandoc $name".md" -o $name".pdf" && exit 0<CR>`z
this line puts a marker (z) where i am in the file, opens a terminal, reduces it in the bottom of the screen, find the file, makes the compilation in order to have a pdf file, and then exit the terminal. Then, with `z I would try to go to the place where I was before compilation but it doesn't work, the cursor is in "gg". I can go to the initial position with `z manually but I would want to make it automatically in my vimrc.
I have tried with marker (as above) and also with functions getpos, setpos but also with winsaveview, winrestview, the result is the same : cursor in "gg".
it seems the fact to close terminal produces this issue. Can you help me please ?
vim --clean, for example) See How do I debug my vimrc file? – B Layer Oct 15 '20 at 00:08