DonkeyPeanuts / dotfiles

vim, bash, screen, zsh, tmux
The Unlicense
0 stars 0 forks source link

Organize settings #4

Closed DonkeyPeanuts closed 3 years ago

DonkeyPeanuts commented 3 years ago
DonkeyPeanuts commented 3 years ago

remove package/files settings

DonkeyPeanuts commented 3 years ago
".vimrcの最初に書くおまじない
filetype off

"dein.vimの設定
if &compatible
    set nocompatible
endif

let s:dein_dir = expand('~/.cache/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'

if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif

if dein#load_state(s:dein_dir)
    call dein#begin(s:dein_dir)
    let s:toml = '~/.dein.toml'
    let s:lazy_toml = '~/.dein_lazy.toml'
    call dein#load_toml(s:toml, {'lazy': 0})
    call dein#load_toml(s:lazy_toml, {'lazy': 1})

    let g:dein#install_process_timeout =  600
    if has('job') && has('channel') && has('timers')
      call dein#add('w0rp/ale')
    else
      call dein#add('vim-syntastic/syntastic')
    endif
    let g:dein#install_process_timeout =  120

    if ((has('nvim')  || has('timers')) && has('python3')) && system('pip3 show neovim') !=# ''
        call dein#add('Shougo/deoplete.nvim')
        if !has('nvim')
            call dein#add('roxma/nvim-yarp')
            call dein#add('roxma/vim-hug-neovim-rpc')
        endif
    endif

    call dein#end()
    call dein#save_state()
endif

if dein#tap('deoplete.nvim')
  let g:deoplete#enable_at_startup = 1
elseif dein#tap('neocomplete.vim')
  let g:neocomplete#enable_at_startup = 1
endif

if dein#check_install()
    call dein#install()
endif

if !has('nvim')
  packadd! matchit
  runtime ftplugin/man.vim
endif

augroup vimrc
  autocmd!
augroup END

" colors
if has('gui_running')
  let s:color_level = 2
elseif $TERM !~? '.*-256color'
  let s:color_level = 0
elseif !has('termguicolors')
  let s:color_level = 1
else
  let s:color_level = 2
  if !has('nvim') && $TERM =~? 'screen'
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  endif
endif

"色
"colorschemeの微調整
"colorschemeより前に書く
autocmd ColorScheme * highlight Comment ctermfg=245

if s:color_level >=? 2
  set termguicolors
endif
if s:color_level >=? 1
  set background=dark
  try
    let g:molokai_original = 1
    let g:rehash256 = 1
    colorscheme molokai
    set t_Co=256
  catch /E185:/ " colorscheme doesn't exist
  endtry
endif

let g:go_bin_path = $GOPATH.'/bin'

"indentline unset expandtab
"tab、indentの可視化
set list lcs=tab:\|\
let g:indentLine_color_term = 239
let g:indentLine_char = '.'
set listchars=tab:>-,trail:.,extends:>,precedes:<,nbsp:%

set colorcolumn=81
set ruler
set showcmd
set cmdheight=1
set laststatus=2
set lazyredraw
set wildmenu
set wildignorecase
set title

"encoding settings
set ff=unix
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932

"tabの入力
set expandtab

"自動でインデントを行う時の幅
set shiftwidth=4

"tabの幅
set softtabstop=4

"tabを含むファイルを開いた時のtabの幅
set tabstop=4

"対応する括弧の非表示
set noshowmatch
let loaded_matchparen = 1

"文字幅が不明な場合2バイトに固定
set ambiwidth=double

"ステータス行の内容
set statusline=%<%f%=%h%w%y%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%9(\ %m%r\ %)[%4v][%12(\ %5l/%5L%)]

"vimでbackspaceを入れても無反応 or Delete状態の時のおまじない
noremap
noremap!

"backsapceで削除できるものの指定
"おまじないその2
set backspace=indent,eol,start

"returnキーで改行
noremap <CR> o<ESC>

"autoindent
set smartindent

augroup fileTypeIndent
    autocmd!
    autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4
    autocmd BufNewFile,BufRead *.rb setlocal tabstop=2 softtabstop=2 shiftwidth=2
    autocmd BufNewFile,BufRead *.js setlocal tabstop=2 softtabstop=2 shiftwidth=2
augroup END

"行数表示
set number

"起動時のメッセージを消す
set shortmess+=I

"外部で変更のあったファイルは読み直す
set autoread

"現在の行/列の強調
set cursorline
set cursorcolumn

"行末の1文字先までカーソルを移動できるようにする
set virtualedit=onemore

"Escでハイライト消去
nmap <Esc><Esc> :nohlsearch<CR><Esc>

"windowサイズ調整
let g:winresizer_start_key = '<C-E>'

"neotermの基本設定
set sh=bash

"shellをEscで抜ける
if exists(':tnoremap')
    tnoremap <silent> <ESC> <C-\><C-n>
endif

"マウスで選択してもVisualモードにしない
set mouse-=a

if exists('+inccommand')
  set inccommand=split
endif

" show whitespace errors
hi link WhitespaceError Error
au vimrc Syntax * syn match WhitespaceError /\s\+$\| \+\ze\t/

""""""""""""
"  Search  "
""""""""""""
"インクリメンタル検索の有効化
set incsearch
"検索結果をハイライト
set hlsearch
"検索時に大文字と小文字を区別しない
set ignorecase
set smartcase
"検索がファイル末尾まで進んだらファイル先頭から再び検索する
set wrapscan
set tags=./tags;,tags

"""""""""""
"  Cache  "
"""""""""""
if !has('nvim')
  set viminfo+=n~/.cache/vim/viminfo
endif
set dir=~/.cache/vim/swap//
set backup
set backupdir=~/.cache/vim/backup
set undofile
set undodir=~/.cache/vim/undo
for s:d in [&dir, &backupdir, &undodir]
  if !isdirectory(s:d)
    call mkdir(iconv(s:d, &encoding, &termencoding), 'p')
  endif
endfor

""""""""""
"  Misc  "
""""""""""
let g:tex_flavor='latex'

" EasyMotion"
let g:EasyMotion_do_mapping=0
let g:EasyMotion_smartcase=1
let g:EasyMotion_use_migemo=1

" EditorConfig "
let g:EditorConfig_exclude_patterns=['fugitive://.*', '\(M\|m\|GNUm\)akefile']

" airline "
let g:airline_skip_empty_sections=1
if $USE_POWERLINE
  let g:airline_powerline_fonts=1
endif

" markbar "
let g:markbar_enable_peekaboo=v:false

" undotree "
let g:undotree_WindowLayout=2

let g:tigris#enabled = 1
let g:tigris#on_the_fly_enabled = 1
let g:tigris#delay = 300

".vimrcの最後に書くおまじない
filetype plugin indent on
syntax enable
DonkeyPeanuts commented 3 years ago
# 色有効化
autoload -Uz colors && colors # black red green yellow blue magenta cyan white

# hookの設定
autoload -Uz add-zsh-hook

typeset -U path PATH

bindkey -e
########################################
# completion周りの設定
########################################
fpath=($(brew --prefix)/share/zsh/site-functions $fpath)
if [ -e $(brew --prefix)/share/zsh-completions ]; then
  fpath=($(brew --prefix)/share/zsh-completions $fpath)
fi

autoload -Uz compinit
if [[ -f ~/.zcompdump(#qN.m+1) ]]; then
  compinit -u
else
  compinit -C
fi

setopt nonomatch

# 補完候補に色つける
zstyle ':completion:*' list-colors "${LS_COLORS}"

# 補完で小文字でも大文字にマッチさせる
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# ../ の後は今いるディレクトリを補完しない
zstyle ':completion:*' ignore-parents parent pwd ..

# sudo の後ろでコマンド名を補完する
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
                   /usr/sbin /usr/bin /sbin /bin

# ps コマンドのプロセス名補完
zstyle ':completion:*:processes' command 'ps x -o pid,s,args'

# 単語の入力途中でもTab補完を有効化
setopt complete_in_word

# 補完候補をハイライト
zstyle ':completion:*:default' menu select=1

# キャッシュの利用による補完の高速化
zstyle ':completion::complete:*' use-cache true

# 補完リストの表示間隔を狭くする
setopt list_packed

# コマンドの打ち間違いを指摘してくれる
setopt correct
SPROMPT="correct: $RED%R$DEFAULT -> $GREEN%r$DEFAULT ? [Yes/No/Abort/Edit] => "

# 不完全な補完
setopt always_to_end

# コマンドラインの引数でも補完を有効にする
setopt magic_equal_subst

# 展開する前に補完候補を出させる
setopt menu_complete

zmodload -i zsh/complist

########################################
# prompt周りの設定
# @TODO 今の所やりたいこと
# - cvs対応
# - ssh中のみホスト名表示
########################################
# VCSの情報を取得するzsh関数
autoload -Uz promptinit && promptinit
autoload -Uz vcs_info

# PROMPT変数内で変数参照
setopt prompt_subst

zstyle ':vcs_info:git:*' check-for-changes true #formats 設定項目で %c,%u が使用可
zstyle ':vcs_info:git:*' stagedstr "%F{green}!" #commit されていないファイルがある
zstyle ':vcs_info:git:*' unstagedstr "%F{magenta}+" #add されていないファイルがある
zstyle ':vcs_info:*' formats "%F{cyan}%c%u(%b)%f" #通常
zstyle ':vcs_info:*' actionformats '[%b|%a]' #rebase 途中,merge コンフリクト等 formats 外の表示
zstyle ':vcs_info:*' enable git cvs

# %b ブランチ情報
# %a アクション名(mergeなど)
# %c changes
# %u uncommit

__update_term() {

  vcs_info

  local user='%n'
  if [[ -n "$SSH_CONNECTION" ]]; then
    user='%n@%m'
  fi

  local left=" %{\e[38;5;4m%}[${user}]${vcs_info_msg_0_}%{\e[m%}"

  local right="%{\e[38;5;3m%}(%~)%{\e[m%}"
  # スペースの長さを計算
  # テキストを装飾する場合、エスケープシーケンスをカウントしないようにします
  local invisible='%([BSUbfksu]|([FK]|){*})'
  local leftwidth=${#${(S%%)left//$~invisible/}}
  local rightwidth=${#${(S%%)right//$~invisible/}}
  local padwidth=$(($COLUMNS - ($leftwidth + $rightwidth) % $COLUMNS))

  # print -P $left${(r:$padwidth:: :)}$right
  print -P $left$right
}

add-zsh-hook precmd __update_term

# プロンプト(左)
PROMPT='$'

# プロンプト(右)
RPROMPT=$'%{\e[38;5;251m%}%D{%b %d}, %*%{\e[m%}'

########################################
# alias周りの設定
# @TODO linuxとmacどちらでも使えるようにする
########################################
alias l='ls -tF --color=auto'
alias ls='ls -tF --color=auto'
alias ll='ls -ltF --color=auto'
alias la='ls -atF --color=auto'
alias lla='ls -altF --color=auto'
alias lld='ls -altFd --color=auto'

alias df='df -h'
alias sc='screen -D -U -RR'
alias hn='hostname'

alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'

alias vim='/usr/local/bin/vim'

alias history='history -i'

alias go='/usr/local/go/bin/go'

export GOPATH=$HOME/.go
export PATH=/usr/local/bin:$PATH:/usr/local/go/bin
########################################
# history共有周りの設定
########################################
function history-all { history -E 1 }
# プロセスを横断してヒストリを共有
# ヒストリの共有の有効化
setopt share_history

# 直前と同じコマンドをヒストリに追加しない
setopt hist_ignore_dups

# history search
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward

# ヒストリに追加されるコマンド行が古いものと同じなら古いものを削除
setopt hist_ignore_all_dups

# スペースで始まるコマンド行はヒストリリストから削除
setopt hist_ignore_space

# ヒストリを呼び出してから実行する間に一旦編集可能
setopt hist_verify

# 余分な空白は詰めて記録
setopt hist_reduce_blanks  

# 古いコマンドと同じものは無視 
setopt hist_save_no_dups

# historyコマンドは履歴に登録しない
setopt hist_no_store

# 履歴をインクリメンタルに追加
setopt inc_append_history
# インクリメンタルからの検索
bindkey "^R" history-incremental-search-backward
bindkey "^S" history-incremental-search-forward

# history 拡張
setopt extended_history

setopt hist_expire_dups_first
########################################
# その他
# @TODO 必要になったら編集
########################################
# shellで<back space>効かないとき用
if test -t 0; then
    stty stop undef
    stty erase "^H"
fi

# 単語の区切り文字を指定する
autoload -Uz select-word-style && select-word-style default

# ここで指定した文字は単語区切りとみなされる
# / も区切りと扱うので、^W でディレクトリ1つ分を削除できる
zstyle ':zle:*' word-chars " /=;@:{},|"
zstyle ':zle:*' word-style unspecified

# 日本語ファイル名を表示可能にする
setopt print_eight_bit

# beep を無効にする
setopt no_beep

# フローコントロールを無効にする
setopt no_flow_control

# '#' 以降をコメントとして扱う
setopt interactive_comments

# cd したら自動的にpushdする
setopt auto_pushd

# 重複したディレクトリを追加しない
setopt pushd_ignore_dups

# 高機能なワイルドカード展開を使用する
setopt extended_glob
# 内部コマンド jobs の出力をデフォルトで jobs -l にする
setopt long_list_jobs

# リダイレクトによる上書き禁止
setopt no_clobber

# 再コンパイル設定
autoload -Uz zrecompile && zrecompile -p -R ~/.zshrc -- -M ~/.zcompdump &!
autoload -Uz url-quote-magic && zle -N self-insert url-quote-magic

source ~/.zsh_plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets)

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

export PATH=$HOME/.nodebrew/current/bin:$PATH
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
DonkeyPeanuts commented 3 years ago
# シェル生成の度に読み込まれる
# prompt
PS1='\[\033[32m\]($(date +%Y-%m-%d_%H:%M:%S))\[\033[00m\]\[\033[34m\][\h @ \u]\[\033[00m\]\[\033[33m\]:\n\w\[\033[00m\]\$ '

# alias
alias l='ls -tF --color=auto'
alias ls='ls -tF --color=auto'
alias ll='ls -ltF --color=auto'
alias la='ls -atF --color=auto'
alias lla='ls -altF --color=auto'
alias lld='ls -altFd --color=auto'

alias grep='grep --color=auto'
alias df='df -h'
#alias ps='ps --sort=start_time'
alias sc='screen -D -U -RR'
alias hn='hostname'

# for root
if test "$UID" == 0; then
    alias mv='mv -i'
    alias cp='cp -i'
    alias rm='rm -i'
fi

# share history
function share_history
{
    history -a
    history -c
    history -r
}
PROMPT_COMMAND='share_history'
shopt -u histappend
shopt -s cmdhist

# test
# shellで<back space>効かないとき用
if test -t 0; then
    stty stop undef
    stty erase "^H"
fi

if [ -f ~/.local/share/etc/bash-completion ]; then
    source ~/.local/share/etc/bash_completion
fi
if [ -f ~/.local/share/git/git-completion.bash ]; then
    source ~/.local/share/git/git-completion.bash
fi
if [ -f ~/.local/share/git/git-prompt.sh ]; then
    source ~/.local/share/git/git-prompt.sh
    GIT_PS1_SHOWDIRTYSTATE=true
    GIT_PS1_SHOWUNTRACKEDFILES=true
    export PS1='\[\033[32m\]($(date +%Y-%m-%d_%H:%M:%S))\[\033[00m\]\[\033[34m\][\h @ \u]\[\033[00m\]\[\033[33m\]:\n\w\[\033[00m\]\[\033[35m\]$(__git_ps1 [%s])\[\033[00m\]\$ '
fi

[ -f ~/.fzf.bash ] && source ~/.fzf.bash
DonkeyPeanuts commented 3 years ago
[user]
    email = shsuehir@yahoo-corp.jp
    name = shsuehir
[alias]
    show-graph = log --graph --abbrev-commit --pretty=oneline
    tree = log --graph --all --format=\"%x09%C(cyan bold)%an%Creset%x09%C(yellow)%h%Creset %C(magenta reverse)%d%Creset %s\"
DonkeyPeanuts commented 3 years ago
#############
#  general  #
#############

set -g base-index 1
set -g renumber-windows on
set -g mouse on
set -g history-limit 50000
set -g display-time 4000
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
set -g set-titles on

###########
#  theme  #
###########

_curr_mode="#{?pane_in_mode,copy,#{client_key_table}}"
_sty_mode="#{?client_prefix,yellow,#{?pane_in_mode,blue,green}}"
_sty_stat="#[default,fg=black,bg=${_sty_mode}]"
_sty_sep1="#[default,fg=${_sty_mode}]"
_sty_sep2="#[reverse,fg=${_sty_mode}]"
_sep_lmain1="#{?USE_POWERLINE,,}"
_sep_lmain2="#{?USE_POWERLINE,, }"
_sep_lsub="#{?USE_POWERLINE,,|}"
_sep_rmain="#{?USE_POWERLINE,,}"
_sep_rsub="#{?USE_POWERLINE,,|}"
_seg_host="#{?#{==:#{SSH_CONNECTION},},,#{?USE_POWERLINE, ,S:}}#{=17:host_short}"
_seg_sync="#{?pane_synchronized,sync ${_sep_rsub} ,}"
_seg_table="${_curr_mode} ${_sep_rsub} "
_seg_mode="#{?#{==:${_curr_mode},root},${_seg_sync},${_seg_table}}"

set -g status-style "fg=white,bg=black"
set -g status-left "${_sty_stat} ${_ico_ssh}#{=7:session_name} ${_sty_sep1}${_sep_lmain2}"
set -g status-right "${_sty_sep1}${_sep_rmain}${_sty_stat} ${_seg_mode}%H:%M %b-%d-%y ${_sep_rsub} ${_seg_host} "
set -g status-right-length 50
set -g window-status-format " #I ${_sep_lsub} #W#{?window_flags,#{window_flags},}"
set -g window-status-current-format "${_sty_sep2}${_sep_lmain1}${_sty_stat} #I ${_sep_lsub} #W#{?window_flags,#{window_flags},} ${_sty_sep1}${_sep_lmain1}"
set -ga update-environment "USE_POWERLINE"

set-hook -g 'after-new-window' \
  'if -b "[ \#{window_panes} -eq 1 ]" "set pane-border-status off"'
set-hook -g 'after-kill-pane' \
  'if -b "[ \#{window_panes} -eq 1 ]" "set pane-border-status off"'
set-hook -g 'pane-exited' \
  'if -b "[ \#{window_panes} -eq 1 ]" "set pane-border-status off"'
set-hook -g 'after-split-window' \
  'if -b "[ \#{window_panes} -gt 1 ]" "set pane-border-status top"'

setenv -gu _curr_mode
setenv -gu _sty_mode
setenv -gu _sty_stat
setenv -gu _sty_sep1
setenv -gu _sty_sep2
setenv -gu _sep_lmain1
setenv -gu _sep_lmain2
setenv -gu _sep_lsub
setenv -gu _sep_rmain
setenv -gu _sep_rsub
setenv -gu _seg_host
setenv -gu _seg_sync
setenv -gu _seg_table
setenv -gu _seg_mode

#################
#  keybindings  #
#################

# prefix
set -g prefix C-z
unbind -a -T prefix
bind C-z send-prefix

# vi bindings
set -g mode-keys vi

# Don't wait after escape key input, since it slows down mode-switching in vim.
set -g escape-time 0

# mouse
bind -n MouseDrag1Status swap-window -t=
bind -n WheelUpPane if -Ft= "#{||:#{mouse_any_flag},#{pane_in_mode}}" \
  "select-pane -t=; send -M" \
  "if -Ft= '#{alternate_on}' 'select-pane -t=; send -t= Up' 'select-pane -t=; copy-mode -e; send -M'"
bind -n WheelDownPane if -Ft= "#{||:#{?alternate_on,#{mouse_any_flag},1},#{pane_in_mode}}" \
  "select-pane -t=; send -M" \
  "select-pane -t=; send -t= Down"

#################
#  prefix mode  #
#################

bind k select-pane -U \; switch-client -T prefix
bind j select-pane -D \; switch-client -T prefix
bind h select-pane -L \; switch-client -T prefix
bind l select-pane -R \; switch-client -T prefix
bind K resize-pane -U \; switch-client -T prefix
bind J resize-pane -D \; switch-client -T prefix
bind H resize-pane -L \; switch-client -T prefix
bind L resize-pane -R \; switch-client -T prefix
bind C-b copy-mode -ue
bind C-k swap-pane -U \; switch-client -T prefix
bind C-j swap-pane -D \; switch-client -T prefix
bind C-n new-window \; switch-client -T prefix
bind C-u copy-mode -e \; send -X halfpage-up
bind C-y copy-mode -e \; send -X scroll-up
bind g switch-client -T g
bind G display-panes \; switch-client -T prefix

bind i switch-client -T root
bind c switch-client -T c
bind d switch-client -T d
bind f switch-client -T copycat
bind m select-pane -m \; switch-client -T prefix
bind p paste-buffer \; switch-client -T prefix
bind t clock-mode \; switch-client -T prefix
bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane \;\
  switch-client -T prefix
bind y copy-mode
bind I setw synchronize-panes \; switch-client -T root
bind X confirm-before -p "kill-window #W? (y/n)" kill-window \;\
  switch-client -T prefix
bind Z switch-client -T Z
bind C-g display-message \; switch-client -T prefix
bind C-l refresh-client \; switch-client -T prefix
bind C-o if '[ #{window_panes} -gt 1 ]' last-pane last-window \;\
  switch-client -T prefix
bind C-w switch-client -T ctrl-w
bind '"' switch-client -T buffer
bind "'" command-prompt -p index "select-window -t ':%%'"
bind . send-prefix
bind / copy-mode \; command-prompt -ip "(search up)" \
  -I"#{pane_search_string}" "send -X search-backward-incremental \"%%%\""
bind : command-prompt \; switch-client -T prefix
bind ? list-keys
bind Enter resize-pane -Z \; switch-client -T prefix
bind Space next-layout \; switch-client -T prefix

###############
#  copy mode  #
###############

bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -i -sel clip"
bind -T copy-mode-vi / command-prompt -ip "(search up)" \
  -I"#{pane_search_string}" "send -X search-backward-incremental \"%%%\""
bind -T copy-mode-vi ? command-prompt -ip "(search down)" \
  -I"#{pane_search_string}" "send -X search-forward-incremental \"%%%\""
bind -T copy-mode-vi C-v send -X begin-selection \;\
  send -X rectangle-toggle

############
#  c mode  #
############

bind -T c s command-prompt -I "#S" "rename-session '%%'" \;\
  switch-client -T prefix
bind -T c w command-prompt -I "#W" "rename-window '%%'" \;\
  switch-client -T prefix

############
#  d mode  #
############

bind -T d b delete-buffer \; switch-client -T prefix
bind -T d m select-pane -M \; switch-client -T prefix

############
#  g mode  #
############

bind -T g 0 select-window -t :0 \; switch-client -T prefix
bind -T g 1 select-window -t :1 \; switch-client -T prefix
bind -T g 2 select-window -t :2 \; switch-client -T prefix
bind -T g 3 select-window -t :3 \; switch-client -T prefix
bind -T g 4 select-window -t :4 \; switch-client -T prefix
bind -T g 5 select-window -t :5 \; switch-client -T prefix
bind -T g 6 select-window -t :6 \; switch-client -T prefix
bind -T g 7 select-window -t :7 \; switch-client -T prefix
bind -T g 8 select-window -t :8 \; switch-client -T prefix
bind -T g 9 select-window -t :9 \; switch-client -T prefix
bind -T g b choose-tree
bind -T g s switch-client -n \; switch-client -T prefix
bind -T g S switch-client -p \; switch-client -T prefix
bind -T g t next-window \; switch-client -T prefix
bind -T g T previous-window \; switch-client -T prefix
bind -T g / run ~/.local/opt/tmux-copycat/scripts/copycat_search.sh

############
#  Z mode  #
############

bind -T Z C choose-client
bind -T Z Q suspend-client
bind -T Z Z detach-client

#################
#  buffer mode  #
#################

bind -T buffer p choose-buffer
# bind -T buffer + choose-buffer 'run "tmux show-buffer -b \'%%\' | xclip -i -sel clip"'

#################
#  ctrl-w mode  #
#################

bind -T ctrl-w K resize-pane -U 5 \; switch-client -T prefix
bind -T ctrl-w J resize-pane -D 5 \; switch-client -T prefix
bind -T ctrl-w H resize-pane -L 5 \; switch-client -T prefix
bind -T ctrl-w L resize-pane -R 5 \; switch-client -T prefix

bind -T ctrl-w o confirm-before -p "kill panes? (y/n)" "kill-pane -a" \;\
  switch-client -T prefix
bind -T ctrl-w r rotate-window -D \; switch-client -T prefix
bind -T ctrl-w s split-window -v -c "#{pane_current_path}" \;\
  switch-client -T prefix
bind -T ctrl-w v split-window -h -c "#{pane_current_path}" \;\
  switch-client -T prefix
bind -T ctrl-w w select-pane -t :.+ \; switch-client -T prefix
bind -T ctrl-w R rotate-window \; switch-client -T prefix
bind -T ctrl-w T break-pane \; switch-client -T prefix
bind -T ctrl-w C-o confirm-before -p "kill panes? (y/n)" "kill-pane -a" \;\
  switch-client -T prefix
bind -T ctrl-w C-r rotate-window \; switch-client -T prefix
bind -T ctrl-w C-s split-window -v -c "#{pane_current_path}" \;\
  switch-client -T prefix
bind -T ctrl-w C-v split-window -h -c "#{pane_current_path}" \;\
  switch-client -T prefix
bind -T ctrl-w C-w select-pane -t :.+ \; switch-client -T prefix
bind -T ctrl-w / command-prompt "find-window '%%'"

##################
#  copycat mode  #
##################

bind -T copycat u run "~/.local/opt/tmux-copycat/scripts/copycat_mode_start.sh \
  '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*'"
bind -T copycat f run "~/.local/opt/tmux-copycat/scripts/copycat_mode_start.sh \
  '(^|^\.|[[:space:]]|[[:space:]]\.|[[:space:]]\.\.|^\.\.)[[:alnum:]~_-]*/[][[:alnum:]_.#$%&+=/@-]*'"
bind -T copycat '#' run "~/.local/opt/tmux-copycat/scripts/copycat_mode_start.sh \
  '\\b[0-9a-fA-F]{7,64}\\b'"
bind -T copycat 1 run "~/.local/opt/tmux-copycat/scripts/copycat_mode_start.sh \
  '\\b[[:digit:]]+\\b'"
bind -T copycat 4 run "~/.local/opt/tmux-copycat/scripts/copycat_mode_start.sh \
  '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'"
bind -T copycat g run "~/.local/opt/tmux-copycat/scripts/copycat_git_special.sh #{pane_current_path}"
DonkeyPeanuts commented 3 years ago

最低限は完了したのでclose