mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:50:05 +08:00
deoplete and denite backward compatibility (#3058)
This commit is contained in:
parent
276ae1d35e
commit
ad8a7113f9
@ -423,9 +423,11 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
elseif &filetype ==# 'denite'
|
||||
return '%#SpaceVim_statusline_a_bold# %{SpaceVim#layers#core#statusline#denite_mode()} '
|
||||
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' '
|
||||
\ . '%#SpaceVim_statusline_b#%{denite#get_status_sources()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' '
|
||||
\ . '%#SpaceVim_statusline_b#%{SpaceVim#layers#core#statusline#denite_status("sources")} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' '
|
||||
\ . '%#SpaceVim_statusline_z#%=%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:rsep
|
||||
\ . '%#SpaceVim_statusline_c# %{denite#get_status_path() . denite#get_status_linenr()}'
|
||||
\ . '%#SpaceVim_statusline_c# %{SpaceVim#layers#core#statusline#denite_status("path") . SpaceVim#layers#core#statusline#denite_status("linenr")}'
|
||||
elseif &filetype ==# 'denite-filter'
|
||||
return '%#SpaceVim_statusline_a_bold# Filter %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
elseif &filetype ==# 'unite'
|
||||
return '%#SpaceVim_statusline_a_bold#%{SpaceVim#layers#core#statusline#unite_mode()} Unite '
|
||||
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' %{get(unite#get_context(), "buffer_name", "")} '
|
||||
@ -723,9 +725,38 @@ function! SpaceVim#layers#core#statusline#mode_text(mode) abort
|
||||
return ' '
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#core#statusline#denite_status(argv) abort
|
||||
if exists('*get_status_mode')
|
||||
let denite_ver = 2
|
||||
else
|
||||
let denite_ver = 3
|
||||
endif
|
||||
if denite_ver == 3
|
||||
return denite#get_status(a:argv)
|
||||
else
|
||||
return denite#get_status_{a:argv}()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#denite_mode() abort
|
||||
let t = s:colors_template
|
||||
let dmode = split(denite#get_status_mode())[1]
|
||||
if exists('*get_status_mode')
|
||||
let denite_ver = 2
|
||||
else
|
||||
let denite_ver = 3
|
||||
endif
|
||||
|
||||
if denite_ver == 3
|
||||
let dmode = ['Denite']
|
||||
else
|
||||
let dmode = split(denite#get_status_mode(), ' ')
|
||||
endif
|
||||
if empty(dmode)
|
||||
let dmode = ''
|
||||
else
|
||||
let dmode = dmode[0]
|
||||
endif
|
||||
if get(w:, 'spacevim_statusline_mode', '') != dmode
|
||||
if dmode ==# 'NORMAL'
|
||||
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
|
@ -137,6 +137,7 @@ let s:normal_mode_mappings = [
|
||||
\ ['r', '<denite:redraw>', 'noremap'],
|
||||
\ ]
|
||||
|
||||
" this is for old version of denite
|
||||
for s:m in s:insert_mode_mappings
|
||||
call denite#custom#map('insert', s:m[0], s:m[1], s:m[2])
|
||||
endfor
|
||||
@ -147,4 +148,33 @@ endfor
|
||||
unlet s:m s:insert_mode_mappings s:normal_mode_mappings
|
||||
|
||||
|
||||
" Define mappings
|
||||
autocmd FileType denite call s:denite_my_settings()
|
||||
function! s:denite_my_settings() abort
|
||||
nnoremap <silent><buffer><expr> i
|
||||
\ denite#do_map('open_filter_buffer')
|
||||
nnoremap <silent><buffer><expr> '
|
||||
\ denite#do_map('toggle_select').'j'
|
||||
nnoremap <silent><buffer><expr> q
|
||||
\ denite#do_map('quit')
|
||||
nnoremap <silent><buffer><expr> <C-t>
|
||||
\ denite#do_map('do_action', 'tabopen')
|
||||
nnoremap <silent><buffer><expr> <C-v>
|
||||
\ denite#do_map('do_action', 'vsplit')
|
||||
nnoremap <silent><buffer><expr> <C-s>
|
||||
\ denite#do_map('do_action', 'split')
|
||||
nnoremap <silent><buffer><expr> <CR>
|
||||
\ denite#do_map('do_action')
|
||||
nnoremap <silent><buffer><expr> p
|
||||
\ denite#do_map('do_action', 'preview')
|
||||
nnoremap <silent><buffer><Tab> j
|
||||
nnoremap <silent><buffer><S-Tab> k
|
||||
endfunction
|
||||
|
||||
autocmd FileType denite-filter call s:denite_filter_my_settings()
|
||||
function! s:denite_filter_my_settings() abort
|
||||
imap <silent><buffer> <Esc> <Plug>(denite_filter_quit)
|
||||
endfunction
|
||||
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,3 +1,10 @@
|
||||
"=============================================================================
|
||||
" deoplete.vim --- deoplete default config in spacevim
|
||||
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
let g:deoplete#enable_at_startup = get(g:, 'deoplete#enable_at_startup', 1)
|
||||
|
||||
" deoplete options
|
||||
@ -10,14 +17,6 @@ call deoplete#custom#option({
|
||||
\ 'refresh_always' : get(g:, 'deoplete#enable_refresh_always', 1)
|
||||
\ })
|
||||
|
||||
" let g:deoplete#max_abbr_width = get(g:, 'deoplete#max_abbr_width', 0)
|
||||
" let g:deoplete#max_menu_width = get(g:, 'deoplete#max_menu_width', 0)
|
||||
" init deoplet option dict
|
||||
let g:deoplete#ignore_sources = get(g:,'deoplete#ignore_sources',{})
|
||||
let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})
|
||||
let g:deoplete#omni_patterns = get(g:, 'deoplete#omni_patterns', {})
|
||||
let g:deoplete#keyword_patterns = get(g:, 'deoplete#keyword_patterns', {})
|
||||
|
||||
" java && jsp
|
||||
call deoplete#custom#var('omni', 'input_patterns', {
|
||||
\ 'java': [
|
||||
@ -87,7 +86,9 @@ call deoplete#custom#var('omni', 'input_patterns', {
|
||||
call deoplete#custom#option('ignore_sources', {'gitcommit': ['neosnippet']})
|
||||
|
||||
" lua
|
||||
let g:deoplete#omni_patterns.lua = get(g:deoplete#omni_patterns, 'lua', '.')
|
||||
call deoplete#custom#var('omni', 'input_patterns', {
|
||||
\ 'lua': '.',
|
||||
\})
|
||||
|
||||
" c c++
|
||||
call deoplete#custom#source('clang2', 'mark', '')
|
||||
@ -100,8 +101,13 @@ call deoplete#custom#source('racer', 'mark', '')
|
||||
" vim
|
||||
call deoplete#custom#option('ignore_sources', {'vim': ['tag']})
|
||||
|
||||
" denite
|
||||
call deoplete#custom#option('ignore_sources', {'denite-filter': ['denite', 'buffer', 'around', 'member']})
|
||||
|
||||
" clojure
|
||||
let g:deoplete#keyword_patterns.clojure = '[\w!$%&*+/:<=>?@\^_~\-\.#]*'
|
||||
call deoplete#custom#option('keyword_patterns', {
|
||||
\ 'clojure': '[\w!$%&*+/:<=>?@\^_~\-\.#]*',
|
||||
\})
|
||||
|
||||
" ocaml
|
||||
call deoplete#custom#option('ignore_sources', {'ocaml': ['buffer', 'around', 'omni']})
|
||||
|
Loading…
Reference in New Issue
Block a user