pearofducks / ansible-vim

A vim plugin for syntax highlighting Ansible's common filetypes
MIT License
796 stars 98 forks source link

First line garbage display #61

Open cddouma opened 6 years ago

cddouma commented 6 years ago

When opening a yml file with this plugin enabled, I see only: ---2;2R^[[>1;5200;0c^[]10;rgb:2e2e/3434/3636^G^[]11;rgb:ffff/ffff/ffff^G This stays for a second or two and then the rest of the file appears. A clear and redraw of the screen (^L) makes the line disappear.

This happens on any yml file I've encountered (for example, those generated by: ansible-galaxy init foo).

pearofducks commented 6 years ago

Are you able to provide any reproduction for this? Does it work against a minimal vimrc (like the one below)?

set nocp
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
Plug 'pearofducks/vim-quack'
call plug#end()
filetype plugin indent on
syntax on
colorscheme solarized
set ai
set si
cddouma commented 6 years ago

I've spend some time going through all the startup code (I needed some of the debian vimrc as well). I've got a nice reproducer now. It seems to be a bad interaction between vim-syntastic/syntastic and pearofducks/ansible-vim. I've not reported this to syntastic (yet) although there is a chance it is entirely their fault. See the attached reproduce.zip.

Thanks for looking.

barlik commented 6 years ago

I don't use synstastic and I've seen that output in the past as well. I reckon it's a bug in vim that might have already been fixed with later versions. I'm on 8.1.22.

OurFriendIrony commented 6 years ago

I have also found "garbage" output upon installation of this plugin. "^[[>1;2802;0c" appears as the last lines output and moves with scrolling text.
Running VIM version: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)

 24     <input name="right"     type="axis"   id="0"    value="1"   />
 25     <input name="a"         type="button" id="0"    value="1"   />
 26     <input name="b"         type="button" id="1"    value="1"   />
 27     <input name="x"         type="button" id="3"    value="1"   />
 28     <input name="y"         type="button" id="4"    value="1"   />
 29     <input name="start"     type="button" id="11"   value="1"   />
 30     <input name="select"    type="button" id="15"   value="1"   />
 31     <input name="pageup"    type="button" id="6"    value="1"   />
 32     <input name="pagedown"  type="button" id="7"    value="1"   />
 33   </inputConfig>^[[>1;2802;0c

and upon scroll

 29     <input name="start"     type="button" id="11"   value="1"   />
 30     <input name="select"    type="button" id="15"   value="1"   />
 31     <input name="pageup"    type="button" id="6"    value="1"   />
 32     <input name="pagedown"  type="button" id="7"    value="1"   />
 33   </inputConfig>^[[>1;2802;0c
 34   <inputConfig type="joystick" deviceName="Microsoft 360 Wireless Receiver (XBOX)">
 35     <input name="up"        type="axis"   id="1"  value="-1"    />
 36     <input name="down"      type="axis"   id="1"  value="1"     />
 37     <input name="left"      type="axis"   id="0"  value="-1"    />
 38     <input name="right"     type="axis"   id="0"  value="1"     />

I'm using vundle to manage plugins. Current vimrc config as below:

"-----------------------------------------------------
" VUNDLE
"-----------------------------------------------------

" Turn off vi compatibility
  set nocompatible
  set encoding=utf8
  filetype off
  set rtp+=~/.vim/bundle/vundle/
  call vundle#rc()

" Plugin manager
  Plugin 'gmarik/vundle'

" Plugins
  Plugin 'vim-airline/vim-airline'
  Plugin 'vim-airline/vim-airline-themes'
  Plugin 'scrooloose/nerdtree'
  Plugin 'Xuyuanp/nerdtree-git-plugin'
  Plugin 'tpope/vim-fugitive'
  Plugin 'markcornick/vim-terraform'
  Plugin 'pearofducks/ansible-vim'
"  Plugin 'ekalinin/dockerfile.vim'

" Plugin config
  " Airline
    let g:airline#extensions#tabline#enabled = 1
    let g:airline_powerline_fonts = 1
    let g:airline_theme = 'term'
    let g:airline_section_y = []

  " Nerdtree git
    let g:NERDTreeIndicatorMapCustom = {
        \ "Untracked" : "?"
        \ }

"-----------------------------------------------------
" MAPPINGS
"-----------------------------------------------------

  map <C-Right>   :next<CR>|            " Move to next file
  map <C-Left>    :prev<CR>|            " Move to prev file
  map <S-Right>   :wnext<CR>|           " Save - Move to prev file
  map <S-Left>    :wprev<CR>|           " Save - Move to next file

  map <F2>        :NERDTreeToggle<CR>|  " Show nerdtree
  map <F3>        <C-W><C-W>|           " Change window

  map <F4>        :%s/\t/  /g<CR>|      " Convert tabs to spaces
  map <F5>        :w<CR>|               " Save file
  map <F6>        <S-I>//<ESC>|         " Block comment with '//'
  map <F7>        <S-I>#<ESC>|          " Block comment with '#'
  map <F9>        :edit!<CR>|           " Re-load file

  map <F10>       :set paste!<CR>|      " Paste Mode    [on/off]
  map <F12>       :set number!<CR>|     " Line Numbers  [on/off]

"-----------------------------------------------------
" GENERAL
"-----------------------------------------------------

" System
  filetype plugin on
  syntax on
  set backspace=indent,eol,start
  set t_Co=256

" Tabs
  set expandtab
  set shiftwidth=2
  set softtabstop=2

" Search
  set hlsearch
  set incsearch
  set smartcase
  set ignorecase

" Layout
  set number
  set laststatus=2
  set noshowmode

"-----------------------------------------------------

If I open a file that that has fewer lines than the current occuppied windows max lines, garbage does not appear. It appears regardless of whether it is a .j2, .yml, .xml. If I shrink my vimrc down to the following, the error does not occur:

  set nocp
  set rtp+=~/.vim/bundle/vundle/
  call vundle#rc()

  Plugin 'gmarik/vundle'
  Plugin 'pearofducks/ansible-vim'

  filetype plugin indent on
  syntax on
  set ai
  set si

Anyway, hope this helps in the debug. Let me know if you want me to try anything else

OurFriendIrony commented 6 years ago

I've done a bit more testing by adding/removing other plugins and it seems to be (at least in my case) a conflict between a couple of plugins:

" Plugins
  Plugin 'vim-airline/vim-airline'
  Plugin 'vim-airline/vim-airline-themes'
"  Plugin 'scrooloose/nerdtree'
"  Plugin 'Xuyuanp/nerdtree-git-plugin'
  Plugin 'tpope/vim-fugitive'
"  Plugin 'markcornick/vim-terraform'
"  Plugin 'chase/vim-ansible-yaml'
  Plugin 'pearofducks/ansible-vim'
"  Plugin 'ekalinin/dockerfile.vim'

With this combo it seems to show the garbage output. This plugin just happens to be the bottom of the list.
Also tried adding this plugin instead of pearofducks "chase/vim-ansible-yaml" and the issue appears again.