From 0bc29fea6bf38418887e6e46dc9c42bc0e1d3303 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 4 Jun 2021 16:24:23 +0200 Subject: [PATCH 1/2] Added tmux session handling --- .bash_aliases | 2 +- .bashrc | 1 + .local/bin/e | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 .local/bin/e diff --git a/.bash_aliases b/.bash_aliases index c7c0bd0..bd98848 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,6 +1,6 @@ # General alias 'clear=echo "No more clear for you"' -alias 'e=$EDITOR' +# alias 'e=$EDITOR' alias 'ec=$EDITOR ~/.bashrc' alias 'sc=source ~/.bashrc' diff --git a/.bashrc b/.bashrc index 3336dd9..e7d584d 100644 --- a/.bashrc +++ b/.bashrc @@ -9,6 +9,7 @@ export EDITOR=nvim export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" export INPUTRC="$HOME/.inputrc" +export HISTCONTROL=ignorespace # =====FUNCTIONS===== diff --git a/.local/bin/e b/.local/bin/e new file mode 100755 index 0000000..8f9b90f --- /dev/null +++ b/.local/bin/e @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +create_session() { + tmux new -ds "$1" + + tmux send-keys -t "$1" 'nvim' Enter +} + +# Use Git repo root as dir if we're in one +dir=`git rev-parse --show-toplevel 2> /dev/null || pwd` +dir_hash=`echo "$dir" | shasum | grep -o '^[^ ]\+'` +dir_name=`basename "$dir" | sed 's/[^a-zA-Z0-9]/_/g'` +session_name="${dir_name}-${dir_hash}" + +tmux has -t "$session_name" 2> /dev/null || \ + create_session "$session_name" + +# Attach to the session +if [ -n "$TMUX" ]; then + tmux switch-client -t "$session_name" +else + tmux attach -t "$session_name" +fi From ebdac1081fd0d6b748cd988270896080f677e874 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 4 Jun 2021 16:26:21 +0200 Subject: [PATCH 2/2] Some more settings --- .config/i3/config | 2 +- .config/nvim/init/plugins/plugins.vim | 2 ++ .tmux.conf | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index 1dbe221..910496d 100755 --- a/.config/i3/config +++ b/.config/i3/config @@ -1,6 +1,6 @@ # =====GENERAL===== # Main modifier; Mod1 is alt -set $mod Mod1 +set $mod Mod4 # Modifier for floating-related operations floating_modifier $mod diff --git a/.config/nvim/init/plugins/plugins.vim b/.config/nvim/init/plugins/plugins.vim index c8531eb..023a421 100644 --- a/.config/nvim/init/plugins/plugins.vim +++ b/.config/nvim/init/plugins/plugins.vim @@ -65,4 +65,6 @@ Plug 'udalov/kotlin-vim' Plug 'editorconfig/editorconfig-vim' +Plug 'maxmellon/vim-jsx-pretty' + call plug#end() diff --git a/.tmux.conf b/.tmux.conf index 1f228b6..12845ba 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1 +1,27 @@ +<<<<<<< Updated upstream set -s escape-time 0 +======= +# Change prefix to Ctrl-a +unbind C-b +set -g prefix C-a + +# Prevent weird delay in Vim +set -s escape-time 0 + +# Make tabs count from 1 +set -g base-index 1 + +# Key binding to reload config file +bind r source-file ~/.tmux.conf \; display "Reloaded config." + +# Customize bar +set -g status-style fg=default,bg=default +set -g status-left '' +set -g status-right '' +set -g status-justify centre + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +>>>>>>> Stashed changes