网站搭建外推站群服务器竞价专用GVim配置一个漂亮的NerdTree
需要服务器咨询以下联系方式
联系人:銳輝(香港)科技 敏敏
扣扣:3007425289/2853898501
电话:18316411879
稳定24小时售后 不限流量CN2带宽
第二台机器半价 先到先得 新机柜 上完截止 没有抢到等新的机柜
NerdTree下载安装
如果你安装了插件管理器的化安装就很简单了,如果没有安装使用任何插件管理器,那我建议你还是装一个,因为vim你会用到的插件挺多的,有个管理器很方便。
将这句添加到vimrc中Plugin 'scrooloose/nerdtree',随后重启下vim然后命令模式下执行:BundleInstall(具体根据你装的插件,我装的是Bundle。)安装指令,完毕后最好再重启一次vim。
NerdTree配置
ps: 以下我的配置仅供参考,具体配置请查阅github上的文档,因为随着作者版本的升级指令和功能可能会边。总之请灵活学习。
"""""""""""""""""""""""""""""""
"NerdTree setting
"""""""""""""""""""""""""""""""
set encoding=utf-8
set termencoding=utf-8
set fileencoding=chinese
set fileencodings=ucs-bom,utf-8,chinese
set langmenu=zh_CN.utf-8
language messages zh_cn.utf-8
"Show line number.
let g:NERDTreeShowlineNumber=1
"Show hide file.
let g:NERDTreeHidden=0
"Show Node model.
let NERDTreeDirArrows=1
"Delete help information at the top
let NERDTreeMinimalUI=1
let g:NERDTreeDirArrowExpandable = '|'
let g:NERDTreeDirArrowCollapsible = '/'
简单解释下,前面几行将几个部分的字体设置为utf-8是为了防止再windows下乱码。是否显示行号这里配置为是,因为否的话左边一列每行首都会显示|符号,太多了不好看。配置为是反倒不会显示行号,且只有在文件夹左边才会显示|符号。剩下的配置根据注释意思好理解。文件召开或关闭很多人配置为三角符号,我试了下windows下需要折腾合适字体才能显示,我现在用的molokai字体是不支持的。其实我更喜欢的是键盘上的|和/符号,简单粗暴。
另外我还建议加上这样一句配置,作用是当剩余的窗口都不是文件编辑窗口时,自动退出vim。就是你都不编辑文件了,还剩个NerdTree窗口在那里时自动退出GVim(执行:qa!)。
autocmd BufEnter * if 0 == len(filter(range(1, winnr('$')), 'empty(getbufvar(winbufnr(v:val), "&bt"))')) | qa! | endif
1
vim-devicons插件
为了在NerdTree中显示图标需要装此插件,当然这个插件不光支持NerdTree,还支持vim-airline、CtrlP、powerline等。
vim-devicons下载安装
插件安装都类似的,在vimrc中添加Plugin ‘ryanoasis/vim-devicons’
vim-devicons配置
""""""""""""""""""""""""""""""
"vim-devicons settings
""""""""""""""""""""""""""""""`
set encoding=UTF-8
"Can be enabled or disabled
let g:webdevicons_enable_nerdtree = 1
"whether or not to show the nerdtree brackets around flags
let g:webdevicons_conceal_nerdtree_brackets = 1
"adding to vim-airline's tabline
let g:webdevicons_enable_airline_tabline = 1
"adding to vim-airline's statusline
let g:webdevicons_enable_airline_statusline = 1
根据注释很容易明白这些配置的作用,就是让这些插件支持特殊符号的显示。
装完着两个插件还没结束。你装了NerdTree支持了目录树显示,devicons支持显示图标和高亮,最后还需要插件来管理显示的规则,即什么文件或文件夹应该显示什么样的图标和颜色。有了上面的安装基础,我下面讲的简略一点。
vim-nerdtree-syntax-highlight插件
这个插件能根据文件类型显示不同的图标和颜色,大大美化了NerdTree显示效果。
vim-nerdtree-syntax-highlight下载安装
vimrc文件中添加Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'安装插件。
vim-nerdtree-syntax-highlight配置
""""""""""""""""""""""""""""""
"vim-nerdtree-syntax-highlight settings
""""""""""""""""""""""""""""""
"Highlight full name (not only icons). You need to add this if you don't have vim-devicons and want highlight.
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
"Highlight full name (not only icons). You need to add this if you don't have vim-devicons and want highlight.
let g:NERDTreeHighlightFolders = 1
"highlights the folder name
let g:NERDTreeHighlightFoldersFullName = 1
"you can add these colors to your .vimrc to help customizing
let s:brown = "905532"
let s:aqua = "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let srange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:Turquoise = "40E0D0"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = "FE405F"
let s:git_orange = "F54D27"
let s:gray = "808A87"
let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['o'] = s:gray " sets the color of o files to blue
let g:NERDTreeExtensionHighlightColor['h'] = s:blue " sets the color of h files to blue
let g:NERDTreeExtensionHighlightColor['c'] = s:green " sets the color of c files to blue
let g:NERDTreeExtensionHighlightColor['cpp'] = s:green " sets the color of cpp files to blue
let g:NERDTreeExtensionHighlightColor['c++'] = s:green " sets the color of c++ files to blue
这个插件有一些默认的颜色显示规则,但是支持自定义,你可以制定颜色值和哪些后缀的文件显示什么颜色,没有指定的就还是按默认规则,如果默认也没指定那就时白色。
*ps:这里有个坑。你如果看过github上作者给出的配置,你会发现作者在每句指定文件类型颜色的配置前都加了一句let g:NERDTreeExtensionHighlightColor = {},在Windows下这么配置只有最后一句指定文件类型的颜色能生效,后来我只保留了第一句就没问题了。
&ems;完了吗?还没有!我再推荐一个插件,对于编写github的人有帮助。这个插件能用图标在NerdTree里(vim-gitgutter是在编辑区里按行标识)标识出哪些目录下的哪些文件做了何种修改,比如增加、删除、新创建等。
nerdtree-git-plugin插件
和github上传的代码作对比,在NerdTree目录中用图标标识出文件和文件夹做了何种修改的插件。
nerdtree-git-plugin下载安装
在vimrc中添加Plugin 'Xuyuanp/nerdtree-git-plugin'安装此插件。
nerdtree-git-plugint配置
""""""""""""""""""""""""""""""
"nerdtree-git-plugin settings
""""""""""""""""""""""""""""""
let g:NERDTreeShowIgnoredStatus = 1
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
|