Cmder: Problem with using vim in cmder

Created on 20 Mar 2018  路  11Comments  路  Source: cmderdev/cmder

I'm using cmder:bash with the vim which comes with cmder (full-version). I'm also using vim-plug for plugin management.
Problem is, colorscheme plugin does not work as expected. It seems it is conflicting with cmder colors.
1- How can I solve this issue?
2- Where is .vimrc located? In cmder\vendor\git-for-windows\etc ?
3- Why echo $MYVIMRC prints nothing in bash?
4- Why echo $TERM prints cygwin in bash? Shouldn't it print xterm?

Thanks in advance

Most helpful comment

For the solarized theme you need to add and select the Solarized (Luck Maciack) colour scheme, if you don't want to change the cmder theme switch out solarized for the Molokai theme it works perfectly as well. You can also set the in the App Specific overrides the colour-scheme to use for just the vim.exe process.

You need to add this to your vim configuration, mine is in $home\vimfiles\vimrc

if (&term == "pcterm" || &term == "win32")
        set term=xterm t_Co=256
        let &t_AB="\e[48;5;%dm"
        let &t_AF="\e[38;5;%dm"
        set termencoding=utf8
        set nocompatible
        inoremap <Char-0x07F> <BS>
        nnoremap <Char-0x07F> <BS>
endif
set background=dark
colorscheme solarized

for symbols to work properly you need to chcp 65001 you can add this to the environment option in the settings.

All 11 comments

@Stanzilla But it's not duplicate. #468 has syntax highlighting issue but my syntax highlighting is fine. I have issues with themes and colors.

@pvonmoradi the color issues you are asking about is simply a limitation of the Windows console subsystem which cmder uses. I don't think your going to find a fix, I tried for months.

@daxgames But I'm using a bash tab (not a cmd tab). Does that limitation still apply? Do you have any answers to my other questions? (2, 3 & 4)
Also, what should I do now? How do you use vim?

@pvonmoradi

Yes it does. I use vim every day and love it. I experimented and found a color scheme I can live with but am not completely happy with.

bash->mintty does not use the Windows console subsystem but introduces a whole bunch of other issues.

  1. %userprofile%\.vimrc just like always
  2. What do you expect it to print? I would say nothing.
  3. $TERM is set to cygwin by one of the init scripts, I don't know which one. If you don't like it change it by setting it to whtever you think it should be in $CMDER_ROOT/config/user-profile.sh

@daxgames Thanks. So I just need to change cmder's colorscheme using the menu configs then in this way, vim would accept that setting?
2- About .vimrc, when I enter :scriptnames in vim, it is showing me that it is loading something from this /etc/vimrc which I gather is the .vimrc file. No .vimrc file resides in my $home directory. Are you sure about this? Can you check which scripts are loaded at vim startup by :scriptnames command?
3- People say it should print .vimrc directory
4- Again, some say that in order for vim to have the ability to change colors, $TERM should be xterm to support multiple colors but it is set to cygwin now

I don't know what setting you are trying to set. I think I run the default cmder color scheme and played with setting a color scheme in .vimrc.

If you put .vimrc in your home dir it will load from there. I believe the one in /etc loads first then the one in home loads second.

For the solarized theme you need to add and select the Solarized (Luck Maciack) colour scheme, if you don't want to change the cmder theme switch out solarized for the Molokai theme it works perfectly as well. You can also set the in the App Specific overrides the colour-scheme to use for just the vim.exe process.

You need to add this to your vim configuration, mine is in $home\vimfiles\vimrc

if (&term == "pcterm" || &term == "win32")
        set term=xterm t_Co=256
        let &t_AB="\e[48;5;%dm"
        let &t_AF="\e[38;5;%dm"
        set termencoding=utf8
        set nocompatible
        inoremap <Char-0x07F> <BS>
        nnoremap <Char-0x07F> <BS>
endif
set background=dark
colorscheme solarized

for symbols to work properly you need to chcp 65001 you can add this to the environment option in the settings.

In case it's useful for anyone else, after I added the settings suggested by @grufffta I was getting crazy random colored boxes drawn all over the screen, and struggled for a long time before I stumbled upon the answer: my theme didn't have a background color set for terminals. Once I added one to the theme, everything became normal. Thank you so much for your suggestion!

hi Normal                 cterm=NONE             ctermbg=234  ctermfg=145

@grufffta Could you please explain how your .vimrc config works and how to apply it for the Solarized Light colourscheme in Cmder and Vim respectively? Thanks

@grufffta Could you please explain how your .vimrc config works and how to apply it for the Solarized Light colourscheme in Cmder and Vim respectively? Thanks

You should just be able to change set background=dark to set background=light you can also select the normal solarized theme in cmder - but they don't have to be the same, you'll just get whatever the cmder theme background colour as the margin around the vim app.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justinmchase picture justinmchase  路  3Comments

emesx picture emesx  路  3Comments

GlassGruber picture GlassGruber  路  3Comments

danwellman picture danwellman  路  3Comments

luisrudge picture luisrudge  路  3Comments