Skip to content

simonmclean/pretty-vanilla-tabline.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🌈 pretty-vanilla-tabline.nvim

Minimal plugin which makes the neovim tabline pretty and configurable, while maintaining default functionality.

Turn this monstrosity 🤮

Default tabline

into this spectacle of superlative beauty 🤩

Plugin tabline

🤔 What this plugin does

Using default configuration your tab titles will consist of

<filetype_icon> <filename or filetype> [<number_of_windows_in_tab>] <modified_buffer_indicator>

The filename and filetype will refer to the active window of each tab. Filename will take priority over filetype.

See below for how to change this display configuration.

📦 Installation

-- Example installation using Packer
use "simonmclean/pretty-vanilla-tabline.nvim"
use "kyazdani42/nvim-web-devicons" -- optional, if you want icons to work out of the box

-- Initialize
require "pretty-vanilla-tabline".setup()

⚙️ Configuration

filetype_icons

If you have nvim-web-devicons installed, pretty-vanilla-tabline will try to use require 'nvim-web-devicons'.get_icon_by_filetype for the icons. But some filetypes won't have an associated icon. In such cases no icon will be shown, unless you specify one. For example, if you want to use the git icon for the fugitive filetype.

require 'pretty-vanilla-tabline'.setup {
  filetype_icons = {
    fugitive = require 'nvim-web-devicons'.get_icon_by_filetype('git')
  },
}

formatter

Use this to change how the icon, title, window count, and modified buffer indicator are displayed.

require 'pretty-vanilla-tabline'.setup {
  formatter = function(icon, title, win_count, is_dirty)
    local str = ""
    if (icon) then
      str = icon .. " "
    end
    str = str .. title .. " [" .. win_count .. "]"
    if (is_dirty) then
      str = str .. " +"
    end
    return str
  end,
}

This can of course be used to remove elements as well. For example if you don't want to display the window count, just don't include it in the returned string.

highlight_groups

Change which highlight groups are used. If you set this option you must provide a value for every element in the table.

A highlight group basically consists of a background colour and a foreground/text colour, and will be set by your colorscheme. To browse them use :highlight or, if you have Telescope installed, :Telescope highlights.

require 'pretty-vanilla-tabline'.setup {
  highlight_groups = {
    tab = 'TabLine',
    active_tab = 'TabLineSel',
    tabline_bg = 'TabLineFill',
  }
}

empty_window_title

Override the text to display for empty windows (like when you do :tabnew)

require 'pretty-vanilla-tabline'.setup {
  empty_window_title = '[empty window]'
}

🙋 Q&A

Why another tabline plugin?

Many other plugins are based around fundamentally changing what the (neo)vim tabline is. While some may allow you to preserve default functionality, they are either quite large, complex plugins, or just don't provide what I'm looking for.

The goal of pretty-vanilla-tabline is to create a minimal plugin, which allows the user to customise how tabs look and what information they display, while preserving the vanilla tabline experience.

How do I change highlighting within tabs?

If you'd like to control highlight colours within tabs, you can use vim's funky highlighting syntax in the formatter function. Here's an example of applying the CurSearch highlight group to the "+" indicator.

local function with_highlight_group(group_name, str)
  return '%#' .. group_name .. '#' .. str
end

require 'pretty-vanilla-tabline'.setup {
  formatter = function(icon, title, win_count, is_dirty)
    local str = title
    if (is_dirty) then
      str = str .. with_highlight_group('CurSearch', ' +')
    end
    return str
  end,
}

You can of course create your own highlight groups to use. See :h nvim_set_hl

About

Plugin to make the tabline pretty

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages