From f4afd031a34f63f1d7f699b5bf496b1041e19f69 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 24 Jun 2019 23:20:54 +0900 Subject: [PATCH] Fix next item in CSS --- autoload/emmet.vim | 2 +- autoload/emmet/lang/css.vim | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index ef4a7ab..0e36d3b 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -380,7 +380,7 @@ function! emmet#getFileType(...) abort endif let pos = emmet#util#getcurpos() - let type = synIDattr(synID(pos[1], pos[2], 1), 'name') + let type = synIDattr(synID(max([pos[1], 1]), max([pos[2], 1]), 1), 'name') " ignore htmlTagName as it seems to occur too often if type == 'htmlTagName' diff --git a/autoload/emmet/lang/css.vim b/autoload/emmet/lang/css.vim index b3977ab..7ba6a6a 100644 --- a/autoload/emmet/lang/css.vim +++ b/autoload/emmet/lang/css.vim @@ -296,7 +296,9 @@ function! emmet#lang#css#toggleComment() abort let line = substitute(matchstr(line, mx), mx, '\2', '') let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g') else - let mx = '^\(\s*\)\(.*\)\s*$' + let mx = '^\(\s*\)\(''[^'']*''\|[^'']*\|;\)\s*$' + " TODO multi-property + "let mx = '^\(\s*\)\(\%(''[^'']*''\|[^'';]\+\)*;\{0,1}\)' let line = substitute(line, mx, '\1/* \2 */', '') endif call setline('.', line) @@ -352,13 +354,8 @@ function! emmet#lang#css#moveNextPrevItem(flag) abort endfunction function! emmet#lang#css#moveNextPrev(flag) abort - let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp') - if pos == 2 - startinsert! - else - silent! normal! l - startinsert - endif + call search('""\|()\|\(:\s*\zs;\{1,0}$\)', a:flag ? 'Wbp' : 'Wp') + return '' endfunction function! emmet#lang#css#splitJoinTag() abort