I use Vim for editing DocBook files. I created several functions that manipulate the text in the buffer. For example to build a PDF from the source using an external command. I run these functions asynchronously in a separate Vim terminal buffer. I need to capture the last line of the terminal buffer after the build PDF process finishes because it is the path to the target PDF file. The process is following:
let term_buf_no = s:RunCmdTerm(cmd, 'term_name', 'exit_cb')
The above command runs s:RunCmdTerm
function and passes the cmd
which is the actual command to be run (building PDF) + a callback function exit_cb
the RunCmdTerm
function runs cmd
in a terminal buffer like this:
let term_buf_no = term_start(cmd, {'term_name': name, 'term_rows': 10, 'exit_cb': exit_cb})
Everything works fine, but when I want to capture the last line of the terminal buffer inside the exit_cb
function with:
let target_dir = getbufline(term_buf_no, '$')[0]
it captures earlier lines from the output but never the last one.
Any ideas?
systemlist()