Compare commits

...

9 Commits

10 changed files with 106 additions and 14 deletions

View File

@@ -3,6 +3,7 @@
"actions-preview.nvim": { "branch": "master", "commit": "36513ad213855d497b7dd3391a24d1d75d58e36f" }, "actions-preview.nvim": { "branch": "master", "commit": "36513ad213855d497b7dd3391a24d1d75d58e36f" },
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" },
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
"eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" }, "eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" },
"fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" }, "fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" },

View File

@@ -15,3 +15,16 @@ vim.keymap.set("n", "N", "Nzz")
-- Clear search highlight by pressing esc -- Clear search highlight by pressing esc
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>") vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
vim.api.nvim_create_autocmd("FileType", {
pattern = { "rust" },
callback = function(args)
local command = {
rust = "cargo run",
}
vim.keymap.set("n", "<F5>", function()
vim.system({ "tmux", "send-keys", "-t", ":shell", "c-u", command[args.match], "Enter" })
vim.system({ "tmux", "select-window", "-t", ":shell" })
end, { buffer = true })
end,
})

View File

@@ -0,0 +1,5 @@
-- https://github.com/kwkarlwang/bufresize.nvim
return {
"kwkarlwang/bufresize.nvim",
opts = {},
}

1
sesh/.stow-local-ignore Normal file
View File

@@ -0,0 +1 @@
setup

View File

@@ -0,0 +1,25 @@
# Hide all scratch sessions
blacklist = ["scratch-*"]
# Scratch sessions rename themselves to something unique and are hidden from the overview
[[session]]
name = "scratch"
startup_command = "tmux rename-session scratch-$(echo -n $(date) | sha256sum | cut -c1-4) && tmux set detach-on-destroy on && clear"
[[session]]
name = "automation_rs"
path = "~/Projects/rust/automation_rs/"
startup_command = "nvim"
windows = ["shell"]
[[session]]
name = "olympus"
startup_command = "ssh olympus && exit"
[[session]]
name = "niestern_sander"
path = "~/Projects/ALTEN/niestern_sander/"
startup_command = "$DOTFILES/sesh/setup/niestern_sander.sh"
[[window]]
name = "shell"

15
sesh/setup/niestern_sander.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
if ! systemctl is-active --quiet docker; then
echo "Starting docker..."
systemctl start docker
fi
devcontainer up --workspace-folder .
tmux rename-window nvim
tmux new-window -n "ros" "devcontainer exec --workspace-folder . bash"
tmux new-window -n "shell"
tmux select-window -t :-2
devcontainer exec --workspace-folder . nvim

View File

@@ -1,6 +1,7 @@
# Plugins # Plugins
set -g @plugin 'mrjones2014/smart-splits.nvim' set -g @plugin 'mrjones2014/smart-splits.nvim'
set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'wfxr/tmux-fzf-url'
# Settings # Settings
set -ag terminal-overrides ",xterm-256color:RGB" set -ag terminal-overrides ",xterm-256color:RGB"
@@ -11,6 +12,8 @@ set -sg escape-time 0
set -g history-limit 5000 set -g history-limit 5000
set -g detach-on-destroy off # don't exit from tmux when closing a session
# Setup vi-mode with better keybindings # Setup vi-mode with better keybindings
# TODO: Escape does not work properly for leaving # TODO: Escape does not work properly for leaving
setw -g mode-keys vi setw -g mode-keys vi
@@ -73,3 +76,8 @@ bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8 bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9 bind-key -n M-9 select-window -t 9
bind-key -n M-0 select-window -t 10 bind-key -n M-0 select-window -t 10
bind-key "a" run-shell "sesh-select"
bind-key x kill-pane
bind-key X kill-session

17
zsh/dot-local/bin/sesh-select Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env zsh
exec </dev/tty
exec <&1
local session
session=$(sesh list -i | fzf-tmux -p 70%,60% \
--no-sort --ansi --border-label ' Select session ' --prompt '⚡ ' \
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
--bind 'btab:down,tab:up' \
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list -i)' \
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t -i)' \
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c -i)' \
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z -i)' \
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
--bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list -i)')
[[ -z "$session" ]] && return
sesh connect $session

View File

@@ -22,7 +22,6 @@ plugins=(
# Disabled because the highlighting conflicts with autosuggestions # Disabled because the highlighting conflicts with autosuggestions
# history-substring-search # history-substring-search
vi-mode vi-mode
tmux
colored-man-pages colored-man-pages
command-not-found command-not-found
zsh-autopair zsh-autopair
@@ -43,10 +42,6 @@ VI_MODE_SET_CURSOR=true
# Might cause issues? # Might cause issues?
KEYTIMEOUT=1 KEYTIMEOUT=1
ZSH_TMUX_AUTOSTART=true
ZSH_TMUX_AUTOCONNECT=false
ZSH_TMUX_FIXTERM=true
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
autoload -U compinit && compinit autoload -U compinit && compinit
source "$ZSH/oh-my-zsh.sh" source "$ZSH/oh-my-zsh.sh"
@@ -60,12 +55,12 @@ export EDITOR=nvim
alias cl="clear" alias cl="clear"
if hash bat 2>/dev/null; then if (( $+commands[hash] )); then
export BAT_THEME="gruvbox-dark" export BAT_THEME="gruvbox-dark"
alias cat=bat alias cat=bat
fi fi
if hash devcontainer 2>/dev/null; then if (( $+commands[devcontainer] )); then
dc() { dc() {
ORIG_DIR="$PWD" ORIG_DIR="$PWD"
while [[ "$PWD" != / ]] ; do while [[ "$PWD" != / ]] ; do
@@ -92,7 +87,7 @@ if hash devcontainer 2>/dev/null; then
} }
fi fi
if hash pnpm 2>/dev/null; then if (( $+commands[pnpm] )); then
export PNPM_HOME="/home/tim/.local/share/pnpm" export PNPM_HOME="/home/tim/.local/share/pnpm"
case ":$PATH:" in case ":$PATH:" in
*":$PNPM_HOME:"*) ;; *":$PNPM_HOME:"*) ;;
@@ -110,22 +105,22 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--prompt="> " --marker="◆" --pointer=">" --separator="─" --prompt="> " --marker="◆" --pointer=">" --separator="─"
--scrollbar="│" --info="right"' --scrollbar="│" --info="right"'
if hash fd 2>/dev/null; then if (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix" export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi fi
if hash fzf 2>/dev/null; then if (( $+commands[fzf] )); then
source <(fzf --zsh) source <(fzf --zsh)
if hash paru 2>/dev/null; then if (( $+commands[paru] )); then
function pi { function pi {
paru -Slq | fzf -q "$1" --border-label="Packages" --multi --preview 'paru -Si {1} --color=always' | xargs -ro paru -S paru -Slq | fzf -q "$1" --border-label=" Install package " --multi --preview 'paru -Si {1} --color=always' | xargs -ro paru -S
} }
fi fi
fi fi
export _ZO_FZF_OPTS="--tmux" export _ZO_FZF_OPTS="--tmux"
if hash zoxide 2>/dev/null; then if (( $+commands[zoxide] )); then
eval "$(zoxide init zsh --cmd cd)" eval "$(zoxide init zsh --cmd cd)"
fi fi
@@ -142,3 +137,15 @@ for km in viopp visual; do
bindkey -M $km $c select-bracketed bindkey -M $km $c select-bracketed
done done
done done
ZSH_TMUX_AUTOSTART=true
if (( $+commands[tmux] )); then
if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then
if (( $+commands[sesh] )); then
sesh-select
else
tmux new-session
fi
exit
fi
fi