首页 > 其他分享 >我的GVIM配置文件

我的GVIM配置文件

时间:2022-10-17 23:38:17浏览次数:82  
标签:set 配置文件 endfunction GVIM let endif call suren


以下是我自己的vim配置文件。个人建议,还是使用完整的命令比较好,这样有助于理解记忆,尤其对于初次接触的人来说更重要。




"显示行号,取消显示行号为nonumber,诸多进行相反设置都是加前缀no即可


"设置用于显示行号的宽度



"在下方显示标尺



set encoding=utf8



"搜索后,高亮


"搜索时,没有回车就高亮


"搜索时,忽略大小写



set showmatch



"隐藏菜单栏



"自动将当前目录切换为编辑文件所在的目录



"高亮当前列


"高亮当前行



"窗口打开后自动最大化,这是对于gvim有效的


autocmd guienter * simalt ~x



set nowrap"不自动换行



set autoread



"取消对vim、的兼容,这样可以使用到vim的一些特性



"显示右侧的滚动条


"显示底部的滚动条



set scrolloff=3 "使光标始终和上下边缘相距3行



set smartindent "回车后,根据上一行自动缩进


set smarttab



set backup "设置备份


set nobackup



syntax on "打开语法高亮



set foldenable


set foldmarker={,}


set foldmethod=marker


nnoremap <space> @=((foldclosed(line('.'))<0)?'zc':'zo')<CR>


set foldopen+=search


set foldopen+=undo


set foldlevel=1


set foldcolumn=4


filetype plugin on


highlight normal guifg=#008000 guibg=#000000


"set visualbell t_vb=



"以下是对一些经常用到的命令映射的快捷键


nmap <silent> <F1> :w<cr>


<silent>  <F2> :q<cr>


<silent>  <F3> :x<cr>



set readonly 设置只读


set nomodifiable 设置为不可修改模式


digraphs 显示编码表


changes 打开更改列表


gf 打开以当前字符的文件


ga 显示当前光标下单个字的ascii,十进制,十六进制……


:browse e 打开文件选择框


tabe file 在新的tab中打开文件file


<C-A>,<C-X> 增加,减少当前光标下的数字


