From 5f5c2491b1f6be42dbcb117657e27126d4d3e777 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Dec 2022 14:25:43 +1000 Subject: [PATCH] fix terminal --- home/profiles/cli/default.nix | 58 ++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index d60c5c46..bacd36fb 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -51,7 +51,6 @@ gdb xxd taskwarrior - yt-dlp gnupg syncthing dijo @@ -60,7 +59,7 @@ pandoc (pkgs.writeScriptBin "jq-repl" '' #!/usr/bin/env bash - if [[ -z $1 ]] || [[ $1 == "-" ]] then + if [[ -z $1 ]] || [[ $1 == "-" ]]; then input=$(mktemp) trap "rm -f $input" EXIT cat /dev/stdin > $input @@ -70,27 +69,29 @@ echo "" \ | fzf --phony --preview-window="up:90%" --print-query --preview "jq --color-output -r {q} $input" '') + (pkgs.writeScriptBin "flakify" '' + #!/usr/bin/env zsh + if [ ! -e flake.nix ]; then + nix flake new -t github:nix-community/nix-direnv . + elif [ ! -e .envrc ]; then + echo "use flake" > .envrc + direnv allow + fi + vim flake.nix + '') + (pkgs.writeScriptBin "mx" '' + #!/usr/bin/env bash + manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix + '') ]; programs.zsh = { enable = true; enableCompletion = true; - enableAutosuggestions = true; + enableAutosuggestions = false; initExtra = '' bindkey -v - flakify() { - if [ ! -e flake.nix ]; then - nix flake new -t github:nix-community/nix-direnv . - elif [ ! -e .envrc ]; then - echo "use flake" > .envrc - direnv allow - fi - vim flake.nix - } - mx() { - manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix - } autopair-init ''; sessionVariables = { @@ -137,16 +138,16 @@ }; file = "zsh-autoquoter.zsh"; } - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.5.0"; - sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91"; - }; - } + # { + # name = "zsh-nix-shell"; + # file = "nix-shell.plugin.zsh"; + # src = pkgs.fetchFromGitHub { + # owner = "chisui"; + # repo = "zsh-nix-shell"; + # rev = "v0.5.0"; + # sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91"; + # }; + # } ]; }; @@ -164,7 +165,6 @@ enable = true; enableZshIntegration = true; nix-direnv.enable = true; - # nix-direnv.enableFlakes = true; always enabled }; programs.zoxide = { @@ -182,7 +182,9 @@ "....." = "cd ../../../.."; # kitaab recents - kr = "cd /home/anish/kitaab/vimwiki; ls --sort=modified --reverse | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 {}'"; + kr = "cd /home/anish/kitaab/vimwiki; exa --sort=modified --reverse | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}'"; + icat = "kitty +kitten icat"; + yt = "ytfzf -T kitty -t "; # modern cli tools ls = "exa --icons"; @@ -235,7 +237,7 @@ nf = "n flake"; nfl = "nf lock"; nepl = "n repl ''"; - srch = "ns nixos"; + srch = "ns nixpkgs"; orch = "ns override"; nrb = "cd /tmp; sudo nixos-rebuild switch --flake '/etc/nixos/#curve'; cd $OLDPWD"; nrt = "cd /tmp; sudo nixos-rebuild test --flake '/etc/nixos/#curve'; cd $OLDPWD";