Am 2014-03-13 12:13, schrieb Viktor Kojouharov:
To easily use the remote-expr feature. You need to start a new
instance of vim and point it to the current running vim server. And I
need the full executable path in order to start the remote-expr. Vim
is usually in the path on linux systems, but that's not the case on
windows and macvim
Something like this maybe? This should work on Windows on Linux,
don't know for other Operating Systems.
fu! GetProcessPath(id)
let dir=''
if (has("win32") || has("win64"))
if executable("wmic")
if !exists("s:tfile")
let s:tfile = fnamemodify(tempname(), ':r'). '.cmd'
endif
let cr=nr2char(13)
let content=['@ECHO OFF',
\ "FOR /F \"skip=1 tokens=*\" %%T IN ('wmic process
where^(ProcessId^=\"".a:id."\"^)get commandline') DO (echo %%T) &goto
exit",
\ ":exit"]
call map(content, 'v:val.cr')
call writefile(content, s:tfile, 'b')
let dir = system(s:tfile)
call delete(s:tfile)
else
" use globpath ?
let ver = v:version[0].v:version[2]
let dir = get(filter(split(globpath(substitute($PATH, ';', ',',
'g'), v:progname), '\n'), 'v:val =~# "vim".ver'), 0, '')
endif
elseif filereadable("/proc/".a:id."/exe")
let dir = substitute(system(printf("readlink /proc/%d/exe", a:id)),
'\n$', '', '')
endif
echo dir
endfu
com! VimPath :call GetProcessPath(getpid())
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.