From b8cb900ec180d3d5d583b2480967add34c17957b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 23 Aug 2019 18:27:06 +0200 Subject: [PATCH] make "take" available to every shell --- configs/default.nix | 24 +++++++++++++----------- configs/zsh.nix | 5 ----- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/configs/default.nix b/configs/default.nix index 2223ef8..ca6bc92 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -185,23 +185,24 @@ environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin"; environment.shellAliases = let - wcd = - pkgs.writeScript "wcd" '' - #!/bin/sh - cd "$(${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname)/.." - ''; - where = - pkgs.writeScript "where" '' - #!/bin/sh - ${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname - ''; + wcd = pkgs.writeDash "wcd" '' + cd "$(${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" \ + | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname)/.." + ''; + where = pkgs.writeDash "where" '' + ${pkgs.coreutils}/bin/readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" \ + | ${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/dirname + ''; + take = pkgs.writeDash "take" '' + mkdir "$1" && cd "$1" + ''; in { clipboard = "${pkgs.xclip}/bin/xclip -se c"; o = "${pkgs.xdg_utils}/bin/xdg-open"; tmux = "${pkgs.tmux}/bin/tmux -2"; ip = "${pkgs.iproute}/bin/ip -c"; ns = "nix-shell --run zsh"; - nixi = ''nix repl ""''; + nixi = "nix repl ''"; rm = "rm -i"; cp = "cp -i"; mv = "mv -i"; @@ -212,6 +213,7 @@ dig = "dig +short"; wcd = "source ${wcd}"; where = "source ${where}"; + take = "source ${take}"; }; } { diff --git a/configs/zsh.nix b/configs/zsh.nix index d1f7517..9eb34d7 100644 --- a/configs/zsh.nix +++ b/configs/zsh.nix @@ -49,11 +49,6 @@ autoload -U zmv run-help - take() { - mkdir $1 - cd $1 - } - fpath=(${zsh-completions}/src $fpath) source ${zsh-history-substring-search}/zsh-history-substring-search.zsh