abeldekat / harpoonline Goto Github PK
View Code? Open in Web Editor NEWHarpoon info for any statusline
License: Apache License 2.0
Harpoon info for any statusline
License: Apache License 2.0
formatter
to be more neutral.formatter
The options for the built-in formatters
are now in the configuration. Function gen_override
is not needed anymore and removed.
New example, overriding a builtin: Customize a built-in
Changed options for the extended formatter
:
separator
. Change the spacing inside the indicators instead. Allows for more flexibility.The following example setup has been removed:
local Harpoonline = require("harpoonline").setup()
Please use:
local Harpoonline = require("harpoonline")
Harpoonline.setup()
A small improvement.
The plugin only updates its data on the appropriate events.
However, the format function still constructs the line dynamically, using string.format
Solution: Cache that line, and use it when nothing has changed for harpoon.
There are breaking changes if the config of the user:
custom_formatter
functionempty_slots
( default empty ){ formatter = "extended" }
formatter_opts.extended
Previously:
Harpoonline.setup({
custom_formatter = Harpoonline.gen_formatter(
---@param data HarpoonLineData
---@return string
function(data)
-- create and return the line
end
),
})
Now:
opts
of type HarpoonlineConfig
Harpoonline.setup({
---@param data HarpoonlineData
---@param opts HarpoonLineConfig
---@return string
custom_formatter = function(data, opts)
-- create and return the line
end,
})
HarpoonLineData
is also changedChanged the name into HarpoonlineData
(lower l)
The data parameter for the custom_formatter
used to contain:
---@class HarpoonLineData
H.data = {
-- Harpoon's default list is in use when list_name = nil
--- @type string|nil
list_name = nil, -- the name of the current list
--- @type number
list_length = 0, -- the length of the current list
--- @type number|nil
buffer_idx = nil, -- the mark of the current buffer if harpooned
}
For more flexibility, the actual items in the harpoon list are now provided.
The length of the list can be inferred using #data.items
---@class HarpoonlineData
---@field list_name string|nil -- the name of the current list
---@field items HarpoonItem[] -- the items of the current list
---@field active_idx number|nil -- the harpoon index of the current buffer
See the examples in the readme.
Previously, the default formatter to use when not overridden in the config:
---@type "extended" | "short"
formatter = 'extended', -- use a builtin formatter
-- Corresponding opts: formatter_opts.extended
The name of the default formatter is now just "default"
---@type "default" | "short"
formatter = 'default', -- use a builtin formatter
-- Corresponding opts: formatter_opts.default
The config option for the extended formatter was already disabled:
formatter_opts = {
extended = {
-- 1 More indicators than items in the harpoon list:
empty_slot = '', -- ' · ', -- middledot. Disable using empty string
},
},
The option has been removed.
Previously:
-- formatter_opts.extended
{
-- An indicator corresponds to a position in the harpoon list
-- Suggestion: Add an indicator for each configured "select" keybinding
indicators = { ' 1 ', ' 2 ', ' 3 ', ' 4 ' },
active_indicators = { '[1]', '[2]', '[3]', '[4]' },
-- Less indicators than items in the harpoon list
more_marks_indicator = ' … ', -- horizontal elipsis. Disable using empty string
more_marks_active_indicator = '[…]', -- Disable using empty string
}
Now:
-- formatter_opts.default
{
inactive = ' %s ', -- including spaces
active = '[%s]',
-- Number of slots to display:
max_slots = 4, -- Suggestion: as many as there are "select" keybindings
-- The number of items in the harpoon list exceeds max_slots:
more = '…', -- horizontal elipsis. Disable using empty string
}
The output is the same.
Chapter "custom formatters" in the readme includes an extra example displaying letters.
Sometimes, lualine displays the update from harpoon with a little noticeable delay
Update the readme, recommending lualine.refresh()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.