Skip to content

Instantly share code, notes, and snippets.

@betaboon

betaboon/zsh.nix Secret

Created April 2, 2019 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaboon/9353abc362de0552ccfdc27d2306c470 to your computer and use it in GitHub Desktop.
Save betaboon/9353abc362de0552ccfdc27d2306c470 to your computer and use it in GitHub Desktop.
{ config, pkgs, ... } :
{
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
shellAliases = rec {
l = "ls -1";
ls = "ls --color=auto";
ll = "ls --color=auto -al";
vim = "nvim";
vi = "vim";
v = "vi";
r = "ranger";
t = "tig";
".." = cd1;
cd1 = "cd ..";
cd2 = "cd ../..";
cd3 = "cd ../../../";
cd4 = "cd ../../../..";
cd5 = "cd ../../../../..";
bell = "echo -e \"\a\"";
};
enableCompletion = true;
interactiveShellInit = let
colors = import ../desktop/colors.nix;
antibodyBundleFile = pkgs.writeText "antibody-bundle.txt" ''
eendroroy/alien
zsh-users/zsh-completions
zsh-users/zsh-autosuggestions
zdharma/fast-syntax-highlighting
# it would be better to select what we actually need
robbyrussell/oh-my-zsh
'';
in with colors; ''
# hacks required to use oh-my-zsh plugins with antibody
# see: https://github.com/getantibody/antibody/issues/218
DISABLE_AUTO_UPDATE=true
ZSH="$(antibody home)/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh"
# configure alien
USE_NERD_FONT=1
ALIEN_THEME="gruvbox"
ALIEN_PROMPT_SYM=ﬦ
ALIEN_SECTIONS_LEFT_SEP_SYM=
ALIEN_SECTIONS_RIGHT_SEP_SYM=
ALIEN_SECTIONS_LEFT=(exit user path vcs_branch:async vcs_status:async vcs_dirty:async newline venv ssh prompt)
ALIEN_SECTION_USER_HOST=1
ALIEN_SECTION_PATH_COMPONENTS=3
# load antibody plugins
source <(antibody init)
antibody bundle < ${antibodyBundleFile}
# install direnv hook
eval "$(direnv hook zsh)"
# bind some keys
bindkey -e
bindkey "^[[c" forward-word
bindkey "^[[d" backward-word
'';
};
environment.systemPackages = with pkgs; [
antibody
direnv
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment