Vim Tips Wiki

Insert line numbers with a Perl filter

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 569 Printable Monobook Previous Next

created September 30, 2003 · complexity basic · author mosh · version 6.0

" Create a menu item to call Perl on the file.
" Edit the -e "script" before pressing return to filter thru Perl.
" Script below works shell=sh, and add line numbers to the file.
:amenu Mo1.Format.NumberLines<Tab>:!perl :1,$!perl -ne \"printf(\\"\%3d:\%s\\",\$.,\$_);\"

See Insert line numbers for other methods.


Also on Fandom

Random Wiki