Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues related with terminal setting. #133

Open
Kang-geophysics opened this issue Jun 24, 2024 · 5 comments
Open

Issues related with terminal setting. #133

Kang-geophysics opened this issue Jun 24, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Kang-geophysics
Copy link

Description

To Reproduce
I use "Lazy" package manager.
I initialized as follows:

vim.opt.shell = 'powershell.exe'

Expected behavior

What is expected to happen:

Screenshots
image

  • This screen is shown up after command ":LazyGit"

Desktop (please complete the following information):

  • nvim --version: v0.10.0

If I unset vim.opt.shell , it works well.

I think, lazygit.nvim seems to use termianl related with vim.opt.shell.
Thus, I tried to use 'git-bash.'

vim.opt.shell = '"C:/Program Files/Git/bin/bash.exe"'
vim.o.shellcmdflag = "-s"

image

  • This screen is shown up after command ":LazyGit"

I want to set terminal emulator as git-bash. How can I solve it?

@Kang-geophysics Kang-geophysics added the bug Something isn't working label Jun 24, 2024
@SRCthird
Copy link

I'm having the same issue with vim.opt.shell = 'pwsh' using packer.nvim as my package manager.

@SRCthird
Copy link

This is my current workaround:

  use({
    'kdheepak/lazygit.nvim',
    requires = {
      'nvim-lua/plenary.nvim',
    },
    config = function()
      if SystemOS == "Windows" then -- SystemOS is a dynamic var set in init.lua
        vim.schedule(function()
          vim.api.nvim_create_user_command(
            "LazyGit",
            function()
              local current = vim.opt.shell
              vim.opt.shell='cmd'
              require'lazygit'.lazygit()
              vim.opt.shell=current
            end,
            { force = true }
          )
        end)
      end
    end
  })

@Kang-geophysics
Copy link
Author

This is mine.

return {
  {
    "tpope/vim-fugitive",
  },
  {
    "kdheepak/lazygit.nvim",
    cmd = {
      "LazyGit",
      "LazyGitConfig",
      "LazyGitCurrentFile",
      "LazyGitFilter",
      "LazyGitFilterCurrentFile",
    },
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim"
    },
    config = function()
      require("telescope").load_extension("lazygit")
    end
  }
}

I have no idea....

@zaflaton
Copy link

zaflaton commented Sep 1, 2024

I was having the same issue with powershell, found the below solution and it works fine :)
for both terminal and Lazygit

local powershell_options = {
  shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell",
  shellcmdflag = "-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;",
  shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait",
  shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode",
  shellquote = "",
  shellxquote = "",
}

for option, value in pairs(powershell_options) do
  vim.opt[option] = value
end

for more details check this link (https://github.com/akinsho/toggleterm.nvim/wiki/Tips-and-Tricks#using-toggleterm-with-powershelll)

@JohnWilliston
Copy link

JohnWilliston commented Oct 4, 2024

I have a similar error when using JP Software's TCC shell. I set it in my init.lua file as vim.opt.shell='tcc.exe'

But then when I use the :LazyGit command inside Neovim, I get the following message flashing by so quickly in what should be the floating lazygit window that I had to capture it on video:

TCC: (Sys) the system cannot find the file specified. "\lazygit\"

If I simply stick with the CMD shell, the floating lazygit window appears as it should. I can easily run lazygit from the command line in TCC as well without any issues. None of the workarounds posted so far seem to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants