我是一个 vim 初学者,我有点困惑。看起来 Vim 比 Geany 慢。这是一个非常明显的区别。当我在 Geany 中按住任何键时,它会毫无延迟地打印它(例如 llllllll)。在 Vim 中,它缓慢而跳跃。与 Geany 相比,vim 中的自动完成是可怕的。我认为 Vim 和光一样快。看起来不是。有什么建议可以改变这种情况,让 vim 更快吗?
这是我的 _vimrc 文件:
" This must be first, because it changes other options as side effect
set nocompatible
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#infect()
" change the mapleader from \ to ,
let mapleader=","
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
set hidden
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup
set noswapfile
filetype plugin indent on
autocmd filetype python set expandtab
if &t_Co >= 256 || has("gui_running")
colorscheme badwolf
endif
if &t_Co > 2 || has("gui_running")
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
" Vim can highlight whitespaces for you in a convenient way:
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
set pastetoggle=<F2>
set mouse=a " Enable mouse
set encoding=utf-8
set langmenu=en_US
let $LANG = 'en_US'
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set autochdir " working directory is always the same as the file you are editing
noremap <F5> :w !python %<CR>
inoremap <F5> <ESC>:w !python %<CR>
nmap <leader>t :NERDTree<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
set guifont=Hack:h10:cDEFAULT
let g:Powerline_symbols = 'fancy'
set laststatus=2
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
filetype plugin on
set omnifunc=syntaxcomplete#Complete
au CompleteDone * pclose
set completeopt=longest,menuone,preview
set guioptions-=T
set nofoldenable " disable folding
nmap <silent> ,/ :nohlsearch<CR>
最佳答案
这可能是很多事情,不一定是 Vim 的错。实际上,这不太可能是 vim 的错。
vim -u NONE
并注释掉 .vimrc 中的所有内容 - 然后做一件看起来很慢的事情。 -u NONE
的情况下运行并进行比较。它应该一样快,否则某些插件会自动加载并导致问题。如果是这样,请尝试暂时将文件移离 ~/.vim/bundle
目录。 我猜你可能会在每次滚动时执行昂贵的操作,例如检查文件语法。
最好一步一步地追捕缓慢。
另一个问题可能是终端和/或驱动程序缓慢(因此将 Vim 与 GVim 进行比较)。如果你有一个带有花哨字体、透明度、小字体和大屏幕的慢速终端,终端可能会非常、非常、非常慢。
关于vim - 为什么 Vim 这么慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37644682/