Re: Shelling out to cygwin bash from Windows vim

2012-09-16 Thread AndyHancock
On Sep 7, 1:10 am, Linda W v...@tlinx.org wrote:
 AndyHancock wrote:
 This problem dogged me for many years, and I finally hunkered down
 to chase it down.

 Here is the solution that I found works for me:

 set shell=c:\cygwin\bin\bash.exe\ -i
Won't always find ~/.bashrc cuz depending on how vim is
launched, ~ doesn't always resolve to c:/cygwin/home/$USERNAME
 let shell='c:\cygwin\bin\bash.exe\ --rcfile c:\cygwin\home\' .
   \ $USERNAME . '\.bashrc'
   Backslashes are hated by bash.  Also needs -i to ensure
   bash is interactive so that .bashrc is sourced
 let shell='c:\cygwin\bin\bash.exe --rcfile c:/cygwin/home/' .
\ $USERNAME . '/.bashrc -i'
Depending on how vim is launched, c:/cygwin/home/$USERNAME
will sometimes be equivalent to ~.  If so, then it will be
replaced by ~ in shell.

 Wow... that looks complicated.

I think it looks complicated at first glance, but it's only one vim
command.  The rest is either comments explaining the one command, or
commented-out alternative commands along with why they were not used.
I deliberately left them because if people started to customize the
one command line, those are the obvious alternatives (at least they
were to me) and I wanted to save them the lengthy troubleshooting to
find out that it didn't work.

 Why don't you just set
 SHELL=C:/Bin/Bash.exe

 I have my cygwin in C:/

 In my system environment vars (controlpanel-system-
 advanced system settings(system properties)-Advanced-
 Environment variables-System Variables,
 I have:

 DISPLAY=:0
 CYGWIN=nodosfilewarning winsymlinks export
 PATH=C:\prog64\vim;%SystemRoot%\system32;%SystemRoot%;C:\bin;[other
 stuff]...
 SHELL=C:/Bin/Bash.exe

 Bash starts and runs it's RC vars, which pick up my home.. and
 that runs my .bashrc.

 One of the aliases I have in my bash startup files
 for gvim is setsid gvim

 That allows gvim to run in the background...

 Would that work for you?

 I let bash   cygwin figure out my userid and home ..

Interesting.  I did not know that the shell could be set like that.
But it makes sense.

As for setsid, I'm shelling out from the Windows-based gvim, so I'm
not sure if I really want bash to run in separate session.  It's not
clear to me what that means, from the setsid man and info pages.
However, if it's the same as appending an ampserand to a bash command
so that it runs in the background, then I probably don't want that.
Shelling out from vim is a trick for using a bash command as a filter
for a lot of text, so the user would want vim to wait for the output
to come back before proceeding.

I don't know if setting the environment variable SHELL would propagate
its value into the vim option shell.  However, even if it did, I
would feel more comfortable with the command in my code because just
setting the shell alone left the rc file un-executed, even with the
interactive flag was provided as part of the shell option (which is
suppose to cause the rc file to run).  It's all kind of foggy to me
now, but I believe that one of the possible causes was that $HOME was
being set to different things depending on how vim was invoked.  So it
wasn't finding the rc file in many cases.

Thanks for sharing though.  I feel a bit more smarter after looking up
stuff based on your examples.

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


Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Martin Jiricka
Dear Vim users,

I do not understand why output of this command: `echo 
matchstr('123abc','\v(123)\@=abc')` is `123abc`. I'm using zero-width pattern, 
so I would like to get just `abc`. What am i doing wrong?

Thank you very much!

Martin Jiricka

P.S.: This is my second attempt to post this question into the mailing list, 
because it looks like the first one was not successful. I apology if you get it 
twice.

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


Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Martin Jiricka
Dear vim users,

I do not understand why output of this command: `echo
matchstr('123abc','\v(123)\@=abc')` is `123abc`. I'm using zero-width
pattern, so I would like to get just `abc`. What am i doing wrong?

Thank you very much!

Martin Jiricka

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


Re: Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Tony Mechelynck

On 16/09/12 10:02, Martin Jiricka wrote:

Dear Vim users,

I do not understand why output of this command: `echo 
matchstr('123abc','\v(123)\@=abc')` is `123abc`. I'm using zero-width pattern, 
so I would like to get just `abc`. What am i doing wrong?

Thank you very much!

Martin Jiricka

P.S.: This is my second attempt to post this question into the mailing list, 
because it looks like the first one was not successful. I apology if you get it 
twice.



The first attempt was successful, it's just that it was held for 
moderation because it was your first post. Everyone's first post(s) must 
be approved by a human moderator: this is the only way we found to keep 
the list spam-free. The problem is that moderators are all voluteers, 
they aren't many, nor is each of them working 24/7. If they are all at 
the same time taking the week-end off, or asleep, or busy shopping, or 
for any other reason away from the keyboard, the turnaround time for 
your first post(s) can be very long.


Now that you _have_ been approved, further posts by you should make it 
to the list in a matter of seconds, or minutes at most.



Best regards,
Tony.
--
Only God can make random selections.

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


Re: Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Andy Wokula

Am 16.09.2012 10:02, schrieb Martin Jiricka: Dear Vim users,

I do not understand why output of this command:
  :echo matchstr('123abc','\v(123)\@=abc')
is `123abc`. I'm using zero-width pattern, so I would like to get just
`abc`. What am i doing wrong?


Your (very magic) zero-width item should be `@=', not `\@=':
:echo matchstr('123abc','\v(123)@=abc')
abc

:h \@=

`\v\@=' is the same as `@\=' (match `@' zero or one times):
:echo matchstr('123@abc','\v(123)\@=abc')
123@abc

Match a literal `@=':
:echo matchstr('123@=abc', '\v(123)\@\=abc')
123@=abc

--
Andy

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


Re: How to avoid command name clashes from plugins ?

2012-09-16 Thread Timothy Madden

On 09/13/2012 10:49 PM, Charles Campbell wrote:

Ben Fritz wrote:

On Saturday, September 8, 2012 9:01:47 AM UTC-5, Timothy Madden wrote:

snip


Is there a way to define a command in my plugin in a way that allows

user to change the command name in case of conflicts ? And that can also

be detected by the plugin script, in order to resolve the conflict ?



Also, I have recently forked (copied and modified) an existing plugin,

and I only made a number of small changes initially, not related to the

entry points in plugin mappings and commands. But at this moment

automatically all these mappings and commands conflict with the ones in

the original plugin (since they are duplicates of the original). Is

there way to prevent this ? Ideally, is there a way to have the

PlugMapName mappings and the commands depend on the script name ?

Preferrably in a simple enough way that can be included in the

documentation, and that user can understand and use.



Thank you,

Timothy Madden

I think the best way is just to make sure your names are likely to be
unique. Don't usePlugUp, usePlugMyNiftyPluginName_Up.


What I typically do is to provide two names; using Ben's style:

com! MyNiftyPluginName_Up ...
sil! com Up ...

The first one guarantees that your command will be available with that
MyNiftyPluginName_Up command.  The user can then use cabbr to get
whatever string s/he wants.
Example:

com! MyNiftyCmd echo MyNifyCmd works
com  Cmdecho Cmd works the first time
sil! Cmdecho Cmd works the second time!
cabbr UserVariantOfCmd   MyNiftyCmd


Thank you. I eventually chose a variation like:

command DebuggerBreakpoint echo Breakpoint command implementation
if !exists(':Bp')
command Bp DebuggerBreakpoint
endif

In short it is the same approach as with mappings (using commands on two 
levels for indirection), except for commands there is no special 
construct like Plug for mappings.


This way I can document both command names, together with the definition 
for the user-space :Bp command, so user can easily create the same 
command with a different name in case of conflicts.


I prefer to explicitly check if exists(':Bp') because to my knowledge 
silent! still records an error message in the message history. And then 
scripts running in batch mode with vim -es that want the plugin will 
terminate with an error exit code no matter what script actually does, 
because the plugin runs into a name conflict that was never meant to 
trigger an error.


Thank you,
Timothy Madden

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


Re: Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Martin Jiricka
 The first attempt was successful, it's just that it was held for 
 moderation because it was your first post. Everyone's first post(s) must 
 be approved by a human moderator: this is the only way we found to keep 
 the list spam-free. The problem is that moderators are all voluteers, 

Thank you for explanation. I should be more patient. I have never seen this 
Google Groups site, it disconcerted me a bit :)

Best regards

Martin Jiricka

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


Re: Why matchstr returns also text matched by zero-width pattern?

2012-09-16 Thread Martin Jiricka
 Your (very magic) zero-width item should be `@=', not `\@=':
 
  :echo matchstr('123abc','\v(123)@=abc')
 
  abc

Ah, thank you, now it works!

I think I tried that but I kept the backslash before `@` and that produced 
empty match. 

Thanks

Martin Jiricka

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


Buffer name changed after :edit command

2012-09-16 Thread Timothy Madden

Hello

In some situation if I try to edit a file like with
:edit plugin/script.vim
I may end up with a buffer name like '../.vim/plugin/script.vim'

Note though two paths are equivalent, assuming the current directory is 
named .vim, still the buffer names are not the same in a literal sense.


This will happen when I already have the file opened (or listed) with 
the long name (../.vim/plugin/script.vim), then I try to :edit it in a 
different window with the short name.


In my script I would like to use :MkVimball command plugin from the 
standard vimball plugin, and if I ran into this problem than MkVimball 
will create for example a file like ../../src/vim/plugin/scriptname.vim 
in the vimball archive. Even if the filename I pass to MkVimball really 
is the right one, plugin/scriptname.vim.


For this to trigger, the MkVimball command should be seen from within a 
:source'd script, and not directly from the command line. Anyway, I 
think this should not happen (actually, I find this a bug in the 
standard vimballPlugin, but that is another problem).


Is there a way to know if a file is already loaded/listed in a buffer, 
with a modified path name like ../dir/script.vim instead of script.vim ?


Are there other cases where such a different path name may exist ?

Thank you,
Timothy Madden

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


Putting stdout from Python into vim

2012-09-16 Thread Simon W. Jones
Hello,

I am trying to capture the stdout (a simple digit) from a python script that I 
am calling from vim and assign it to a variable.  I have been trying redir but 
can't seem to get it to work.

Any help would be appreciated!

Thanks.

Simon.

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Marc Weber

let var = system('python script.py')

If you're using the :py command you have to lookup how to redirect
stdout within python if using redir doesn't work.

Marc Weber

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


expanding tabs in a visual selection

2012-09-16 Thread Tim Johnson
Hi :

Is there a way to apply the expand/retab process to a visual
selection?

:h ??

thanks
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Timothy Madden

On 09/16/2012 07:34 PM, Tony Mechelynck wrote:

On 16/09/12 15:18, Timothy Madden wrote:

Hello

In some situation if I try to edit a file like with
 :edit plugin/script.vim
I may end up with a buffer name like '../.vim/plugin/script.vim'

Note though two paths are equivalent, assuming the current directory is
named .vim, still the buffer names are not the same in a literal sense.

This will happen when I already have the file opened (or listed) with
the long name (../.vim/plugin/script.vim), then I try to :edit it in a
different window with the short name.

In my script I would like to use :MkVimball command plugin from the
standard vimball plugin, and if I ran into this problem than MkVimball
will create for example a file like ../../src/vim/plugin/scriptname.vim
in the vimball archive. Even if the filename I pass to MkVimball really
is the right one, plugin/scriptname.vim.

For this to trigger, the MkVimball command should be seen from within a
:source'd script, and not directly from the command line. Anyway, I
think this should not happen (actually, I find this a bug in the
standard vimballPlugin, but that is another problem).

Is there a way to know if a file is already loaded/listed in a buffer,
with a modified path name like ../dir/script.vim instead of script.vim ?

Are there other cases where such a different path name may exist ?

Thank you,
Timothy Madden



Vim identifies files by their full path, but displays them (e.g. on the
statusline) by a shorter path if possible. If you have several windows
on a single buffer, but with different local current directories, it
may happen that Vim can shorten the name in one window but not in the
other. However it should display all statuslines relative to what is the
current directory now: if you change windows, and the LCDs are
different, statuslines may change.


I have the same file, the same directory, two windows with no local 
directory, and the same file name in both (in other words, one buffer 
with two windows).


The problem is the file name is ../.vim/plugin/script.vim, and I want to 
open plugin/script.vim


Thank you,
Timothy Madden

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Bee


On Sep 16, 9:43 am, Tim Johnson t...@akwebsoft.com wrote:
 Hi :

 Is there a way to apply the expand/retab process to a visual
 selection?

 :h ??

 thanks
 --
 Tim
 tim at tee jay forty nine dot com or akwebsoft dot comhttp://www.akwebsoft.com


:help :retab

:[range]ret[ab][!]
[new_tabstop]

Bill

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Tony Mechelynck

On 16/09/12 18:32, Simon W. Jones wrote:

Hello,

I am trying to capture the stdout (a simple digit) from a python script that I 
am calling from vim and assign it to a variable.  I have been trying redir but 
can't seem to get it to work.

Any help would be appreciated!

Thanks.

Simon.



Unless your Python script is using the Vim-Python interface (using 
import vim etc.) you might run it independently:


:let py_retval = system('python mynicescript.py')

see :help system()


Or you might try to capture the stdout by means of the :redir statement 
(see :help :redir) but I don't know if it works:


(untested)
:redir = py_retval
:pyfile mynicescript.py
:redir END
:echo 'Result = «' . py_retval . '»'

Also, this might add ends-of-lines before and/or after your single 
digit answer.



Best regards,
Tony.
--
We are all in the gutter, but some of us are looking at the stars.
-- Oscar Wilde

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Timothy Madden

On 09/16/2012 07:32 PM, Simon W. Jones wrote:

Hello,

I am trying to capture the stdout (a simple digit) from a python script that I 
am calling from vim and assign it to a variable.  I have been trying redir but 
can't seem to get it to work.

Any help would be appreciated!


Redir worked just fine for me

:redir @a
:py import sys
:py print 2
:redir END
:echo @a

The code will display 2 preceded and followed by few new-lines

Timothy Madden

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


Re: Shelling out to cygwin bash from Windows vim

2012-09-16 Thread Alessandro Antonello
 AndyHancock wrote:
 This problem dogged me for many years, and I finally hunkered down
 to chase it down.

 Here is the solution that I found works for me:

 set shell=c:\cygwin\bin\bash.exe\ -i
Won't always find ~/.bashrc cuz depending on how vim is
launched, ~ doesn't always resolve to c:/cygwin/home/$USERNAME

 I don't know if setting the environment variable SHELL would propagate
 its value into the vim option shell.  However, even if it did, I
 would feel more comfortable with the command in my code because just
 setting the shell alone left the rc file un-executed, even with the
 interactive flag was provided as part of the shell option (which is
 suppose to cause the rc file to run).  It's all kind of foggy to me
 now, but I believe that one of the possible causes was that $HOME was
 being set to different things depending on how vim was invoked.  So it
 wasn't finding the rc file in many cases.

I never tried to shelling using cygwin bash on Windows GVim. I will give a shot.
In respect to '~' to be recognized as $HOME you will need to create an
environment
variable, in Windows, targeting that path. Be prepared that if you
have any other
cross platform software it probably will use that %HOME% path to write
temporary
and configuration specific files (Inkscape, GIMP, Dia, etc.).

The best thing about this configuration is that both Windows Vim/Gvim and cygwin
vim uses the same user runtime path (~/.vim) with save me for synchronizing
plugins, syntaxes, colors, etc.

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Timothy Madden

On 09/16/2012 04:18 PM, Timothy Madden wrote:

Hello

In some situation if I try to edit a file like with
 :edit plugin/script.vim
I may end up with a buffer name like '../.vim/plugin/script.vim'

Note though two paths are equivalent, assuming the current directory is
named .vim, still the buffer names are not the same in a literal sense.

This will happen when I already have the file opened (or listed) with
the long name (../.vim/plugin/script.vim), then I try to :edit it in a
different window with the short name.

In my script I would like to use :MkVimball command plugin from the
standard vimball plugin, and if I ran into this problem than MkVimball
will create for example a file like ../../src/vim/plugin/scriptname.vim
in the vimball archive. Even if the filename I pass to MkVimball really
is the right one, plugin/scriptname.vim.


I find that Vim will modify the arguments so as to match existing 
buffers or previous arguments. Thus


:args ../dir/script.vim script.vim

becomes:

:args
../dir/script.vim ../dir/script.vim

That is, the second argument is modified to match the first one. The 
same thing happens on the command line, too.


Is there a way to prevent this ?

Thank you,
Timothy Madden

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


Re: Shelling out to cygwin bash from Windows vim

2012-09-16 Thread AndyHancock
On Sep 16, 1:22 pm, Alessandro Antonello antonello@gmail.com
wrote:
AndyHancock wrote:
 This problem dogged me for many years, and I finally hunkered
 down to chase it down.

 Here is the solution that I found works for me:

 set shell=c:\cygwin\bin\bash.exe\ -i
Won't always find ~/.bashrc cuz depending on how vim is
launched, ~ doesn't always resolve to
c:/cygwin/home/$USERNAME

The full code was:
set shell=c:\cygwin\bin\bash.exe\ -i
   Won't always find ~/.bashrc cuz depending on how vim is launched,
   ~ doesn't always resolve to c:/cygwin/home/$USERNAME
let shell='c:\cygwin\bin\bash.exe\ --rcfile c:\cygwin\home\' .
  \ $USERNAME . '\.bashrc'
  Backslashes are hated by bash.  Also needs -i to ensure bash is
  interactive so that .bashrc is sourced
let shell='c:\cygwin\bin\bash.exe --rcfile c:/cygwin/home/' .
   \ $USERNAME . '/.bashrc -i'
   Depending on how vim is launched, c:/cygwin/home/$USERNAME
   will sometimes be equivalent to ~.  If so, then it will be
   replaced by ~ in shell.

I said in my response to Linda that this only looks complicated
because I also included the ones that didn't work (for me) to save
experimenters the trouble of finding that out themselves.  Hence there
are comments explaining what didn't work, what did, and my best
rationalization of why.

 I don't know if setting the environment variable SHELL would
 propagate its value into the vim option shell.  However, even if
 it did, I would feel more comfortable with the command in my code
 because just setting the shell alone left the rc file un-executed,
 even with the interactive flag was provided as part of the shell
 option (which is suppose to cause the rc file to run).  It's all
 kind of foggy to me now, but I believe that one of the possible
 causes was that $HOME was being set to different things depending
 on how vim was invoked.  So it wasn't finding the rc file in many
 cases.

 I never tried to shelling using cygwin bash on Windows GVim. I will
 give a shot.  In respect to '~' to be recognized as $HOME you will
 need to create an environment variable, in Windows, targeting that
 path. Be prepared that if you have any other cross platform software
 it probably will use that %HOME% path to write temporary and
 configuration specific files (Inkscape, GIMP, Dia, etc.).

 The best thing about this configuration is that both Windows
 Vim/Gvim and cygwin vim uses the same user runtime path (~/.vim)
 with save me for synchronizing plugins, syntaxes, colors, etc.

I suspect that the lack of a defined Windows %HOME% variable (and
hence, the automatic predefinition of unix $HOME) could very have been
the cause of the problems I described above.  I haven't experimented
how robust is the solution of setting %HOME%.  For example, what
happens if you were logged into a non-administrator account and ran
Windows gvim as MyAdminAccount, and administrator account.

And in Windows 7, there is another way to invoke apps, As
Administrator, where Administrator isn't necessarily an account.
Somehow, it knows that you are referring to MyAdminAccount, but
running As Administrator further runs with elevated privileges,
which simply running as MyAdminAccount does not.  Environment
variables also seem to differ.  Not sure if either method of running
as MyAdminAccount would pick up that account's %HOME% variable, since
you don't actually log onto that account.  (Not something I can test
right now cuz I'm scanning a slow stick, which has taken more than a
week).

I'll wait until I get more info about the robustness of the solution
of setting %HOME%, either from myself, you, or someone else.

Thanks for the added knowledge, though, of how the problem could be
circumvented.

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Tim Johnson
* Bee fo...@calcentral.com [120916 09:09]:
 
 
 On Sep 16, 9:43 am, Tim Johnson t...@akwebsoft.com wrote:
  Hi :
 
  Is there a way to apply the expand/retab process to a visual
  selection?
 
  :h ??
 
  thanks
  --
  Tim
  tim at tee jay forty nine dot com or akwebsoft dot 
  comhttp://www.akwebsoft.com
 
 
 :help :retab
 
 :[range]ret[ab][!]
 [new_tabstop]
 blush I shoulda asked for an example.
 If I do the following
 v start visual mode
   select 4 more lines
 :retab   nothing
 :retab!  nothing
 What else need I do?
 thanks
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Simon W. Jones
On Sunday, September 16, 2012 5:32:09 PM UTC+1, Simon W. Jones wrote:
 Hello,
 
 I am trying to capture the stdout (a simple digit) from a python script that 
 I am calling from vim and assign it to a variable.  I have been trying redir 
 but can't seem to get it to work.
 
 Any help would be appreciated!
 
 Thanks.
 
 Simon.

Many thanks for the many answers, unfortunately I am still struggling.

The python script ends with:

sys.stdout.write(refs[int(chosen[1])][0])

When I run the script with %!nameofscript the correct answer is replaces the 
content of the current buffer. I still can't seem able to pipe it into a 
variable.  Could it be because the python script gets user input from a dialog 
box that they have to select by pressing Enter?

Thanks again for all your assistance.

Simon.

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Tony Mechelynck

On 16/09/12 19:01, Timothy Madden wrote:

On 09/16/2012 07:34 PM, Tony Mechelynck wrote:

On 16/09/12 15:18, Timothy Madden wrote:

Hello

In some situation if I try to edit a file like with
 :edit plugin/script.vim
I may end up with a buffer name like '../.vim/plugin/script.vim'

Note though two paths are equivalent, assuming the current directory is
named .vim, still the buffer names are not the same in a literal
sense.

This will happen when I already have the file opened (or listed) with
the long name (../.vim/plugin/script.vim), then I try to :edit it in a
different window with the short name.

In my script I would like to use :MkVimball command plugin from the
standard vimball plugin, and if I ran into this problem than MkVimball
will create for example a file like ../../src/vim/plugin/scriptname.vim
in the vimball archive. Even if the filename I pass to MkVimball really
is the right one, plugin/scriptname.vim.

For this to trigger, the MkVimball command should be seen from within a
:source'd script, and not directly from the command line. Anyway, I
think this should not happen (actually, I find this a bug in the
standard vimballPlugin, but that is another problem).

Is there a way to know if a file is already loaded/listed in a buffer,
with a modified path name like ../dir/script.vim instead of script.vim ?

Are there other cases where such a different path name may exist ?

Thank you,
Timothy Madden



Vim identifies files by their full path, but displays them (e.g. on the
statusline) by a shorter path if possible. If you have several windows
on a single buffer, but with different local current directories, it
may happen that Vim can shorten the name in one window but not in the
other. However it should display all statuslines relative to what is the
current directory now: if you change windows, and the LCDs are
different, statuslines may change.


I have the same file, the same directory, two windows with no local
directory, and the same file name in both (in other words, one buffer
with two windows).

The problem is the file name is ../.vim/plugin/script.vim, and I want to
open plugin/script.vim

Thank you,
Timothy Madden



When I have a file opened in a window with the long name, and then I use 
:sv or :new with the short name as argument, then both statuslines 
display the short name from then on, howsoever I switch windows among 
them. Example:


:pwd
/root/.mozilla/seamonkey/nexrdon9.default
:sv ../nexrdon9.default/chrome/userChrome.css
statusline says: ../nexrdon9.default/chrome/userChrome.css
:sv chrome/userChrome.css
_both_ statuslines say: chrome/userChrome.css
Ctrl-W p
both statuslines still say: chrome/userChrome.css

Similarly with 
../../seamonkey/nexrdon9.default/chrome/userContent-example.css : as 
soon as I supply the short name, _both_ windows for that file get (and 
keep) the short name in their statusline.



What happens if you open the file in a window with the short name first, 
and then pass expand('%') to MkVimball?



FWIW, I'm using gvim 7.3.661 (Huge) with GTK2-GNOME GUI.


Best regards,
Tony.
--
In Blythe, California, a city ordinance declares that a person must own
at least two cows before he can wear cowboy boots in public.

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Tony Mechelynck

On 16/09/12 19:45, Timothy Madden wrote:

On 09/16/2012 04:18 PM, Timothy Madden wrote:

Hello

In some situation if I try to edit a file like with
 :edit plugin/script.vim
I may end up with a buffer name like '../.vim/plugin/script.vim'

Note though two paths are equivalent, assuming the current directory is
named .vim, still the buffer names are not the same in a literal sense.

This will happen when I already have the file opened (or listed) with
the long name (../.vim/plugin/script.vim), then I try to :edit it in a
different window with the short name.

In my script I would like to use :MkVimball command plugin from the
standard vimball plugin, and if I ran into this problem than MkVimball
will create for example a file like ../../src/vim/plugin/scriptname.vim
in the vimball archive. Even if the filename I pass to MkVimball really
is the right one, plugin/scriptname.vim.


I find that Vim will modify the arguments so as to match existing
buffers or previous arguments. Thus

:args ../dir/script.vim script.vim

becomes:

:args
../dir/script.vim ../dir/script.vim

That is, the second argument is modified to match the first one. The
same thing happens on the command line, too.

Is there a way to prevent this ?

Thank you,
Timothy Madden

Which Vim version and patchlevel are you using? I think there was a fix 
about that, but it was a long time ago.


Best regards,
Tony.
--
You are old, father William, the young man said,
And your hair has become very white;
And yet you incessantly stand on your head --
Do you think, at your age, it is right?

In my youth, father William replied to his son,
I feared it might injure the brain;
But, now that I'm perfectly sure I have none,
Why, I do it again and again.
-- Lewis Carrol

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


autochdir vs command-t

2012-09-16 Thread shawn wilson
i like autochdir so that i can easily rename files and :E stuff where
i am. but, then if i use command-t again, it is limited to the current
directory. how do i make the pwd of certain commands the path vim was
opened in and the pwd of another set of commands the pwd of the file
of the current buffer?

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Tony Mechelynck

On 16/09/12 19:56, Simon W. Jones wrote:

On Sunday, September 16, 2012 5:32:09 PM UTC+1, Simon W. Jones wrote:

Hello,

I am trying to capture the stdout (a simple digit) from a python script that I 
am calling from vim and assign it to a variable.  I have been trying redir but 
can't seem to get it to work.

Any help would be appreciated!

Thanks.

Simon.


Many thanks for the many answers, unfortunately I am still struggling.

The python script ends with:

sys.stdout.write(refs[int(chosen[1])][0])

When I run the script with %!nameofscript the correct answer is replaces the 
content of the current buffer. I still can't seem able to pipe it into a 
variable.  Could it be because the python script gets user input from a dialog 
box that they have to select by pressing Enter?

Thanks again for all your assistance.

Simon.



%!nameofscript runs the script as a filter, i.e., its output replaces 
the current buffer. This is intentional: for instance :2,$-1!sort uses 
the external sort program to sort all lines of the current buffer 
except the first and last. (It feeds lines 2 to $-1 to the stdin of 
sort, and replaces them with its stdout.)


Use instead
	:update | let variablename = system('nameofscript  ' . 
shellescape(expand('%'),1))


Or if your script doesn't require to get your editfile as input, just use
:let variablename = system('nameofscript')

Or if your script can get its data from vim.current.range (after 
importing vim), then


:redir = variablename
:%pyfile nameofscript
:redir END


Best regards,
Tony.
--
Keep Cool, but Don't Freeze
- Hellman's Mayonnaise

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


Re: autochdir vs command-t

2012-09-16 Thread Tony Mechelynck

On 16/09/12 20:08, shawn wilson wrote:

i like autochdir so that i can easily rename files and :E stuff where
i am. but, then if i use command-t again, it is limited to the current
directory. how do i make the pwd of certain commands the path vim was
opened in and the pwd of another set of commands the pwd of the file
of the current buffer?



What about not using 'autochdir' but

:lcd %:h

in the window(s) where you want the current directory to be that of the 
current file? Of course if you want the PWD to _follow_ the current file 
in some windows or tabs but not in others, this won't work. Maybe open 
two or more Vim sessions then, and :set acd in some of them but but not 
others?


See also the Note at the end of :help 'acd':


Note: When this option is on some plugins may not work.




Best regards,
Tony.
--
How do you explain school to a higher intelligence?
-- Elliot, E.T.

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Gary Johnson
On 2012-09-16, Tim Johnson wrote:
 * Bee fo...@calcentral.com [120916 09:09]:
  
  
  On Sep 16, 9:43 am, Tim Johnson t...@akwebsoft.com wrote:
   Hi :
  
   Is there a way to apply the expand/retab process to a visual
   selection?
  
   :h ??
  
   thanks
   --
   Tim
   tim at tee jay forty nine dot com or akwebsoft dot 
   comhttp://www.akwebsoft.com
  
  
  :help :retab
  
  :[range]ret[ab][!]
  [new_tabstop]
  blush I shoulda asked for an example.
  If I do the following
  v start visual mode
    select 4 more lines
  :retab   nothing
  :retab!  nothing
  What else need I do?

I don't know.  It works fine for me.

Since :retab takes a range of lines, you should probably start
visual mode with V rather than v.  The latter will work, but the
range of text affected by the :retab command will be more apparent
with the former.

Example:

:set ts=8
:set list
:set noexpandtab

Enter the following text, with no leading space and using a real
tab where Tab is shown.

abcTabcow
defTabchicken
ghiTabhorse
jklTabsheep
mnoTabpig

:set expandtab

Move the cursor to def and type

   Vjj:retab

You should see each of the tabs in those three lines replaced by 
five spaces.

:set noexpandtab

Move the cursor to def and type

Vj:retab

You should see no change.  Now type

gv:retab

You should see the spaces replaced by tabs on the two visually-
selected lines but not on the jkl line.

Do you see different behavior?

Note that :retab! will not replace a single space by a tab.

Regards,
Gary

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Gary Johnson
On 2012-09-16, Gary Johnson wrote:

...
 Move the cursor to def and type
 
 Vj:retab
 
 You should see no change.  Now type
 
 gv:retab

That should have been

gv:retab!
 
 You should see the spaces replaced by tabs on the two visually-
 selected lines but not on the jkl line.

Regards,
Gary

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Tony Mechelynck

On 16/09/12 19:54, Tim Johnson wrote:

* Bee fo...@calcentral.com [120916 09:09]:



On Sep 16, 9:43 am, Tim Johnson t...@akwebsoft.com wrote:

Hi :

Is there a way to apply the expand/retab process to a visual
selection?

:h ??

thanks
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot comhttp://www.akwebsoft.com



:help :retab

:[range]ret[ab][!]
[new_tabstop]

  blush I shoulda asked for an example.
  If I do the following
  v start visual mode
    select 4 more lines
  :retab   nothing
  :retab!  nothing
  What else need I do?
  thanks



When you type : in Visual mode, you should see

:','

where ' means the first visually selected line and ' means the last 
visually selected line. Don't erase these marks as you type :retab in 
Visual mode. Or you could do without Visual mode, as follows:


:set expandtab
5:retab

(that second line will be expanded to :.,.+4retab and it should expand 
tabs to spaces in the current line and the 4 following ones). Or


:set noexpandtab
5:retab!

to convert spaces to tabs instead.

See
:help v_:
:help N:


Best regards,
Tony.
--
Mandrell: You know what I think?
Doctor:   Ah, ah that's a catch question. With a brain your size you
  don't think, right?
-- Dr. Who

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Simon W. Jones
On Sunday, September 16, 2012 5:32:09 PM UTC+1, Simon W. Jones wrote:
 Hello,
 
 I am trying to capture the stdout (a simple digit) from a python script that 
 I am calling from vim and assign it to a variable.  I have been trying redir 
 but can't seem to get it to work.
 
 Any help would be appreciated!
 
 Thanks.
 
 Simon.

Brilliant.  Thanks very much Tony. I've made sure your help is recognised in 
the vimscript!

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Marc Weber
 Many thanks for the many answers, unfortunately I am still struggling.
 sys.stdout.write(refs[int(chosen[1])][0])
What about rereading what I wrote earlier?

Marc Weber

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Timothy Madden

When I have a file opened in a window with the long name, and then I use
:sv or :new with the short name as argument, then both statuslines
display the short name from then on, howsoever I switch windows among
them. Example:

 :pwd
/root/.mozilla/seamonkey/nexrdon9.default
 :sv ../nexrdon9.default/chrome/userChrome.css
statusline says: ../nexrdon9.default/chrome/userChrome.css
 :sv chrome/userChrome.css
_both_ statuslines say: chrome/userChrome.css
 Ctrl-W p
both statuslines still say: chrome/userChrome.css

Similarly with
../../seamonkey/nexrdon9.default/chrome/userContent-example.css : as
soon as I supply the short name, _both_ windows for that file get (and
keep) the short name in their statusline.


What happens if you open the file in a window with the short name first,
and then pass expand('%') to MkVimball?


FWIW, I'm using gvim 7.3.661 (Huge) with GTK2-GNOME GUI.


In my case (Vim 7.3.154, Huge version with GTK2 GUI, Slackware 13.37), 
both windows display the original (long name).


A simple `:cd .` refreshes them both to use the short name, but not in a 
script that is sourced or run with `vim -e` (not even with :redraw).


Is there  way to check in advance that this would happen, so I can wipe 
the damn buffer (and load if later) ?


About using expand('%'), Vimball documentation says the files should 
always be relative (unless I intend to distribute some file like 
/etc/opt/plugin-config) that is meant to be absolute).


Thank you,
Timothy Madden

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Simon W. Jones
I read and tried it Marc but it didn't work for me. Thanks for responding.

Simon.

On Sunday, 16 September 2012, Marc Weber wrote:

  Many thanks for the many answers, unfortunately I am still struggling.
  sys.stdout.write(refs[int(chosen[1])][0])
 What about rereading what I wrote earlier?

 Marc Weber

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



-- 
---
Simon W. Jones

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Tim Johnson
* Gary Johnson garyj...@spocom.com [120916 10:50]:
 
 Do you see different behavior?
 
 Note that :retab! will not replace a single space by a tab.
  That did it.
  thanks, Gary
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Tony Mechelynck

On 16/09/12 21:14, Timothy Madden wrote:

When I have a file opened in a window with the long name, and then I use
:sv or :new with the short name as argument, then both statuslines
display the short name from then on, howsoever I switch windows among
them. Example:

 :pwd
/root/.mozilla/seamonkey/nexrdon9.default
 :sv ../nexrdon9.default/chrome/userChrome.css
statusline says: ../nexrdon9.default/chrome/userChrome.css
 :sv chrome/userChrome.css
_both_ statuslines say: chrome/userChrome.css
 Ctrl-W p
