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 @@ -213,6 +213,35 @@ require("telescope").extensions.rest.select_env()
213213- env_pattern: For env file pattern
214214- env_edit_command: For env file edit command
215215
216+ ## Lualine
217+
218+ We also have lualine component to get what env file you select!
219+ And dont't worry, it will only show up under http files.
220+
221+ ``` lua
222+ -- Juse add a component in your lualine config
223+ {
224+ sections = {
225+ lualine_x = {
226+ " rest"
227+ }
228+ }
229+ }
230+
231+ -- To custom icon and color
232+ {
233+ sections = {
234+ lualine_x = {
235+ {
236+ " rest" ,
237+ icon = " " ,
238+ fg = " #428890"
239+ }
240+ }
241+ }
242+ }
243+ ```
244+
216245## Contribute
217246
2182471 . 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