--- /dev/null
+# 安装vim插件
+
+
+## 安装插件总管
+
+`git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim`
+
+在`~/.vimrc`中添加如下代码
+```
+set nocompatible " be iMproved, required
+filetype off
+set rtp+=~/.vim/bundle/Vundle.vim
+call vundle#begin()
+Plugin 'VundleVim/Vundle.vim'
+Plugin 'fatih/vim-go'
+Plugin 'Valloric/YouCompleteMe'
+Plugin 'Lokaltog/vim-powerline'
+Plugin 'scrooloose/nerdtree'
+Plugin 'Yggdroot/indentLine'
+call vundle#end()
+filetype plugin indent on
+```
+
+
+## 安装vim-go
+
+在`~/.vimrc` 中添加如下代码
+
+```
+call plug#begin()
+
+" ....
+
+call plug#end()
+```
+之间添加`Plugin 'fatih/vim-go'`
+
+退出,再打开vim,执行 `:PluginInstall`
+
+
+# 安装yourcompleteme
+
+如上
+```Plug 'Valloric/YouCompleteMe'```
+
+再`:PlugInstall`
+
+重启vim,输入指令重启ycm服务器 `:YcmRestartServer`
+
+编译的命令:
+```
+cd ~/.vim/bundle/YouCompleteMe
+./install.py --clang-completer
+```
+
+参数 --clang-completer是为了加上C系列语言的自动补全,如果不需要可以不加
+
+
+```
+" 解决 No .ycm_extra_conf.py detected
+let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py"
+
+" 设置回车为补全确认键
+let g:ycm_key_list_stop_completion = ['<CR>']
+```
+
+
+
+## 安装vim-powerline
+```Plugin 'Lokaltog/vim-powerline'```
+
+```
+set laststatus=2 " Always show the statusline
+set encoding=utf-8 " Necessary to show Unicode glyphs
+set t_Co=256
+let g:Powerline_symbols= 'unicode'
+```
+
+
+## 安装NERDTree
+
+```Plugin 'scrooloose/nerdtree'```
+
+```
+" NERDTree 插件的相关配置
+"F2开启和关闭树"
+map <F2> :NERDTreeToggle<CR>
+let NERDTreeChDirMode=1
+"显示书签"
+let NERDTreeShowBookmarks=1
+"设置忽略文件类型"
+let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
+"窗口大小"
+let NERDTreeWinSize=25
+```
+
+## 安装indentline
+
+```Plugin 'Yggdroot/indentLine'```
+
+
+```:echo has("conceal")``` 如果为0表示vim不带conceal功能,就没法用indentline
set number " 显示行号
" set autoindent " 自动对齐
set smartindent
+
set tabstop=4 " TAB的宽度
set shiftwidth=4
set expandtab " TAB用空格代替,否则可用 set noexpandtab
"hi CursorColumn ctermbg=lightgreen cterm=BOLD
set viminfo='1000,<500
-" 需要安装bundle/vundle vim-go 到~/.vim/
-"filetype off
-"set rtp+=~/.vim/bundle/vundle/
-"call vundle#rc()
-"Bundle 'gmarik/vundle'
-"Plugin 'fatih/vim-go'
-"filetype plugin indent on
-
" 以下是让mac vim支持中文输入
set encoding=utf-8 " 默认UTF-8
set fenc=utf-8 " 默认以UTF-8新建文件
" 连续按两次jj表示按ESC,进入命令模式
imap jj <Esc>
+
" set paste 会使 imap jj <Esc>失效
"set paste
+
+
+filetype off
+set rtp+=~/.vim/bundle/Vundle.vim
+call vundle#begin()
+Plugin 'VundleVim/Vundle.vim'
+Plugin 'fatih/vim-go'
+Plugin 'Valloric/YouCompleteMe'
+Plugin 'Lokaltog/vim-powerline'
+Plugin 'scrooloose/nerdtree'
+call vundle#end()
+filetype plugin indent on
+
+" youcompleteme插件相关配置
+let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py"
+" 设置回车为补全确认键
+let g:ycm_key_list_stop_completion = ['<CR>']
+
+" vim-powerline插件相关配置
+set laststatus=2 " Always show the statusline
+set encoding=utf-8 " Necessary to show Unicode glyphs
+set t_Co=256
+let g:Powerline_symbols= 'unicode'
+
+" NERDTree 插件的相关配置
+"F2开启和关闭树"
+map <F2> :NERDTreeToggle<CR>
+let NERDTreeChDirMode=1
+"显示书签"
+let NERDTreeShowBookmarks=1
+"设置忽略文件类型"
+let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
+"窗口大小"
+let NERDTreeWinSize=25
+
+"let g:indentLine_setColors = 0
+"let g:indentLine_color_term = 239
+"let g:indentLine_bgcolor_term = 202
+"let g:indentLine_bgcolor_gui = '#FF5F00'
+"let g:indentLine_char = '|'
+let g:indentLine_color_term = 239
+"let g:indentLine_char_list = ['|', '¦', '┆', '┊']
+"let g:indentLine_enabled=1
+let g:indentLine_char='┆'
+let g:indentLine_enabled = 1
+let g:indentLine_showFirstIndentLevel = 1
--- /dev/null
+/*
+ * ------------------------------------------------------------------------
+ * File Name: closure.go
+ * Author: Zhao Yanbai
+ * 2019-03-18 11:01:25 星期一 CST
+ * Description: none
+ * ------------------------------------------------------------------------
+ */
+package main
+import (
+ "fmt"
+)
+
+
+func Accumulate(value int) func() int {
+ return func() int {
+ value++;
+ return value;
+ }
+}
+
+func main() {
+ defer fmt.Println("Program Exited...")
+
+ accumulatorA := Accumulate(1)
+
+ fmt.Println(accumulatorA())
+ fmt.Println(accumulatorA())
+
+ fmt.Printf("%p\n", accumulatorA);
+
+
+ accumulatorB := Accumulate(1024)
+
+ fmt.Println(accumulatorB())
+ fmt.Println(accumulatorB())
+
+ fmt.Printf("%p\n", accumulatorB);
+}
--- /dev/null
+/*
+ * ------------------------------------------------------------------------
+ * File Name: variadicfunc.go
+ * Author: Zhao Yanbai
+ * 2019-03-18 15:16:04 星期一 CST
+ * Description: none
+ * ------------------------------------------------------------------------
+ */
+package main
+import (
+ "fmt"
+)
+
+func sum(vals ...int) int {
+ total := 0
+
+ for _, v := range(vals) {
+ total += v
+ }
+
+ return total
+}
+
+
+func rawPrintType(args ...interface{}) {
+ for _, s := range args {
+ fmt.Printf("%T\n", s)
+ }
+}
+
+
+func printType(args ...interface{}) {
+ rawPrintType(args...);
+}
+
+
+func main() {
+ defer fmt.Println("Program Exited...")
+
+ fmt.Println(sum(1, 2, 3, 4, 5))
+
+ var a struct { }
+
+ printType(1, 1.0, true, a)
+}