I´m new to git and I´ve a little problem using git the way I want to. I administrate a bunch of servers. What I want to have is a local repository of the config files I edit. In case of missconfiguratin I could then easily jump back to a working version.
For example: I edit a file that is not in the repository. After editing I would like to add it to the repo automatically including the absolute path and do the commit. The commit message should be asked automatically on quit.
Until now I tried it using this additional line in vimrc.local:
autocmd BufWritePost * let message = input('Message? ', 'Auto-commit: saved ' .
expand('%')) | execute ':silent ! if git rev-parse --git-dir > /dev/null 2>&1 ;
then git add % ; git commit -m ' . shellescape(message, 1) . '; fi > /dev/null 2>&1'
Source: stackoverflow
This does not solve my problem as the files are not included with their absolute path and sometimes are not added at all.
I heard about fugitive which could do that but I don´t get it working this way.
I think I am not the first one having this problem. Could anyone explain me how to set this up step by step. Please consider that I am new to this topic.
Thanks in advance Chris