Questions tagged [alignment]
Alignment is the organization of content elements by tokens/symbols and/or by column or line locations.
10
questions
6
votes
2answers
376 views
Align a block of code on the basis of a single character
The question's title might sound a little vague, so I'll explain the situation here more clearly.
I have these lines of code in a file which I want to align with respect to the character =.
const ...
14
votes
7answers
3k views
How to left-align two columns of text? [duplicate]
If I have a text file like this:
alpha: 1
beta: 2
gamma: 3
delta: 4
epsilon: 5
Is there a way to align the numbers like so?:
alpha: 1
beta: 2
gamma: 3
delta: 4
epsilon: 5
65
votes
4answers
48k views
How can I set up a ruler at a specific column?
When coding in different languages, I tend to need to restrict my lines to a specific length (usually 79 or 80 characters).
I've seen this done in other editors through the use of a ruler (solid line ...
58
votes
6answers
50k views
How to add indentation guides/lines
In Sublime Text 2, you get vertical guides where your indentation is, like this:
but in vim I obviously don't:
Is there a way to show lines like that in vim? By the way, my indentation is 2 spaces.
...
5
votes
1answer
431 views
How to align statements around a particular word or token?
I want to align my statements around a particular word or token.
Example:
import React from 'react';
import { browserHistory, Router, Route } from 'react-router';
import Main from ...
35
votes
4answers
14k views
How can I easily create and maintain tables?
Here is (part of) a table I use in some documentation:
+---------------+------------------------+---------------------------------------+
| TASK NAME | WHEN | DESCRIPTION ...
42
votes
6answers
16k views
Can I justify text in Vim?
The only reason why I'd ever edit a text file in Pico or Nano, and not in Vim was its "Justify" command ^J. It would reformat a paragraph of text, creating line breaks at word breaks so that the text ...
13
votes
4answers
3k views
Adding 80-column wide comment header block with centered text
For some reason or another I often divide the code into subsections separated by headers like these:
################################################################################
##################...
5
votes
1answer
163 views
Is there a way to push existing text left while inserting (e.g., insert right-aligned text)?
In insert mode, typing normally moves the cursor right and pushes text to the right of the cursor farther to the right on the line. I am typing some right-aligned text and am wondering - is there a ...
1
vote
1answer
459 views
How can I right-align end-of-line comments with the Tabular plugin?
I often have code that looks something like this:
a = 1 # description 1
longer_name = 2 # description 2
# no_longer_needed = 3 # ignore
another_name = 4 # description 4
and would like to right-align ...