保存時にunixコマンドを使用したい。コマンドはファイルパスを返します。以下のように:
pseudo code
:w !command
# I name this command 'mami'
$ MAMI_DIR=~/work echo $MAMI_DIR/$(date "+%Y-%m-%d-%H-%M-%S").txt
#=> /Users/sane/work/2012-09-13-01-58-01.txt
https://gist.github.com/3713132
# my expectation
:w !mami
#=> to save /Users/sane/work/2012-09-13-01-58-01.txt
# or
:mami
#=> to save /Users/sane/work/2012-09-13-01-58-01.txt
しかし、私のexecは文字列またはエラーを返すだけです:
:w !mami
#=> This show only file path, /Users/sane/work/2012-09-13-01-58-01.txt and said "press key"
:w !$(MAMI_DIR=~/work echo $MAMI_DIR/$(date "+%Y-%m-%d-%H-%M-%S").txt)
#=> This return value 127
どうすればこれを達成できますか?これはvimスクリプトの領域ですか?提案をお願いします。