Skip to content

You need to enable direnv with a bashrc hook on a clean VM #3

@cognivore

Description

@cognivore
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

eval "$(direnv hook bash)"

Installer doesn't seem to be appending the hooks. Here are hooks: https://github.com/direnv/direnv/blob/master/docs/hook.md

BASH

Add the following line at the end of the ~/.bashrc file:

eval "$(direnv hook bash)"

Make sure it appears even after rvm, git-prompt and other shell extensions
that manipulate the prompt.

ZSH

Add the following line at the end of the ~/.zshrc file:

eval "$(direnv hook zsh)"

Oh my zsh

Oh my zsh has a core plugin with direnv support.

Add direnv to the plugins array in your zshrc file:

plugins=(... direnv)

FISH

Add the following line at the end of the ~/.config/fish/config.fish file:

direnv hook fish | source

Fish supports 3 modes you can set with the global environment variable direnv_fish_mode:

set -g direnv_fish_mode eval_on_arrow    # trigger direnv at prompt, and on every arrow-based directory change (default)
set -g direnv_fish_mode eval_after_arrow # trigger direnv at prompt, and only after arrow-based directory changes before executing command
set -g direnv_fish_mode disable_arrow    # trigger direnv at prompt only, this is similar functionality to the original behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions