Git Product home page Git Product logo

incline.nvim's Introduction

๐ŸŽˆ incline.nvim

License: MIT Test Status

Incline is a plugin for creating lightweight floating statuslines. It works great with Neovim's global statusline (:set laststatus=3).

Why use Incline instead of Neovim's built-in winbar? Incline:

  • Only takes up the amount of space it needs, leaving more room for your code.
  • Is highly configurable and themeable using Lua.
  • Can be shown/hidden dynamically based on cursor position, focus, buffer type, or any other condition.
  • Can be positioned at the top or bottom, left or right side of each window.

Screenshot of Incline.nvim running in Neovim

Configuration

The render function is the most important part of an Incline configuration. As the name suggests, it's called for each window in order to render its statusline. You can think of it like a React component: it's passed a table of props and returns a tree-like data structure describing the content and appearance of the statusline. For example:

render = function(props)
  local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
  local modified = vim.bo[props.buf].modified
  return {
    ' ',
    filename,
    modified and { ' *', guifg = '#888888', gui = 'bold' } or '',
    ' ',
    guibg = '#111111',
    guifg = '#eeeeee',
  }
end

The returned value can be nil, a string, or a table which can include strings, highlight properties like foreground/background color, or even nested tables. Nested tables can contain the same sorts of things, including more nested tables. If the render function returns nil, the statusline will be hidden until the next time the render function returns a non-nil value. For more on the render function, see :help incline-render.

Below are some examples to get you started.

Icon + Filename

Screenshot

Requires nvim-web-devicons.

View Code
local helpers = require 'incline.helpers'
local devicons = require 'nvim-web-devicons'
require('incline').setup {
  window = {
    padding = 0,
    margin = { horizontal = 0 },
  },
  render = function(props)
    local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
    if filename == '' then
      filename = '[No Name]'
    end
    local ft_icon, ft_color = devicons.get_icon_color(filename)
    local modified = vim.bo[props.buf].modified
    return {
      ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '',
      ' ',
      { filename, gui = modified and 'bold,italic' or 'bold' },
      ' ',
      guibg = '#44406e',
    }
  end,
}

Icon + Filename + Navic

Screenshot

Requires nvim-web-devicons and nvim-navic.

View Code
local helpers = require 'incline.helpers'
local navic = require 'nvim-navic'
local devicons = require 'nvim-web-devicons'
require('incline').setup {
  window = {
    padding = 0,
    margin = { horizontal = 0, vertical = 0 },
  },
  render = function(props)
    local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
    if filename == '' then
      filename = '[No Name]'
    end
    local ft_icon, ft_color = devicons.get_icon_color(filename)
    local modified = vim.bo[props.buf].modified
    local res = {
      ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '',
      ' ',
      { filename, gui = modified and 'bold,italic' or 'bold' },
      guibg = '#44406e',
    }
    if props.focused then
      for _, item in ipairs(navic.get_data(props.buf) or {}) do
        table.insert(res, {
          { ' > ', group = 'NavicSeparator' },
          { item.icon, group = 'NavicIcons' .. item.type },
          { item.name, group = 'NavicText' },
        })
      end
    end
    table.insert(res, ' ')
    return res
  end,
}

Diagnostics + Git Diff + Icon + Filename

Screenshot

Requires nvim-web-devicons and gitsigns.nvim.

Credit: @lkhphuc (Discussion)

View Code
local devicons = require 'nvim-web-devicons'
require('incline').setup {
  render = function(props)
    local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
    if filename == '' then
      filename = '[No Name]'
    end
    local ft_icon, ft_color = devicons.get_icon_color(filename)

    local function get_git_diff()
      local icons = { removed = '๏‘˜', changed = '๏‘™', added = '๏‘—' }
      local signs = vim.b[props.buf].gitsigns_status_dict
      local labels = {}
      if signs == nil then
        return labels
      end
      for name, icon in pairs(icons) do
        if tonumber(signs[name]) and signs[name] > 0 then
          table.insert(labels, { icon .. signs[name] .. ' ', group = 'Diff' .. name })
        end
      end
      if #labels > 0 then
        table.insert(labels, { 'โ”Š ' })
      end
      return labels
    end

    local function get_diagnostic_label()
      local icons = { error = '๏€', warn = '๏ฑ', info = '๏š', hint = '๏ ด' }
      local label = {}

      for severity, icon in pairs(icons) do
        local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
        if n > 0 then
          table.insert(label, { icon .. n .. ' ', group = 'DiagnosticSign' .. severity })
        end
      end
      if #label > 0 then
        table.insert(label, { 'โ”Š ' })
      end
      return label
    end

    return {
      { get_diagnostic_label() },
      { get_git_diff() },
      { (ft_icon or '') .. ' ', guifg = ft_color, guibg = 'none' },
      { filename .. ' ', gui = vim.bo[props.buf].modified and 'bold,italic' or 'bold' },
      { 'โ”Š ๏€‰ ' .. vim.api.nvim_win_get_number(props.win), group = 'DevIconWindows' },
    }
  end,
}

More Examples

See more user-contributed configurations and share your own in the Showcase.

Installation

Lazy.nvim:

{
  'b0o/incline.nvim',
  config = function()
    require('incline').setup()
  end,
  -- Optional: Lazy load Incline
  event = 'VeryLazy',
},

Packer:

use "b0o/incline.nvim"

Usage

require('incline').setup()

Configuration

Incline's default configuration:

require('incline').setup {
  debounce_threshold = {
    falling = 50,
    rising = 10
  },
  hide = {
    cursorline = false,
    focused_win = false,
    only_win = false
  },
  highlight = {
    groups = {
      InclineNormal = {
        default = true,
        group = "NormalFloat"
      },
      InclineNormalNC = {
        default = true,
        group = "NormalFloat"
      }
    }
  },
  ignore = {
    buftypes = "special",
    filetypes = {},
    floating_wins = true,
    unlisted_buffers = true,
    wintypes = "special"
  },
  render = "basic",
  window = {
    margin = {
      horizontal = 1,
      vertical = 1
    },
    options = {
      signcolumn = "no",
      wrap = false
    },
    overlap = {
      borders = true,
      statusline = false,
      tabline = false,
      winbar = false
    },
    padding = 1,
    padding_char = " ",
    placement = {
      horizontal = "right",
      vertical = "top"
    },
    width = "fit",
    winhighlight = {
      active = {
        EndOfBuffer = "None",
        Normal = "InclineNormal",
        Search = "None"
      },
      inactive = {
        EndOfBuffer = "None",
        Normal = "InclineNormalNC",
        Search = "None"
      }
    },
    zindex = 50
  }
}

See incline.txt for full documentation of all configuration options.

License

ยฉ 2022-2024 Maddison Hellstrom and contributors

Released under the MIT License.

incline.nvim's People

Contributors

b0o avatar deresmos avatar syphar avatar willothy avatar zioroboco avatar zyriab 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  avatar  avatar  avatar  avatar  avatar

incline.nvim's Issues

[Bug] Winhighlight is passed on to quickfix window

Hi ๐Ÿ‘‹๐Ÿพ,

Big fan on your work on this plugin, been really enjoying using it ๐Ÿ’ฏ
Today I noticed a weird bug which I have seen once or twice before but repeated several times for me today. So I have incline configured as

    use {
      'b0o/incline.nvim',
      config = function()
        require('incline').setup {
          hide = {
            focused_win = true,
          },
          window = {
            options = {
              winhighlight = 'Normal:Search',
            },
          },
        }
      end,
    }

and have also set up nvim-bqf using

use {
      'kevinhwang91/nvim-bqf',
      ft = 'qf',
    }

I've noticed today that when I run a grep command which opens the quickfix list, it takes on the winhighlight of incline. I don't know whether the magic window bqf creates trips up incline somehow or what. It's only really noticeable for me now because I changed the winhiglight to quite an unmissable highlight colour.

