On 02/28/12 05:41, [email protected] wrote:
  im looking for a posibillity for fast "underlining" some Text with a
  charakter like "=" or "-", which is used in markdown-Syntax.

  I.E. if I write some comment in a program like

  # This is an big Headline
  # =======================
  #
  # And this a normal headline
  # --------------------------

  So it would be nice to expand the "=" or "-" with a command up to the
  end of the upper line.

  How can I do this? Is there a builtin for this? Makro?

There are two possibilities that occur to me. The first is if you want the *whole* line underlined. There are lots of ways you can do this. I personally use

  :t.|s/./-/g

(which could be wrapped up in a macro) because it doesn't tromp my scratch register. I know other people use a macro that does something like

  YpVr-

to "Y"ank the current line, "p"aste it, "V"isualize the line, and "r"eplace each character in that selection with a "-". Note that changes your scratch/yank registers' contents.

You can map them something like

  :nnoremap <leader>- :t.<bar>s/./-/g<cr>
  :nnoremap <leader>= YpVr=

so you can (by default, based on your 'mapleader' setting) type

  \=

to underline the current line with "="s. I put in both styles so you can see how each would work, but I'd pick the one that's clearest to you and stick with it for both cases.


The other case regards visually marking a sub-portion of a line as underlined such as

   I only want this part underlined, okay?
               --------------------

That's a lot harder, so if it's what you want, time can be taken to cook up something, but there are some non-trivial edge-cases that would have to be addressed.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to