Skip to content

Commit 1fb4f61

Browse files
committed
[add][mod] tmux is better than screen!
add: config/.tmux.conf, configuration of tmux. mod: package.sh, remove screen & add tmux installation.
1 parent 4418a07 commit 1fb4f61

File tree

2 files changed

+84
-11
lines changed

2 files changed

+84
-11
lines changed

config/.tmux.conf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
### rebind hotkey
2+
3+
# prefix setting (screen-like)
4+
set -g prefix C-a
5+
unbind C-b
6+
bind C-a send-prefix
7+
8+
# reload config without killing server
9+
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
10+
11+
# "|" splits the current window vertically, and "-" splits it horizontally
12+
unbind %
13+
bind | split-window -h
14+
bind - split-window -v
15+
16+
# Pane navigation (vim-like)
17+
bind h select-pane -L
18+
bind j select-pane -D
19+
bind k select-pane -U
20+
bind l select-pane -R
21+
22+
# Pane resizing
23+
bind -r Left resize-pane -L 1
24+
bind -r Down resize-pane -D 1
25+
bind -r Up resize-pane -U 1
26+
bind -r Right resize-pane -R 1
27+
28+
29+
### other optimization
30+
31+
# set the shell you like (zsh, "which zsh" to find the path)
32+
# set -g default-command /bin/zsh
33+
# set -g default-shell /bin/zsh
34+
35+
# use UTF8
36+
# set -g utf8
37+
# set-window-option -g utf8 on
38+
39+
# display things in 256 colors
40+
set -g default-terminal "screen-256color"
41+
42+
# mouse is great!
43+
set-option -g mouse on
44+
45+
# history size
46+
set -g history-limit 10000
47+
48+
# fix delay
49+
set -g escape-time 0
50+
51+
# 0 is too far
52+
set -g base-index 1
53+
setw -g pane-base-index 1
54+
55+
# stop auto renaming
56+
setw -g automatic-rename off
57+
set-option -g allow-rename off
58+
59+
# renumber windows sequentially after closing
60+
set -g renumber-windows on
61+
62+
# window notifications; display activity on other window
63+
setw -g monitor-activity on
64+
set -g visual-activity on
65+

package.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#- -h, --help print help information.
1414
#- -no_git-config do not customize git.
1515
#- -no_vim-config do not use customize .vimrc config file (from ./config/.vimrc).
16+
#- -no_tmux-config do not use customize .tmux.conf file (from ./config/.tmux.conf).
1617
#- -no_chewing do not install Taiwanese typing method.
1718
#- -no_extra-packages do not install all the extra-packages.
1819
#-
1920
#- =========== extra package options ===========
2021
#- --no_ssh-server do not install openssh-server.
21-
#- --no_screen do not install screen.
2222
#- --no_pip3 do not install python3-pip.
2323
#-
2424
#- EXAMPLES
@@ -42,10 +42,10 @@ function show_script_help(){
4242
all_accept=0
4343
git_config=1
4444
vim_config=1
45+
tmux_config=1
4546
chewing=1
4647
extra_packages=1
4748
ssh_server=1
48-
screen=1
4949
pip3=1
5050
if [ "$#" -gt 0 ]; then
5151
while [ "$#" -gt 0 ]; do
@@ -70,6 +70,11 @@ if [ "$#" -gt 0 ]; then
7070
vim_config=0
7171
shift 1
7272
;;
73+
# Not use customize .tmux.conf file (from ./config/.tmux.conf).
74+
"-no_tmux-config" )
75+
tmux_config=0
76+
shift 1
77+
;;
7378
# Not install Taiwanese typing method
7479
"-no_chewing" )
7580
chewing=0
@@ -85,11 +90,6 @@ if [ "$#" -gt 0 ]; then
8590
ssh_server=0
8691
shift 1
8792
;;
88-
# Not install screen
89-
"--no_screen" )
90-
screen=0
91-
shift 1
92-
;;
9393
# Not install python3-pip
9494
"--no_pip3" )
9595
pip3=0
@@ -102,7 +102,7 @@ if [ "$#" -gt 0 ]; then
102102
done
103103
fi
104104
declare -A Extra_package_dict
105-
Extra_package_dict=([openssh-server]=$ssh_server [screen]=$screen [python3-pip]=$pip3)
105+
Extra_package_dict=([openssh-server]=$ssh_server [python3-pip]=$pip3)
106106

107107
function Echo_Color(){
108108
case $1 in
@@ -149,7 +149,7 @@ function Ask_yn(){
149149
#====================================================
150150
sudo apt update
151151
sudo apt upgrade
152-
sudo apt install -y git-all vim curl wget make
152+
sudo apt install -y git-all vim curl wget make tmux
153153

154154
if [ $git_config = 1 ]; then
155155
# git: config global usr information
@@ -209,10 +209,18 @@ if [ $git_config = 1 ]; then
209209
fi
210210

211211
if [ $vim_config = 1 ]; then
212-
Ask_yn "Do you want to use customize VIM editor setting? $(Echo_Color r '(If you do this, the old ~/.vimrc will remove it.)')"; result=$?
212+
Ask_yn "Do you want to use customized VIM editor setting? $(Echo_Color r '(If you do this, the old ~/.vimrc will remove it.)')"; result=$?
213213
if [ $result = 1 ]; then
214214
cp ./config/.vimrc ~/
215-
Echo_Color g "Completed VIM editor customize setting"
215+
Echo_Color g "Completed VIM editor customized setting"
216+
fi
217+
fi
218+
219+
if [ $tmux_config = 1 ]; then
220+
Ask_yn "Do you want to use customized tmux configuration? $(Echo_Color r '(If you do this, the old ~/.tmux.conf will remove it.)')"; result=$?
221+
if [ $result = 1 ]; then
222+
cp ./config/.tmux.conf ~/
223+
Echo_Color g "Completed customized tmux configuration"
216224
fi
217225
fi
218226

0 commit comments

Comments
 (0)