:bn 跳转到下一个buffer
:bp  跳转到前一个buffer
:wn 保存当前buffer并跳转到下一个buffer (超有用)
:wp 保存当前buffer并跳转到前一个buffer
:bd 把当前文件从buffer移出 (超有用)



  • 配置文件[codesyntax lang="php" lines="normal"]scriptencoding=utf-8 set number set incsearch set hlsearch set autoindent "set smartindent set autochdir set ignorecase "set textwidth=80 set colorcolumn=+1 set tabstop=4 set shiftwidth=4 set backspace=indent,start,eol set showmatch set matchtime=1 set ruler set foldmethod=syntax "set foldmethod=indent set foldlevel=0 set encoding=utf-8 set termencoding=utf-8 set langmenu=zh_CN.utf-8 language message zh_CN.utf-8 "set titlestring=中文 set nolist set nocursorline set nocursorcolumn syntax on filetype on map <special> <silent> <F1> :call Quit()<CR>" ---Quit map <special> <silent> <F2> :call ContentReload()<CR>" ---Quit map <special> <silent> <F3> :call OpenShell()<CR>" ---Shell map <special> <silent> <F4> :call OpenTaskMgr()<CR>" ---TaskMgr map <F5> :call Test()<CR>" ---Test map <special> <silent> <F6> :call ReloadFile()<CR>" ---ReloadFile map <special> <silent> <F10> :call ReloadRc()<CR>" ---Reload RcFile map <special> <silent> <F11> :call ToggleFullScreen()<CR>" ---FullScreen map <special> <silent> <F12> :call EditRc()<CR>" ---Edit RcFile if has("gui") map <special> <silent> <C-K> :call RestoreWin()<CR>" ---Restore map <special> <silent> <C-M> :call MaxWin()<CR>" ---Maximize map <special> <silent> <C-N> :call MinWin()<CR>" ---Minimize endif map <special> <silent> <C-S> :call Save()<CR>" ---Save map <special> <silent> <C-Tab> :call SwitchWin()<CR>" ---SwitchWin imap <special> <silent> <C-S> <ESC>:write<CR>a imap <special> <silent> <C-Tab> <ESC><C-W><C-W>a function! EditRc() if "" == expand("%:p") :edit ~/.vimrc elseif ".vimrc" != expand("%:t") :split ~/.vimrc endif endfunction function! Test() let s:buf_name = "suren" if !bufexists(s:buf_name) || bufwinnr(s:buf_name) == -1 25vsplit suren set modifiable set buftype=nofile redir @a silent map redir END silent execute "normal " . '"ap' silent :%substitute/^\n// silent :global!/\s*:call.*---/delete silent :%substitute/\s*:call.*---/\t/ silent :%substitute/^\s*// silent :nohlsearch sort set nowrap set colorcolumn="" set readonly set nomodifiable endif endfunction function! SubString(str, begin, len) let str=a:str let begin=a:begin let len=a:len let length=begin+len let rv="" while begin < length let rv=rv.str[begin] let begin=begin+1 endwhile return rv endfunction function! IndexOf(str, sub) let str=a:str let sub=a:sub let subLen=strlen(sub) let len=strlen(str) let len=len-subLen+1 let i=0 while i < len if SubString(str, i, subLen) == sub return i endif let i=i+1 endwhile return -1 endfunction function! LastIndexOf(str, sub) let str=a:str let sub=a:sub let len=strlen(str) let subLen=strlen(sub) let i=len-subLen while i >= 0 if SubString(str, i,subLen) == sub return i endif let i=i-1 endwhile return -1 endfunction function! SortFunc(x, y) let s:index = 0 let s:x_list = split(a:x) let s:y_list = split(a:y) let s:x_len = len(s:x_list) let s:y_len = len(s:y_list) let s:x_is_num = 0 let s:y_is_num = 0 if s:x_list == s:y_list return 0 elseif s:x_len == 0 return -1 elseif s:y_len == 0 return 1 endif for i in s:x_list let s:x = i let s:y = s:y_list[s:index] let s:x_is_num = s:x + 0 let s:y_is_num = s:y + 0 if s:x_is_num != 0 let s:x = s:x_is_num endif if s:y_is_num != 0 let s:y = s:y_is_num endif if s:x > s:y return 1 endif if s:x < s:y return -1 endif let s:index = s:index + 1 if s:index >= s:y_len break endif endfor return 0 endfunction function! Sort(from, to) let s:begin = a:from + 0 let s:end = a:to + 0 if s:begin <= 0 let s:begin = 1 endif if s:end <= 0 let s:end = 1 endif if s:begin > line("$") || s:end > line("$") return endif let s:content = getline(s:begin, s:end) let s:content = sort(s:content, "SortFunc") call DeleteLine(s:begin, s:end) call append(s:begin - 1, s:content) $delete endfunction function! DeleteLine(from, to) let s:begin = a:from + 0 let s:end = a:to + 0 if s:begin < 0 || s:begin > line("$") return endif if s:end < 0 || s:end > line("$") return endif execute "normal " . s:begin . "gg" execute ":" . s:begin . "," . s:end . "delete" endfunction function! Quit() silent :quit endfunction function! ContentReload() silent :e execute "normal G" endfunction function! OpenShell() if has("gui_win32") silent execute "!start cmd" endif endfunction function! OpenTaskMgr() if has("gui_win32") silent execute "!start taskmgr" endif endfunction if !exists("*ReloadRc") function! ReloadRc() silent :source ~/.vimrc endfunction endif if !exists("*ReloadFile") function! ReloadFile() silent :e execute "normal " . s:begin . "G" endfunction endif function! SwapMouse() let s:suren_lib = findfile("suren.dll", &runtimepath) if s:suren_lib != "" call libcall(s:suren_lib, "SwapMouse", "") endif endfunction function! ToggleFullScreen() let s:suren_lib_str = "suren.dll" let s:suren_lib = findfile(s:suren_lib_str, &runtimepath) if !exists("s:suren_fullscreen") let s:suren_fullscreen = 0 endif if s:suren_lib != "" let s:suren_lib = s:suren_lib_str if s:suren_fullscreen == 0 echo s:suren_lib let s:suren_win_info = libcall(s:suren_lib, "FullScreen", "") if len(split(s:suren_win_info)) == 4 let s:suren_win_last_left = split(s:suren_win_info)[0] + 0 let s:suren_win_last_top = split(s:suren_win_info)[1] + 0 let s:suren_win_last_right = split(s:suren_win_info)[2] + 0 let s:suren_win_last_bottom = split(s:suren_win_info)[3] + 0 set guioptions-=m set guioptions-=T let s:suren_fullscreen = 1 endif else call libcall(s:suren_lib, "FullScreen", "") call libcall(s:suren_lib, "SetPosX", s:suren_win_last_left) call libcall(s:suren_lib, "SetPosY", s:suren_win_last_top) call libcall(s:suren_lib, "SetWinWidth", \ s:suren_win_last_right - s:suren_win_last_left) call libcall(s:suren_lib, "SetWinHeight", \ s:suren_win_last_bottom - s:suren_win_last_top) set guioptions+=m set guioptions+=T let s:suren_fullscreen = 0 endif else echo "can't found " . s:suren_lib_str endif endfunction function! MaxWin() simalt ~x endfunction function! MinWin() simalt ~n endfunction function! RestoreWin() simalt ~r endfunction function! SwitchWin() execute "normal \<C-W>\<C-W>" endfunction function! Save() let s:path = expand("%:p") if s:path == "" if has("gui") execute ":browse confirm saveas" else let s:path = input("saveas:") execute ":write " . s:path endif else execute ":write" endif endfunction[/codesyntax]



