bcbcarl / env-setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

env-setup

Homebrew

https://brew.sh/

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Web Browsers

brew cask install firefox google-chrome google-chrome-canary vivaldi

Bash 4

brew install bash
echo /usr/local/bin/bash | sudo tee -a /etc/shells
chsh -s /usr/local/bin/bash

XCode Command Line Tools

xcode-select --install

Caskroom-fonts

brew tap caskroom/fonts
brew cask install font-fira-code font-firacode-nerd-font font-noto-sans-cjk-tc font-source-code-pro

iTerm2

brew tap caskroom/versions
brew cask install iterm2-beta
  1. Profiles -> Colors -> Import… -> Solarized Dark - Patched.itermcolors
  2. Profiles -> Text -> Font -> Change Font -> Fira Code
  3. Profiles -> Text -> Font -> Use Ligatures
  4. Profiles -> Keys -> + -> option-right -> Send Escape Sequence -> f
  5. Profiles -> Keys -> + -> option-left -> Send Escape Sequence -> b

GNU ls

brew install coreutils
wget https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-dark -O ~/.dir_colors
alias ls='gls --color=auto'
eval $(gdircolors $HOME/.dir_colors)

less

brew install source-highlight
export LESSOPEN='| /usr/local/bin/src-hilite-lesspipe.sh %s'
export LESS=' -RXF'
alias less='less -m -N -g -i -J --underline-special --SILENT'

Git

brew install git git-lfs
git config --global user.name <username>
git config --global user.email <email>
git lfs install
sudo git lfs install --system

tmux

brew install tmux

.tmux.conf:

set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
set -g escape-time 10
set -g mouse on

Node.js

Node.js:

brew install node

NPM prefix:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.profile
source ~/.profile

Yarn:

brew install yarn --ignore-dependencies

Python

brew install pyenv
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v 2.7.13
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v 3.6.2
pyenv global 3.6.2
pip install --upgrade pip

Ranger

brew install atool exiftool highlight libcaca mediainfo p7zip poppler ranger transmission unrar w3m
brew install mpv --with-bundle
ranger --copy-config=all

.config/ranger/rc.conf:

set preview_images true
set preview_images_method iterm2
set colorscheme solarized
export RANGER_LOAD_DEFAULT_RC='FALSE'

Utilities

brew install fasd ispell the_silver_searcher tree
brew cask install alfred amethyst android-platform-tools docker keepassx mactex rambox skim spotify virtualbox virtualbox-extension-pack vlc

Zsh

install:

brew install zsh
echo /usr/local/bin/zsh | sudo tee -a /etc/shells
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

customize:

git clone https://github.com/bhilburn/powerlevel9k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel9k
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

24-bit true color:

tic -x -o ~/.terminfo terminfo-24bit.src

.zshrc:

export TERM=xterm-24bit
export DEFAULT_USER=$(whoami)
ZSH_THEME="powerlevel9k/powerlevel9k"
plugins=(adb colored-man-pages docker emacs fasd git osx pyenv zsh-autosuggestions zsh-syntax-highlighting)

reference:

Editors

Emacs

brew tap d12frosted/emacs-plus
brew install emacs-plus --HEAD --with-natural-title-bar
brew linkapps emacs-plus
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
emacs

.spacemacs:

(defun dotspacemacs/layers ()
  (setq-default
    dotspacemacs-configuration-layers
    '(
      asm
      auto-completion
      bibtex
      (c-c++ :variables
             c-c++-default-mode-for-headers 'c++-mode)
      common-lisp
      docker
      emacs-lisp
      git
      html
      ivy
      javascript
      latex
      (markdown :variables
                markdown-live-preview-engine 'vmd)
      ocaml
      (org :variables
           org-enable-github-support t
           org-enable-reveal-js-support t)
      osx
      python
      ranger
      (shell :variables
             shell-default-height 30
             shell-default-position 'bottom)
      shell-scripts
      spell-checking
      syntax-checking
      themes-megapack
      version-control
      ycmd
      )

    dotspacemacs-additional-packages
    '(
      editorconfig
      quickrun
      wttrin
      )

    dotspacemacs-install-packages 'used-but-keep-unused
))

(defun dotspacemacs/init ()
  (setq-default
  dotspacemacs-elpa-https nil
  dotspacemacs-themes '(material
                        material-light)
  dotspacemacs-default-font '("Fira Code"
                              :size 14
                              :weight normal
                              :width normal
                              :powerline-scale 1.1)
  dotspacemacs-loading-progress-bar nil
  dotspacemacs-fullscreen-at-startup t
  dotspacemacs-fullscreen-use-non-native t
  dotspacemacs-line-numbers 'relative
  dotspacemacs-smartparens-strict-mode t
  dotspacemacs-smart-closing-parenthesis t
))

