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

:VimtexInfo fails in iVim (iPadOS) #2647

Closed
bwhelm opened this issue Feb 25, 2023 · 10 comments
Closed

:VimtexInfo fails in iVim (iPadOS) #2647

bwhelm opened this issue Feb 25, 2023 · 10 comments
Labels

Comments

@bwhelm
Copy link

bwhelm commented Feb 25, 2023

Description

With iVim on iPadOS (which does not have access to a LaTeX installation), running :VimtexInfo on a blank .tex document results in the following error:

Error detected while processing function vimtex#info#open[2]..vimtex#scratch#new[2]..211[32]..213[4]..191[1]..192[1]..<SNR>124_get_os_info: line 9:
E684: list index out of range: 0
Error detected while processing function vimtex#info#open[2]..vimtex#scratch#new[2]..211[32]..213[4]..191: line 1:
E714: List required

Steps to reproduce

  1. Launch vim
  2. :set ft=tex
  3. :VimtexInfo

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

See above for error message.
@bwhelm bwhelm added the bug label Feb 25, 2023
@lervag
Copy link
Owner

lervag commented Feb 25, 2023

With iVim on iPadOS (which does not have access to a LaTeX installation), running :VimtexInfo on a blank .tex document results in the following error:

Error detected while processing function vimtex#info#open[2]..vimtex#scratch#new[2]..211[32]..213[4]..191[1]..192[1]..<SNR>124_get_os_info: line 9:
E684: list index out of range: 0

Interesting. This is the part that is failing:

elseif l:os ==# 'mac'
let l:name = vimtex#jobs#cached('sw_vers -productName')[0]
let l:version = vimtex#jobs#cached('sw_vers -productVersion')[0]
let l:build = vimtex#jobs#cached('sw_vers -buildVersion')[0]
return l:name . ' ' . l:version . ' (' . l:build . ')'

So, essentially, the commands sw_vers -productName and so on does not work on your device. It would be very useful if you were able to investigate this on your end. Are you able to get a bash shell or similar on your device in which you can check if these commands work?

@bwhelm
Copy link
Author

bwhelm commented Feb 25, 2023

iPadOS and iOS are quite limiting, with each app in its own sandbox, so there is no full shell and only a limited number of commands available in iVim; sw_vers is not among them. Here’s the complete list available in iVim:

2to3 alias awk bc cat catimg cd chardetect chflags chksum compress ctags curl cut cр date de diff dig du easy easy_install-3.7 echo egrep env exit fgrep file find gl grep gunzip gzip head help history host ifconfig install ivish less link ln ls lua luac md5 mkdir mv nc nslookup open openurl pbcopy pbpaste ping pip pip3 pip3.7 printenv pwd pydoc3 python3 readlink rlogin rm rmdir say scp sed setenv sftp sort ssh ssh-keygen stat sum tail tar tee telnet titlecase touch tqdm tr unalias uname uncompress unidecode unig unlink unsetenv uptime wc whoami whois xargs xxd

I don’t see anything there that can retrieve this info, though some of it could be scraped from :version.

@lervag
Copy link
Owner

lervag commented Feb 25, 2023

I could do something like this:

    if executable('sw_vers')
      let l:name = vimtex#jobs#cached('sw_vers -productName')[0]
      let l:version = vimtex#jobs#cached('sw_vers -productVersion')[0]
      let l:build = vimtex#jobs#cached('sw_vers -buildVersion')[0]
      return l:name . ' ' . l:version . ' (' . l:build . ')'
    else
      " fallback
      return 'MacOS/iPadOS'
    endif

Do you have a better suggestion for the fallback-text?

@bwhelm
Copy link
Author

bwhelm commented Feb 25, 2023

That would certainly work around the problem. As for fallback text, it really depends on what debug info you want to get. Perhaps you’d want something like:

redir => l:versionText
silent version
redir END
let l:versionList = split(l:versionText, '\n')[:2]
return 'MacOS/i[Pad]OS: ' . join(l:versionList, "\n")

(Note that I’ve written “i[Pad]OS”: iVim works on iOS — on iPhones — as well as on iPadOS.)

@lervag
Copy link
Owner

lervag commented Feb 25, 2023

That would certainly work around the problem. As for fallback text, it really depends on what debug info you want to get.

Yes. I want to get as much info on the current OS as possible. :version does not really work well in most cases. E.g., on Arch Linux with neovim, I get this with :version:

NVIM v0.9.0-dev-1009+gf1816f9ee2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion
-Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes
-Wno-unused-result -Wimplicit-fallthrough -Wvla -fno-common
-fdiagnostics-color=always -fstack-protector-strong -DNVIM_MSGPACK_HAS_FLOAT32
-DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR
-DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DMIN_LOG_LEVEL=3
-DNVIM_UNIBI_HAS_VAR_FROM -I/usr/include/luajit-2.1 -I/usr/include
-I/usr/include -I/usr/include -I/usr/include -I/usr/include
-I/home/lervag/.cache/paru/clone/neovim-git/src/build/src/nvim/auto
-I/home/lervag/.cache/paru/clone/neovim-git/src/build/include
-I/home/lervag/.cache/paru/clone/neovim-git/src/build/cmake.config
-I/home/lervag/.cache/paru/clone/neovim-git/src/neovim/src -I/usr/include
-I/usr/include -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
     fall-back for $VIM: "/usr/share/nvim"

     Run :checkhealth for more info

(Note that I’ve written “i[Pad]OS”: iVim works on iOS — on iPhones — as well as on iPadOS.)

Thanks! I'll go with this for now.

@lervag
Copy link
Owner

lervag commented Feb 25, 2023

What's the output of :!uname -a on your system?

lervag added a commit that referenced this issue Feb 25, 2023
@lervag lervag closed this as completed Feb 25, 2023
@lervag
Copy link
Owner

lervag commented Feb 25, 2023

Please check that the last update fixes things for you.

@bwhelm
Copy link
Author

bwhelm commented Feb 25, 2023

Darwin Aristotle-iPad 22.3.0 Darwin Kernel Version 22.3.0: Wed Jan 4 21:24:51 PST 2023; root:xnu-8792.8
2.2~1/RELEASE_ARM64_T8020 iPad8,9

Note that if you’re into this part of the code, presumably you’re on i[Pad]OS, and presumably in the iVim app. So it might be more reliable to scrape from version, at least to get info on the vim version. Nonetheless, that’s not reliably future proof.

@bwhelm
Copy link
Author

bwhelm commented Feb 25, 2023

Running VimtexInfo now seems to work, giving this output:

System info:
  OS: MacOS/i[Pad]OS
  Vim version: VIM 8.1 (1-2110)
  Has clientserver: false

VimTeX project: 
  name: 
  base: 
  root: .
  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

In short, it looks like it’s working. Thanks!

@lervag
Copy link
Owner

lervag commented Feb 25, 2023

Great, glad to see it. I think this should suffice; if I need more info from people I'll just ask.

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