~/.bashrc的常用配置
终端提示符显示git branch名
在 ~/.bashrc里面添加终端提示符显示git branch名
PS1='\[\e[32;1m\]${debian_chroot:+($debian_chroot)}\u@\A:\[\e[1;33m\]\w$(__git_ps1 " \[\e[1;35m\](%s)")\[\e[32;1m\]\$ \[\e[m\]'
Mac 如下更改
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " ($branch)"
fi
}
export PS1='\[\e[32;1m\]${debian_chroot:+($debian_chroot)}\u@\A:\[\e[1;33m\]\w\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ \[\e[m\]'
好看的PS1配置
parse_git_branch() {
git branch 2> /dev/null | sed -e ‘/[]/d’ -e ‘s/ (.*)/ (\1)/’
}
PS1="[\033[0;32m]\u@\h [\033[0;33m]\w [\033[0;36m]$(parse_git_branch)[\033[0m]\n$ "
设置 path
# config path
export PATH=/home/changpzh/.nvm/versions/node/v6.11.4/bin:/usr/share/:$PATH
设置 proxy
export http_proxy=http://10.144.1.10:8080
export https_proxy=http://10.144.1.10:8080
nvm 配置
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
配置 alias
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..="cd .."
alias ..2="cd ../../"
alias ..3="cd ../../../"
alias ..4="cd ../../../../"
alias ..5="cd ../../../../../"
vimrc 常用配置
vimrc在 /etc/vim/ 下面
"change tapsapce to 4 spaces"
set tabstop=4 " 设置tab长度为4
set softtabstop=4 " 使得按退格键时可以一次删掉 4 个空格
set shiftwidth=4 " 设置<<< 和 >>>移动时宽度为4
set noexpandtab
set expandtab
set autoindent " 自动缩进
set showmatch " 显示匹配的括号
set hlsearch " 高亮search 匹配字样
set backspace=2 " 可以随时用退格删除字符
set background=dark " 显示不同的底色色调
set nu " 显示每一行的行号
syntax on " 自动语法高亮
"Hightlight cursor line"
:set cursorline
:set cursorcolumn
"change Hight light color"
highlight CursorLine cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE
highlight CursorColumn cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE
==============================================================================
set showmatch " automatically show matching brackets. works like it does in bbedit.
set vb " turn on the "visual bell" - which is much quieter than the "audio blink"
set ruler " show the cursor position all the time
set laststatus=2 " make the last line where the status is two lines deep so you can see status always
set backspace=indent,eol,start " make that backspace key work the way it should
set nocompatible " vi compatible is LAME
set background=dark " Use colours that work well on a dark background (Console is usually black)
set showmode " show the current mode
set clipboard=unnamed " set clipboard to unnamed to access the system clipboard under windows
syntax on " turn syntax highlighting on by default
" Show EOL type and last modified timestamp, right after the filename
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P