From 9550f1b1a0a3353c74abc0334578ea33b42479ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 22 Aug 2019 09:44:11 +0200 Subject: [PATCH] add wcd and where scripts --- configs/default.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configs/default.nix b/configs/default.nix index 1126e83..40db8c5 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -183,7 +183,19 @@ } { environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin"; - environment.shellAliases = { + 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 + ''; + in { clipboard = "${pkgs.xclip}/bin/xclip -se c"; o = "${pkgs.xdg_utils}/bin/xdg-open"; tmux = "${pkgs.tmux}/bin/tmux -2"; @@ -198,6 +210,8 @@ ll = "${pkgs.exa}/bin/exa -l"; la = "${pkgs.exa}/bin/exa -la"; dig = "dig +short"; + wcd = "source ${wcd}"; + where = "source ${where}"; }; } {