#[NeoVim] Why doesn't `os.getenv` work?

10 messages · Page 1 of 1 (latest)

slow mirage
#

I tried to get $HOME and $PREFIX before with os.getenv, but it didn't work. I had to resort to using this atrocity:

vim.fn.system("echo $HOME"):match("^%s*(.-)%s*$")

The above is something I had to do because this:

os.getenv "HOME"

Did not seem to work.

Why is Termux like this? Why can't I get $HOME the normal way?

blazing dome
#

works with both bash and fish

trim torrent
#

it should also work in bash, zsh and fish

slow mirage
#

Zsh

#

Sorry, I got confused.
Getting $HOME works fine, but getting $OSTYPE does not. Why is that?

#

This gives linux-android:

:lua print(vim.fn.system "echo $OSTYPE")

But this returns nil:

:lua print(os.getenv "OSTYPE")
blazing dome
#

my shell doesnt declare OSTYPE

trim torrent
#

you can use uname or not check if TERMUX_* exist