Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors in nnn.vim don't seem to work always #170

Open
sedimentation-fault opened this issue Sep 22, 2023 · 1 comment
Open

Colors in nnn.vim don't seem to work always #170

sedimentation-fault opened this issue Sep 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sedimentation-fault
Copy link

sedimentation-fault commented Sep 22, 2023

How to set colors in nnn.vim

I've had to spend days(!) to find out how to set some colors in nnn.vim. One problem is that documentation about them is so hard to find, so let me put some information here for anyone with the same problem:

Highlights nnn-hl

The following are the highlight groups that are used:

NnnNormal Window. Linked to |hl-Normal|.

NnnNormalNC Non-current window. Linked to |hl-Normal|.

NnnNormalFloat Floating window. Linked to |hl-Normal|.

NnnBorder Floating window border. Linked to |hl-FloatBorder| or
|hl-Comment|.

NnnVertSplit (depecated. for < nvim-0.7) Explorer window VertSplit. Linked
to |hl-VertSplit|.
NnnWinSeparator Explorer window WinSeparator. Linked to |hl-WinSeparator|.
(requires nvim-0.7 and above).
The above is from

NnnNormalNC Non-current window. Linked to |hl-Normal|.

, so let's try it:

In my /etc/vim/vimrc.local I have:

let g:nnn#layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'StatusLineNC' } }
let NNN_COLORS='#b4c77b9b;5384'
let g:nnn#command='nnn -C'
highlight NnnNormalNC guibg=#C8AE95 ctermbg=darkgrey ctermfg=white
highlight NnnNormalFloat guibg=#4992A7 guifg=white ctermbg=cyan ctermfg=white

The above works only partially for me:

  • The floating windows does get its border colored according to the colors of the StatusLineNC group, so that's OK.
  • NNN_COLORS does not have any effect, even though g:nnn#command is nnn -C, which means that at least directories should be colored according to the context colors set in NNN_COLORS. Directories are always blue for me (color 4, the default for all contexts) in the floating window.
  • Changing g:nnn#command to nnn -D has only the effect of painting directories (in the floating window) in white too, according to the guifg color of NnnNormalFloat. Directories should appear in "context color" and it seems that guifg overwrites the context color set in NNN_COLORS - not sure if that's OK or not...
  • Switching to the floating window with, say, <leader>-n, should change the "non-current" window (the background window that has just lost its focus to the floating one) to the color set in NnnNormalNC. This works if I have one or two files open, but not if I have opened a whole session that contains dozens of files. I have taken care to save my sessions without options, i.e. I have taken away options from my sessionoptions variable:
    set sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,terminal.

How to reproduce

Use the above settings and try to set colors.

Expected behavior

Consistent, trouble-free user experience regarding colors.

Environment:

  • OS: Gentoo Linux
  • Terminal: x11-misc/tabbed-0.6-r1 with x11-terms/xterm-367
  • Shell: app-shells/bash-5.1_p16
  • Vim version: app-editors/vim-8.2.3741
  • Gvim version: app-editors/gvim-8.2.3741
  • Plugin manager: None
  • Plugin version: git clone of Aug. 21st, 2023
  • Nnn version: app-misc/nnn-4.8
@sedimentation-fault sedimentation-fault added the bug Something isn't working label Sep 22, 2023
@sedimentation-fault
Copy link
Author

FWIW I also have

BLK="0B" CHR="0B" DIR="04" EXE="06" REG="00" HARDLINK="06" SYMLINK="06" MISSING="00" ORPHAN="09" FIFO="06" SOCK="0B" OTHER="06"
export NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$OTHER"

(taken from https://github.com/sigmavim/vimrc) in my ~/.bashrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant