Git Product home page Git Product logo

betterterm.nvim's People

Contributors

crag666 avatar sam-hobson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sam-hobson

betterterm.nvim's Issues

feat: pass directory to open terminal in

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.

Toggling the terminal creates empty buffers

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"}
)

The result is this:
image

really good plugin btw :)

Integrating with code_runner.nvim gives error after first run

  • Description
    If the user runs a code with code_runner.nvim, it works first time but fails thereafter.
  • Steps to repro
  1. Setup hotkeys as described in https://github.com/CRAG666/betterTerm.nvim#integration-with-code_runnernvim
  2. Make a simple python script such as below:
print("hello")
  1. Run above code using the hotkey set up in step 1
  2. A terminal will open and "hello" is printed
  3. Type exit in terminal to kill the terminal
  4. Repeat step 3
  5. See error message:
E5108: 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>
  • Expected
    "hello" is printed
  • Environment
    Windows 11 22H2
    NVIM 0.8.3
    Windows Terminal

Opening betterTerm in current window

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.

Use tabs to switch between terminals instead of select window

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
image
image

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

Integration with flatten.nvim

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

Terminal stays in background after :q

  • Description
    If the user opens a new terminal and :q to close the terminal, the terminal isn't removed completely

  • Steps to repro

  1. Press the hotkey mapped to require('betterTerm').select
  2. See "Empty betterTerm's" message
  3. Open a terminal by pressing a hotkey mapped to require('betterTerm').open
  4. Close the terminal by :q
  5. Press the hotkey mapped to require('betterTerm').select
  6. See the closed terminal is still available
  • Expected
    Closed terminal is completely removed from memory

  • Environment
    Windows 11 22H2
    NVIM v0.8.3
    Windows Terminal

Integration of code_runner

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.