vim的配置文件
来源:互联网 发布:windows桌面软件 编辑:程序博客网 时间:2024/06/07 02:34
自己比较喜欢的一个vim的配置文件。
----------------_vimrc--------------------------
source$VIMRUNTIME/mswin.vim
behave mswin
imap <c-d> <c-o>dd
imap <cr> <cr><left><right>
map o o<left><right>
imap <c-]> {<cr>}<c-o>O<left><right>
noremap <f6> =a{
syn on
colo desert
filetype indent on
se ru nu ar sw=4 ts=4 noswf et sta nowrap ww=<,>,[,] gfn=Consolas:h12
autocmd BufEnter * lcd %:p:h
map <c-t> :tabnew<CR>
map <F2> :call SetTitle()<CR>Gkkk
func SetTitle()
let l = 0
let l = l + 1 | call setline(l, '/*')
let l = l + 1 | call setline(l, ' * Author: mybestwishes')
let l = l + 1 | call setline(l, ' * Created Time: '.strftime('%c'))
let l = l + 1 | call setline(l, ' * File Name: '.expand('%'))
let l = l + 1 | call setline(l, ' */')
let l = l + 1 | call setline(l, '#include <iostream>')
let l = l + 1 | call setline(l, '#include <cstdio>')
let l = l + 1 | call setline(l, '#include <cstdlib>')
let l = l + 1 | call setline(l, '#include <cstring>')
let l = l + 1 | call setline(l, '#include <cmath>')
let l = l + 1 | call setline(l, '#include <algorithm>')
let l = l + 1 | call setline(l, '#include <string>')
let l = l + 1 | call setline(l, '#include <vector>')
let l = l + 1 | call setline(l, '#include <stack>')
let l = l + 1 | call setline(l, '#include <queue>')
let l = l + 1 | call setline(l, '#include <set>')
let l = l + 1 | call setline(l, '#include <time.h>')
let l = l + 1 | call setline(l, 'using namespace std;')
let l = l + 1 | call setline(l, 'const int maxint = -1u>>1;')
let l = l + 1 | call setline(l, '')
let l = l + 1 | call setline(l, 'int main() {')
let l = l + 1 | call setline(l, ' return 0;')
let l = l + 1 | call setline(l, '}')
let l = l + 1 | call setline(l, '')
echo l
endfun
map<F4> :call AddComment()<cr>
func AddComment()
if matchstr(getline('.'), '[^ ]') == '/'
normal ^xx
else
normal ^i//
endif
endfunc
set printoptions=syntax:n,number:y,portrait:y
"设置vim根据编辑的文件自动切换工作目录
set autochdir
"设置水平滚动条
set guioptions+=b
"set encoding=utf-8
"set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1 " 如果你要打开的文件编码不在此列,那就添加进去"
set termencoding=utf-8
"F5编译当前的文件
map <F5> :call CompileGcc()<CR>
func! CompileGcc()
exec "w"
echo "file type:"&filetype
if &filetype == 'c'
exec "!gcc -o %:r.exe %:t"
" exec "! %:r.exe"
elseif &filetype == 'cpp'
exec "!g++ -I\"D:\\boost_1_50_0\" -I\"C:\\Python32\\include\" -o %:r.exe %:t"
" exec "! %:r.exe"
elseif &filetype == 'java'
exec "!javac %:t"
" exec "!java %:r"
elseif &filetype == 'bat'
exec ":! %:t"
elseif &filetype == 'python'
" elseif "%:r" == "py"
exec ":! %:t"
endif
endfunc
" 运行
map <F9> :call RunGcc()<CR><CR>
func! RunGcc()
if &filetype == 'c'
" exec "! %:r.exe"
if has('windows') " 判断操作系统
exec '!start cmd /c %:r.exe & pause'
elseif has('linux')
exec '!%:r.exe & pause'
endif
elseif &filetype == 'cpp'
" exec "! %:r.exe"
exec '!start cmd /c %:r.exe & pause'
elseif &filetype == 'java'
" exec "!java %:r"
exec '!start cmd /c java %:r & pause'
elseif &filetype == 'bat'
exec "w"
" exec ":! %:t"
exec '!start cmd /c %:t & pause'
elseif &filetype == 'python'
" elseif "%:r" == "py"
exec "w"
" exec ":! %:t"
exec '!start cmd /c %:t & pause'
endif
endfunc
- 我的VIM配置文件
- 我的VIM配置文件
- 我的vim配置文件
- 我的VIM配置文件
- 我的vim配置文件
- vim的配置文件
- 关于vim的配置文件
- 我的VIM配置文件
- 我的vim配置文件
- vim的配置文件
- 程序员的vim配置文件
- 我的vim配置文件
- 我的vim配置文件
- 一个vim的配置文件
- 自己的vim配置文件
- 我的VIM配置文件
- vim的配置文件
- vim的配置文件
- 机器学习中Lession1-回归(regression)、梯度下降(gradient descent)
- Could not change executable permissions on the application.
- mac 组
- PreparedStatement 在mysql下中文乱码解决方案
- javascript保留两位小数
- vim的配置文件
- JS判断Checkbox是否选中
- 登陆状态模板怎么控制返回地址(登录和退出)
- Sysfs文件系统
- ifconfig 手动设置网卡示例
- 冒泡算法的优化
- 线性同余方程及其特殊情况的求解法
- vim 调整窗口高度和宽度
- leetcode 33: Plus One