s1n7ax / nvim-terminal

A Lua-Neovim plugin that toggles a terminal
MIT License
115 stars 6 forks source link

How can i make it open terminal window on vimenter #6

Closed rzksobhy78 closed 2 years ago

rzksobhy78 commented 2 years ago

I want the terminal window to open automatically and the put the cursor on the back into the editor ?

Ty for the great plugins btw

s1n7ax commented 2 years ago

You could use something like below

vim.api.nvim_exec([[
function OpenTerm()
    let l:current_window = win_getid()
    lua require('nvim-terminal').DefaultTerminal:open(1)
    call win_gotoid(l:current_window)
endfunction

au VimEnter * call OpenTerm()
]], false)
rzksobhy78 commented 2 years ago

thanks it worked