首页 > 系统相关 >windows下的gvim配置

windows下的gvim配置

时间:2022-10-11 12:32:45浏览次数:59  
标签:0let windows gvim 配置 vim set 1let Tlist php

首要任务是下载安装Gvim7.3 。
安装完后,gvim菜单中文出现乱码,在_vimrcset文件中增加:

" 配置多语言环境,解决中文乱码问题
if has("multi_byte")
" UTF-8 编码
set encoding=utf-8
set termencoding=utf-8
set formatoptions+=mM
set fencs=utf-8,gbk
if v:lang =~? '^/(zh/)/|/(ja/)/|/(ko/)'
set ambiwidth=double
endif
if has("win32")
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
endif
else
echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte"
endif3、设置语法高亮

编辑安装目录下的_vimrc文件(例如:我的在D:\Program Files\Vim)
加入以下内容:
set nu!
colorscheme desert
syntax enable
syntax on

用 taglist 实现代码导航

解决了目录和文件导航问题,我们还要为代码之间的跳转提供辅助手段,taglist 就是这样一个插件。taglist 可以列出已打开文件中定义的类、函数、常量,甚至变量。


下载地址:
​​http://www.vim.org/scripts/script.php?script_id=273​​

下载文件:taglist_45.zip


压缩包需要完整解压缩到 $VIMvimfiles 目录,并且用 :helptags $VIMvimfilesdoc 命令索引 taglist 插件的帮助文档。taglist 插件需要依赖 ctags 程序才能工作。目前常用的 ctags 版本是 Exuberant Ctags。


下载地址:
​​http://ctags.sourceforge.net/​​

下载文件:ec57w32.zip


只需要把压缩包中的 ctags.exe 复制到 $VIMvim72 目录中即可。ctags.exe 应该和 gvim.exe 在一个目录。


最后在 _vimrc 添加下列内容,设置好 taglist 插件:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugin configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" taglistlet Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Auto_Highlight_Tag = 1
let Tlist_Auto_Open = 1
let Tlist_Auto_Update = 1
let Tlist_Close_On_Select = 0
let Tlist_Compact_Format = 0
let Tlist_Display_Prototype = 0
let Tlist_Display_Tag_Scope = 1
let Tlist_Enable_Fold_Column = 0
let Tlist_Exit_OnlyWindow = 0
let Tlist_File_Fold_Auto_Close = 0
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Inc_Winwidth = 0
let Tlist_Max_Submenu_Items = 1
let Tlist_Max_Tag_Length = 30
let Tlist_Process_File_Always = 0
let Tlist_Show_Menu = 0
let Tlist_Show_One_File = 0
let Tlist_Sort_Type = "order"
let Tlist_Use_Horiz_Window = 0
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let tlist_php_settings = 'php;c:class;i:interfaces;d:constant;f:function'gvim代码自动提示 插件
插件名:AutoComplPop
下载地址:​​http://www.vim.org/scripts/script.php?script_id=1879​​
gvim 代码模板补全 插件
插件名:snipMate
下载地址:​​http://www.vim.org/scripts/script.php?script_id=2540​​

通过vim字典补全,实现php函数名自动补全 字典到网上搜索下载
将下面内容加入.vimrc文件中即可
au FileType php call AddPHPFuncList()
function AddPHPFuncList()
set dictionary-=$VIM/vimfiles/extra/php_funclist.txt dictionary+=$VIM/vimfiles/extra/php_funclist.txt
set complete-=k complete+=k
endfunction
使用方式(关键字+<tab>)

"代码自动补全 (按快捷键Ctrl+X+O)
set autoindent
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascrīpt set omnifunc=javascrīptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

关键字补全 (快捷键 Ctrl+P)

​​vim中实现括号和引号自动补全​​
将下面内容加入.vimrc文件中即可

inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {<CR>}<Esc>O
autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair('>')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap } <c-r>=CloseBracket()<CR>
inoremap " <c-r>=QuoteDelim('"')<CR>
inoremap ' <c-r>=QuoteDelim("'")<CR>

function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf

function CloseBracket()
if match(getline(line('.') + 1), '\s*}') < 0
return "\<CR>}"
else
return "\<Esc>j0f}a"
endif
endf

function QuoteDelim(char)
let line = getline('.')
let col = col('.')
if line[col - 2] == "\\"
"Inserting a quoted quotation mark into the string
return a:char
elseif line[col - 1] == a:char
"Escaping out of the string
return "\<Right>"
else
"Starting a string
return a:char.a:char."\<Esc>i"
endif
endf

标签:0let,windows,gvim,配置,vim,set,1let,Tlist,php
From: https://blog.51cto.com/u_14934686/5746129

相关文章

  • springboot2中多环境配置@@ 无法解析maven中的设置
    Maven(pom中设置环境)SpringBoot(yml中设置多环境)都具备对环境的开发控制maven优先度高于springboot,springboot基于maven的坐标配置需要在pom.xml中配置多环境开......
  • Spread for Windows Forms高级主题(8)---通过暂停布局提高性能
    一种改善控件性能的方法是,当需要对许多单元格进行变动时,可以先保持或挂起重画,直到所有的变动都完成时再进行。通过在对单元格修改和重算时保持重画(挂起布......
  • Windows 7样式地址栏(Address Bar)控件实现
    介绍从Vista开始,地址栏就有了很大的改变,不知道大家有什么感觉,笔者觉得很方便,同时又兼容之前的功能,是个很不错的创新。不过,微软并不打算把这一很酷的功能......
  • vmware workstation NAT模式配置
    一.配置虚拟网络编辑器1.打开虚拟网络编辑器2.点击右下角更改设置 3.选择NAT模式点击选中NAT模式的虚拟网络,默认为VMnet8(可调整),可设置NAT模式的子网IP和掩码 ......
  • windows系统下安装gym运行atari游戏报错:ale_interface/ale_c.dll OSError
    安装gym的atari支持:pip install gym[atari]  为gym下的atari环境下载游戏镜像ROMs文件:​需要注意的是由于gym的版本更新现在的gym依赖的atari库已经不叫做atari-py了,......
  • nginx配置前台支持gzip压缩
    很多人都认为webpack的compression-webpack-plugin插件压缩后的gzip文件可以起到优化发布后请求包大小这个作用,但是实际上这只是一部分,你会发现请求的时候并没有请求到g......
  • Windows技巧
    win11添加开机启动项win+r输入:shell:startup,会打开一个目录,把程序图标放进去即可。......
  • JDK的安装和配置
    目录下载jdk配置环境测试安装下载jdkJDk安装包:官网:https://www.oracle.com/cn/java/technologies/downloads/网盘(速度更快):https://www.123pan.com/s/aiv9-hkrG(适合W......
  • 魔改xxl-job,彻底告别手动配置任务!
    原创:微信公众号码农参上,欢迎分享,转载请保留出处。哈喽大家好啊,我是Hydra。xxl-job是一款非常优秀的任务调度中间件,轻量级、使用简单、支持分布式等优点,让它广泛应用在......
  • 134 . Eclipse 简单配置和使用
    134.Eclipse简单配置和使用常用视图Packageexplorer包视图Navigator导航视图Outline结构视图Consoles控制台视图字符集设置Window-Preferen......