【发布时间】:2016-10-05 07:24:46
【问题描述】:
我是 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>
【问题讨论】:
-
这确实是您的 vimrc 文件的问题。首先尝试在没有的情况下运行它,看看它是否有所作为:
vim -u NONE -
是的,你错了。
-
你没有错 - 关于自定义,我的意思是你的 vimrc 中有一些乱码,这会导致挂断。
-
看看这个问题的答案:stackoverflow.com/questions/12213597/…。内置分析总是帮助我找到 vim 缓慢的根源。
-
第一件事让我大吃一惊:为什么每次启动 Vim 时都运行
pathogen#helptags()?您只需在安装或升级插件后运行一次。至于还有什么让你的 Vim 变慢;你可能有无数个插件可以通过一千次削减来杀死它。按照上面的建议,禁用您实际上不使用的那些,然后运行分析。
标签: vim