1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:50:04 +08:00

Add option for emmet (#4451)

* Add options for setting emmet filetype

close https://github.com/SpaceVim/SpaceVim/issues/4247

* Update

* Update
This commit is contained in:
Wang Shidong 2021-09-01 21:16:13 +08:00 committed by GitHub
parent aa02628810
commit 943d34a1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 17 deletions

View File

@ -18,12 +18,13 @@
"
" @subsection Options
"
" user_emmet_leader_key: change the default leader key for emmet
"
" - `emmet_leader_key`: change the default leader key for emmet
" - `emmet_filetyps`: Set the filetypes for enabling emmet
" >
" [layers]
" name = "lang#html"
" user_emmet_leader_key = "<C-e>"
" emmet_leader_key = "<C-e>"
" emmet_filetyps = ['html']
" <
"
" @subsection Key bindings
@ -34,12 +35,13 @@
" <
"
if exists('s:user_emmet_leader_key')
if exists('s:emmet_leader_key')
finish
endif
let s:user_emmet_leader_key = '<C-e>'
let s:emmet_leader_key = '<C-e>'
let s:emmet_filetyps = ['']
function! SpaceVim#layers#lang#html#plugins() abort
@ -56,17 +58,18 @@ function! SpaceVim#layers#lang#html#plugins() abort
endfunction
function! SpaceVim#layers#lang#html#config() abort
let g:user_emmet_leader_key = s:user_emmet_leader_key
let g:emmet_leader_key = s:emmet_leader_key
augroup spacevim_lang_html
autocmd!
autocmd FileType html,css,scss,sass,less,javascript,jsp,vue,eex,php,erb call s:install_emmet()
exe printf('autocmd FileType %s call s:install_emmet()', join(s:emmet_filetyps, ','))
autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
augroup END
endfunction
function! SpaceVim#layers#lang#html#set_variable(var) abort
let s:user_emmet_leader_key = get(a:var, 'user_emmet_leader_key', s:user_emmet_leader_key)
let s:emmet_leader_key = get(a:var, 'emmet_leader_key', get(a:var, 'user_emmet_leader_key', s:emmet_leader_key))
let s:emmet_filetyps = get(a:var, 'emmet_filetyps', s:emmet_filetyps)
endfunction
@ -83,3 +86,11 @@ function! SpaceVim#layers#lang#html#health() abort
call SpaceVim#layers#lang#html#config()
return 1
endfunction
function! SpaceVim#layers#lang#html#get_options() abort
return ['emmet_filetyps',
\ 'emmet_leader_key']
endfunction

View File

@ -2387,13 +2387,14 @@ add following snippet to your SpaceVim configuration file.
OPTIONS
user_emmet_leader_key: change the default leader key for emmet
`emmet_leader_key`: change the default leader key for emmet
`emmet_filetyps`: Set the filetypes for enabling emmet
>
[layers]
name = "lang#html"
user_emmet_leader_key = "<C-e>"
emmet_leader_key = "<C-e>"
emmet_filetyps = ['html']
<
KEY BINDINGS

View File

@ -40,12 +40,14 @@ npm install --global vscode-html-languageserver-bin
## 模块选项
- `user_emmet_leader_key`: 设置插件 emmet 的默认前置键。
- `emmet_leader_key`: 设置插件 emmet 的默认前置键。
- `emmet_filetyps`:设置启用 emmet 插件的文件类型列表。
```toml
[layers]
name = "lang#html"
user_emmet_leader_key = "<C-e>"
emmet_leader_key = "<C-e>"
emmet_filetyps = ['html']
```
## 功能特性
@ -59,5 +61,5 @@ npm install --global vscode-html-languageserver-bin
## 快捷键
| 快捷键 | 功能描述 |
| ------- | ------------ |
| -------- | ------------ |
| `Ctrl-e` | emmet 前缀键 |

View File

@ -39,12 +39,14 @@ npm install --global vscode-html-languageserver-bin
## Layer options
- `user_emmet_leader_key`: change the default leader key for emmet.
- `emmet_leader_key`: change the default leader key for emmet.
- `emmet_filetyps`: Set the filetypes for enabling emmet
```toml
[layers]
name = "lang#html"
user_emmet_leader_key = "<C-e>"
emmet_leader_key = "<C-e>"
emmet_filetyps = ['html']
```
## Features