fish: port functions and more aliases
Alan Pearce alan@alanpearce.eu
Sun, 20 Aug 2023 06:52:48 +0200
11 files changed, 43 insertions(+), 0 deletions(-)
jump to
- user/emacs/init.el
- user/nanopi.nix
- user/settings/emacs.nix
- user/settings/fish.nix
- user/settings/fish/functions/delink.fish
- user/settings/fish/functions/ecpenv.fish
- user/settings/fish/functions/esetenv.fish
- user/settings/fish/functions/field.fish
- user/settings/fish/functions/help.fish
- user/settings/fish/functions/tere.fish
- user/settings/shell.nix
M user/emacs/init.el → user/emacs/init.el
@@ -763,6 +763,11 @@ sh-basic-offset 2) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +(use-package fish-mode + :mode (("\\.fish\\'" . fish-mode)) + :config (progn + (setq fish-enable-auto-indent t))) + ;;;; make (general-add-hook 'makefile-mode-hook (lambda ()
M user/nanopi.nix → user/nanopi.nix
@@ -4,6 +4,7 @@ imports = [ ./modules/tabnine.nix ./settings/base.nix ./settings/development/base.nix + ./settings/fish.nix ./settings/git.nix ./settings/nix.nix ./settings/nixos.nix
M user/settings/emacs.nix → user/settings/emacs.nix
@@ -140,6 +140,7 @@ evil-space evil-surround evil-textobj-tree-sitter eyebrowse + fish-mode format-all flycheck general
M user/settings/fish.nix → user/settings/fish.nix
@@ -27,5 +27,12 @@ ]; interactiveShellInit = '' bind \es __ghq_repository_search ''; + functions = { + ds = "du -hd1 $argv[1] | sort -h"; + }; + }; + xdg.configFile."fish/functions" = { + recursive = true; + source = ./fish/functions; }; }
A user/settings/fish/functions/delink.fish
@@ -0,0 +1,10 @@+function delink + if test ! -L $argv[1] + echo "$argv[1] is not a symlink" + return 1 + end + set -l src (readlink $argv[1]) + rm $argv[1] + cp $src $argv[1] + chmod u+w $argv[1] +end
A user/settings/fish/functions/ecpenv.fish
@@ -0,0 +1,3 @@+function ecpenv + esetenv $argv[1] $$argv[1] +end
A user/settings/fish/functions/esetenv.fish
@@ -0,0 +1,3 @@+function esetenv + emacsclient -e "(setenv \"$argv[1]\" \"$argv[2]\")" +end
A user/settings/fish/functions/field.fish
@@ -0,0 +1,3 @@+function field + awk "{ print \$$argv[1]}" +end
A user/settings/fish/functions/help.fish
@@ -0,0 +1,3 @@+function help + $argv --help 2>&1 | bat --plan --language=help +end
A user/settings/fish/functions/tere.fish
@@ -0,0 +1,6 @@+function tere + set -f result $(command tere $argv) + if test -n $result + cd $result + end +end
M user/settings/shell.nix → user/settings/shell.nix
@@ -57,6 +57,7 @@ di = "docker image"; dj = "docker pull"; dk = "docker push"; + dc = "docker-compose"; dcb = "dc build"; dcd = "dc down"; dcj = "dc pull";