zbirenbaum / nvterm

NvChad's Official Terminal Plugin ( Unmaintained but still usable and stable), wait for v3.0
GNU General Public License v3.0
178 stars 21 forks source link

Run code inside the horizontal/vertical terminal with autocommands? #63

Closed koaledu closed 7 months ago

koaledu commented 7 months ago

Is there any way to run code directly inside the terminals using autocommands?

Like, for example... If I'm editing a TypeScript file that ask for input I can't use my shortcut with :!, I can use :term but it opens a separate buffer. It would be way more convenient to run it on the horizontal or verticals with Leader+h

Example of my init.lua file:

vim.api.nvim_exec([[
  augroup Code_Runner
    autocmd!

    autocmd BufRead,BufNewFile *.ts setlocal bufhidden=delete | 
    \ nnoremap <buffer> <C-A-N> :w<CR>:!bun %<CR>

  augroup END
]], false)

Something like this...

image

koaledu commented 7 months ago

I don't want to bother the maintainers but I really couldn't find a way to do this by myself and would be awesome to know if this is possible and if it is, how to do it. Thanks for reading anyway.

siduck commented 7 months ago

with v3.0 term's module you could implement this kinda, but do know nvterm's dead. So wait for v3.0 :)