Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Toggling test plans with vim

by Smylers (Pilgrim)
on Aug 09, 2006 at 11:12 UTC ( #566380=note: print w/ replies, xml ) Need Help??


in reply to Toggling test plans with vim

... you might want to save this as ~/.vim/plugin/ToggleTestPlan.vim.

Or even better, save it as ~/.vim/ftplugin/perl_toggle_test_plan.vim; using the ftplugin/ directory and putting perl_ at the start of its name will ensure it's only loaded for Perl files.

map ,tp :call ToggleTestPlan()<cr>
That would be better written as:
map <buffer> ,tp :call ToggleTestPlan()<cr>

That will make the mapping local to the current buffer, so it won't leak out into other (non-Perl) files you subsequently open in the same Vim session.

Why were they defined like that (with <SID>)? Who knows?

<SID> is the script ID, a unique ID which identifies the source file which has this code in it. By using it like this it allows other scripts also to define a SaveCursorPosition() function without their names clashing. Basically if you're ever defining a function which will only ever be invoked from the current file (or from a mapping defined in the current file) then use <SID>.


Comment on Re: Toggling test plans with vim
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-04 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls