Skip to content

Instantly share code, notes, and snippets.

@rslay
Last active October 28, 2025 20:10
Show Gist options
  • Select an option

  • Save rslay/9f5d9a0df378829e34a3b6445381db49 to your computer and use it in GitHub Desktop.

Select an option

Save rslay/9f5d9a0df378829e34a3b6445381db49 to your computer and use it in GitHub Desktop.
Set up Vim with One Dark Pro colors, whitespace rendering, configure tmux to use better colors, and enable viewing tmux scrollback via mousewheel
mkdir -p ~/.vim/autoload ~/.vim/colors &&
curl -fsSL https://raw.githubusercontent.com/joshdick/onedark.vim/refs/heads/main/autoload/onedark.vim -o ~/.vim/autoload/onedark.vim &&
curl -fsSL https://raw.githubusercontent.com/joshdick/onedark.vim/refs/heads/main/colors/onedark.vim -o ~/.vim/colors/onedark.vim &&
(touch ~/.vimrc; grep -qxF 'colorscheme onedark' ~/.vimrc || echo 'colorscheme onedark' >> ~/.vimrc) &&
echo "syntax on" >> ~/.vimrc &&
echo "set tabstop=4 shiftwidth=4 autoindent cursorline softtabstop=-1" >> ~/.vimrc &&
echo "set list listchars=tab:⟶\ ,trail:·,extends:>,precedes:<,nbsp:% lcs+=space:· listchars-=eol:$" >> ~/.vimrc &&
# Enable true color support in terminal Vim and Neovim
if (has("nvim"))
export NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
cat <<EOT >> ~/.tmux.conf
set -g mouse on
set-option -g mouse on
setw -g mode-mouse on
# make scrolling with wheels page tmux history instead of default behavior (warning: breaks selection)
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
EOT
# If you use this, you must hold SHIFT, CTRL, or ALT depending on your OS to select text like before for copying/pasting
echo "Run this command to trigger tmux to reload the config without restarting:"
echo "source-file ~/.tmux.conf"
echo "To turn off mouse mode, run in tmux after hitting your prefix key: ':set -g mouse on' or 'set -g mode-mouse off' for older versions"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment