Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • %!sort -- sorts all of the lines in the file

    I've rarely found that useful...more often it's:

    ma -- mark line as line "a" now go down to another line
    mb -- mark line as line "b"
    :'a,'b!sort -- sort lines "a" through "b"
    • In vim, I use a visual selection for the job. Shift-v in normal mode takes you to visual line mode; select the line range you want to manipulate, then type :!sort. Note that vim will automatically type '<,'> for you when you go from visual mode to command mode, so the command actually executed is '<,'>!sort, which filters the selected lines through sort.

      Very handy. Also nice for selectively perltidying code and such.

  • Put a .vimrc file in your home directory and in the file put "syntax off" and you should be good to go.
  • All the things you mentioned apply to vim also, I believe. Here's one that I know works in vim, and might work in nvi.

        >i{ -- indent the enclosing { ... } block