I want to use unix command on save. Command return file path. Like below:
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
But my exec is only return string or errors:
: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
How do I achieve this? Is this the area of vim script? Please give me suggestion.
You can do
to achieve what you want. What you were actually doing was piping output to the
mamicommand.