Sam, thanks for sharing your tip :).
As it happens, I went a different route (after first trying xmove &
xpra - neither worked reliably). I fork the window manager into the
background, and keep a sleep job running in the foreground. That way,
whenever I have to bounce my window manager (I use sawfish, so
sometimes some new lisp functions I add on the fly may not work out so
well ...), the X server stays up regardless. Problem solved.
Something like this in ~/.Xclients:
<window-manager> &
exec sleep 1000d
wait
Regards,
Imran.
On Jul 15, 5:46 am, Sam Watkins <[email protected]> wrote:
> I have the same problem, and solved it with a few nasty hacks.
>
> I want to keep GNU screen, with bash and vim, running nicely
> when I start a new X server and the DISPLAY number changes.
> (We are using Xming on Windows with a Linux server on the LAN).
>
> There's no 'nice' way to do this, as far as I can tell.
>
> My hacky solution reloads DISPLAY from a file each time you press enter in
> bash,
> and provides a :R = Restart() command in vim, so I can easily restart vim
> with a new DISPLAY, but preserving the current session (files, windows,
> etc.).
> It also provides a default --servername (process ID).
>
> I'm somewhat embarrassed to post this!
>
> 0. Make a ~/tmp directory:
>
> mkdir -p ~/tmp
>
> 1. In my .bash_profile (local):
>
> echo "DISPLAY='$DISPLAY'" >~/.session-env
>
> 2. In my .bashrc (local):
>
> export PROMPT_COMMAND='source ~/.session-env'
>
> 3. Wrapper script for vim / vi, put it in e.g. $HOME/bin:
>
> #!/bin/bash
> export vim_session=$$
> export vim_restart_file="$HOME/tmp/vim-restart-$vim_session"
> VIM="/usr/bin/vim --servername $vim_session"
> $VIM "$@"
> while [ -e "$vim_restart_file" ]; do
> source ~/.session-env
> tmp="$vim_restart_file.tmp"
> mv "$vim_restart_file" "$tmp"
> $VIM -S "$tmp" "$@"
> rm -f "$tmp"
> done
>
> 4. In my .vimrc:
>
> function! Restart()
> let $DISPLAY=''
> exe "mksession ".$vim_restart_file
> :xa
> endfun
>
> command! R call Restart()
>
> Well, it's a bit complicated, but it does seem to work!
--
You received this message from the "vim_use" 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