【发布时间】:2014-09-17 13:46:17
【问题描述】:
我最近决定迁移到 Gvim,并注意到我的一些特定于 gui 的设置很糟糕。
我已经定义了一个自动命令,以便在写入 $MYVIMRC 时重新获取它,并且在重新获取它时(这不会在初始启动时发生),底部会出现一个空栏。我相信它是用来包含水平滚动条的栏。
当我尝试使用
移除滚动条时:set guioptions-=b
什么都没有发生。但是,如果我先添加然后删除它,
:set guioptions+=b
:set guioptions-=b
它消失了。
我认为这可能与我定义guioptions 的方式和时间有关。这是我的 .vimrc 的相关部分:
set guioptions-=m " GUI: Disable Menu
set guioptions-=r " GUI: Disable right scrollbar
set guioptions-=T " GUI: Disable Toolbar
我试图把它放在这样的augroup 中
augroup GuiWidgets
au!
set guioptions-=m " GUI: Disable Menu
set guioptions-=r " GUI: Disable right scrollbar
set guioptions-=T " GUI: Disable Toolbar
augroup end
但这并没有什么不同。
这个问题的根源是什么?
编辑 1 - 添加 .vimrc
let mapleader = ','
inoremap jj <Esc>
set nocompatible
"********************************
" PLUGINS
"********************************
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'benmills/vimux'
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'kana/vim-textobj-entire'
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'Raimondi/delimitMate'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'godlygeek/tabular'
NeoBundle 'surround.vim'
NeoBundle 'christoomey/vim-tmux-navigator'
NeoBundle 'Shougo/vimproc.vim'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/vimshell.vim'
NeoBundle 'c.vim'
call neobundle#end()
filetype plugin indent on
NeoBundleCheck
"******************************
" PLUGIN SETTINGS
"******************************
nnoremap <C-p> :Unite file_rec/async:! -silent -start-insert -auto-resize<CR>
"******************************
" PLUGIN MAPPINGS
"******************************
map <Space> <Plug>(easymotion-prefix)
cnoreabbrev bi Unite neobundle/install
cnoreabbrev bu Unite neobundle/update
cnoreabbrev bc NeoBundleClean
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
nmap <Leader>a# :Tabularize /#<CR>
vmap <Leader>a# :Tabularize /#<CR>
"******************************
" GENERAL SETTINGS
"******************************
set t_Co=256
let g:molokai_original=0
colorscheme molokai
filetype plugin indent on
syntax on
set complete-=t
set gfn=Source\ Code\ Pro\ 10
set encoding=utf-8
set number
set lazyredraw
set completeopt-=preview
set ttyfast
set backspace=indent,eol,start
set hidden
set showmatch
set wildmode=longest:list,full
set wildmenu
set shortmess+=I
set showcmd
set showmode
set clipboard=unnamed
set history=50
set nrformats=
set autoread
set ruler
set laststatus=2
set scrolloff=8
set visualbell
set splitright
set smarttab
set autoindent
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set ignorecase smartcase
set gdefault
set incsearch
set hlsearch
set nobackup
set noswapfile
set ttimeoutlen=50
set relativenumber
set cursorline
set cc=80
set guioptions-=m
set guioptions-=r
set guioptions-=T
"set guioptions=
match ErrorMsg '\%>80v.\+'
"***************************
" GENERAL MAPPINGS
"***************************
map cn <Esc>:cn<CR>
map cp <Esc>:cp<CR>
nmap <CR> o<Esc>k
inoremap {<CR> {<CR>}<C-o>O
nnoremap <leader>v :e $MYVIMRC<CR>
nnoremap <leader>h :let @/ = ""<CR>
nnoremap n nzz
nnoremap <silent> <leader>; :call setline('.', getline('.').';')<CR>
nnoremap <leader>q <C-w>q<CR>
nnoremap <leader>w :w<CR>
nnoremap <silent> <leader>d :bp\|bd #<CR>
nnoremap <leader>c :cd %:p:h<CR>
cnoreabbrev ci( %ci(
cnoreabbrev ci) %ci)
cnoreabbrev ci[ %ci[
cnoreabbrev ci[ %ci]
cnoreabbrev ci{ %ci{
cnoreabbrev ci} %ci}
"***************************
" AUTOCOMMANDS
"***************************
" Auto-source .vimrc
augroup Vimrc
au!
au bufwritepost .vimrc source $MYVIMRC
augroup end
" Filetype-specific settings
augroup Filetypes
au!
"au FileType c nmap <leader>r :SCCompileRun<CR>
au FileType c nmap <leader>r :make\|!./%:r<CR>
au FileType c setlocal sw=2 sts=2
au FileType ruby nmap <leader>r :call RunByFiletype("ruby")<CR>
augroup end
编辑 2 - 添加图片
(抱歉,尺寸过小)
启动时
获取 .vimrc 后(出现空滚动条容器)
运行后 :set guioptions+=b (水平滚动条添加到容器中)
运行后 :set guioptions-=b (水平容器消失)
运行后 :set gfn=Source\ Code\ Pro\ 10 (栏再次出现)
【问题讨论】:
-
我已将问题追溯到
set gfn=<fontname>行。还不知道为什么会这样。 -
你能在
+=b之后、-=b之后和gfn=<fontname>之后添加边缘图像吗? -
在请求命令后添加了条形图!
-
灰色阴影不太匹配。我是新手,但如果你只是用鼠标调整窗口高度会发生什么?浅灰色区域是否仍然存在字体高度和窗口大小的倍数之间的差异?
-
试着弄乱字体大小,看看能不能让空白的灰色区域消失并重新出现。我怀疑它不是一个空的滚动条,而只是带有丑陋头部的窗口边缘。你在Linux上吗?哪个发行版和 DE?
标签: vim