Use a help function to get user config

This commit is contained in:
leafOfTree
2020-07-17 08:41:51 +08:00
parent fe9c81657a
commit b22a41fb6b
6 changed files with 22 additions and 34 deletions

View File

@@ -7,3 +7,8 @@ function! vue#Log(msg)
echom '['.s:name.']['.v:lnum.'] '.a:msg echom '['.s:name.']['.v:lnum.'] '.a:msg
endif endif
endfunction endfunction
function! vue#GetConfig(name, default)
let name = 'g:vim_vue_plugin_'.a:name
return exists(name) ? eval(name) : a:default
endfunction

View File

@@ -3,8 +3,7 @@
" Config {{{ " Config {{{
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:use_foldexpr = exists("g:vim_vue_plugin_use_foldexpr") let s:use_foldexpr = vue#GetConfig("use_foldexpr", 0)
\ && g:vim_vue_plugin_use_foldexpr == 1
"}}} "}}}
if !s:use_foldexpr | finish | endif if !s:use_foldexpr | finish | endif

View File

@@ -33,18 +33,12 @@ let s:tag_end = '\v^\s*\/?\>\s*'
" Config {{{ " Config {{{
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:use_pug = exists("g:vim_vue_plugin_use_pug") let s:use_pug = vue#GetConfig("use_pug", 0)
\ && g:vim_vue_plugin_use_pug == 1 let s:use_sass = vue#GetConfig("use_sass", 0)
let s:use_sass = exists("g:vim_vue_plugin_use_sass") let s:use_scss = vue#GetConfig("use_scss", 0)
\ && g:vim_vue_plugin_use_sass == 1 let s:use_stylus = vue#GetConfig("use_stylus", 0)
let s:use_scss = exists("g:vim_vue_plugin_use_scss") let s:use_coffee = vue#GetConfig("use_coffee", 0)
\ && g:vim_vue_plugin_use_scss == 1 let s:use_typescript = vue#GetConfig("use_typescript", 0)
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
\ && g:vim_vue_plugin_use_stylus == 1
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
\ && g:vim_vue_plugin_use_coffee == 1
let s:use_typescript = exists("g:vim_vue_plugin_use_typescript")
\ && g:vim_vue_plugin_use_typescript == 1
let s:has_init_indent = 0 let s:has_init_indent = 0
if !exists("g:vim_vue_plugin_has_init_indent") if !exists("g:vim_vue_plugin_has_init_indent")

View File

@@ -3,8 +3,7 @@
" Config {{{ " Config {{{
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:highlight_vue_attr = exists("g:vim_vue_plugin_highlight_vue_attr") let s:highlight_vue_attr = vue#GetConfig("highlight_vue_attr", 0)
\ && g:vim_vue_plugin_highlight_vue_attr == 1
"}}} "}}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

View File

@@ -3,8 +3,7 @@
" Config {{{ " Config {{{
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:highlight_vue_keyword = exists("g:vim_vue_plugin_highlight_vue_keyword") let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0)
\ && g:vim_vue_plugin_highlight_vue_keyword == 1
if !s:highlight_vue_keyword | finish | endif if !s:highlight_vue_keyword | finish | endif
"}}} "}}}

View File

@@ -18,22 +18,14 @@ let b:current_loading_main_syntax = 'vue'
" Config {{{ " Config {{{
" "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:load_full_syntax = exists("g:vim_vue_plugin_load_full_syntax") let s:load_full_syntax = vue#GetConfig("load_full_syntax", 0)
\ && g:vim_vue_plugin_load_full_syntax == 1 let s:use_pug = vue#GetConfig("use_pug", 0)
let s:use_pug = exists("g:vim_vue_plugin_use_pug") let s:use_less = vue#GetConfig("use_less", 0)
\ && g:vim_vue_plugin_use_pug == 1 let s:use_sass = vue#GetConfig("use_sass", 0)
let s:use_less = exists("g:vim_vue_plugin_use_less") let s:use_scss = vue#GetConfig("use_scss", 0)
\ && g:vim_vue_plugin_use_less == 1 let s:use_stylus = vue#GetConfig("use_stylus", 0)
let s:use_sass = exists("g:vim_vue_plugin_use_sass") let s:use_coffee = vue#GetConfig("use_coffee", 0)
\ && g:vim_vue_plugin_use_sass == 1 let s:use_typescript = vue#GetConfig("use_typescript", 0)
let s:use_scss = exists("g:vim_vue_plugin_use_scss")
\ && g:vim_vue_plugin_use_scss == 1
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
\ && g:vim_vue_plugin_use_stylus == 1
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
\ && g:vim_vue_plugin_use_coffee == 1
let s:use_typescript = exists("g:vim_vue_plugin_use_typescript")
\ && g:vim_vue_plugin_use_typescript == 1
"}}} "}}}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""