Loading ...
Sorry, an error occurred while loading the content.

Re: Calling a function from a :s command (weird results)

Expand Messages
  • Charles E. Campbell, Jr.
    ... Since = doesn t nest, I thought I d donate a couple of maps. They don t work with = in a substitute, but they will mirror-reverse the order of characters
    Message 1 of 11 , Dec 1, 2003
    View Source
    • 0 Attachment
      David Fishburn wrote:

      >I have this function (from a previous posting):
      >
      >
      >
      Since \= doesn't nest, I thought I'd donate a couple of maps.

      They don't work with \= in a substitute, but they will mirror-reverse
      the order of characters on the current line:

      nmap <Leader>fR :set
      lz<CR>o<Esc>mqkO<Esc>mpj:s/./&\r/ge<CR>:'p+1,'q-1g/^/m
      'p<CR>:'p+1,'q-1j!<CR>'pdd'qddk:set nolz<CR>

      vmap <Leader>fR :<C-U>set lz<CR>:let ai=&ai<CR>:set
      noai<CR>`>maa<CR><Esc>`<i<CR><Esc>jmz:'a+1,'z-1s/./&\r/g<CR>:'a+1,'z-1g/^/m
      'a<CR>:'a,'zj!<CR>:let &ai=ai<CR>:set nolz<CR>

      The two maps should be on one line, of course.

      To use \fR on a range of lines:

      :[range]norm \fR

      will do the trick.

      Regards,
      Chip Campbell
    Your message has been successfully submitted and would be delivered to recipients shortly.