This commit is contained in:
parent
b44bbef3e2
commit
21d9ca8737
8 changed files with 4 additions and 112 deletions
|
@ -25,13 +25,13 @@
|
|||
user_path="$XDG_REPOS_DIR/$domain/$user"
|
||||
repo_path="$user_path/$name"
|
||||
|
||||
[[ -d "$repo_path" ]] && t "$repo_path" && exit 0
|
||||
[[ -d "$repo_path" ]] && tmux-sessionizer "$repo_path" && exit 0
|
||||
|
||||
mkdir -pv "$repo_path"
|
||||
|
||||
git clone "$repo_url" "$repo_path"
|
||||
|
||||
t "$repo_path"
|
||||
tmux-sessionizer "$repo_path"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
|
30
modules/scripts/tmux-sessionizer/default.nix
Normal file
30
modules/scripts/tmux-sessionizer/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.file.".tmux-sessionizer".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/os" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/work" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
};
|
||||
}
|
|
@ -4,9 +4,9 @@
|
|||
{
|
||||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "t";
|
||||
name = "tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [ fzf ];
|
||||
runtimeInputs = with pkgs; [ coreutils fzf tmux ];
|
||||
|
||||
text = ''
|
||||
set -euo pipefail
|
Loading…
Add table
Add a link
Reference in a new issue