numToStr / FTerm.nvim

:fire: No-nonsense floating terminal plugin for neovim :fire:
MIT License
743 stars 23 forks source link

How to toggle the terminal? #30

Closed z0mbix closed 3 years ago

z0mbix commented 3 years ago

I've installed FTerm and am using lua require('FTerm').toggle() to toggle the terminal, which opens it, but once the terminal is open, how to I toggle it closed again as I can't enter neovim's command mode inside the terminal?

delphinus commented 3 years ago

Use <Cmd> to run commands from any mode. So you can toggle FTerm with these mappings below.

tnoremap <C-t> <Cmd>lua require'FTerm'.toggle()<CR>
nnoremap <C-t> <Cmd>lua require'FTerm'.toggle()<CR>

See https://neovim.io/doc/user/map.html#%3CCmd%3E

delphinus commented 3 years ago

In addition to that, you can run into the command mode from terminals with this map: <C-\><C-n>:

https://neovim.io/doc/user/intro.html#CTRL-\_CTRL-N

z0mbix commented 3 years ago

I had no idea about tnoremap. Thanks, this works perfectly 😃