mcchrish / nnn.vim

File manager for vim/neovim powered by n³
BSD 2-Clause "Simplified" License
646 stars 25 forks source link

Not getting nnn colors with neovim #73

Closed asgeo1 closed 4 years ago

asgeo1 commented 4 years ago

Describe the bug

Normal use of nnn inside fish shell seems to work fine. It shows the output with colors. $TERM is set to xterm-kitty.

But if I start vim inside fish shell, and then trigger nnn.vim, it shows the output without any colors.

Note that changing to bash shell, starting Vim and then trigger nnn.vim, it shows the output with colors though.

So seems to be some issue with Vim and Fish working together.

To Reproduce

  1. Use fish shell

    fish --version
    fish, version 3.1.2
    
    echo $SHELL
    /usr/local/bin/fish
    
    echo $TERM
    xterm-kitty
    
    # .vimrc
    set shell=/usr/local/bin/fish
  2. Use suggested custom mapping configuration

    " Disable default mappings
    let g:nnn#set_default_mappings = 0
    
    " Start nnn in the current file's directory
    nnoremap <leader>n :NnnPicker '%:p:h'<CR>
  3. Trigger ,n

Expected behavior

It should show the nnn output with colors

Environment:

Additional context

It may not be an issue with this plugin, perhaps it's something to do with vim + fish or kitty... not sure.

Your help would be much appreciated!

asgeo1 commented 4 years ago

UPDATE: seems that this is actually an issue with neovim and likely nothing to do with fish / kitty. I didn't realise, but in bash vim is actually starting Vim 8, which doesn't have the color issue. So at least I'm a little closer to working this out...

asgeo1 commented 4 years ago

OK, I've sort of worked it out. In Neovim, if I open a terminal with :terminal and do echo $TERM, it shows xterm-256color, which is different to xterm-kitty that I use elsewhere.

For some reason on my system, nnn will not show colors when used with xterm-256color. I'm not sure why that is, but it's obviously nothing to do with this plugin. Vim 8 doesn't override $TERM, so I don't have any issue with it.

For now, I just override the command used to run nnn, i.e.

let g:nnn#command = 'TERM=xterm-kitty nnn'

and that works to get nnn colors in Neovim.