Giter Site home page Giter Site logo

colorful-winsep.nvim's Introduction

colorful-winsep.nvim

2024-02-22_12-43-34.mp4

configurable window separtor

Motivation

Currently in Neovim, we can not make the active window distinguishable via the window separator. This plugin will color the border of active window, like what tmux does for its different panes.

Requirements

Install

Using a plugin manager

Using vim-plug:

Plug 'nvim-zh/colorful-winsep.nvim'

Using Packer.nvim:

use {
    "nvim-zh/colorful-winsep.nvim",
    config = function ()
        require('colorful-winsep').setup()
    end
}

Using lazy.nvim

{
  "nvim-zh/colorful-winsep.nvim",
  config = true,
  event = { "WinNew" },
}

Default configuration

require("colorful-winsep").setup({
  -- highlight for Window separator
  hi = {
    bg = "#16161E",
    fg = "#1F3442",
  },
  -- This plugin will not be activated for filetype in the following table.
  no_exec_files = { "packer", "TelescopePrompt", "mason", "CompetiTest", "NvimTree" },
  -- Symbols for separator lines, the order: horizontal, vertical, top left, top right, bottom left, bottom right.
  symbols = { "", "", "", "", "", "" },
  -- Smooth moving switch
  smooth = true,
  exponential_smoothing = 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 },
 },
})

TODO

  • add marquee(nvim_buf_add_highlight())

License

This plugin is released under the MIT License.

colorful-winsep.nvim

colorful-winsep.nvim's People

Contributors

4513echo avatar 4542elgh avatar acehinnnqru avatar avvo-na avatar denstiny avatar distek avatar guxuerui avatar hanaasagi avatar jdhao avatar kevintraver avatar nela avatar nkakouros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

colorful-winsep.nvim's Issues

Error: invalid in command-line window.

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>

Highlighting with `cterm` colors getting overridden

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.

Vertical split and selecting right window breaks global statusline

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.

1. Create vertical split

Screenshot from 2023-05-28 21-13-30

2. Select window on right (statusline is accidentally split)

Screenshot from 2023-05-28 21-13-35

Opening `q:` will show an error

image

Context:
I have this create-event function in my config that causing the error.

image

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

[feature request] `min_windows` option

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,
}

[BUG]: `colorful-winsep` is on top of `lualine`

Hello,
Since latest updates, colorful-winsep is on top of lualine :
image

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 },
		},
	},
}

Error when opening harpoon list

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:
image

Would it be possible to pass a file type exclusion table to the setup function?

Border of top panel overlaps bottom panel

2024-02-27_13.57.07.mp4

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)

[Enhancement] Enhance Vertical Split Visual Clarity with Distinct Active Window Borders

Description

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.

Expected Behavior

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.

Current Behavior

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.
image

Steps to Reproduce

  1. Open the plugin and create a vertical split layout with two windows.
  2. Click between windows to change the focus.
  3. Observe that there is no clear indication of which window is active, other than the cursor location.

Additional Information

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.

Over-extending background

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.

Screenshot from 2024-04-26 16-48-43

Screenshot from 2024-04-26 16-48-54

Screenshot from 2024-04-26 16-48-59

conflict with window picker

image

there should be an "f" under the upper window, but blocked by winsep, i tried unload winsep and the "f" is back

my config :

-- windwo picker
  {
    "s1n7ax/nvim-window-picker",
    opts = {
      use_winbar = "smart",
    },
  },
  --win sep
  {
    "nvim-zh/colorful-winsep.nvim",
    config = true,
    event = { "WinNew" },
  },

Error: Window was closed immediately

I am getting the following error
image

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.

Lazy.nvim setup

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" },
  },

Error introduced with 39ecad5

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)

Opening `q:` will show an error

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")

[bug] after call NvimSeparatorDel, the color of win line not recovery

image

as the img show, when i use true-zen plugin, after open zen mode, then use NvimSeparatorDel command, the color is not recovery

vim.api.nvim_create_user_command("NvimSeparatorDel", function()
    M.colorful_winsep.NvimSeparatorDel()
end, { desc = "Delete the window separator" })

After using the latest code, there is an error message when I split window

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👇🏻

image

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!

Typo in the Lazy instructions?

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()?

Highlight color config not working

I'm trying to change the color of the window separator in the config but its not working, but manually changing the highlight group NvimSeparator works

  • highlight config #111111 but its still using the #a9b1d6 for some reason

image

  • did the highlight NvimSeparator guifg=#a94dc1

image

Bug

When you use :only command, being on the next or whatever split comes after the original buffer, the split breaks until you exit neovim.


Trying to change background color but it doesnt seem to work.

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?

Error when start: attempt to call field 'nvim_get_hl' (a nil value)

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)

2023-04-12_12-24

Plugin commit sha: 9270b5f
Neovim version: 0.8.3

Not compatible with mouse for resizing

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.

Conflict with trouble.nvim

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.

WinSeparator doesnt respect statusline

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.

winseptop
winsepbottom

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.

win

Set nofile

This plugins have potentially, but problem is that
if you try :qa
You wouldn't able to quit since it will complain about no write since last change or something

so you need to set nofile for each of those floating window

colofulwinsep

Change border size

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

[Feature request] Highlight outer border

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.

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.