scriptencoding utf-8 " Vim と explorer, Finder, terminal への橋渡し " 正直微妙だと思う.基本的に,すべて Vim 上で行えるか, " ターミナルでやるのが理想 ? if has('mac') nnoremap exp :!open . nnoremap sh :!open -a Terminal.app . call add(g:mapping_descriptions, ['exp', 'open Finder']) call add(g:mapping_descriptions, ['sh', 'open Terminal']) elseif has('win32') || has('win64') if has('gui') || has('nvim') let s:to_unset = ['VIM', 'VIMRUNTIME', 'MYVIMRC', 'MYGVIMRC'] let s:env_unset = join(map(s:to_unset, '"set \"" .. v:val .. "=\""'), ' && ') nnoremap exp :silent !start explorer . exe 'nnoremap cmd :silent !start ' .. s:env_unset .. "\" if executable('pwsh') nnoremap sh :silent !start pwsh elseif executable('powershell') nnoremap sh :silent !start powershell endif nnoremap ubu ":silent !start " .. $LocalAppData .. "\\wsltty\\bin\\mintty.exe --WSL=\"Ubuntu\" --configdir=\"" .. $AppData .. "\\wsltty\"\" call add(g:mapping_descriptions, ['exp', 'open explorer']) call add(g:mapping_descriptions, ['cmd', 'open cmd']) call add(g:mapping_descriptions, ['sh', 'open powershell']) call add(g:mapping_descriptions, ['ubu', 'open WSL Ubuntu with mintty']) if executable('msys2') nnoremap bas :silent !msys2 -here -full-path -mingw64 -mintty -no-start call add(g:mapping_descriptions, ['bas', 'open msys2']) endif endif elseif has('unix') " --working-directory=は必要なし nnoremap exp :!xdg-open . nnoremap sh :!gnome-terminal call add(g:mapping_descriptions, ['exp', 'xdg-open']) call add(g:mapping_descriptions, ['sh', 'open gnome-terminal']) endif " -- ターミナル if has('terminal') || has('nvim') if has('win32') || has('win64') || g:is_wsl if executable('pwsh.exe') && !g:is_wsl " WSL で pwsh.exe を起動するとなぜか $PWD がセットされない command! Pwsh :vertical new | :term pwsh.exe call add(g:mapping_descriptions, [':Pwsh', 'open pwsh in +terminal']) elseif executable('powershell.exe') command! Pwsh :vertical new | :term powershell.exe call add(g:mapping_descriptions, [':Pwsh', 'open powershell in +terminal']) endif endif endif