3

SOLVED: the problem was this line in my .vimrc:

set shell=/bin/bash\ -li

UPDATE: it appears the problem is due to my .vimrc (renaming the .vimrc to 'hide' it fixed the problem), so it probably has nothing to do with Mint.

I'm running Linux Mint 17 Cinnamon. When I run vim -d file otherversion in the terminal, I get a blank screen with

"otherversion" 18L, 218C
[1]+  Stopped                 vim -d file otherversion
user@machine:~/path/to/directory$ ;2R

If I do fg 1 that terminal window just closes. Also, there's no blinking cursor, though I am able to type. Same with vimdiff instead of vim -d. I've tried multiple distributions of vim, some that include the GUI, some that don't.

However, with versions that do include the GUI, if I run vim -d -g file otherversion, it works as expected.

I'd rather not depend on gvim to use vimdiff.

Any advice?

Thanks

user3391564
  • 576
  • 1
  • 5
  • 16
  • What is your `TERM` variable and shell? – FDinoff Aug 10 '14 at 23:32
  • TERM is 'xterm'. It's a bash shell and the command to launch one is gnome-terminal. Also, see update in main post. – user3391564 Aug 10 '14 at 23:35
  • 1
    My guess this is more likely a problem with the shell than vim. Does vim open normally (Does a different program work correctly that tries to write to the whole screen such as less or man). vim gets sent SIGTTOU which stops it by default. Although bash shouldn't have this problem. (BTW vimdiff is normally just a symlink to vim with a different name) – FDinoff Aug 10 '14 at 23:42
  • Yes, everything else works fine. Vim, less, man, top, nano. Starting with `vim -d` instead of `vimdiff` leads to the same behavior. – user3391564 Aug 10 '14 at 23:45
  • 1
    This place is not a forum, accept your own answer and remove the "SOLVED" part of your question. – romainl Aug 11 '14 at 06:34
  • I have to wait two days to accept my own answer. Didn't want people to waste time reading the whole question because most of the details, such as the OS being Mint, it turns out are total red herrings. Those details would be of no help to someone who may have the problem in the future. – user3391564 Aug 11 '14 at 22:27

3 Answers3

4

If you need an interactive bash shell (to get your bash aliases for instance), use this code in your .vimrc instead of removing the option:

if &diff == 'nodiff'
    set shellcmdflag=-ic
endif

This will only enable the interactive bash shell when not running vimdiff, so that you will have you bash aliases when running vim.

antoyo
  • 11,097
  • 7
  • 51
  • 82
  • Works like a charm, thanks! However, this still doesn't prevent vim from crashing or going background after diffing files _inside_ vim with `:diffthis` command. How to remedy that? – gadamiak Feb 01 '18 at 15:37
2

After removing the following line from my .vimrc, the problem went away:

set shell=/bin/bash\ -li
user3391564
  • 576
  • 1
  • 5
  • 16
1

Thanks to comment from @FDinoff, the same problem at my end got solved.

The problem was "bash" command in my ~/.cshrc.

I had put that to avoid entering into bash every time after login. It was working fine until this issue started coming whenever I used to open vimdiff.

Removing ~/.vimrc didn't help me either. Then I read comment from FDinoff. There, he suggested that it could be related to shell, if "less" and "man" have also stopped working. I observed the same issue in my case, that helped me rule out the corruption in .vimrc.

After removing "bash" from my ~/.cshrc, the problem went away completely.

Vivek Agrawal
  • 113
  • 11