Skip to content

Commit 6107352

Browse files
authored
feat: configurable auto search (#367)
1 parent 9f11d39 commit 6107352

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,19 @@ vim.keymap.set("n", "<Plug>(kubectl.wrap)", "gw")
145145
{
146146
auto_refresh = {
147147
enabled = true,
148-
interval = 3000, -- milliseconds
148+
interval = 300, -- milliseconds
149149
},
150150
diff = {
151151
bin = "kubediff" -- or any other binary
152152
},
153+
kubectl_cmd = { cmd = "kubectl", env = {}, args = {} },
153154
namespace = "All",
154155
namespace_fallback = {}, -- If you have limited access you can list all the namespaces here
155156
hints = true,
156157
context = true,
158+
filter = {
159+
apply_on_select_from_history = true,
160+
},
157161
float_size = {
158162
-- Almost fullscreen:
159163
-- width = 1.0,
@@ -167,7 +171,7 @@ vim.keymap.set("n", "<Plug>(kubectl.wrap)", "gw")
167171
col = 10,
168172
row = 5,
169173
},
170-
obj_fresh = 0, -- highlight if creation newer than number (in minutes)
174+
obj_fresh = 5, -- highlight if creation newer than number (in minutes)
171175
}
172176
```
173177

lua/kubectl/config.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ local defaults = {
2424
namespace_fallback = {},
2525
hints = true,
2626
context = true,
27+
filter = {
28+
apply_on_select_from_history = true,
29+
},
2730
float_size = {
2831
-- Almost fullscreen:
2932
-- width = 1.0,
@@ -35,7 +38,7 @@ local defaults = {
3538
col = 10,
3639
row = 5,
3740
},
38-
obj_fresh = 0, -- highghlight if age is less than minutes
41+
obj_fresh = 5, -- highghlight if age is less than minutes
3942
}
4043

4144
---@type KubectlOptions

lua/kubectl/views/filter/init.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local buffers = require("kubectl.actions.buffers")
22
local completion = require("kubectl.utils.completion")
3+
local config = require("kubectl.config")
34
local state = require("kubectl.state")
45
local tables = require("kubectl.utils.tables")
56

@@ -72,12 +73,14 @@ function M.filter()
7273
local prompt = "% "
7374

7475
vim.api.nvim_buf_set_lines(buf, #header + 1, -1, false, { prompt .. line })
75-
vim.api.nvim_win_set_cursor(0, { #header + 2, #prompt })
76-
vim.cmd("startinsert")
76+
vim.api.nvim_win_set_cursor(0, { #header + 2, #(prompt .. line) })
77+
vim.cmd("startinsert!")
7778

78-
vim.schedule(function()
79-
vim.api.nvim_input("<cr>")
80-
end)
79+
if config.options.filter.apply_on_select_from_history then
80+
vim.schedule(function()
81+
vim.api.nvim_input("<cr>")
82+
end)
83+
end
8184
end,
8285
})
8386
end

0 commit comments

Comments
 (0)