Giter Club home page Giter Club logo

Comments (33)

fenetikm avatar fenetikm commented on May 27, 2024 1

phew - thanks for helping make falcon better 👍

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Yeah I really need to add in a bit more detail on how to set this up as it's a bit fiddly.

So to get the whole inactive / active thing going you need:

  • NeoVim (not supported in Vim)
  • 24-bit color working inside of tmux, inside of vim
  • the latest version of falcon which makes this stuff configurable:
    if exists('+winhighlight') && g:falcon_inactive == 1
  • in your tmux config somewhere:
set -g window-style "bg=#151521"
set -g window-active-style "bg=#020221"
  • in your NeoVim config:
"24bit color
set termguicolors

let g:falcon_lightline = 1
let g:lightline.colorscheme='falcon'
let g:falcon_background = 0
let g:falcon_inactive = 1

colorscheme falcon

(the lightline stuff is optional)

Let me know if you have all of the above and how you go.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

So I updated my NeoVim (built from source, latest commit) and checked for truecolor:
image
Everything seems to be ok. (Left is Terminal inside NeoVim and right is pure shell)

echo exists('+winhighlight') returns 1 and g:falcon_inactive is equal 1 (and g:falcon_background is 0);

I've imported the falcon theme into iTerm as mentioned in the Wiki. The Tmux Panes seem ok.

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Oh, that was the other thing, need to be on a recent version of NeoVim (note to self). I am on v0.3.1.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

I'm guessing my colors might be a bit off. Comparing my screenshot to the one on the README, I've noticed the current active tmux window should be orange and mine is grey (on TMUX, that is):

Mine README
image image

My NeoVim is v0.3.2:

Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20180822-82772-1ggjmf4/build/config -I/tmp/neovim-20180822-82772-1ggjmf4/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180822-82772-1ggjmf4/build/src/nvim/auto -I/tmp/neovim-20180822-82772-1ggjmf4/build/include
Compiled by filipekiss@urbosa

Features: +acl +iconv +jemalloc +tui 
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-012cd35/share/nvim"

Run :checkhealth for more info

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

hah, sorry, screenshot is slightly behind - I have gone back to grey.

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

in my tmux conf I currently have this:

source-file ~/Documents/Work/internal/vim/colors/falcon/tmux/falcon.tmux.conf

# the following is falcon colour specific
set -g status-left "#[fg=white] #S #[fg=#57575e]│ "
set -g status-right "#(~/.config/tmux/itunes_current_track.zsh) #[fg=#57575e]│ #(~/.config/tmux/tw_status.sh) #[fg=#57575e]│ #[fg=white]%d/%m/%Y %H:%M "
set -g status-right-length 200

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

So I am importing the falcon one then overwriting the status a bit since I have a script to show the itunes track and a taskwarrior script.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

Yeah, I'm starting to guess it's more a NeoVim issue than a Falcon one.

Can you confirm something for me? Open a Tmux window, split it in two and open an empty Buffer on NeoVim and then focus the other pane. Does NeoVim change the bg color to the Inactive one?

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Yeah, it works perfectly for me.

The key to the way it works is that NeoVim should only set the background for inactive buffers and leave the background unset otherwise, thus taking it's colour from Tmux which will be either the Tmux inactive colour or the Tmux active colour.

It used to be that there was no background set anywhere in falcon, however, I noted that had some issues in certain places so now, the background is set for Normal and NonText but is then unset via the plugin/falcon.vim file which looks at the settings.

So the tests I would run, would be:

  • open up NeoVim just in iTerm2, no Tmux - does the active inactive thing work?
  • open up three iTerm2 instances, check that the background colour in NeoVim, Tmux inside of Neovim and iTerm2 all match
  • open up Tmux inside of iTerm2, make some splits, check that the colours change as expected
  • open up NeoVim inside of Tmux (no extra splits), check that the colours changes as expected
  • open up NeoVim inside of Tmux, two splits (one NeoVim, one shell), create two splits in NeoVim, check that moving between NeoVim splits and Tmux works as expected re active / inactive

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

I remember I had some interesting issues at one stage due to iTerm2 background being wrong (I have sinced moved away from iTerm2 for performance reasons).

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Actually I have this in my config:

"turn off the cursorline when not in a window
autocmd InsertLeave,WinEnter * set cursorline
autocmd InsertEnter,WinLeave * set nocursorline

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

maybe that is forcing an extra redraw?

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

And also this for reloading files, probably not relevant:

" Reload when gaining focus
autocmd FocusGained,BufEnter * :silent! !

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

So, here's the deal:

Opened nvim outside tmux, just iTerm and split in 3 (Active Pane is bottom-right):

image

Then, I manually ran hi ActiveWindow guibg=NONE | hi InactiveWindow guibg=#151521 and it becomes like this (Active Pane is bottom-right):

image

Better, but if the bottom-right pane is the inactive one, only the first line stays inactive (Active Pane is top):

image

Same thing if I ran this inside tmux

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

Also I should note that I copied the autocmds you suggested before trying this, so they're definetely not the responsibles for doing this

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

can you possibly post a link to your nvim config?

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

it looks like to me that the falcon plugin (vs the colorscheme) isn't doing it's thing

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

essentially this code:

" NeoVim has support for changing background colour depending on active or not
if !exists('g:falcon_inactive')
  let g:falcon_inactive = 0
endif

