由於 coding style 的規劃,需要調整 vim editor 的行為:
set tabstop=4set shiftwidth=4set expandtab
因此,設計一個 vim_env.sh 來做切換啟用:
% vim --version...system vimrc file: "$VIM/vimrc"user vimrc file: "$HOME/.vimrc"2nd user vimrc file: "~/.vim/vimrc"user exrc file: "$HOME/.exrc"defaults file: "$VIMRUNTIME/defaults.vim"fall-back for $VIM: "/usr/share/vim"% cat project_vimrctrysource $VIM/vimrccatchecho "\$VIM/vimrc not found"endtryset tabstop=4set shiftwidth=4set expandtab% cat vim_env.sh#!/bin/bashSCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";alias vim='vim -u $SCRIPT_DIR/project_vimrc'echo "Update vim environment (using 'type vim' to show raw command) "% type vimvim is an alias for vim -u $SCRIPT_DIR/project_vimrc
接著,就靠 alias 來啟用專案 vimrc
沒有留言:
張貼留言