change test for automap (do not execute lsusb on ssh)

This commit is contained in:
fiplox 2023-01-03 15:18:25 +00:00
parent 3974ab5bb4
commit 1a3744d95e
1 changed files with 8 additions and 5 deletions

View File

@ -86,12 +86,15 @@ function UnMapDHM()
vim.api.nvim_del_keymap('n', 'N')
end
local handle = io.popen 'lsusb | grep -c Sofle'
local automap = handle:read '*n'
handle:close()
if not automap or os.getenv 'SSH_TTY' then
if os.getenv 'SSH_TTY' then
MapDHM()
else
local handle = io.popen 'lsusb | grep -c Sofle'
local automap = handle:read '*n'
handle:close()
if not automap then
MapDHM()
end
end
local wk = require 'which-key'