1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 20:30:05 +08:00

perf(flygrep): use notify api for warnings

This commit is contained in:
wsdjeg 2023-06-27 18:06:34 +08:00
parent 745b3ff6d1
commit 789831cc21
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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 = ''