This is an automated archive made by the Lemmit Bot.

The original was posted on /r/neovim by /u/Capable-Package6835 on 2024-09-01 12:18:09+00:00.


Hi everyone, I saw a lot of people asking questions, especially those moving from VS Code, about terminal in neovim. I think it is quite handy to be able to run commands from within neovim and I am sure there are plugins out there that can do this. If you wish to have something very minimalist, simply add the following keymaps:

vim.api.nvim_set_keymap('n', 't', ':terminal', opts)

vim.api.nvim_set_keymap('t', '', '', opts)

the first one open a terminal in current window, the second one exit terminal mode without closing the terminal. Here are some examples:

Move and Yank

The terminal (at least the output) in neovim is treated as a buffer so you can use any plugin, keymap, or functionalities that you have configured in your nvim and use it immediately to the terminal, without installing any plugin. Of course if you have telescope, you can also fuzzy-find inside the terminal!

For VS Code users that want a terminal to open at the bottom:

keymap('n', 'j', ':botright new | resize 10 | terminal', opts)

Happy coding everyone!