Zsh
mac下默认的shell比较弱,直接换成zsh吧,兼容bash、更高效、更好的自动实例、可定制性高……
安装
1 2
| ✗ more /etc/shells | grep zsh /bin/zsh
|
1
| sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
插件
- autosuggestions
- syntax-highlighting
1 2 3
| mkdir -p ~/.zsh/plugins git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/plugins/zsh-syntax-highlighting
|
修改配置
1 2
| ZSH_CUSTOM=~/.zsh plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
|
重新加载配置
Tmux
安装
配置
1 2 3 4
| ➜ ~ rm -rf .tmux ➜ ~ git clone https://github.com/gpakosz/.tmux.git ➜ ~ ln -s .tmux/.tmux.conf ➜ ~ cp .tmux/.tmux.conf.local .
|
重新加载tmux.conf
1
| tmux source-file /path/to/conf
|
1
| bind r source-file ${HOME}/.tmux.conf \; display-message "source-file reloaded"
|
一些快捷键
快捷键 |
简介 |
PREFIX-:new |
新建session |
PREFIX-$ |
重命名session |
PREFIX-s |
列出所有session(可用上下方向键选择切换) |
PREFIX-c |
新建window |
PREFIX-, |
window重命名 |
PREFIX-& |
kill window |
PREFIX-% |
垂直切分(切分为两个panel) |
PREFIX-“ |
水平切分 |
Theme
Soliarized是笔者见过的最强大(支持的软件真心多)最酷的一个主题包
VIM
基本配置
tab
1 2 3 4 5
| set tabstop=4 set cindent shiftwidth=4 set autoindent shiftwidth=4
set expandtab
|
编码识别
原理是严格的编码放前面,宽松的放后面
1
| set fencs=ucs-bom,utf-8,gb18030,gbk,gb2312,cp936,latin1
|
插件逐个说
总览
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Plugin 'VundleVim/Vundle.vim' Plugin 'mileszs/ack.vim' Plugin 'mattn/emmet-vim' Plugin 'ervandew/supertab' Plugin 'christoomey/vim-tmux-navigator' Plugin 'tpope/vim-markdown' Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdcommenter' Plugin 'majutsushi/tagbar' Plugin 'kien/ctrlp.vim' Plugin 'jiangmiao/auto-pairs' Plugin 'flazz/vim-colorschemes' Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' Plugin 'tpope/vim-dispatch' Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-surround' Plugin 'tpope/vim-repeat' Plugin 'bling/vim-airline' Plugin 'Lokaltog/vim-easymotion' Plugin 'Shougo/neocomplete' Plugin 'mhinz/vim-startify' Plugin 'vim-scripts/wildfire.vim' Plugin 'vim-scripts/cscope.vim' Plugin 'nathanaelkane/vim-indent-guides' Plugin 'yonchu/accelerated-smooth-scroll' Plugin 'sunzy/vim-deploy' Plugin 'vim-scripts/tlib' Plugin 'gregsexton/MatchTag' Plugin 'valloric/MatchTagAlways' Plugin 'pangloss/vim-javascript' Plugin 'vimwiki/vimwiki' Plugin 'dahu/diffo'
|
NERDTree
1 2 3 4 5 6
| :map <leader>n :NERDTree<CR> let NERDTreeQuitOnOpen=1 let NERDChristmasTree=1 let g:NERDTreeWinSize=32 map <leader>r :NERDTreeFind<CR> map <leader>bs :BookmarkToRoot static<CR>
|
vimwiki
适合做随笔,写代码时有啥灵感,使用+wt呼之而出
配置支持markdown(实际上也没什么卵用)
1 2 3
| let g:vimwiki_list = [ \{"path":"~/vimwiki","path_html":"~/vimwiki_html","syntax":"markdown","auto_export":0}, \]
|
snippets
1 2
| Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets'
|
1 2 3 4 5 6
| let g:UltiSnipsExpandTrigger="<tab>" let g:UltiSnipsJumpForwardTrigger="<c-b>" let g:UltiSnipsJumpBackwardTrigger="<c-z>" let g:UltiSnipsListSnippets="<c-tab>" let g:UltiSnipsEditSplit="vertical" nnoremap <leader>es :UltiSnipsEdit<CR>
|
使用es便可以打开一个当前文件类型的snippet配置文件(在~/.vim/ultiSnips/下),可以在写代码的同时把snippet也给写了
最新版本已经解决了与supertab的冲突
php.snippets可直接使用
如果想使用php-laravel.snippets可在vimrc中添加如下代码 =>参考
1
| autocmd FileType php set ft=php.laravel
|
cscope
生成cscope
1 2 3 4
| mkdir -p ~/data/ cd ~/data find /Projects/trunk -name '*.php' > ~/data/cscope.files cscope -b
|
设置环境变量
1 2
| echo export CSCOPE_DB=/Users/test/data/cscope.out >> ~/.zshrc source ~/.zshrc
|
插件安装
1
| Plugin 'vim-scripts/cscope.vim'
|
插件配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| if has("cscope") if filereadable("cscope.out") cs add cscope.out elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif endif
nnoremap <leader>fa :call cscope#findInteractive(expand('<cword>'))<CR> nnoremap <leader>l :call ToggleLocationList()<CR>
nnoremap <leader>fs :call cscope#find('s', expand('<cword>'))<CR>
nnoremap <leader>fg :call cscope#find('g', expand('<cword>'))<CR>
nnoremap <leader>fd :call cscope#find('d', expand('<cword>'))<CR>
nnoremap <leader>fc :call cscope#find('c', expand('<cword>'))<CR>
nnoremap <leader>ft :call cscope#find('t', expand('<cword>'))<CR>
nnoremap <leader>fe :call cscope#find('e', expand('<cword>'))<CR>
nnoremap <leader>ff :call cscope#find('f', expand('<cword>'))<CR>
nnoremap <leader>fi :call cscope#find('i', expand('<cword>'))<CR>
|
生成数据文件
1 2 3 4 5 6 7 8 9
| cat phpctags.sh #!/bin/bash
cur_dir=$PWD cd ~/project/trunk/ find . -name "*.php" > src.files ctags -R -L src.files PWD=cur_dir echo 'Done!'
|
配置
1
| set tags+=~/project/trunk/tags
|