Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Last active May 28, 2023 13:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamemomonga/4663dde65896402ca99a13d63afbeb64 to your computer and use it in GitHub Desktop.
Save mamemomonga/4663dde65896402ca99a13d63afbeb64 to your computer and use it in GitHub Desktop.

さくらのクラウドシェルでコピペ一発で「俺環境」を準備する

以下をコピペする

curl -L https://gist.githubusercontent.com/mamemomonga/4663dde65896402ca99a13d63afbeb64/raw/9045827bae598b3658f21204027ef0831d39358e/setup.sh | sudo bash
#!/bin/bash
set -eu
# Build Essentialをインストールする
INSTALL_BUILD_ESSENTIAL=1
if [ "$(id -u)" != 0 ]; then
echo "Please Run as root"
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install \
tzdata \
git \
curl \
wget \
vim \
jq \
sudo \
dnsutils
if [ $INSTALL_BUILD_ESSENTIAL ]; then
apt-get -y install build-essential
fi
cat > /etc/vim/vimrc.local << 'EOS'
syntax on
set wildmenu
set history=100
set number
set scrolloff=5
set autowrite
set tabstop=4
set shiftwidth=4
set softtabstop=0
set termencoding=utf-8
set encoding=utf-8
set fileencodings=utf-8,cp932,euc-jp,iso-2022-jp,ucs2le,ucs-2
set fenc=utf-8
set enc=utf-8
EOS
update-alternatives --set editor /usr/bin/vim.basic
cat > ~/.tmux.conf << 'EOS'
## 256色端末の使用
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm:colors=256'
## 色:ステータスバー
set -g status-fg white
#set -g status-bg black
set -g status-bg "#000066"
# ステータスラインの設定
set-window-option -g window-status-format "#I:#W"
set-window-option -g window-status-current-format "#[fg=colour255,bg=colour27,bold] #I:#W #[default]"
# ステータスバーを設定する
## 左パネルを設定する
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P "
## 右パネルを設定する
# set -g status-right "#[fg=cyan][%Y-%m-%d(%a) %H:%M] #[fg=colour255,bg=colour75] #H "
## ステータスバーのUTF-8サポート
# set -g status-utf8 on
## リフレッシュ間隔(デフォルト 15秒)
set -g status-interval 30
## ウィンドウリストの位置
set -g status-justify left
## ヴィジュアルノーティフィケーション
setw -g monitor-activity on
set -g visual-activity on
## ステータスバー位置
set -g status-position top
# ウィンドウ名が自動で変わらないようにする
set-option -g allow-rename off
# 新しいウィンドウを開いて縦割りにして一つ目のペインに戻る
bind C new-window \; split-window -h \; select-pane -t :.0
# 設定のリロード
bind r source-file ~/.tmux.conf \; display-message "Reload Config!!"
# vimのキーバインドでペインを移動する
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# vimのキーバインドでペインをリサイズする
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# コピーをvim風に設定する
setw -g mode-keys vi
EOS
echo "*** FINISH $0 ***"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment