Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed windows vim and added the following function to my .bashrc:

function winvim() {
    local win_vim_path='/cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/vim.exe'
    #local win_vim_args=`cygpath -w -a "$*"`

When I type winvim I am informed that there is 'No such file or directory'. However, if I type the path explicitly in cygwin vim runs as expected.

What is wrong here?

share|improve this question

migrated from Jun 5 '13 at 0:13

This question came from our site for professional and enthusiast programmers.

the `\` are going to be lost. you need to double-escape – Marc B Jun 4 '13 at 19:16
@MarcB sure? IMHO he dont't need the ` \ ` because the path is in single quotes... – jm666 Jun 4 '13 at 19:20
but without the escapes the command will be seen as /cygdrive/c/Program with arguments Files and (x86)/Vim/vim73/vim.exe. – Marc B Jun 4 '13 at 19:21
@MarcB Not if you quote the expansion of win_vim_path. – chepner Jun 4 '13 at 19:29
up vote 4 down vote accepted

When setting the value of win_vim_path, you need either single quotes or the backslashes to escape the spaces/parantheses, but not both.

local win_vim_path=/cygdrive/c/Program\ Files\ \(x86\)/Vim/vim73/vim.exe


local win_vim_path='/cygdrive/c/Program Files (x86)/Vim/vim73/vim.exe'

The quoted version is preferred as easier to read and type.

share|improve this answer

From memory:

local win_vim_path="$(cygpath -u "$PROGRAMFILES")/Vim/vim73/vim.exe"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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