1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

オレオレtmux

Posted at

完全に誰得

これをコピペして使え、将来のオレ

tmux.conf
# setting tmux
#  prefix Ctrl+t
unbind C-b
set-option -g prefix C-t
bind C-t send-prefix

set-option -g history-limit 2000
set-window-option -g mode-keys vi
set-option -g mouse on
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'

# move pane by vim like 
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# resize
bind -r C-k  resize-pane -U 1
bind -r C-j  resize-pane -D 1
bind -r C-h  resize-pane -L 1
bind -r C-l  resize-pane -R 1

bind | split-window -h 
bind - split-window -v

bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

bashrc->

alias tm='/usr/local/bin/tmux'

function proj() {
	tmux split-window -v -p 40
	if [ $# -eq 1 ]; then
		WNUM=$1
		if [ $WNUM -lt 2 ]; then
			return
		fi
		tmux split-window -h -p 50
		if [ $WNUM -lt 3 ]; then
			return
		fi
		tmux split-window -h -p 50
	fi
}

tmuxプラグイン

プラグインマネージャーを利用する
使用時の状態を保存してくれるだけでもサイコー٩(ˊᗜˋ*)و

更新版.tmux.conf
# setting tmux

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'

#  prefix Ctrl+t
unbind C-b
set-option -g prefix C-t
bind C-t send-prefix

set-option -g history-limit 2000
set-window-option -g mode-keys vi
# set-option -g mode mouse
set-option -g mouse on
# set-option -g mouse-select-window on
# set-option -g mouse-select-pane on
# set-option -g mouse-resize-pane on
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'

# move pane by vim like 
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# resize
bind -r C-k  resize-pane -U 1
bind -r C-j  resize-pane -D 1
bind -r C-h  resize-pane -L 1
bind -r C-l  resize-pane -R 1

bind | split-window -h 
bind - split-window -v

bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b "~/.tmux/plugins/tpm/tpm"

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?