denstiny / colorful-winsep.nvim

Make your window separators colorful

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

colorful-winsep.nvim

2022-10-31.23-10-01.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
  highlight = {
    bg = "#16161E",
    fg = "#1F3442",
  },
  -- timer refresh rate
  interval = 30,
  -- 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 = { "", "", "", "", "", "" },
  close_event = function()
    -- Executed after closing the window separator
  end,
  create_event = function()
    -- Executed after creating the window separator
  end,
})

API function

  • NvimSeparatorDel: close active window separtors.
  • NvimSeparatorShow: show active window separtors (cannot be used on already activated windows)

FAQ

How to disable this plugin for nvim-tree #8

  create_event = function()
    local win_n = require("colorful-winsep.utils").calculate_number_windows()
    if win_n == 2 then
      local win_id = vim.fn.win_getid(vim.fn.winnr('h'))
      local filetype = api.nvim_buf_get_option(vim.api.nvim_win_get_buf(win_id), 'filetype')
      if filetype == "NvimTree" then
        colorful_winsep.NvimSeparatorDel()
      end
    end
  end

TODO list

  • Refactor more delicate logic for creating floating windows
  • will provide enable and disable api create_event and close_event

License

This plugin is released under the MIT License.

visitors

About

Make your window separators colorful

License:MIT License


Languages

Language:Lua 100.0%