sunjon / shade.nvim Goto Github PK
View Code? Open in Web Editor NEWAn Nvim lua plugin that dims your inactive windows
License: MIT License
An Nvim lua plugin that dims your inactive windows
License: MIT License
If i start nvim with help only window, I got and invalid window id error:
> nvim -c 'help | only'
Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua .../shade.nvim/lua/shade.lua:166: Invalid window id: 1003
And then, if I open a new split window, I got the same error for shade.lua:155 line
Similar to #19 I get an Invalid window id:
error when exiting [neogit].
E5108: Error executing lua ...nvim/site/pack/packer/start/neogit/lua/neogit/status.lua:712: Vim(call):E5108: Error executing lua ...che/nvim/site/pack/packer/start/shade.nvim/lua/shade.lua:322: Invalid window id: 1082
Repro steps
minimal_init.lua
file nvim --clean -u minimal_init.lua
:Neogit
q
minimal_init.lua
local install_path = "/tmp/nvim/site/pack/packer/start/packer.nvim"
local compile_path = install_path .. "/plugin/packer_compiled.lua"
vim.opt.packpath = "/tmp/nvim/site"
local function load_plugins()
require("packer").startup({
function(use)
use("wbthomason/packer.nvim")
use("sunjon/Shade.nvim")
use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
end,
config = { compile_path = compile_path, package_root = "/tmp/nvim/site/pack" },
})
end
_G.load_config = function()
require("shade").setup()
require("neogit").setup()
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]])
Is there a way to disable shade for certain filetypes? I am using mundo for the undo history, but with shade active it is not as useful:
So maybe ab ignore list or similar would be helpful? Or expose the command ShadeDisable
, ShadeEnable
, and ShadeToggle
so there is a possibility to use autocommands.
nvim --version
: NVIM v0.5.0-dev+1256-gd19348923DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=21.0
DISTRIB_CODENAME=Ornara
DISTRIB_DESCRIPTION="Manjaro Linux"
$TERM
: alacrittynvim -u minvimrc -i NONE
" minvimrc
set encoding=utf-8
filetype plugin indent on
if has('vim_starting')
let s:pluin_manager_dir='~/.config/nvim/.plugged/vim-plug'
execute 'set runtimepath+=' . s:pluin_manager_dir
endif
call plug#begin('~/.config/nvim/.plugged')
Plug '~/ghq/github.com/sunjon/Shade.nvim'
call plug#end()
set nobackup
set nowritebackup
set noswapfile
set updatecount=0
set backspace=indent,eol,start
language messages en_US.utf8
lua << EOF
require'shade'.setup {
overlay_opacity = 15,
opacity_step = 1,
keys = {
brightness_up = '<C-up>',
brightness_down = '<C-down>',
toggle = '<Space>ss',
},
-- debug = true,
}
EOF
I want the numbers to be displayed correctly.
When I set the width
to 18
, it displays correctly.
Line 344 in d02c639
Thank you!
Hi there! awesome plugin. It would be great if there was an option to exclude the dimming of certain filetypes. I dont want to dim NvimTree buffer , its a file tree plugin ( https://github.com/kyazdani42/nvim-tree.lua ) .
When opening a file through NERDTree the newly focused window/pane is still transparent.
Where does the config element go? Could you please add that to the readme with an example
if i'm using this plugin:
i can't close tab if i have more than one tab
i should be close all tab by :qa or :wqa
the Shade
plugin itself works very well but I've enabled transparency in my neovim and it seems Shade
disables that transparency and changes it to a black background.
I'd love to see options for ignoring certain filetypes, because in some cases I would imagine having un-shaded windows is preferable (like debuggers and file browsers).
It seems this plugin breaks the LSP documentation from showing:
It took me a while to track down what the cause was - by systematically removing bits of my config until I removed this plugin and bam the documentation was working again. It could be a combination with the rest of my setup as well. Happy to help debug further just let me know what you need.
I like the idea of this plugin! It makes it nice to see which split I am/was working in :)
Hi guys,
I would like to thank you guys for this plugin because before installing I had issues to know in with part of neovim I was working when I had to do something on another program and return to it. However, recently I am having the problem that will be better explained by the screenshots below:
Before or when I deactivate the plugin
Lemme know how I can help you guys to solve this issue
Best, Eddie
When loading a config one must have a guibg
color for the Normal
highlight group.
If it is set to NONE
: shade.nvim/lua/shade.lua:119 : bad argument #1 to 'format' (number expected, got nil)
Do the following:
:tabnew
:tabclose
Error:
Error detected while processing WinClosed Autocommands for "*":
E5108: Error executing lua ...are/nvim/site/pack/packer/start/shade.nvim/lua/shade.lua:280: Invalid window
id: 1010
Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua ...are/nvim/site/pack/packer/start/shade.nvim/lua/shade.lua:255: Invalid window
id: 1010
It will cause a lot of error like the following:
E5108: Error executing lua ...e/pack/packer/start/nvim-tree.lua/lua/nvim-tree/view.lua:347: Vim:E444: Cannot close last window
Which will cost you so much time and find nothing.
After installing this and using the setup()
in the readme, I noticed that my neovim was really laggy when I scroll by holding down J or K. However when I run neovim with nvim -u NORC
and then :luafile
my config it works just fine.
^^
config (using packer):
use {
"sunjon/shade.nvim",
config = function ()
require("shade").setup({
overlay_opacity = 50,
opacity_step = 0,
})
end
}
Hello. I use vista.vim for symbol lookups and it seems that I can reliably make Shade error by doing the following:
:Vista!!
to toggle) - Vista opens correctly:Vista!!
) - Vista hides correctly but the part that was occupied by the side panel is now "Shaded"The error is the following:
Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua /home/penaz/.config/nvim/plugged/shade.nvim/lua/shade.lua:178: Invalid window id: 1003
Thank you in advance for your help.
Behavior : Launching Goyo plugin in a split then switching split causes a core dump of nvim
Terminal error message:
/src/nvim/ui_compositor,c.358: compose_line Assertion until>col
failed
Expected Behavior: revert to normal highlighting but without core dump
NVIM v0.6.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9/build/config -I/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9/src -I/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9/.deps/usr/include -I/usr/include -I/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9/build/src/nvim/auto -I/build/neovim-QYeQt9/neovim-0.5.0+ubuntu2+git202107071802-3de777d25-d569569c9/build/include
Compiled by buildd@lgw01-amd64-030
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Hi,
I want to start nvim with shade disabled in some scenarios. Is there a command that I can pass to the CLI like nvim +ShadeOff
to achieve this? If not, how can I start nvim with shade disabled by default?
Great plugin, so hoping it fixes whatever issues come up.
My neovim terminal's colours get all distorted with this plugin. I am using sainnhe/edge
but I guess this might happen in general. Can you check?
Hello ๐
I'm using neovim v.0.7.2 with a vimrc
file written in vimscript.
I already have different lua plugins which work well (e.g. neotree
, nvim-treesitter
, ...) but I can't get Shade to work properly.
I added this to my vimrc
:
" sunjon/Shade.nvim: Dim inactive windows {{{
Plug 'sunjon/Shade.nvim'
lua <<EOF
require'shade'.setup({
overlay_opacity = 50,
opacity_step = 1,
keys = {
brightness_up = '<C-Up>',
brightness_down = '<C-Down>',
toggle = '<Leader>s',
}
})
EOF
" }}}
Made sure to run :PlugInstall
and I have the repo cloned in my ~/.vim/plugged
directory.
But when I start neovim I get the following error:
Error detected while processing /home/statox/.vimrc:
line 209:
E5108: Error executing lua [string ":lua"]:1: module 'shade' not found:
no field package.preload['shade']
no file './shade.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/shade.lua'
no file '/usr/local/share/lua/5.1/shade.lua'
no file '/usr/local/share/lua/5.1/shade/init.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/shade.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/shade/init.lua'
no file './shade.so'
no file '/usr/local/lib/lua/5.1/shade.so'
no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/shade.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
[string ":lua"]:1: in main chunk
I'm not sure if the issue comes from the plugin or from my setup, could you point me in the right direction?
Thank you in advance and congrats on your plugin which looks really good!
It seems like shade is preventing the background color of some words from changing on cholorscheme switching at runtime (when using :colorscheme
)
tested with all variants of both ayu and iceberg with only shade and the two aforementioned colorscheme plugins using packer.
shade was setup with zero config
require'shade'.setup()
au ColorScheme * hi Normal ctermbg=none guibg=none
cause lose background color?
not use Shade.nvim and au ColorScheme * hi Normal ctermbg=none guibg=none
before colorscheme
use Shade.nvim and au ColorScheme * hi Normal ctermbg=none guibg=none
before colorscheme
au ColorScheme * hi Normal ctermbg=none guibg=none
colorscheme xxx
change the order:
colorscheme xxx
au ColorScheme * hi Normal ctermbg=none guibg=none
but I still want to use au ColorScheme * hi Normal ctermbg=none guibg=none
before colorscheme
getting this message pack/packer/start/Shade.nvim/lua/shade.lua:278: Invalid window id: 1004
https://github.com/sunjon/Shade.nvim/blob/master/lua/shade.lua#L259
I think nvim already has autocomands, no need to keep old vimscript calls:
-- setup autocommands -- TODO: set a precalculated winid
api.nvim_exec([[
augroup shade
au!
au WinEnter,VimEnter * call v:lua.require'shade'.autocmd('WinEnter', win_getid())
au WinClosed * call v:lua.require'shade'.autocmd('WinClosed', expand('<afile>'))
au TabEnter * call v:lua.require'shade'.autocmd('TabEnter', win_getid())
au OptionSet diff call v:lua.require'shade'.autocmd('OptionSet', win_getid())
augroup END
]], false)
In the terminal, it works just fine.
In goneovim, I cannot select any text with the mouse or move to a position after a click.
Hi. Is this project unmaintained?
If so, I request to archive it and encourage others to fork it. Thanks.
Error detected while processing WinClosed Autocommands for "*":
E5108: Error executing lua ...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:326: Invalid window id: 1008
stack traceback:
[C]: in function 'nvim_win_close'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:326: in function 'on_win_closed'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:439: in function 'fn'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:456: in function <...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:428>
Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua ...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:182: Invalid window id: 1006
stack traceback:
[C]: in function 'nvim_win_get_option'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:182: in function 'shade_tabpage'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:295: in function 'on_win_enter'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:436: in function 'fn'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:456: in function <...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:428>
Error detected while processing TabEnter Autocommands for "*":
E5108: Error executing lua ...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:194: Invalid window id: 1008
stack traceback:
[C]: in function 'nvim_win_close'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:194: in function 'remove_all_overlays'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:442: in function 'fn'
...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:456: in function <...share/nvim/site/pack/packer/opt/shade.nvim/lua/shade.lua:428>
Lines 416 to 426 in 4286b5a
Please remove print("off")
and print("on")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.