Open daephx opened 3 years ago
I tried, and it works for me (windows 10, nvim 6.0) . I didn't know neoterm_shell var... nice.
function! TermOV(use_file_dir)
let t=&shell
let g:neoterm_shell = executable('pwsh') ? 'pwsh' : 'powershell'
set shell=cmd.exe
set splitright
let k=g:neoterm.last_id+1
vertical Tnew "~/"
"exe k."T . /etc/bashrc"
"exe k."T . ~/.bash_profile"
if a:use_file_dir
exe k."T cd " . expand('%:p:h')
"else
"exe k."T hookvim"
endif
"exe k."T set -o emacs"
"if g:on_ek_computer
"exe k."T bind '\"\\C-r\": \"\\C-ahstr -- \\C-j\"'"
"endif
exe k."Tclear"
set shell=t
endfunction
It is important that shell would be cmd.exe
Just stumbeled upon a similar error using MSYS bash instead of cmd. Found out, that neoterm uses an heuristic to find the opened terminal. Essentially it goes like this:
:b neoterm-3
to jump to the third terminalNow to the actual error you are getting: on Windows, this marker is set to &::neoterm
which I believe is a comment string in cmd.exe
. You will have to change it to a proper PowerShell comment string with
let g:neoterm_marker = ';#neoterm'
And just as a reference, this is my working config to use MSYS bash with neoterm on windows:
if vim.loop.os_uname().sysname == "Windows_NT" then
vim.o.shell=vim.env.HOME:gsub('\\', '/') .. [[/AppData/Local/Programs/msys64/usr/bin/bash.exe]]
vim.o.shellpipe="| tee"
vim.o.shellslash=true
vim.o.shellredir=">"
vim.o.shellquote=""
vim.o.shellxquote=""
vim.o.shellcmdflag="-c"
vim.g.neoterm_marker=";#neoterm"
end
I am uncertain as to if this could be related to #246 but it was the only issue I saw within the same vein. Thanks in advanced for any information! 🎉
Describe the bug Upfront, it's important to know: I'm running Windows 10. Following the help documentation
:h shell-powershell
. I changed the default shell for Neovim topwsh
/powershell
. This allows me to use PowerShell aliases in command mode such as!ls
or!mv % ~/Desktop
and have a fairly consistent command structure to bash. While commands incmd.exe
are slightly diffrent:!dir
and!move % ~/Desktop
<- doesn't seem to work.Unfortunately, regardless of if I use
powershell
orpwsh
as the new default, and regardless of how I set myg:neoterm_shell
. This breaks Neoterm, resulting in an error when running:Tnew
or:T ls
.To Reproduce Steps to reproduce the behavior:
:h shell-powershell
:Tnew
||:T ls
Expected behavior Neoterm should still function under these conditions. But cannot handle this modification.
Screenshots/gifs Windows PowerShell: I struggled to copy the text before the term window closed
powershell.exe
PowerShell Core: The error output is slightly different from
powershell.exe
pwsh.exe
Versions Information:
Vim or Neovim
Version: NVIM v0.5.0
OS: Windows 10 21H1 Build: 19043.1237
Neoterm commit master/e78179a9ceb98de8d0c37bdda435a5deab4d5e71 Installed/Updated via vim-plug, so I assume it's the newest commit.
All configurations related to neoterm - See Below
nvim/plugin/neoterm.vim
Additional context For clarity sake: I have a preference for PowerShell Core and have slightly modified the shell replacement command. However, I do not believe this is important to the issue seeing as: both result the same errors already presented.
Original: Windows PowerShell
Provided by `:h shell-powershell` ```viml let &shell = has('win32') ? 'powershell' : 'pwsh' ```Modified: PowerShell Core
Wrapped within an `if has('win32')` for safety ```viml let &shell = executable('pwsh') ? 'pwsh' : 'powershell' ```