Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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...


In reply to Re: developing in vim and tmux by morgon
in thread developing in vim and tmux by morgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-05-20 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?