Block highlighting in vim - vim

I tried to do syntax highlighting in vim, but I've got weird color highlighting letters on blocks. On black, it is not much of a problem, but when it's sunny blue, it's not readable, so I would prefer a light background.
~/.vimrc does not seem to respond to set background=light if there is no colorscheme.
I'm not very proficient with vim, and I think I might have turned on a function inadvertently, by accidental key strokes. Is there a way to turn off all kind of search and highlight?
I'm reading readmes, but this makes it difficult. The image below shows my screen.

I've heard about such incomplete screen updates occurring then the value of $TERM isn't right. Especially inside a screen / tmux session, be sure to have set the correct value (screen-256color in that latter case).
You could try GVIM (the non-terminal GUI version of Vim) to get moving with your work; it shouldn't have those issues.
I think I might have turned on a function inadvertently, by accidental key strokes
Fear not, any settings only persist by editing the ~/.vimrc file (or by saving a session). You'll always get a clean new instance by quitting and re-starting Vim.

Related

Vim motion keys sometimes appear on screen when using tmux

When I'm not in insert mode and I'm navigating around my file with the motion keys (hjkl etc), the keys often appear in the buffer (illustrated below). I can observe this effect pretty readily in tmux, but it doesn't seem to happen without. If I run :!reset in vim the buffer returns to normal, but it doesn't stay that way for long. I'm not sure why this is happening and google yielded nothing. Halp?
Edit: It seems just a simple :e will fix the problem, too.
I experience the same thing. A few extra observations:
it only seems to happen when I hold down a motion key like j or k, causing rapid repeats
it happens both in and outside of tmux, but much more often in tmux
it happens much more often since I enabled vim-go's go_auto_sameids, which I believe is making a call to an external program (guru) for every cursor movement
This leads me to assume that it's a timing issue in vim that is exacerbated by latency added by things like tmux and/or plugins.
(Using gnome terminal; $TERM is screen-256color in tmux and xterm-256color outside)
I think this was alluded to on the tmux mailing list recently. Try decreasing the value of the escape-time parameter in tmux, so that tmux more quickly sends the escape character to vim to return to command mode, rather than waiting for more characters in an escape sequence. The default value is 500ms, so try something smaller, like 50.
In .tmux.conf:
set-option -g escape-time 50

Mac OSX Terminal Vim displays javascript code with weird and horrid shade

I develop javascript and just recently I found that I still love to use Terminal Vim instead of MacVim. Then I was totally annoyed when I opened my usual javascript file in the Terminal Vim: the statements of the code are irregularly highlighted with a mysterious color.
Just to clarify that other file types I have opened (e.g. c, html etc.) do not have the problem. I have scoured website but I could not find an answer. This is just so unacceptable, could someone help me out. A million thanks!
My .vimrc screen shot:
You appear to be using Syntastic.
The first line with the red background seems to be marked as an error.
The Error highlight group is very often set to use a red background.
My conclusion is that what you see is exactly what you should see. It is ugly on purpose and designed to look like that: you don't want to miss errors, do you?
However, Syntastic can be set to not use the Error highlighting to mark errors but the "signs" feature instead which is a lot less ugly.
You should have read the Syntastic documentation as it is all explained in plain english:
:help syntastic-error-signs
Also, set background=dark is not very useful (it doesn't change the background color, if that's what you want) and can be removed safely from your ~/.vimrc.
I found out that it was this plugin jslint.vim that caused the text to be highlighted. The problem is that this plugin could not be disabled properly which I thought I did. Thanks to the hint of #romaini, syntactic is a better plugin to check code errors and make proper configuration.
As a side note, for those who would like to use vim solarized color scheme, please use the solarized terminal color scheme first. Otherwise the color scheme won't be displayed properly.
Thank you for all of your comments and answers! Really appreciated.
Try changing your colorscheme. Open the file in Vim, then do
:colorscheme blink
To cycle through all possible colourschemes, type :colorscheme, then a space, then press Tab. When you reach a colorscheme that sounds promising, press Enter, and see if the text looks OK. Keep doing this until you find a colorscheme that you like.
Once you have found a colorscheme that you like, copy its name, and put the following in your .vimrc:
colorscheme name
(name is the name of the colorscheme you like.)
My favourite colorscheme is blink, but there are many good ones. You can even go online and download new ones if the defaults are not good enough.
Seems the syntax are not recognized correctly. Could you try:
:set filetype=javascript
One other thing to look at to make things look better (will change colors not highlighting). Make sure that your terminal reports itself as xterm-256colors. You can check this by typing echo $TERM.
If it doesn't return xterm-256colors go to Preferences -> Settings -> Advanced (tab) on the profile you are using.
Change the drop down at the top to xterm-256colors.

