title: How to call vim script in C language
body: <h1>what's my goal:</h1>
  
  <p>i want a program to get session.vim and viminfo.info file for each file being edited by vim,
  and scp these file to another pc, then i can continue the work on another pc.</p>
  
  <h2>problems:</h2>
  
  <ul>
  <li>maybe the file isn't saved. 
  <ul>
  <li>should save the file before the program generate the session.vim.</li>
  </ul></li>
  <li>how get the absolute path of the file.
  <ul>
  <li>i just can get the file name using ps -ef | grep vim. </li>
  <li>getcwd() can get the current working derectory.but, i can't push it to my program written by C.</li>
  </ul></li>
  </ul>
  
  <p>Here is my solution, but it doesn't work, maybe you get a better solution, i need your help.</p>
  
  <p>kill all vim process, and get session.vim and viminfo.info for each file. 
  in my C code:</p>
  
  <pre><code>system(kill -9 pid);//pid is the pid of vim process.
  </code></pre>
  
  <p>in my .vimrc file:</p>
  
  <pre><code>autocmd VimEnter * let s:this_session='.'.expand('%:t').'.vim'
  autocmd VimLeave * if v:dying | call Somefunc() | endif
  function! Somefunc()
      silent! wa
      execute 'mksession! '.fnameescape(s:this_session)
  endfunction
  </code></pre>
  
  <p>it does not work.</p>
  
  <p>do i make myself clear? i'm not good at english.</p>
  
  <p>i'd be very grateful for any help.</p>