Skip to content

Commit

Permalink
dotter/tmux setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
iliekturtles committed Aug 29, 2024
1 parent ab6a474 commit 8f3dfc0
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fish/fish_variables text eol=lf
msys2/nsswitch.conf text eol=lf
tmux/tmux.conf text eol=lf
3 changes: 3 additions & 0 deletions aconfmgr/10-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ AddPackage unzip # For extracting and viewing files in .zip archives
{{#if dotter.packages.starship}}AddPackage starship # The cross-shell prompt for astronauts{{/if}}
{{#if dotter.packages.systemd-networkd}}{{#if systemd-networkd.wlan}}AddPackage iwd # Internet Wireless Daemon{{/if}}{{/if}}
{{#if dotter.packages.systemd-networkd}}{{#if systemd-networkd.wlan}}AddPackage wireless_tools # Tools allowing to manipulate the Wireless Extensions{{/if}}{{/if}}
{{#if dotter.packages.tmux}}AddPackage tmux # Terminal multiplexer{{/if}}

# Configuration files.
#CopyFile '/etc/fstab'
Expand Down Expand Up @@ -63,6 +64,8 @@ CreateLink '/etc/localtime' '/usr/share/zoneinfo/{{shell.LocalTimeZone}}'
{{#if dotter.packages.paru}}CopyFile '/etc/paru.conf'{{/if}}
{{#if dotter.packages.sshd}}CopyFile '/etc/ssh/sshd_config'{{/if}}
{{#if dotter.packages.systemd-networkd}}CopyFile '/usr/lib/systemd/system/systemd-networkd-wait-online.service'{{/if}}
{{#if dotter.packages.tmux}}SetFileProperty '/usr/lib/utempter/utempter' group utmp{{/if}}
{{#if dotter.packages.tmux}}SetFileProperty '/usr/lib/utempter/utempter' mode 2755{{/if}}
{{#if dotter.packages.wsl}}CopyFile '/etc/wsl.conf'{{/if}}
{{#if dotter.packages.wsl}}CreateLink '/etc/resolv.conf' '/run/systemd/resolve/resolv.conf'{{/if}}
{{#if systemd-networkd.ethernet}}CopyFile '/etc/systemd/network/10-ethernet.network'{{/if}}
Expand Down
7 changes: 2 additions & 5 deletions config/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@ if [ ! -z "$MSYSTEM" ] && [ "$DOTFILES_VERSION" != "$_DOTFILES_VERSION" ]; then
fi

echo "Setup config directories..."
mkdir -p "$XDG_CONFIG_HOME"/{git,tmux}
mkdir -p "$XDG_CONFIG_HOME"/git

echo "Setup KeePass, mintty, tmux, and VsVim..."
echo "Setup KeePass, mintty, and VsVim..."
if [ ! -z "$MSYSTEM" ]; then
mkdir -p "$XDG_CONFIG_HOME/mintty"
mkdir -p ~/AppData/Roaming/KeePass

dos2unix -n -q tmux.conf "$XDG_CONFIG_HOME/tmux/tmux.conf"
cp _vsvimrc ~/_vsvimrc
dos2unix -n -q minttyrc "$XDG_CONFIG_HOME/mintty/config"
dos2unix -n -q minttyrc "$APPDATA/wsltty/config"
cp KeePass.config.xml ~/AppData/Roaming/KeePass
else
cp tmux.conf "$XDG_CONFIG_HOME/tmux/tmux.conf"
fi

echo "Setup git..."
Expand Down
1 change: 1 addition & 0 deletions dotter/fhcc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ packages = [
"starship",
"systemd",
"systemd-networkd",
"tmux",
]

[files]
Expand Down
6 changes: 6 additions & 0 deletions dotter/global.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ ethernet = true
wlan = false
wwan = false

[tmux.files]
"tmux/tmux.conf" = "$XDG_CONFIG_HOME/tmux/tmux.conf"

[tmux.variables.tmux]
default-terminal = ""

[windows]
depends = ["shell"]

Expand Down
1 change: 1 addition & 0 deletions dotter/in-mxl9142x0w-arch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages = [
"ripgrep",
"starship",
"systemd",
"tmux",
"wsl",
]

Expand Down
1 change: 1 addition & 0 deletions dotter/in-mxl9142x0w.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages = [
"ripgrep",
"ssh",
"starship",
"tmux",
"windows",
"wsl-client",
]
Expand Down
1 change: 1 addition & 0 deletions dotter/jvzx.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ packages = [
"starship",
"systemd",
"systemd-networkd",
"tmux",
]

[files]
Expand Down
1 change: 1 addition & 0 deletions dotter/usnb170504nkdxn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages = [
"ripgrep",
"ssh",
"starship",
"tmux",
"windows",
"wsl-client",
]
Expand Down
3 changes: 3 additions & 0 deletions dotter/windows.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ connection-sharing = false

[starship.variables.starship]
command_timeout = 10000

[tmux.variables.tmux]
default-terminal = "xterm-256color"
17 changes: 17 additions & 0 deletions neovim/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,20 @@ nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
{{#if dotter.packages.tmux}}

" Map C-<direction> to move between splits and tmux panes.
function! MoveWindowPane(direction)
let wnr = winnr()
silent! execute 'wincmd ' . a:direction
" If the winnr is still the same after we moved, it is the last pane
if wnr == winnr() && !has('g:vscode')
call system('tmux select-pane -' . tr(a:direction, 'phjkl', 'lLDUR'))
end
endfunction

nnoremap <silent> <c-h> :call MoveWindowPane('h')<cr>
nnoremap <silent> <c-j> :call MoveWindowPane('j')<cr>
nnoremap <silent> <c-k> :call MoveWindowPane('k')<cr>
nnoremap <silent> <c-l> :call MoveWindowPane('l')<cr>
{{/if}}
5 changes: 5 additions & 0 deletions systemd/environment.d/envvars.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ HISTSIZE={{bash.HISTSIZE}}
# SSH.
SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
{{/if}}
{{#if dotter.packages.tmux}}

# Tmux.
TMUX_TMPDIR=$XDG_RUNTIME_DIR
{{/if}}
12 changes: 11 additions & 1 deletion config/tmux.conf → tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

{{#if (eq dotter.os "unix")}}
# Tmux options.
set -g default-command "${SHELL}" # Use non-login shells.

{{/if}}
{{#if dotter.packages.neovim}}
# Smart pane switching
bind -n C-k if "[ $(tmux display -p '#{pane_current_command}') = nvim ]" "send-keys C-k" "select-pane -U"
bind -n C-j if "[ $(tmux display -p '#{pane_current_command}') = nvim ]" "send-keys C-j" "select-pane -D"
bind -n C-h if "[ $(tmux display -p '#{pane_current_command}') = nvim ]" "send-keys C-h" "select-pane -L"
bind -n C-l if "[ $(tmux display -p '#{pane_current_command}') = nvim ]" "send-keys C-l" "select-pane -R"

{{/if}}
# Options.
set-option -sg escape-time 0
set-option -g status-right "#h|%Y-%m-%d %H:%M"
set-option -g set-titles on
set-option -g set-titles-string "#I:#T"
set-option -ga update-environment " SSH_CLIENT SSH_TTY"

# Window options.
set-window-option -g base-index 1
set-window-option -g default-terminal "xterm-256color"
{{#if tmux.default-terminal}}
set-window-option -g default-terminal "{{tmux.default-terminal}}"
{{/if}}
set-window-option -g display-time 3000
set-window-option -g mode-keys vi
set-window-option -g mouse on
Expand Down

0 comments on commit 8f3dfc0

Please sign in to comment.