My .zshrc

  • .zshrc
    ########################
    # INITS
    ########################
    ZSH=$HOME/.oh-my-zsh                         # Path to your oh-my-zsh configuration.
    ZSH_CUSTOM=$HOME/.zsh_custom                 # Path to your oh-my-zsh configuration.
    ZSH_CUSTOM_PLUGINS=$HOME/.zsh_custom/plugins # Path to your oh-my-zsh configuration.
    ZSH_CUSTOM_THEMES=$HOME/.zsh_custom/themes   # Path to your oh-my-zsh configuration.
    ZSH_DISABLE_COMPFIX=true                     # Disable compfix which checks insecureness of folders (disabling it for docker)
    DISABLE_AUTO_TITLE=true                      # Disable shell name change (for TMUX)
    HIST_STAMPS="mm/dd/yyyy"                     # unable hisotry time stamp
    
    # set umask
    umask 000
    
    # set locale
    TZ=Asia/Seoul
    skip_global_compinit=1
    
    ########################
    # PLUGINS
    ########################
    #ZSH_THEME="robbyrussell"
    ZSH_THEME="spaceship-prompt/spaceship"
    
    ########################
    # PLUGINS
    ########################
    if [ ! -d $ZSH_CUSTOM_PLUGINS/zsh-autosuggestions ]; then
        git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM_PLUGINS/zsh-autosuggestions
    fi
    if [ ! -d $ZSH_CUSTOM_PLUGINS/zsh-syntax-highlighting ]; then
        git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM_PLUGINS/zsh-syntax-highlighting
    fi
    if [ ! -d $ZSH_CUSTOM_THEMES/spaceship-prompt ]; then
        git clone https://github.com/denysdovhan/spaceship-prompt.git $ZSH_CUSTOM_THEMES/spaceship-prompt
    fi
    
    plugins=(git autojump zsh_reload zsh-autosuggestions zsh-syntax-highlighting)
    
    #########################
    # SPACESHIP THEME SETTING
    #########################
    source $HOME/.zsh/set_spaceship.zsh
    
    ## Set prompt for docker container ##
    if [ -f /.dockerenv ]; then
        # >>> conda initialize >>>
        # !! Contents within this block are managed by 'conda init' !!
        __conda_setup="$('/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
        if [ $? -eq 0 ]; then
            eval "$__conda_setup"
        else
            if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
                # . "/anaconda3/etc/profile.d/conda.sh"  # commented out by conda initialize
            else
                # PATH="/anaconda3/bin:$PATH"  # commented out by conda initialize
            fi
        fi
        unset __conda_setup
        # <<< conda initialize <<<
        conda config --set changeps1 false
    
        SPACESHIP_PROMPT_FIRST_PREFIX_SHOW="true"
        SPACESHIP_USER_PREFIX="%F{blue}(Docker) "
    fi
    
    ########################
    # source oh my zsh
    ########################
    source $ZSH/oh-my-zsh.sh
    
    # compinit
    autoload -Uz compinit
    # set zcompdump to be saved in different directory
    compinit -u $HOME/.cache/zsh/zcompdump-$ZSH_VERSION
    
    ########################
    # MISC
    ########################
    
    ## Set tab color completion as the same as dircolros ##
    zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
    ## enable shift-tab ##
    bindkey -M menuselect '^[[Z' reverse-menu-complete
    
    ########################
    # SETTING VI MODE
    ########################
    EDITOR="vim -u $HOME/.vim/command_mode.vim"  # Set diffualt command line editor
    set -o vi #bindkey -v                               # Set command line editing mode
    KEYTIMEOUT=1                                 # Make Vi mode transitions faster (KEYTIMEOUT is in hundredths of a second)
    
    # key bindings for history searching
    bindkey -M vicmd '/' history-incremental-search-backward
    bindkey -M vicmd '?' history-incremental-search-forward
    
    # key bindings for history searching with arrow keys
    bindkey "^[OA" up-line-or-beginning-search
    bindkey "^[OB" down-line-or-beginning-search
    bindkey -M vicmd "k" up-line-or-beginning-search
    bindkey -M vicmd "j" down-line-or-beginning-search
    
    # key binkding for vim-like editor opening
    bindkey -M vicmd v edit-command-line
    bindkey -M vicmd "^V" edit-command-line
    function zle-keymap-select() {
        zle reset-prompt
        zle -R
    }
    zle -N zle-keymap-select
    
    ########################
    # KEY BINDINGS
    ########################
    #autosuggestions
    bindkey '^h' backward-kill-word
    bindkey '^l' forward-word
    bindkey '^k' up-line-or-beginning-search
    bindkey '^j' down-line-or-beginning-search
    
    bindkey '^ ' autosuggest-accept
    
    # key binding for deleting backward in insert mode
    bindkey '^?' backward-delete-char
    
    ########################
    # Alias
    ########################
    alias tmux="tmux -2 -u"
    alias count_files="find . -type f | wc -l"
    alias reload_history="fc -R $HOME/.zsh_history"
    alias dotdrop=/Jarvis/workspace/junyonglee/dotfiles/dotdrop.sh --cgf=/Jarvis/workspace/junyonglee/dotfiles/config.yaml
    alias glf='git log --graph --all --pretty=format:"%h%x09%C(auto)%d%Creset%x20%s"'
    alias glb='git log --graph --simplify-by-decoration --branches --topo-order --pretty=format:"%C(auto)%D%Creset"'
    alias wglb="watch -c -n 3 -t 'git log --graph --simplify-by-decoration --branches --pretty=format:\"%C(auto)%D%Creset\"'"
    #alias wglb="watch -c -n 3 -t 'git log --graph --simplify-by-decoration --branches --first-parent --pretty=format:\"%C(auto)%D%Creset\"'"
    alias wb="watch -c -n 3 -t 'git branch --color'"
    alias tb="/usr/local/bin/tb.sh"
    alias ps="ps rau"
    alias wn="watch -c -n 3 -t nvidia-smi --query-gpu=index,memory.used,memory.total,name --format=csv,noheader"
    
    alias pyclean="find . | grep -E \"(__pycache__|\.pyc|\.pyo$)\" | xargs rm -rf"
    
    
    ########################
    # Environment variables
    ########################
    
    LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
    PATH="/usr/local/cuda/bin:~/.local/bin:$PATH"
    CUDA_HOME="/usr/local/cuda"
    
    JAVA_HOME="/usr/local/java/jdk1.8.0_221"
    JRE_HOME="$JAVA_HOME/jre"
    PATH="$PATH:$JAVA_HOME/bin:$JRE_HOME/bin"
    PYTHONDONTWRITEBYTECODE=1
    OMP_NUM_THREADS="8"
    TERM="xterm-256color"
    
    #eval $(thefuck --alias)
    
    #if [ ! -f ~/.fzf.zsh ]; then
    #    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    #    ~/.fzf/install
    #fi
    #source ~/.fzf.zsh
    
    # syntax hihlighing plugin (should be at the end of zshrc file)
    source $ZSH_CUSTOM_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    
  • zsh/set_spaceship.zsh
    SPACESHIP_PROMPT_FIRST_PREFIX_SHOW="false"
    
    SPACESHIP_PROMPT_ADD_NEWLINE=true
    SPACESHIP_PROMPT_SEPARATE_LINE=true
    
    SPACESHIP_USER_SHOW=always
    SPACESHIP_USER_SUFFIX=""
    SPACESHIP_USER_COLOR=215        # SandyBrown
    
    SPACESHIP_DIR_COLOR="cyan"
    SPACESHIP_DIR_PREFIX="" #"» "
    SPACESHIP_DIR_LOCK_COLOR=203    # IndinaRed
    SPACESHIP_DIR_TRUNC=3
    SPACESHIP_DIR_TRUNC_PREFIX=".."
    
    SPACESHIP_HOST_SHOW=always
    SPACESHIP_HOST_PREFIX="@"
    SPACESHIP_HOST_SUFFIX=" "
    SPACESHIP_HOST_COLOR=215        # SandyBrown
    SPACESHIP_HOST_COLOR_SSH=215    # SandyBrown
    
    SPACESHIP_GIT_PREFIX="git:("
    SPACESHIP_GIT_SUFFIX=") "
    SPACESHIP_GIT_SYMBOL=""
    SPACESHIP_GIT_BRANCH_PREFIX=""
    SPACESHIP_GIT_STATUS_COLOR="yellow"
    SPACESHIP_GIT_STATUS_PREFIX="["
    SPACESHIP_GIT_STATUS_SUFFIX="]"
    
    SPACESHIP_CHAR_PREFIX=""
    SPACESHIP_CHAR_SYMBOL="%{➜ %2G%}"
    SPACESHIP_CHAR_SUFFIX=""
    
    SPACESHIP_GIT_BRANCH_COLOR=203  # IndianRed
    
    #SPACESHIP_VI_MODE_INSERT="%F{blue}%{[I]%1G%}"
    #SPACESHIP_VI_MODE_NORMAL="%F{white}[%F{203}%{N%1G%}%F{white}]%f"
    SPACESHIP_VI_MODE_INSERT="%F{white}[%F{white}%{I%1G%}%F{white}]%f"
    SPACESHIP_VI_MODE_NORMAL="%F{white}[%F{yellow}%{N%1G%}%F{white}]%f"
    SPACESHIP_VI_MODE_SUFFIX=" "
    
    SPACESHIP_TIME_SHOW="false"
    SPACESHIP_EXIT_CODE_SHOW="false"
    
    SPACESHIP_PROMPT_ORDER=(
        user          
        host         
        dir         
        git        
        conda
        line_sep      # Line break
        jobs
        vi_mode
        char      
    )
    
  • vim/command_mode.vim
    filetype on
    filetype plugin indent on
    syntax on
    set ft=stl
    
    set nocompatible
    let mapleader=" "
    
    set all&
    set hi=100
    set loadplugins
    set ma                  "set modifiable
    
    set encoding=utf-8
    set fenc=utf-8
    set fencs=utf-8,cp949,cp932,euc-jp,shift-jis,big5,ucs-2le,latin1
    
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#rc()
    """"""""""""""""""""""""""""""""""""""""""
    Bundle 'gmarik/Vundle.vim'
    """"""""""""""""""""""""""""""""""""""""""
    Bundle 'morhetz/gruvbox'
    """"""""""""""""""""""""""""""""""""""""""
    set background=dark" [light, dark]
    
    set cursorcolumn                           " highlight the current column
    set cursorline                             " highlight current line
    
    set t_Co=256
    "colorscheme wombat256mod
    colorscheme gruvbox
    set hlsearch                               " do not highlight searched for phrases
    set number                                 " turn on line numbers