if exists('+winhighlight') && g:falcon_inactive == 1
  hi ActiveWindow guibg=NONE | hi InactiveWindow guibg=#151521
  set winhighlight=Normal:ActiveWindow,NormalNC:InactiveWindow
endif

" Put in a background colour for gui
if !exists('g:falcon_background')
  let g:falcon_background = 1
endif

if !has("gui_running") || g:falcon_background == 0
  hi NonText guifg=#36363a ctermfg=237 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
  hi Normal guifg=#b4b4b9 ctermfg=249 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
endif

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

My vim config is kinda huge. I've disabled all plugins to see if something was conflicting but still no luck. I'm loading it via vim-plug. I'll try to run the plugin code manually and see if it works, hang on.

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

thanks

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

I am using plug, but I am just including it ala:

Plug '~/Documents/Work/internal/vim/colors/falcon'

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

I've put just this on my .vimrc:

set termguicolors
hi ActiveWindow guibg=NONE | hi InactiveWindow guibg=#151521    

and of course it works!. It's surely something I'm not setting up properly. Time to dive down the rabbit hole and try to find it!

Thank you for you help @fenetikm! As soon as I find out what's causing this I'll post a comment!

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Great - progress!

If you look in the falcon repo, you will see that there is plugin/falcon.vim - my suggestion would be to check if that is being called and when. Also what the values are of the global variables, especially if it is hitting that line that you have just manually added in. Maybe pepper the code with echom statements or what have you.

Would be great if you can post back here and so I can write up a separate wiki page on getting this all working.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

So, a few things I've picked up (and I wasn't really able to determine the issue yet):

  • If I do not load my plugin/color.vim file, the whole inactive thing works as expected
  • If I load the file mentioned above, the "dimming" of the background color stops working
  • Weirdly enough, what makes the whole thing stops working is colorscheme falcon

I'll try to run the colorscheme command somewhere else and see if it's the loading order that's causing this.

Ran :scriptnames and the plugin/falcon.vim is being loaded way before the color.vim and the color scheme itself

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

So I've managed to get it working by making the background check run at VimEnter:

diff --git i/plugin/falcon.vim w/plugin/falcon.vim
index d128335..fda9487 100644
--- i/plugin/falcon.vim
+++ w/plugin/falcon.vim
@@ -1,3 +1,8 @@
+if exists('g:loaded_falcon')
+  finish
+endif
+let g:loaded_falcon=1
+
 " required as colors will come from terminal without
 let g:fzf_colors =
 \ { 'fg':      ['fg', 'Comment'],
@@ -29,11 +34,16 @@ if !exists('g:falcon_background')
   let g:falcon_background = 1
 endif
 
-if !has("gui_running") || g:falcon_background == 0
+function! s:setColors(...)
   hi NonText guifg=#36363a ctermfg=237 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
   hi Normal guifg=#b4b4b9 ctermfg=249 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
+endfunction
+
+if !has("gui_running") || g:falcon_background == 0
+    autocmd VimEnter,FocusGained * call s:setColors()
 endif
 
+
 " NeoVim terminal colors
 if has ("nvim")
   let g:terminal_color_0 = '#000004'

This makes everything working as expected inside TMUX, but still not working outside TMUX. I'll let you know if I find anything else.

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

hrm, what is currently in your color.vim file?

I just made a minimal .vimrc:

set nocompatible " disable compatibility with vi
syntax enable "enable syntax highlighting

" Assumes vim-plug is installed.
call plug#begin()
Plug 'fenetikm/falcon'
call plug#end()

"enable 24bit support.
set termguicolors

" enables the active / inactive functionality.
let g:falcon_background = 0
let g:falcon_inactive = 1

colorscheme falcon

... and everything works fine. It's sounding like something clobbering the falcon plugin code... and so expected behaviour of sorts.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

My color.vim has only this:

if has('termguicolors')
    set termguicolors
end

try
    colorscheme falcon
catch
    colorscheme ron
endtry

So here's the thing: In tmux it works fine but outside tmux it does not. My understanding is that TMUX is able to set the inactive pane BG to a certain color (and when the vim pane has it's BG set to NONE you see that color) whereas iTerm isn't able to do that. I really don't care about this since I never work outside TMUX but I'd be happy to continue debugging if you think it's worth.

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Oh when you say it doesn't work outside of Tmux in iTerm - are you referring to iTerm splits? If that's the case then yeah, that isn't supported AFAIK.

I'll try modifying my falcon plugin to use an autocmd approach like you have above and then hopefully we can call it day ;)

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

No, I actually mean vim splits:

image

I'm guessing the command sare depending on it being loaded on a specific order. I've tried the vim syntax test and the groups for ActiveWindow and InactiveWindow were not being set properly withouth the autocmd (Just to be clear: If I make autocmd for both color setting options we have in the plugin, it works flawlessly).

If you wish I can open a pull-request with the autocmd patch :)

Thank you so much for your patience!

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Ok, cool, thanks for the clarification.

All good re the PR - no need to bother.

I want to see it with my own eyes first ;)

from falcon.

fenetikm avatar fenetikm commented on May 27, 2024

Ok, develop branch now has the autocmd version. Also added in your guard statement which is always a good idea. I removed FocusGained - felt that might be a bit much.

Let me know what you think.

from falcon.

filipekiss avatar filipekiss commented on May 27, 2024

develop is hella fine! Working perfectly! Thank you. 🙏

from falcon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.