Skip to content

Commit 79d6c61

Browse files
committed
🎉 release: v0.2.0
1 parent 95907fd commit 79d6c61

File tree

8 files changed

+269
-101
lines changed

8 files changed

+269
-101
lines changed

.github/images/sidebars.png

93.3 KB
Loading

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,34 @@ The format is based on [Keep a Changelog], and this project adheres to
77

88
## [Unreleased]
99

10+
## [0.2.0] - 2022-01-01
11+
1012
### Added
1113

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

19+
- Config options to configure left and right sidebars to integrate nicely with
20+
file explorer plugins
21+
([#31](https://github.com/noib3/nvim-cokeline/issues/31)).
22+
1723
### Fixed
1824

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

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

32+
- Using `{}` as the `preferences` table when `nil` is passed to the `setup`
33+
function ([#36](https://github.com/noib3/nvim-cokeline/issues/36)).
34+
35+
- Using plain `string.find` when setting pick letters to work w/ filenames
36+
with special characters
37+
([#37](https://github.com/noib3/nvim-cokeline/issues/37)).
2638

2739
## [0.1.0] - 2021-12-07
2840

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

67-
[unreleased]: https://github.com/noib3/nvim-cokeline/compare/v0.1.0...HEAD
79+
[unreleased]: https://github.com/noib3/nvim-cokeline/compare/v0.2.0...HEAD
80+
[0.2.0]: https://github.com/noib3/nvim-cokeline/releases/tag/v0.2.0
6881
[0.1.0]: https://github.com/noib3/nvim-cokeline/releases/tag/v0.1.0

README.md

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,92 @@ require('cokeline').setup({
305305
<!-- TODO -->
306306
<!-- ### Maximum buffer widths -->
307307

308+
### Sidebars
309+
310+
You can add left and right sidebars to integrate nicely with file explorer
311+
plugins like
312+
[nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua),
313+
[CHADTree](https://github.com/ms-jpq/chadtree) or
314+
[NERDTree](https://github.com/preservim/nerdtree).
315+
316+
<details>
317+
<summary>Click to see configuration</summary>
318+
319+
```lua
320+
local get_hex = require('cokeline/utils').get_hex
321+
322+
local yellow = vim.g.terminal_color_3
323+
324+
require('cokeline').setup({
325+
default_hl = {
326+
focused = {
327+
fg = get_hex('Normal', 'fg'),
328+
bg = get_hex('ColorColumn', 'bg'),
329+
},
330+
unfocused = {
331+
fg = get_hex('Comment', 'fg'),
332+
bg = get_hex('ColorColumn', 'bg'),
333+
},
334+
},
335+
336+
rendering = {
337+
left_sidebar = {
338+
filetype = 'NvimTree',
339+
components = {
340+
{
341+
text = ' NvimTree',
342+
hl = {
343+
fg = yellow,
344+
bg = get_hex('NvimTreeNormal', 'bg'),
345+
style = 'bold'
346+
}
347+
},
348+
}
349+
},
350+
},
351+
352+
components = {
353+
{
354+
text = function(buffer) return (buffer.index ~= 1) and '' or '' end,
355+
},
356+
{
357+
text = ' ',
358+
},
359+
{
360+
text = function(buffer)
361+
return buffer.devicon.icon
362+
end,
363+
hl = {
364+
fg = function(buffer)
365+
return buffer.devicon.color
366+
end,
367+
},
368+
},
369+
{
370+
text = ' ',
371+
},
372+
{
373+
text = function(buffer) return buffer.filename .. ' ' end,
374+
hl = {
375+
style = function(buffer)
376+
return buffer.is_focused and 'bold' or nil
377+
end,
378+
}
379+
},
380+
{
381+
text = '',
382+
delete_buffer_on_left_click = true,
383+
},
384+
{
385+
text = ' ',
386+
},
387+
},
388+
})
389+
```
390+
</details>
391+
392+
![sidebars](.github/images/sidebars.png)
393+
308394
### Unique buffer names
309395

310396
When files with the same filename belonging to different directories are opened
@@ -424,6 +510,23 @@ require('cokeline').setup({
424510
-- value.
425511
-- default: `999`.
426512
max_buffer_width = int,
513+
514+
-- Left and right sidebars to integrate nicely with file explorer plugins.
515+
-- Each of these is a table containing a `filetype` key and a list of
516+
-- `components` to be rendered in the sidebar.
517+
-- The last component will be automatically space padded if necessary
518+
-- to ensure the sidebar and the window below it have the same width.
519+
-- NOTE: unlike the `components` config option described below, right now
520+
-- these components don't allow any of their fields (text, hl, etc.) to be
521+
-- defined as a function of `buffer`.
522+
left_sidebar = {
523+
filetype = '<filetype>',
524+
components = {..},
525+
},
526+
right_sidebar = {
527+
filetype = '<filetype>',
528+
components = {..},
529+
},
427530
},
428531

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

doc/cokeline.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ The valid keys are:
6969
-- value.
7070
-- default: `999`.
7171
max_buffer_width = int,
72+
73+
-- Left and right sidebars to integrate nicely with file explorer
74+
-- plugins. Each of these is a table containing a `filetype` key and a
75+
-- list of `components` to be rendered in the sidebar.
76+
-- The last component will be automatically space padded if necessary
77+
-- to ensure the sidebar and the window below it have the same width.
78+
-- NOTE: unlike the `components` config option described below, right now
79+
-- these components don't allow any of their fields (text, hl, etc.) to
80+
-- be defined as a function of `buffer`.
81+
left_sidebar = {
82+
filetype = '<filetype>',
83+
components = {..},
84+
},
85+
right_sidebar = {
86+
filetype = '<filetype>',
87+
components = {..},
88+
},
7289
},
7390

7491
-- The default highlight group values for focused and unfocused buffers.

lua/cokeline/defaults.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ local defaults = {
2020
rendering = {
2121
max_buffer_width = 999,
2222
slider = rq_sliders.center_current_buffer,
23-
offsets = false,
23+
left_sidebar = false,
24+
right_sidebar = false,
2425
},
2526

2627
---@type table<string, Hl>
@@ -88,7 +89,7 @@ update = function(settings, preferences, key)
8889
echoerr(('Configuration option "%s" does not exist!'):format(key_tree))
8990
else
9091
updated[k] =
91-
(type(v) == 'table' and not vim_tbl_islist(v))
92+
(type(v) == 'table' and not vim_tbl_islist(v) and not k:find('sidebar'))
9293
and update(settings[k], v, key_tree)
9394
or v
9495
end

lua/cokeline/offset.lua

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)