1

I have my alias file set up like so in Bash in WSL:

alias gvim='/mnt/d/Vim/vim81/gvim.exe'
alias vim='/mnt/d/Vim/vim81/vim.exe'
alias pngcrush='/mnt/c/Users/nathan/Downloads/pngcrush_1_8_11_w64.exe -reduce -brute -ow'

but when I try running gvim or vim within Bash, I get this error:

:No such file or directorym.exe (gvim)

`:No such file or directory.exe' (vim)

However, the pngcrush alias works correctly. For some odd reason though, the aliases defined in my ~/.alias file have the first "a" in alias replaced with single quote and the ending single quote is missing when I run alias command in bash without arguments.

Anyone know why the gvim and vim executables are not being found correctly? If I enter the path to the .exe in bash directly it works but those two aliases don't work

Bash version:

> bash --version
GNU bash, version 4.3.42(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

OpenSUSE version:

> cat /etc/*release
NAME="openSUSE Leap"
VERSION="42.3"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="42.3"
PRETTY_NAME="openSUSE Leap 42.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:42.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
openSUSE 42.3 (x86_64)
VERSION = 42.3
CODENAME = Malachite
# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead

All of my bash aliases below:

>alias
alias +='pushd .'
alias -='popd'
alias ..='cd ..'
alias ...='cd ../..'
alias beep='echo -en "\007"'
alias cd..='cd ..'
alias dir='ls -l'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
'lias gvim='/mnt/d/Vim/vim81/gvim.exe
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='_ls'
alias ls-l='ls -l'
alias md='mkdir -p'
alias o='less'
'lias pngcrush='/mnt/c/Users/nathan/Downloads/pngcrush_1_8_11_w64.exe -reduce -brute -ow
alias rd='rmdir'
alias rehash='hash -r'
alias unmount='echo "Error: Try the command: umount" 1>&2; false'
'lias vim='/mnt/d/Vim/vim81/vim.exe
alias you='if test "$EUID" = 0 ; then /sbin/yast2 online_update ; else su - -c "/sbin/yast2 online_update" ; fi'

Microsoft Windows 10 Home 10.0.17134

  • Check if your alias file has CRLF line-endings e.g. with cat -v[et] or sed -n l (ell). – dave_thompson_085 Jul 20 '18 at 14:27
  • Change the alias to another name like: alias wvim='/mnt/d/Vim/vim81/vim.exe'. The vim alias may conflict with the Windows path and Linux path. +1 for this well formatting question. – Biswapriyo Jul 20 '18 at 15:37
  • I tried cat -v ~/.alias and each line ends with a ^M. Does that mean I need to run dos2unix on it? – Nathan Mills Jul 21 '18 at 20:35
  • okay tried dos2unix on the alias file and the gvim alias seems to work but the aliased vim just hangs now if I run it from bash using either the alias or the path to the exe but works fine when I run that exe from Cortana. Guess I'll remove that particular alias and keep the other two. Thanks for the help dave and Biswapriyo. – Nathan Mills Jul 21 '18 at 20:40
1

Quick answer: just open vim from within bash.

The Linux distribution you are using with WSL probably has vim included. There is no reason to use WSL & bash to open a Windows version of vim.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.