nvim-zh / colorful-winsep.nvim Goto Github PK
View Code? Open in Web Editor NEWMake your nvim window separators colorful
License: MIT License
Make your nvim window separators colorful
License: MIT License
Here maybe need add a default opts when opts is nil, if without will case a bug when startup.
code:
error message:
Error in packer_compiled: ...rt/colorful-winsep.nvim/lua/colorful-winsep/comments.lua:19: bad argument #1 to 'pairs' (table expected, got nil)
While changing focus on a window, there's a minor blinking.
What can be the cause?
Minimal config:
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
vim.opt.laststatus = 3
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({
'git',
'clone',
'--depth',
'1',
'https://github.com/wbthomason/packer.nvim',
install_path
})
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.o.runtimepath
end
vim.cmd [[
augroup packer_user_config
autocmd!
autocmd BufWritePost packer_init.lua source <afile> | PackerSync
augroup end
]]
local status_ok, packer = pcall(require, 'packer')
if not status_ok then
return
end
packer.init {
display = {
open_fn = function()
return require("packer.util").float { border = "rounded" }
end,
},
git = {
clone_timeout = 300, -- Timeout, in seconds, for git clones
},
}
return packer.startup(function(use)
use {
"nvim-zh/colorful-winsep.nvim",
config = function ()
require('colorful-winsep').setup()
end
}
if packer_bootstrap then
require('packer').sync()
end
end)
When you use :only
command, being on the next or whatever split comes after the original buffer, the split breaks until you exit neovim.
Thanks for the awesome plugin! It seems this plugin doesn't quite interact correctly with a global statusline (vim.opt.laststatus = 3
), if one is present. As shown in the screenshot below, creating a vertical split and then selecting the window on the right causes the statusline to be split in half. This example uses lualine.nvim with options.globalstatus = true
.
Winsep is installed with a mostly stock Lazy.nvim installation. I'm using Neovim v0.9.5.
The problem is the background of the horizontal separator extends to 2 lines of height. When a pane at the top is selected it is always 2 lines high and covers the first line of the pane below. When a pane at the bottom is selected the separator is 1 line high until the content of the pane is scrolled to the top, when it extends to 2 lines too.
In my (vimscipt) config with previous commit https://github.com/nvim-zh/colorful-winsep.nvim/tree/9a474934a27203d1c2e9943c94a29165dd81823d, i configured colorful-winsep like this:
" use color 2 for the new window border
lua require('colorful-winsep').setup()
hi NvimSeparator ctermfg=2
(I currently use neovim with termguicolors
off)
As of #20, the NvimSeparator
highlight gets overridden on ColorScheme
and WinEnter
events (here).
Since the setup doesn't allow for using cterm
colors, only gui
colors, I can't set this color in the setup, so this is the workaround I am currently using:
local group_postwinsep = vim.api.nvim_create_augroup(
"NvimSeparatorPost", { clear = true }
)
vim.api.nvim_create_autocmd("WinEnter",
{
group = group_postwinsep,
callback = function(opts) vim.cmd [[ hi NvimSeparator ctermfg=2 ]] end,
}
)
Not sure if there's a better way to do this, or if there's a good solution for how the view.highlight
code is organized?
Thanks for the plugin! I appreciate the how clean it makes splits look.
Hello,
I think there is an error in the Lazy instructions:
{
"nvim-zh/colorful-winsep.nvim",
config = function()
asynrequire("packers.nvimsep")
end,
event = { "WinNew" },
}
Should asynrequire("packers.nvimsep")
be require("colorful-winsep").setup()
?
When movin the focus fom one window to the other, the boder color briefly flickers.
I believe the lazy.nvim setup in the README is currently wrong.
This instead works as a basic setup
{
"nvim-zh/colorful-winsep.nvim",
config = true,
event = { "WinNew" },
},
Hello,
Since latest updates, colorful-winsep
is on top of lualine
:
Config :
{
"nvim-zh/colorful-winsep.nvim",
event = { "WinNew" },
opts = {
hi = {
fg = "#f5e0dc",
},
no_exec_files = {
"TelescopePrompt",
"dbui",
"dbout",
},
symbols = { "━", "┃", "┏", "┓", "┗", "┛" },
smooth = true,
anchor = {
left = { height = 1, x = -1, y = -1 },
right = { height = 1, x = -1, y = 0 },
up = { width = 0, x = -1, y = 0 },
bottom = { width = 0, x = 1, y = 0 },
},
},
}
I love this plugin when I have at least 3 windows visible, it makes it a lot easier to identify where I am. However, if I only have 2 windows open, this plugin doesn't really do a whole lot for me. The separator stays constant and just flickers when I move between the two splits.
I think it would be useful to provide a config option to specify the minimum number of visible windows required to enable the border.
{
-- ...
-- only enable the border if there are at least this many windows visible
min_windows = 2,
}
I use 2 window v-splits most of the time so the inner window border highlights often don't provide good feedback for me (given a global statusline). Having the outer border highlighted also would solve this.
Hi there,
thanks for your work !
Is-it possible to change border size ? Because it's huge with my config.
Not sure, but it seems this behaviour is due to a conflict with Lualine status bar when set to vim.opt.laststatus = 2
Thanks, Flo
Hiya,
Your plugin is amazing as it makes it lot quicker to check which terminal is focused.
The problem is that the color is not that nice.
I am using lazy as nvim package manager.
I've tried to change background color but it doesn't seem to do anything with this.
return {
"nvim-zh/colorful-winsep.nvim",
config = true,
highlight = {
bg = '#4974a5',
fg = '#4974a5'
},
}
```'¨
Can you help?
I'm getting this error on startup ever since 39ecad5
packer.nvim: Error running config for colorful-winsep.nvim: ...rt/colorful-winsep.nvim/lua/colorful-winsep/comments.lua:19: bad argument #1 to 'pairs' (table expected, got nil)
Sometimes an error is reported when starting nvim.
/home/kumiko/.config/nvim/lua/plugins/ui.lua:6: Vim(append):Error executing lua callback: ...m/lazy/colorful-winsep.nvim/lua/colorful-winsep/view.lua:129: attempt to call field 'nvim_get_hl' (a nil value)
Plugin commit sha: 9270b5f
Neovim version: 0.8.3
I am getting the following error
when using the command :TaskWikiChoseTag
from taskwiki. The command is suposed to open an interactive vertical split. The split instead closes as soon as Enter (to acknowledge the erorr message) is pressed.
I can investigate later.
Smart idea on highlight active window with colorful lines.
I want to use it with:
https://github.com/akinsho/bufferline.nvim
The split line goes straight through bufferline tab plugin.lua
Hello, glad to offer such a great plugin.
I found a problem while using it. After enabling this plug-in, the exit preview operation of trouble.nvim cannot return to the original buf, and will only stay on the buf previewed last time.
Hey fam, Tysm for this plugin.
Everything was working perfectly until I accidently set via command :set signcolumn=number, and now I have this bug. Resetting back to :set signcolumn=yes didn't revert the bug :(
Prior to this, I set signcolumn=yes via vim api.
As the title suggests, when I am vsplit 2 windows, the winSeparator doesnt respect the status line as seen in this image.
The issue is really in the 2nd image. However, if you compare the first and the 2nd image, theres actually a tiny gap in the winsepartor that doesnt get highlighted at all.
Turning off my status line plugins and playing with laststatus doesn't really change anything.
And this bug is only for 2 vertically split screens. All other behaviour still works perfectly and I love this plugin sosososo much.
I think the code has been refactored a bit since the last issue mentioning this: #27
I have colorful-winsep
configured via lazy.nvim
to load on the WinNew
event. The first time in a particular buffer I open the command q:
window, it opens fine. The second time however, the follow error is shown:
Error 23:38:08 msg_show.lua_error Error executing vim.schedule lua callback: ...m/lazy/colorful-winsep.nvim/lua/colorful-winsep/view.lua:72: E11: Invalid in command-line window; <CR> executes, CTRL-C quits
stack traceback:
[C]: in function 'nvim_buf_delete'
...m/lazy/colorful-winsep.nvim/lua/colorful-winsep/view.lua:72: in function 'close_dividing'
...m/lazy/colorful-winsep.nvim/lua/colorful-winsep/view.lua:16: in function 'create_dividing_win'
...m/lazy/colorful-winsep.nvim/lua/colorful-winsep/view.lua:151: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
If I remove the event = { "WinNew" }
, the error is simply shown starting with first time I open the command window after opening vim.
Maybe this is due to calling nvim_buf_delete
on the command window? I looked into the stacktrace but i'm not really sure what's going on. Looks like there's already some special logic for handling a wintype of "command"
in some of the relevant functions.
minimal config below (copped from the lazy.nvim
minimal repro.lua
, you can run this with nvim -u repro.lua
:
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
-- add any other plugins here
{
"nvim-zh/colorful-winsep.nvim",
event = { "WinNew" },
opts = { highlight = { ctermfg = 2 } },
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
When using the plugin with a vertical split layout containing only two windows, it becomes difficult to discern which window is currently active because there is only a single dividing line between them. This can lead to confusion and inefficiency, as users might type or perform actions in the wrong window.
I would like to propose a feature where there is a more distinct visual cue to indicate the active window when only two windows are present in a vertical split layout.
At present, the plugin indicates the active window in a vertically split view by lighting up only half of the dividing line: the upper half if the right window is active, and the lower half if the left window is active. While this does provide an indication of which window is focused, the signal is quite subtle and can be easily overlooked.
This enhancement would greatly improve the user experience by making it easier to identify the active window at a glance, especially for users who frequently switch between only two vertical split windows.
Thank you for considering this feature request. I believe it would benefit many users of your plugin.
How can I hide the border colour when there is only one window opened including the nvim-tree border?
When mouse is enabled (set mouse=a
), one can left-click the window border and drag around to resize the window. However, when the border is visible (which is a floating window), mouse can't be used for resizing. We probably may need to emulate the mouse behavior.
The error:
Error executing vim.schedule lua callback: .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:229: Vim(append):Error executing lua callback: .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:23: 'bg' is not a valid color
https://github.com/nvim-zh/colorful-winsep.nvim/blob/main/lua/colorful-winsep/init.lua#L16
Seems like 112c732#diff-f91d374d8a5d29281a06126fb34125af0dc154e1e3245d87eabb619e70a47973R11-R18
added notification spam by default. Any particular reason why that is?
When opening the command-line window (q:), i get the following error message:
Error executing vim.schedule lua callback: .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:221: E11: Invalid in command-line window; <CR> executes, CTRL-C quits
stack traceback:
[C]: in function 'nvim_win_close'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:221: in function 'close_win_space'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:119: in function 'create_float_win'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:35: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
Error executing vim.schedule lua callback: .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:221: E11: Invalid in command-line window; <CR> executes, CTRL-C quits
stack traceback:
[C]: in function 'nvim_win_close'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:221: in function 'close_win_space'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:119: in function 'create_float_win'
.../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:35: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Context:
I have this create-event
function in my config that causing the error.
Steps to Reproduce:
Opening neovim with only one window and open the command history will reproduce the error, but opening the command history with more than 1 window will not.
Neovim Version:
NVIM v0.9.0-dev-647+g1df2db0bc
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compiled by runneradmin@fv-az612-44
Is there a way to change the color of active window based on the current mode? I would like to have a different color if the window in Insert mode or Visual mode, etc.
Error detected while processing WinClosed Autocommands for "*":
Error executing lua callback: ...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:29: Invalid window id: -1
stack traceback:
[C]: in function 'nvim_win_get_config'
...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:29: in function <...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:23>
Error executing lua callback: ...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:29: Invalid window id: -1
stack traceback:
[C]: in function 'nvim_win_get_config'
...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:29: in function <...lugged/colorful-winsep.nvim/lua/colorful-winsep/view.lua:23>
Press ENTER or type command to continue
mini.vim
set nocompatible
filetype plugin indent on
syntax on
set hidden
call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-zh/colorful-winsep.nvim'
call plug#end()
lua << EOF
require("colorful-winsep").setup({
no_exec_files = { "TelescopePrompt", "mason", "NvimTree" },
symbols = { "─", "│", "┌", "┐", "└", "┘" },
})
EOF
Error:
Error executing vim.schedule lua callback: .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:232: Vim(wincmd):E16: Invalid range: 5 wincmd w stack traceback: [C]: in function 'nvim_command' .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:232: in function 'direction_have' .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:129: in function 'create_float_win' .../start/colorful-winsep.nvim/lua/colorful-winsep/init.lua:38: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>
What is interesting is the harpoon command list opens fine:
Would it be possible to pass a file type exclusion table to the setup function?
Hello~ I'm using your plugin, and I saw that you have submitted the latest code. However, when I use lazy.nvim
update, I get the following error every time I start up the split screen👇🏻
And I am using the default configuration:
{
"nvim-zh/colorful-winsep.nvim",
config = true,
event = { "WinNew" },
}
Everything went back to normal after I removed it,what can I do to solve this question? Thank you very much!
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.