Thursday, April 21, 2016

Re: Right Aligning Mid-line After a Marker?

On Thu, Apr 21, 2016 at 12:34 AM, Mike K. <lists@koralatov.com> wrote:
> I'm trying to work out how to make vim right-align comments in my various
> config files whilst leaving the rest of the line where it is.
>
> Here's what my .muttrc currently looks like:
>
> set attribution = "* %n wrote on %D:" # Date in ISO 8601 format
> set include = yes # Include original message in reply
> set indent_string = "> " # Use `>' as quote character
> set nomarkers # Don't add marker to wrapped lines
>
> And here's what I'm trying to make it look like:
>
> set attribution = "* %n wrote on %D:" # Date in ISO 8601 format
> set include = yes # Include original message in reply
> set indent_string = "> " # Use `>' as quote character
> set nomarkers # Don't add marker to wrapped lines
>
> So, my question is this: is it possible to get vim to insert the required
> number of spaces to get all the text after the `#' to align on the right,
> say in column 78? I've tried googling and came up with nothing.
>
Are you aware of align vim plugin
(http://www.vim.org/scripts/script.php?script_id=294)? This has tons
of options and you might find something in there that matches what you
need.

I came close with,
:AlignCtrl lr
:Align #

This converted the text to:
set attribution = "* %n wrote on %D:" # Date in ISO 8601 format
set include = yes # Include original message in reply
set indent_string = "> " # Use `>' as quote character
set nomarkers # Don't add marker to wrapped lines

Comments are right aligned (as in your desired output) and (but..) the
'#' is also aligned (maybe you want that too?). You can also check the
alignment maps specifically meant for comments.. (\adcom etc).

Also check the other justification tools mentioned in the description
page (I haven't used any of these):

> Note: this plugin is not a left&right margin justification tool! See vimscript#177, vimscript#2324, or vimscript#3728 for that.

An alternate align tool is also mentioned in the plugin page.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment