2 Commits

Author SHA1 Message Date
Tiago Rinaldi
45b6f23506 Merge 90fa3f7936 into 3fb2f63799 2024-06-24 05:07:39 +00:00
Tiago Rinaldi
90fa3f7936 Add meta tag for responsiviness
The usual `html:5_` snippet does not have the meta tag with the contents
`name="viewport" content="width=device-width, initial-scale=1"`, which
allows the website to be responsive.
2020-07-17 14:18:26 -03:00
2 changed files with 7 additions and 35 deletions

View File

@@ -371,21 +371,17 @@ endfunction
function! emmet#getFileType(...) abort
let flg = get(a:000, 0, 0)
if has_key(s:emmet_settings, &filetype)
let type = &filetype
if emmet#getResource(type, 'ignore_embeded_filetype', 0)
return type
return type
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'
let type = ''
@@ -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
@@ -1759,6 +1755,7 @@ let s:emmet_settings = {
\ ."<html lang=\"${lang}\">\n"
\ ."<head>\n"
\ ."\t<meta charset=\"${charset}\">\n"
\ ."\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
\ ."\t<title></title>\n"
\ ."</head>\n"
\ ."<body>\n\t${child}|\n</body>\n"

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