I have a simple makefile as follow:
all: A.cpp
g++ -o A.exe A.cpp
.\A
In A.cpp,
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!\n" << '\n';
return 0;
}
In Neovim, if I run :!make
, I get what I expect:
:!make
g++ -o A.exe A.cpp
.\A
Hello World!
But :make
gives
:!make >C:\Users\yeung\AppData\Local\Temp\nvimHfW5tI\3 2>&1
(1 of 5): <ff><fe>g
Although it also compiled A.cpp but the output is not seen. How to make :make
to output "Hello World"?
Another question is what should I do so that Neovim can take input from stdin when I run :make
?
My init.vim
call plug#begin(stdpath('data') . '/plugged')
Plug 'Valloric/YouCompleteMe'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Raimondi/delimitMate'
Plug 'preservim/nerdtree'
"Plug 'vim-scripts/c.vim'
call plug#end()
set number
set tabstop=4
set shiftwidth=4
set expandtab
set termguicolors
set mouse=a
set foldmethod=syntax
set nofoldenable
let g:airline_powerline_fonts = 1
let g:ycm_autoclose_preview_window_after_completion = 1
let g:delimitMate_expand_cr = 1
let mapleader = "\<Space>"
"enable powershell in nvim
let &shell = has('win32') ? 'powershell' : 'pwsh'
set shellquote= shellxquote=
set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
set shellredir=\|\ Out-File\ -Encoding\ UTF8
inoremap <C-Z> <C-O>u
nnoremap <C-Z> u
nnoremap <Leader>o o<Esc>
nnoremap <Leader>O O<Esc>
nnoremap <C-J> i<CR><Esc>
nnoremap <F9> :YcmCompleter FixIt<CR>
nnoremap <F10> :w<CR>:!make %<<CR>
nnoremap <leader>to :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
autocmd FileType makefile set noexpandtab.
<ff><fe>
sequence is the Unicode BOM, commonly used on Windows, so this suggests a possible encoding issue... Do you set any of the encoding options explicitly in your vimrc? (Maybe try undervim --clean
to see if you can still reproduce the issue.)'shellquote'
default value? Ages ago I had to change them to the following: github.com/LucHermitte/vim-system-tools/blob/master/plugin/… So far, it's still working, with gvim under Windows.nvim --clean
displays correctly. How do I get it work in normal nvim?