From caaf3ea5f9c98c98f22932372a2bd5eeca4e8f99 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sun, 9 Jun 2019 12:23:35 +0800 Subject: [PATCH] Remove old functions --- autoload/SpaceVim/layers/lang/java.vim | 10 ++- autoload/SpaceVim/layers/lang/xml.vim | 17 +++-- config/functions.vim | 87 +++----------------------- 3 files changed, 30 insertions(+), 84 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index f4f1cb41c..322be0586 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -109,7 +109,7 @@ function! SpaceVim#layers#lang#java#config() abort autocmd FileType java setlocal omnifunc=javacomplete#Complete call SpaceVim#mapping#gd#add('java', function('s:go_to_def')) endif - autocmd FileType jsp call JspFileTypeInit() + autocmd FileType jsp call JspFileTypeInit() augroup END let g:neoformat_enabled_java = ['googlefmt'] let g:neoformat_java_googlefmt = { @@ -123,6 +123,14 @@ function! SpaceVim#layers#lang#java#config() abort endtry endfunction +function! s:JspFileTypeInit() + set tags+=~/others/openjdk-8-src/tags + set omnifunc=javacomplete#Complete + inoremap . =OnmiConfigForJsp() + nnoremap :JCimportAdd + inoremap :JCimportAddI +endfunction + function! s:language_specified_mappings() abort let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} diff --git a/autoload/SpaceVim/layers/lang/xml.vim b/autoload/SpaceVim/layers/lang/xml.vim index 9e97e5bc8..b3d7ae0fb 100644 --- a/autoload/SpaceVim/layers/lang/xml.vim +++ b/autoload/SpaceVim/layers/lang/xml.vim @@ -16,16 +16,23 @@ function! SpaceVim#layers#lang#xml#plugins() abort - let plugins = [] - call add(plugins,['Valloric/MatchTagAlways', { 'on_ft' : ['html' , 'xhtml' , 'xml' , 'jinja']}]) - call add(plugins,['sukima/xmledit', { 'on_ft' : ['html' , 'xhtml' , 'xml' , 'jinja']}]) - return plugins + let plugins = [] + call add(plugins,['Valloric/MatchTagAlways', { 'on_ft' : ['html' , 'xhtml' , 'xml' , 'jinja']}]) + call add(plugins,['sukima/xmledit', { 'on_ft' : ['html' , 'xhtml' , 'xml' , 'jinja']}]) + return plugins endfunction function! SpaceVim#layers#lang#xml#config() abort + function! s:xml_file_init() abort + set omnifunc=xmlcomplete#CompleteTags + if filereadable('AndroidManifest.xml') + set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic + endif + endfunction augroup spacevim_lang_xml autocmd! - autocmd FileType xml call XmlFileTypeInit() + autocmd FileType xml call xml_file_init() autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags augroup END endfunction + diff --git a/config/functions.vim b/config/functions.vim index e7b40f1ad..68495f9b8 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -1,3 +1,12 @@ +"============================================================================= +" functions.vim --- public function for SpaceVim +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + function! OnmiConfigForJsp() let pos1 = search('','nb',line('w0')) let pos2 = search('a." endif endf -function! BracketsFunc() - let line = getline('.') - let col = col('.') - if line[col - 2] ==# ']' - return "{}\i" - else - return "{\}\O" - endif -endf -function! XmlFileTypeInit() - set omnifunc=xmlcomplete#CompleteTags - if filereadable('AndroidManifest.xml') - set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic - endif -endf -function! WSDAutoComplete(char) - if(getline('.')=~?'^\s*.*\/\/')==0 - let line = getline('.') - let col = col('.') - if a:char ==# '.' - return a:char."\\\" - elseif line[col - 2] ==# ' ' ||line[col -2] ==# '(' ||line[col - 2] ==# ',' - return a:char."\\\" - elseif line[col - 3] ==# ' ' && line[col - 2] ==# '@' - return a:char."\\\" - else - return a:char - endif - else - "bug exists - normal! ma - let commentcol = searchpos('//','b',line('.'))[1] - normal! `a - if commentcol == 0 - return a:char."\\\" - else - return "\".a:char - endif - endif -endf -function! ClosePair(char) - if getline('.')[col('.') - 1] == a:char - return "\" - else - return a:char - endif -endf - -function! CloseBracket() - if match(getline(line('.') + 1), '\s*}') < 0 - return "\}" - else - return "\j0f}a" - endif -endf - -function! QuoteDelim(char) - let line = getline('.') - let col = col('.') - if line[col - 2] ==# "\\" - "Inserting a quoted quotation mark into the string - return a:char - elseif line[col - 1] == a:char - "Escaping out of the string - return "\" - else - "Starting a string - return a:char.a:char."\i" - endif -endf -function! JspFileTypeInit() - set tags+=~/others/openjdk-8-src/tags - set omnifunc=javacomplete#Complete - inoremap . =OnmiConfigForJsp() - nnoremap :JCimportAdd - inoremap :JCimportAddI -endfunction - function! MyLeaderTabfunc() abort if g:spacevim_autocomplete_method ==# 'deoplete' if g:spacevim_enable_javacomplete2_py