Skip to content

Commit

Permalink
fix: Deal with spaced/empty/nil input
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasTavaresA committed Apr 27, 2023
1 parent 5e3d9df commit 9d2e69e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/simpleCommand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ function M.command(open_with)
vim.ui.input(
{ prompt = M.config.prompt, default = command },
function(input)
command = input
if command ~= nil then
input = input:gsub("^(%s*)(.-)(%s*)$", "%2")

if input ~= "" then
command = input
open(command)

if not vim.tbl_contains(M.commands[cwd], command) then
Expand Down

0 comments on commit 9d2e69e

Please sign in to comment.