HerringtonDarkholme / yats.vim

Yet Another TypeScript Syntax: The most advanced TypeScript Syntax Highlighting in Vim
Vim License
650 stars 68 forks source link

Odd behavior when first opening a tsx file #200

Closed jimmycuadra closed 3 years ago

jimmycuadra commented 4 years ago

I'm using yats.vim at commit 4d76c5391b7975bd6dd09c0562c0fd4d78e14fa0 with Vim 8.2.

When I open a new tsx file that doesn't already exist (e.g. vim foo.tsx), this appears:

"foo.tsx" [New]
Error detected while processing BufNewFile Autocommands for "*.tsx"..FileType Autocommands for "*"..function <SNR>24_LoadFTPlugin:
line    2:
E749: empty buffer
Press ENTER or type command to continue

Once I press a key the message disappears and the file works as expected.

If I open an existing tsx file, instead the first line of the file is printed in a similar prompt:

(Assuming foo.tsx contains a single line with function foo() {} and I open it with vim foo.tsx):

"foo.tsx" 1L, 18B
  1 function foo() {}
Press ENTER or type command to continue

Again, once I press a key the message disappears and the file works as expected.

Neither of these things happen with regular TypesScript files (i.e. ts, not tsx).

Here is the exact contents of my vimrc: https://github.com/jimmycuadra/dotfiles/blob/50b323feff92156d03506b3b8065b24dd666e095/.vimrc.

HerringtonDarkholme commented 3 years ago

Please provide a minimal vimrc. By minimal, it means your config file should only contain yats.

mogelbrod commented 3 years ago

I also experience this issue. It seems to happen when using both vim-apathy and this plugin. With the setup below vim echoes the first line of any typescript file opened. The bug stops occurring if I disable either plugin.

.vimrc

let $VIMHOME = $HOME."/.vim"

" Boilerplate code to install plug.vim - should work without it if you have another plugin manager
if empty(glob($VIMHOME . '/autoload/plug.vim'))
  silent !curl -fLo $VIMHOME/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin($VIMHOME . '/bundle')

Plug 'tpope/vim-apathy'
Plug 'HerringtonDarkholme/yats.vim'

call plug#end()

:version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec  3 2020 01:11:23)
macOS version
Included patches: 1-1719
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +cryptv            +fork()            +mksession         +path_extra        +statusline        +vertsplit
+arabic            +cscope            +fullscreen        +modify_fname      +perl              -sun_workshop      +virtualedit
+autocmd           +cursorbind        +gettext           +mouse             +persistent_undo   +syntax            +visual
+autochdir         +cursorshape       -hangul_input      +mouseshape        +popupwin          +tag_binary        +visualextra
-autoservername    +dialog_con_gui    +iconv             +mouse_dec         +postscript        -tag_old_static    +viminfo
+balloon_eval      +diff              +insert_expand     -mouse_gpm         +printer           -tag_any_white     +vreplace
+balloon_eval_term +digraphs          +ipv6              -mouse_jsbterm     +profile           +tcl               +wildignore
+browse            +dnd               +job               +mouse_netterm     -python            +termguicolors     +wildmenu
++builtin_terms    -ebcdic            +jumplist          +mouse_sgr         +python3           +terminal          +windows
+byte_offset       +emacs_tags        +keymap            -mouse_sysmouse    +quickfix          +terminfo          +writebackup
+channel           +eval              +lambda            +mouse_urxvt       +reltime           +termresponse      -X11
+cindent           +ex_extra          +langmap           +mouse_xterm       +rightleft         +textobjects       -xfontset
+clientserver      +extra_search      +libcall           +multi_byte        +ruby              +textprop          +xim
+clipboard         -farsi             +linebreak         +multi_lang        +scrollbind        +timers            -xpm
+cmdline_compl     +file_in_path      +lispindent        -mzscheme          +signs             +title             -xsmp
+cmdline_hist      +find_in_path      +listcmds          +netbeans_intg     +smartindent       +toolbar           -xterm_clipboard
+cmdline_info      +float             +localmap          +num64             -sound             +transparency      -xterm_save
+comments          +folding           +lua               +odbeditor         +spell             +user_commands
+conceal           -footer            +menu              +packages          +startuptime       +vartabs
   system vimrc file: "$VIM/vimrc"