【问题标题】:Vim status line won't immediately appear unless i press a key?除非我按下一个键,否则 Vim 状态行不会立即出现?
【发布时间】:2018-03-10 10:12:21
【问题描述】:

大约 3 周前我刚搬到 Vim。我知道这是小问题,但我发现它以某种方式惹恼了我。每当我打开 vim 时,状态行(或状态栏?)不会立即出现(+ 光标始终位于屏幕的最后一行),除非我按下一个键(任意键)。这是我的 vimrc 供参考:

set nocompatible
" Pathogen
filetype off
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
filetype plugin indent on

" Color Schemes
set t_Co=256
syntax on
set background=dark
colorscheme ir_black

" Misc
set history=200
set backspace=indent,eol,start
set mouse=n
set lazyredraw
runtime macros/matchit.vim

" Escape Timeout
set notimeout
set ttimeout
set ttimeoutlen=10

" Backup & Undo
set noswapfile
set backup
set undofile
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//

" Scroll
set scrolloff=3

" Status Bar
set showmode
set showcmd
set ruler
set laststatus=2
set statusline=

" Tabs & Spaces
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set shiftround
set smarttab

" Text
set encoding=utf-8
set nowrap
set autoindent
set textwidth=80
set formatoptions=qrn1j

" Splitting
set splitbelow
set splitright

" Buffer
set hidden

" Wildmenu
set wildmenu
set wildmode=list:longest,full
set wildignore+=**/vendor/**
set wildignore+=**/node_modules/**

" Auto-completion
set complete=.,i,w,b,u,t
set omnifunc=
set completeopt=longest,menuone,preview

" Searching + Regex
set ignorecase
set smartcase
set hlsearch
set incsearch
set gdefault
highlight Search cterm=underline
nnoremap / /\v
vnoremap / /\v
nnoremap <space> :noh<cr>

" Mapping
let mapleader=","
noremap \ ,
inoremap jk <esc>

noremap L g_
noremap H ^

" Window Resize
nnoremap <silent> <up> <c-w>+
nnoremap <silent> <down> <c-w>-
nnoremap <silent> <left> <c-w><
nnoremap <silent> <right> <c-w>>

" Disable Arrow Keys
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>

" Move by Display Line
noremap j gj
noremap k gk

" Toggles
nnoremap <leader>wl :set wrap!<cr>
nnoremap <leader>n :setlocal number!<cr>
nnoremap <leader>l :set list!<cr>

" Wipe Whitespace
nnoremap <leader>ww mz:%s/\s\+$//<cr>:let @/=''<cr>`z

" Easy Access to Active File Directory
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'

" Toggles
nnoremap <silent> <leader>n :set number!<cr>
nnoremap <silent> <leader>wl :set wrap!<cr>

" Buffer Navigation
nnoremap <silent> [b :bprevious<cr>
nnoremap <silent> ]b :bnext<cr>
nnoremap <silent> [B :bfirst<cr>
nnoremap <silent> ]B :blat<cr>

" Split Navigation
nnoremap <c-h> <c-w><c-h>
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>

" Netrw
let g:netrw_banner=0

" Grep Ag
if executable("ag")
    set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column
    set grepformat=%f:%l:%c:%m,%f:%l:%m
endif

有什么问题吗?

编辑:这是我的 vim 发生的屏幕截图。 before i press a key

【问题讨论】:

  • 这是您的全部配置,还是您还使用任何插件?把:redraw!放在vimrc的底部有帮助吗?
  • @IngoKarkat 现在我只使用 abolish、surround 和 commentary,我已经在问题发生前一周使用它们。确实重绘了几次,但没有改变。
  • 嗯,我怀疑像 vim-airline 这样的状态栏插件。这是屏幕内容关闭的唯一场合吗?您使用什么终端,$TERM 设置是否正确?或者,换一种说法,GVIM 中存在同样的问题?
  • @IngoKarkat 不,我正计划使用 lightline。我在 babun 中使用 vim。 $TERM 设置为 xterm-256color。嗯,不是 gvim 的粉丝。
  • 好吧,如果你只在 babun 中看到这个,而不是在本地 Cygwin / Windows 终端中,我想这是 babun 的终端仿真的问题,你应该在那里报告。我认为您的 Vim 设置没有问题。

标签: vim text-editor statusline


【解决方案1】:

从我的 vimrc 中删除 lazyredraw 也为我解决了这个问题。

这是在 Ubuntu 16.04 上使用 Vim 7.4。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-17
    • 2018-06-13
    • 2022-07-19
    • 1970-01-01
    • 2017-07-25
    • 2019-05-16
    • 1970-01-01
    相关资源
    最近更新 更多