EG
join(filter(split(GetResult("ls"), '\n'), {_, x -> matchstr(x, "Scratch") == ""}), "\n")
а на луа это как будет выглядеть?
lines = {}
for line in io.popen("ls -1"):lines() do
if not line:match("Scratch") then
table.insert(lines, line)
end
end
Size: a a a
EG
join(filter(split(GetResult("ls"), '\n'), {_, x -> matchstr(x, "Scratch") == ""}), "\n")
lines = {}
for line in io.popen("ls -1"):lines() do
if not line:match("Scratch") then
table.insert(lines, line)
end
end
EG
EG
EG
vim.tbl_filter
и прочее счастье, но тут проще использовать стандартный LuaVM
lines = {}
for line in io.popen("ls -1"):lines() do
if not line:match("Scratch") then
table.insert(lines, line)
end
end
EG
lines = {}
for line in io.popen("ls -1"):lines() do
if not line:match("Scratch") then
table.insert(lines, line)
end
end
EG
GetResult
n
NG
ПК
join(filter(split(GetResult("ls"), '\n'), {_, x -> matchstr(x, "Scratch") == ""}), "\n")
a
lines = {}
for line in io.popen("ls -1"):lines() do
if not line:match("Scratch") then
table.insert(lines, line)
end
end
a
EG
EG
EG
buffers = {}
for _, buf in pairs(vim.api.nvim_list_bufs()) do
local name = vim.api.nvim_buf_get_name(buf)
if not name:match("Scratch") then
table.insert(buffers, name)
end
end
print(table.concat(buffers, "\n"))
EG
:ls
, а использует нормальные API-функцииa
buffers = {}
for _, buf in pairs(vim.api.nvim_list_bufs()) do
local name = vim.api.nvim_buf_get_name(buf)
if not name:match("Scratch") then
table.insert(buffers, name)
end
end
print(table.concat(buffers, "\n"))
YS
buffers = {}
for _, buf in pairs(vim.api.nvim_list_bufs()) do
local name = vim.api.nvim_buf_get_name(buf)
if not name:match("Scratch") then
table.insert(buffers, name)
end
end
print(table.concat(buffers, "\n"))
let res = []
for buf in getbufinfo()
if buf.name !~# 'Scratch'
call add(res, buf.name)
endif
endfor
echo join(res, "\n")
vim9script
var res = []
for buf in getbufinfo()
if buf.name !~ 'Scratch'
res->add(buf.name)
endif
endfor
echo join(res, "\n")
YS
GetResult
join(filter(split(execute("ls"), "\n"), {_, x -> matchstr(x, "Scratch") == ""}), "\n")
YS