Skip to content

Commit

Permalink
frg function and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
atropos112 committed Apr 11, 2024
1 parent c0ab427 commit 2a8277a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
};
apply = {
exec = ''
build && sudo nixos-rebuild switch || exit 1
build && sudo nixos-rebuild switch --fast || exit 1
'';
description = "Rebuild the system";
};
Expand All @@ -73,7 +73,7 @@
};
update = {
exec = ''
sudo nix-channel --update && nix flake update && git add . && git commit -m "Update flake.lock" && rebuild
sudo nix-channel --update && nix flake update && git add . && git commit -m "Update flake.lock" && apply
'';
description = "Update the system";
};
Expand Down
6 changes: 2 additions & 4 deletions lib/common/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ in {
environment.sessionVariables = {
# To Globally replace gcc stuff use this env var but it will do damage to othre stuff so ideally use nix-ld approach
# LD_LIBRARY_PATH = lib.mkForce "${pkgs.stdenv.cc.cc.lib}/lib";
FZF_BASE = "${pkgs.fzf}/bin/fzf";

# For direnv to not show the log
DIRENV_LOG_FORMAT = "";
Expand Down Expand Up @@ -352,9 +353,6 @@ in {
# connect to k8s external secret source
doppler

# password manager
bitwarden

# dns resolving tool (for testing)
dig

Expand All @@ -377,7 +375,7 @@ in {
# database client
dbeaver

# debbuger for golang
# debuger for golang
delve

# Cllium eBPF client tool for kubernetes cluster
Expand Down
17 changes: 16 additions & 1 deletion lib/pkgs/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ in {
plugins = [
"git"
"extract"
"fzf" # WARN: This is temporary solution until atuin works again.
"kubectl"
"docker-compose"
];
Expand Down Expand Up @@ -144,7 +143,23 @@ in {
git rebase -i HEAD~$1
}
# Found this cool function here: https://news.ycombinator.com/item?id=38471822
function frg {
result=$(rg --ignore-case --color=always --line-number --no-heading "$@" |
fzf --ansi \
--color 'hl:-1:underline,hl+:-1:underline:reverse' \
--delimiter ':' \
--preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3')
file=''${result%%:*}
linenumber=$(echo "''${result}" | cut -d: -f2)
if [[ -n "$file" ]]; then
$EDITOR +"''${linenumber}" "$file"
fi
}
eval "$(zoxide init zsh)"
eval "$(fzf --zsh)"
'';
};
};
Expand Down

0 comments on commit 2a8277a

Please sign in to comment.