Skip to content

Instantly share code, notes, and snippets.

@tai2
Last active December 13, 2022 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tai2/22d04d024f90a611102a7e2b371c6598 to your computer and use it in GitHub Desktop.
Save tai2/22d04d024f90a611102a7e2b371c6598 to your computer and use it in GitHub Desktop.
あたらしいMacにインストールするもの
# base-files version 3.7-1
# To pick up the latest recommended .bash_profile content,
# look in /etc/defaults/etc/skel/.bash_profile
# Modifying /etc/skel/.bash_profile directly will prevent
# setup from updating it.
# The copy in your home directory (~/.bash_profile) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benifitial to all, please feel free to send
# a patch to the cygwin mailing list.
# ~/.bash_profile: executed by bash for login shells.
# source the system wide bashrc if it exists
if [ -e /etc/bash.bashrc ] ; then
source /etc/bash.bashrc
fi
# source the users bashrc if it exists
if [ -e "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"
fi
# Set PATH so it includes user's private bin if it exists
if [ -d "${HOME}/bin" ] ; then
PATH=${HOME}/bin:${PATH}
fi
# Set MANPATH so it includes users' private man if it exists
if [ -d "${HOME}/man" ]; then
MANPATH=${HOME}/man:${MANPATH}
fi
# Set INFOPATH so it includes users' private info if it exists
if [ -d "${HOME}/info" ]; then
INFOPATH=${HOME}/info:${INFOPATH}
fi
# source the bash_completion if it exists
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
# git-prompt
# https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
if [ -f ~/.git-prompt.sh ]; then
. ~/.git-prompt.sh
fi
# git completion
# https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# 履歴
HISTSIZE=10000
HISTFILESIZE=10000
HISTIGNORE=\&
# エラー時に終了状態を表示
function showexit {
local s=$?
if [[ $s -eq 0 ]]; then return; fi
echo "exit $s"
}
PROMPT_COMMAND=showexit
# BASHオプション
shopt -s cdspell
shopt -s dirspell
shopt -s histappend
shopt -s histverify
shopt -s histreedit
shopt -s checkhash
shopt -s checkjobs
shopt -s checkwinsize
shopt -s cmdhist
shopt -s lithist
shopt -s nocaseglob
shopt -s no_empty_cmd_completion
set -o ignoreeof
# aliases
alias ls='ls -FG'
alias rm='rm -i'
alias s='git status'
alias d='git diff'
alias d-c='git diff --cached'
alias g='git grep'
alias b='git branch'
alias ag='ag --path-to-ignore ~/.agignore'
alias tenki='curl "http://wttr.in/akishima?lang=ja"'
alias python='python3'
alias pip='pip3'
alias vim='NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim'
# prompt custormize.
# see http://www.linux.or.jp/JF/JFdocs/Bash-Prompt-HOWTO.html#toc5%23Message-complete
export PS1='\[\033[0;32m\]\t \[\033[0;33m\]\w $(__git_ps1 "(%s)") \n\[\033[0m\]$ '
PATH=/usr/local/bin:$PATH
PATH=/usr/local/sbin:$PATH
PATH=~/bin:$PATH
PATH=$(go env GOPATH)/bin:$PATH
export SHELL=/opt/homebrew/bin/bash
export EDITOR=nvim
export PAGER=less
export LSCOLORS=dxfxcxdxbxegedabagacad
export FIGNORE=.o:~
export MESSAGES=c
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ORKA_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInV1aWQiOiI1ZjQ3YjIwOC0yMGRmLTQ2NmUtYWQwNi1lMjNiNjgyZmM4YTEifQ.eyJpZCI6IjA2YTkyYTJlLTE5MTUtNDAwMS05M2UwLThjZGFiNzg4OTE1NCIsImlhdCI6MTYyOTg1ODU1Mn0.A44xrxyk8L5kf1y6uNOmRJzpBAMRpTycAILQFLERo4I
# to use Ctrl-s in Terminal.app
# c.f. http://dallarosa.tumblr.com/post/31333511717/commandt-and-ctrl-s-on-mac-os-x
stty -ixon -ixoff
alias conWeb='ssh -i ~/.ssh/autify.pem ec2-user@$(aws ec2 describe-instances --profile forWeb --query "Reservations[*].Instances[?State.Name == \`running\` && Platform != \`windows\`].{InstanceId:InstanceId, Hostname:Tags[?Key == \`Name\`].Value|[0]}" --output text | sort | column -t | fzf --layout=reverse --cycle | head -n 1 | awk "{print \$2}")'
alias conMobile='ssh -i ~/.ssh/autify.pem ec2-user@$(aws ec2 describe-instances --profile forMobile --query "Reservations[*].Instances[?State.Name == \`running\` && Platform != \`windows\`].{InstanceId:InstanceId, Hostname:Tags[?Key == \`Name\`].Value|[0]}" --output text | sort | column -t | fzf --layout=reverse --cycle | head -n 1 | awk "{print \$2}")'
eval "$(rbenv init -)"
function afcd() {
LIST=(
"web behivee-web"
"editor behivee-web/autify-frontend/packages/scenario-editor"
"recorder behivee-web/autify-frontend/packages/behivee-recorder"
"content-recorder behivee-web/autify-frontend/packages/content-recorder"
"common behivee-web/autify-frontend/packages/common"
"worker behivee-worker"
)
cd ~/Code/autify/$(printf '%s\n' "${LIST[@]}" | fzf --layout=reverse --cycle | awk "{print \$2}")
}
# https://raw.githubusercontent.com/rupa/z/master/z.sh
. ~/bin/z.sh
function zcd() {
cd $(z | tail -r | fzf --layout=reverse --cycle | awk "{print \$2}")
}
function ge() {
FILE=`git grep "$@" | fzf --layout=reverse --cycle | cut -d : -f 1`
nvr --remote $FILE
}
function gt() {
FILE=`git grep "$@" | fzf --layout=reverse --cycle | cut -d : -f 1`
nvr --remote-tab $FILE
}
function fe() {
FILE=`find . -name "$1" | fzf --layout=reverse --cycle`
nvr --remote $FILE
}
function ft() {
FILE=`find . -name "$1" | fzf --layout=reverse --cycle`
nvr --remote-tab $FILE
}
function se() {
FILE=`git status --short | sed 's/^.* //' | fzf --layout=reverse --cycle`
nvr --remote $FILE
}
function st() {
FILE=`git status --short | sed 's/^.* //' | fzf --layout=reverse --cycle`
nvr --remote-tab $FILE
}
set editing-mode vi
TAB: menu-complete
"\e[Z": menu-complete-backward
" Plugin Settings
call plug#begin('~/.vim/plugged')
Plug 'lifepillar/vim-solarized8'
Plug 'tomtom/tcomment_vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'bronson/vim-trailing-whitespace'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'itchyny/lightline.vim'
Plug 'easymotion/vim-easymotion'
Plug 'airblade/vim-gitgutter'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'dhruvasagar/vim-table-mode'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'preservim/nerdtree'
Plug 'PhilRunninger/nerdtree-buffer-ops'
call plug#end()
" To properly drow CJK characters
set ambiwidth=double
" Show 80th character vertical line
set colorcolumn=100
highlight ColorColumn ctermbg=9
" colorscheme
set termguicolors
let &t_8f = "\[38;2;%lu;%lu;%lum"
let &t_8b = "\[48;2;%lu;%lu;%lum"
set background=dark
colorscheme solarized8
" ignore case on searching
set ignorecase
" Use clipboard as anonymous register
set clipboard=unnamed
" file change detection
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
" ctrlp http://ctrlpvim.github.io/ctrlp.vim/
let g:ctrlp_map = '<Leader>p'
let g:ctrlp_cmd = 'CtrlP'
" vim-indent-guides https://github.com/nathanaelkane/vim-indent-guides
let g:indent_guides_guide_size = 1
let g:indent_guides_color_change_percent = 3
" typescript.tsx
autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact
hi tsxTagName ctermfg=13 guifg=#E06C75
hi tsxCloseString guifg=#F99575
hi tsxCloseTag guifg=#F99575
hi tsxCloseTagName ctermfg=124 guifg=#F99575
hi tsxAttributeBraces guifg=#F99575
hi tsxEqual guifg=#F99575
hi tsxAttrib guifg=#F8BD7F cterm=italic
hi tsxTypeBraces guifg=#999999
hi tsxTypes guifg=#666666
hi ReactState guifg=#C176A7
hi ReactProps guifg=#D19A66
hi ApolloGraphQL guifg=#CB886B
hi Events ctermfg=204 guifg=#56B6C2
hi ReduxKeywords ctermfg=204 guifg=#C678DD
hi ReduxHooksKeywords ctermfg=204 guifg=#C176A7
hi WebBrowser ctermfg=204 guifg=#56B6C2
hi ReactLifeCycleMethods ctermfg=204 guifg=#D19A66
" Custom keymaps
let mapleader=","
nmap <silent> <C-N> :tabnext<CR>
nmap <silent> <C-P> :tabprevious<CR>
nmap <C-Y> :registers<cr>
nmap <F10> :set paste<cr>
nmap <F9> :set nopaste<cr>
nmap <F8> :IndentGuidesToggle<cr>
source ${HOME}/.config/nvim/coc.vim
"
" NerdTree
"
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Open the existing NERDTree on each new tab.
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
nnoremap <leader>f :NERDTreeFind<CR>
###
### keymap.conf
###
# ======================================================================
# event section
# ======================================================================
SKK_JMODE ctrl::;
SKK_ENTER group::hex::0x03,0x0a,0x0d||ctrl::m
SKK_CANCEL ctrl::g||hex::0x1b
SKK_BACKSPACE hex::0x08||ctrl::h
SKK_DELETE hex::0x7f||ctrl::d
SKK_TAB hex::0x09||ctrl::i
SKK_PASTE ctrl::y
SKK_LEFT hex::0x1c||ctrl::b||keycode::7b
SKK_RIGHT hex::0x1d||ctrl::f||keycode::7c
SKK_UP hex::0x1e||ctrl::a||keycode::7e
SKK_DOWN hex::0x1f||ctrl::e||keycode::7d
SKK_PING ctrl::l
SKK_UNDO ctrl::/
# ======================================================================
# attribute section(for SKK_CHAR)
# ======================================================================
ToggleKana q
ToggleJisx0201Kana ctrl::q
SwitchToAscii l
SwitchToJisx0208Latin L
EnterAbbrev /
EnterJapanese Q
NextCompletion .
PrevCompletion ,
NextCandidate hex::0x20||ctrl::n
PrevCandidate x||ctrl::p
RemoveTrigger X
UpperCases group::A-K,M-P,R-Z
Direct group::keycode::0x41,0x43,0x45,0x4b,0x4e,0x51-0x59,0x5b,0x5c,0x5f
InputChars group::hex::0x20-0x7e
CompConversion alt::hex::0x20||shift::hex::0x20
# ======================================================================
# handle option
# ======================================================================
AlwaysHandled group::keycode::0x66,0x68
PseudoHandled ctrl::l||hex::0x1b

App

  • Pro Tools
  • Avid Link
  • RX
  • Ableton Live Lite
  • Loopback

Homebrew

  • nvim
  • tmux
  • bash
  • bash-completion@2
  • nodebrew
  • jq
  • fzf
  • reattach-to-user-namespace
  • gtop
  • nvr
  • go
  • rbenv

brew cask

  • 1passowrd
  • google-chrome
  • spectacle
  • firefox
  • docker
  • choosy
  • slack
  • iterm2
  • daisydisk
  • caffeine
  • kindle
  • aquaskk
  • grammarly
  • wireshark
  • blackhole-2ch
  • loopback
  • signal
  • vlc

Firefox Addon

  • 1Password
  • AddToAny
  • better-history
  • Choosy
  • Grammarly
  • Wayback Machine
  • Zoom Scheduler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment