Re: How to make gvim ignore the TERM signal ?

2016-06-27 Thread Jacky Liu
On Monday, June 27, 2016 at 6:40:07 PM UTC+8, Jacky Liu wrote:
> I'm using gvim as the user interface for my own application largely written 
> in python, and I'm firing up matplotlib windows through vim's python 
> interface to do data visualization and graphical operation, here I have an 
> issue: I'm using Ubuntu 14.04 with Unity as the desktop environment, and only 
> by the first time triggering will Unity bring the new matplotlib window on 
> top of my gvim window, after the first time, Unity will only give me a notice 
> in the launching area, and I have to manually switch to the newly created 
> matplotlib window.
> 
> I'm using PyQT4 as the backend inside matplotlib, here is the demo code:
> 
>   nnoremap\t  :py3 test_graphical_interface()
> 
>   python3 << EOF
> 
>   import matplotlib
>   matplotlib.use("Qt4Agg", warn=True)
>   import matplotlib.pyplot as pyplot
> 
>   from PyQt4 import QtGui, QtCore
> 
>   def test_graphical_interface():
> 
>   fig= pyplot.figure( \
>   figsize= (3.0, 3.0), \
>   dpi= 300, \
>   facecolor= '#ffc0cb', \
>   edgecolor= '#ffc0cb', \
>   linewidth= 1.0
>   )
>   ax= fig.add_axes((0.1, 0.1, 0.8, 0.8), axis_bgcolor='black')
> 
>   manager= pyplot.get_current_fig_manager()
>   manager.window.setWindowTitle('GIF testing')
> 
>   manager.window.showMaximized()  # XXX: show up the graphical 
> window
> 
>   EOF
> 
> 
> 
> The following code I found online was also tried, yet it has no effect.
> 
>   manager.window.setWindowState(
>   manager.window.windowState() & \
>   ~QtCore.Qt.WindowMinimized | \
>   QtCore.Qt.WindowActive
>   )
> 
>   manager.window.setWindowFlags(
>   manager.window.windowFlags() & \
>   QtCore.Qt.WindowStaysOnTopHint
>   
>   )
> 
>   manager.window.setWindowFlags(
>   manager.window.windowFlags() & \
>   ~QtCore.Qt.WindowStaysOnTopHint
>   )
> 
>   manager.window.raise_()
>   manager.window.activateWindow()
> 
> 
> 
> I realized this issue was in line with Unity's behaviour, like when you open 
> up multiple image files with eog the viewer, only the first time opening will 
> bring up the eog window, later opening up will only gives you notice in the 
> launching area and Unity will not bring up new windows (having the new 
> windows minimized and hidden below).
> 
> After some try I realized two consecutive calls of window.show() will always 
> bring up the window to the front as desired:
> 
>   manager.window.showNormal()
>   manager.window.showMaximized()
> 
> but a new problem occurred, when the matplotlib window is closed, gvim window 
> will be closed as well, it looks like each call of the show() function will 
> be registered, such that corresponding numbers of TERM signal will be 
> generated later, first signal kills the graphical window, the second kills 
> gvim.
> 
> There are 3 options I can think of trying to solve the issue:
> 
>   1. try to make gvim ignore the TERM signal, such that it can only be 
> quitted by commands like :qall
>   2. try to alter the behaviour of Unity into always bringing up the new 
> app windows to the top
>   3. keep trying within the Qt frame, like more methods of the 
> manager.window object to see if a solution can be found
> 
> Can someone enlighten me as to which option I should try with the most 
> likelihood of success? Thanks.



OK, I found a not so elegant solution:

evalstr= "feedkeys(':py3 subprocess.Popen([''wmctrl'', ''-a'', ''" 
+"GIF testing"+ "''], shell=False)' . " + '"\")'
vim.eval(evalstr)


When in doubt, feedkeys.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Difficulty with Packages

2016-06-27 Thread Bram Moolenaar

Matthew Desjardins wrote:

> I've been trying to get packages to work, but I'm having difficulties
> with the resulting 'runtimepath'.  Packages are all added after my own
> "after" directory, which I would have assumed would be at the end to
> allow me to override things.
> 
> Am I missing something?

What is supposed to happen is that the package directory is added just
after the entry in 'runtimepath' where it that package was found.

For example, the 'rtp' starts as:
~/.vim,/usr/lib/vim/vim74/runtime,~/.vim/after

And when finding the matchit plugin it becomes:

~/.vim,/usr/lib/vim/vim74/runtime,/usr/lib/vim/vim74/runtime/pack/dist/opt/matchit,~/.vim/after

Or when finding a package under ~/.vim:
~/.vim,~/.vim/pack/my/start/demo,/usr/lib/vim/vim74/runtime,~/.vim/after


Can you give a small example of what you are doing and what you see
happens?

-- 
Although the scythe isn't pre-eminent among the weapons of war, anyone who
has been on the wrong end of, say, a peasants' revolt will know that in
skilled hands it is fearsome.
-- (Terry Pratchett, Mort)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Settings the starting line for multiple buffers

2016-06-27 Thread Zaxxon
Greetings to all,

When I use vim for multiple files, they are placed in the buffer. Not all the 
buffers are at "line 1", instead, they seem to be in various other places that 
I am not sure why that is, as shown in the attached screen shot.

Is there a way to set all the buffers to start at "Line 1", or at a place of my 
choosing?

Thank you

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: horizontal range, kindof

2016-06-27 Thread Tumbler Terrall
On Monday, June 27, 2016 at 6:12:47 AM UTC-5, BPJ wrote:
> I'm trying to do a substitution in a 'horizontal/virtual column range'.
> 
> I have an ASCII table where the columns are separated by tab
> characters (for now). I want to wrap the contents (which contain
> space (U+0020) and \S characters, being of unequal length of
> course!) of some specific table columns in asterisks (think
> Markdown emphasis). I thought I could use a range and \%v to
> match the text between two screen virtual columns and then use an
> expression with substitute() to wrap instances of \T\+
> inside the matched screen column range, something like
> 
> 'a,'b s/\%13v.*\%46v/\=substitute(submatch(0),'\T\+','*&*','g')/
> 
> but apparently I've misunderstood \%v because I get no match.
> So what is the right way to do this? I'm not looking forward to
> changing three columns on some 70 lines manually!
> 
> /bpj

What are you trying to match with "\T"? Because as far as I can tell that
matches the letter "t". If you're looking to match tabs, that would be "\t".
The case does make a difference.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Difficulty with Packages

2016-06-27 Thread Matthew Desjardins
I've been trying to get packages to work, but I'm having difficulties with the 
resulting 'runtimepath'.  Packages are all added after my own "after" 
directory, which I would have assumed would be at the end to allow me to 
override things.

Am I missing something?

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


vim.org script spam

2016-06-27 Thread Paul

http://www.vim.org/scripts/script.php?script_id=5410 just appeared.

--
--
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

--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


horizontal range, kindof

2016-06-27 Thread BPJ
I'm trying to do a substitution in a 'horizontal/virtual column range'.

I have an ASCII table where the columns are separated by tab
characters (for now). I want to wrap the contents (which contain
space (U+0020) and \S characters, being of unequal length of
course!) of some specific table columns in asterisks (think
Markdown emphasis). I thought I could use a range and \%v to
match the text between two screen virtual columns and then use an
expression with substitute() to wrap instances of \T\+
inside the matched screen column range, something like

'a,'b s/\%13v.*\%46v/\=substitute(submatch(0),'\T\+','*&*','g')/

but apparently I've misunderstood \%v because I get no match.
So what is the right way to do this? I'm not looking forward to
changing three columns on some 70 lines manually!

/bpj

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to make gvim ignore the TERM signal ?

2016-06-27 Thread Jacky Liu
I'm using gvim as the user interface for my own application largely written in 
python, and I'm firing up matplotlib windows through vim's python interface to 
do data visualization and graphical operation, here I have an issue: I'm using 
Ubuntu 14.04 with Unity as the desktop environment, and only by the first time 
triggering will Unity bring the new matplotlib window on top of my gvim window, 
after the first time, Unity will only give me a notice in the launching area, 
and I have to manually switch to the newly created matplotlib window.

I'm using PyQT4 as the backend inside matplotlib, here is the demo code:

nnoremap\t  :py3 test_graphical_interface()

python3 << EOF

import matplotlib
matplotlib.use("Qt4Agg", warn=True)
import matplotlib.pyplot as pyplot

from PyQt4 import QtGui, QtCore

def test_graphical_interface():

fig= pyplot.figure( \
figsize= (3.0, 3.0), \
dpi= 300, \
facecolor= '#ffc0cb', \
edgecolor= '#ffc0cb', \
linewidth= 1.0
)
ax= fig.add_axes((0.1, 0.1, 0.8, 0.8), axis_bgcolor='black')

manager= pyplot.get_current_fig_manager()
manager.window.setWindowTitle('GIF testing')

manager.window.showMaximized()  # XXX: show up the graphical 
window

EOF



The following code I found online was also tried, yet it has no effect.

manager.window.setWindowState(
manager.window.windowState() & \
~QtCore.Qt.WindowMinimized | \
QtCore.Qt.WindowActive
)

manager.window.setWindowFlags(
manager.window.windowFlags() & \
QtCore.Qt.WindowStaysOnTopHint

)

manager.window.setWindowFlags(
manager.window.windowFlags() & \
~QtCore.Qt.WindowStaysOnTopHint
)

manager.window.raise_()
manager.window.activateWindow()



I realized this issue was in line with Unity's behaviour, like when you open up 
multiple image files with eog the viewer, only the first time opening will 
bring up the eog window, later opening up will only gives you notice in the 
launching area and Unity will not bring up new windows (having the new windows 
minimized and hidden below).

After some try I realized two consecutive calls of window.show() will always 
bring up the window to the front as desired:

manager.window.showNormal()
manager.window.showMaximized()

but a new problem occurred, when the matplotlib window is closed, gvim window 
will be closed as well, it looks like each call of the show() function will be 
registered, such that corresponding numbers of TERM signal will be generated 
later, first signal kills the graphical window, the second kills gvim.

There are 3 options I can think of trying to solve the issue:

1. try to make gvim ignore the TERM signal, such that it can only be 
quitted by commands like :qall
2. try to alter the behaviour of Unity into always bringing up the new 
app windows to the top
3. keep trying within the Qt frame, like more methods of the 
manager.window object to see if a solution can be found

Can someone enlighten me as to which option I should try with the most 
likelihood of success? Thanks.


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.