Let me know if this isn't enough to reproduce it. I'm hoping it's really just running any quickfix command with both plugins setup and the winhighlight will be enough to trigger the issue

Scrolling performance impact when incline is enabled

Thanks for the awesome plugin! I've noticed that while holding C-e/y or C-j/k, if incline is enabled, nvim can't keep up with a 120hz display and I get stutter both in Kitty and Neovide. When I disable incline, the problem goes away. Is it doing work while scrolling that could be paused? Thanks.

Hide Incline when there is just one window

Hello there!

I'm loving the plugin, it's really handy with the new global status bar.
My only problem with it is that I see no point in showing it when there is just one window (expected behaviour for me is: 1 window => Hide | 2 or more windows => Show)

I have cloned it and tried to implement it myself but not there yet ๐Ÿ˜…

Maybe you feel this is not necessary, feel free to close it then!

Have a nice day and thanks for the plugin!

Refresh on FocusLost & FocusGained

It looks like incline.nvim doesn't refresh on the FocusLost or FocusGained events. I was able to work around this with the following configuration:

vim.api.nvim_create_autocmd({'FocusLost', 'FocusGained'}, {
     callback = function()
         require('incline').enable()
     end,
})

but it might make sense to add those two events as default refresh events.

Bug: Incline disable doesn't consistently work with tabs

Description

lua require("incline").disable() doesn't consistently work when using multiple tabs. Toggling between the enabled and disabled state, incline is sometimes not hidden.

Steps to reproduce

  1. Open a file in Neovim
  2. :tabnew
  3. :lua require("incline").disable()
  4. :lua require("incline").enable()

Repeat steps 3 and 4 and observe the disable command has no effect after a while. For me, it consistently stops working after I disable, enable, and disable again. Works fine when only using one tab.

Related issue: #51.

[BUG] How To Work with Goyo?

Hi @b0o ,

There is a small issue that I notice when I use this with the great plugin Goyo.vim. Currently, here is how my incline looks:
image

As you can see, the incline bar is in the top right of each window with its background color matched to my colorscheme. Then I activate Goyo:

image

Incline disappears as expected which is cool! Then when I quit Goyo:

image

The window background color gets cleared and resets to what are incline's defaults.

How should I restore my configuration for incline after quitting Goyo?

Here is my Incline configuration:

require('incline').setup {
	debounce_threshold = {
		falling = 50,
		rising = 10
	},
	hide = {
		cursorline = false,
		focused_win = false,
		only_win = true -- Hide incline if only one window in tab
	},
	highlight = {
		groups = {
			InclineNormal = {
				default = true,
				group = "NormalFloat"
			},
			InclineNormalNC = {
				default = true,
				group = "NormalFloat"
			}
		}
	},
	ignore = {
		buftypes = "special",
		filetypes = {},
		floating_wins = true,
		unlisted_buffers = true,
		wintypes = "special"
	},
	render = function(props)
		local fname = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
		local colors = require('gruvbox.palette')

		if props.focused == true then
			return {
				{
					fname,
					guibg = colors.dark0_hard,
					guifg = colors.light1
				}
			}
		else
			return {
				{
					fname,
					guibg = colors.dark0_hard,
					guifg = colors.dark4
				}
			}
		end
	end,
	window = {
		margin = {
			horizontal = 1,
			vertical = 2
		},
		options = {
			signcolumn = "no",
			wrap = false
		},
		padding = 0,
		padding_char = " ",
		placement = {
			horizontal = "right",
			vertical = "top"
		},
		width = "fit",
		winhighlight = {
			active = {
				EndOfBuffer = "None",
				Normal = "InclineNormal",
				Search = "None"
			},
			inactive = {
				EndOfBuffer = "None",
				Normal = "InclineNormalNC",
				Search = "None"
			}
		},
		zindex = 50
	}
}

And here is my configuration for Goyo:

vim.g.goyo_width = '85%' -- Default width
vim.g.goyo_height = '90%' -- Default height

