Questions tagged [alignment]
The alignment tag has no usage guidance.
0
votes
2answers
60 views
Substitute tabs for equivalent number of spaces
N.B I use the word blank here due to lack of a better word. By blank I mean the remaining part of a tab that is visualized after the starting part. Please feel free to edit this question.
I know ...
3
votes
1answer
54 views
How can I get Tabular to only work with certain lines and to use spaces as a delimiter?
How can I get Tabular.vim to only consider and affect lines that match /^item\s/, to use /\s\+/ as the delimiter, to left-align everything, and to use at least three spaces between words?
For example:...
1
vote
2answers
90 views
Working with line continuations (\).
When working in the C language, sometimes you have to write multi line macros like the following.
#define SOME_FUNCTION_LIKE_MACRO(a,b) \
foo(a); \
bar(b); ...
0
votes
1answer
42 views
Align Righthand Side Comments
I have a bunch of assembly code that needs commenting and I want to avoid having to space forward to make a comment every time just to align the comments.
movq %rdi, %rdi # comment
jne label ...
-1
votes
1answer
16 views
EasyAlign: Why first line is not aligned?
I have below shortcut and function to align code.
map <leader>vga :call Vhdl_GA_All()<CR>
" Alignment
function! Vhdl_GA_All()
exe ":'<,'> EasyAlign *<space>"
exe ":'<...
4
votes
1answer
182 views
vim-easy-align: How to align multiple characters with single command?
I've created several keys and each key is working fine.
Want to find a way to do multiple alignments with single command. Like to create a key mapping, when it's running it can align the specific ...
1
vote
1answer
24 views
How can I align the comment at the end of sentences when the comment predictor is already shown?
I want to align commens on multiple lines neatly, and found the following question and answer (I used the tabular package), but then I found out that it needs the comment specifier NOT to be shown on ...
1
vote
1answer
45 views
How can I adjust ='s alignment of C-style comments?
I'd like = to indent block C-style comments like this:
/*
Comment.
*/
not this:
/*
Comment.
*/
Note the extra space before the last *. (I would like to automatically align the first / and the ...
1
vote
2answers
92 views
How can I center align a word(s) in a table?
Say I have the table:
| TITLE |
| This is some text |
Can I center align the TITLE like so?
| TITLE |
| This is some text |
I've tried using both EasyAlign and Tabular but ...
2
votes
1answer
107 views
Is it possible to align the results in the quickfix list in columns
Currently, when I view the quickfix list with :cw, the columns/pipes are not aligned, as in this example:
I wonder if there is an option in vim or a plugin to rearrange the pipes so that they align ...
1
vote
3answers
412 views
simple map to right align text selection within visual block?
This should be easy but it seems to be a blind spot in vim. I'm looking for a short one line mapping, let's say to <leader>r, to right-align text inside a visual block selection. For example, ...
1
vote
1answer
258 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 ...
6
votes
3answers
264 views
align/spread file content in vertically split windows
I have a single buffer open across multiple vertically split windows and all the windows have scrollbind set. However, before setting scrollbind, I had to scroll down in second window in order to make ...
3
votes
2answers
236 views
How can I add a visual margin on the right of my window?
Here is my document; the entire text is on a single line:
However, I would like it to be not so wide; for example by using set textwidth=40 and gq I get my desired results:
The problem with this is ...
4
votes
1answer
447 views
How to sort lines by the right most characters?
When I enter visual mode, :'<,'>sort allows me to sort alphabetically the lines I have selected, obviously starting from the left most characters on a line going to the right.
Is it possible to ...
4
votes
2answers
88 views
How to move word under current cursor to begin at current cursor?
My cursor is on the f of the first line. I'd like to move the word so that it aligns with the word below it. I know I could b i spaces until they align. I'd like to avoid getting in insert mode.
0
votes
3answers
480 views
Vim-easy-align: how to align delimeter on right
Fo example, this piece of code in rails:
t.string :receipt_number
t.timestamp :transaction_timestamp
t.string :transaction_type
t.decimal :cash_amount
t.decimal :card_amount
Now, I want ...
4
votes
1answer
166 views
Align code functions documentation
Is there an easy way to align a function documentation (I'm using Python) from this:
arg1 :: Some text
arg2345 :: Some very long text text text text
arg3:: Other text
to something like:
arg1 ::...
6
votes
4answers
2k views
How to add space around a symbol using vim?
I have following code. I want to add spaces around =. With the minimal keystrokes (May be with the help of macro). Do not want search and replace approach.
<div className="row">
<div ...
6
votes
1answer
393 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 ...
1
vote
1answer
83 views
perl multi line comments are not aligned properly
With Vim 7.2, when a perl block is aligned using =,
Multi line comments are moved as per the blocks inner alignment. But they should be placed at immediate start of the line.
Is there any way to ...
3
votes
1answer
290 views
Align C preprocessor definitions
How do I align C preprocessor definitions using vim's Align plugin?
Something like:
#define ORING 'r'
#define OLRING "ring"
where the string 'r' should be aligned with "ring".
I don't find any ...
0
votes
1answer
47 views
Using Align plugin
I want to align C variables declariations with the Align plugin using \adec as parameter, the problem is that it doesn't do anything.
struct mutex {
pthread_mutex_t listmsg;
pthread_rwlock_t ...
5
votes
3answers
307 views
How can I replace a word in a column without changing the width
I'm writing cucumber example tables, which are formatted like this:
| title | title |
| data | data |
| data | data |
How can I replace one of the data or title cells with a word of ...
10
votes
1answer
823 views
How do I align C++ comments to be compliant with Google styling?
Any way to get Vim to format my comments to comply with Google cpplint?
Top section is not compliant, to comply 5 changes are required.
keep this comment at the same level
Add a space after //
add ...
6
votes
1answer
556 views
Neovim format ruby code like rubocop
is there any chance to format code to satisfy rubocop?
By default my neovim is indenting code like that:
class Test
attr_accessor :a, :b, :c,
:d, :e, :f
end
However, it would be nicer to have ...
5
votes
1answer
252 views
A plugin to align comments
I often edit code where I have a general comment for a block of code and specific comment for each line. For instance, this a sample of my .vimrc.
"indentation
set autoindent "...
4
votes
0answers
87 views
How to align a Latex table that uses \multicolumn?
I want to align a Latex table the way it appears in the final document.
There are various Vim plugins for aligning tables (2, 3, 4), but none of them handle the spanning cell correctly. The code ...
2
votes
1answer
276 views
easy-align spaces around delimiters
I'm using vim-easy-align plugin and when in bash scripts I try to align $ at the beginning of variable names, the aligning adds spaces around the delimiter, i.e. <space>$<space> which of ...
5
votes
1answer
146 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
0answers
60 views
How do I make Vim highlight a margin? [duplicate]
I want to make Vim highlight the entire margin past column 79. I've seen other people's editors have a nice indicator bar or margin for maximum line length. What do I add to my config?
37
votes
5answers
24k 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.
...
11
votes
4answers
1k views
How to left-align two columns of text?
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
6
votes
2answers
844 views
Creating & maintaining flowcharts in Vim
Here is a simple text-based flowchart I made in Vim for a weblog post:
[DNS request]
|
|
[Adsuck]
|
...
35
votes
6answers
10k 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 ...
9
votes
4answers
2k 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:
################################################################################
##################...
25
votes
4answers
7k 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
3answers
21k 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 ...