both statuslines still say: chrome/userChrome.css

Similarly with
../../seamonkey/nexrdon9.default/chrome/userContent-example.css : as
soon as I supply the short name, _both_ windows for that file get (and
keep) the short name in their statusline.


What happens if you open the file in a window with the short name first,
and then pass expand('%') to MkVimball?


FWIW, I'm using gvim 7.3.661 (Huge) with GTK2-GNOME GUI.


In my case (Vim 7.3.154, Huge version with GTK2 GUI, Slackware 13.37),
both windows display the original (long name).

A simple `:cd .` refreshes them both to use the short name, but not in a
script that is sourced or run with `vim -e` (not even with :redraw).

Is there  way to check in advance that this would happen, so I can wipe
the damn buffer (and load if later) ?

About using expand('%'), Vimball documentation says the files should
always be relative (unless I intend to distribute some file like
/etc/opt/plugin-config) that is meant to be absolute).

Thank you,
Timothy Madden



Well, expand('%:.') then. But expand('%') (without :p) ought to be good 
enough.



Patch 7.3.154 was released on 2 April 2011. I recommend that you upgrade.

See http://ftp.vim.org/pub/vim/patches/7.3/README for a one-line summary 
of each patch to Vim 7.3.



If Slackware distributes no version of Vim later than 7.3.154, then see

http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

about how to compile your own Vim on Unix-like systems. (The former of 
these web pages obsoletes the part of the latter about getting and 
patching the source.)



Best regards,
Tony.
--
The Ruffed Pandanga of Borneo and Rotherham spreads out his feathers in
his courtship dance and imitates Winston Churchill and Tommy Cooper on
one leg.  The padanga is dying out because the female padanga doesn't
take it too seriously.
-- Mike Harding, The Armchair Anarchist's Almanac

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Marc Weber
Excerpts from Simon W. Jones's message of Sun Sep 16 21:30:53 +0200 2012:
 I read and tried it Marc but it didn't work for me. Thanks for responding.
Hard to believe. Do you want to capture stderr?
let var = system('python script.py 21') is the way to go then.

What else can go wrong this way?

Marc Weber

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Simon W. Jones
Marc,

The solution that worked was the one provided by Tony, as I mentioned in my 
reply to him.  It was:

:update | let variablename = system('nameofscript  ' . 
shellescape(expand('%'),1))

I did try your suggestion (as I've already written).

-
Simon W. Jones.

On 16 Sep 2012, at 21:20, Marc Weber marco-owe...@gmx.de wrote:

 Excerpts from Simon W. Jones's message of Sun Sep 16 21:30:53 +0200 2012:
 I read and tried it Marc but it didn't work for me. Thanks for responding.
 Hard to believe. Do you want to capture stderr?
 let var = system('python script.py 21') is the way to go then.
 
 What else can go wrong this way?
 
 Marc Weber
 
 -- 
 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 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


Re: Putting stdout from Python into vim

2012-09-16 Thread Marc Weber
Excerpts from Simon W. Jones's message of Sun Sep 16 22:37:24 +0200 2012:
 :update | let variablename = system('nameofscript  ' . 
 shellescape(expand('%'),1))
system('nameofscript', join(getline(1,'$'),\n))

would be an alternative if you don't care about kind of line ending,
then you don't have to write the buffer.

I should have read all messages, I agree.

Marc Weber

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


Re: autochdir vs command-t

2012-09-16 Thread shawn wilson
On Sun, Sep 16, 2012 at 6:38 PM, Tony Mechelynck
antoine.mechely...@gmail.com wrote:
 On 16/09/12 20:08, shawn wilson wrote:

 i like autochdir so that i can easily rename files and :E stuff where
 i am. but, then if i use command-t again, it is limited to the current
 directory. how do i make the pwd of certain commands the path vim was
 opened in and the pwd of another set of commands the pwd of the file
 of the current buffer?


 What about not using 'autochdir' but

 :lcd %:h


that's not a bad solution. is there a way of getting the directory
where i opened vim back? so, basically some way of toggling between
the path of the file and the path i opened vim in? i could map it to
an f-key and be fine with that...

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


Re: Buffer name changed after :edit command

2012-09-16 Thread Timothy Madden

On 09/16/2012 10:48 PM, Tony Mechelynck wrote:

On 16/09/12 21:14, Timothy Madden wrote:

[...]

About using expand('%'), Vimball documentation says the files should
always be relative (unless I intend to distribute some file like
/etc/opt/plugin-config) that is meant to be absolute).

Thank you,
Timothy Madden



Well, expand('%:.') then. But expand('%') (without :p) ought to be good
enough.


Patch 7.3.154 was released on 2 April 2011. I recommend that you upgrade.

See http://ftp.vim.org/pub/vim/patches/7.3/README for a one-line summary
of each patch to Vim 7.3.


If Slackware distributes no version of Vim later than 7.3.154, then see

http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

about how to compile your own Vim on Unix-like systems. (The former of
these web pages obsoletes the part of the latter about getting and
patching the source.)


Slackware-current has a new version, and I am now running 7.3.645.
The behavior has been fixed in some cases, but not in others, so it did 
not help me much.


bash-4.2$ vim -V1 -nNes -i NONE -c 'version | echo  | qall!'

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 29 2012 16:49:50)
Included patches: 1-645
Compiled by volke...@slackware.com
Huge version without GUI.  Features included (+) or not (-):


bash-4.2$ vim -V1 -nNes -i NONE -c 'args | echo  | qall!' \
/home/adrian/.profile ../../.profile
~/.profile
~/.profile 16L, 376C
[/home/adrian/.profile] /home/adrian/.profile
bash-4.2$
bash-4.2$ vim -V1 -nNes -i NONE -c 'args | echo  | qall!' \
../../.profile /home/adrian/.profile
../../.profile
../../.profile 16L, 376C
[../../.profile] ../../.profile


I believe this behavior is intentional, the help files do say the 
arguments are added to the buffers list.


