How to use relative line numbering universally in Vim - configuration

I love the relative line numbering feature in Vim 7.3, but am having trouble making it stick universally. For many files, line numbering reverts to absolute mode, even though I have specified:
set rnu
in my .vimrc file. Any idea what could be causing this? I am using Vim 7.3 on OSX 10.6, with the Janus package of extensions.

Try using :verbose set rnu? and :verbose set nu? to find the script that is causing the problem.

Add this to your .vimrc.after:
set nonumber
set relativenumber
Relative line numbers should persist with these settings.

Try putting set rnu at the very end of your .vimrc. Relative numbering is mutually exclusive with absolute numbering. I suspect Janus is trying to be smart and sets absolute numbering for some filetypes.

Related

Prevent double-indent

What's the code style setting to prevent PhpStorm from adding an extra indentation level when pasting arrays from clipboard?
The most obvious (continuation indent) does not seem to be the one:
It's Editor/ General/ Smart Keys/ Reformat on paste:
Setting it to Indent Block appears to fix the issue while keeping the auto-format feature working.

How can I get Vim HTML syntax highlighting to colour the whole tag?

As a PhpStorm user, one of the disappointing things I come across when I try using Vim is the way it does syntax highlighting in HTML:
Vim colours just the tagname and attributes,leaving the <, / and > in a different colour. What's the point of that? I find this distracting compared to the view I get in PhpStorm:
(Ignore the different colour scheme.) I find it harder to read code with all those < and > characters. How I can modify Vim to do this?
I'm using the monokai colour scheme for Vim.
You don't need to modify the HTML syntax itself - this can all be done by overriding the default links. syntax/html.vim defines syntax groups for the various HTML elements, and (at the end of the script) then links those to certain highlight groups, the appearance of which is determined by your colorscheme. If you establish a different link (in your ~/.vimrc), this will be honored. So, to make the entire tag appear like the tag name, use this:
highlight link htmlTag htmlTagName
highlight link htmlEndTag htmlTagName
Make a local copy of syntax/html.vim in ~/.vim/syntax/html.vim (where the first filename is your system install dir).
Experiment with changing the hilight group of htmlTag and htmlTagEnd (near the bottom of the syntax file) to match the hilight group of htmlTagName. I like the default, so I only experimented on a few files, and it didn't seem to break anything. Being the same colour, there shouldn't be anymore chevrons sticking it to your receptor cones.
Being such a simple minded test, this does likely break something somewhere, and you'll probably have to spend a few minutes with the other hilight groups to get a consistent look.

PhpStorm, remove line numbers spacing

Does any know how to remove the spacing after the line numbers in PhpStorm (v10)
When you have 2 or 3 vertical columns it is just a waste of real estate!
You can disable "gutter icons" in the settings (I'm running PhpStorm 2016.3)
This removes all vertical spacing from the right of the line numbers.
As darkomen said PhpStorm use this space for various functionalities:
For example with the Symfony2 plugin, you have icons to navigate to services classes or Twig templates. You also have a bracket that shows you the "current context" of where your cursor is located.
But indeed, you seem to have more space than my setup, perhaps you should try to change the font used for these columns numbers.

vim: about adding new rules to indentation configuration files

in order to get correct indentation in my html5 files, I have added lines like this below to my /usr/share/vim/vim73/indent/html.vim:
call <SID>HtmlIndentPush('header')
As you can guess header is a new tag in html5..
Now I don't know if I should leave those lines in that file or create another file in ~/vim/indent/html.vim that overwrites that /usr/share/vim/vim73/indent/html.vim.
What is your advice?
Take into account that I'm versioning my ~/.vim.
I see that you are using Vim 7.3.
Vim 7.4, which is the current "stable" (in quotes) release, has had its support for HTML improved. I checked the indent script and I can see that it does have code for new HTML5 tags, including header.
You could try upgrading your Vim to 7.4 and your problem will probably simply disappear.

MacVim tabwidth inconsistency issue

I have a python script with 3-spaces before each line as indent. Now I want to make further editing easier and added "set tabwidth=3" in my $HOME/.vimrc file. It works when editing under MacVim, however, when later running it, python complained about the inconsistent indent between the original '3-spaces' indents and my new '1-tab' indent. Not sure why and how to work it out.
Use
set ts=3
set expandtab
this should work for you.