gvim配置

我的gvim配置文件,先存着,以后继续修改

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
  set nu!
  colorscheme torte
  syntax enable
  syntax on
  set showmatch
filetype plugin indent on
filetype indent on
  set nuw=1
set ruler
   set helplang=cn
    set encoding=utf-8
  set diffexpr=MyDiff()
  inoremap ( ()<ESC>i
  inoremap [ []<ESC>i
  inoremap { {}<ESC>i
  inoremap < <><ESC>i
  "Toggle Menu and Toolbar
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
        \set guioptions-=T <Bar>
        \set guioptions-=m <bar>
    \else <Bar>
        \set guioptions+=T <Bar>
        \set guioptions+=m <Bar>
    \endif<CR>
set guifont=Consolas:h14:cANSI
  set ai
set autoindent
set cindent
set shiftwidth=2
set sts=4
set tabstop=4
set expandtab
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
:inoremap ( ()<ESC>i

:inoremap ) <c-r>=ClosePair(')')<CR>

:inoremap { {}<ESC>i

:inoremap } <c-r>=ClosePair('}')<CR>

:inoremap [ []<ESC>i

:inoremap ] <c-r>=ClosePair(']')<CR>

":inoremap < <><ESC>i

":inoremap > <c-r>=ClosePair('>')<CR>

:inoremap " ""<ESC>i

:inoremap ' ''<ESC>i

:inoremap ` ``<ESC>i

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

  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
"定义CompileRun函数,用来调用编译和运行
func CompileRun()
exec "w"

if &filetype == 'c'
exec "!gcc  % -g -o %<.exe"

elseif &filetype == 'cpp'
exec "!g++  % -g -o %<.exe"

elseif &filetype == 'java'
exec "!javac %"
endif
endfunc
"结束定义ComplieRun

"定义Run函数
func Run()
if &filetype == 'c' || &filetype == 'cpp'
exec "!%<.exe"
elseif &filetype == 'java'
exec "!java %<"
endif
endfunc

"定义Debug函数,用来调试程序
func Debug()
exec "w"

if &filetype == 'c'
exec "!gcc % -g -o %<.exe"
exec "!gdb %<.exe"
elseif &filetype == 'cpp'
exec "!g++ % -g -o %<.exe"
exec "!gdb %<.exe"
elseif &filetype == 'java'
exec "!javac %"
exec "!jdb %<"
endif
endfunc

"设置程序的运行和调试的快捷键F5和Ctrl-F5"
map <F10> :call CompileRun()<CR>
map <F11> :call Run()<CR>
map <C-F5> :call Debug()<CR>

这两张图图片是我搜的关于配置成C++编译器的资源。。。先存着,目前还不能识别中文文件名字,而且文件夹不能有空格。

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-11 07:44:34

gvim配置的相关文章

Windows下将gvim配置为Python IDE[转]

正文 Windows下将gvim配置为Python IDE 回到顶部 1.准备工作 将下面的安装包或者文件下载好 1) Python 2.7  http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi 2) gvim8.0   http://www.vim.org/download.php 3) Exuberant Ctags http://ctags.sourceforge.net/ 4) Taglist  http://www.vim.o

gVim 配置方案 采用Vundle管理插件

在Linux下配置vim非常简单,尤其是采用Vundle来管理插件,使得一切用起来得心应手. Maple大神在github上公布了自己的vim配置方案,相当方便好用.详见 https://github.com/humiaozuzu/dot-vimrc 在Windows下也可以用Maple提供的方案,但是,要修改一些东西.并且,gVim可能需要做一些设置使得它好用一些,比如多标签页显示.隐藏工具栏. 下面,我将介绍我的gVim配置方案. Step 1. 安装gVim 下载gVim之后,安装,我使用

Gvim 配置 Vundle

这两天折腾了下vundle来管理vim的插件,老是不能让插件正常工作,一番探索之后终于解决了插件不能运行的问题. 我的Gvim是通过  sudo apt-get install vim-gtk   安装的 一直装插件但是我发现在Gvim下插件无法工作,于是打算放弃Gvim,但是无意间发现了插件在vim中却生效了,之后再次打开gvim,插件也同时生效了. 虽然不知道具体的内部原因,但是如果将.vimrc 和 .gvimrc 设置得一样,并且更改配置后现在vim中查看插件是否生效,如果生效的话,再打

【转】Gvim配置(Windows and Linux)for C++|gvim编译运行c/c++程序

转载地址:http://blog.csdn.net/onepiecehuiyu/article/details/8934366 http://mawenhao19930620.blog.163.com/blog/static/12857536120112991818242/ Windows下gvim配置文件_vimrc 首先配置g++到环境变量(配置g++,具体是将devc++的g++.exe的路径比如说:c:/deVC++/bin..加入到环境变量path里面) , 然后将下面的代码复制并保存

gvim 配置Pydiction

配置windows下gvim 的python关键字补全插件Pydiction 1.下载Pydiction 2.解压缩包,里面有after文件夹.complete-dict.pydiction.py 3.将after里面的文件拷贝到 gvim安装目录下的ftpplugin里面,将complete-dict.pydiction.py 拷贝到ftpplugin目录下 4.vimrc里面添加 filetype plugin onlet g:pydiction_location='C:\Program F

Gvim 配置

1.安装vundle管理插件 sudo apt-get install vim sudo apt-get install gvim sudo apt-get install git mkdir .vim cd .vim mkdir bundle cd bundle git clone https://github.com/gmarik/vundle.git 2.gvim配置文件 1 " =======================================================

gvim配置到命令行可以使用

下载安装gvim后,把gvim的安装目录添加到环境变量.

【转】gvim配置及相关插件安装

0.准备软件及插件.(a)gvim72.exe 地址ftp://ftp.vim.org/pub/vim/pc/gvim72.exe.(b)vimcdoc-1.7.0-setup.exe 地址http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-1.7.0-setup.exe?download(c)ec57w32.zip 地址http://prdownloads.sourceforge.net/ctags/ec57w32.zip(d)taglist_

Gvim配置备份

set nocompatible "设置关闭vi兼容模式set backspace=indent,eol,start "设置退格健正常使用set nu "显示行号set ts=4 "tab健占4个空格syntax on "语法高亮set ruler "设置光标显示set tabstop=4 "设置制表符宽度set softtabstop=4 set shiftwidth=4 "设置缩进的空格数为4个set ai "设