File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed
Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,35 @@ require("telescope").extensions.rest.select_env()
210210- env_pattern: For env file pattern
211211- env_edit_command: For env file edit command
212212
213+ ## Lualine
214+
215+ We also have lualine component to get what env file you select!
216+ And dont't worry, it will only show up under http files.
217+
218+ ``` lua
219+ -- Juse add a component in your lualine config
220+ {
221+ sections = {
222+ lualine_x = {
223+ " rest"
224+ }
225+ }
226+ }
227+
228+ -- To custom icon and color
229+ {
230+ sections = {
231+ lualine_x = {
232+ {
233+ " rest" ,
234+ icon = " " ,
235+ fg = " #428890"
236+ }
237+ }
238+ }
239+ }
240+ ```
241+
213242## Contribute
214243
2152441 . Fork it (https://github.com/rest-nvim/rest.nvim/fork )
Original file line number Diff line number Diff line change 1+ local lualine_require = require (" lualine_require" )
2+ local M = lualine_require .require (" lualine.component" ):extend ()
3+ local config = require (" rest-nvim.config" )
4+
5+ local default_options = {
6+ fg = " #428890" ,
7+ icon = " " ,
8+ }
9+
10+ function M :init (options )
11+ M .super .init (self , options )
12+ self .options = vim .tbl_deep_extend (" keep" , self .options or {}, default_options )
13+ self .icon = self .options .icon
14+
15+ self .highlight_color = self :create_hl ({ fg = self .options .fg }, " Rest" )
16+ end
17+
18+ function M :apply_icon ()
19+ local default_highlight = self :get_default_hl ()
20+ self .status = self :format_hl (self .highlight_color ) .. self .icon .. " " .. default_highlight .. self .status
21+ end
22+
23+ function M .update_status ()
24+ local current_filetype = vim .bo .filetype
25+ if current_filetype == " http" then
26+ return config .get (" env_file" )
27+ end
28+ return " "
29+ end
30+
31+ return M
You can’t perform that action at this time.
0 commit comments