vim.cmd [[
function! s:goyo_enter()
  " Hides mode from showing
  set noshowmode 

  " Hides the sign column
  :set scl=no 

  " Hides lualine
  lua require"lualine".hide() 

  " ...
endfunction
function! s:goyo_leave()
  " Resets syntax highlighting (workaround for goyo bug)
  syntax off 
  syntax on 

  " Makes the signcolumn match the background colorscheme
  highlight clear SignColumn

  " Brings mode back
  set showmode 

  " Shows lualine again
  lua require"lualine".hide({unhide=true})

  " ...
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
]]

Thanks!

Dynamically add separators

I'd like to render several sections which are all optional (diagnostics, Aerial breadcrumbs, filename only if more than one window is open), and add separator characters between them.

It doesn't seem like there's a way to do this with the plugin, would you consider adding it as an option? It could just be a single string that gets inserted between non-empty sections.

I could do this formatting myself inside render() and return the final string, but then I lose the ability to also set highlight groups. Unless I'm missing something?

How to Add rounded Edges ?

Hi!
I am using incline.nvim and i really like it so far !

I was wondering if it is possible to create rounded corners similar to my tmux status bar shown in the screenshot (top) and my lualine in neovim (bottom).

Appreciate any help !
Screenshot from 2024-03-02 01-06-08

Error message popping up

Hey,

I have a custom function that is called on a keymap and waits for user input with getchar(). While neovim waits for the char from getchar(), it seems incline tries to do some work but isn't allowed due to the context. Is it possible to either fix, or if it's simpler catch and hide the errors below:

image

Thanks

The position of the float win becomes wrong (offset by one column upward) after updating to the `a43a250`

nvim version 0.7 release

my config:

    local incline_setup_table = {
        highlight = {
            groups = {
                InclineNormal = 'lualine_a_normal',
                InclineNormalNC = 'lualine_a_normal',
            },
        },
        hide = {
            focused_win = true,
        },
        window = {
            width = 'fill',
            placement = {
                vertical = 'bottom',
                horizontal = 'center',
            },
            margin = {
                horizontal = {
                    left = 0,
                    right = 0,
                },
            },
            padding = {
                left = 1,
                right = 1,
            },
            zindex = 10,
        },
    }

    require('incline').setup(incline_setup_table)

Screen Shot 2022-05-22 at 10 05 15

It is clearly shown that the floatwin is offset by one column upward.
It should be at the bottommost column at each window

[Bug] Setting z index throws an error

Hi,

Sorry for the influx of feedback ๐Ÿ˜…. I noticed today whilst trying to get incline to stop overlaying telescope by dropping the z index that setting the z index causes an error to be thrown. It looks like the options in the window table are passed to the set window options wrapper function and since zindex is not a valid window key in normal circumstances it throws an error

