Skip to content

Instantly share code, notes, and snippets.

@rk76feWF
Last active July 8, 2022 15:10
Show Gist options
  • Save rk76feWF/756dd2b7d1f0aa0b0bb3a11a8854b136 to your computer and use it in GitHub Desktop.
Save rk76feWF/756dd2b7d1f0aa0b0bb3a11a8854b136 to your computer and use it in GitHub Desktop.
dotfiles(一旦)
alias ls='ls -GF'
alias ll='ls -GF -l'
alias grep='grep --color=auto'
alias ..='cd ..'
alias vim='nvim'
alias x='exit'
alias g++='g++-11'
alias pip='pip3'
alias g='git'
alias ga='git add'
alias gs='git status'
alias gp='git push'
#!/usr/bin/env bash
# エラーがあったらそこで即終了、設定していない変数を使ったらエラーにする
set -eu
# is_arm という関数を用意しておく。毎回 uname -m を実行するのは莫迦らしいので、UNAME 環境変数で判断
is_arm() { test "$UNAME" == "arm64"; }
# アーキテクチャ名は UNAME に入れておく
UNAME=`uname -m`
# dotfiles の場所を設定
DOTPATH=$HOME/dotfiles
# 入っていなければ、コマンドライン・デベロッパツールをインストール
xcode-select -p 1>/dev/null || {
echo "Installing Command line tools ..."
xcode-select --install
# その場合、M1 Mac では Rosetta2 もインストールされていないと思われるので、こちらもインストール
if is_arm; then
# ソフトウェアアップデートで Rosetta2 をインストール。面倒なのでライセンス確認クリックをスキップ
echo "Installing Rosetta2 ..."
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi
echo "Please exec ./bootstrap.sh again in $DOTPATH after installing command-line-tools and Rosetta2(M1 Mac only)."
exit 1
}
# install homebrew
if ! command -v brew > /dev/null 2>&1; then
# Install homebrew in Intel Mac or M1 Mac on Rosetta2
echo "Installing homebrew in /usr/local for Intel or Rosetta2 ..."
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo
# M1 Mac では /opt/homebrew にネイティブ版をインストール
if is_arm; then
echo "Installing homebrew in /opt/homebrew for Arm ..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi
# homebrew, cask and mas
if is_arm; then
echo "brew bundle in Rosetta2 ..."
cd rosetta2_brew
arch --arch x86_64 /usr/local/bin/brew bundle
# /opt/homebrew/bin のパスを追加
echo "brew bundle in Arm native ..."
cd ../arm_brew
brew bundle -v
cd ..
else
echo "brew bundle in Intel ..."
cd intel_brew
brew bundle -v
cd ..
fi
echo
# vscodeの拡張機能インストール
vscode_extensions=(
"MS-CEINTL.vscode-language-pack-ja"
"ms-vscode.cpptools"
"usernamehw.errorlens"
"oderwat.indent-rainbow"
"ms-vscode-remote.remote-ssh"
"MS-vsliveshare.vsliveshare"
"MS-vsliveshare.vsliveshare-audio"
"vscodevim.vim"
)
for e in ${vscode_extensions[@]}; do
if printf '%s\n' `code --list-extensions` | grep -qx ${e}; then # vscodeにすでに拡張機能がインストールされているか確認
echo "${e} is already installed."
else
code --install-extension ${e}
fi
done
### tap
tap "homebrew/bundle" # brew bundle コマンド
tap "homebrew/cask" # GUI アプリのインストール
tap "homebrew/services" # brew service コマンド
tap "homebrew/cask-fonts" # フォント
tap "homebrew/cask-versions" # 異なるバージョンの cask
### Casks
cask "visual-studio-code" # 多機能テキストエディタ
cask "notion" # Notion
cask "slack" # Slack
cask "drawio" # Drawio
cask "discord" # Discord
cask "utm" # エミュレータ
cask "eagle" # 回路設計ソフト
cask "warp" # Rust製terminal
cask "cloudflare-warp" # Cloudflareが提供する簡易VPN
cask "arduino" # Arduino IDE
cask "processing" # Processing
cask "iterm2" # iTerm2
cask "sourcetree" # sourcetree
### Homebrew
brew "mas" # Mac App Store command-line interface
brew "groff" # GNUの文章整形用プログラム Macにはデフォで入ってるけど文字化け防止で最新版に更新
brew "neovim" # Neovim
brew "ansible"
brew "gh" # GitHub Cli
brew "translate-shell" # Google翻訳をCLIでやるやつ
brew "yt-dlp/taps/yt-dlp" # YouTube Download Tool
brew "tig" # CLIなGitブラウザ
brew "glow" # CLI Markdown Viewer
brew "ffmpeg"
brew "python-tk"
brew "nodebrew"
### mas
mas "Microsoft Remote Desktop", id: 1295203466
mas "GoodNotes 5", id: 1444383602
# zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
set -x PATH $HOME/.nodebrew/current/bin:$PATH
# zshrc
alias ls='ls -GF'
alias ll='ls -GF -l'
alias grep='grep --color=auto'
alias ..='cd ..'
alias vim='nvim'
alias x='exit'
alias g++='g++-11'
alias pip='pip3'
alias g='git'
alias ga='git add'
alias gs='git status'
alias gp='git push'
starship init fish | source
set number
set title
set tabstop=4
set shiftwidth=4
set cursorline
set ignorecase
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;
nnoremap <silent><C-n> :NERDTreeToggle<CR>
inoremap jj <ESC>
" クソ設定
noremap <Left> <Nop>
noremap <Down> <Nop>
noremap <Up> <Nop>
noremap <Right> <Nop>
let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"
let g:lightline = {
\ 'colorscheme': 'one',
\ }
call plug#begin()
" Plug 'github/copilot.vim'
Plug 'tpope/vim-commentary'
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'yuttie/comfortable-motion.vim'
" ファイラは暗黒美夢王氏のものを使いたかったが慣れなかった
" " if has('nvim')
" Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
" else
" Plug 'Shougo/defx.nvim'
" Plug 'roxma/nvim-yarp'
" Plug 'roxma/vim-hug-neovim-rpc'
" endif
call plug#end()
format = """
[](#9A348E)\
$username\
[](bg:#DA627D fg:#9A348E)\
$directory\
[](fg:#DA627D bg:#FCA17D)\
$git_branch\
$git_status\
[](fg:#FCA17D bg:#86BBD8)\
$c\
$elixir\
$elm\
$golang\
$haskell\
$java\
$julia\
$nodejs\
$nim\
$rust\
[](fg:#86BBD8 bg:#06969A)\
$docker_context\
[](fg:#06969A bg:#33658A)\
$time\
[](fg:#33658A)\
\n[╰─>](fg:#6CAD77)
"""
# $time\
# [ ](fg:#33658A)\
# Disable the blank line at the start of the prompt
# add_newline = false
# You can also replace your username with a neat symbol like  to save some space
[username]
show_always = true
style_user = "bg:#9A348E"
style_root = "bg:#9A348E"
format = '[$user ]($style)'
[directory]
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"Documents" = " "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
# Keep in mind that the order matters. For example:
# "Important Documents" = "  "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important  " = "  "
[c]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[docker_context]
symbol = " "
style = "bg:#06969A"
format = '[[ $symbol $context ](bg:#06969A)]($style) $path'
[elixir]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[elm]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[git_branch]
symbol = ""
style = "bg:#FCA17D"
format = '[[ $symbol $branch ](bg:#FCA17D)]($style)'
[git_status]
style = "bg:#FCA17D"
format = '[[($all_status$ahead_behind )](bg:#FCA17D)]($style)'
[golang]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[haskell]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[java]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[julia]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[nodejs]
symbol = ""
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[nim]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[rust]
symbol = ""
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
[time]
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[[  $time ](bg:#33658A)]($style)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment