Remove Vim first column highlight - vim

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.

Related

vimdiff - disable highlighting a particular line

I doing a code-review for a colleague. I have opened the diff using vimdiff. There are over 50 changes within the same file. Each line that has a diff is highlighted. Thus, I have close to 50 highlighted lines. As I work through the code review, I would like to mark the lines I have fully reviewed as OK. One way to do this, would be to tell vim to not highlight that line anymore. Is there a way to do this?
You could use this:
highlight Hignore ctermfg=black guifg=black
command! D call matchadd("Hignore",getline('.'))
Typing :D will highlight the current line according to Hignore. To recover the original highlighting do :call clearmatches().

How to remove row lines in vim?

How do i remove the row lines at the start of the line? I typed the command
:s/^/# /
while in command mode and it suddenly appeared. I typed the command again, but it's still in my editor. I was trying to comment out a few blocks of code. This is the stackoverflow page I was following: What's a quick way to comment/uncomment lines in Vim?
Please see the image below to see what I'm pertaining to. Thanks in advance!
Vim highlights the current search pattern; this is the 'incsearch' option; either you have it explicitly turned on in your ~/.vimrc, or you use a recent Vim 8 version that has this enabled by the defaults.
Check with :hi IncSearch; it should show the same white-underscore-onblack formatting as your screenshot. You can also use a :hi command to customize this (or choose a different colorscheme).
To turn this off, use
:nohlsearch
You can shorten that to :noh; some people also define a mapping to quickly clear this. Alternatively, you can also search for something else.

Different cscopequickfix behavior for vimrc and command line

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!

un-highlight columns in vim

I'm using vim 7.3 on a new system and have noticed something very annoying while editing files with long lines. vim is highlighting all text past column 80. Sure, I can see how this might be handy but I want to turn it off. It doesn't appear to be the colorcolumn setting - I can turn that on and see a single column highlighted by the original highlighting is still there.
Here is a screenshot:
Can anyone please advise?
Vim doesn't do that by default: that's probably a variant of this old trick. Check your ~/.vimrc and ftplugins.

How to prevent Vim indenting wrapped text in parentheses

This has bugged me for a long time, and try as I might I can't find a way round it.
When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is very annoying. For example, this works fine
Here is some text... over
two lines.
but this doesn't
Here is some text... (over
two
lines
If anyone can tell me how to turn this off (just for text/latex files) I'd be really grateful. Presumably it has something to do with the fact that this is desired behaviour in C, but I still can't figure out what's wrong.
:set nocindent
The other options do nothing, and the filetype detection doesn't change it.
There are three options you may need to turn off: set noai, set nosi, and setnocin (autoindent, smartindent, and cindent).
This may be related, when pasting from gui into terminal window, vim cannot distinguish paste modes, so to stop any odd things from occuring:
set paste
then paste text
set nopaste
I had similar issues trying to paste xml text, it would just keep indenting. :)
gvim, the gui version of vim, can detect paste modes.
You can have a look at the autoindent option :
autoindent - ai
Copy indent from current line when starting a new line (typing
in Insert mode or when using the "o" or "O" command). If you do not
type anything on the new line except and then type or
, the indent is deleted again. When autoindent is on,
formatting (with the "gq" command or when you reach 'textwidth' in
Insert mode) uses the indentation of the first line. When
'smartindent' or 'cindent' is on the indent is changed in specific
cases. The 'autoindent' option is reset when the 'paste' option is
set. {small difference from Vi: After the indent is deleted when
typing or , the cursor position when moving up or down is
after the deleted indent; Vi puts the cursor somewhere in the deleted
indent}.
From the official Vim documentation
filetype plugin indent on
This switches on three very clever
mechanisms:
Filetype detection. Whenever you start editing a file, Vim will try to
figure out what kind of file this
is. When you edit "main.c", Vim will
see the ".c" extension and
recognize this as a "c" filetype.
When you edit a file that starts with
"#!/bin/sh", Vim will recognize it as
a "sh" filetype. The filetype
detection is used for syntax
highlighting and the other two
items below. See |filetypes|.
Using filetype plugin files Many different filetypes are edited with
different options. For example,
when you edit a "c" file, it's very
useful to set the 'cindent' option to
automatically indent the lines. These
commonly useful option settings are
included with Vim in filetype plugins.
You can also add your own, see
|write-filetype-plugin|.
Using indent files When editing programs, the indent of a line can
often be computed automatically.
Vim comes with these indent rules for
a number of filetypes. See
|:filetype-indent-on| and
'indentexpr'.
:set noai
sets no auto indent tt may be smartindent though. Check out the doc and see if you can find something more
http://www.vim.org/htmldoc/indent.html

Resources