Hi Ping,

There are a couple of options for setting DISPLAY automatically for new
windows.

1. You could put "export DISPLAY=:0.0" in your bashrc file.
2. You could put "setenv DISPLAY :0.0" in your screenrc file.
3. You could manually run the above screen command (via C-a :) in an active
screen session. (this would set it for all new windows).

Regarding the other issues, it looks like vim relies on X for a lot of
stuff. I'm not a vim user, but you might want to test the "-X" and "-T
screen" options to vim. They might help out.

On Tue, Sep 6, 2011 at 2:31 PM, ping <songpingem...@gmail.com> wrote:

>  hi kevin/folks:
>
> just update about this issue.
> this morning my X got froze after long weekend -- I was able to work on it
> in ssh all the time though.
> I have 2 screen sessions previously created using option 2) -- start screen
> inside ssh connections to loopback.
> I killed the X and got a new X.
> I re-attached my 2 old screen sessions. here is what I observed:
>
>         everything "looks" is still there, but
>         all my own vim key mappings got lost, only the default key maps
> work. --- looks vim issue.
>         all login sessions (telnet/ssh) to remote servers got lost, ---
> look vim issue. (I run vim ConqueTerm plugin and login to server from that)
>         vim behave strange, no "tab completion" under vim cmd now.
> ---looks vim issue
>         cp/paste doesn't work well, this looks expected I think, guess this
> is because vim is still sticking to previous X clipboard
>             while it is now running with a new X (display ID changed)
> ---looks X issue.
>
> so overall I can't blame screen at all.
>
> I'm going to switch to option 1: start screen in console and re-attach it
> in X. just it's boring to type export DISPLAY=:0.0 in every windows.
>
> is there a way to automatically execute a cmd(s) right before a new windows
> got created?
>
> and, furthermore, anyone had better vim/screen integration tips/solutions
> is highly welcomed to share his/her experiences ...
>
> thanks!
>
> regards
> ping
>
>
>
> On 08/02/2011 06:32 PM, ping wrote:
>
> kevin,
> thanks for your time on that. but you forget " when you yank to register,
> so to yank things to X clipboard, type:
> "+
> not just +
>
> yes I just tested your 2 more alternates out, here is the results:
> option 1) the export DISPLAY method works great!
> option 2) the ssh method also works in terms of copy&paste
> I have to wait and see it survives across next X restart--I think it can.
>
> and, I think this option2) also has its value given that option1 works,
> imaging I can create a screen from ssh remotely. starting screen from
> console I need to have physical access to my laptop...
>
> thanks again! I hope other screen/vim-lovers also enjoy these workarounds.
>
> regards
> ping
>
> On 08/02/2011 12:13 PM, Kevin Van Workum wrote:
>
>
>
> On Mon, Aug 1, 2011 at 5:12 PM, ping <songpingem...@gmail.com> wrote:
>
>>  hi Kevin / Paul :
>> yes I think this might be vim issue. or , at least vim-screen integration 
>> issue.
>> but being able to use vim smoothly in screen is essential for my daily work 
>> and it is a big part of my use of screen.
>>
>> the steps to reproduce is quick simple:
>> 1) c-s-5 to go to console 5
>> 2) start screen : screen -S test
>> 3) c-s-7 to go back X
>> 4) screen -dR test to attach the screen
>> 5) start vim in screen session 0 (or any other sessions)
>>    vim
>> 6) type "i" go into insert mode, then start to type anything there, for 
>> example:
>>    some texts that I want to coy to editor geany
>>    type <esc> key to leave insert mode
>> 7) shift-v to mark the line in vim, "+y to copy it into register "+
>>
>> now at this point, ":registers" command shows the texts are in "0 "" and ". 
>> register, but not even in the "+ register.
>> I think that's why I can't paste it to any apps in X.
>>
>>
>  This does not work for me either. But it does not work for me under X or
> outside of screen either.  After shift-v, pressing + gives me a system beep
> indicating some error. Pressing y does the usual yank.
>
>>  and the "left button to mark and select and middle button to paste" method 
>> that usually works in X seems not work for vim, at least in my case...
>> its ok for other editors like nano.
>>
>>  Using the mouse works fine for me.
>
>>  I think the "left button text mark" was intercepted by vim for other usage. 
>> that said, if I disable mouse in vim(set mouse-=a), I'm ok
>> to achieve the same effect with that method. but again, I don't understand 
>> why vim "+ or "* register doesn't cooperatively work inside screen that 
>> started outside of X (from console in this case).
>>
>> and, as what I usually did, if I start screen from inside X and start vim 
>> there (but vim won't survive accross X reboot, OK, that's another issue), 
>> with the help of these vimrc config:if match($TERM, "screen")!=-1
>>           set term=xterm
>>           let g:GNU_Screen_used = 1
>>         else
>>           let g:GNU_Screen_used = 0
>>         endif
>> or even this:
>> if match($TERM, "screen")!=-1
>>   set term=xterm
>> endif
>>
>> (see this http://vim.wikia.com/wiki/GNU_Screen_integration)
>>
>> I can copy things to "+ or "* and then paste the content from these 
>> registers to X apps...
>>
>>  This still did not work for me. I see nothing in the + register and get
> the system beep.
>
>>  I'm not sure if plugin fakeclip that another advice I got from this alias 
>> work or not (looks most for maxOS), I haven't try it yet...
>>
>>
>  How about this idea. Under X, open an terminal. Then ssh to localhost.
> Then start screen. The screen session should persist across X reboots since
> sshd is started outside of X. You might want to experiment with the -X and
> -Y option to ssh to see if that has any affect.
>
>  Another idea. Do as before (start screen from a non-X console) and do a
> "export DISPLAY=:0.0" or what every display you are on before starting vim.
> Maybe vim and/or your mouse is using that to get to the xclipboard.
>
>>  thanks.
>>
>> regards
>> ping
>>
>>
>>
>> > On 08/01/2011 04:28 PM, Paul Ackersviller wrote:
>>
>> This is now just a problem with vim and not specific to screen, correct?
>> I don't know why any of the above is ever necessary, unless it's some sort
>> of workaround for the use of ttymouse.  If you're setting ttymouse in vim
>> (or maybe someone else is setting it for you), you need to hold down a shift
>> key for vim to ignore mouse clicks and pass them through to the terminal.
>>
>>
>>
>> On 07/29/2011 02:16 PM, Kevin Van Workum wrote:
>>
>> Ping,
>>
>>  I'm not a vim user, so I don't know what that code is supposed to do or
>> how to use it. Can you provide the step by steps to reproduce the issue. You
>> should be able to use the copy/paste feature of your window manager or X11.
>> For me, I can highlight text with the mouse and then paste it with the
>> middle mouse button.
>>
>>  Kevin
>>
>> On Thu, Jul 28, 2011 at 5:46 PM, ping <songpingem...@gmail.com> wrote:
>>
>>>  hi kevin:
>>> I tried that and it looks good, in terms that my apps inside screen now
>>> get retained across X reboot...but then I find another issue that make it
>>> hard to use this approach in practice:
>>> it looks now I can't copy$paste between vim and other apps, or even
>>> between vim instances I was running inside screen...
>>> previously I can at least achieve that with following vim config:
>>>
>>> if match($TERM, "screen")!=-1
>>>   set term=xterm
>>>   let g:GNU_Screen_used = 1
>>> else
>>>   let g:GNU_Screen_used = 0
>>> endif
>>>
>>>
>>> function! InScreen(command)
>>>   return g:GNU_Screen_used ? 'screen '.a:command : a:command
>>> endfunction
>>>
>>> I double maybe this related to the fact that, with this approach now
>>> screen (and all its child) is not a child of X, so it has problem to access
>>> the X selections or clipboards...
>>> any idea?
>>>
>>> regards
>>>  ping
>>>
>>>
>>>
>>> On 07/07/2011 03:21 PM, ping wrote:
>>>
>>> hi Kevin:
>>> thanks and that sounds exactly what my issue was.
>>> I'll try start screen from outside of X and see if it is ok.
>>>
>>> regards
>>> ping
>>>
>>> On 07/07/2011 09:37 AM, Kevin Van Workum wrote:
>>>
>>> Ping,
>>>
>>>  If you start screen from an X session,  then screen is a child of X. So
>>> when X dies, so does screen. To do what you want, you would have to start
>>> screen outside of X.
>>>
>>>  There are many ways to do this. For example, you could start a screen
>>> session at boot time from rc.local. Or you could just switch to a different
>>> tty (e.g. ctrl-alt-F2) and start a new screen session there. Then go back to
>>> X (ctrl-alt-F7) and reattach to that screen session.
>>>
>>>  Kevin
>>>
>>> On Mon, Jul 4, 2011 at 2:44 PM, ping <songpingem...@gmail.com> wrote:
>>>
>>>>  guys:
>>>> I use screen for years and I'm happy with it.
>>>> one thing annoyed me a lot is everytime when i need to reload X (it's
>>>> not stable), and when I come back and find everything in my screen (vim,
>>>> news, mutt, telnet, ssh,...everything) also went away, the session/windows
>>>> are there though. searching the internet I haven't got much useful info.
>>>> people are saying they use screen to get persistent sessions across
>>>> X...how can i archive that?
>>>>
>>>> thanks!
>>>>
>>>> regards
>>>> ping
>>>>
>>>> _______________________________________________
>>>> screen-users mailing list
>>>> screen-users@gnu.org
>>>> https://lists.gnu.org/mailman/listinfo/screen-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Kevin Van Workum, PhD
>>> Sabalcore Computing Inc.
>>> Run your code on 500 processors.
>>> Sign up for a free trial account.
>>> www.sabalcore.com
>>> 877-492-8027 ext. 11 <877-492-8027%20ext.%2011>
>>>
>>>
>>
>>
>> --
>> Kevin Van Workum, PhD
>> Sabalcore Computing Inc.
>> Run your code on 500 processors.
>> Sign up for a free trial account.
>> www.sabalcore.com
>> 877-492-8027 ext. 11 <877-492-8027%20ext.%2011>
>>
>>
>
>
> --
> Kevin Van Workum, PhD
> Sabalcore Computing Inc.
> Run your code on 500 processors.
> Sign up for a free trial account.
> www.sabalcore.com
> 877-492-8027 ext. 11
>
>


-- 
Kevin Van Workum, PhD
Sabalcore Computing Inc.
Run your code on 500 processors.
Sign up for a free trial account.
www.sabalcore.com
877-492-8027 ext. 11
_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to