Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Last active May 25, 2023 03:48
Show Gist options
  • Save heywoodlh/8a382990ad8a001de048bdeb92cd1342 to your computer and use it in GitHub Desktop.
Save heywoodlh/8a382990ad8a001de048bdeb92cd1342 to your computer and use it in GitHub Desktop.
My shell script for setting up iSH
#!/usr/bin/env ash
## Enable location, allow iSH to run in background
grep -q '/dev/location' $HOME/.profile || echo 'cat /dev/location > /dev/null &' >> $HOME/.profile && source $HOME/.profile
# Install my dependencies
apk update
apk add vim git coreutils openssh-client mosh tmux curl
# Setup tmux
cp tmux.conf $HOME/.tmux.conf
grep TMUX $HOME/.tmux.conf || echo 'env | grep -q TMUX || tmux && exit' >> $HOME/.profile
# Install rbw
apk add cargo
cargo install rbw
# Change default prefix key to C-a, similar to screen
unbind-key C-b
set-option -g prefix C-a
# Enable 24-bit color support
set-option -ga terminal-overrides ",xterm-termite:Tc"
# Start window indexing at one
set-option -g base-index 1
# Use vi-style key bindings in the status line, and copy/choice modes
set-option -g status-keys vi
set-window-option -g mode-keys vi
# Large scrollback history
set-option -g history-limit 10000
# Xterm Keys on
set-window-option -g xterm-keys on
# Set 256 colors
set -g default-terminal "screen-256color"
# Set escape time to zero
set -sg escape-time 0
# move between panes with vim-like motions
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Synchronizing panes
bind-key y set-window-option synchronize-panes
# SSH to Host
bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
# Split windows
unbind-key %
bind-key | split-window -h -c "#{pane_current_path}"
unbind-key '"'
bind-key - split-window -v -c "#{pane_current_path}"
# Mouse mode
set -g mouse on
# Tmux Scrolling
bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -n WheelDownPane select-pane -t= \; send-keys -M
# vim-copy
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'tmux save-buffer - | cat > /dev/clipboard'
set -g status off
bind a send-prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment