Sourcing Remote Sesssions / Vimscript question

2013-07-11 Thread steadystatic
I love Vim's sessions and create them all the time locally enjoying the use of 
my .vimrc with plugins and color schemes, etc.

But I would love to do this on servers I regularly work on from my local 
machine like:

  :source scp://server-name/work.vim

This works somewhat but the files are empty so I usually check the session file 
for lcd /whatever/path and some something like:

  :tabdo :e scp://server-name/file/path/%

and I'm back working again.

This is begging me to script it (or if there's a better way to do this please 
enlighten me!).

Only problem is thus far is my VimScript foo being weak, here's what I'm 
starting to stub out:

function RemoteCheck()
let sesh_path = expand('afile')
let test_for_scp = scp:
if match(remote_sesh, test_for_scp)
:echom 'this is indeed scp sesh do something about it'
else
:echom 'nope just a regular .vim file to source proceed'
endif
endfunction

autocmd SourceCmd *vim call RemoteCheck()

I think I have a few syntax issues so far – can someone help me? This is like 
my second vim function ever so it's slow going so far. 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/groups/opt_out.




Re: Vimscript Question

2011-04-21 Thread niva
Ok I was looking in another approach...more objects.

Maybe I can use elseif like Ben says for instant.

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


Vimscript Question

2011-04-20 Thread niva
Hi,


I am writing a vimscript that contains recursivecondition block.

if cond1

else
  if cond2
  else
 if condN
 else
 
 endif
  endif
endif

How canI code to avoidrecursive conditional block and have an object
approach?

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


Re: Vimscript Question

2011-04-20 Thread Marc Weber
Excerpts from niva's message of Wed Apr 20 21:25:48 +0200 2011:
 Hi,
 
 
 I am writing a vimscript that contains recursivecondition block.
 
 if cond1
 
 else
   if cond2
   else
  if condN
  else
  
  endif
   endif
 endif
 
 How canI code to avoidrecursive conditional block and have an object
 approach?

Talk about your use case. Copy paste more code so that we know what the
hell you're talking about. I don't see object usage here.

let conditions = [['a=7','echo 7'],['a=8','echo 8']]

for [c,action] in conditions
  exec 'let c_result = '.action
  if c_result
exec action
  endif
  unlet c, c_result, action
endfor

This still sucks and I'm not sure that
this is what you're looking for.
Instead of exec you could be using call('functionname',...)

If you have to do real programming use one of the many :h if_tab
implementations.

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: Vimscript Question

2011-04-20 Thread Ben Fritz


On Apr 20, 2:25 pm, niva nivaem...@gmail.com wrote:
 Hi,

 I am writing a vimscript that contains recursivecondition block.


What is a recursive condition block?

Are you just looking for elseif?

-- 
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: Vimscript Question

2011-04-20 Thread Tim Chase

On 04/20/2011 06:15 PM, Marc Weber wrote:

let conditions = [['a=7','echo 7'],['a=8','echo 8']]

for [c,action] in conditions
   exec 'let c_result = '.action
   if c_result
 exec action


I think, to mimic the OP's structure, you need a break in here


   endif
   unlet c, c_result, action
endfor


-tim

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