Windows gVim 多标签设置

windows下若是"双击"打开方式,则可以修改注册表

HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command将其键值

修改为:"D:\Program Files\Vim\vim73\gvim.exe" -p --remote-tab-silent "%1"

其中,“D:\Program Files\Vim”是我安装Vim的路径,注意根据实际修改。

而若是用鼠标右键中的"用vim编辑",先删掉注册表中的
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim,然后手工添加鼠标右键菜单
直接进入注册表,在HKEY_CLASSES_ROOT\*\shell下添加项"Edit with gVim",

再在项"Edit with gVim"下添加子项"command",在其右边窗口把其键值设定为上述键值


附上我的gVim配置文件

" windows下若是"双击"打开方式,则可以修改注册表
" HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command将其键值
" 修改为:"D:\Program Files\Vim\vim73\gvim.exe" -p --remote-tab-silent "%1"
" 而若是用鼠标右键中的"用vim编辑",先删掉注册表中的
" HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim,然后手工添加鼠标右键菜单
" 直接进入注册表,在HKEY_CLASSES_ROOT\*\shell下添加项"Edit with gVim",
" 再在项"Edit with gVim"下添加子项"command",在其右边窗口把其键值设定为上述键值
  

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

"解决consle输出乱码
language messages zh_CN.utf-8

"防止特殊符号无法正常显示
set ambiwidth=double

"配色方案
" colo pablo
colo desert

set nohlsearch "关闭高亮搜索

"gvim font setting
set guifont=Consolas:h13

if has("win32")
    au GUIEnter * simalt ~x
endif

set diffexpr=MyDiff()
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


" My configuration
set t_Co=256

"Sets how many lines of history VIM have to remember
set history=400

filetype on
"Enable filetype plugin
filetype indent on
filetype plugin on
filetype plugin indent on

"Set to auto read when a file is changed from the outside
set autoread

"Have the mouse enabled all the time:
set mouse=a

"Fast saving
nmap <leader>w :w!<cr>
nmap <leader>f :find<cr>


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax hl
syntax enable

autocmd BufEnter * :syntax sync fromstart

"设置终端编码为gvim内部编码encoding
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb2312,big5,euc-jp,euc-kr,latin1

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM userinterface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors - when moving vertical..
set so=7

"Turn on WiLd menu
set wildmenu

"Always show current position
set ruler

"The height of the command bar
set cmdheight=1

"Show line number
set nu

"Do not redraw, when running macros.. lazyredraw
set lz

"Change buffer - without saving
set hid

"Set backspace
set backspace=eol,start,indent

"Bbackspace and cursor keys wrap to
set whichwrap+=<,>,h,l

"Ignore case when searching
" set ignorecase
" set incsearch

"Set magic on
set magic

"No sound on errors.
set noerrorbells
set novisualbell
set t_vb=

"show matching bracets
set showmatch

"How many tenths of a second to blink
set mat=2

"Turn backup off
set nobackup
set nowb
set noswapfile


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Folding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable folding, I find it very useful
set nofen
set fdl=0


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=4
set tabstop=4

set smarttab
set lbr
set tw=500


""""""""""""""""""""""""""""""
" => Indent
""""""""""""""""""""""""""""""
"Auto indent
set ai

"Smart indent
set si

"C-style indeting
set cindent

"Wrap lines
set wrap
:map ff :tabnext<CR>
:map fd :tabnew .<CR>

"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>

" 标签页只显示文件名
function ShortTabLabel ()
    let bufnrlist = tabpagebuflist (v:lnum)
    let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1])
    let filename = fnamemodify (label, ':t')
    return filename
endfunction
set guitablabel=%{ShortTabLabel()}

" Brackets auto-complete
function g:autoCompleteCurlyBraces()
    if &filetype=="c" || &filetype=="cpp" || &filetype=="java"
        inoremap { {}<ESC>i<Enter><ESC>O
        inoremap ' ''<ESC>i
        inoremap " ""<ESC>i
    else
        inoremap { {}<ESC>i
    endif
endfunction
autocmd FileType * call g:autoCompleteCurlyBraces()
inoremap [ []<ESC>i
inoremap ( ()<ESC>i


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值