Questions tagged [environment-variables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
51 views

Force Vim to only use 80 columns

I would like Vim (run in a terminal) to only use the leftmost 80 columns of the terminal (i.e., not display anything in the columns right of that). Of course, I don't want to have to resize my ...
a3nm's user avatar
  • 435
0 votes
1 answer
41 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_: ...
Chris Heithoff's user avatar
0 votes
0 answers
333 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 ...
gdupras's user avatar
  • 186
1 vote
2 answers
575 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 ...
Xxxo's user avatar
  • 187
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 ...
Damien L's user avatar
  • 173
1 vote
0 answers
131 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/...
Fortran's user avatar
  • 111
0 votes
2 answers
1k 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 =...
Boyd's user avatar
  • 209
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/...
roachsinai's user avatar
3 votes
1 answer
773 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 ...
Tim Mak's user avatar
  • 133
2 votes
2 answers
639 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 ...
Leo Simon's user avatar
  • 715
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 ...
Todd Walton's user avatar
3 votes
2 answers
378 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:
Konstantin Glukhov's user avatar
3 votes
0 answers
208 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/...
gfe's user avatar
  • 245
1 vote
1 answer
47 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 ...
OJFord's user avatar
  • 435
0 votes
1 answer
259 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?
leeand00's user avatar
  • 3,577
4 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 ...
NunonuN's user avatar
  • 43
3 votes
2 answers
8k 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 ...
flow2k's user avatar
  • 157
7 votes
2 answers
7k 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 ...
SLN's user avatar
  • 547
2 votes
0 answers
841 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' ...
Fisher's user avatar
  • 1,086
2 votes
1 answer
971 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....
Trevor Boyd Smith's user avatar
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?
leeand00's user avatar
  • 3,577
1 vote
1 answer
459 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 ...
user123456's user avatar
1 vote
2 answers
518 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 ...
Tom Hale's user avatar
  • 2,681
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....
login-redirected-me-to-signup's user avatar
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 ...
René Nyffenegger's user avatar