From 6c834307062d9dae16fd6dd9195402c987d2d3f3 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Mon, 15 Aug 2022 23:26:28 +0200 Subject: [PATCH] nvim: Add search position to statusline --- home/config/nvim/nifoc/statusline.fnl | 10 ++++++++++ home/config/nvim/plugins/heirline.fnl | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/home/config/nvim/nifoc/statusline.fnl b/home/config/nvim/nifoc/statusline.fnl index 7e07e82..e169639 100644 --- a/home/config/nvim/nifoc/statusline.fnl +++ b/home/config/nvim/nifoc/statusline.fnl @@ -271,6 +271,16 @@ i)] (string.rep new-scrollbar 2))) :hl {:fg colors.purple}}) + ;; Search count + (set mod.search-count + {:condition (fn [] + (if (= vim.v.hlsearch 0) false true)) + :init (fn [self] + (set self.count (vim.fn.searchcount {:timeout 5}))) + :provider (fn [self] + (string.format "[%s/%s]" self.count.current + self.count.total)) + :hl {:fg colors.black :bg colors.purple}}) ;; Custom Mode (fn mod.custom-mode [str fg bg] diff --git a/home/config/nvim/plugins/heirline.fnl b/home/config/nvim/plugins/heirline.fnl index 07f72bc..f41191d 100644 --- a/home/config/nvim/plugins/heirline.fnl +++ b/home/config/nvim/plugins/heirline.fnl @@ -16,7 +16,8 @@ ns.space ns.scrollbar ns.space - ns.position]) + ns.position + ns.search-count]) (local telescope-statusline {:condition (fn [] (conditions.buffer_matches {:filetype [:TelescopePrompt]}))