About expand(), it does return the relative file name as expected, but 
the presence of an already opend buffer with the long ../../ name still 
breaks MkVimball...


I believe all I can do in this case is to open each file as returned by 
fnamemodify() (that is, expand()) and if the buffer name is not the 
requested one, wipe it...


Thank you,
Timothy Madden

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Tim Johnson
* Tony Mechelynck antoine.mechely...@gmail.com [120916 11:02]:
 
 When you type : in Visual mode, you should see
 
   :','
 
 where ' means the first visually selected line and ' means the last 
 visually selected line. Don't erase these marks as you type :retab in 
 Visual mode. Or you could do without Visual mode, as follows:
 
   :set expandtab
   5:retab
  Elegant!

 (that second line will be expanded to :.,.+4retab and it should expand 
 tabs to spaces in the current line and the 4 following ones). Or
 
   :set noexpandtab
   5:retab!
  Again ... 
 to convert spaces to tabs instead.
 
 See
   :help v_:
   :help N:
 thanks 
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Timothy Madden

On 09/16/2012 11:37 PM, Simon W. Jones wrote:

Marc,

The solution that worked was the one provided by Tony, as I mentioned in my 
reply to him.  It was:

:update | let variablename = system('nameofscript  ' . 
shellescape(expand('%'),1))

I did try your suggestion (as I've already written).

-
Simon W. Jones.

On 16 Sep 2012, at 21:20, Marc Weber marco-owe...@gmx.de wrote:


Excerpts from Simon W. Jones's message of Sun Sep 16 21:30:53 +0200 2012:

I read and tried it Marc but it didn't work for me. Thanks for responding.

Hard to believe. Do you want to capture stderr?
let var = system('python script.py 21') is the way to go then.

What else can go wrong this way?


It looks to me what you actually needed was how to get the right input 
for the python script.


Timothy Madden

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


Re: Putting stdout from Python into vim

2012-09-16 Thread Tony Mechelynck

On 17/09/12 00:32, Timothy Madden wrote:

On 09/16/2012 11:37 PM, Simon W. Jones wrote:

Marc,

The solution that worked was the one provided by Tony, as I mentioned
in my reply to him.  It was:

:update | let variablename = system('nameofscript  ' .
shellescape(expand('%'),1))

I did try your suggestion (as I've already written).

-
Simon W. Jones.

On 16 Sep 2012, at 21:20, Marc Weber marco-owe...@gmx.de wrote:


Excerpts from Simon W. Jones's message of Sun Sep 16 21:30:53 +0200
2012:

I read and tried it Marc but it didn't work for me. Thanks for
responding.

Hard to believe. Do you want to capture stderr?
let var = system('python script.py 21') is the way to go then.

What else can go wrong this way?


It looks to me what you actually needed was how to get the right input
for the python script.

Timothy Madden



Well, at first you didn't mention what kind of input your script needed; 
I had to guess it from your mention of :%!nameofscript in a later post.



Best regards,
Tony.
--
With sufficient thrust, pigs fly just fine.
   -- RFC 1925

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


Re: expanding tabs in a visual selection

2012-09-16 Thread Tony Mechelynck

On 16/09/12 23:21, Tim Johnson wrote:

* Tony Mechelynck antoine.mechely...@gmail.com [120916 11:02]:


When you type : in Visual mode, you should see

:','

where ' means the first visually selected line and ' means the last
visually selected line. Don't erase these marks as you type :retab in
Visual mode. Or you could do without Visual mode, as follows:

:set expandtab
5:retab

   Elegant!


(that second line will be expanded to :.,.+4retab and it should expand
tabs to spaces in the current line and the 4 following ones). Or

:set noexpandtab
5:retab!

   Again ...

to convert spaces to tabs instead.

See
:help v_:
:help N:

  thanks



Beware though, that the former will convert hard tabs (but not 
backslash-t etc.) even in string literals, and that the latter will 
convert sequences of two or more spaces ending on a tab stop (i.e., in a 
column whose number is a multiple of the 'tabstop' value) even in string 
literals. IOW the :retab command doesn't know what quotes are for.


Best regards,
Tony.
--
We really don't have any enemies.  It's just that some of our best
friends are trying to kill us.

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


Re: autochdir vs command-t

2012-09-16 Thread Tony Mechelynck

On 16/09/12 22:46, shawn wilson wrote:

On Sun, Sep 16, 2012 at 6:38 PM, Tony Mechelynck
antoine.mechely...@gmail.com wrote:

On 16/09/12 20:08, shawn wilson wrote:


i like autochdir so that i can easily rename files and :E stuff where
i am. but, then if i use command-t again, it is limited to the current
directory. how do i make the pwd of certain commands the path vim was
opened in and the pwd of another set of commands the pwd of the file
of the current buffer?



What about not using 'autochdir' but

 :lcd %:h



that's not a bad solution. is there a way of getting the directory
where i opened vim back? so, basically some way of toggling between
the path of the file and the path i opened vim in? i could map it to
an f-key and be fine with that...



Hm... I thought there was a way to unset the lcd (like there are ways to 
set a local option back to the global setting, or any option to the Vi 
or Vim default), but I can't find it in the help. So here's a 
workaround, to be added to your vimrc


either (F5 to toggle)

let SIDcurdir = getcwd()
	map F5 :if getcwd() == SIDcurdir Bar lcd %:h Bar else Bar exe 
'lcd' SIDcurdir Bar endifCR


or (F5 to set, Shift-F5 to clear)

let SIDcurdir = getcwd()
map F5 :lcd %:hCR
map S-F5 :exe 'lcd' SIDcurdirCR

Note that :lcd %:h while editing a directory with netrw will set the 
current directory to the _parent_ of the directory being displayed. Use 
:lcd % (which doesn't work when editing a file) to set it to that 
directory itself.



Best regards,
Tony.
--
Organic chemistry is the chemistry of carbon compounds.  Biochemistry
is the study of carbon compounds that crawl.
-- Mike Adams

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