b61afc44e6
* docs: fix typo in component notice * refactor: rename typo param 'pattern' * docs: fix comments typos across project files Cleanup misspellings and wording in comment lines. * docs: improve readability of `CONTRIBUTING.md` * docs: improve readability of `README.md` - Minor typos - Clarify information - Separate sections from paragraphs * docs: add newline below headers in `THEMES.md` Aim's to be consistent with other documents. * docs: fix unname tabpage command reference * docs: reword 'directly bused' for `setup_theme()` * docs: fix extra indent in contribution list * docs: more separation in readme/tabs, remove extra backtick * docs: further improve wording for `setup_theme` * docs: improve wording for `setup` function * docs: missing underscore in lualine/config
36 lines
986 B
Lua
36 lines
986 B
Lua
local Window = require('lualine.components.buffers.buffer'):extend()
|
|
|
|
---initialize a new buffer from opts
|
|
---@param opts table
|
|
function Window:init(opts)
|
|
assert(opts.winnr, 'Cannot create Window without winnr')
|
|
opts.bufnr = vim.api.nvim_win_get_buf(opts.winnr)
|
|
|
|
Window.super.init(self, opts)
|
|
|
|
self.winnr = opts.winnr
|
|
self.win_number = vim.api.nvim_win_get_number(self.winnr)
|
|
end
|
|
|
|
function Window:is_current()
|
|
return vim.api.nvim_get_current_win() == self.winnr
|
|
end
|
|
|
|
function Window:apply_mode(name)
|
|
if self.options.mode == 0 then
|
|
return string.format('%s%s%s', self.icon, name, self.modified_icon)
|
|
end
|
|
|
|
if self.options.mode == 1 then
|
|
return string.format('%s %s%s', self.win_number, self.icon, self.modified_icon)
|
|
end
|
|
|
|
return string.format('%s %s%s%s', self.win_number, self.icon, name, self.modified_icon)
|
|
end
|
|
|
|
function Window:configure_mouse_click(name)
|
|
return string.format('%%%s@LualineSwitchWindow@%s%%T', self.win_number, name)
|
|
end
|
|
|
|
return Window
|