@@ -286,11 +286,44 @@ Here is a preview of the extension working :)
286286- ` env_pattern ` : For env file pattern
287287- ` env_edit_command ` : For env file edit command
288288
289+
290+ ### Select environment alternative
291+
292+ If you are not using telescope, this custom keybind can let you select an environment
293+
294+ ``` lua
295+ vim .keymap .set (' n' , ' ,q' , function ()
296+ local pattern = _G ._rest_nvim .env_pattern
297+ local command = string.format (" fd -HI '%s'" , pattern )
298+ local result = io.popen (command ):read (' *a' )
299+
300+ local env_list = {}
301+ for line in result :gmatch (' [^\r\n ]+' ) do
302+ table.insert (env_list , line )
303+ end
304+
305+ local rest_functions = require (' rest-nvim.functions' )
306+
307+ vim .ui .select (env_list , {
308+ prompt = ' Select env file ' ,
309+ format_item = function (item )
310+ return item
311+ end ,
312+ }, function (choice )
313+ if choice == nil then
314+ return
315+ end
316+ rest_functions .env (' set' , choice )
317+ end )
318+ end , { desc = ' [q]uery envs' })
319+ ```
320+
321+
289322## Lualine
290323
291324We also have lualine component to get what env file you select!
292325
293- And dont 't worry, it will only show up under HTTP files.
326+ And don 't worry, it will only show up under HTTP files.
294327
295328``` lua
296329-- Just add a component in your lualine config
0 commit comments