2 votes
Accepted

Best way to downport funcrefs and partials from 8.2 to 7.4

The newer function() signature was introduced with Vim patch 7.4.1559. It may have been applied to some Vim 7.4 builds. Should you decide to port a script, with a view to touching as few lines as ...
Aliaksei Budavei's user avatar
2 votes

How to swap lines programmatically in file?

"#!/usr/bin/perl -d" <-> "#!/usr/bin/env perl" First off, you do not want to remove the '-d', in fact you want to change the whole line. If you want to do that not for one ...
bakunin's user avatar
  • 125
2 votes

How to swap lines programmatically in file?

Here's a POSIX-portable version that only relies on ed and can be shoved into a shell script: printf %s\\n '1s/ -d' wq | ed -s $file This uses the shorthand for s that only requires the delimited ...
D. Ben Knoble's user avatar
  • 25.4k
2 votes
Accepted

How to swap lines programmatically in file?

To toggle a file's shebang, I'd use the following quick and dirty one-liner: :1s@^#!/usr/bin/\zs.*@\=submatch(0)=='perl -d'?'env perl':'perl -d' In English, that's: in line 1, substitute the ...
Friedrich's user avatar
  • 1,259
1 vote
Accepted

Script in autoload is not running

A script in autoload is loaded when a function that is defined in your autoload script is called. The autoload scripts have been introduced to optimize the Vim startup time. Instead of loading all the ...
Vivian De Smedt's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible