Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: function to run vim



OK, as i was writing this response, I figured it out (or the solution
- I'm just guessing at the problem). But, I think some library got
updated and I haven't rebooted / zsh sessions are old. what's weird is
that in an old session, I show the same ZSH_PATCHLEVEL as in a new
one. I'll have to see if I can figure out what libraries running
processes are linked against...

Thanks for the reply

On Wed, Nov 13, 2013 at 12:13 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 13,  6:18am, shawn wilson wrote:
> }
> } A while I made a function so that I could keep one vim session (gvim
> } really) and that running 'vim file' would open the file in a new tab
> } in that session. Recently, it has stopped working.and I'm not sure
> } why.
>
> What version of zsh is this (and has that changed recently)?  What does
>
> % print $ZSH_PATCHLEVEL
>
> say?
>

1.5778

> Does the function work if you do NOT pass the --remote-tab option?
>

Didn't test - I assume that would've failed

> Are you running vimfunc via an alias?  If so, does the behavior change
> if you actually type out the full command word "vimfunc ..."?
>

Yeah, it's an alias so that I can do \vim to actually run plain vim.
It does the same thing if I do 'vimfunc file'

> Try "functions -t vimfunc" to enable execution tracing and then run the
> function in the way that fails.
>

That's cool, I'll use that....
 % vim schroot.conf
+vimfunc:1> local cmd
+vimfunc:2> local servername
+vimfunc:3> local remote
+vimfunc:4> local misc
+vimfunc:5> local version
+vimfunc:7> echo swilson
+vimfunc:7> tr '[:lower:]' '[:upper:]'
+vimfunc:7> local 'username=SWILSON'
+vimfunc:9> local 'opt_ex=^-'
+vimfunc:11> [ 1 -gt 0 ']'
+vimfunc:12> case schroot.conf (--servername)
+vimfunc:12> case schroot.conf (--remote*)
+vimfunc:12> case schroot.conf (--version*)
+vimfunc:12> case schroot.conf (*)
+vimfunc:40> misc=' schroot.conf'
+vimfunc:43> shift
+vimfunc:11> [ 0 -gt 0 ']'
+vimfunc:46> cmd=vim
+vimfunc:48> [ '!' -z ']'
+vimfunc:51> cmd='vim --servername SWILSON'
+vimfunc:54> [ -z ' schroot.conf' ']'
+vimfunc:64> [ '!' -z ']'
+vimfunc:67> cmd='vim --servername SWILSON --remote-tab  schroot.conf'
+vimfunc:70> echo 'vim --servername SWILSON --remote-tab  schroot.conf'
vim --servername SWILSON --remote-tab  schroot.conf
+vimfunc:71> 'vim --servername SWILSON --remote-tab  schroot.conf'
vimfunc:71: command not found: vim --servername SWILSON --remote-tab
schroot.conf
+vimfunc:72> return

> By the way, I think you have a typo here:
>
> }         # list version if we asked for that
> }         if [ ! -z version ] ; then
> }             cmd="$cmd --version"
> }         fi
>
> The [ -z version ] is always going to fail.  Needs $version instead.

Good catch - I just put that in for completeness and never tested it (obviously)



Messages sorted by: Reverse Date, Date, Thread, Author