Setting up vim
" You need to import default vim settings first, e.g. syntax highlighting, etc.
source $VIMRUNTIME/defaults.vi
" Set non visual mode when mouse is dragging on vim
set mouse-=a
" set 1 tab == 4 spaces..
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
run .bashrc at .bash_profile time
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi
- Difference between .bashrc and .bash_profile
- Basically
.bash_profile
runs at log-in,.bashrc
runs when you run an interactive shell - But in Mac OS X, it runs login shell every time (even for starting an interactive shell).
- Basically
Highlight for git branch name
- Find git-prompt.sh from official git repo
- Setup code example
source ~/.git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " \[\033[32m\](%s)\[\033[00m\]")]\$ '
Double Pinyin (双拼)
使用Ctrl + space来改变输入法。 Use Ctrl + space to change input source..
使用Karabiner来把
Shift
键映射为Ctrl + space
。Use Karabiner to support usingShift
to switch between input sources.- 以下为映射代码 (需要放在
~/.config/karabiner/karabiner.json
,可能需要先做Karabiner
UI里面先映射一个simple modification
,然后karabiner.json
文件才会被创建。)Code to do that (to be put in~/.config/karabiner/karabiner.json
, you may need to set asimple modification
first inKarabiner
UI, then do this). - 更改文件中
complex_modifications
=>rules
的内容。You need to change thecomplex_modifications
=>rules
as follows:
"rules": [ { "manipulators": [ { "description": "Change left_shift to control+space when used alone", "from": { "key_code": "left_shift", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_shift" } ], "to_if_alone": [ { "key_code": "spacebar", "modifiers": [ "left_control" ] } ], "type": "basic" } ] } ]
- 引用 Credit: Armin’s Blog
- 以下为映射代码 (需要放在