Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Citation completion not working on windows unless full ~/textmf/bibtex/bib/... path is specified #2322

Closed
lyeoh opened this issue Feb 4, 2022 · 3 comments
Labels

Comments

@lyeoh
Copy link

lyeoh commented Feb 4, 2022

Description

I'm not sure if it's just my setup or which versions of kpsewhich are doing this but as of kpathsea version 6.3.3, the absolute paths that kpsewhich returns can have a lowercase drive letter on windows. Then vimtex#kpsewhich#find thinks this is a relative path and prepends l:root to it.

Steps to reproduce

  1. nvim -u minimal.vim minimal.tex
  2. :VimtexCompile
  3. enter insert mode in the \cite command \cite{citeke|}
  4. attempt citation completion with <C-X><C-O>

minimal.tex

\documentclass{article}
\begin{document}
\cite{citeke}
\bibliographystyle{unsrt}
\bibliography{minimal}
% \bibliography{C:/Users/luke/texmf/bibtex/bib/minimal.bib}
\end{document}

minimal.vim

set nocompatible
let &runtimepath  = '~/AppData/Local/nvim/plugged/vimtex,' . &runtimepath
let &runtimepath .= ',~/AppData/Local/nvim/plugged/vimtex/after'
filetype plugin indent on
syntax enable

~\texmf\bibtex\bib\minimal.bib

@article{citekey,
  title = {Title},
  author = {Author},
  year = {Year},
  journal = {Journal},
}

Expected behavior

citeke completes to citekey

Actual behavior

  • No completion takes place, with the error message Pattern not found.
  • :echo vimtex#bib#files() returns []
  • :echo vimtex#kpsewhich#find('minimal.bib') returns C:\Users\luke\Downloads\issue/c:Users/luke/texmf/bibtex/bib/minimal.bib
  • :echo vimtex#jobs#capture('kpsewhich minimal.bib') returns ['c:/Users/luke/texmf/bibtex/bib/minimal.bib']

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: WINDOUGH (Microsoft Windows 10 Education)
  Vim version: NVIM v0.4.4
  Has clientserver: true
  Servername: \\.\pipe\nvim-60692-0

VimTeX project: minimal
  base: minimal.tex
  root: C:\Users\luke\Downloads\issue
  tex: C:\Users\luke\Downloads\issue\minimal.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 5
      output: C:\Users\luke\AppData\Local\Temp\nvimOclcoH\0
      cmd: set max_print_line=2000 & latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -view=none -e "$compiling_cmd = ($compiling_cmd ? $compiling_cmd . ' ^& ' : '') . 'echo vimtex_compiler_callback_compiling'" -e "$success_cmd = ($success_cmd ? $success_cmd . ' ^& ' : '') . 'echo vimtex_compiler_callback_success'" -e "$failure_cmd = ($failure_cmd ? $failure_cmd . ' ^& ' : '') . 'echo vimtex_compiler_callback_failure'" "minimal.tex"
      pid: 64744
  viewer: General
    job: 
      pid: 51580
      cmd: SumatraPDF -reuse-instance -forward-search "C:\Users\luke\Downloads\issue\minimal.tex" 1 "C:\Users\luke\Downloads\issue/minimal.pdf"
  qf method: LaTeX logfile
@lyeoh lyeoh added the bug label Feb 4, 2022
@lervag
Copy link
Owner

lervag commented Feb 4, 2022

Interesting issue. Before I look into it more closely, why do you want to put the bib file under your texmf tree? If you put it in the project root, things should work as expected. I guess it is because you share a reference file between projects?

The reason it fails is probably because of these lines:

function! vimtex#paths#is_abs(path) abort " {{{1
return a:path =~# s:re_abs
endfunction
" }}}1

let s:re_abs = has('win32') ? '^[A-Z]:[\\/]' : '^/'

@lyeoh
Copy link
Author

lyeoh commented Feb 4, 2022

Yeah I have a global bib file for short one-off notes. Do you think we can just change s:re_abs to allow for lowercase drive letters? I'm not sure if passing on such a path might fail somewhere else.

lervag added a commit that referenced this issue Feb 4, 2022
@lervag
Copy link
Owner

lervag commented Feb 4, 2022

Sure, let's try that. I don't really use Windows, so please let me know if this breaks anything unexpectedly.

@lervag lervag closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants