Different cscopequickfix behavior for vimrc and command line - vim

If I do set cscopequickfix=g- in my vimrc file, it does not work: search results do not get listed in quick fix window.
But if I do :set cscopequickfix=g- from vim command line, it starts working as expected.
What's even more puzzling to me, is that g search is the only one that this happens to. The rest of them e-, s-, etc... if I put set cscopequickfix=e-,s-, in my vimrc file, search results for them get directed to quick fix window correctly.
Ideas? Thanks!

Related

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.

macvim mapping works when set in command line but not in vimrc

I want to map cmd-left/right to W and w to navigate splits. So I tested right from the command line (in normal mode):
:map <D-Left> <C-w>W
And it works like a charm. When I had the same line (minus the colon, obviously) in my .vimrc, the mapping is not set.
The closest question I found seem to be related to cygwin only. I also don't believe I am running against a terminal hijacking issue (launching macvim from the finder doesn't change the behaviour) nor does CMD-left/right seem to be an OS wide shortcut.
I must be missing something terribly simple here but I can't find out what.
Thanks in advance for any help/hints
You can try :verbose map <D-Left> to find in which script the mapping were defined for the last time

Changing NERDTree ~/.vimrc options on the fly without restarting VIM

I would like to change my sort order dynamically. At times, I want my sources to be listed alphabetical, at times I want only one extension to be shown.
I can currently get it to work by editing NERDTreeSortOrder in my ~/.vimrc.
But how do I do this without re-launching VIM?
I tried just executing ":let NERDTreeSortOrder = ['new sort order']" but that doesn't really change anything. i add it to my vimrc, quit VIM and restart and it works.
By the way, if someone can tell me how to make NerdTree show only a specific extension, that would work for me too. I know I can make NERDTree not show a particular file type by adding it to ignore, but I want the other way around.
Any ideas?
You'll need to refresh the directory (after entering let NERDTreeSortOrder=[...]).
While in the NERDTree buffer, either :
r to limit the refresh to the selected directory
R to refresh from the start of the root node.
As for whitelisting specific file extensions, have at look at this question.
Have your tried source-ing your .vimrc from within vim?
:source $MYVIMRC or :source ~/.vimrc
:source can be shortened to :so, e.g. :so ~/.vimrc

Remove Vim first column highlight

Some how the first column of any vim buffer is being highlighted. I didn't notice until today so I'm not really sure when the change happened. I tried to mess around with the search options and highlighting options but I was not successful.
Does anybody have any idea to what may be causing this?
Here is a screenshot:
Here is my vimrc: https://tinyurl.com/mrbcu77
I don't know if you wrote your vimrc by yourself. If you search in that file for colorcolumn, you found two lines:
50:set colorcolumn=+1
and
70:set colorcolumn+=1
70 line, you force the 1st column to be highlighted.
remove that line and try again.
also you auto load (source) vimrc by autocmd when it was saved. you can try opening it in vim, and save it 10-20 times, see how slow your vim would be. You should clear autocmds before create them.

the weirdest VI problem EVER

Ok, so I am trying to type the following in .cshrc file: alias ls 'ls --color=auto'. I type one character at a tiem.
However, when I reach --color= i type a and cursor goes to the next line.
I checked the .vimrc file and didn't fine anything out of whack. I am using vim7.2
EDIT
I noticed it is only happens in the .cshrc file, and cursor starts blinking with ' character.
I had "set mouse=a" set in .vimrc file
What is the problem?
Do you have textwidth set? If so it'll break your lines once they reach a certain length. Inspect the value via
:set textwidth?
Set it to 0 to turn off hard line-wrapping. Otherwise, do you have a mapped to something weird in insert mode? Check
:imap a
to see if you do.
I cannot test it now, but probably something wrong with the appropriate indent file for that filetype. Does it happen if you edit some other configuration file ?

Resources