From 789831cc216116ca908489b903e449a0253faa62 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2023 18:06:34 +0800 Subject: [PATCH] perf(flygrep): use notify api for warnings --- .ci/detach_plugin.sh | 2 ++ lua/spacevim/plugin/flygrep.lua | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.ci/detach_plugin.sh b/.ci/detach_plugin.sh index bbb11e5d5..85a432327 100755 --- a/.ci/detach_plugin.sh +++ b/.ci/detach_plugin.sh @@ -70,6 +70,8 @@ main () { _detact lua/spacevim/api.lua _detact lua/spacevim/api/logger.lua _detact lua/spacevim/api/prompt.lua + _detact lua/spacevim/api/notify.lua + _detact lua/spacevim/api/password.lua _detact lua/spacevim/api/vim.lua _detact lua/spacevim/api/system.lua _detact lua/spacevim/api/vim/compatible.lua diff --git a/lua/spacevim/plugin/flygrep.lua b/lua/spacevim/plugin/flygrep.lua index c3e28acab..f744625eb 100644 --- a/lua/spacevim/plugin/flygrep.lua +++ b/lua/spacevim/plugin/flygrep.lua @@ -16,6 +16,7 @@ local Key = require('spacevim.api').import('vim.keys') local buffer = require('spacevim.api').import('vim.buffer') local window = require('spacevim.api').import('vim.window') local sl = require('spacevim.api').import('vim.statusline') +local nt = require('spacevim.api').import('notify') -- set commandline mpt @@ -748,7 +749,12 @@ end function M.open(argv) previous_winid = vim.fn.win_getid() if empty(grep_default_exe) then - logger.warn(' [flygrep] make sure you have one search tool in your PATH') + logger.warn('make sure you have one search tool in your PATH') + nt.notify('make sure you have one search tool in your PATH') + return + elseif type(argv.cmd) == "string" and vim.fn.empty(argv.cmd) == 0 and vim.fn.executable(argv.cmd) == 0 then + logger.warn(argv.cmd .. ' is not executable, make sure ' .. argv.cmd .. ' is in your PATH') + nt.notify(argv.cmd .. ' is not executable,\nmake sure ' .. argv.cmd .. ' is in your PATH', 'WarningMsg') return end mode = ''