(defun dotspacemacs/user-config ()
  ;; c-c++
  (add-hook 'c++-mode-hook (lambda () (setq flycheck-clang-language-standard "c++11")))
  ;; editorconfig
  (editorconfig-mode 1)
  ;; emacs-plus
  (setq powerline-default-separator 'utf-8)
  ;; latex
  (setq TeX-engine 'xetex)
  ;; org-mode
  (setq org-reveal-root "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.4.1/")
  (setq org-latex-pdf-process '("xelatex -interaction nonstopmode %f"))
  ;; wttrin
  (setq wttrin-default-cities '("Taipei"))
  ;; ycmd
  (setq ycmd-server-command '("python" "/Users/carlsu/Documents/ycmd/ycmd/"))
  (setq ycmd-force-semantic-completion t)
  (setq ycmd-extra-conf-handler 'load)
  (set-variable 'ycmd-global-config "/Users/carlsu/Documents/ycmd/cpp/ycm/.ycm_extra_conf.py")
  ;; ligatures
  (when (window-system)
    (set-default-font "Fira Code"))
  (let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
              (35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
              (36 . ".\\(?:>\\)")
              (37 . ".\\(?:\\(?:%%\\)\\|%\\)")
              (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
              (42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
              (43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
              (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
              (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
              (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
              (48 . ".\\(?:x[a-zA-Z]\\)")
              (58 . ".\\(?:::\\|[:=]\\)")
              (59 . ".\\(?:;;\\|;\\)")
              (60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
              (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
              (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
              (63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
              (91 . ".\\(?:]\\)")
              (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
              (94 . ".\\(?:=\\)")
              (119 . ".\\(?:ww\\)")
              (123 . ".\\(?:-\\)")
              (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
              (126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
              )
            ))
  (dolist (char-regexp alist)
    (set-char-table-range composition-function-table (car char-regexp)
                          `([,(cdr char-regexp) 0 font-shape-gstring]))))
)

Neovim

brew install neovim
ln -s /usr/local/bin/nvim /usr/local/bin/vim
pip install --upgrade neovim
brew install go
go get -u github.com/nsf/gocode
curl -sLf https://spacevim.org/install.sh | bash
nvim

Visual Studio Code

brew cask install visual-studio-code

Install ‘code’ command in PATH

code --install-extension \
  christian-kohler.npm-intellisense \
  christian-kohler.path-intellisense \
  dbaeumer.vscode-eslint \
  eamodio.gitlens \
  mkaufman.HTMLHint \
  ms-vscode.cpptools \
  robertohuertasm.vscode-icons \
  shinnn.stylelint \
  vscodevim.vim \
  DavidAnson.vscode-markdownlint \
  PeterJausovec.vscode-docker \
  Tyriar.sort-lines
{
  "editor.fontFamily": "'Fira Code', monospace",
  "editor.fontSize": 14,
  "editor.lineNumbers": "relative",
  "editor.rulers": [80],
  "editor.tabSize": 2,
  "editor.minimap.renderCharacters": false,
  "editor.cursorBlinking": "phase",
  "editor.fontLigatures": true,
  "editor.renderControlCharacters": true,
  "editor.renderIndentGuides": true,
  "workbench.colorTheme": "Solarized Dark",
  "workbench.iconTheme": "vscode-icons",
  "stylelint.enable": true,
  "css.validate": false,
  "terminal.external.osxExec": "iTerm.app",
  "terminal.integrated.fontLigatures": true,
  "telemetry.enableCrashReporter": false,
  "telemetry.enableTelemetry": false,
  "javascript.referencesCodeLens.enabled": true,
  "typescript.referencesCodeLens.enabled": true,
  "typescript.implementationsCodeLens.enabled": true,
  "vsicons.projectDetection.disableDetect": true,
  "vim.useSystemClipboard": true,
  "vim.enableNeovim": true,
  "vim.disableAnnoyingNeovimMessage": true,
  "search.exclude": {
    "**/node_modules": false
  }
}

Atom

brew cask install atom
apm install \
  atom-ternjs \
  busy-signal \
  editorconfig \
  file-icons \
  git-plus \
  git-time-machine \
  intentions \
  language-docker \
  language-markdown \
  linter \
  linter-clang \
  linter-eslint \
  linter-stylelint \
  linter-ui-default \
  merge-conflicts \
  project-manager \
  react \
  relative-numbers \
  sort-lines \
  vim-mode-plus

config.cson:

"*":
  core:
    disabledPackages: [
      "language-gfm"
    ]
    telemetryConsent: "no"
    themes: [
      "one-dark-ui"
      "solarized-dark-syntax"
    ]
    titleBar: "hidden"
  editor:
    fontFamily: "Fira Code"
    showIndentGuide: true
    showInvisibles: true
  welcome:
    showOnStartup: false

ycmd

https://github.com/Valloric/YouCompleteMe/blob/master/README.md#installation

Misc.

defaults write com.apple.screencapture disable-shadow true

About