Suppose I want to write N
words related to my studies in Vim everyday as my daily goal.
Every time I am done writing something I can do g
+Ctrl-g
and then I can send that number variable to a file. I want help in automating this.
If at each save vim can execute a shell command like Words diff
(where Words
is a bash script in my path) with diff
being the word difference between the two saves, this can be automated.
The problem is that I don't know vim-script. With the basic structure of the function I think I will be able to tweak it to my needs.
Can you help?
Edit: full explanation
I imagine something like a :Write
mode which sends the new added words (diff
: difference between saves) on each save to a file.
Similar to this mode, I imagine an :Edit
mode, which would do almost the same thing.. instead of sending the difference diff
, it would send 2*abs(diff)
.
I use vim splits very often, so a full shell script solution which uses the only original file name can't solve my problem. For each split I would like to invoke these command functions separately.
I can do basic bash scripts, so you can leave the writing to file part to me.