mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.43k stars 411 forks source link

emmet freezes neovim when expanding inside parenthesis. #351

Closed paulsoh closed 7 years ago

paulsoh commented 7 years ago

I have been using emmet for JSX quite a while now. Love your work!! I just set up neovim on a new laptop using my old vimrc. On the previous machine it worked just fine, but in this new laptop, nvim seems to freeze whenever I try to expand inside parenthesis.

For example:

div>h3+p

will produce

<div>
  <h3></h3>
  <p></p>
</div>

where in this case:

return (
  div>h3+p
)

It would freeze. The command seems to be stuck in =emmet#expandAbbr(0, "") I did verbose map <C-y> and it seems like there is no conflict.

v  <C-Y>,        <Plug>(emmet-expand-abbr)
        Last set from ~/.dotfiles/nvim/bundle/emmet-vim/plugin/emmet.vim

I would really appreciate your help. Thanks in advance.

This is my vimrc.

set nocompatible
filetype off

call plug#begin('~/.dotfiles/nvim/bundle')

Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-surround'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'morhetz/gruvbox'
Plug 'mhartington/oceanic-next'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'othree/yajs.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'neomake/neomake'
Plug 'benjie/neomake-local-eslint.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-fugitive'
Plug 'terryma/vim-multiple-cursors'
Plug 'flowtype/vim-flow'
Plug 'zchee/deoplete-jedi', { 'for': 'python' }
Plug 'fishbullet/deoplete-ruby', { 'for': 'ruby' }
Plug 'osyo-manga/vim-monster', { 'for': 'ruby' }
Plug 'tpope/vim-rbenv'
Plug 'scrooloose/nerdcommenter'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'mattn/emmet-vim'
Plug 'ruanyl/vim-fixmyjs'
Plug 'heavenshell/vim-jsdoc'
Plug 'w0ng/vim-hybrid'

function! DoRemote(arg)
  UpdateRemotePlugins
endfunction
Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') }

call plug#end()

filetype plugin indent on

set relativenumber 
set number    

set showmatch
set ruler
set autoindent
set smartindent
set tabstop=2 shiftwidth=2 expandtab
"
" Or if you have Neovim >= 0.1.5
if (has("termguicolors"))
  set termguicolors
endif

syntax enable

colorscheme OceanicNext
" let g:hybrid_custom_term_colors = 1
" let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette.
" colorscheme hybrid

" let g:gruvbox_contrast_dark="hard"
" let g:gruvbox_italic=1

" colorscheme gruvbox
" set background=dark    " Setting dark mode

set omnifunc=syntaxcomplete#Complete

"""""""""""""""""""
" Plugin settings
"""""""""""""""""""
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*

" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 1
" let g:syntastic_ruby_checkers = ['rubocop']
" let g:syntastic_javascript_checkers = ['eslint']
" let g:neomake_open_list = 0
" let g:neomake_javascript_eslint_maker = {
"     \ 'args': ['--verbose'],
"     \ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
"    \ }
" let g:neomake_javascript_enabled_makers = ['eslint']

let g:user_emmet_settings = {
\  'javascript' : {
\      'extends' : 'jsx',
\  },
\}

" let g:user_emmet_mode='n'    "only enable normal mode functions.
" let g:user_emmet_leader_key='<C-Z>'
d8660091 commented 7 years ago

I encounter the same problem and did some debugging. It seems like the while loop at line 16 of emmet-vim/autoload/emmet/lang.vim cause the problem. Because when type = 'jsParen', which does not exist in settings, the while loop would not quit.

https://github.com/mattn/emmet-vim/blame/64544b778d08ab7304022e8226b78df358e76320/autoload/emmet/lang.vim

paulsoh commented 7 years ago

Updated plugin and it works great! Thanks 🍰 🍰 🍰 🍰 🍰 🍰