3 Commits

Author SHA1 Message Date
Kevin Rambaud
4c7d28ca7d Merge a37097cf18 into 3fb2f63799 2024-06-24 13:48:27 +00:00
Kevin Rambaud
a37097cf18 Fix fst and fset aliases 2020-05-25 22:28:56 -04:00
Kevin Rambaud
a407c0fec7 Fix html btn* aliases 2020-05-24 23:17:28 -04:00
2 changed files with 9 additions and 33 deletions

View File

@@ -379,12 +379,8 @@ function! emmet#getFileType(...) abort
endif
endif
if get(g:, 'loaded_nvim_treesitter', 0)
let type = luaeval('require"emmet_utils".get_node_at_cursor()')
else
let pos = emmet#util#getcurpos()
let type = synIDattr(synID(max([pos[1], 1]), max([pos[2], 1]), 1), 'name')
endif
let pos = emmet#util#getcurpos()
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'
@@ -430,7 +426,7 @@ function! emmet#getFileType(...) abort
endfor
endif
return empty(type) ? 'html' : type
return len(type) == 0 ? 'html' : type
endfunction
function! emmet#getDollarExprs(expand) abort
@@ -1917,7 +1913,11 @@ let s:emmet_settings = {
\ 'cap': 'caption',
\ 'colg': 'colgroup',
\ 'fst': 'fieldset',
\ 'btn:': 'button',
\ 'fst:disabled': 'fieldset',
\ 'btn': 'button',
\ 'btn:d': 'button',
\ 'btn:r': 'button',
\ 'btn:s': 'button',
\ 'optg': 'optgroup',
\ 'opt': 'option',
\ 'pic': 'picture',
@@ -1933,6 +1933,7 @@ let s:emmet_settings = {
\ 'sty': 'style',
\ 'prog': 'progress',
\ 'fset': 'fieldset',
\ 'fset:d': 'fieldset',
\ 'datag': 'datagrid',
\ 'datal': 'datalist',
\ 'kg': 'keygen',

View File

@@ -1,25 +0,0 @@
local M = {}
M.get_node_at_cursor = function()
local ts_utils = require("nvim-treesitter.ts_utils")
local node = ts_utils.get_node_at_cursor()
if not node then
return nil
end
while node do
local node_type = node:type()
if node_type == "element" then
return "html"
elseif node_type == "stylesheet" then
return "css"
end
node = node:parent()
end
return ""
end
return M