Defining the settings for the vim help file - vim

With opened vim help file the command
:set conceallevel=0
works fine and e.g. the "|" signs for the internal links are showed as expected, but unfortunately, it remains not permanent, i.e., jumping to another link hides the "|" signs again.
As I put this setting into my .vimrc as into my .gvimrc too to make it permanent, there is no effect at all, while other settings from my config files are applied properly.
So are there any local definitions for the vim help file?
Perhaps I didn't look for this deeply enough, but because I think it is from some importance for other people too, I've got the courage to ask this question here ;-)
I really appreciate any suggestions...
(Tested with VIM 7.4 from 2013 August 10 from the ubuntu repository)

Yes, as with most filetypes, Vim has help-specific settings that override your generic settings.
You can use :verbose to see where an option was set:
:verbose set conceallevel?
The default ftplugin for help files is where conceallevel is set:
$VIMRUNTIME/ftplugin/help.vim
To override that setting, create ~/.vim/after/ftplugin/help.vim and put this line:
setlocal conceallevel=0

Related

vim81 configuration wrong after I added .vimrc

I uninstalled vim74 and compiled vim81 and installed it. However I found it strange, comparing to vim74. When there's no .vimrc file under HOME dir, I open a c++ file and syntax highlight is working and I can use Backspace to delete letters. However when I add a .vimrc under HOME dir and just put set number into it, when the c++ source file is opened, no highlight, and Backspace not working. Why is that ? I used to add some configurations in .vimrc under vim74 before, and this situation never happens.
After complaints that Vim in its default configuration is hard to use (especially for beginners), it was decided to enable a default configuration if the user hasn't created his own ~/.vimrc (yet). This was introduced with Vim 8.0, and explains what you're seeing (namely: syntax highlighting and sensible backspace behavior). Read more about the details at :help defaults.vim.
The help also has instructions how to keep the defaults when adding your own ~/.vimrc configuration:
If you create your own .vimrc, it is recommended to add these lines somewhere
near the top:
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
Then Vim works like before you had a .vimrc.
Tip: Don't go all crazy with adding various snippets (especially not those you don't fully understand) and plugins to your ~/.vimrc, even though the Internet is full of them. Rather, build it up gradually, depending on needs, and back up your understanding with careful studying of the excellent :help. Also, avoid pre-packaged Vim distributions; they're even worse.

Can not switch to previous page in gvim

I have a very weird problem which did not exist in my environment before but now happened. When editing files, I'm used to doing this way:
gvim . #open current directory browsing
scroll up/down to select file, enter then edit.
ctrl-6 #back to previous directory
However one day I found the step3 was failed, it said "No alternate file".
My .vimrc file only contains:
colorscheme darkblue
set number
set autoindent
set nowrap
set ignorecase
set cursorline
I tried to clean all content in .cshrc but the same.
Can anyone tell me what's wrong with my gvim ?
Thanks in advance.
This looks to be a change in behavior introduced in Vim 7.4. The netrw view is no longer stored as an alternate file. See this discussion.
The Vim maintainers seemed split on what the correct behavior should be, but Bram himself offered up this advice with a mapping:
I do realize that editing the directory of the current file is
something I often do, but I never bothered to set up a mapping for
it. Typing ":e %:h" is not too difficult, but CTRL-O to jump back to
the netrw %directory view was easier.
I now added a mapping:
map ,d :e %:h<CR>
Let's see if I can get used to that.
Another related discussion can be found here.
You are likely using netrw to edit a directory. This is the equivalent of :Explore. Sadly netrw has a bad habit of not maintaining the alternative buffer, #. You maybe able to upgrade netrw or use :Rexplore (:Rex for short) to resume exploring.
Another option is to just use :e with wildcards and tab completion to explore files. Use <c-d> to list out completions as well.

Vim weird behaviour with backspace with empty .vimrc

