重温vim的配置:支持go
来源:互联网 发布:手游云挂机软件 编辑:程序博客网 时间:2024/06/06 02:26
参考vimrc配置 ,先将基础的vimrc配置好。这是我之前的配置,但是使用中还是有些不方便,有些技能没有掌握好,于是又好好研究下vim的配置,增加了如下的插件配置,同时支持go。
我在上面的基础上手动增加了其余几个常用的插件
vim-easy-align:快速对齐
1.vim ~/.vim/bundles.vim,在末尾增加:
Bundle 'junegunn/vim-easy-align'
2.vim ~/.vim/vimrc,末尾增加:
vmap <Leader>a <Plug>(EasyAlign)nmap <Leader>a <Plug>(EasyAlign)if !exists('g:easy_align_delimiters') let g:easy_align_delimiters = {}endiflet g:easy_align_delimiters['#'] = { 'pattern': '#', 'ignore_groups': ['String'] }" Start interactive EasyAlign in visual mode (e.g. vipga)xmap ga <Plug>(EasyAlign)"" " Start interactive EasyAlign for a motion/text object (e.g. gaip)nmap ga <Plug>(EasyAlign)
3.实例:
a. v模式,选择下面
let g:tagbar_left=1 let g:tagbar_width=30let g:tagbar_autofocus = 1 let g:tagbar_sort = 0 let g:tagbar_compact = 1
b. 敲入ga,进入EasyAlign模式,敲入=,会按如下等号对齐显示:
let g:tagbar_left = 1let g:tagbar_width = 30let g:tagbar_autofocus = 1let g:tagbar_sort = 0let g:tagbar_compact = 1
更多的实例参考:https://github.com/junegunn/vim-easy-align
multiple-cursors:多光标操作
1.vim ~/.vim/bundles.vim,在末尾增加:
Bundle 'terryma/vim-multiple-cursors'
2.vim ~/.vim/vimrc,末尾增加:
" 多光标操作 let g:multi_cursor_use_default_mapping=0" Default mapping " ctrl+m 选中一个" ctrl+p 放弃一个, 回到上一个" ctrl+x 跳过当前选中, 选中下一个" esc 退出 let g:multi_cursor_next_key='<C-m>'let g:multi_cursor_prev_key='<C-p>'let g:multi_cursor_skip_key='<C-x>'let g:multi_cursor_quit_key='<Esc>'
3.实例:
a. 如下代码中,光标停留再Println任何一个字母上,敲几次ctrl+m,就会选中几个Println
fmt.Println(url) fmt.Println(url.Scheme)fmt.Println(url.Opaque)fmt.Println(url.User)fmt.Println(url.Host)
b. 敲入c,输入Print,选择的Println会一块替换成Print
fmt.Print(url) fmt.Print(url.Scheme)fmt.Print(url.Opaque)fmt.Print(url.User)fmt.Print(url.Host)
vim-cpp-enhanced-highlight:c++高亮
1.vim ~/.vim/bundles.vim,在末尾增加:
Plugin 'octol/vim-cpp-enhanced-highlight'
2.vim ~/.vim/vimrc,末尾增加:
let g:cpp_class_scope_highlight = 1let g:cpp_experimental_template_highlight = 1
Ack
- 这个插件很有用,不需要重新安装,已经存在。光标停留在某函数或变量上,输入:Ack,会自动全局搜索调用处。
- 常用的命令:
? a quick summary of these keys, repeat to closeo to open (same as Enter)O to open and close the quickfix windowgo to preview file, open but maintain focus on ack.vim resultst to open in new tabT to open in new tab without moving to ith to open in horizontal splitH to open in horizontal split, keeping focus on the resultsv to open in vertical splitgv to open in vertical split, keeping focus on the resultsq to close the quickfix window
go支持
- 插件vim-go已经存在,但需要运行GoInstallBinaries,下载一些bin文件。前提是配置好$GOBIN,参考Go环境安装
- cd ~退出至home下,一定要在home下,否则后面会报错。
- 终端vim随便打开一个文件,输入
:GoInstallBinaries
,回车开始下载 - 如果需要更新,输入
:GoUpdateBinaries
- 增加配置,让go的函数、方法、关键字等高亮显示。
vim ~/.vim/vimrc,末尾增加:
let g:go_highlight_functions = 1let g:go_highlight_methods = 1let g:go_highlight_fields = 1let g:go_highlight_types = 1let g:go_highlight_operators = 1let g:go_highlight_build_constraints = 1
参考:
http://www.wklken.me/category/vim.html
http://vimawesome.com/
http://studygolang.com/articles/4777
https://github.com/yangyangwithgnu/use_vim_as_ide#4.1
0 0
- 重温vim的配置:支持go
- vim中对go的支持
- 配置 VIM 的 Go 语言开发环境
- 关于vim go环境的配置问题
- GO语言安装及vim-go的配置
- vim+go环境配置
- 配置go语言vim
- vim+go配置
- Go 支持Protocol Buffers的配置
- GO开发利器vim-go配置
- Go vim开发环境配置
- vim如何配置go语言环境
- vim 之 Cscope 一 配置对C++文件的支持
- 将您最喜爱的subliem text2 配置成支持vim
- 简洁又好用的vim配置 支持 python 中文
- Vim - Go
- vim go
- go and vim-go
- git版本恢复reset
- 【VijosP1792】摆花
- 贡献30本经典Linux学习和开发教程和资料,都是pdf完整版的
- Oracle get the Primary and foreign Key Column
- 元数据(MetaData)
- 重温vim的配置:支持go
- 做中文验证码
- suricata 3.1 源码分析25 (数据包以太层解码)
- 2.3-4将插入排序写成个递归的排序
- [gdc15]《命运》的多线程渲染框架
- Netty (二) 入门
- oracle函数listagg()
- 博文里程碑-20160930
- 大牛养成指南(3):天天写业务代码,如何成为技术大牛?