Error executing vim.schedule lua callback: ...site/pack/packer/start/incline.nvim/lua/incline/util.lua:128: Error executing lua: ...site/pack/packer/start/incline.nvim/lua/incline/u
til.lua:136: Vim(setlocal):E518: Unknown option: zindex=49                                                                                                                           
stack traceback:                                                                                                                                                                     
        [C]: in function 'cmd'                                                                                                                                                       
        ...site/pack/packer/start/incline.nvim/lua/incline/util.lua:136: in function <...site/pack/packer/start/incline.nvim/lua/incline/util.lua:128>                               
        [C]: in function 'nvim_win_call'                                                                                                                                             
        ...site/pack/packer/start/incline.nvim/lua/incline/util.lua:128: in function 'win_set_local_options'                                                                         
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:141: in function 'refresh'                                                                                       
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:150: in function 'win'                                                                                           
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:199: in function 'render'                                                                                        
        ...e/pack/packer/start/incline.nvim/lua/incline/tabpage.lua:70: in function 'update'                                                                                         
        ...e/pack/packer/start/incline.nvim/lua/incline/manager.lua:59: in function 'fn'                                                                                             
        .../pack/packer/start/incline.nvim/lua/incline/debounce.lua:36: in function 'immediate'                                                                                      
        .../pack/packer/start/incline.nvim/lua/incline/debounce.lua:19: in function ''                                                                                               
        vim/_editor.lua: in function ''                                                                                                                                              
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                                                             
stack traceback:                                                                                                                                                                     
        [C]: in function 'nvim_win_call'                                                                                                                                             
        ...site/pack/packer/start/incline.nvim/lua/incline/util.lua:128: in function 'win_set_local_options'                                                                         
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:141: in function 'refresh'                                                                                       
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:150: in function 'win'                                                                                           
        ...e/pack/packer/start/incline.nvim/lua/incline/winline.lua:199: in function 'render'                                                                                        
        ...e/pack/packer/start/incline.nvim/lua/incline/tabpage.lua:70: in function 'update'                                                                                         
        ...e/pack/packer/start/incline.nvim/lua/incline/manager.lua:59: in function 'fn'                                                                                             
        .../pack/packer/start/incline.nvim/lua/incline/debounce.lua:36: in function 'immediate'                                                                                      
        .../pack/packer/start/incline.nvim/lua/incline/debounce.lua:19: in function ''                                                                                               
        vim/_editor.lua: in function ''                                                                                                                                              
        vim/_editor.lua: in function <vim/_editor.lua:0>                        

Incline "jumps" when closing

When closing a window, the incline statusline jumps to the left or top (it depends on the position of the window being closed) for a few milliseconds before disappearing. Any ideas what could be causing this :D?

[Feature request] Allow specifying a border

Hi,

Not sure if there's a specific implementation reason to avoid this, but I'm essentially trying to draw a bottom border on the window line to demarcate it a bit better from the buffer content rather than changing the colour of the window, which over time I've found too distracting on a small laptop screen. I tried overwriting the window config in a filetype autocommand (which didn't work), but I personally dislike that way of setting options anyway and think an explicit option would be much nicer.

Screen Shot 2022-05-07 at 08 01 56

Hide label if cursor is directly within the label area

Discussed in #66

Originally posted by MatejBransky April 2, 2024
Hello, thanks for the plugin ๐Ÿ™ , it's really awesome. ๐ŸŽ‰

However, I'm trying to figure out how I could keep the label even when I'm hovering over the first row and the cursor isn't on the label itself. ๐Ÿค”

Is it possible in the current version already? ๐Ÿ™‚

Incline behind neo-tree floating window

I want incline.nvim's floating statusline to be behind neo-tree's floating window, to avoid overlapping issues as below:

image

I've tried increasing the zindex of neo-tree to 1000, keeping incline.nvim's default at 50, but it doesn't seem to work. Is there another way to achieve my desired effect (or a fix)?

Supress overlaping if statement

How can I suppress the below overlaping if statement in 'winline.lua' config file?
I use lspsaga and I'd like to align incline at the same line of the lspsaga breadcumb. This is prevent achieving this...

if cw.margin.vertical.top == 0 and (vim.o.laststatus ~= 3 or a.nvim_win_get_position(self.target_win)[1] <= 1) then return 1 end

Removing this statement, I can get this (not overlaping tab bar):

incline_top-margin

Thx in advance!

Hide on cursorline does not work without tabs

Hey @b0o I've been really enjoying Incline.nvim.

Reproduction

      require("incline").setup({
        hide = {
          cursorline = true,
        },
        window = {
          margin = {
            vertical = 0,
          },
        },
      })
  1. Open a new file without tabs

Expected

Incline to hide when cursor is inline with the file name.

Actual

Incline doesn't hide filename.

No module called incline.helpers

I copied one of the configs (the one involving nvim-navic and it tells me that incline.helpers doesn't exist and I don't understand why? I am on Neovim nightly

Change indicator support?

Hi! I love this plugin.

It would be great to have indicators on the changed files like * filename.lua.
Is it possible?

Add Option `hide > inactive_window`

I've used lualine before and I could hide the status line in inactive window, why doesn't incline have such functionality?

When I split the current window vertically, I see the incline status message on both windows, which is annoying.

image

can the filename include the folder?

in many projects (web, esp) there are "index" files, it'd be nice to be able to configure having the folder show up so there is some context as to which index file

wrong position of window line when setting `width = 'fill'` unless setting `placement.horizontal = 'center'`

example config:

require('incline').setup {
        window = {
            width = 'fill',
            placement = {
                vertical = 'bottom',
            },
            margin = {
                horizontal = {
                    left = 0,
                    right = 0,
                },
            },
            padding = {
                left = 0,
                right = 0,
            },
        },
    }

when there are two windows, the window line for the window that is focused is left shifted (my focus is on the right window):

Screen Shot 2022-05-05 at 03 13 08

however, adding placement,horizontal = 'center' solves the issue. I guess the inner logic doesn't handle the width = fill case with placement.horizontal

Powerline symbols on ends

I would like to use Powerline symbols such as U+E0BC/E0BC (upper left and right triangle) on the ends of the winline, to make it a trapezoid instead of rectangle. But these work poorly on a nontransparent background, and I don't know how to set the background to transparent without messing up the rest of the display. Any idea on how to do this?

Somewhat similar to #13, and might be implementable through it, by setting only left and right border and fiddling with hl-FloatBorder.

Placement

Had the same idea after global status line got merged in. Did not get that far though. Well done! I was originally thinking of displaying only the filename (as you did, but without spanning entire window) in right top corner of each but current window (so they don't obstruct anything. What do you think about it?

Highlight group not found error

I am getting an highlight group not found: InclineNormal error after installing incline.nvim with the following config:

local colors = require("kanagawa.colors").setup().theme
require("incline").setup({
  highlight = {
    groups = {
      InclineNormal = {
        guibg = colors.sumilink0,
        guifg = colors.peachRed,
      },
      InclineNormalNC = {
        guibg = colors.sumilink0,
        guibg = colors.sumiInk4,
      },
    },
  },
  window = { margin = { vertical = 0, horizontal = 1 } },
  render = function(props)
    local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
    local icon, color = require("nvim-web-devicons").get_icon_color(filename)
    return { { icon, guifg = color }, { " " }, { filename } }
  end,
})

It all works fine if I remove the content of groups (i.e, set it to groups = {}.

This is the full error message:

...l/share/nvim/lazy/incline.nvim/lua/incline/highlight.lua:38: nvim_exec()..BufReadPre Autocommands for "*"..script nvim_exec() called at BufReadPre Autocommands for "*":0: Vim(highlight):E411: highlight group not found: InclineNormal

# stacktrace:
  - /incline.nvim/lua/incline/highlight.lua:38 _in_ **register**
  - /incline.nvim/lua/incline/highlight.lua:67 _in_ **setup**
  - /incline.nvim/lua/incline/init.lua:12 _in_ **enable**
  - /incline.nvim/lua/incline/init.lua:31 _in_ **setup**
  - lua/plugins/incline.lua:7 _in_ **config**
  - /telescope.nvim/lua/telescope/actions/set.lua:168 _in_ **run_replace_or_original**
  - /telescope.nvim/lua/telescope/actions/mt.lua:65 _in_ **run_replace_or_original**
  - /telescope.nvim/lua/telescope/actions/mt.lua:65 _in_ **run_replace_or_original**
  - /telescope.nvim/lua/telescope/actions/mt.lua:65 _in_ **key_func**
  - /telescope.nvim/lua/telescope/mappings.lua:350 _in_ **execute_keymap**
  - lua/:1

Am I doing something wrong here?

Incline disappears after switching tabs

Staying in one tab and creating windows works as expected, however, the second I swap off the existing tab, incline no longer provides the filenames. Here are a couple of screenshots detailing the behavior:

Before tab creation

File names are visible at the top right of every window (expected):
Screen Shot 2022-05-14 at 6 15 32 PM

After tab creation

The [No Name] buffer name is now visible at the top right (expected):
Screen Shot 2022-05-14 at 6 15 49 PM

Swapping back to first tab

Incline no longer shows the file names for each of the open windows:
Screen Shot 2022-05-14 at 6 16 00 PM

Besides this one bug, the plugin looks great so far! Your work is much appreciated and I can't wait to fully transition to the new global status line.

Make updating event configurable

If I loop a table in render function, each time debounce time hit, render function will rerun, which is a waste of cpu, and I'd like to make render function only run when I enter nomal mode, is it possible?
For example, I'd like to only show the severiest diagnostic, so I'm looping a table, as soon as I found one, break the loop. But the debounce time makes the behaviour unable to determine, because maybe when it loops to info, gets a n>0, breaks the loop, so that possible error is ignored

                                local function get_diagnostic_label()
                    local icons = {
                        Error = "๏€",
                        Warn = "๏ฑ",
                        Info = "๏š",
                        Hint = "๏ ด",
                    }

                    local label = {}
                    for severity, _ in pairs(icons) do
                        local n = #vim.diagnostic.get(
                            props.buf,
                            { severity = vim.diagnostic.severity[string.upper(severity)] }
                        )
                        if n > 0 then
                            label = {
                                { " ๎ญฅ  " }, -- ๅ‰็ผ€ๅ›พๆ ‡
                                {
                                    n,
                                    group = "DiagnosticSign" .. severity,
                                },
                            }
                            break
                        end
                    end
                    return label
                end

Allow overlapping window borders with `window.placement.vertical = "bottom"` as well

:h incline-config-window.margin.vertical states that:

If window.placement.vertical is top and 'laststatus' is 3, you can set
window.margin.vertical.top to 0 to allow Incline statuslines to overlap
window borders.

Is it possible to get the same behaviour with window.placement.vertical = "bottom" as well? I.e. if there for instance is a two-way horizontal split, place the top window's incline over the window border (below that window), and the bottom window's incline in a floating window at the bottom of that window.

How to trigger a rerender?

When I reset my hlsearch with :nohlsearch, incline is not updating until I move my cursor. My current fix is to add a jk movement after :nohlsearch, but then the cursor moves and flickers after executing my command. I need a way to rerender incline. How do I do that?

Unresponsiveness on events

Hi! Wanted to ask you if the following is intended behaviour:

Screen.Recording.2024-03-14.at.10.52.32.mov

Whenever I change modes in my editor, incline (generally) won't update my mode signifier even when the editor already detected that event (see mode status at the bottom of my buffer). This is my configuration of incline.nvim:

      --- Setup incline filename statusbar
      ---@return nil
      local setup_incline = function()
        -- Get current colorscheme `Normal` highlight group
        local utils = require("mateo.utils")
        local hsl = require("lush.hsl")
        local fg = utils.get_hl_group_hex("Normal", "foreground")
        local bg = utils.get_hl_group_hex("Normal", "background")

        -- Setup `incline`
        local incline = require("incline")
        incline.setup({
          window = {
            padding = 0,
            placement = {
              horizontal = "center",
              vertical = "bottom",
            },
          },
          render = function(props)
            local bufname = vim.api.nvim_buf_get_name(props.buf)
            local res = bufname ~= "" and vim.fn.fnamemodify(bufname, ":t") or bufname
            if vim.bo[props.buf].modified then res = "* " .. res end
            return {
              "๎‚ถ",
              {
                utils.get_mode(),
                " ยท ",
                res,
                guifg = fg,
                guibg = hsl(bg).darken(10).hex,
                gui = "bold",
              },
              "๎‚ด",
              guifg = hsl(bg).darken(10).hex,
              guibg = "none",
            }
          end,
          hide = { cursorline = true },
        })
        vim.on_key(incline.refresh(), 0)
      end

      -- Launch statusline
      vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
        pattern = { "*" },
        callback = setup_incline,
      })
    end,

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.