From 7641a0d3e4339e981eed1980e538eb5f2fe0acd8 Mon Sep 17 00:00:00 2001 From: Alvaro Sevilla Date: Mon, 5 Jul 2021 11:11:23 +0100 Subject: Update README --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 8a0fcd1..087577e 100644 --- a/README.md +++ b/README.md @@ -1 +1,27 @@ # luatab.nvim + +## Usage +Add this to your init.lua: + +``` +Tabline = require'tabline'.tabline +vim.cmd[[ set tabline=%!luaeval('Tabline()') ]] +``` + +Note: `require'tabline'.tabline` must be assigned to a global variable for it to be picked up by `luaeval` + +You can also define your own tabline function using the provided functions for help. The default tabline is equivalent to: +``` +local formatTab = require'luatab'.formatTab +Tabline = function() + local i = 1 + local line = '' + while i <= vim.fn.tabpagenr('$') do + line = line .. formatTab(i) + i = i + 1 + end + return line .. '%T%#TabLineFill#%=' +end +``` + + -- cgit v1.2.3