Skip to content

Commit

Permalink
move hcd to aliases and he to a script
Browse files Browse the repository at this point in the history
  • Loading branch information
adomixaszvers committed Nov 5, 2023
1 parent 002357f commit e3e43ad
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 72 deletions.
1 change: 1 addition & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
bumblebee-status-source = inputs.bumblebee-status.outPath;
};
hunspell-lt = pkgs.callPackage ./hunspell-lt { };
he = pkgs.callPackage ./he.nix { };
hm-option = pkgs.callPackage ./hm-option.nix { };
hm-repl = pkgs.callPackage ./hm-repl.nix { };
hm-switch = pkgs.callPackage ./hm-switch.nix {
Expand Down
8 changes: 8 additions & 0 deletions pkgs/he.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ writeShellScriptBin, fzf }:
writeShellScriptBin "he" ''
cd ~/.config/nixpkgs || exit 1
readarray -t files < <(${fzf}/bin/fzf --multi)
if [ -n "''${files[0]}" ]; then
exec $EDITOR "''${files[@]}"
fi
''
81 changes: 36 additions & 45 deletions profiles/cli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,47 @@
./zsh
./nushell
];
home.packages = (with pkgs; [
bat
bfs
binutils
cachix
comma
dnsutils
fd
file
git
github-cli
htop
icdiff
jq
lf
lsof
ncdu
niv
nixfmt
nix-index
p7zip
patchelf
ripgrep
shellcheck
statix
tree
unzip
wol
xdg-user-dirs
]) ++ (with myPkgs; [ hm-repl hm-switch ]);
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
home = {
packages = (with pkgs; [
bat
bfs
binutils
cachix
comma
dnsutils
fd
file
git
github-cli
htop
icdiff
jq
lf
lsof
ncdu
niv
nixfmt
nix-index
p7zip
patchelf
ripgrep
shellcheck
statix
tree
unzip
wol
xdg-user-dirs
]) ++ (with myPkgs; [ he hm-repl hm-switch ]);
sessionVariables = {
EDITOR = "nvim";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
shellAliases.hcd = "cd ~/.config/nixpkgs";
};
programs = {
bash = {
enable = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
initExtra = ''
hcd () {
cd ~/.config/nixpkgs || exit 1
}
he () {
(
local FILES
hcd && readarray -t FILES <<< "$(fzf --multi)" && [ -n "''${FILES[*]}" ] && "$EDITOR" "''${FILES[@]}"
)
}
'';
};
broot.enable = true;
exa = {
Expand Down
8 changes: 0 additions & 8 deletions profiles/cli/fish/init.fish
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
function hcd
cd ~/.config/nixpkgs || exit 1
end

function he
if pushd ~/.config/nixpkgs
set -l FILES (fzf --print0 --multi | string split0)
set -q FILES[1] && $EDITOR $FILES
popd
end
end
11 changes: 0 additions & 11 deletions profiles/cli/nushell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@
...targets: string@"manpages"
]
alias hcd = cd ~/.config/nixpkgs
def he [] {
hcd
let files = (fzf --multi | lines)
if not ($files | is-empty) {
run-external $env.EDITOR $files
}
}
$env.config = {
render_right_prompt_on_last_line: true
show_banner: false
Expand Down
8 changes: 0 additions & 8 deletions profiles/cli/zsh/initExtra.zsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
find-shells () {
cat "$XDG_DATA_HOME"/direnv/allow/* | sort | uniq | sed -e 's/\.envrc$/shell.nix/'
}
hcd () {
cd ~/.config/nixpkgs || exit 1
}
he () {
(
hcd && local FILES=("${(@f)$(fzf --multi)}") && [ -n "${FILES[*]}" ] && "$EDITOR" "${FILES[@]}"
)
}

rebuild_shells () {
while read i; do
Expand Down

0 comments on commit e3e43ad

Please sign in to comment.