I was trying to get the configure file’s location using echo stdpath("config")
and the console showed E117: unknown function: stdpath
- Reinstall tried (isn’t thorough enough because
vimrc
stayed) Vimrc
delete tried
Both these methods made no progress
Jacob Gong is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
stdpath()
is only available in Neovim so you can’t use it in Vim.
The two programs share some DNA and there is still some cross-pollinisation happening but they are not the same program and there is no reason whatsoever to expect something that works in one to also work in the other.
FWIW, if by “the configure file’ location” you mean “the location of my vimrc
“, then you can get it with :echo $MYVIMRC
in both Vim and Neovim.
The stdpath()
function seems to be specific to Neovim.
There’s no such function in Vim and that’s why it gives E117: Unknown function
.
The following line of Vimscript should give the analogue result, i.e. the path where vimrc
is stored:
:echo fnamemodify(expand('$MYVIMRC'), ':p:h')
The MYVIMRC
environment variable holds the path to your vimrc
, We expand it, turn it into an absolute path and take its head, i.e. everything but the file name itself. See the example given at :help fnamemodify()
.