gabesoft / vim-ags

Silver searcher plugin for vim
183 stars 12 forks source link

Weird highlighting characters #9

Open mikekreeki opened 9 years ago

mikekreeki commented 9 years ago

Thanks for a useful plugin!

Anyway I have some highlighting issues in Macvim. I tried to disable colors using let g:ags_agexe = 'ag --nocolor' but the issue is still there on some lines.

Any ideas?

gabesoft commented 9 years ago

Do you mind pasting the raw text from the search window in here. Only what's visible in the screenshot would suffice. This could be a syntax highlighting bug.

mikekreeki commented 9 years ago

Actually when I try to do that it copies the text correctly (without any highlight markers).

Interestingly when I select a line that has correctly highlighted line number using V the highlighting markers appear. Also when I move the cursor on the line with broken highlighting it fixes it (only on some lines). Its hard to describe the issue in letters but it definitely looks like a highlighting bug.

gabesoft commented 9 years ago

The nocolor option works for me when I pass it from the command line Ags --nocolor current but that's not a solution as that removes all highlighting. So, are the results the same for you with or without that option? Also, do you have a recent version of the plugin?

gabesoft commented 9 years ago

Seems to work fine for me otherwise. screen shot 2015-04-01 at 8 29 32 am

mikekreeki commented 9 years ago

I think I have the latest version (installed yesterday).

When I run with --nocolor on command it works but has no color obviously.

If it works for you maybe some other plugin is messing with it. Will try in clean vim installation.

gabesoft commented 9 years ago

One more thing, the highlight markers are used for coloring the syntax. If you want to see the raw text you can do :syntax off. But, on copy those markers are removed. You can still paste the text with the markers if you use the 0 register "0p

gabesoft commented 9 years ago

I also wonder if this could be a vim version discrepancy. My version is

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 13 2015 23:48:18)
MacOS X (unix) version
Included patches: 1-622
gabesoft commented 9 years ago

I'm closing this as there seems to be no new input.

blueyed commented 9 years ago

I was seeing the same issue, both with Vim (patch 692) and NeoVim (recent version).

It looked like this:

[1;31mdocs/conf.py[0m[K
[1;30m125 [0m[K-# of the sidebar.
[1;30m126 [0m[K-#html_logo = None
[1;30m127 [0m[K-
[1;30m128 [0m[K:64:# The name of an image file (within the static path) to use as [32;40mfavicon[0m[K of the
[1;30m129 [0m[K-# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
[1;30m130 [0m[K-# pixels large.
[1;30m131 [0m[K:7:#html_[32;40mfavicon[0m[K = None
[1;30m132 [0m[K-
[1;30m133 [0m[K-# Add any paths that contain custom static files (such as style sheets) here,
[1;30m134 [0m[K-# relative to this directory. They are copied after the builtin static files,

This appears to be caused because the &filetype of the buffer is not being set, and that seems to be a consequent of using Neobundle to load the plugin after Vim startup, just with NeoBundle "gabesoft/vim-ags" (for testing it).

The file ftdetect/agsv.vim is not being sourced/used in this case.

It would require to do filetype off and filetype plugin on first.

Adding the plugin to vimrc proper (before the filetype command fixes it).

mikekreeki commented 9 years ago

For me the filetype for ags buffer is set correctly. My .vimrc goes like this:

" GENERAL
  set nocompatible
  filetype off

" PLUGINS
  set rtp+=~/.vim/bundle/Vundle.vim
  call vundle#begin()

  Plugin 'gabesoft/vim-ags'

  call vundle#end()

" GENERAL
  filetype plugin indent on
  syntax on
blueyed commented 9 years ago

@mikekreeki And does it look like in my paste for you? Does :filetype off, :filetype plugin indent on fix it for you? Or when you reload the file (:e)?

gabesoft commented 9 years ago

@mikekreeki I still think that in your case it may be a syntax bug because only some of the lines don't get highlighted. But, I wasn't able to reproduce the problem just from the screeshot. It would help if you could paste the original text from your file.

ghost commented 9 years ago

@blueyed I've got the exact same issue as you did, using pathogen, but moving the pathogen#infect() line around doesn't fix it:

execute pathogen#infect()
syntax on
filetype plugin indent on

ftdetect

Doing :set filetype=agsv fixes the rendering.

ftdetect is not being called apparently and I'm not sure why :(

smith commented 9 years ago

I was able to fix it by putting

autocmd BufWinEnter {*.agsv} syntax on

in my vimrc.

mikekreeki commented 9 years ago

@smith Your solution works for me too :+1:

ghost commented 9 years ago

@smith didn't work for me (where did you put it?)

However this did:

autocmd BufNewFile,BufRead,BufEnter *.agsv set filetype=agsv

It's still a hack though.

smith commented 9 years ago

@vaskas it's somewhere in the middle :) after the Vundle setup stuff.

zamaterian commented 9 years ago

When using junegunn/rainbow_parentheses.vim the above problem occurs. The filetype and syntax are correctly set to agsv.

Cheers

gabesoft commented 9 years ago

Unfortunately, I'm not able to reproduce this. The search results display fine for me even when the rainbow parentheses are enabled. However, you could try disabling them for agse and agsv file types.

autocmd FileType agse,agsv RainbowParentheses!
zamaterian commented 9 years ago

Thnx, thats a work around. Let me know if you want me to try out something :)