Questions tagged [environment-variables]
The environment-variables tag has no usage guidance.
24
questions
0
votes
1
answer
36
views
Can I isolate an environment variable name in the expand() function
In my shell, I can use curly braces to isolate the names of environment variables.
For example, if I have two env vars, ONE and TWO, equal to 1 and 2, then
> echo "$ONE_$TWO"
ONE_: ...
0
votes
0
answers
270
views
How can I make $PATH stored in Vim match the actual environment variable $PATH?
It seems that when starting Vim, it stores the value of the environment variable $PATH into its own internal variable $PATH. Then, when using $PATH anywhere inside Vim, it gets expanded into the ...
1
vote
2
answers
496
views
Use poetry shell in Vimspector
I'm using Poetry to manage my virtual environments for Python and I'm using Vimspector as a debugger plugin for Vim.
How can I use the Poetry venv when starting debugging?
I'm thinking that all that ...
7
votes
2
answers
1k
views
Why is `let foo = $HOME/bar` invalid?
Why is let foo = $HOME valid and let foo = $HOME/bar invalid in vimscript?
I have tried let foo = "$HOME/bar" but it is the equivalent of foo = '$HOME/bar' in shell script, $HOME is not ...
1
vote
0
answers
114
views
Vim Indent and Syntax environment variables?
I was building CMake today and I saw in the install output:
-- Installing: /ford1/share/gmao_SIteam/Utilities/cmake-3.19.3/share/vim/vimfiles/indent
-- Installing: /ford1/share/gmao_SIteam/Utilities/...
0
votes
2
answers
879
views
Can I use a variable in autocmd pat?
I have 3 languages and any can be a source or target so I need some flexibility.
I am successfully loading a language translation specific setup with this:
let g:tr_source = 'dyu'
let g:tr_target =...
1
vote
2
answers
3k
views
How to let Vim work with pyenv?
I've created some Python virtual environments:
hmanx ~ » pyenv virtualenvs
3.7.4/envs/nn (created from /home/roach/.pyenv/versions/3.7.4)
3.8.2/envs/py38 (created from /home/roach/.pyenv/versions/...
2
votes
1
answer
674
views
Improve copy to clipboard using xclip
I'm trying to improve the answer here for copying to clipboard in a vim without the +clipboard option. The problem with the above approach is that :w always writes the entire line, so it is not ...
2
votes
2
answers
583
views
Include the value of a system environment variable when setting title in vimrc
I have the number of my xterm (i.e., the value of /dev/tty??) saved as an environment variable, TTY e.g., echo $TTY returns 11. I'd like to include this number in the title, along with the name of ...
8
votes
2
answers
5k
views
How to change location of ~/.vim
I have Vim 7 installed from my distro's package manager, and I compiled Vim 8 from source. Vim 8 is all in /usr/local. Then I created a new directory in $HOME called ".vim8". I have all my Vim 7 stuff ...
3
votes
2
answers
359
views
Sort output of let or set
How to sort the output of let or get? E.g., I want to sort all global variables containing "python":
:filter python let g:
3
votes
0
answers
184
views
Disable expansion of environment variables when completing filenames
Let's suppose I have the following environment variable
1| export my__files=$HOME/Documents/MyFiles
Now let's suppose I am editing the file main.txt (see content below)
1| foo
2| bar
3| $my__files/...
1
vote
1
answer
43
views
Cross-platform way to execute command with clean environment?
A plugin I use executes:
silent execute '%!cmd'
which fails because of a particular environment variable I have set that deliberately modifies the behaviour of cmd.
I can fix it with:
silent ...
0
votes
1
answer
254
views
Can a vim session use environment variables to specify the path to a file it opens?
Can you edit a vim session, so that it opens a file based on the value of an environment variable instead of an absolute path to a file?
3
votes
2
answers
1k
views
Neovim-Qt: environment variable TERM not set
Running :checkhealth in NeoVim-Qt (v0.3.5) I get the following report on terminal:
ERROR: command failed: infocmp -L
infocmp: environment variable TERM not set
How can I set the environment variable ...
3
votes
2
answers
7k
views
How does VIM sets the $VIM environment variable?
I was reading http://vimdoc.sourceforge.net/htmldoc/starting.html#initialization, but couldn't immediately find the answer. Is the $VIM environment variable hardcoded in its binary (not read from a ...
7
votes
2
answers
6k
views
How to generate a string by concatenating another string with an environment variable
I need to create a variable with a fool folder direct which need to concatenate from a environment variable and the end notes
function! MyFoo(arg)
let repo=$Project + "/cfora" #Q1 ...
2
votes
0
answers
746
views
Why gf is not working with variable?
If there is no variable in path, gf can open the file.
Added sfname+={,} to .vimrc to support ${VARIABLE}.
:!echo ${VAR}/test/file can correctly print full path with ${VAR} expanded.
But if run 'gf' ...
2
votes
1
answer
813
views
How do you fix the Home and End keys producing 'H' and 'F'?
I recently was doing some Vim editing and noticed the behavior was very different for two important keys.
The only difference I made was I started bash using:
env -i bash --init-script ~/.bashrc....
2
votes
1
answer
2k
views
How to set the vim path to your bash PATH?
I'd like my $PATH to be available to vim when running commands with !. How do I set vim's set path= to my environment variable $PATH?
1
vote
1
answer
400
views
How to open a GPG encrypted file without having to choose the GPG recipient with the gnupg plugin?
I want to edit a GPG encrypted file file.asc without having to split the window to enter the recipient.
The recipient can be set in the vimrc.
:let g:GPGDefaultRecipients='<key ID>'
How would ...
1
vote
2
answers
486
views
Using get with environment variable namespace
I want to use get with the environment variable namespace, so instead of this in the global namespace:
let vim_data_dir = get(g:, 'vim_data_dir', "default value if not set")
Something like this, in ...
0
votes
1
answer
1k
views
Execute curl command with variable interpolation
I'm trying to adapt this known-working snippet for installing vim-plug:
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw....
2
votes
1
answer
59
views
Is there a platform independent way to use "${ENVVAR}more_text" in vim?
I just discovered that I am able to use ${ENVVAR}more_text in a vim installation on Unix, but not if installed on Windows.
In Unix, I did in a shell:
export ABC=/tmp/
echo foo>${ABC}foo
gvim
...