Skip to content

Commit

Permalink
🎉 release: v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Jan 1, 2022
1 parent 95907fd commit 79d6c61
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 101 deletions.
Binary file added .github/images/sidebars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,34 @@ The format is based on [Keep a Changelog], and this project adheres to

## [Unreleased]

## [0.2.0] - 2022-01-01

### Added

- Added ability to focus or close a buffer by typing its `pick_letter` after
triggering either `<Plug>(cokeline-pick-focus)` or
`<Plug>(cokeline-pick-close)`
([#16](https://github.com/noib3/nvim-cokeline/issues/16)).

- Config options to configure left and right sidebars to integrate nicely with
file explorer plugins
([#31](https://github.com/noib3/nvim-cokeline/issues/31)).

### Fixed

- Fixed an error when deleting a buffer with no buffers currently focused, e.g.
when using filetree plugins
([#32](https://github.com/noib3/nvim-cokeline/issues/32)).

- Now checking that a buffer's filename isn't `[No Name]` when assigning its
- Checking that a buffer's filename isn't `[No Name]` when assigning its
`pick_letter` ([#34](https://github.com/noib3/nvim-cokeline/issues/34)).

- Using `{}` as the `preferences` table when `nil` is passed to the `setup`
function ([#36](https://github.com/noib3/nvim-cokeline/issues/36)).

- Using plain `string.find` when setting pick letters to work w/ filenames
with special characters
([#37](https://github.com/noib3/nvim-cokeline/issues/37)).

## [0.1.0] - 2021-12-07

Expand Down Expand Up @@ -64,5 +76,6 @@ The format is based on [Keep a Changelog], and this project adheres to
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
[Keep a changelog]: https://keepachangelog.com/en/1.0.0/

[unreleased]: https://github.com/noib3/nvim-cokeline/compare/v0.1.0...HEAD
[unreleased]: https://github.com/noib3/nvim-cokeline/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/noib3/nvim-cokeline/releases/tag/v0.2.0
[0.1.0]: https://github.com/noib3/nvim-cokeline/releases/tag/v0.1.0
105 changes: 104 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,92 @@ require('cokeline').setup({
<!-- TODO -->
<!-- ### Maximum buffer widths -->

### Sidebars

You can add left and right sidebars to integrate nicely with file explorer
plugins like
[nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua),
[CHADTree](https://github.com/ms-jpq/chadtree) or
[NERDTree](https://github.com/preservim/nerdtree).

<details>
<summary>Click to see configuration</summary>

```lua
local get_hex = require('cokeline/utils').get_hex

local yellow = vim.g.terminal_color_3

require('cokeline').setup({
default_hl = {
focused = {
fg = get_hex('Normal', 'fg'),
bg = get_hex('ColorColumn', 'bg'),
},
unfocused = {
fg = get_hex('Comment', 'fg'),
bg = get_hex('ColorColumn', 'bg'),
},
},

rendering = {
left_sidebar = {
filetype = 'NvimTree',
components = {
{
text = ' NvimTree',
hl = {
fg = yellow,
bg = get_hex('NvimTreeNormal', 'bg'),
style = 'bold'
}
},
}
},
},

components = {
{
text = function(buffer) return (buffer.index ~= 1) and '' or '' end,
},
{
text = ' ',
},
{
text = function(buffer)
return buffer.devicon.icon
end,
hl = {
fg = function(buffer)
return buffer.devicon.color
end,
},
},
{
text = ' ',
},
{
text = function(buffer) return buffer.filename .. ' ' end,
hl = {
style = function(buffer)
return buffer.is_focused and 'bold' or nil
end,
}
},
{
text = '',
delete_buffer_on_left_click = true,
},
{
text = ' ',
},
},
})
```
</details>

![sidebars](.github/images/sidebars.png)

### Unique buffer names

When files with the same filename belonging to different directories are opened
Expand Down Expand Up @@ -424,6 +510,23 @@ require('cokeline').setup({
-- value.
-- default: `999`.
max_buffer_width = int,

-- Left and right sidebars to integrate nicely with file explorer plugins.
-- Each of these is a table containing a `filetype` key and a list of
-- `components` to be rendered in the sidebar.
-- The last component will be automatically space padded if necessary
-- to ensure the sidebar and the window below it have the same width.
-- NOTE: unlike the `components` config option described below, right now
-- these components don't allow any of their fields (text, hl, etc.) to be
-- defined as a function of `buffer`.
left_sidebar = {
filetype = '<filetype>',
components = {..},
},
right_sidebar = {
filetype = '<filetype>',
components = {..},
},
},

-- The default highlight group values for focused and unfocused buffers.
Expand Down Expand Up @@ -459,7 +562,7 @@ require('cokeline').setup({
-- A list of components to be rendered for each buffer. Check out the section
-- below explaining what this value can be set to.
-- default: see `/lua/cokeline/defaults.lua`
components = {},
components = {..},
})
```

Expand Down
17 changes: 17 additions & 0 deletions doc/cokeline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ The valid keys are:
-- value.
-- default: `999`.
max_buffer_width = int,

-- Left and right sidebars to integrate nicely with file explorer
-- plugins. Each of these is a table containing a `filetype` key and a
-- list of `components` to be rendered in the sidebar.
-- The last component will be automatically space padded if necessary
-- to ensure the sidebar and the window below it have the same width.
-- NOTE: unlike the `components` config option described below, right now
-- these components don't allow any of their fields (text, hl, etc.) to
-- be defined as a function of `buffer`.
left_sidebar = {
filetype = '<filetype>',
components = {..},
},
right_sidebar = {
filetype = '<filetype>',
components = {..},
},
},

-- The default highlight group values for focused and unfocused buffers.
Expand Down
5 changes: 3 additions & 2 deletions lua/cokeline/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ local defaults = {
rendering = {
max_buffer_width = 999,
slider = rq_sliders.center_current_buffer,
offsets = false,
left_sidebar = false,
right_sidebar = false,
},

---@type table<string, Hl>
Expand Down Expand Up @@ -88,7 +89,7 @@ update = function(settings, preferences, key)
echoerr(('Configuration option "%s" does not exist!'):format(key_tree))
else
updated[k] =
(type(v) == 'table' and not vim_tbl_islist(v))
(type(v) == 'table' and not vim_tbl_islist(v) and not k:find('sidebar'))
and update(settings[k], v, key_tree)
or v
end
Expand Down
79 changes: 0 additions & 79 deletions lua/cokeline/offset.lua

This file was deleted.

Loading

0 comments on commit 79d6c61

Please sign in to comment.