Reputation: 25754
I just compiled vim 7.2 on a Linux server (in my user dir, since the server had vim 6 installed and I wanted to upgrade but do not have root privileges).
When I enter "vim", it hangs on startup without any response, but when I call "killall vim" from another ssh window, startup completes and vim seems to work fine after that. Why would that be, and how can I fix it?
Many thanks for your responses.
Upvotes: 12
Views: 4900
Reputation: 24617
Using strace vim
to find the error gave me this:
.vim/bundle/Vundle.vim", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 getdents(4, /* 0 entries */, 32768) = 0 close(4) = 0 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
so removing Vundle.vim
fixed the issue.
Upvotes: 0
Reputation: 101
Related to the mentioned case of vim hanging at startup when trying to access GPM, you can tell if this is the case using strace
. First run vim in one terminal/console so that it hangs
vim
then go to another terminal, get the PID and strace it
$> pgrep vim
32502
$> strace -p 32502
Process 32502 attached - interrupt to quit
connect(4, {sa_family=AF_FILE, path="/dev/gpmctl"...}, 13
So we have a GPM case. Just restart the GPM service and we are good to go
$> service gpm restart
Shutting down console mouse services: [ OK ]
Starting console mouse services: [ OK ]
Upvotes: 0
Reputation: 19333
Another common reason for vim hanging at startup is when it is trying to access GPM (ie: custom fonts, etc). In my case, I was having the same symptoms, but it ended up being a mouse-related issue with GPM.
Putting the following (from: http://www.linuxquestions.org/questions/slackware-14/vim-freeze-at-startup-when-in-ssh-session-856606/) in my .vimrc fixed the hang-on-startup issue with VIM.
" This section is bigger in my .vimrc, this is just an excerpt.
if has('gui_running')
" Mouse on GUI comes handy.
set mouse=a
else
set mouse=
endif
Hope this helps other readers that come this way :)
Upvotes: 2
Reputation: 25754
Well, I found the answer:
:help -X
shows that Vim tries to connect to the X11 server on startup to get clipboard functionality and other stuff, which can lead to a "long startup time when running Vim in a terminal emulator and the connection to the X server is slow"
There are three ways to resolve this issue:
vim -X
" disables this X11 communicationunset DISPLAY
" also disables the X11 communication+X11
" feature, this communication will not take placeI went for "unset DISPLAY
" since I've been getting other strange error messages, and now vim starts all but instantly. I also tested the -X parameter, which resolved the problem as well (even with the DISPLAY parameter still set).
Upvotes: 29