File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ condition.buffer_not_empty -- if buffer not empty return true else false
137137condition .hide_in_width -- if winwidth(0)/ 2 > 40 true else false
138138-- find git root, you can use this to check if the project is a git workspace
139139condition .check_git_workspace ()
140+ condition .check_active_search -- if highlight search and search results exist true else false
140141
141142-- built-in theme
142143local colors = require (' galaxyline.theme' ).default
Original file line number Diff line number Diff line change @@ -40,4 +40,12 @@ function M.check_active_lsp()
4040 return true
4141end
4242
43+ function M .check_active_search ()
44+ local search_count = vim .fn .searchcount ({recompute = 1 , maxcount = - 1 })
45+ if vim .v .hlsearch == 1 and search_count .total > 0 then
46+ return true
47+ end
48+ return false
49+ end
50+
4351return M
Original file line number Diff line number Diff line change 1+ local condition = require (' condition' )
12local vim = vim
23local M = {}
34
45function M .get_search_results ()
56 local search_term = vim .fn .getreg (' /' )
67 local search_count = vim .fn .searchcount ({recompute = 1 , maxcount = - 1 })
7- local active = vim .v .hlsearch == 1 and search_count .total > 0
88
9- if active then
9+ if condition . check_active_search () then
1010 return ' /' .. search_term .. ' [' .. search_count .current .. ' /' .. search_count .total .. ' ]'
1111 end
1212end
You can’t perform that action at this time.
0 commit comments