When setting linespace to some value greater than zero, the characters in the line are vertically top-aligned. I want the characters to be vertically centered (in the middle of the line).
The 'linespace' setting allows to slightly adapt the visual spacing of lines to the used font (so that text is neither too dense nor too much apart). It is not meant to be used for the "widely-spaced lines" effect shown in your screenshot.
If you really need something like that, you'd need to patch Vim's source code, or use another editor, or what I would attempt is modifying the used font to include more vertical padding in all glyphs.
Related
I've been using vim for a few weeks, and so far I've downloaded a few plugins including airline, nerdtree, and a colorscheme. When I downloaded some files with wget, I noticed that they weren't properly aligned. Text in the code files are normally supposed to be aligned in columns, and there generally shjouldn't be issues with indentation. As an example, when I try running the command cat filename.extension, I get this:
This is how the file is supposed to look. Everything is aligned neatly into columns without any issues. However, if I try editing the file in Vim, it instead looks like this:
The text for whatever reason is not aligned properly, and so far I am not sure how to resolve it...
The file appears to be using tabulations for indentation and alignment.
The de-facto standard width of a tabulation is 8 characters.
cat respects that "standard" to the letter, without the possibility of changing the tabulation width.
Vim also respects it by default but it allows the user to change the tabulation width and you tell it to use a tabulation width of 4 characters.
The file looks different because the two programs have different tabulation settings.
Therefore, if you want the file to look the same in the two programs, use the same tabulation settings. Since they can't be changed in cat, you will have to revert Vim's to their default values.
You didn't show us your vimrc so we don't know exactly what you did and we can't really tell you how to go about it.
When defining a :sign you can use the linehl argument to assign a highlight group for the whole line the sign is placed in.
This highlights the whole line until the end, but how I do to highlight only the text of that line?
Edit: The idea is to use Syntastic to show the errors and warnings, but I can't redefine the SyntasticStyleError sign to do what I want. It highlights all the line instead of only the text of that line.
It is not possible as far as I know. Look at the :h sign-define:
:sign define {name} {argument}...
Define a new sign or set attributes for an existing sign.
The {name} can either be a number (all digits) or a name
starting with a non-digit. Leading digits are ignored, thus
"0012", "012" and "12" are considered the same name.
About 120 different signs can be defined.
Accepted arguments:
icon={bitmap}
Define the file name where the bitmap can be found. Should be
a full path. The bitmap should fit in the place of two
characters. This is not checked. If the bitmap is too big it
will cause redraw problems. Only GTK 2 can scale the bitmap
to fit the space available.
toolkit supports ~
GTK 1 pixmap (.xpm)
GTK 2 many
Motif pixmap (.xpm)
Win32 .bmp, .ico, .cur
pixmap (.xpm) |+xpm_w32|
linehl={group}
Highlighting group used for the whole line the sign is placed
in. Most useful is defining a background color.
text={text} *E239*
Define the text that is displayed when there is no icon or the
GUI is not being used. Only printable characters are allowed
and they must occupy one or two display cells.
texthl={group}
Highlighting group used for the text item.
It does not offer you a straight-forward way to distinguish between the text background colour and the background colour of the line - in fact, you can only set the linehl parameter.
Maybe there is a hacky way to do what you want. I've stumbled upon this link you might find useful: https://sunaku.github.io/vim-256color-bce.html
Another interesting idea is explained on vim.wikia.com (link) in the Highlighting that stays after cursor moves section. It suggests using the following command:
:nnoremap <silent> <Leader>l ml:execute 'match Search /\%'.line('.').'l/'<CR>
This way you might mix it with the information you get from :sign place and replace signs with your custom highlighting method I posted above. It requires some scripting though.
When I split window, an ugly split line appears. I wonder why there is grey spaces between the '|' separator. I want only the '|'.
By the way, I use mac iterm2. I wonder some vim plugins cause this, but not sure.
In most fonts, the default pipe symbol (|) doesn't run the whole height of the display cell. In your screenshot, the spacing between lines is particularly pronounced.
You may either influence this in your terminal emulator settings (by changing fonts or reducing the line spacing), or in Vim by configuring a different character for the vertical separator:
set fillchars-=vert:\| | set fillchars+=vert:\
This replaces the default with a space (note the trailing space!) You can also try a Unicode character (should your terminal be able to display this); there are some vertical bars that run the whole length.
I've discovered many sources which have said it cannot be tightened up and that the space between letters within a word is not something the user can adjust. At first I didn't believe it, but after applying a few tips such as this and having the editor continue to display text with the letters evenly spaced, I wonder.
Has anyone experienced or come across a way to set letter spacing?
Vim (out of necessity, because it runs in the terminal) and GVIM (for consistency) use a cell-based addressing scheme, so they require a fixed-size matrix of screen cells. On Windows GVIM, you even can only use fonts that are fixed-width.
Therefore, the only way to influence the perceived spacing between letters is through the selected font (and its size). If you feel that the letters are too far apart, you need to either edit the font (to reduce the width of all characters), or choose another one.
GVIM does allow to tweak the vertical padding between screen lines through the 'linespace' option, though.
Bulit-in documentations look like this in smaller gVim windows:
while normally it should look like (capture from larger gVim window):
Is there any way to 'fix' the line breaks when viewing documentation in smaller windows?
Use the :nowrap option, which says (in part):
This option changes how text is displayed. It doesn't change the text
in the buffer, see 'textwidth' for that.
When on, lines longer than the width of the window will wrap and
displaying continues on the next line. When off lines will not wrap
and only part of long lines will be displayed. When the cursor is
moved to a part that is not shown, the screen will scroll
horizontally.
The help files are written with hard wraps at position 78; see the modeline at the bottom; it contains tw=78.
Especially with todays gigantic monitor sizes, terminals with less that the 1970s-standard 80 character width don't make sense. If your issue is with vertical splits of the help, just don't do that :-) (use the default horizontal splits).
The long-proposed, but so far not applied breakindent patch would provide a lot of what you want, though: The indent wouldn't be cluttered by the broken lines (but you'd still have a ragged right edge).