crag666 / betterterm.nvim Goto Github PK
View Code? Open in Web Editor NEWThe best terminal you could have (well for me it is), is very similar to that of VScode.
License: GNU Affero General Public License v3.0
The best terminal you could have (well for me it is), is very similar to that of VScode.
License: GNU Affero General Public License v3.0
this would allow the user to detect the project root and open a terminal automatically there.
require('betterTerm').open(1, { cwd = "<ROOT DIR>" })
this could be implemented by calling lcd DIR
before term
, after creating the window with <pos> new
.
The terminal seems to create a new buffer every time you toggle it. I've tried with this minimal config (just betterterm and bufferline to showcase the buffers):
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
"CRAG666/betterTerm.nvim",
"akinsho/bufferline.nvim",
},
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
display = { non_interactive = true },
},
}
end
_G.load_config = function()
require('betterTerm').setup()
require("bufferline").setup{}
--require('nvim-bufferline').setup()
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing Telescope and dependencies.")
vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
-- betterTerminal
local betterTerm = require('betterTerm')
vim.keymap.set({"n", "t"}, "<C-t>", betterTerm.open, { desc = "Open terminal"})
vim.keymap.set({"n", "t"}, "<leader>tt", betterTerm.select, { desc = "Select terminal"})
local current = 2
vim.keymap.set(
{"n", "t"}, "<leader>tn",
function()
betterTerm.open(current)
current = current + 1
end,
{ desc = "New terminal"}
)
really good plugin btw :)
While the terminal is open, and focused (insert mode), i can trigger vim commands while typing i.e. <leader>tt
print("hello")
exit
in terminal to kill the terminalE5108: Error executing lua: .../Local/nvim-data/lazy/betterTerm.nvim/lua/betterTerm.lua:204: E900: Invalid channel id
stack traceback:
[C]: in function 'nvim_chan_send'
.../Local/nvim-data/lazy/betterTerm.nvim/lua/betterTerm.lua:204: in function 'send'
...rs/choij/AppData/Local/nvim/after/plugin/code_runner.lua:17: in function <...rs/choij/AppData/Local/nvim/afte r/plugin/code_runner.lua:16>
I think whatever vim mode it was before entering the terminal, it should be restored
I've been wondering if there's a way to not only have the default config open terminals in a new window located at the bottom of the screen, but also to have a custom keymap that opens a betterTerm instance in the currently focused window instead of at the bottom of the screen.
I think it would be very useful to have a tab system for the terminal as its quite more comfortable than using the select view every time you want to change terminal. I think most people use 1-3 terminals, and i think having a select system becomes preferable to a tab based system at 3-4 and up. Maybe something similar to rider or vscode
I am not sure how to handle the keybindings. At first i thought you could have a autocommand that changes the keybindings if youre focused on the terminal. For instance I use "J" and "K" to switch buffers normally, but if i focus the terminal, there could switch between buffers instead. The problem is that most of these keys are regular keys in the terminal so you cant quite do that, but you could do it with like and . Using autocommands means you dont have to dedicate keys just to switch terminal bufers
Would it be possible to have this plugin work with flatten.nvim? With flatten, I can use :term
to open a terminal buffer, open a file with nvim {file}
, and it will open in the first neovim instance rather than a nested one. Having this functionality with betterTerm would be awesome. Any help would be greatly appreciated! (I'm nowhere near good enough with neovim to figure this out alone)
This same functionality as flatten can be achieved with this plugin: https://github.com/samjwill/nvim-unception
Description
If the user opens a new terminal and :q
to close the terminal, the terminal isn't removed completely
Steps to repro
require('betterTerm').select
require('betterTerm').open
:q
require('betterTerm').select
Expected
Closed terminal is completely removed from memory
Environment
Windows 11 22H2
NVIM v0.8.3
Windows Terminal
I want to set the window size to be bigger, but when I use code_runner plugin and the window popped out is still the default value of 18, which is so small.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.