I have a setup using cygwin with midnight commander and vim. I have a proper .vimrc in my home folder, which works fine if I start up vim directly on the console. Now I also want mc to use vim, so I disabled "use internal viewer/editor". I also aliased vi to vim in my .bashrc and the alias is working properly.

The Problem is: when I open vim via mc, coloring is not working. If I manually try to enable syntax highlighting (syntax on), I get

E319: Sorry, the command is not available in this version

If I start vim directly, everything is working as it should. My .vimrc and .bashrc look the following:

set nocompatible
set nocp
set backspace=indent,eol,start
set term=xterm-256
syntax on
set hlsearch
set t_Sb=m
set t_Sf=m
set autoindent
set cindent
set smartindent
colorscheme distinguished
set t_Co=256

export EDITOR vim
alias vi="/usr/bin/vim"
[..other stuff..]

I've also tried to alias vi and explicitly setting the Terminal to xterm-256color, which cygwin uses in my case.

Same setup on debian is working fine though..

  • I have tried your settings (except colorscheme distinguished which I do not have) in a clean, updated Cygwin installation. I do not observe the problem. You do not need xterm-256 which is for 256 color xterm variant instead of 16 standard ones. ------ As a test please try to rename: mv /usr/bin/vi /usr/bin/vi-dontuse and start mc again. ------ Also in the vim instance without highlighting try to run :version and add the result to the question. ------ Additionally please list the process tree with the problematic vim: pstree -alpsuU. – pabouk Oct 31 '14 at 11:02

Oh. Guess what: There was a missing '='

export EDITOR=vim

Only found it because mc did not start the editor when moving vi to vi-dontuse

| improve this answer | |
  • :-)) I did not notice the missing =. --- Yesterday I also forgot about one thing. The alias alias vi="/usr/bin/vim" was useless because 1. Aliases are not expanded in a non-interactive shell by default. 2. They are not inherited by sub-processes and .bashrc is automatically executed only during start of an interactive bash. 3. Contrary to variables aliases have no sense to non-shell processes. (Anyway they are not inherited.) – pabouk Nov 1 '14 at 10:15
  • And learned something again :) Thanks for your thoughts. If you commit an answer, I'll mark it. – CShark Nov 1 '14 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.