Neovim (nvy) sometimes opens strange empty "path\to\init.vim\" instead of "path\to\init.vim"

I’m using neovim on Windows with nvy GUI. And at some point when I want to open my config using e $MYVIMRC command, sometimes it opens path\to\init.vim\ instead of path\to\init.vim and of course it’s empty and is not something I wanted. The same behavior I get even if explicitly write e path\to\init.vim. It sometimes opens path\to\init.vim\

There’s my config:

call plug#begin()
    Plug 'scrooloose/nerdtree'
    Plug 'ctrlpvim/ctrlp.vim'
    Plug 'rhysd/vim-clang-format'
    Plug 'tacahiroy/ctrlp-funky'
    Plug 'morhetz/gruvbox'
    Plug 'rakr/vim-one'
    Plug 'skywind3000/asyncrun.vim'
    Plug 'mhartington/oceanic-next'
    Plug 'wadackel/vim-dogrun'
call plug#end()

set guifont=Roboto\ Mono:h8
set smartindent
set tabstop=4
set splitright
set expandtab
set shiftwidth=4

windo set nowrap
set nowrap
set formatoptions=t
set cursorline
set background=dark
set noswapfile
colorscheme gruvbox

if isdirectory('src/')
    set path+=src
endif

if isdirectory('source/')
    set path+=souce
endif

if isdirectory('Source/')
    set path+=Souce
endif

" basic VIM autocompletion for Vulkan API
if isdirectory($VULKAN_SDK."/include/")
    set path+=$VULKAN_SDK/include
    badd $VULKAN_SDK/include/vulkan/vulkan_core.h
    if has('win32')
        badd $VULKAN_SDK/include/vulkan/vulkan_win32.h
    elseif has('linux')
        badd $VULKAN_SDK/include/vulkan/vulkan_xlib.h
        badd $VULKAN_SDK/include/vulkan/vulkan_xlib_xrandr.h
        badd $VULKAN_SDK/include/vulkan/vulkan_xlib_wayland.h
    endif
endif

autocmd FileType c,cpp,cc,hh,hpp,h,cxx ClangFormatAutoEnable
nnoremap <C-b> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
nnoremap <M-p> :CtrlPFunky<CR>
nnoremap <M-F2>  :w $MYVIMRC<CR>
nnoremap <F2>  :so $MYVIMRC<CR>
nnoremap <F5> :AsyncRun -mode=term -cwd=build -pos=right -focus=0 cmake --build .<CR>
nnoremap <M-F5> :+q<CR>
nnoremap <A-F4> :qa<CR>

fu! OpenCompanion(n)
    let cur_ext = expand("%:e")
    if cur_ext == "hh" || cur_ext == "h"
        let p = expand("%:r")

        if filereadable(p . ".cc")
            let p = p . ".cc"
        elseif filereadable(p . ".cpp")
            let p = p . ".cpp"
        elseif filereadable(p . ".cxx")
            let p = p . ".cxx"
        endif

        if a:n == 0
            execute "vsplit" p
        else
            execute "e" p
        endif

    elseif cur_ext == "cc" || cur_ext == "cpp" || cur_ext == "cxx"
        let p = expand("%:r")

        if filereadable(p . ".h")
            let p = p . ".h"
        elseif filereadable(p . ".hh")
            let p = p . ".hh"
        endif

        if a:n == 0
            execute "vsplit" p
        else
            execute "e" p
        endif
    endif

endfunction

nnoremap <F3> :call OpenCompanion(0)<CR>
nnoremap <A-F3> :call OpenCompanion(1)<CR>
nnoremap <C-F2> :e $MYVIMRC<CR>

" win32 binds
if has('win32')
    nnoremap <S-T> :vs<CR> :terminal<CR>
    nnoremap <F4> :!start remedybg project/debug.rdbg<CR><CR>
endif

" default formatting
if !filereadable(".clang-format")
    autocmd FileType c,cpp,cc,hh,hpp,h,cxx ClangFormatAutoDisable
endif



let g:ctrlp_user_command = ['.git/', 'git ls-files --cached --others  --exclude-standard %s']

What happens?

So it doesn’t happen every time?

As usually try to reduce your config to important bits and try to recreate the problem.

Are you sure you’re not hitting \ before hitting enter by accident when entering :e $MYVIMRC so it ends as :e $MYVIMRC\? \ can be dangerously close to Enter. Use a mapping, like you do for other to remove this possibility.

By the way (unrelated): you seem to have 2 typos here:

if isdirectory('source/')
    set path+=souce
endif

if isdirectory('Source/')
    set path+=Souce
endif

Checking for [Ss]ource and adding [Ss]ouce.

Also I believe you cannot have 2 directories that differ only in case, and isdirectory seems to be case-insensitive.