feat: open notes and fix tmux
This commit is contained in:
parent
48e8218774
commit
89cf7f3a75
3 changed files with 22 additions and 7 deletions
|
@ -1,8 +1,6 @@
|
||||||
# Inject the right home-manager config for the machine.
|
# Inject the right home-manager config for the machine.
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -239,7 +237,9 @@ in
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
#tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new";
|
#tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new";
|
||||||
bunx = "bun --bun x";
|
bunx = "bun --bun x";
|
||||||
|
c = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer";
|
||||||
g = "lazygit";
|
g = "lazygit";
|
||||||
|
n = "/home/mrflos/Code/nixos-config/scripts/open-notes";
|
||||||
s = "/home/mrflos/Code/nixos-config/scripts/ssh-connect";
|
s = "/home/mrflos/Code/nixos-config/scripts/ssh-connect";
|
||||||
t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer";
|
t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer";
|
||||||
kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix";
|
kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix";
|
||||||
|
|
15
scripts/open-notes
Executable file
15
scripts/open-notes
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pushd ~/Nextcloud/Notes/ > /dev/null
|
||||||
|
if [[ $# -eq 1 ]]; then
|
||||||
|
selected=$1
|
||||||
|
else
|
||||||
|
selected=$(rg . --files --glob "*.md" | sort -r -f | fzf)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $selected ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
nvim "$selected"
|
||||||
|
popd > /dev/null
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
pushd ~/Code
|
pushd ~/Code > /dev/null
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
selected=$1
|
selected=$1
|
||||||
else
|
else
|
||||||
|
@ -15,13 +15,13 @@ selected_name=$(basename "$selected" | tr . _)
|
||||||
tmux_running=$(pgrep tmux)
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||||
tmux new-session -s $selected_name -c $selected
|
tmux new-session -s $selected_name -c $selected -d 'nvim .'
|
||||||
|
tmux a
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
||||||
tmux new-session -ds $selected_name -c $selected
|
tmux new-session -ds $selected_name -c $selected -d 'nvim .'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t $selected_name
|
tmux switch-client -t $selected_name
|
||||||
popd
|
popd > /dev/null
|
||||||
|
|
Loading…
Add table
Reference in a new issue