代码拉取完成,页面将自动刷新
同步操作将从 会PS的小码农/我的vimrc配置 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nocompatible
filetype off
set number " 显示行号
syntax on " 高亮
"高亮搜索
set hlsearch
"设置折叠方式
"set flodmethod=indent
"高亮光标所在行列
set cursorcolumn
set cursorline
" 自定义高亮颜色
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
" vim使用自动对起,也就是把当前行的对起格式应用到下一行
set autoindent
" 第二行,依据上面的对起格式,智能的选择对起方式,对于类似C语言编
set smartindent
"nnore 非递归映射
"空格控制折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
"先映射逗号为 leader
let mapleader=','
let g:mapleader=','
"再映射逗号 +w 未保存
nnoremap <leader>w :w<cr>
inoremap <leader>w <Esc>:w<cr>
"vib 实现选中空格到空格
"nnoremap vib f<space>,,lv;h
"vib 实现选中html 属性
nnoremap vib f<space>,lvf";
"vis 实现选中php变量连字符
nnoremap vis bbhf$ve
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
"下面是插件
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"插件管理插件Vundle
Plugin 'VundleVim/Vundle.vim'
"目录树插件
Plugin 'preservim/nerdtree'
""将F2设置为开关NERDTree的快捷键
map <f2> :NERDTreeToggle<cr>
" 显示行号
let NERDTreeShowLineNumbers=1
" 防止出现 ^G 问题
let g:NERDTreeNodeDelimiter = "\u00a0"
" 是否显示隐藏文件
let NERDTreeShowHidden=1
"vim git操作插件
Plugin 'tpope/vim-fugitive'
call vundle#end()
"自动保存最后修改时间
function SetLastModifiedTimes()
let line = getline(7)
let newtime = "* @LastEditTime: ".strftime("%Y年%m月%d日 %H时%I分%S秒")
let repl = substitute(line,".*$",newtime,"g")
let res = search("@LastEditTime","w")
if res
call setline(7,repl)
endif
endfunction
autocmd BufWrite *.php call SetLastModifiedTimes()
" 当新建 .h .c .hpp .cpp .mk .sh等文件时自动调用SetTitle 函数
autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh,*.php,*.html exec ":call SetTitle()"
" 加入注释
"加入c cpp h hpp ch mk php 等文件注释
func SetComment()
call setline(1,"/*================================================================")
call append(line("."), "* Copyright (C) ".strftime("%Y")." EdisonLiu_ All rights reserved.")
call append(line(".")+1, "* ")
call append(line(".")+2, "* @Author: 偻儸小卒[EdisonLiu_]")
call append(line(".")+3, "* @Date:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call append(line(".")+4, "* @LastEditTime:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call append(line(".")+5, "* @Description:")
call append(line(".")+6, "*")
call append(line(".")+7, "================================================================*/")
call append(line(".")+8, "")
call append(line(".")+9, "")
endfunc
"加入html注释
func SetHtmlComment()
call setline(1,"<!--")
call append(line("."), " Copyright (C) ".strftime("%Y")." EdisonLiu_ All rights reserved.")
call append(line(".")+1, " ")
call append(line(".")+2, " @Author: 偻儸小卒[EdisonLiu_] 747357766@qq.com")
call append(line(".")+3, " @Date:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call append(line(".")+4, " @LastEditTime:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call append(line(".")+5, " @Description:")
call append(line(".")+6, "")
call append(line(".")+7, "-->")
call append(line(".")+8, "")
call append(line(".")+9, "")
endfunc
" 加入sh,Makefile注释
func SetComment_sh()
call setline(3, "#================================================================")
call setline(4, "# Copyright (C) ".strftime("%Y")." EdisonLiu_ All rights reserved.")
call setline(5, "# ")
call setline(6, "# @Author: 偻儸小卒[EdisonLiu_] 747357766@qq.com")
call setline(7, "# @Date:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call setline(8, "# @LastEditTime:".strftime("%Y年%m月%d日 %H时%I分%S秒"))
call setline(9, "# @Description:")
call setline(10, "#")
call setline(11, "#================================================================")
call setline(12, "")
call setline(13, "")
endfunc
" 定义函数SetTitle,自动插入文件头
func SetTitle()
if &filetype == 'make'
call setline(1,"")
call setline(2,"")
call SetComment_sh()
elseif &filetype == 'sh'
call setline(1,"#!/system/bin/sh")
call setline(2,"")
call SetComment_sh()
elseif &filetype == 'html'
call setline(2,"")
call SetHtmlComment()
else
call SetComment()
if expand("%:e") == 'hpp'
call append(line(".")+10, "#ifndef _".toupper(expand("%:t:r"))."_H")
call append(line(".")+11, "#define _".toupper(expand("%:t:r"))."_H")
call append(line(".")+12, "#ifdef __cplusplus")
call append(line(".")+13, "extern \"C\"")
call append(line(".")+14, "{")
call append(line(".")+15, "#endif")
call append(line(".")+16, "")
call append(line(".")+17, "#ifdef __cplusplus")
call append(line(".")+18, "}")
call append(line(".")+19, "#endif")
call append(line(".")+20, "#endif //".toupper(expand("%:t:r"))."_H")
elseif expand("%:e") == 'h'
call append(line(".")+10, "#pragma once")
elseif &filetype == 'c'
call append(line(".")+10,"#include \"".expand("%:t:r").".h\"")
elseif &filetype == 'cpp'
call append(line(".")+10, "#include \"".expand("%:t:r").".h\"")
elseif expand("%:e") == 'php'
call setline(1,"<?php ")
call append(line("."),"/*================================================================")
call append(line(".")+11, " ?>")
endif
endif
endfunc
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。