What is the difference between gVim and gVim easy?

The question is self explanatory, but I haven't found a single resource that explains what the difference is after an hour of searching. After poking around a little bit in both, it appears that gVim and gVim easy are identical.
Gvim easy is started and locked in insert-mode (every character you type is printed like a simple notepad).
Standard gvim starts in normal mode and you have to toggle between normal/insert like all other vim.
From help:
Easy mode. Implied for |evim| and |eview|. Starts with
'insertmode' set and behaves like a click-and-type editor.
This sources the script $VIMRUNTIME/evim.vim. Mappings are
set up to work like most click-and-type editors, see
|evim-keys|. The GUI is started when available.
{not in Vi}
gVim-Easy, which is installed with gVim, has all the functionality of
normal gVim but lacks modes. This is especially useful for begginers
and people who do not want to, or do not have the time to, learn how
to use gVim. Users can benefit from gVim's superior syntax
highlighting and auto-indentation while not having to have to learn
the, often deemed complex, command set of gVim in order to edit a
simple document. It is recommended that readers of this tutorial at
least try to learn how to use gVim in normal mode, the learning curve
is steep, but, the benefits in speed and usability this confers is
worth the investment.
Read here
gVim Easy: gvim.exe -y (pass a parameter y)
gVim: gvim.exe
It seems that Insert and Replace are available modes, and command mode is missing. And at first glance it appears to have lost the ability to save a document using keystrokes - the File menu shows only ":w" for Save and without command mode, the command simply isn't there. What isn't shown however is Alt-F followed by S - this works, although also missing is the status line confirmation of the file being written.

Strange TeX syntax highlighting behaviour in vim

I have a bit of a strange problem with [La]TeX syntax highlighting in vim. vim seems to randomly switch between three different syntax highlighting styles, with little rhyme or reason. It doesn't appear to do this for other languages, though I haven't written anything except LaTeX (using syntax highlighting) for a while now.
So: a bit of background. This problem started becoming noticeable when I switched terminal emulators (to urxvt), but it also appears in roxterm, konsole, and gnome-terminal.
Playing around with the value of the TERM environment variable does appear to affect the result: changing TERM from the default of rxvt-unicode-256color to xterm or linux appears to make vim not choose the third, but the first two appear to be selected at random.
I've done some Googling, to no avail. My google-fu is perhaps weak, and I apologize if this is a common problem that I've managed to overlook . . .
For reference, what the three styles look like in a sample document:
Any thoughts or suggestions would be much appreciated.
According to this website, for TeX files, Vim scans the file and guesses whether it is LaTeX, ConTeXt, or plain TeX based on the keywords used therein. Now this is a guess, but maybe every once in a while, while you're editing, you're adding or removing some keyword that is causing it to change its guess each time.

Vim color schemes don't load anymore

Today I installed the last version of MacPorts on my laptop, since then (though I cannot be sure that this is the real cause) vim's color schemes don't load anymore. Instead, a strange black-and-white color scheme shows up, in which line numbers and reserved keywords are underlined.
If I try to change color scheme the syntax highlighting changes a bit, but still black and white.
Note that MacVim, which shares .vimrc with text-based vim, display the correct color scheme.
I have already tried relaxing file permissions on the colors and syntax directories in the vim directory.
Do you have any idea on what could have happened?
Thank you
Tunnuz
This sounds like an issue with vim's ability to detect if your terminal supports colors. Take a look at this from the vim documentation, specifically the second bullet point.

Resources