Inital Commit
This commit is contained in:
3
config/tmux/sessions/assembly
Normal file
3
config/tmux/sessions/assembly
Normal file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'assembly' -n 'neovim' -c ~/Projects/assembly
|
||||
tmux new-window -t assembly -n shell -c ~/Projects/assembly
|
||||
tmux select-window -t assembly:0
|
||||
3
config/tmux/sessions/c
Executable file
3
config/tmux/sessions/c
Executable file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'c' -n 'neovim' -c ~/Projects/c
|
||||
tmux new-window -t c -n shell
|
||||
tmux select-window -t c:0
|
||||
6
config/tmux/sessions/default
Executable file
6
config/tmux/sessions/default
Executable file
@@ -0,0 +1,6 @@
|
||||
tmux new-session -d -s 'default' -n 'neovim'
|
||||
tmux new-window -t default -n 'shell'
|
||||
#tmux split-window -t default:1.0 -h*/
|
||||
#tmux split-window -t default:1.1 */
|
||||
#tmux resize-pane -t default:1.2 -x 60 -y 20*/
|
||||
tmux select-window -t default:0
|
||||
3
config/tmux/sessions/python
Executable file
3
config/tmux/sessions/python
Executable file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'python' -n 'neovim' -c ~/Projects/python
|
||||
tmux new-window -t python -n shell -c ~/Projects/python
|
||||
tmux select-window -t python:0
|
||||
3
config/tmux/sessions/rust
Executable file
3
config/tmux/sessions/rust
Executable file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'rust' -n 'neovim' -c ~/Projects/rust
|
||||
tmux new-window -t rust -n shell -c ~/Projects/rust
|
||||
tmux select-window -t rust:0
|
||||
3
config/tmux/sessions/teddit
Executable file
3
config/tmux/sessions/teddit
Executable file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'teddit' -n 'neovim' -c ~/Projects/rust/teddit
|
||||
tmux new-window -t teddit -n shell -c ~/Projects/rust/teddit
|
||||
tmux select-window -t teddit:0
|
||||
3
config/tmux/sessions/test
Executable file
3
config/tmux/sessions/test
Executable file
@@ -0,0 +1,3 @@
|
||||
tmux new-session -d -s 'test' -n 'neovim' -c ~/Projects/test
|
||||
tmux new-window -t test -n shell
|
||||
tmux select-window -t test:0
|
||||
48
config/tmux/start-tmux
Executable file
48
config/tmux/start-tmux
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
live_sessions=$(tmux list-sessions 2>/dev/null)
|
||||
all_sessions=$(find ~/.config/tmux/sessions -type f -executable -printf '%f\n')
|
||||
TMUX_SESSIONS="$HOME/.config/tmux/sessions"
|
||||
# for some reason ~/.config/tmux/session doesn't work if made with quotes
|
||||
# TMUX_SESSIONS=$XDG_CONFIG_HOME/tmux/sessions
|
||||
|
||||
if ! [ -z "$TMUX" ];then
|
||||
echo "Nested tmux sessions are a bad idea?"
|
||||
echo "If you want to really do this unset TMUX environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS=$'\n'
|
||||
for live_session in $live_sessions;do
|
||||
live_session_name=$(echo $live_session | cut -d: -f1)
|
||||
if [ -z "${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash
|
||||
all_sessions="$(echo "$all_sessions" | sed "s/$live_session_name/$live_session/g")"
|
||||
fi
|
||||
done
|
||||
|
||||
session=$(echo "$all_sessions" | fzf)
|
||||
session_name=$(echo $session | cut -d: -f1)
|
||||
|
||||
if [ -z "$session" ];then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! [ -z "${session##*created*}" ];then
|
||||
if [ -x "$TMUX_SESSIONS/$session_name" ];then
|
||||
source $TMUX_SESSIONS/$session_name
|
||||
else
|
||||
echo $TMUX_SESSIONS/$session_name not found or is not executable
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "${session##*attached*}" ];then
|
||||
read -r -p "The session is already attached somewhere else. Attach it here too ? (y/N): " choice
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ];then
|
||||
tmux attach-session -t$session_name
|
||||
fi
|
||||
else
|
||||
tmux attach-session -t$session_name
|
||||
fi
|
||||
|
||||
46
config/tmux/tmux.conf
Normal file
46
config/tmux/tmux.conf
Normal file
@@ -0,0 +1,46 @@
|
||||
# List of plugins
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'uttarayan21/tmux-wombat'
|
||||
set -g @plugin 'tmux-plugins/tmux-battery'
|
||||
|
||||
|
||||
# set -g @dracula-show-powerline true
|
||||
# set -g @dracula-show-weather false
|
||||
# set -g @dracula-show-left-icon session
|
||||
# set -g @dracula-show-left-sep
|
||||
# set -g @dracula-show-right-sep
|
||||
# Theme
|
||||
# set -g @plugin 'dracula/tmux'
|
||||
|
||||
# load plugin manager
|
||||
run -b '~/.config/tmux/plugins/tpm/tpm'
|
||||
|
||||
set -g default-terminal 'screen-256color'
|
||||
set -ga terminal-overrides ',*256col*:Tc'
|
||||
set-option -sa terminal-overrides ',alacritty:RGB'
|
||||
set-option -g focus-events on
|
||||
set-option -sg escape-time 10
|
||||
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins'
|
||||
|
||||
# source-file ~/.config/tmux/tmuxline.conf
|
||||
# Bind prefix to ctrl space
|
||||
unbind C-b
|
||||
set -g prefix C-Space
|
||||
bind Space send-prefix
|
||||
|
||||
# Use vi keys
|
||||
set -gw mode-keys vi
|
||||
set -g status-keys vi
|
||||
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Binds
|
||||
bind C-d detach
|
||||
bind C-n next-window
|
||||
bind C-p previous-window
|
||||
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Configuration reloaded."
|
||||
bind C-Space last-window
|
||||
bind m send-keys -t.- 'mpcfzf' Enter
|
||||
Reference in New Issue
Block a user