I am a beginning vim user and I am a little confused. It looks like Vim is slower than Geany. And it is a very noticeable difference. When I hold any key in Geany it prints it without any lag (llllllll for example). In Vim it is slow and jumping. Autocomplete in vim is horrible in comparison to Geany. I thought Vim is as fast as light. It looks like it isn't. Is there any advice to change that, make vim faster?
This is my _vimrc file:
" 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>
Overkill, perhaps. Now, you should do things that make vim act slowly. They are being profiled in the background. Once you have concluded, end the profiling. And quit vim. Now, read the profile.log file and see what's slow. Note that this is for slow running inside of vim. If vim is slow to start up (a different problem), you should start vim with
It’s not hard to use. It is hard to learn. Once you figure out the basic keys, it is very simple to use. Hard to learn, not hard to use. With VIM, you are essentially learning and ingraining a new language of sorts. It’s similar to learning to touch-type—something that comes only after regular practice.
It’s archaic. Vi was created when keyboard was the main/only input devices. It doesn’t support mo vi (or vim) IS intuitive and it IS NOT HARD TO USE, once you learn its premises. vim is a TEXT-OBJECT ORIENTED EDITOR, and the commands are applied on the objects.
But that was just an example for illustrating the problem, and executing ":%s/^/newstring-/g" is not the main issue. The reason for the warning message is that Vim, in its default configuration, is an interactive application which expects to communicate using a particular terminal configuration.
It could be a lot of things, not necessarily Vim's fault. Actually it's unlikely to be vim's fault.
First, get a feel for how fast Vim can be: run with vim -u NONE
and comment out everything in your .vimrc - then do the single thing that seems slow.
Run without the -u NONE
and compare. It should be just as fast, or some plugin is autoloaded and is causing problems. If so, try and temporarily move files away from the ~/.vim/bundle
directory.
Next, uncomment half of your .vimrc and check if it causes the slowness or not. Keep commenting/uncommenting until you find the exact line.
Google the line that caused the slowness and find out if there are alternatives.
I'm guessing you could be doing an expensive operation with every scroll, such as checking the file syntax.
It's best to hunt down the slowness step by step.
Another issue may be slow terminal and/or drivers (so compare Vim with GVim). If you have a slow terminal with fancy fonts, transparency, small font and big screen size, terminals can be very, very, VERY slow.
If you use vim in terminal like me (and not GVim), I just found that, try, and it seems pretty good :
add this in your ~/.vimrc :
set timeoutlen=1000
set ttimeoutlen=0
and this (even more important) in your ~/.screenrc :
maptimeout 0
Since I did that, everything is better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With