I'm having a weird issue with vim on Ubuntu. I've been using it for the last few weeks, trying to learn, on Windows and it behaves differently now that I'm using it on Linux.
I noticed that while in insert mode pressing backspace will delete text just like any other editor on Windows, but on Linux the text is "deleted" yet it stays there until I press ESC or write over it.
I was trying to fix this but I'm confused as to whether this is intended behaviour or not. It happens in gvim too.
The reason of this question is this, however:
I deleted my .vimrc file to see if any of my config was at fault and it fixed it. Backspace was now back to its regular self.
But then I tried creating an empty .vimrc file and that made it go back to the delayed delete. It's empty. Why the hell?
So I have no idea what's causing this. Hope my question makes sense my English ain't the best. Thanks.
Alright so looking at :h compatible I found this:
"When a |vimrc| or |gvimrc| file is found while Vim is starting up,
this option is switched off, and all options that have not been
modified will be set to the Vim defaults. Effectively, this means
that when a |vimrc| or |gvimrc| file exists, Vim will use the Vim
defaults, otherwise it will use the Vi defaults. (Note: This doesn't
happen for the system-wide vimrc or gvimrc file, nor for a file given
with the |-u| argument). Also see |compatible-default| and
|posix-compliance|."
So if I'm getting this right, running Vim with a .vimrc file should automatically set nocompatible and running it without one should set compatible... ? Whatever the case, I tried checking with :verbose set compatible? and it always says nocompatible is on so the -N flag shouldn't do anything... Yet it fixes the issue.
Without a vimrc Vim will load /usr/share/vim/vim80/defaults.vim (depending on your vim version). In this file the bs/backspace parameter is set to 2, or actually it is indent,eol,start which is the same as 2 (see :h bs)
Now if you create an empty .vimrc, defaults.vim will not be loaded, so your bs will possibly be 0.
This behaviour is described in :h defaults.vim
So to solve your problem, just put set bs=2 in your .vimrc
Alright I fixed it.
Running vim with the -N command makes it work properly. I'm not sure why but that's what's happening.

set tags=tags in gvimrc not working, unless set it explicitly

I have a problem to set my tags file correctly. It use to work without problem after I reinstalled the system. error message like
E433: No tags file
E426: tag not found: Pids
accurs when I press ctrl+].
I have this line in my .gvimrc file
set tags=~/projectdirectory/tags
and tags-exuberant installed properly.
It works fine when I type :set tags=~/projectdirectory/tags in gvim
I also tried use set tags=~/projectdirectory/tags;/
All other .gvimrc settings function well. How this could be possible?
UPDATE:
I have solved the problem, it is because I have multiple tags setting in ~/.gvimrc, vim take the last one in current session.
You can check the actual effective value (after starting GVIM) via
:verbose set tags?
The option might have been overwritten by a later :set command, or a plugin.
Even if you only use GVIM, it's recommended to put the general settings into ~/.vimrc (which is also sourced in GVIM), and keep ~/.gvimrc reserved for GUI-specific settings. An important difference between the two is that the latter is only sourced at the very end, so it's unsuitable for configuring plugins.

Vim is (seemingly) Ignoring My Configurations

I've been using vim daily at work for almost 2 years now, and I've never really had any issues except for in the last two days...
My initial problem was that vim was using 8 spaces for tabs despite my settings in .vimrc. It even refused to let me reset the tab settings from within the vim instance itself. Furthermore, this problem was only happening when editing a specific file, and only while it was named a specific thing (i.e., renaming it fixed the problem). I assumed this must be due to some kind of per-file configuration that I was unaware of, and some searching led me to another post which prompted me to try the following command:
:so ~/.vimrc
This fixed my original problem, but I still don't know what caused it. I didn't do anything that I recall, it just sort of started happening as far as I can tell.
Today I deleted a swap file and all of the sudden my syntax highlighting is gone for a single file (the same one that was affected by the original issue). Again, renaming the file fixes the problem, and it running syntax on has no effect. This time :so ~/.vimrc doesn't alleviate the problem.
Does anyone have any idea what is happening here?
Update:
Thanks to Benoit's suggestion I found out that my vim was looking at a file in ~/.vim/view for some settings. When I moved this file, the issue was resolved (and vim created a new version). I'm still not 100% sure happened, but at least now I have something to look into.
Thanks Benoit!!
Your settings are probably modified by filetype specific files.
To know when a setting has been modified:
:verbose set setting?
for example:
:verb set tabstop?
:verb set expandtab?
:verb set shiftwidth?
Also, you could find autocmds for your file type:
:autocmd *.ext
probably some autocmd sets the file type, thus triggering .vim files that modify your settings.
FWIW, I've kept my vim settings in ~/.exrc for the last half-decade or so, without trouble.

Resources