lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.29k stars 386 forks source link

Autocompletion using '\' instead of '/' in paths (Windows 10) #2954

Closed Lucho32-byte closed 1 month ago

Lucho32-byte commented 1 month ago

Description

I'm currently using a Windows 10 Laptop (No WSL) but the autocompletion for the following path sources appears to be using backslash "\" instead of "/":

imagen imagen imagen imagen

However, [graphics] source seems to be working fine imagen

Currently as a workaround I've just modified the lines 478, 483, 504 and 525 from the file vimtex/autoload/vimtex/complete.vim with the function substitute to patch this behaviour:

          \ 'word': substitute(fnamemodify(x, ':r'), '\\', '/', 'g'),
          " or
          \ 'word': substitute(x, '\\', '/', 'g'),

Steps to reproduce

  1. Minimal folder structure
    ~\test/..
    images
    └ stuff.pdf
    src
    │ firstsection.tex
    └ secondsection.tex
    main.tex
  2. Minimal latex file
    
    \documentclass[a4paper, 10pt]{article}
    \begin{document}

% The problem's with the following commands \input{} \include{} \includepdf{} \includestandalone{}

% This works fine \includegraphics{}

\end{document}


### Expected behavior

Autocompletion should use the '/' syntax for paths.

### Actual behavior

Instead, autocompletion is using the traditional Windows '\\' syntax.

### Do you use a latexmkrc file?

No

### VimtexInfo

```yaml
System info:
  OS: LAPTOP-H90H219I (Microsoft Windows 10 Home Single Language)
  Vim version: NVIM v0.9.5
  Has clientserver: true
  Servername: \\.\pipe\nvim.32700.0

VimTeX project: main
  base: main.tex
  root: C:\Users\LUIS\test
  tex: C:\Users\LUIS\test/main.tex
  main parser: fallback current file
  document class: 
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
lervag commented 1 month ago

Does this work as expected if you use set shellslash in your config?

PS! I really don't like Windows.

Lucho32-byte commented 1 month ago

PS! I really don't like Windows.

Fair enough xd

Does this work as expected if you use set shellslash in your config? It solves the autocompletion problem, but introduces two additional problems:

  • I'm afraid this option breaks the use of the term (:te command), since I'm using cmd.exe as default shell. imagen And the documentation says its meant to be used in unix like shells imagen

In addition, this option breaks mechanisms in other plugins dependent on plenary.path (like telescope).

lervag commented 1 month ago

Does this work as expected if you use set shellslash in your config? It solves the autocompletion problem, but introduces two additional problems:

  • I'm afraid …

I'm not suggesting it as a solution, I just want to know if setting it fixes the present issue. I guess that my intent was unclear. I understand it will likely cause other problems. So, please, could you check if :set shellescape will fix the completion related issue?

Lucho32-byte commented 1 month ago

Sorry, I forgot to answer the original question. Yes, actually it solves the autocompletion:

imagen imagen imagen imagen

lervag commented 1 month ago

Thanks. I'm pushing an update that I believe fixes this now; please test and help verify that it indeed fixes the problem.

Lucho32-byte commented 1 month ago

It works! (I've disabled the shellslash option)

imagen

imagen

imagen

imagen

Thanks for the quick response :D

lervag commented 1 month ago

Great, glad to hear it!