Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: developing in vim and tmux

by morgon (Priest)
on Apr 21, 2016 at 02:48 UTC ( [id://1161055]=note: print w/replies, xml ) Need Help??


in reply to developing in vim and tmux

New feature.

Running perl-scripts is nice and dandy, but sometimes these scripts needs arguments...

So here is how to add arguments to your perl-script:

Add this to your .vimrc:

function! PerlArgs() let @p = getline(".")[1:] endfunction let mapleader=" " map <Leader><space> :VimuxRunCommand("perl " . bufname('%') . " " . @p +)<CR> map <Leader>a :call PerlArgs()<CR>
The idea is to let the vim-register p hold the arguments you want to supply to your script.

You have to set them only once and run the script with these args as many times as you want. Only when you want different arguments you need to set them again.

Assume this script:

#hubba bubba print join "\n", @ARGV;
To run this script without arguments you simply hit <space> twice.

To supply the arguments "hubba bubba", you place your cursor on the first line and press <space>a.

This puts the content of this line (excluding the first character '#') into register p, which will be used when you call the script with <space><space>.

I hope I don't misuse this section, my idea is to improve productivity with trivial code that is understandable, as opposed to using plugins or tools that no-one understands...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1161055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found