标签:set,配置文件,endfunction,GVIM,let,endif,call,suren
From: https://blog.51cto.com/suren/5764663

相关文章

  • 使用Etcd+Confd实现Nginx配置文件自动管理
    ​安装etcd#yum安装yuminstalletcd-y#更新https://github.com/coreos/etcd/releases替换掉etcd和etcdctlsed-i's/localhost/0.0.0.0/g'/etc/etcd/etcd.confsystemc......
  • log4j配置文件详解
    【参考文章】:Log4j2中RollingFile的文件滚动更新机制1.配置文件示例<?xmlversion="1.0"encoding="UTF-8"?><!--ALL<TRACE<DEBUG<INFO<WARN<ERROR<FATA......
  • NGINX配置文件,REWRITE,IF
    NGINX配置文件,REWRITE,IF目录NGINX配置文件,REWRITE,IFREWRITIF基于浏览器实现分离案例防盗链案例nginx配置文件,rewrite,if[rewrit]if[基于浏览器实现分离案例][防盗......
  • nginx配置文件rewrite和if
    nginx配置文件rewrite和ifrewrite语法:rewriteregexreplacementflag;,如:rewrite^/images/(.*\.jpg)$/imgs/$1break;此处的$1用于引用(.*.jpg)匹配到的内容,又如:re......
  • nginx配置文件rewrite和if
    nginx配置文件rewrite和ifrewrite语法:rewriteregexreplacementflag;,如:rewrite^/images/(.*\.jpg)$/imgs/$1break;此处的$1用于引用(.*.jpg)匹配到的内容,又如:re......
  • Spring Boot 配置 jar 包外面的 Properties 配置文件
    一、概述Properties文件是我们可以用来存储项目特定信息的常用方法。理想情况下,我们应该将其保留在jar包之外,以便能够根据需要对配置进行更改。在这个教程中,我们将研......
  • SSM框架各配置文件模板
    SpringMVC配置文件springmvc-config.xml<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="htt......
  • 使用viper读取配置文件
    配置文件config.ymlmysql:type:mysqldsn:"user:pass@tcp(localhost:30306)/db_name?charset=utf8&parseTime=True&loc=Local"maxopen:100maxidle:10ma......
  • Linux中/etc/passwd配置文件解析
    /etc/passwd文件中的内容如下:文件内容非常规律,每行记录对应一个用户。每行用户信息都以":"作为分隔符,划分为7个字段。各个字段含义如下:用户名:方便用户记忆的代号(如r......
  • 内置认证类、权限类、频率类;过滤类的其他使用;全局异常处理;接口文档;django配置文件
    目录内置认证类、权限类、频率类一、内置认证类二、内置权限类三、内置频率类过滤类的其他使用一、内置过滤类全局异常处理一、简介二、自己写一个函数捕获异常接口文档一......