mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Add direnv support
This commit is contained in:
parent
d52e1d1f82
commit
52e20aca38
5 changed files with 28 additions and 0 deletions
2
bash/ext
2
bash/ext
|
|
@ -4,6 +4,8 @@
|
|||
# Hooks
|
||||
# derived from http://glyf.livejournal.com/63106.html
|
||||
|
||||
# TODO: support precmd_functions and chpwd_functions arrays
|
||||
|
||||
# default: NOOPs
|
||||
function preexec { :; }
|
||||
function precmd { :; }
|
||||
|
|
|
|||
1
bash/rc
1
bash/rc
|
|
@ -20,6 +20,7 @@ GIT_PS1_SHOWUNTRACKEDFILES=1
|
|||
|
||||
precmd() {
|
||||
LAST_CMD_RC=$?
|
||||
_direnv_hook
|
||||
#clear_incomplete_line
|
||||
set_prompt
|
||||
update_terminal_cwd
|
||||
|
|
|
|||
21
shell/direnv
Executable file
21
shell/direnv
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
if command -v direnv 2>&1 >/dev/null; then
|
||||
if [[ -n $BASH_VERSION ]]; then
|
||||
# eval "$(direnv hook bash)"
|
||||
_direnv_hook() {
|
||||
local previous_exit_status=$?;
|
||||
trap -- '' SIGINT;
|
||||
eval "$("${HOME}/.nix-profile/bin/direnv" export bash)";
|
||||
trap - SIGINT;
|
||||
return $previous_exit_status;
|
||||
};
|
||||
fi
|
||||
if [[ -n $ZSH_VERSION ]]; then
|
||||
# eval "$(direnv hook zsh)"
|
||||
_direnv_hook() {
|
||||
trap -- '' SIGINT;
|
||||
eval "$("${HOME}/.nix-profile/bin/direnv" export zsh)";
|
||||
trap - SIGINT;
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -5,4 +5,6 @@
|
|||
#export DOCKER_CERT_PATH="/Users/lloeki/.docker/machine/machines/default"
|
||||
#export DOCKER_MACHINE_NAME="default"
|
||||
|
||||
export DOCKER_HOST=ssh://172.16.50.2
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
|||
2
zsh/rc
2
zsh/rc
|
|
@ -13,6 +13,7 @@ source $DOTFILES_ZSH_DIR/completion
|
|||
source $DOTFILES_ZSH_DIR/prompt
|
||||
source $DOTFILES_ZSH_DIR/fzf
|
||||
source $DOTFILES_SHELL_DIR/go
|
||||
source $DOTFILES_SHELL_DIR/direnv
|
||||
|
||||
set -o ignoreeof
|
||||
unsetopt BEEP
|
||||
|
|
@ -24,6 +25,7 @@ GIT_PS1_SHOWUNTRACKEDFILES=1
|
|||
|
||||
precmd() {
|
||||
LAST_CMD_RC=$?
|
||||
_direnv_hook
|
||||
psvar=()
|
||||
set_prompt
|
||||
set_term_title
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue