Skip to content
This repository was archived by the owner on Apr 4, 2026. It is now read-only.

Configs

Lukas Pietzschmann edited this page Sep 6, 2025 · 4 revisions

Configs

This is a (hopefully growing) list of different configs submitted by other users, or thought of by me :)


This config will list full paths to the files relative to the current working directory. For files outside the cwd the full path is shown. Thanks to @hinell (#12)

require("telescope-tabs").setup({
	entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current)
		local entry_string = table.concat(vim.tbl_map(function(v)
			return vim.fn.fnamemodify(v, ":.")
		end, file_paths), ', ')
		return string.format('%d: %s%s', tab_id, entry_string, is_current and ' <' or '')
	end
})

If you're using tabby.nvim, this config might come in handy. With it installed, telescope-tabs will display the same name that tabby does. Thanks to @IceS2 (#14)

require("telescope-tabs").setup {
    entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current)
        local tab_name = require("tabby.feature.tab_name").get(tab_id)
        return string.format("%d: %s%s", tab_id, tab_name, is_current and " <" or "")
    end,
    entry_ordinal = function(tab_id, buffer_ids, file_names, file_paths, is_current)
       return require("tabby.feature.tab_name").get(tab_id)
    end
}

This configuration enables the integration of telescope-tabs with tabline.nvim in Neovim, providing a powerful and user-friendly tab management experience. The primary feature of this setup is the ability to list all tabs, where the currently active tab is indicated by a "<" symbol, and the active windows within each tab are marked with a "#" symbol. Thanks to @DaiterGG (#29)

require("telescope-tabs").setup {
  entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current)
    if vim.g.Tabline_session_data == nil then
      return
    end
    local TablineData = vim.fn.json_decode(vim.g.Tabline_session_data)

    local function find_tabpage_index(tab_id)
      local tabpages = vim.api.nvim_list_tabpages()
      for index, tp in ipairs(tabpages) do
        if tp == tab_id then
          return index
        end
      end
      return nil
    end
    local status_ok, tabpage_id = pcall(find_tabpage_index, tab_id)
    if not status_ok then
      print("telescope-tabs Error : or Not found correctly tab_id in nvim tab list")
      return
    end

    local tab_name = TablineData[tabpage_id].name
    -- require("tabby.feature.tab_name").get(tab_id)
    -- return string.format("%d: %s%s", tab_id, tab_id, is_current and " <" or "")

    -- Get the focused window's buffer ID for the current tab
    local focused_win = vim.fn.tabpagewinnr(tabpage_id)

    -- Iterate over file_names and add '<' if the corresponding buffer exists
    file_names[focused_win] = file_names[focused_win] .. " #"

    local entry_string = table.concat(file_names, ', ')
    return string.format('%d [%s]: %s%s', tabpage_id, tab_name, entry_string, is_current and ' <' or '')
  end,
  entry_ordinal = function(tab_id, buffer_ids, file_names, file_paths, is_current)
    -- return table.concat(file_names, ' ')
    if vim.g.Tabline_session_data == nil then
      return
    end
    local TablineData = vim.fn.json_decode(vim.g.Tabline_session_data)
    -- need require "user.tabpage" in config.lua
    local status_ok, tabpage_id = pcall(find_tabpage_index, tab_id)
    if not status_ok then
      return
    end

    -- return TablineData[tab_id].name
    local entry_string = table.concat(file_names, ', ')
    return string.format('%d %s %s', tabpage_id, TablineData[tabpage_id].name, entry_string)
    -- require("tabby.feature.tab_name").get(tab_id)
  end
}

Clone this wiki locally