문제

I am using Windows gVim and I am trying to invoke commands to run on cygwin's bash. It is working, but the working directory is set to $HOME every time. Would it possible to set to the current file's directory?

I have the following line in my .vimrc:

set shell=C:/cygwin/bin/bash
set shellcmdflag=--login\ -c
set shellxquote=\"

I have the following lines in my .profile:

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi
도움이 되었습니까?

해결책

I think the --login does that; remove that argument and the shell will be opened in GVIM's current directory.

다른 팁

You can pass the current file's directory to external commands like this:

:!ls %:p:h

See :h filename-modifiers and possibly :h shellescape().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top