On 16/03/09 15:52, Christian Ebert wrote:
>
> * Buckley, Bryan (GE EntSol, Intelligent Platforms) on Monday, March 16, 2009
> at 09:34:00 -0400
>> Can someone show me a usage of getpid() inside of vim? Currently to get
>> the pid from inside vim i have to do something like:
>>
>> !ps | echo $PPID
>
> I'm not sure I understand, but how about:
>
> :echo getpid()
>
> c
That function is of limited use, since its return value will stay
contant within a given Vim session, but it will probably change if you
restart Vim, except in MS-Dos, where it always returns zero. You can
maybe use something like
function TempSplit()
let f = '.vimf' . getpid()
let g:tempfilename = '~/' . f
if filewritable(g:tempfilename)
exe "new" g:tempfilename
if has('autocmd')
au VimLeave *
\ if filewritable(g:tempfilename)
\ && !v:dying
\ | exe '!rm -vf' g:tempfilename
\ | endif
endif
return 1
else
return 0
endif
endfunction
to create a file which you won't need after Vim exits.
Best regards,
Tony.
--
When the Universe was not so out of whack as it is today, and all the
stars were lined up in their proper places, you could easily count them
from left to right, or top to bottom, and the larger and bluer ones
were set apart, and the smaller yellowing types pushed off to the
corners as bodies of a lower grade ...
-- Stanislaw Lem, "Cyberiad"
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---