Einenlum / yaml-revealer

A vim plugin to easily navigate through Yaml files
MIT License
72 stars 7 forks source link

Errors appear in non-yaml files #5

Closed soulshake closed 2 years ago

soulshake commented 3 years ago

Hi and thank you for this wonderful, life-improving plugin.

Occasionally, when editing non-yaml files, I get some unexpected errors like the following:

image

I have cloned yaml-revealer to ~/.vim/plugin (commit 62a63ef45763e6a214105b5c8317a7da30ba04a7). I don't think my vim config is relevant; this occurs even with an empty .vimrc.

Any idea what might be causing this?

Einenlum commented 3 years ago

Hi @soulshake,

First, sorry for the long delay (I missed the notification) and thank you for your nice compliments :). I have to say it's a weird behavior. The ftplugin should only enable the plugin on yaml files. Does it happen specifically on some types of files (like go) or you don't see any pattern? Also, do you use vim or neovim? If so, which version?

soulshake commented 3 years ago

It seems to happen regularly with .go files. It may have occasionally happened on other file types but I don't recall for sure. I get the behavior on both of my computers. I'm using regular vim, compiled with python3 support as shown below.

vim --version ``` $ vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 21 2020 09:17:43) Included patches: 1-2029 Compiled by aj@zagreb Huge version with GTK2 GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary +arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path +mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte +termguicolors +balloon_eval -footer +multi_lang +terminal +balloon_eval_term +fork() -mzscheme +terminfo +browse +gettext +netbeans_intg +termresponse ++builtin_terms -hangul_input +num64 +textobjects +byte_offset +iconv +packages +textprop +channel +insert_expand +path_extra +timers +cindent +ipv6 +perl +title +clientserver +job +persistent_undo +toolbar +clipboard +jumplist +popupwin +user_commands +cmdline_compl +keymap +postscript +vartabs +cmdline_hist +lambda +printer +vertsplit +cmdline_info +langmap +profile +virtualedit +comments +libcall -python +visual +conceal +linebreak +python3 +visualextra +cryptv +lispindent +quickfix +viminfo +cscope +listcmds +reltime +vreplace +cursorbind +localmap +rightleft +wildignore +cursorshape -lua -ruby +wildmenu +dialog_con_gui +menu +scrollbind +windows +diff +mksession +signs +writebackup +digraphs +modify_fname +smartindent +X11 +dnd +mouse +sound -xfontset -ebcdic +mouseshape +spell +xim +emacs_tags +mouse_dec +startuptime +xpm +eval +mouse_gpm +statusline +xsmp_interact +ex_extra -mouse_jsbterm -sun_workshop +xterm_clipboard +extra_search +mouse_netterm +syntax -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/local/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm ```
Output of `:set` ``` :set --- Options --- autoindent expandtab ignorecase scroll=28 showcmd softtabstop=2 ttyfast window=58 background=dark filetype=go laststatus=2 scrolloff=5 smartcase syntax=go ttymouse=sgr t_EI=^[[?2004l confirm hlsearch pastetoggle= shiftwidth=4 smarttab tabstop=4 wildmenu t_SI=^[[?2004h backspace=indent,eol,start comments=s1:/*,mb:*,ex:*/,:// commentstring=// %s directory=~/.vim/swap,. fileencoding=utf-8 fileencodings=ucs-bom,utf-8,default,latin1 formatoptions=cqjr indentexpr=GoIndent(v:lnum) indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,<:>,0=},0=) runtimepath=~/.vim,~/.vim/bundle/editorconfig-vim,~/.vim/bundle/nerdcommenter,~/.vim/bundle/surround,~/.vim/bundle/syntastic,~/.vim/bundle/vim-autoswap,~/.vim/bundle/vim-gitgutter,~/.vim/bundle/vim-shfmt,~/.vim/ bundle/vim-terraform,~/.vim/bundle/vim-wakatime,/usr/local/share/vim/vimfiles,/usr/local/share/vim/vim82,/usr/local/share/vim/vimfiles/after,~/.vim/after wildmode=longest,list:longest ```
Einenlum commented 3 years ago

Thank you, I didn't know the <details> feature on Github! Nice.

I don't use vim 8, I use neovim 0.4.3, so maybe it's linked? :thinking:

Two questions:

Thanks!

soulshake commented 3 years ago

When this happens do you have any yaml file open aside?

Can confirm that it happens even when it's the only file I have open in vim, i.e. ps faux | grep vim shows only a single vim process.

When this happens on a go file, could you check the output of :set syntax ?

Sure!

:set

--- Options ---
  autoindent          filetype=go         incsearch           mouse=a             scroll=29           syntax=go           ttyfast             window=58
  background=dark     formatoptions=cq    langnoremap         nrformats=bin,hex   scrolloff=5         ttimeout            ttymouse=sgr
  display=truncate    history=200       nolangremap           ruler               showcmd             ttimeoutlen=100     wildmenu
  backspace=indent,eol,start
  comments=s1:/*,mb:*,ex:*/,://
  commentstring=// %s
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,default,latin1
  indentexpr=GoIndent(v:lnum)
  indentkeys=0{,0},0),0],:,0#,!^F,o,O,e,<:>,0=},0=)
soulshake commented 3 years ago

This became a problem because I needed to work on some .go files yesterday so I explored a bit further. After moving the repo from ~/.vim/plugin/yaml-revealer to ~/.vim/bundle/yaml-revealer, I'm no longer seeing this behavior :tada:

(I don't understand why, since as you pointed out, ftplugin/yaml.vim should only be used when yaml filetype is detected, and in my case it was clearly being run when filetype=go, but :shrug: )

Feel free to close this!