Closed fedoranvar closed 2 years ago
You could use :run(<cmd>)
method like this
local fterm = require("FTerm")
local visidata = fterm:new({
ft = "fterm_visidata", -- You can also override the default filetype, if you want
dimensions = {
x = 1,
y = 0,
height = 0.9,
width = 0.9,
},
})
function _G.fterm.visidata()
visidata:run({"visidata ", vim.fn.expand("%"))
end
compared my currenti implementation (with cmd
) against run
:
cmd
is faster, because it launches directly command, but run
launches at first shell and then command in it, and also i've added ;exit
after command, because quitting my command doesn't quit fterm shell by default
so, still, dynamic cmd
would be prefferable if it can be.
Thank you!
'ive digged a little bit in code and found soluton:
local fterm = require("FTerm")
local visidata = fterm:new({
ft = "fterm_visidata", -- You can also override the default filetype, if you want
dimensions = {
x = 1,
y = 0,
height = 0.9,
width = 0.9,
},
})
function _G.fterm.visidata()
visidata.config.cmd = "visidata " .. vim.fn.expand("%")
if vim.bo.filetype == "csv" then
visidata:toggle()
end
end
Good day to you!
For opening csv files in certain program i have this code:
right now it creates new
fterm
-instance in function.Question:
is it possible to define template without
cmd
attribute, but set it in dynamic function, socmd
could be dynamic because of expansion of%
?something like this (i've tried this, but get only shell float window):
Thank you!