Allow to override particular environment variables in builtin Terminal

This commit is contained in:
Alexander Zolotov
2018-06-13 19:45:58 +03:00
parent 0ee075b02c
commit c8d2f5d619
3 changed files with 54 additions and 2 deletions
+19 -1
View File
@@ -43,4 +43,22 @@ if [ -n "$JEDITERM_SOURCE" ]
then
source $(echo $JEDITERM_SOURCE)
unset JEDITERM_SOURCE
fi
fi
function override_jb_variables {
for VARIABLE in $(env)
do
NAME=${VARIABLE%%=*}
if [[ $NAME = '_INTELLIJ_FORCE_SET_'* ]]
then
NEW_NAME=${NAME:20}
if [ -n "$NEW_NAME" ]
then
VALUE=${VARIABLE#*=}
export "$NEW_NAME"="$VALUE"
fi
fi
done
}
override_jb_variables
+17 -1
View File
@@ -16,4 +16,20 @@ end
if test -n "$JEDITERM_SOURCE"
. "$JEDITERM_SOURCE"
set -e JEDITERM_SOURCE
end
end
function override_jb_variables {
for variable in (env)
set name_and_value (string split -m 2 "=" -- $variable)
set name $name_and_value[1]
set value $name_and_value[2]
if string match -q -- "_INTELLIJ_FORCE_SET_*" $name
set new_name (string sub -s 21 -- $name)
if [ $new_name ]
set -x $new_name $value
end
end
end
}
override_jb_variables
@@ -31,6 +31,22 @@ function load_interactive_configs {
fi
}
function override_jb_variables {
for VARIABLE in $(env)
do
NAME=${VARIABLE%%=*}
if [[ $NAME = '_INTELLIJ_FORCE_SET_'* ]]
then
NEW_NAME=${NAME:20}
if [ -n "$NEW_NAME" ]
then
VALUE=${VARIABLE#*=}
export "$NEW_NAME"="$VALUE"
fi
fi
done
}
if [ -n $LOGIN_SHELL ]; then
load_login_configs
unset LOGIN_SHELL
@@ -38,6 +54,8 @@ fi
load_interactive_configs
override_jb_variables
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
bind '"\e\e[C":forward-word'
bind '"\e\e[D": backward-word'