Skip to content

Commit 195bb94

Browse files
committed
feat(doc): update read me to 2.0
1 parent 722c2a4 commit 195bb94

File tree

2 files changed

+88
-39
lines changed

2 files changed

+88
-39
lines changed

README.md

Lines changed: 83 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
# nvim-window-picker
22

3-
<https://user-images.githubusercontent.com/18459807/161597479-a3d8cf73-3dca-44b1-9eb6-d00b4e6eb842.mp4>
3+
`hint = 'floating-big-letter'`
4+
5+
`hint = 'statusline-winbar'`
46

57
This plugins prompts the user to pick a window and returns the window id of the
6-
picked window. Part of the code is from
7-
[nvim-tree](https://github.com/kyazdani42/nvim-tree.lua) so shout out to them
8-
for coming up with this idea.
8+
picked window.
99

1010
## Install
1111

12+
### lazy
13+
14+
```lua
15+
{
16+
's1n7ax/nvim-window-picker',
17+
name = 'window-picker',
18+
event = 'VeryLazy',
19+
version = '2.*',
20+
config = function()
21+
require'window-picker'.setup()
22+
end,
23+
}
24+
```
25+
1226
### packer
1327

1428
```lua
@@ -21,8 +35,6 @@ use {
2135
}
2236
```
2337

24-
**Make sure to `:PackerCompile` after installing**
25-
2638
## How to use
2739

2840
```lua
@@ -39,25 +51,47 @@ behaviour.
3951

4052
```lua
4153
require 'window-picker'.setup({
54+
-- type of hints you want to get
55+
-- following types are supported
56+
-- 'statusline-winbar' | 'floating-big-letter'
57+
-- 'statusline-winbar' draw on 'statusline' if possible, if not 'winbar' will be
58+
-- 'floating-big-letter' draw big letter on a floating window
59+
-- used
60+
hint = 'statusline-winbar',
61+
4262
-- when you go to window selection mode, status bar will show one of
4363
-- following letters on them so you can use that letter to select the window
4464
selection_chars = 'FJDKSLA;CMRUEIWOQP',
4565

46-
-- You can change the display string in status bar.
47-
-- It supports '%' printf style. Such as `return char .. ': %f'` to display
48-
-- buffer filepath. See :h 'stl' for details.
49-
selection_display = function(char, windowid)
50-
return '%=' .. char .. '%='
51-
end,
66+
-- This section contains picker specific configurations
67+
picker_config = {
68+
statusline_winbar_picker = {
69+
-- You can change the display string in status bar.
70+
-- It supports '%' printf style. Such as `return char .. ': %f'` to display
71+
-- buffer file path. See :h 'stl' for details.
72+
selection_display = function(char, windowid)
73+
return '%=' .. char .. '%='
74+
end,
75+
76+
-- whether you want to use winbar instead of the statusline
77+
-- "always" means to always use winbar,
78+
-- "never" means to never use winbar
79+
-- "smart" means to use winbar if cmdheight=0 and statusline if cmdheight > 0
80+
use_winbar = 'never', -- "always" | "never" | "smart"
81+
},
82+
83+
floating_big_letter = {
84+
-- window picker plugin provides bunch of big letter fonts
85+
-- fonts will be lazy loaded as they are being requested
86+
-- additionally, user can pass in a table of fonts in to font
87+
-- property to use instead
5288

53-
-- whether you want to use winbar instead of the statusline
54-
-- "always" means to always use winbar,
55-
-- "never" means to never use winbar
56-
-- "smart" means to use winbar if cmdheight=0 and statusline if cmdheight > 0
57-
use_winbar = 'smart', -- "always" | "never" | "smart"
89+
font = 'ansi-shadow', -- ansi-shadow |
90+
},
91+
},
5892

5993
-- whether to show 'Pick window:' prompt
60-
show_prompt = false,
94+
show_prompt = true,
6195

6296
-- prompt message to show to get the user input
6397
prompt_message = 'Pick window: ',
@@ -74,7 +108,7 @@ require 'window-picker'.setup({
74108
filter_func = nil,
75109

76110
-- following filters are only applied when you are using the default filter
77-
-- defined by this plugin. if you pass in a function to "filter_func"
111+
-- defined by this plugin. If you pass in a function to "filter_func"
78112
-- property, you are on your own
79113
filter_rules = {
80114
-- when there is only one window available to pick from, use that window
@@ -106,28 +140,40 @@ require 'window-picker'.setup({
106140
file_name_contains = {},
107141
},
108142

109-
-- the foreground (text) color of the picker
110-
fg_color = '#ededed',
111-
112-
-- if you have include_current_win == true, then current_win_hl_color will
113-
-- be highlighted using this background color
114-
current_win_hl_color = '#e35e4f',
115-
116-
-- all the windows except the curren window will be highlighted using this
117-
-- color
118-
other_win_hl_color = '#44cc41',
143+
-- You can pass in the highlight name or a table of content to set as
144+
-- highlight
145+
highlights = {
146+
statusline = {
147+
focused = {
148+
fg = '#ededed',
149+
bg = '#e35e4f',
150+
bold = true,
151+
},
152+
unfocused = {
153+
fg = '#ededed',
154+
bg = '#44cc41',
155+
bold = true,
156+
},
157+
},
158+
winbar = {
159+
focused = {
160+
fg = '#ededed',
161+
bg = '#e35e4f',
162+
bold = true,
163+
},
164+
unfocused = {
165+
fg = '#ededed',
166+
bg = '#44cc41',
167+
bold = true,
168+
},
169+
},
170+
},
119171
})
120172
```
121173

122174
```lua
123-
require(package_name).pick_window({
124-
selection_chars = '123345',
125-
filter_rules = {
126-
include_current_win = true,
127-
bo = {
128-
filetype = {'markdown'}
129-
}
130-
},
175+
require('window-picker').pick_window({
176+
hint = 'floating-big-letter'
131177
})
132178
```
133179

lua/window-picker/config.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
local config = {
22
-- type of hints you want to get
33
-- following types are supported
4-
-- 'statusline-winbar' | 'statusline' | 'floating-big-letter'
5-
hint = 'floating-big-letter',
4+
-- 'statusline-winbar' | 'floating-big-letter'
5+
-- 'statusline-winbar' draw on 'statusline' if possible, if not 'winbar' will be
6+
-- 'floating-big-letter' draw big letter on a floating window
7+
-- used
8+
hint = 'statusline-winbar',
69

710
-- when you go to window selection mode, status bar will show one of
811
-- following letters on them so you can use that letter to select the window

0 commit comments

Comments
 (0)