mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 03:10:06 +08:00
Merge branch 'core_layer' into dev
This commit is contained in:
commit
dcd6479e7c
@ -63,7 +63,7 @@ If you are new to vim, you should learning about Vim in general, read [vim-galor
|
||||
|
||||
### Quick start guide
|
||||
|
||||
SpaceVim load custom configuration from `~/.SpaceVim.d/init.vim`,
|
||||
SpaceVim load custom configuration from `~/.SpaceVim.d/init.vim`,
|
||||
|
||||
:warning: It is not `~/.SpaceVim/init.vim`, user should not change anything in `~/.SpaceVim/`.
|
||||
|
||||
@ -183,9 +183,9 @@ The best way to support SpaceVim is to contribute to it either by reporting bugs
|
||||
|
||||
If you want to show your support financially you can contribute to [Bountysource](https://www.bountysource.com/teams/spacevim) or buy a drink for the maintainer by clicking following icon.
|
||||
|
||||
<a href='https://ko-fi.com/A538L6H' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||
<a href='https://ko-fi.com/A538L6H' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||
|
||||
If you used SpaceVim in a project and you want to show that fact, you can use the SpaceVim badge:
|
||||
If you used SpaceVim in a project and you want to show that fact, you can use the SpaceVim badge:
|
||||
|
||||
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
" SpaceVim.vim --- Initialization and core files for SpaceVim
|
||||
" Copyright (c) 2016-2017 Shidong Wang & Contributors
|
||||
" Author: Shidong Wang < wsdjeg at 163.com >
|
||||
" URL: https://github.com/syl20bnr/spacemacs
|
||||
" URL: https://spacevim.org
|
||||
" License: MIT license
|
||||
"=============================================================================
|
||||
|
||||
@ -72,7 +72,9 @@ let g:spacevim_vim_plug_installed = 0
|
||||
" >
|
||||
" let g:spacevim_plugin_bundle_dir = '~/.cache/vimplugs'
|
||||
" <
|
||||
let g:spacevim_plugin_bundle_dir = $HOME. join(['', '.cache', 'vimfiles', ''], SpaceVim#api#import('file').separator)
|
||||
let g:spacevim_plugin_bundle_dir
|
||||
\ = $HOME. join(['', '.cache', 'vimfiles', ''],
|
||||
\ SpaceVim#api#import('file').separator)
|
||||
""
|
||||
" Enable/Disable realtime leader guide. Default is 0.
|
||||
" >
|
||||
@ -160,7 +162,7 @@ let g:spacevim_filemanager = 'vimfiler'
|
||||
""
|
||||
" The default plugin manager of SpaceVim. Default is 'dein'.
|
||||
" Options are dein, neobundle, or vim-plug.
|
||||
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
|
||||
let g:spacevim_plugin_manager = 'dein'
|
||||
""
|
||||
" Enable/Disable checkinstall on SpaceVim startup. Default is 1.
|
||||
" >
|
||||
@ -249,101 +251,103 @@ let g:spacevim_src_root = 'E:\sources\'
|
||||
""
|
||||
" The host file url. This option is for Chinese users who can not use
|
||||
" Google and Twitter.
|
||||
let g:spacevim_hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
|
||||
let g:spacevim_wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,
|
||||
\*.ttf,*.TTF,*.png,*/target/*,
|
||||
\.git,.svn,.hg,.DS_Store'
|
||||
let g:spacevim_hosts_url
|
||||
\ = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts'
|
||||
let g:spacevim_wildignore
|
||||
\ = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,
|
||||
\*.ttf,*.TTF,*.png,*/target/*,
|
||||
\.git,.svn,.hg,.DS_Store'
|
||||
|
||||
function! SpaceVim#loadCustomConfig() abort
|
||||
let custom_confs_old = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||
let custom_confs = SpaceVim#util#globpath(getcwd(), '.SpaceVim.d/init.vim')
|
||||
let custom_glob_conf_old = expand('~/.local.vim')
|
||||
let custom_glob_conf = expand('~/.SpaceVim.d/init.vim')
|
||||
" the old value will be remove
|
||||
if filereadable(custom_glob_conf_old)
|
||||
exe 'source ' . custom_glob_conf_old
|
||||
endif
|
||||
if !empty(custom_confs_old)
|
||||
exe 'source ' . custom_confs_old[0]
|
||||
endif
|
||||
let custom_confs_old = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||
let custom_confs = SpaceVim#util#globpath(getcwd(), '.SpaceVim.d/init.vim')
|
||||
let custom_glob_conf_old = expand('~/.local.vim')
|
||||
let custom_glob_conf = expand('~/.SpaceVim.d/init.vim')
|
||||
" the old value will be remove
|
||||
if filereadable(custom_glob_conf_old)
|
||||
exe 'source ' . custom_glob_conf_old
|
||||
endif
|
||||
if !empty(custom_confs_old)
|
||||
exe 'source ' . custom_confs_old[0]
|
||||
endif
|
||||
|
||||
if !empty(custom_confs)
|
||||
if isdirectory('.SpaceVim.d')
|
||||
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
||||
endif
|
||||
exe 'source ' . custom_confs[0]
|
||||
if filereadable(custom_glob_conf) && g:spacevim_force_global_config
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
exe 'source ' . custom_glob_conf
|
||||
endif
|
||||
elseif filereadable(custom_glob_conf)
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
exe 'source ' . custom_glob_conf
|
||||
if !empty(custom_confs)
|
||||
if isdirectory('.SpaceVim.d')
|
||||
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
||||
endif
|
||||
exe 'source ' . custom_confs[0]
|
||||
if filereadable(custom_glob_conf) && g:spacevim_force_global_config
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
exe 'source ' . custom_glob_conf
|
||||
endif
|
||||
elseif filereadable(custom_glob_conf)
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
exe 'source ' . custom_glob_conf
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#end() abort
|
||||
if !empty(g:spacevim_windows_leader)
|
||||
call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader)
|
||||
if !empty(g:spacevim_windows_leader)
|
||||
call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader)
|
||||
endif
|
||||
if !empty(g:spacevim_unite_leader)
|
||||
call SpaceVim#mapping#leader#defindUniteLeader(g:spacevim_unite_leader)
|
||||
endif
|
||||
call SpaceVim#mapping#leader#defindglobalMappings()
|
||||
if g:spacevim_simple_mode
|
||||
let g:spacevim_plugin_groups = ['core']
|
||||
else
|
||||
for s:group in g:spacevim_plugin_groups_exclude
|
||||
let s:i = index(g:spacevim_plugin_groups, s:group)
|
||||
if s:i != -1
|
||||
call remove(g:spacevim_plugin_groups, s:i)
|
||||
endif
|
||||
endfor
|
||||
if g:spacevim_vim_help_language ==# 'cn'
|
||||
call add(g:spacevim_plugin_groups, 'chinese')
|
||||
endif
|
||||
if !empty(g:spacevim_unite_leader)
|
||||
call SpaceVim#mapping#leader#defindUniteLeader(g:spacevim_unite_leader)
|
||||
if g:spacevim_use_colorscheme==1
|
||||
call add(g:spacevim_plugin_groups, 'colorscheme')
|
||||
endif
|
||||
call SpaceVim#mapping#leader#defindglobalMappings()
|
||||
if g:spacevim_simple_mode
|
||||
let g:spacevim_plugin_groups = ['core']
|
||||
|
||||
if has('nvim')
|
||||
let g:spacevim_autocomplete_method = 'deoplete'
|
||||
elseif has('lua')
|
||||
let g:spacevim_autocomplete_method = 'neocomplete'
|
||||
else
|
||||
for s:group in g:spacevim_plugin_groups_exclude
|
||||
let s:i = index(g:spacevim_plugin_groups, s:group)
|
||||
if s:i != -1
|
||||
call remove(g:spacevim_plugin_groups, s:i)
|
||||
endif
|
||||
endfor
|
||||
if g:spacevim_vim_help_language ==# 'cn'
|
||||
call add(g:spacevim_plugin_groups, 'chinese')
|
||||
endif
|
||||
if g:spacevim_use_colorscheme==1
|
||||
call add(g:spacevim_plugin_groups, 'colorscheme')
|
||||
endif
|
||||
|
||||
if has('nvim')
|
||||
let g:spacevim_autocomplete_method = 'deoplete'
|
||||
elseif has('lua')
|
||||
let g:spacevim_autocomplete_method = 'neocomplete'
|
||||
else
|
||||
let g:spacevim_autocomplete_method = 'neocomplcache'
|
||||
endif
|
||||
if g:spacevim_enable_ycm
|
||||
let g:spacevim_autocomplete_method = 'ycm'
|
||||
endif
|
||||
if g:spacevim_enable_neocomplcache
|
||||
let g:spacevim_autocomplete_method = 'neocomplcache'
|
||||
endif
|
||||
let g:spacevim_autocomplete_method = 'neocomplcache'
|
||||
endif
|
||||
""
|
||||
" generate tags for SpaceVim
|
||||
let help = fnamemodify(g:Config_Main_Home, ':p:h:h') . '/doc'
|
||||
exe 'helptags ' . help
|
||||
|
||||
""
|
||||
" set language
|
||||
if !empty(g:spacevim_language)
|
||||
silent exec 'lan ' . g:spacevim_language
|
||||
if g:spacevim_enable_ycm
|
||||
let g:spacevim_autocomplete_method = 'ycm'
|
||||
endif
|
||||
if g:spacevim_enable_neocomplcache
|
||||
let g:spacevim_autocomplete_method = 'neocomplcache'
|
||||
endif
|
||||
endif
|
||||
""
|
||||
" generate tags for SpaceVim
|
||||
let help = fnamemodify(g:Config_Main_Home, ':p:h:h') . '/doc'
|
||||
exe 'helptags ' . help
|
||||
|
||||
call SpaceVim#plugins#load()
|
||||
""
|
||||
" set language
|
||||
if !empty(g:spacevim_language)
|
||||
silent exec 'lan ' . g:spacevim_language
|
||||
endif
|
||||
|
||||
call SpaceVim#plugins#load()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#default() abort
|
||||
call SpaceVim#default#SetOptions()
|
||||
call SpaceVim#default#SetPlugins()
|
||||
call SpaceVim#default#SetMappings()
|
||||
call SpaceVim#default#SetOptions()
|
||||
call SpaceVim#default#SetPlugins()
|
||||
call SpaceVim#default#SetMappings()
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#defindFuncs() abort
|
||||
@ -351,13 +355,13 @@ endfunction
|
||||
|
||||
|
||||
function! SpaceVim#welcome() abort
|
||||
if exists(':VimFiler') == 2 && exists(':Startify') == 2
|
||||
if g:spacevim_enable_vimfiler_welcome
|
||||
VimFiler
|
||||
endif
|
||||
wincmd p
|
||||
Startify
|
||||
if exists(':VimFiler') == 2 && exists(':Startify') == 2
|
||||
if g:spacevim_enable_vimfiler_welcome
|
||||
VimFiler
|
||||
endif
|
||||
wincmd p
|
||||
Startify
|
||||
endif
|
||||
endfunction
|
||||
|
||||
""
|
||||
@ -407,3 +411,7 @@ endfunction
|
||||
" >
|
||||
" Add `let mapleader = "\<space>"` to `~/.SpaceVim.d/init.vim`
|
||||
" <
|
||||
|
||||
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,8 +1,10 @@
|
||||
function! SpaceVim#api#import(name) abort
|
||||
let p = {}
|
||||
try
|
||||
let p = SpaceVim#api#{a:name}#get()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
return p
|
||||
let p = {}
|
||||
try
|
||||
let p = SpaceVim#api#{a:name}#get()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
return p
|
||||
endfunction
|
||||
|
||||
" vim:set fdm=marker sw=2 nowrap:
|
||||
|
@ -2,52 +2,52 @@ let s:json = {}
|
||||
|
||||
|
||||
if exists('*json_decode')
|
||||
let g:spacevim_api_json_true = v:true
|
||||
let g:spacevim_api_json_true = v:false
|
||||
let g:spacevim_api_json_true = v:null
|
||||
function! s:json_decode(json) abort
|
||||
if a:json ==# ''
|
||||
return []
|
||||
endif
|
||||
return json_decode(a:json)
|
||||
endfunction
|
||||
let g:spacevim_api_json_true = v:true
|
||||
let g:spacevim_api_json_true = v:false
|
||||
let g:spacevim_api_json_true = v:null
|
||||
function! s:json_decode(json) abort
|
||||
if a:json ==# ''
|
||||
return []
|
||||
endif
|
||||
return json_decode(a:json)
|
||||
endfunction
|
||||
else
|
||||
function! s:json_null() abort
|
||||
endfunction
|
||||
function! s:json_null() abort
|
||||
endfunction
|
||||
|
||||
function! s:json_true() abort
|
||||
endfunction
|
||||
function! s:json_true() abort
|
||||
endfunction
|
||||
|
||||
function! s:json_false() abort
|
||||
endfunction
|
||||
function! s:json_false() abort
|
||||
endfunction
|
||||
|
||||
let g:spacevim_api_json_true = [function('s:json_true')]
|
||||
let g:spacevim_api_json_false = [function('s:json_false')]
|
||||
let g:spacevim_api_json_null = [function('s:json_null')]
|
||||
" @vimlint(EVL102, 1, l:true)
|
||||
" @vimlint(EVL102, 1, l:false)
|
||||
" @vimlint(EVL102, 1, l:null)
|
||||
function! s:json_decode(json) abort
|
||||
let true = g:spacevim_api_json_true
|
||||
let false = g:spacevim_api_json_false
|
||||
let null = g:spacevim_api_json_null
|
||||
if substitute(a:json, '\v\"%(\\.|[^"\\])*\"|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') !~# "[^,:{}[\\] \t]"
|
||||
let g:spacevim_api_json_true = [function('s:json_true')]
|
||||
let g:spacevim_api_json_false = [function('s:json_false')]
|
||||
let g:spacevim_api_json_null = [function('s:json_null')]
|
||||
" @vimlint(EVL102, 1, l:true)
|
||||
" @vimlint(EVL102, 1, l:false)
|
||||
" @vimlint(EVL102, 1, l:null)
|
||||
function! s:json_decode(json) abort
|
||||
let true = g:spacevim_api_json_true
|
||||
let false = g:spacevim_api_json_false
|
||||
let null = g:spacevim_api_json_null
|
||||
if substitute(a:json, '\v\"%(\\.|[^"\\])*\"|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') !~# "[^,:{}[\\] \t]"
|
||||
|
||||
try
|
||||
let object = eval(a:json)
|
||||
catch
|
||||
" malformed JSON
|
||||
let object = ''
|
||||
endtry
|
||||
else
|
||||
let object = ''
|
||||
endif
|
||||
try
|
||||
let object = eval(a:json)
|
||||
catch
|
||||
" malformed JSON
|
||||
let object = ''
|
||||
endtry
|
||||
else
|
||||
let object = ''
|
||||
endif
|
||||
|
||||
return object
|
||||
endfunction
|
||||
" @vimlint(EVL102, 0, l:true)
|
||||
" @vimlint(EVL102, 0, l:false)
|
||||
" @vimlint(EVL102, 0, l:null)
|
||||
return object
|
||||
endfunction
|
||||
" @vimlint(EVL102, 0, l:true)
|
||||
" @vimlint(EVL102, 0, l:false)
|
||||
" @vimlint(EVL102, 0, l:null)
|
||||
endif
|
||||
|
||||
lockvar g:spacevim_api_json_true
|
||||
@ -57,48 +57,50 @@ lockvar g:spacevim_api_json_null
|
||||
let s:json['json_decode'] = function('s:json_decode')
|
||||
|
||||
if exists('*json_encode')
|
||||
function! s:json_encode(val) abort
|
||||
return json_encode(a:val)
|
||||
endfunction
|
||||
function! s:json_encode(val) abort
|
||||
return json_encode(a:val)
|
||||
endfunction
|
||||
else
|
||||
function! s:json_encode(val) abort
|
||||
if type(a:val) == type(0)
|
||||
return a:val
|
||||
elseif type(a:val) == type('')
|
||||
let json = '"' . escape(a:val, '\"') . '"'
|
||||
let json = substitute(json, "\r", '\\r', 'g')
|
||||
let json = substitute(json, "\n", '\\n', 'g')
|
||||
let json = substitute(json, "\t", '\\t', 'g')
|
||||
let json = substitute(json, '\([[:cntrl:]]\)', '\=printf("\x%02d", char2nr(submatch(1)))', 'g')
|
||||
return iconv(json, &encoding, 'utf-8')
|
||||
elseif type(a:val) == 2
|
||||
let s = string(a:val)
|
||||
if s == string(g:spacevim_api_json_null)
|
||||
return 'null'
|
||||
elseif s == string(g:spacevim_api_json_true)
|
||||
return 'true'
|
||||
elseif s == string(g:spacevim_api_json_false)
|
||||
return 'false'
|
||||
endif
|
||||
elseif type(a:val) == type([])
|
||||
if len(a:val) == 1 && a:val[0] == g:spacevim_api_json_false[0]
|
||||
return 'false'
|
||||
elseif len(a:val) == 1 && a:val[0] == g:spacevim_api_json_true[0]
|
||||
return 'true'
|
||||
elseif len(a:val) == 1 && a:val[0] == g:spacevim_api_json_null[0]
|
||||
return 'null'
|
||||
endif
|
||||
return '[' . join(map(copy(a:val), 's:json_encode(v:val)'), ',') . ']'
|
||||
elseif type(a:val) == 4
|
||||
return '{' . join(map(keys(a:val), "s:json_encode(v:val) . ':' . s:json_encode(a:val[v:val])"), ',') . '}'
|
||||
else
|
||||
return string(a:val)
|
||||
endif
|
||||
endfunction
|
||||
function! s:json_encode(val) abort
|
||||
if type(a:val) == type(0)
|
||||
return a:val
|
||||
elseif type(a:val) == type('')
|
||||
let json = '"' . escape(a:val, '\"') . '"'
|
||||
let json = substitute(json, "\r", '\\r', 'g')
|
||||
let json = substitute(json, "\n", '\\n', 'g')
|
||||
let json = substitute(json, "\t", '\\t', 'g')
|
||||
let json = substitute(json, '\([[:cntrl:]]\)', '\=printf("\x%02d", char2nr(submatch(1)))', 'g')
|
||||
return iconv(json, &encoding, 'utf-8')
|
||||
elseif type(a:val) == 2
|
||||
let s = string(a:val)
|
||||
if s == string(g:spacevim_api_json_null)
|
||||
return 'null'
|
||||
elseif s == string(g:spacevim_api_json_true)
|
||||
return 'true'
|
||||
elseif s == string(g:spacevim_api_json_false)
|
||||
return 'false'
|
||||
endif
|
||||
elseif type(a:val) == type([])
|
||||
if len(a:val) == 1 && a:val[0] == g:spacevim_api_json_false[0]
|
||||
return 'false'
|
||||
elseif len(a:val) == 1 && a:val[0] == g:spacevim_api_json_true[0]
|
||||
return 'true'
|
||||
elseif len(a:val) == 1 && a:val[0] == g:spacevim_api_json_null[0]
|
||||
return 'null'
|
||||
endif
|
||||
return '[' . join(map(copy(a:val), 's:json_encode(v:val)'), ',') . ']'
|
||||
elseif type(a:val) == 4
|
||||
return '{' . join(map(keys(a:val), "s:json_encode(v:val) . ':' . s:json_encode(a:val[v:val])"), ',') . '}'
|
||||
else
|
||||
return string(a:val)
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let s:json['json_encode'] = function('s:json_encode')
|
||||
|
||||
function! SpaceVim#api#data#json#get() abort
|
||||
return deepcopy(s:json)
|
||||
return deepcopy(s:json)
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,46 +1,45 @@
|
||||
let s:file = {}
|
||||
|
||||
function! s:trim(str) abort
|
||||
let str = substitute(a:str, '\s*$', '', 'g')
|
||||
return substitute(str, '^\s*', '', 'g')
|
||||
let str = substitute(a:str, '\s*$', '', 'g')
|
||||
return substitute(str, '^\s*', '', 'g')
|
||||
endfunction
|
||||
|
||||
let s:file['trim'] = function('s:trim')
|
||||
|
||||
function! s:fill(str, length) abort
|
||||
if strwidth(a:str) <= a:length
|
||||
return a:str . repeat(' ', a:length - strwidth(a:str))
|
||||
else
|
||||
let l = 0
|
||||
for i in range(strchars(a:str) - 1)
|
||||
if strwidth(strcharpart(a:str, 0, i)) > a:length
|
||||
break
|
||||
else
|
||||
let l = i
|
||||
endif
|
||||
endfor
|
||||
let str = strcharpart(a:str, 0, l)
|
||||
return str . repeat(' ', a:length - strwidth(str))
|
||||
endif
|
||||
if strwidth(a:str) <= a:length
|
||||
return a:str . repeat(' ', a:length - strwidth(a:str))
|
||||
else
|
||||
let l = 0
|
||||
for i in range(strchars(a:str) - 1)
|
||||
if strwidth(strcharpart(a:str, 0, i)) > a:length
|
||||
break
|
||||
else
|
||||
let l = i
|
||||
endif
|
||||
endfor
|
||||
let str = strcharpart(a:str, 0, l)
|
||||
return str . repeat(' ', a:length - strwidth(str))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:file['fill'] = function('s:fill')
|
||||
|
||||
function! s:trim_start(str) abort
|
||||
return substitute(a:str, '^\s*', '', 'g')
|
||||
return substitute(a:str, '^\s*', '', 'g')
|
||||
endfunction
|
||||
|
||||
let s:file['trim_start'] = function('s:trim_start')
|
||||
|
||||
function! s:trim_end(str) abort
|
||||
return substitute(a:str, '\s*$', '', 'g')
|
||||
return substitute(a:str, '\s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
let s:file['trim_end'] = function('s:trim_end')
|
||||
|
||||
function! SpaceVim#api#data#string#get() abort
|
||||
return deepcopy(s:file)
|
||||
return deepcopy(s:file)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -3,181 +3,180 @@ let s:file = {}
|
||||
let s:system = SpaceVim#api#import('system')
|
||||
|
||||
if s:system.isWindows
|
||||
let s:file['separator'] = '\'
|
||||
let s:file['pathSeparator'] = ';'
|
||||
let s:file['separator'] = '\'
|
||||
let s:file['pathSeparator'] = ';'
|
||||
else
|
||||
let s:file['separator'] = '/'
|
||||
let s:file['pathSeparator'] = ':'
|
||||
let s:file['separator'] = '/'
|
||||
let s:file['pathSeparator'] = ':'
|
||||
endif
|
||||
|
||||
let s:file_node_extensions = {
|
||||
\ 'styl' : '',
|
||||
\ 'scss' : '',
|
||||
\ 'htm' : '',
|
||||
\ 'html' : '',
|
||||
\ 'erb' : '',
|
||||
\ 'slim' : '',
|
||||
\ 'ejs' : '',
|
||||
\ 'wxml' : '',
|
||||
\ 'css' : '',
|
||||
\ 'less' : '',
|
||||
\ 'wxss' : '',
|
||||
\ 'md' : '',
|
||||
\ 'markdown' : '',
|
||||
\ 'json' : '',
|
||||
\ 'js' : '',
|
||||
\ 'jsx' : '',
|
||||
\ 'rb' : '',
|
||||
\ 'php' : '',
|
||||
\ 'py' : '',
|
||||
\ 'pyc' : '',
|
||||
\ 'pyo' : '',
|
||||
\ 'pyd' : '',
|
||||
\ 'coffee' : '',
|
||||
\ 'mustache' : '',
|
||||
\ 'hbs' : '',
|
||||
\ 'conf' : '',
|
||||
\ 'ini' : '',
|
||||
\ 'yml' : '',
|
||||
\ 'bat' : '',
|
||||
\ 'jpg' : '',
|
||||
\ 'jpeg' : '',
|
||||
\ 'bmp' : '',
|
||||
\ 'png' : '',
|
||||
\ 'gif' : '',
|
||||
\ 'ico' : '',
|
||||
\ 'twig' : '',
|
||||
\ 'cpp' : '',
|
||||
\ 'c++' : '',
|
||||
\ 'cxx' : '',
|
||||
\ 'cc' : '',
|
||||
\ 'cp' : '',
|
||||
\ 'c' : '',
|
||||
\ 'hs' : '',
|
||||
\ 'lhs' : '',
|
||||
\ 'lua' : '',
|
||||
\ 'java' : '',
|
||||
\ 'sh' : '',
|
||||
\ 'fish' : '',
|
||||
\ 'ml' : 'λ',
|
||||
\ 'mli' : 'λ',
|
||||
\ 'diff' : '',
|
||||
\ 'db' : '',
|
||||
\ 'sql' : '',
|
||||
\ 'dump' : '',
|
||||
\ 'clj' : '',
|
||||
\ 'cljc' : '',
|
||||
\ 'cljs' : '',
|
||||
\ 'edn' : '',
|
||||
\ 'scala' : '',
|
||||
\ 'go' : '',
|
||||
\ 'dart' : '',
|
||||
\ 'xul' : '',
|
||||
\ 'sln' : '',
|
||||
\ 'suo' : '',
|
||||
\ 'pl' : '',
|
||||
\ 'pm' : '',
|
||||
\ 't' : '',
|
||||
\ 'rss' : '',
|
||||
\ 'f#' : '',
|
||||
\ 'fsscript' : '',
|
||||
\ 'fsx' : '',
|
||||
\ 'fs' : '',
|
||||
\ 'fsi' : '',
|
||||
\ 'rs' : '',
|
||||
\ 'rlib' : '',
|
||||
\ 'd' : '',
|
||||
\ 'erl' : '',
|
||||
\ 'hrl' : '',
|
||||
\ 'vim' : '',
|
||||
\ 'ai' : '',
|
||||
\ 'psd' : '',
|
||||
\ 'psb' : '',
|
||||
\ 'ts' : '',
|
||||
\ 'jl' : ''
|
||||
\}
|
||||
\ 'styl' : '',
|
||||
\ 'scss' : '',
|
||||
\ 'htm' : '',
|
||||
\ 'html' : '',
|
||||
\ 'erb' : '',
|
||||
\ 'slim' : '',
|
||||
\ 'ejs' : '',
|
||||
\ 'wxml' : '',
|
||||
\ 'css' : '',
|
||||
\ 'less' : '',
|
||||
\ 'wxss' : '',
|
||||
\ 'md' : '',
|
||||
\ 'markdown' : '',
|
||||
\ 'json' : '',
|
||||
\ 'js' : '',
|
||||
\ 'jsx' : '',
|
||||
\ 'rb' : '',
|
||||
\ 'php' : '',
|
||||
\ 'py' : '',
|
||||
\ 'pyc' : '',
|
||||
\ 'pyo' : '',
|
||||
\ 'pyd' : '',
|
||||
\ 'coffee' : '',
|
||||
\ 'mustache' : '',
|
||||
\ 'hbs' : '',
|
||||
\ 'conf' : '',
|
||||
\ 'ini' : '',
|
||||
\ 'yml' : '',
|
||||
\ 'bat' : '',
|
||||
\ 'jpg' : '',
|
||||
\ 'jpeg' : '',
|
||||
\ 'bmp' : '',
|
||||
\ 'png' : '',
|
||||
\ 'gif' : '',
|
||||
\ 'ico' : '',
|
||||
\ 'twig' : '',
|
||||
\ 'cpp' : '',
|
||||
\ 'c++' : '',
|
||||
\ 'cxx' : '',
|
||||
\ 'cc' : '',
|
||||
\ 'cp' : '',
|
||||
\ 'c' : '',
|
||||
\ 'hs' : '',
|
||||
\ 'lhs' : '',
|
||||
\ 'lua' : '',
|
||||
\ 'java' : '',
|
||||
\ 'sh' : '',
|
||||
\ 'fish' : '',
|
||||
\ 'ml' : 'λ',
|
||||
\ 'mli' : 'λ',
|
||||
\ 'diff' : '',
|
||||
\ 'db' : '',
|
||||
\ 'sql' : '',
|
||||
\ 'dump' : '',
|
||||
\ 'clj' : '',
|
||||
\ 'cljc' : '',
|
||||
\ 'cljs' : '',
|
||||
\ 'edn' : '',
|
||||
\ 'scala' : '',
|
||||
\ 'go' : '',
|
||||
\ 'dart' : '',
|
||||
\ 'xul' : '',
|
||||
\ 'sln' : '',
|
||||
\ 'suo' : '',
|
||||
\ 'pl' : '',
|
||||
\ 'pm' : '',
|
||||
\ 't' : '',
|
||||
\ 'rss' : '',
|
||||
\ 'f#' : '',
|
||||
\ 'fsscript' : '',
|
||||
\ 'fsx' : '',
|
||||
\ 'fs' : '',
|
||||
\ 'fsi' : '',
|
||||
\ 'rs' : '',
|
||||
\ 'rlib' : '',
|
||||
\ 'd' : '',
|
||||
\ 'erl' : '',
|
||||
\ 'hrl' : '',
|
||||
\ 'vim' : '',
|
||||
\ 'ai' : '',
|
||||
\ 'psd' : '',
|
||||
\ 'psb' : '',
|
||||
\ 'ts' : '',
|
||||
\ 'jl' : ''
|
||||
\}
|
||||
|
||||
let s:file_node_exact_matches = {
|
||||
\ 'exact-match-case-sensitive-1.txt' : 'X1',
|
||||
\ 'exact-match-case-sensitive-2' : 'X2',
|
||||
\ 'gruntfile.coffee' : '',
|
||||
\ 'gruntfile.js' : '',
|
||||
\ 'gruntfile.ls' : '',
|
||||
\ 'gulpfile.coffee' : '',
|
||||
\ 'gulpfile.js' : '',
|
||||
\ 'gulpfile.ls' : '',
|
||||
\ 'dropbox' : '',
|
||||
\ '.ds_store' : '',
|
||||
\ '.gitconfig' : '',
|
||||
\ '.gitignore' : '',
|
||||
\ '.bashrc' : '',
|
||||
\ '.bashprofile' : '',
|
||||
\ 'favicon.ico' : '',
|
||||
\ 'license' : '',
|
||||
\ 'node_modules' : '',
|
||||
\ 'react.jsx' : '',
|
||||
\ 'Procfile' : '',
|
||||
\ '.vimrc' : '',
|
||||
\}
|
||||
\ 'exact-match-case-sensitive-1.txt' : 'X1',
|
||||
\ 'exact-match-case-sensitive-2' : 'X2',
|
||||
\ 'gruntfile.coffee' : '',
|
||||
\ 'gruntfile.js' : '',
|
||||
\ 'gruntfile.ls' : '',
|
||||
\ 'gulpfile.coffee' : '',
|
||||
\ 'gulpfile.js' : '',
|
||||
\ 'gulpfile.ls' : '',
|
||||
\ 'dropbox' : '',
|
||||
\ '.ds_store' : '',
|
||||
\ '.gitconfig' : '',
|
||||
\ '.gitignore' : '',
|
||||
\ '.bashrc' : '',
|
||||
\ '.bashprofile' : '',
|
||||
\ 'favicon.ico' : '',
|
||||
\ 'license' : '',
|
||||
\ 'node_modules' : '',
|
||||
\ 'react.jsx' : '',
|
||||
\ 'Procfile' : '',
|
||||
\ '.vimrc' : '',
|
||||
\}
|
||||
|
||||
let s:file_node_pattern_matches = {
|
||||
\ '.*jquery.*\.js$' : '',
|
||||
\ '.*angular.*\.js$' : '',
|
||||
\ '.*backbone.*\.js$' : '',
|
||||
\ '.*require.*\.js$' : '',
|
||||
\ '.*materialize.*\.js$' : '',
|
||||
\ '.*materialize.*\.css$' : '',
|
||||
\ '.*mootools.*\.js$' : ''
|
||||
\}
|
||||
\ '.*jquery.*\.js$' : '',
|
||||
\ '.*angular.*\.js$' : '',
|
||||
\ '.*backbone.*\.js$' : '',
|
||||
\ '.*require.*\.js$' : '',
|
||||
\ '.*materialize.*\.js$' : '',
|
||||
\ '.*materialize.*\.css$' : '',
|
||||
\ '.*mootools.*\.js$' : ''
|
||||
\}
|
||||
|
||||
|
||||
function! s:filetypeIcon(path) abort
|
||||
let file = fnamemodify(a:path, ':t')
|
||||
if has_key(s:file_node_exact_matches, file)
|
||||
return s:file_node_exact_matches[file]
|
||||
let file = fnamemodify(a:path, ':t')
|
||||
if has_key(s:file_node_exact_matches, file)
|
||||
return s:file_node_exact_matches[file]
|
||||
endif
|
||||
for [k, v] in items(s:file_node_pattern_matches)
|
||||
if match(file, k) != -1
|
||||
return v
|
||||
endif
|
||||
for [k, v] in items(s:file_node_pattern_matches)
|
||||
if match(file, k) != -1
|
||||
return v
|
||||
endif
|
||||
endfor
|
||||
let ext = fnamemodify(file, ':e')
|
||||
if has_key(s:file_node_extensions, ext)
|
||||
return s:file_node_extensions[ext]
|
||||
endif
|
||||
return ''
|
||||
endfor
|
||||
let ext = fnamemodify(file, ':e')
|
||||
if has_key(s:file_node_extensions, ext)
|
||||
return s:file_node_extensions[ext]
|
||||
endif
|
||||
return ''
|
||||
|
||||
endfunction
|
||||
|
||||
let s:file['fticon'] = function('s:filetypeIcon')
|
||||
|
||||
function! s:write(msg, fname) abort
|
||||
let flags = filewritable(a:fname) ? 'a' : ''
|
||||
call writefile([a:msg], a:fname, flags)
|
||||
let flags = filewritable(a:fname) ? 'a' : ''
|
||||
call writefile([a:msg], a:fname, flags)
|
||||
endfunction
|
||||
|
||||
let s:file['write'] = function('s:write')
|
||||
|
||||
function! s:override(msg, fname) abort
|
||||
let flags = filewritable(a:fname) ? 'b' : ''
|
||||
call writefile([a:msg], a:fname, flags)
|
||||
let flags = filewritable(a:fname) ? 'b' : ''
|
||||
call writefile([a:msg], a:fname, flags)
|
||||
endfunction
|
||||
|
||||
let s:file['override'] = function('s:override')
|
||||
|
||||
function! s:read(fname) abort
|
||||
if filereadable(a:fname)
|
||||
return readfile(a:fname, '')
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
if filereadable(a:fname)
|
||||
return readfile(a:fname, '')
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:file['read'] = function('s:read')
|
||||
|
||||
function! SpaceVim#api#file#get() abort
|
||||
return deepcopy(s:file)
|
||||
return deepcopy(s:file)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -5,16 +5,16 @@ let s:chars = {}
|
||||
" 1: 1 ➛ ➀
|
||||
" 2: 1 ➛ ⓵
|
||||
function! s:bubble_num(num, type) abort
|
||||
let list = []
|
||||
call add(list,['➊', '➋', '➌', '➍', '➎', '➏', '➐', '➑', '➒', '➓'])
|
||||
call add(list,['➀', '➁', '➂', '➃', '➄', '➅', '➆', '➇', '➈', '➉'])
|
||||
call add(list,['⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'])
|
||||
let n = ''
|
||||
try
|
||||
let n = list[a:type][a:num-1]
|
||||
catch
|
||||
endtry
|
||||
return n
|
||||
let list = []
|
||||
call add(list,['➊', '➋', '➌', '➍', '➎', '➏', '➐', '➑', '➒', '➓'])
|
||||
call add(list,['➀', '➁', '➂', '➃', '➄', '➅', '➆', '➇', '➈', '➉'])
|
||||
call add(list,['⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'])
|
||||
let n = ''
|
||||
try
|
||||
let n = list[a:type][a:num-1]
|
||||
catch
|
||||
endtry
|
||||
return n
|
||||
endfunction
|
||||
|
||||
let s:chars['bubble_num'] = function('s:bubble_num')
|
||||
@ -24,85 +24,86 @@ let s:chars['bubble_num'] = function('s:bubble_num')
|
||||
" 1: 1 ➛ ➀
|
||||
" 2: 1 ➛ ⓵
|
||||
function! s:circled_num(num, type) abort
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if a:type == 0
|
||||
if a:num == 0
|
||||
return nr2char(9471)
|
||||
elseif index(range(1,10), a:num) != -1
|
||||
return nr2char(10102 + a:num - 1)
|
||||
elseif index(range(11, 20), a:num)
|
||||
return nr2char(9451 + a:num - 11)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
elseif a:type == 1
|
||||
if index(range(20), a:num) != -1
|
||||
if a:num == 0
|
||||
return nr2char(9450)
|
||||
else
|
||||
return nr2char(9311 + a:num)
|
||||
endif
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
elseif a:type == 2
|
||||
if index(range(1, 10), a:num) != -1
|
||||
return nr2char(9461 + a:num - 1)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if a:type == 0
|
||||
if a:num == 0
|
||||
return nr2char(9471)
|
||||
elseif index(range(1,10), a:num) != -1
|
||||
return nr2char(10102 + a:num - 1)
|
||||
elseif index(range(11, 20), a:num)
|
||||
return nr2char(9451 + a:num - 11)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
elseif a:type == 1
|
||||
if index(range(20), a:num) != -1
|
||||
if a:num == 0
|
||||
return nr2char(9450)
|
||||
else
|
||||
return nr2char(9311 + a:num)
|
||||
endif
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
elseif a:type == 2
|
||||
if index(range(1, 10), a:num) != -1
|
||||
return nr2char(9461 + a:num - 1)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:chars['circled_num'] = function('s:circled_num')
|
||||
|
||||
function! s:parenthesized_num(num) abort
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 20), a:num) != -1
|
||||
return nr2char(9331 + a:num)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 20), a:num) != -1
|
||||
return nr2char(9331 + a:num)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:chars['parenthesized_num'] = function('s:parenthesized_num')
|
||||
|
||||
function! s:num_period(num) abort
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 20), a:num) != -1
|
||||
return nr2char(9351 + a:num)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 20), a:num) != -1
|
||||
return nr2char(9351 + a:num)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:chars['num_period'] = function('s:num_period')
|
||||
|
||||
function! s:parenthesized_letter(letter) abort
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 26), char2nr(a:letter) - 96) != -1
|
||||
return nr2char(9371 + char2nr(a:letter) - 96)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 26), char2nr(a:letter) - 96) != -1
|
||||
return nr2char(9371 + char2nr(a:letter) - 96)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:chars['parenthesized_letter'] = function('s:parenthesized_letter')
|
||||
|
||||
function! s:circled_letter(letter) abort
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 26), char2nr(a:letter) - 64) != -1
|
||||
return nr2char(9397 + char2nr(a:letter) - 64)
|
||||
elseif index(range(1, 26), char2nr(a:letter) - 96) != -1
|
||||
return nr2char(9423 + char2nr(a:letter) - 96)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
" http://www.unicode.org/charts/beta/nameslist/n_2460.html
|
||||
if index(range(1, 26), char2nr(a:letter) - 64) != -1
|
||||
return nr2char(9397 + char2nr(a:letter) - 64)
|
||||
elseif index(range(1, 26), char2nr(a:letter) - 96) != -1
|
||||
return nr2char(9423 + char2nr(a:letter) - 96)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:chars['circled_letter'] = function('s:circled_letter')
|
||||
|
||||
function! SpaceVim#api#messletters#get() abort
|
||||
return deepcopy(s:chars)
|
||||
return deepcopy(s:chars)
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -8,52 +8,54 @@ let s:system['isLinux'] = has('unix') && !has('macunix') && !has('win32unix')
|
||||
let s:system['isOSX'] = has('macunix')
|
||||
|
||||
function! s:isDarwin() abort
|
||||
if exists('s:is_darwin')
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if has('macunix')
|
||||
let s:is_darwin = 1
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if ! has('unix')
|
||||
let s:is_darwin = 0
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if system('uname -s') ==# "Darwin\n"
|
||||
let s:is_darwin = 1
|
||||
else
|
||||
let s:is_darwin = 0
|
||||
endif
|
||||
|
||||
if exists('s:is_darwin')
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if has('macunix')
|
||||
let s:is_darwin = 1
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if ! has('unix')
|
||||
let s:is_darwin = 0
|
||||
return s:is_darwin
|
||||
endif
|
||||
|
||||
if system('uname -s') ==# "Darwin\n"
|
||||
let s:is_darwin = 1
|
||||
else
|
||||
let s:is_darwin = 0
|
||||
endif
|
||||
|
||||
return s:is_darwin
|
||||
endfunction
|
||||
|
||||
let s:system['isDarwin'] = function('s:isDarwin')
|
||||
|
||||
function! s:fileformat() abort
|
||||
let fileformat = ''
|
||||
let fileformat = ''
|
||||
|
||||
if &fileformat ==? 'dos'
|
||||
let fileformat = ''
|
||||
elseif &fileformat ==? 'unix'
|
||||
if s:isDarwin()
|
||||
let fileformat = ''
|
||||
else
|
||||
let fileformat = ''
|
||||
endif
|
||||
elseif &fileformat ==? 'mac'
|
||||
let fileformat = ''
|
||||
if &fileformat ==? 'dos'
|
||||
let fileformat = ''
|
||||
elseif &fileformat ==? 'unix'
|
||||
if s:isDarwin()
|
||||
let fileformat = ''
|
||||
else
|
||||
let fileformat = ''
|
||||
endif
|
||||
elseif &fileformat ==? 'mac'
|
||||
let fileformat = ''
|
||||
endif
|
||||
|
||||
return fileformat
|
||||
return fileformat
|
||||
endfunction
|
||||
|
||||
let s:system['fileformat'] = function('s:fileformat')
|
||||
|
||||
|
||||
function! SpaceVim#api#system#get() abort
|
||||
return deepcopy(s:system)
|
||||
return deepcopy(s:system)
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -7,75 +7,77 @@ scriptencoding utf-8
|
||||
|
||||
" json should be a list of items which have same keys
|
||||
function! s:drawing_table(json, ...) abort
|
||||
if empty(a:json)
|
||||
return []
|
||||
endif
|
||||
if &encoding ==# 'utf-8'
|
||||
let top_left_corner = '╭'
|
||||
let top_right_corner = '╮'
|
||||
let bottom_left_corner = '╰'
|
||||
let bottom_right_corner = '╯'
|
||||
let side = '│'
|
||||
let top_bottom_side = '─'
|
||||
let middle = '┼'
|
||||
let top_middle = '┬'
|
||||
let left_middle = '├'
|
||||
let right_middle = '┤'
|
||||
let bottom_middle = '┴'
|
||||
else
|
||||
let top_left_corner = '*'
|
||||
let top_right_corner = '*'
|
||||
let bottom_left_corner = '*'
|
||||
let bottom_right_corner = '*'
|
||||
let side = '|'
|
||||
let top_bottom_side = '-'
|
||||
let middle = '*'
|
||||
let top_middle = '*'
|
||||
let left_middle = '*'
|
||||
let right_middle = '*'
|
||||
let bottom_middle = '*'
|
||||
endif
|
||||
let table = []
|
||||
let items = s:json.json_decode(a:json)
|
||||
let col = len(keys(items[0]))
|
||||
let top_line = top_left_corner
|
||||
\ . repeat(repeat(top_bottom_side, 15) . top_middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . top_right_corner
|
||||
let middle_line = left_middle
|
||||
\ . repeat(repeat(top_bottom_side, 15) . middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . right_middle
|
||||
let bottom_line = bottom_left_corner
|
||||
\ . repeat(repeat(top_bottom_side, 15) . bottom_middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . bottom_right_corner
|
||||
call add(table, top_line)
|
||||
let tytle = side
|
||||
if a:0 == 0
|
||||
let keys = keys(items[0])
|
||||
else
|
||||
let keys = a:1
|
||||
endif
|
||||
if empty(a:json)
|
||||
return []
|
||||
endif
|
||||
if &encoding ==# 'utf-8'
|
||||
let top_left_corner = '╭'
|
||||
let top_right_corner = '╮'
|
||||
let bottom_left_corner = '╰'
|
||||
let bottom_right_corner = '╯'
|
||||
let side = '│'
|
||||
let top_bottom_side = '─'
|
||||
let middle = '┼'
|
||||
let top_middle = '┬'
|
||||
let left_middle = '├'
|
||||
let right_middle = '┤'
|
||||
let bottom_middle = '┴'
|
||||
else
|
||||
let top_left_corner = '*'
|
||||
let top_right_corner = '*'
|
||||
let bottom_left_corner = '*'
|
||||
let bottom_right_corner = '*'
|
||||
let side = '|'
|
||||
let top_bottom_side = '-'
|
||||
let middle = '*'
|
||||
let top_middle = '*'
|
||||
let left_middle = '*'
|
||||
let right_middle = '*'
|
||||
let bottom_middle = '*'
|
||||
endif
|
||||
let table = []
|
||||
let items = s:json.json_decode(a:json)
|
||||
let col = len(keys(items[0]))
|
||||
let top_line = top_left_corner
|
||||
\ . repeat(repeat(top_bottom_side, 15) . top_middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . top_right_corner
|
||||
let middle_line = left_middle
|
||||
\ . repeat(repeat(top_bottom_side, 15) . middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . right_middle
|
||||
let bottom_line = bottom_left_corner
|
||||
\ . repeat(repeat(top_bottom_side, 15) . bottom_middle, col - 1)
|
||||
\ . repeat(top_bottom_side, 15)
|
||||
\ . bottom_right_corner
|
||||
call add(table, top_line)
|
||||
let tytle = side
|
||||
if a:0 == 0
|
||||
let keys = keys(items[0])
|
||||
else
|
||||
let keys = a:1
|
||||
endif
|
||||
for key in keys
|
||||
let tytle .= s:string.fill(key , 15) . side
|
||||
endfor
|
||||
call add(table, tytle)
|
||||
call add(table, middle_line)
|
||||
for item in items
|
||||
let value_line = side
|
||||
for key in keys
|
||||
let tytle .= s:string.fill(key , 15) . side
|
||||
let value_line .= s:string.fill(item[key], 15) . side
|
||||
endfor
|
||||
call add(table, tytle)
|
||||
call add(table, value_line)
|
||||
call add(table, middle_line)
|
||||
for item in items
|
||||
let value_line = side
|
||||
for key in keys
|
||||
let value_line .= s:string.fill(item[key], 15) . side
|
||||
endfor
|
||||
call add(table, value_line)
|
||||
call add(table, middle_line)
|
||||
endfor
|
||||
let table[-1] = bottom_line
|
||||
return table
|
||||
endfor
|
||||
let table[-1] = bottom_line
|
||||
return table
|
||||
endfunction
|
||||
|
||||
let s:box['drawing_table'] = function('s:drawing_table')
|
||||
|
||||
function! SpaceVim#api#unicode#box#get() abort
|
||||
return deepcopy(s:box)
|
||||
return deepcopy(s:box)
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,97 +1,99 @@
|
||||
"autocmds
|
||||
function! SpaceVim#autocmds#init() abort
|
||||
augroup My_autocmds
|
||||
au!
|
||||
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
|
||||
\ q :cclose<cr>:lclose<cr>
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
|
||||
\ bd|
|
||||
\ q | endif
|
||||
autocmd FileType jsp call JspFileTypeInit()
|
||||
autocmd FileType html,css,jsp EmmetInstall
|
||||
autocmd BufRead,BufNewFile *.pp setfiletype puppet
|
||||
autocmd BufEnter,WinEnter,InsertLeave * set cursorline
|
||||
autocmd BufLeave,WinLeave,InsertEnter * set nocursorline
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file
|
||||
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
|
||||
autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
|
||||
autocmd FileType text setlocal textwidth=78 " for all text files set 'textwidth' to 78 characters.
|
||||
autocmd FileType c,cpp,cs,swig set nomodeline " this will avoid bug in my project with namespace ex, the vim will tree ex:: as modeline.
|
||||
autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://
|
||||
autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f:///,f://
|
||||
autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",f:\"
|
||||
autocmd FileType lua set comments=f:--
|
||||
autocmd FileType vim setlocal foldmethod=marker
|
||||
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
|
||||
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||
autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags
|
||||
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
||||
autocmd FileType xml call XmlFileTypeInit()
|
||||
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
||||
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
||||
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
||||
autocmd BufEnter *
|
||||
\ if empty(&buftype) && has('nvim') && &filetype != 'help'
|
||||
\| nnoremap <silent><buffer> <C-]> :call MyTagfunc()<CR>
|
||||
\| nnoremap <silent><buffer> <C-[> :call MyTagfuncBack()<CR>
|
||||
\| else
|
||||
\| nnoremap <silent><buffer> <leader>] :call MyTagfunc()<CR>
|
||||
\| nnoremap <silent><buffer> <leader>[ :call MyTagfuncBack()<CR>
|
||||
\| endif
|
||||
"}}}
|
||||
autocmd FileType python,coffee call zvim#util#check_if_expand_tab()
|
||||
" Instead of reverting the cursor to the last position in the buffer, we
|
||||
" set it to the first line when editing a git commit message
|
||||
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
if executable('synclient')
|
||||
let s:touchpadoff = 0
|
||||
autocmd InsertEnter * call s:disable_touchpad()
|
||||
autocmd InsertLeave * call s:enable_touchpad()
|
||||
autocmd FocusLost * call system('synclient touchpadoff=0')
|
||||
autocmd FocusGained * call s:reload_touchpad_status()
|
||||
endif
|
||||
autocmd BufWritePost *.vim call s:generate_doc()
|
||||
autocmd FileType * set scrolloff=7
|
||||
augroup END
|
||||
augroup SpaceVimInit
|
||||
au!
|
||||
autocmd VimEnter * if !argc() | call SpaceVim#welcome() | endif
|
||||
augroup END
|
||||
augroup My_autocmds
|
||||
au!
|
||||
autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
|
||||
\ q :cclose<cr>:lclose<cr>
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
|
||||
\ bd|
|
||||
\ q | endif
|
||||
autocmd FileType jsp call JspFileTypeInit()
|
||||
autocmd FileType html,css,jsp EmmetInstall
|
||||
autocmd BufRead,BufNewFile *.pp setfiletype puppet
|
||||
autocmd BufEnter,WinEnter,InsertLeave * set cursorline
|
||||
autocmd BufLeave,WinLeave,InsertEnter * set nocursorline
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file
|
||||
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
|
||||
autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
|
||||
autocmd FileType text setlocal textwidth=78 " for all text files set 'textwidth' to 78 characters.
|
||||
autocmd FileType c,cpp,cs,swig set nomodeline " this will avoid bug in my project with namespace ex, the vim will tree ex:: as modeline.
|
||||
autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://
|
||||
autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f:///,f://
|
||||
autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",f:\"
|
||||
autocmd FileType lua set comments=f:--
|
||||
autocmd FileType vim setlocal foldmethod=marker
|
||||
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
|
||||
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||
autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags
|
||||
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
||||
autocmd FileType xml call XmlFileTypeInit()
|
||||
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
||||
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
||||
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
||||
autocmd BufEnter *
|
||||
\ if empty(&buftype) && has('nvim') && &filetype != 'help'
|
||||
\| nnoremap <silent><buffer> <C-]> :call MyTagfunc()<CR>
|
||||
\| nnoremap <silent><buffer> <C-[> :call MyTagfuncBack()<CR>
|
||||
\| else
|
||||
\| nnoremap <silent><buffer> <leader>] :call MyTagfunc()<CR>
|
||||
\| nnoremap <silent><buffer> <leader>[ :call MyTagfuncBack()<CR>
|
||||
\| endif
|
||||
"}}}
|
||||
autocmd FileType python,coffee call zvim#util#check_if_expand_tab()
|
||||
" Instead of reverting the cursor to the last position in the buffer, we
|
||||
" set it to the first line when editing a git commit message
|
||||
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
if executable('synclient')
|
||||
let s:touchpadoff = 0
|
||||
autocmd InsertEnter * call s:disable_touchpad()
|
||||
autocmd InsertLeave * call s:enable_touchpad()
|
||||
autocmd FocusLost * call system('synclient touchpadoff=0')
|
||||
autocmd FocusGained * call s:reload_touchpad_status()
|
||||
endif
|
||||
autocmd BufWritePost *.vim call s:generate_doc()
|
||||
autocmd FileType * set scrolloff=7
|
||||
augroup END
|
||||
augroup SpaceVimInit
|
||||
au!
|
||||
autocmd VimEnter * if !argc() | call SpaceVim#welcome() | endif
|
||||
augroup END
|
||||
endfunction
|
||||
function! s:reload_touchpad_status() abort
|
||||
if s:touchpadoff
|
||||
call s:disable_touchpad()
|
||||
endif
|
||||
if s:touchpadoff
|
||||
call s:disable_touchpad()
|
||||
endif
|
||||
endf
|
||||
function! s:disable_touchpad() abort
|
||||
let s:touchpadoff = 1
|
||||
call system('synclient touchpadoff=1')
|
||||
let s:touchpadoff = 1
|
||||
call system('synclient touchpadoff=1')
|
||||
endfunction
|
||||
function! s:enable_touchpad() abort
|
||||
let s:touchpadoff = 0
|
||||
call system('synclient touchpadoff=0')
|
||||
let s:touchpadoff = 0
|
||||
call system('synclient touchpadoff=0')
|
||||
endfunction
|
||||
function! s:fixindentline() abort
|
||||
if !exists('s:done')
|
||||
if exists(':IndentLinesToggle') == 2
|
||||
IndentLinesToggle
|
||||
IndentLinesToggle
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom 'plugin : indentLines has not been installed,
|
||||
\ please use `:call dein#install(["indentLine"])` to install this plugin,'
|
||||
echohl None
|
||||
endif
|
||||
let s:done = 1
|
||||
if !exists('s:done')
|
||||
if exists(':IndentLinesToggle') == 2
|
||||
IndentLinesToggle
|
||||
IndentLinesToggle
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom 'plugin : indentLines has not been installed,
|
||||
\ please use `:call dein#install(["indentLine"])` to install this plugin,'
|
||||
echohl None
|
||||
endif
|
||||
let s:done = 1
|
||||
endif
|
||||
endfunction
|
||||
function! s:generate_doc() abort
|
||||
if filereadable('./addon-info.json') && executable('vimdoc')
|
||||
call system('vimdoc .')
|
||||
endif
|
||||
if filereadable('./addon-info.json') && executable('vimdoc')
|
||||
call system('vimdoc .')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,338 +1,337 @@
|
||||
scriptencoding utf-8
|
||||
function! SpaceVim#default#SetOptions() abort
|
||||
" basic vim settiing
|
||||
if has('gui_running')
|
||||
set guioptions-=m " Hide menu bar.
|
||||
set guioptions-=T " Hide toolbar
|
||||
set guioptions-=L " Hide left-hand scrollbar
|
||||
set guioptions-=r " Hide right-hand scrollbar
|
||||
set guioptions-=b " Hide bottom scrollbar
|
||||
set showtabline=0 " Hide tabline
|
||||
if WINDOWS()
|
||||
" please install the font in 'Dotfiles\font'
|
||||
set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT
|
||||
elseif OSX()
|
||||
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11
|
||||
else
|
||||
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 11
|
||||
endif
|
||||
" basic vim settiing
|
||||
if has('gui_running')
|
||||
set guioptions-=m " Hide menu bar.
|
||||
set guioptions-=T " Hide toolbar
|
||||
set guioptions-=L " Hide left-hand scrollbar
|
||||
set guioptions-=r " Hide right-hand scrollbar
|
||||
set guioptions-=b " Hide bottom scrollbar
|
||||
set showtabline=0 " Hide tabline
|
||||
if WINDOWS()
|
||||
" please install the font in 'Dotfiles\font'
|
||||
set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT
|
||||
elseif OSX()
|
||||
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11
|
||||
else
|
||||
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 11
|
||||
endif
|
||||
endif
|
||||
|
||||
" indent use backspace delete indent, eol use backspace delete line at
|
||||
" begining start delete the char you just typed in if you do not use set
|
||||
" nocompatible ,you need this
|
||||
set backspace=indent,eol,start
|
||||
" indent use backspace delete indent, eol use backspace delete line at
|
||||
" begining start delete the char you just typed in if you do not use set
|
||||
" nocompatible ,you need this
|
||||
set backspace=indent,eol,start
|
||||
|
||||
" Shou number and relativenumber
|
||||
set relativenumber
|
||||
set number
|
||||
" Shou number and relativenumber
|
||||
set relativenumber
|
||||
set number
|
||||
|
||||
" set fillchar
|
||||
hi VertSplit ctermbg=NONE guibg=NONE
|
||||
set fillchars+=vert:│
|
||||
" set fillchar
|
||||
hi VertSplit ctermbg=NONE guibg=NONE
|
||||
set fillchars+=vert:│
|
||||
|
||||
" hide cmd
|
||||
set noshowcmd
|
||||
" hide cmd
|
||||
set noshowcmd
|
||||
|
||||
" indent
|
||||
set autoindent
|
||||
set smartindent
|
||||
set cindent
|
||||
" indent
|
||||
set autoindent
|
||||
set smartindent
|
||||
set cindent
|
||||
|
||||
" show wildmenu
|
||||
set wildmenu
|
||||
" show wildmenu
|
||||
set wildmenu
|
||||
|
||||
" do not break words.
|
||||
set linebreak
|
||||
" do not break words.
|
||||
set linebreak
|
||||
|
||||
" tab options:
|
||||
set tabstop=4
|
||||
set expandtab
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
" tab options:
|
||||
set tabstop=4
|
||||
set expandtab
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
" autoread
|
||||
set autoread
|
||||
" autoread
|
||||
set autoread
|
||||
|
||||
" backup
|
||||
set backup
|
||||
set undofile
|
||||
set undolevels=1000
|
||||
let g:data_dir = $HOME . '/.data/'
|
||||
let g:backup_dir = g:data_dir . 'backup'
|
||||
let g:swap_dir = g:data_dir . 'swap'
|
||||
let g:undo_dir = g:data_dir . 'undofile'
|
||||
if finddir(g:data_dir) ==# ''
|
||||
silent call mkdir(g:data_dir)
|
||||
endif
|
||||
if finddir(g:backup_dir) ==# ''
|
||||
silent call mkdir(g:backup_dir)
|
||||
endif
|
||||
if finddir(g:swap_dir) ==# ''
|
||||
silent call mkdir(g:swap_dir)
|
||||
endif
|
||||
if finddir(g:undo_dir) ==# ''
|
||||
silent call mkdir(g:undo_dir)
|
||||
endif
|
||||
unlet g:backup_dir
|
||||
unlet g:swap_dir
|
||||
unlet g:data_dir
|
||||
unlet g:undo_dir
|
||||
set undodir=$HOME/.data/undofile
|
||||
set backupdir=$HOME/.data/backup
|
||||
set directory=$HOME/.data/swap
|
||||
set nofoldenable " no fold enable
|
||||
set nowritebackup
|
||||
set matchtime=0
|
||||
set ruler
|
||||
set showmatch
|
||||
set showmode
|
||||
"menuone: show the pupmenu when only one match
|
||||
set completeopt=menu,menuone,longest " disable preview scratch window,
|
||||
set complete=.,w,b,u,t " h: 'complete'
|
||||
set pumheight=15 " limit completion menu height
|
||||
set scrolloff=7
|
||||
set incsearch
|
||||
set hlsearch
|
||||
set laststatus=2
|
||||
set completeopt=longest,menu
|
||||
set wildignorecase
|
||||
set mouse=
|
||||
set hidden
|
||||
set ttimeout
|
||||
set ttimeoutlen=50
|
||||
set background=dark
|
||||
" backup
|
||||
set backup
|
||||
set undofile
|
||||
set undolevels=1000
|
||||
let g:data_dir = $HOME . '/.data/'
|
||||
let g:backup_dir = g:data_dir . 'backup'
|
||||
let g:swap_dir = g:data_dir . 'swap'
|
||||
let g:undo_dir = g:data_dir . 'undofile'
|
||||
if finddir(g:data_dir) ==# ''
|
||||
silent call mkdir(g:data_dir)
|
||||
endif
|
||||
if finddir(g:backup_dir) ==# ''
|
||||
silent call mkdir(g:backup_dir)
|
||||
endif
|
||||
if finddir(g:swap_dir) ==# ''
|
||||
silent call mkdir(g:swap_dir)
|
||||
endif
|
||||
if finddir(g:undo_dir) ==# ''
|
||||
silent call mkdir(g:undo_dir)
|
||||
endif
|
||||
unlet g:backup_dir
|
||||
unlet g:swap_dir
|
||||
unlet g:data_dir
|
||||
unlet g:undo_dir
|
||||
set undodir=$HOME/.data/undofile
|
||||
set backupdir=$HOME/.data/backup
|
||||
set directory=$HOME/.data/swap
|
||||
|
||||
" no fold enable
|
||||
set nofoldenable
|
||||
set nowritebackup
|
||||
set matchtime=0
|
||||
set ruler
|
||||
set showmatch
|
||||
set showmode
|
||||
"menuone: show the pupmenu when only one match
|
||||
" disable preview scratch window,
|
||||
set completeopt=menu,menuone,longest
|
||||
" h: 'complete'
|
||||
set complete=.,w,b,u,t
|
||||
" limit completion menu height
|
||||
set pumheight=15
|
||||
set scrolloff=7
|
||||
set incsearch
|
||||
set hlsearch
|
||||
set laststatus=2
|
||||
set wildignorecase
|
||||
set mouse=
|
||||
set hidden
|
||||
set ttimeout
|
||||
set ttimeoutlen=50
|
||||
set background=dark
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#SetPlugins() abort
|
||||
|
||||
call add(g:spacevim_plugin_groups, 'web')
|
||||
call add(g:spacevim_plugin_groups, 'lang')
|
||||
call add(g:spacevim_plugin_groups, 'edit')
|
||||
call add(g:spacevim_plugin_groups, 'ui')
|
||||
call add(g:spacevim_plugin_groups, 'tools')
|
||||
call add(g:spacevim_plugin_groups, 'checkers')
|
||||
call add(g:spacevim_plugin_groups, 'format')
|
||||
call add(g:spacevim_plugin_groups, 'chat')
|
||||
call add(g:spacevim_plugin_groups, 'git')
|
||||
call add(g:spacevim_plugin_groups, 'javascript')
|
||||
call add(g:spacevim_plugin_groups, 'ruby')
|
||||
call add(g:spacevim_plugin_groups, 'python')
|
||||
call add(g:spacevim_plugin_groups, 'scala')
|
||||
call add(g:spacevim_plugin_groups, 'lang#go')
|
||||
call add(g:spacevim_plugin_groups, 'lang#markdown')
|
||||
call add(g:spacevim_plugin_groups, 'scm')
|
||||
call add(g:spacevim_plugin_groups, 'editing')
|
||||
call add(g:spacevim_plugin_groups, 'indents')
|
||||
call add(g:spacevim_plugin_groups, 'navigation')
|
||||
call add(g:spacevim_plugin_groups, 'misc')
|
||||
call add(g:spacevim_plugin_groups, 'web')
|
||||
call add(g:spacevim_plugin_groups, 'lang')
|
||||
call add(g:spacevim_plugin_groups, 'edit')
|
||||
call add(g:spacevim_plugin_groups, 'ui')
|
||||
call add(g:spacevim_plugin_groups, 'tools')
|
||||
call add(g:spacevim_plugin_groups, 'checkers')
|
||||
call add(g:spacevim_plugin_groups, 'format')
|
||||
call add(g:spacevim_plugin_groups, 'chat')
|
||||
call add(g:spacevim_plugin_groups, 'git')
|
||||
call add(g:spacevim_plugin_groups, 'javascript')
|
||||
call add(g:spacevim_plugin_groups, 'ruby')
|
||||
call add(g:spacevim_plugin_groups, 'python')
|
||||
call add(g:spacevim_plugin_groups, 'scala')
|
||||
call add(g:spacevim_plugin_groups, 'lang#go')
|
||||
call add(g:spacevim_plugin_groups, 'lang#markdown')
|
||||
call add(g:spacevim_plugin_groups, 'scm')
|
||||
call add(g:spacevim_plugin_groups, 'editing')
|
||||
call add(g:spacevim_plugin_groups, 'indents')
|
||||
call add(g:spacevim_plugin_groups, 'navigation')
|
||||
call add(g:spacevim_plugin_groups, 'misc')
|
||||
|
||||
call add(g:spacevim_plugin_groups, 'core')
|
||||
call add(g:spacevim_plugin_groups, 'unite')
|
||||
call add(g:spacevim_plugin_groups, 'github')
|
||||
if has('python3')
|
||||
call add(g:spacevim_plugin_groups, 'denite')
|
||||
endif
|
||||
call add(g:spacevim_plugin_groups, 'ctrlp')
|
||||
call add(g:spacevim_plugin_groups, 'autocomplete')
|
||||
if ! has('nvim')
|
||||
call add(g:spacevim_plugin_groups, 'vim')
|
||||
else
|
||||
call add(g:spacevim_plugin_groups, 'nvim')
|
||||
endif
|
||||
if OSX()
|
||||
call add(g:spacevim_plugin_groups, 'osx')
|
||||
endif
|
||||
if WINDOWS()
|
||||
call add(g:spacevim_plugin_groups, 'windows')
|
||||
endif
|
||||
if LINUX()
|
||||
call add(g:spacevim_plugin_groups, 'linux')
|
||||
endif
|
||||
call add(g:spacevim_plugin_groups, 'core')
|
||||
call add(g:spacevim_plugin_groups, 'unite')
|
||||
call add(g:spacevim_plugin_groups, 'github')
|
||||
if has('python3')
|
||||
call add(g:spacevim_plugin_groups, 'denite')
|
||||
endif
|
||||
call add(g:spacevim_plugin_groups, 'ctrlp')
|
||||
call add(g:spacevim_plugin_groups, 'autocomplete')
|
||||
if ! has('nvim')
|
||||
call add(g:spacevim_plugin_groups, 'vim')
|
||||
else
|
||||
call add(g:spacevim_plugin_groups, 'nvim')
|
||||
endif
|
||||
if OSX()
|
||||
call add(g:spacevim_plugin_groups, 'osx')
|
||||
endif
|
||||
if WINDOWS()
|
||||
call add(g:spacevim_plugin_groups, 'windows')
|
||||
endif
|
||||
if LINUX()
|
||||
call add(g:spacevim_plugin_groups, 'linux')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#SetMappings() abort
|
||||
|
||||
"mapping
|
||||
"全局映射
|
||||
"也可以通过'za'打开或者关闭折叠
|
||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
||||
inoremap <silent><expr><CR> SpaceVim#mapping#enter()
|
||||
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
||||
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
||||
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
|
||||
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
|
||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
"Super paste it does not work
|
||||
"ino <C-v> <esc>:set paste<cr>mui<C-R>+<esc>mv'uV'v=:set nopaste<cr>
|
||||
"对于没有权限的文件使用 :w!!来保存
|
||||
cnoremap w!! %!sudo tee > /dev/null %
|
||||
" cmap W!! w !sudo tee % >/dev/null " I can not understand
|
||||
" Save a file with sudo
|
||||
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
|
||||
"mapping
|
||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
||||
inoremap <silent><expr><CR> SpaceVim#mapping#enter()
|
||||
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
||||
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
||||
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
|
||||
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
|
||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
" Save a file with sudo
|
||||
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
|
||||
cnoremap w!! %!sudo tee > /dev/null %
|
||||
|
||||
|
||||
" 映射Ctrl+上下左右来切换窗口
|
||||
nnoremap <silent><C-Right> :<C-u>wincmd l<CR>
|
||||
nnoremap <silent><C-Left> :<C-u>wincmd h<CR>
|
||||
nnoremap <silent><C-Up> :<C-u>wincmd k<CR>
|
||||
nnoremap <silent><C-Down> :<C-u>wincmd j<CR>
|
||||
if has('nvim')
|
||||
exe 'tnoremap <silent><C-Right> <C-\><C-n>:<C-u>wincmd l<CR>'
|
||||
exe 'tnoremap <silent><C-Left> <C-\><C-n>:<C-u>wincmd h<CR>'
|
||||
exe 'tnoremap <silent><C-Up> <C-\><C-n>:<C-u>wincmd k<CR>'
|
||||
exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>'
|
||||
exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>'
|
||||
exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>'
|
||||
exe 'tnoremap <silent><esc> <C-\><C-n>'
|
||||
endif
|
||||
" Use Ctrl+* to jump between windows
|
||||
nnoremap <silent><C-Right> :<C-u>wincmd l<CR>
|
||||
nnoremap <silent><C-Left> :<C-u>wincmd h<CR>
|
||||
nnoremap <silent><C-Up> :<C-u>wincmd k<CR>
|
||||
nnoremap <silent><C-Down> :<C-u>wincmd j<CR>
|
||||
if has('nvim')
|
||||
exe 'tnoremap <silent><C-Right> <C-\><C-n>:<C-u>wincmd l<CR>'
|
||||
exe 'tnoremap <silent><C-Left> <C-\><C-n>:<C-u>wincmd h<CR>'
|
||||
exe 'tnoremap <silent><C-Up> <C-\><C-n>:<C-u>wincmd k<CR>'
|
||||
exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>'
|
||||
exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>'
|
||||
exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>'
|
||||
exe 'tnoremap <silent><esc> <C-\><C-n>'
|
||||
endif
|
||||
|
||||
"Quickly add empty lines
|
||||
nnoremap <silent>[<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
|
||||
nnoremap <silent>]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
|
||||
"Quickly add empty lines
|
||||
nnoremap <silent>[<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
|
||||
nnoremap <silent>]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
|
||||
|
||||
"Use jk switch to normal model
|
||||
inoremap jk <esc>
|
||||
"Use jk switch to normal mode
|
||||
inoremap jk <esc>
|
||||
|
||||
"]e or [e move current line ,count can be useed
|
||||
nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr>
|
||||
nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr>
|
||||
"]e or [e move current line ,count can be useed
|
||||
nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr>
|
||||
nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr>
|
||||
|
||||
"]<End> or ]<Home> move current line to the end or the begin of current buffer
|
||||
nnoremap <silent>]<End> ddGp``
|
||||
nnoremap <silent>]<Home> ddggP``
|
||||
vnoremap <silent>]<End> dGp``
|
||||
vnoremap <silent>]<Home> dggP``
|
||||
"]<End> or ]<Home> move current line to the end or the begin of current buffer
|
||||
nnoremap <silent>]<End> ddGp``
|
||||
nnoremap <silent>]<Home> ddggP``
|
||||
vnoremap <silent>]<End> dGp``
|
||||
vnoremap <silent>]<Home> dggP``
|
||||
|
||||
|
||||
"Ctrl+Shift+上下移动当前行
|
||||
nnoremap <silent><C-S-Down> :m .+1<CR>==
|
||||
nnoremap <silent><C-S-Up> :m .-2<CR>==
|
||||
inoremap <silent><C-S-Down> <Esc>:m .+1<CR>==gi
|
||||
inoremap <silent><C-S-Up> <Esc>:m .-2<CR>==gi
|
||||
"上下移动选中的行
|
||||
vnoremap <silent><C-S-Down> :m '>+1<CR>gv=gv
|
||||
vnoremap <silent><C-S-Up> :m '<-2<CR>gv=gv
|
||||
" download gvimfullscreen.dll from github, copy gvimfullscreen.dll to
|
||||
" the directory that has gvim.exe
|
||||
nnoremap <F11> :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<cr>
|
||||
"Ctrl+Shift+Up/Down to move up and down
|
||||
nnoremap <silent><C-S-Down> :m .+1<CR>==
|
||||
nnoremap <silent><C-S-Up> :m .-2<CR>==
|
||||
inoremap <silent><C-S-Down> <Esc>:m .+1<CR>==gi
|
||||
inoremap <silent><C-S-Up> <Esc>:m .-2<CR>==gi
|
||||
vnoremap <silent><C-S-Down> :m '>+1<CR>gv=gv
|
||||
vnoremap <silent><C-S-Up> :m '<-2<CR>gv=gv
|
||||
" download gvimfullscreen.dll from github, copy gvimfullscreen.dll to
|
||||
" the directory that has gvim.exe
|
||||
nnoremap <F11> :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<cr>
|
||||
|
||||
" Start new line
|
||||
inoremap <S-Return> <C-o>o
|
||||
" Start new line
|
||||
inoremap <S-Return> <C-o>o
|
||||
|
||||
" Improve scroll, credits: https://github.com/Shougo
|
||||
nnoremap <expr> zz (winline() == (winheight(0)+1) / 2) ?
|
||||
\ 'zt' : (winline() == 1) ? 'zb' : 'zz'
|
||||
noremap <expr> <C-f> max([winheight(0) - 2, 1])
|
||||
\ ."\<C-d>".(line('w$') >= line('$') ? "L" : "H")
|
||||
noremap <expr> <C-b> max([winheight(0) - 2, 1])
|
||||
\ ."\<C-u>".(line('w0') <= 1 ? "H" : "L")
|
||||
noremap <expr> <C-e> (line("w$") >= line('$') ? "j" : "3\<C-e>")
|
||||
noremap <expr> <C-y> (line("w0") <= 1 ? "k" : "3\<C-y>")
|
||||
" Improve scroll, credits: https://github.com/Shougo
|
||||
nnoremap <expr> zz (winline() == (winheight(0)+1) / 2) ?
|
||||
\ 'zt' : (winline() == 1) ? 'zb' : 'zz'
|
||||
noremap <expr> <C-f> max([winheight(0) - 2, 1])
|
||||
\ ."\<C-d>".(line('w$') >= line('$') ? "L" : "H")
|
||||
noremap <expr> <C-b> max([winheight(0) - 2, 1])
|
||||
\ ."\<C-u>".(line('w0') <= 1 ? "H" : "L")
|
||||
noremap <expr> <C-e> (line("w$") >= line('$') ? "j" : "3\<C-e>")
|
||||
noremap <expr> <C-y> (line("w0") <= 1 ? "k" : "3\<C-y>")
|
||||
|
||||
" Select blocks after indenting
|
||||
xnoremap < <gv
|
||||
xnoremap > >gv|
|
||||
" Select blocks after indenting
|
||||
xnoremap < <gv
|
||||
xnoremap > >gv|
|
||||
|
||||
" Use tab for indenting in visual mode
|
||||
xnoremap <Tab> >gv|
|
||||
xnoremap <S-Tab> <gv
|
||||
nnoremap > >>_
|
||||
nnoremap < <<_
|
||||
" Use tab for indenting in visual mode
|
||||
xnoremap <Tab> >gv|
|
||||
xnoremap <S-Tab> <gv
|
||||
nnoremap > >>_
|
||||
nnoremap < <<_
|
||||
|
||||
" smart up and down
|
||||
nnoremap <silent><Down> gj
|
||||
nnoremap <silent><Up> gk
|
||||
" smart up and down
|
||||
nnoremap <silent><Down> gj
|
||||
nnoremap <silent><Up> gk
|
||||
|
||||
" Select last paste
|
||||
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
|
||||
" Select last paste
|
||||
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
|
||||
|
||||
" Use Q format lines
|
||||
map Q gq
|
||||
" Use Q format lines
|
||||
map Q gq
|
||||
|
||||
" Navigate window
|
||||
nnoremap <silent><C-q> <C-w>
|
||||
nnoremap <silent><C-x> <C-w>x
|
||||
" Navigate window
|
||||
nnoremap <silent><C-q> <C-w>
|
||||
nnoremap <silent><C-x> <C-w>x
|
||||
|
||||
" Navigation in command line
|
||||
cnoremap <C-a> <Home>
|
||||
cnoremap <C-b> <Left>
|
||||
cnoremap <C-f> <Right>
|
||||
" Navigation in command line
|
||||
cnoremap <C-a> <Home>
|
||||
cnoremap <C-b> <Left>
|
||||
cnoremap <C-f> <Right>
|
||||
|
||||
|
||||
" Fast saving
|
||||
nnoremap <C-s> :<C-u>w<CR>
|
||||
vnoremap <C-s> :<C-u>w<CR>
|
||||
cnoremap <C-s> <C-u>w<CR>
|
||||
" Fast saving
|
||||
nnoremap <C-s> :<C-u>w<CR>
|
||||
vnoremap <C-s> :<C-u>w<CR>
|
||||
cnoremap <C-s> <C-u>w<CR>
|
||||
|
||||
" Tabs
|
||||
nnoremap <silent>g0 :<C-u>tabfirst<CR>
|
||||
nnoremap <silent>g$ :<C-u>tablast<CR>
|
||||
nnoremap <silent>gr :<C-u>tabprevious<CR>
|
||||
" Tabs
|
||||
nnoremap <silent>g0 :<C-u>tabfirst<CR>
|
||||
nnoremap <silent>g$ :<C-u>tablast<CR>
|
||||
nnoremap <silent>gr :<C-u>tabprevious<CR>
|
||||
|
||||
" Remove spaces at the end of lines
|
||||
nnoremap <silent> ,<Space> :<C-u>silent! keeppatterns %substitute/\s\+$//e<CR>
|
||||
" Remove spaces at the end of lines
|
||||
nnoremap <silent> ,<Space> :<C-u>silent! keeppatterns %substitute/\s\+$//e<CR>
|
||||
|
||||
" C-r: Easier search and replace
|
||||
xnoremap <C-r> :<C-u>call <SID>VSetSearch()<CR>:,$s/<C-R>=@/<CR>//gc<left><left><left>
|
||||
function! s:VSetSearch() abort
|
||||
let temp = @s
|
||||
norm! gv"sy
|
||||
let @/ = '\V' . substitute(escape(@s, '/\'), '\n', '\\n', 'g')
|
||||
let @s = temp
|
||||
endfunction
|
||||
" C-r: Easier search and replace
|
||||
xnoremap <C-r> :<C-u>call <SID>VSetSearch()<CR>:,$s/<C-R>=@/<CR>//gc<left><left><left>
|
||||
function! s:VSetSearch() abort
|
||||
let temp = @s
|
||||
norm! gv"sy
|
||||
let @/ = '\V' . substitute(escape(@s, '/\'), '\n', '\\n', 'g')
|
||||
let @s = temp
|
||||
endfunction
|
||||
|
||||
"irssi like hot key
|
||||
nnoremap <silent><M-1> :<C-u>call <SID>tobur(1)<CR>
|
||||
nnoremap <silent><M-2> :<C-u>call <SID>tobur(2)<CR>
|
||||
nnoremap <silent><M-3> :<C-u>call <SID>tobur(3)<CR>
|
||||
nnoremap <silent><M-4> :<C-u>call <SID>tobur(4)<CR>
|
||||
nnoremap <silent><M-5> :<C-u>call <SID>tobur(5)<CR>
|
||||
nnoremap <silent><M-Right> :<C-U>call <SID>tobur("bnext")<CR>
|
||||
nnoremap <silent><M-Left> :<C-U>call <SID>tobur("bprev")<CR>
|
||||
"irssi like hot key
|
||||
nnoremap <silent><M-1> :<C-u>call <SID>tobur(1)<CR>
|
||||
nnoremap <silent><M-2> :<C-u>call <SID>tobur(2)<CR>
|
||||
nnoremap <silent><M-3> :<C-u>call <SID>tobur(3)<CR>
|
||||
nnoremap <silent><M-4> :<C-u>call <SID>tobur(4)<CR>
|
||||
nnoremap <silent><M-5> :<C-u>call <SID>tobur(5)<CR>
|
||||
nnoremap <silent><M-Right> :<C-U>call <SID>tobur("bnext")<CR>
|
||||
nnoremap <silent><M-Left> :<C-U>call <SID>tobur("bprev")<CR>
|
||||
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-x>',':call chat#qq#OpenMsgWin()<cr>',
|
||||
\ 'Open qq chatting room','call chat#chatting#OpenMsgWin()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-w>',':call chat#weixin#OpenMsgWin()<cr>',
|
||||
\ 'Open weixin chatting room','call chat#chatting#OpenMsgWin()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-c>',':call chat#chatting#OpenMsgWin()<cr>',
|
||||
\ 'Open chatting room','call chat#chatting#OpenMsgWin()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-x>',':call chat#qq#OpenMsgWin()<cr>',
|
||||
\ 'Open qq chatting room','call chat#chatting#OpenMsgWin()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-w>',':call chat#weixin#OpenMsgWin()<cr>',
|
||||
\ 'Open weixin chatting room','call chat#chatting#OpenMsgWin()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','<M-c>',':call chat#chatting#OpenMsgWin()<cr>',
|
||||
\ 'Open chatting room','call chat#chatting#OpenMsgWin()')
|
||||
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','g=',':call zvim#format()<cr>','format current buffer','call zvim#format')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>','g=',':call zvim#format()<cr>','format current buffer','call zvim#format')
|
||||
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<C-c>', ':<c-u>call zvim#util#CopyToClipboard()<cr>',
|
||||
\ 'Copy buffer absolute path to X11 clipboard','call zvim#util#CopyToClipboard()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<Tab>', ':wincmd w<CR>', 'Switch to next window or tab','wincmd w')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<S-Tab>', ':wincmd p<CR>', 'Switch to previous window or tab','wincmd p')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'q', ':<C-u>call zvim#util#SmartClose()<cr>',
|
||||
\ 'Smart close windows',
|
||||
\ 'call zvim#util#SmartClose()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gf', ':call zvim#gf()<CR>', 'Jump to a file under cursor', '')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gd', ':call SpaceVim#mapping#gd()<CR>', 'Goto declaration', '')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<C-c>', ':<c-u>call zvim#util#CopyToClipboard()<cr>',
|
||||
\ 'Copy buffer absolute path to X11 clipboard','call zvim#util#CopyToClipboard()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<Tab>', ':wincmd w<CR>', 'Switch to next window or tab','wincmd w')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<S-Tab>', ':wincmd p<CR>', 'Switch to previous window or tab','wincmd p')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'q', ':<C-u>call zvim#util#SmartClose()<cr>',
|
||||
\ 'Smart close windows',
|
||||
\ 'call zvim#util#SmartClose()')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gf', ':call zvim#gf()<CR>', 'Jump to a file under cursor', '')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', 'gd', ':call SpaceVim#mapping#gd()<CR>', 'Goto declaration', '')
|
||||
endfunction
|
||||
|
||||
fu! s:tobur(num) abort
|
||||
if index(get(g:,'spacevim_altmoveignoreft',[]), &filetype) == -1
|
||||
if a:num ==# 'bnext'
|
||||
bnext
|
||||
elseif a:num ==# 'bprev'
|
||||
bprev
|
||||
else
|
||||
let ls = split(execute(':ls'), "\n")
|
||||
let buffers = []
|
||||
for b in ls
|
||||
let nr = matchstr(b, '\d\+')
|
||||
call add(buffers, nr)
|
||||
endfor
|
||||
if len(buffers) >= a:num
|
||||
exec 'buffer ' . buffers[a:num - 1]
|
||||
endif
|
||||
endif
|
||||
if index(get(g:,'spacevim_altmoveignoreft',[]), &filetype) == -1
|
||||
if a:num ==# 'bnext'
|
||||
bnext
|
||||
elseif a:num ==# 'bprev'
|
||||
bprev
|
||||
else
|
||||
let ls = split(execute(':ls'), "\n")
|
||||
let buffers = []
|
||||
for b in ls
|
||||
let nr = matchstr(b, '\d\+')
|
||||
call add(buffers, nr)
|
||||
endfor
|
||||
if len(buffers) >= a:num
|
||||
exec 'buffer ' . buffers[a:num - 1]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endf
|
||||
|
||||
function! SpaceVim#default#UseSimpleMode() abort
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,18 +1,20 @@
|
||||
function! SpaceVim#health#report() abort
|
||||
let items = map(SpaceVim#util#globpath(&rtp,'autoload/SpaceVim/health/*'), "fnamemodify(v:val,':t:r')")
|
||||
let report = []
|
||||
for item in items
|
||||
try
|
||||
let result = SpaceVim#health#{item}#check()
|
||||
call extend(report,result)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call extend(report,[
|
||||
\ '',
|
||||
\ 'SpaceVim Health Error:',
|
||||
\ ' There is no function: SpaceVim#health#' . item . '#check()',
|
||||
\ '',
|
||||
\ ])
|
||||
endtry
|
||||
endfor
|
||||
return join(report, "\n")
|
||||
let items = map(SpaceVim#util#globpath(&rtp,'autoload/SpaceVim/health/*'), "fnamemodify(v:val,':t:r')")
|
||||
let report = []
|
||||
for item in items
|
||||
try
|
||||
let result = SpaceVim#health#{item}#check()
|
||||
call extend(report,result)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
call extend(report,[
|
||||
\ '',
|
||||
\ 'SpaceVim Health Error:',
|
||||
\ ' There is no function: SpaceVim#health#' . item . '#check()',
|
||||
\ '',
|
||||
\ ])
|
||||
endtry
|
||||
endfor
|
||||
return join(report, "\n")
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,24 +1,26 @@
|
||||
function! SpaceVim#health#clipboard#check() abort
|
||||
let result = ['SpaceVim clipboard support check report:']
|
||||
call add(result, 'Checking +clipboard:')
|
||||
if has('nvim')
|
||||
if has('clipboard')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +clipboard, you need has one of following clipboard tools in your $PATH:')
|
||||
call add(result, ' 1. xclip')
|
||||
call add(result, ' 2. xsel')
|
||||
call add(result, ' 3. pbcopy/pbpaste (Mac OS X)')
|
||||
call add(result, ' 4. lemonade (for SSH) https://github.com/pocke/lemonade')
|
||||
call add(result, ' 5. doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/')
|
||||
endif
|
||||
let result = ['SpaceVim clipboard support check report:']
|
||||
call add(result, 'Checking +clipboard:')
|
||||
if has('nvim')
|
||||
if has('clipboard')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if has('clipboard')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +clipboard, you need recompile your vim with +clipboard support.')
|
||||
endif
|
||||
call add(result, ' Failed : to support +clipboard, you need has one of following clipboard tools in your $PATH:')
|
||||
call add(result, ' 1. xclip')
|
||||
call add(result, ' 2. xsel')
|
||||
call add(result, ' 3. pbcopy/pbpaste (Mac OS X)')
|
||||
call add(result, ' 4. lemonade (for SSH) https://github.com/pocke/lemonade')
|
||||
call add(result, ' 5. doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/')
|
||||
endif
|
||||
else
|
||||
if has('clipboard')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +clipboard, you need recompile your vim with +clipboard support.')
|
||||
endif
|
||||
endif
|
||||
|
||||
return result
|
||||
return result
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,18 +1,20 @@
|
||||
function! SpaceVim#health#lua#check() abort
|
||||
let result = ['SpaceVim lua support check report:']
|
||||
call add(result, 'Checking +lua:')
|
||||
if has('nvim')
|
||||
if has('lua')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : Known issue, neovim do not support lua now.')
|
||||
endif
|
||||
let result = ['SpaceVim lua support check report:']
|
||||
call add(result, 'Checking +lua:')
|
||||
if has('nvim')
|
||||
if has('lua')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if has('lua')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +lua, you need recompile your vim with +lua support.')
|
||||
endif
|
||||
call add(result, ' Failed : Known issue, neovim do not support lua now.')
|
||||
endif
|
||||
return result
|
||||
else
|
||||
if has('lua')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +lua, you need recompile your vim with +lua support.')
|
||||
endif
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,41 +1,43 @@
|
||||
function! SpaceVim#health#python#check() abort
|
||||
let result = ['SpaceVim python support check report:']
|
||||
if has('nvim')
|
||||
call add(result, 'Checking +python3:')
|
||||
if has('python3')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +python3, you need run `pip3 install neovim`')
|
||||
endif
|
||||
call add(result, 'Checking +python:')
|
||||
if has('python')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +python, you need run `pip2 install neovim`')
|
||||
endif
|
||||
let result = ['SpaceVim python support check report:']
|
||||
if has('nvim')
|
||||
call add(result, 'Checking +python3:')
|
||||
if has('python3')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, 'Checking +python3:')
|
||||
if has('python3')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if !WINDOWS()
|
||||
call add(result, ' Failed : to support +python3, Please install vim-gik, or build from sources.')
|
||||
else
|
||||
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
|
||||
call add(result, ' install python3, make sure you have `python` in your path.')
|
||||
endif
|
||||
endif
|
||||
call add(result, 'Checking +python:')
|
||||
if has('python')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if !WINDOWS()
|
||||
call add(result, ' Failed : to support +python, Please install vim-gik, or build from sources.')
|
||||
else
|
||||
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
|
||||
call add(result, ' install python3, make sure you have `python` in your path.')
|
||||
endif
|
||||
endif
|
||||
call add(result, ' Failed : to support +python3, you need run `pip3 install neovim`')
|
||||
endif
|
||||
return result
|
||||
call add(result, 'Checking +python:')
|
||||
if has('python')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
call add(result, ' Failed : to support +python, you need run `pip2 install neovim`')
|
||||
endif
|
||||
else
|
||||
call add(result, 'Checking +python3:')
|
||||
if has('python3')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if !WINDOWS()
|
||||
call add(result, ' Failed : to support +python3, Please install vim-gik, or build from sources.')
|
||||
else
|
||||
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
|
||||
call add(result, ' install python3, make sure you have `python` in your path.')
|
||||
endif
|
||||
endif
|
||||
call add(result, 'Checking +python:')
|
||||
if has('python')
|
||||
call add(result, ' SUCCEED!')
|
||||
else
|
||||
if !WINDOWS()
|
||||
call add(result, ' Failed : to support +python, Please install vim-gik, or build from sources.')
|
||||
else
|
||||
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
|
||||
call add(result, ' install python3, make sure you have `python` in your path.')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -6,7 +6,9 @@
|
||||
""
|
||||
" Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers).
|
||||
function! SpaceVim#layers#load(layer) abort
|
||||
if index(g:spacevim_plugin_groups, a:layer) == -1
|
||||
call add(g:spacevim_plugin_groups, a:layer)
|
||||
endif
|
||||
if index(g:spacevim_plugin_groups, a:layer) == -1
|
||||
call add(g:spacevim_plugin_groups, a:layer)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
0
autoload/SpaceVim/layers/core/banner.vim
Normal file
0
autoload/SpaceVim/layers/core/banner.vim
Normal file
41
autoload/SpaceVim/layers/core/statusline.vim
Normal file
41
autoload/SpaceVim/layers/core/statusline.vim
Normal file
@ -0,0 +1,41 @@
|
||||
let g:spacevim_statusline_mode_format = {
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'v' : 'VISUAL',
|
||||
\ }
|
||||
|
||||
"""""""""""""""""""""""""""""""""
|
||||
|
||||
function! s:mode() abort
|
||||
let mt = g:spacevim_statusline_mode_format
|
||||
let m = mode()
|
||||
return mt[m]
|
||||
endfunction
|
||||
|
||||
function! s:filetype() abort
|
||||
return &filetype
|
||||
endfunction
|
||||
|
||||
function! s:encoding() abort
|
||||
return &encoding
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:tabname() abort
|
||||
return '1'
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#get() abort
|
||||
return join([
|
||||
\ s:mode(),
|
||||
\ s:tabname(),
|
||||
\ s:encoding(),
|
||||
\ s:filetype()
|
||||
\ ], ' ')
|
||||
return s:mode() . s:tabname()
|
||||
endfunction
|
||||
|
||||
function! s:refresh() abort
|
||||
endfunction
|
||||
set statusline=%!SpaceVim#layers#core#statusline#get()
|
||||
|
59
autoload/SpaceVim/layers/core/tabline.vim
Normal file
59
autoload/SpaceVim/layers/core/tabline.vim
Normal file
@ -0,0 +1,59 @@
|
||||
"=============================================================================
|
||||
" tabline.vim --- core#tabline Layer file for SpaceVim
|
||||
" Copyright (c) 2012-2016 Shidong Wang & Contributors
|
||||
" Author: Shidong Wang < wsdjeg at 163.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: MIT license
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section core#tabline, layer-core-tabline
|
||||
" @parentsection layers
|
||||
" This layer provides default tabline for SpaceVim
|
||||
|
||||
let s:messletters = SpaceVim#api#import('messletters')
|
||||
let s:file = SpaceVim#api#import('file')
|
||||
|
||||
|
||||
function! s:tabname(id) abort
|
||||
let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
|
||||
let fn = fnamemodify(bufname(a:id), ':t')
|
||||
if g:spacevim_enable_tabline_filetype_icon
|
||||
let icon = s:file.fticon(fn)
|
||||
if !empty(icon)
|
||||
let fn = icon . ' ' . fn
|
||||
endif
|
||||
endif
|
||||
if empty(fn)
|
||||
return 'No Name'
|
||||
else
|
||||
return id . fn
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#get() abort
|
||||
let t = ' '
|
||||
let nr = tabpagenr()
|
||||
" if nr > 1
|
||||
for i in range(1, nr)
|
||||
let buflist = tabpagebuflist(i)
|
||||
let winnr = tabpagewinnr(i)
|
||||
let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
|
||||
let id = s:messletters.bubble_num(i, g:spacevim_buffer_index_type)
|
||||
let icon = s:file.fticon(name)
|
||||
if !empty(icon)
|
||||
let name = icon . ' ' . name
|
||||
endif
|
||||
let t .= id . ' ' . name
|
||||
if i == nr
|
||||
let t .= '%#TabLineSel#'
|
||||
else
|
||||
let t .= '%#TabLine# | '
|
||||
endif
|
||||
endfor
|
||||
let t .= '%#TabLineFill#%T'
|
||||
return t
|
||||
endfunction
|
||||
function! SpaceVim#layers#core#tabline#config() abort
|
||||
set tabline=%!SpaceVim#layers#core#tabline#get()
|
||||
endfunction
|
@ -13,80 +13,87 @@ let s:log_temp = []
|
||||
"
|
||||
" 3 : log error messages only
|
||||
function! SpaceVim#logger#setLevel(level) abort
|
||||
let s:logger_level = a:level
|
||||
let s:logger_level = a:level
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#logger#info(msg) abort
|
||||
if g:spacevim_enable_debug && s:logger_level <= 1
|
||||
call s:wite(s:warpMsg(a:msg, 1))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,1))
|
||||
endif
|
||||
if g:spacevim_enable_debug && s:logger_level <= 1
|
||||
call s:wite(s:warpMsg(a:msg, 1))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,1))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#logger#warn(msg) abort
|
||||
if g:spacevim_enable_debug && s:logger_level <= 2
|
||||
call s:wite(s:warpMsg(a:msg, 2))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,2))
|
||||
endif
|
||||
if g:spacevim_enable_debug && s:logger_level <= 2
|
||||
call s:wite(s:warpMsg(a:msg, 2))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,2))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#logger#error(msg) abort
|
||||
if g:spacevim_enable_debug && s:logger_level <= 3
|
||||
call s:wite(s:warpMsg(a:msg, 3))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,3))
|
||||
endif
|
||||
if g:spacevim_enable_debug && s:logger_level <= 3
|
||||
call s:wite(s:warpMsg(a:msg, 3))
|
||||
else
|
||||
call add(s:log_temp,s:warpMsg(a:msg,3))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:wite(msg) abort
|
||||
let flags = filewritable(s:logger_file) ? 'a' : ''
|
||||
call writefile([a:msg], s:logger_file, flags)
|
||||
let flags = filewritable(s:logger_file) ? 'a' : ''
|
||||
call writefile([a:msg], s:logger_file, flags)
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#logger#viewLog(...) abort
|
||||
let info = "### SpaceVim Options :\n\n"
|
||||
let info .= "```viml\n"
|
||||
let info .= join(SpaceVim#options#list(), "\n")
|
||||
let info .= "\n```\n"
|
||||
let info .= "\n\n"
|
||||
let info = "### SpaceVim Options :\n\n"
|
||||
let info .= "```viml\n"
|
||||
let info .= join(SpaceVim#options#list(), "\n")
|
||||
let info .= "\n```\n"
|
||||
let info .= "\n\n"
|
||||
|
||||
let info .= "### SpaceVim Health checking :\n\n"
|
||||
let info .= SpaceVim#health#report()
|
||||
let info .= "\n\n"
|
||||
let info .= "### SpaceVim Health checking :\n\n"
|
||||
let info .= SpaceVim#health#report()
|
||||
let info .= "\n\n"
|
||||
|
||||
let info .= "### SpaceVim runtime log :\n\n"
|
||||
let info .= "```log\n"
|
||||
let info .= "### SpaceVim runtime log :\n\n"
|
||||
let info .= "```log\n"
|
||||
|
||||
let l = a:0 > 0 ? a:1 : 1
|
||||
if filereadable(s:logger_file)
|
||||
let logs = readfile(s:logger_file, '')
|
||||
let info .= join(filter(logs, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n")
|
||||
else
|
||||
let info .= '[ SpaceVim ] : logger file ' . s:logger_file . ' does not exists, only log for current process will be shown!'
|
||||
let info .= join(filter(s:log_temp, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n")
|
||||
endif
|
||||
let info .= "\n```\n"
|
||||
return info
|
||||
let l = a:0 > 0 ? a:1 : 1
|
||||
if filereadable(s:logger_file)
|
||||
let logs = readfile(s:logger_file, '')
|
||||
let info .= join(filter(logs,
|
||||
\ "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \["
|
||||
\ . s:levels[l] . "\]'"), "\n")
|
||||
else
|
||||
let info .= '[ SpaceVim ] : logger file ' . s:logger_file
|
||||
\ . ' does not exists, only log for current process will be shown!'
|
||||
let info .= join(filter(s:log_temp,
|
||||
\ "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \["
|
||||
\ . s:levels[l] . "\]'"), "\n")
|
||||
endif
|
||||
let info .= "\n```\n"
|
||||
return info
|
||||
endfunction
|
||||
|
||||
""
|
||||
" @public
|
||||
" Set the log output file of SpaceVim. Default is `~/.SpaceVim/.SpaceVim.log`.
|
||||
function! SpaceVim#logger#setOutput(file) abort
|
||||
let s:logger_file = a:file
|
||||
let s:logger_file = a:file
|
||||
endfunction
|
||||
|
||||
function! s:warpMsg(msg,l) abort
|
||||
let time = strftime('%H:%M:%S')
|
||||
let log = '[ SpaceVim ] [' . time . '] [' . s:levels[a:l - 1] . '] ' . a:msg
|
||||
return log
|
||||
let time = strftime('%H:%M:%S')
|
||||
let log = '[ SpaceVim ] [' . time . '] [' . s:levels[a:l - 1] . '] ' . a:msg
|
||||
return log
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#logger#echoWarn(msg) abort
|
||||
echohl WarningMsg
|
||||
echom s:warpMsg(a:msg, 1)
|
||||
echohl None
|
||||
echohl WarningMsg
|
||||
echom s:warpMsg(a:msg, 1)
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,98 +1,100 @@
|
||||
scriptencoding utf-8
|
||||
let g:unite_source_menu_menus =
|
||||
\ get(g:,'unite_source_menu_menus',{})
|
||||
\ get(g:,'unite_source_menu_menus',{})
|
||||
let g:unite_source_menu_menus.CustomKeyMaps = {'description':
|
||||
\ 'Custom mapped keyboard shortcuts [unite]<SPACE>'}
|
||||
\ 'Custom mapped keyboard shortcuts [unite]<SPACE>'}
|
||||
let g:unite_source_menu_menus.CustomKeyMaps.command_candidates =
|
||||
\ get(g:unite_source_menu_menus.CustomKeyMaps,'command_candidates', [])
|
||||
\ get(g:unite_source_menu_menus.CustomKeyMaps,'command_candidates', [])
|
||||
|
||||
function! SpaceVim#mapping#def(type,key,value,desc,...) abort
|
||||
exec a:type . ' ' . a:key . ' ' . a:value
|
||||
let description = '➤ '
|
||||
\. a:desc
|
||||
\. repeat(' ', 80 - len(a:desc) - len(a:key))
|
||||
\. a:key
|
||||
let cmd = len(a:000) > 0 ? a:000[0] : a:value
|
||||
call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd])
|
||||
exec a:type . ' ' . a:key . ' ' . a:value
|
||||
let description = '➤ '
|
||||
\. a:desc
|
||||
\. repeat(' ', 80 - len(a:desc) - len(a:key))
|
||||
\. a:key
|
||||
let cmd = len(a:000) > 0 ? a:000[0] : a:value
|
||||
call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd])
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#tab() abort
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
endif
|
||||
if index(g:spacevim_plugin_groups, 'autocomplete') != -1
|
||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
return "\<Plug>(neosnippet_expand)"
|
||||
elseif neosnippet#jumpable()
|
||||
\ && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
\ && !neosnippet#expandable()
|
||||
return "\<plug>(neosnippet_jump)"
|
||||
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
|
||||
return "\<plug>(neosnippet_expand_or_jump)"
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<tab>"
|
||||
endif
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
endif
|
||||
if index(g:spacevim_plugin_groups, 'autocomplete') != -1
|
||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
return "\<Plug>(neosnippet_expand)"
|
||||
elseif neosnippet#jumpable()
|
||||
\ && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
\ && !neosnippet#expandable()
|
||||
return "\<plug>(neosnippet_jump)"
|
||||
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
|
||||
return "\<plug>(neosnippet_expand_or_jump)"
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<tab>"
|
||||
return "\<tab>"
|
||||
endif
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<tab>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#enter() abort
|
||||
if pumvisible()
|
||||
if getline('.')[col('.') - 2]==# '{'
|
||||
return "\<Enter>"
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
return "\<C-y>"
|
||||
else
|
||||
return "\<esc>a"
|
||||
endif
|
||||
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
||||
return "\<Enter>\<esc>ko"
|
||||
if pumvisible()
|
||||
if getline('.')[col('.') - 2]==# '{'
|
||||
return "\<Enter>"
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
return "\<C-y>"
|
||||
else
|
||||
return "\<Enter>"
|
||||
return "\<esc>a"
|
||||
endif
|
||||
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
||||
return "\<Enter>\<esc>ko"
|
||||
else
|
||||
return "\<Enter>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#gd() abort
|
||||
if !empty(SpaceVim#mapping#gd#get())
|
||||
call call(SpaceVim#mapping#gd#get(), [])
|
||||
else
|
||||
normal! gd
|
||||
endif
|
||||
if !empty(SpaceVim#mapping#gd#get())
|
||||
call call(SpaceVim#mapping#gd#get(), [])
|
||||
else
|
||||
normal! gd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#clearBuffers() abort
|
||||
for i in range(1,bufnr('$'))
|
||||
if i != bufnr('%')
|
||||
try
|
||||
exe 'bw ' . i
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
endfor
|
||||
for i in range(1,bufnr('$'))
|
||||
if i != bufnr('%')
|
||||
try
|
||||
exe 'bw ' . i
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#split_previous_buffer() abort
|
||||
if bufnr('#') == -1
|
||||
call SpaceVim#util#echoWarn('There is no previous buffer')
|
||||
else
|
||||
split
|
||||
wincmd w
|
||||
e#
|
||||
endif
|
||||
if bufnr('#') == -1
|
||||
call SpaceVim#util#echoWarn('There is no previous buffer')
|
||||
else
|
||||
split
|
||||
wincmd w
|
||||
e#
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#vertical_split_previous_buffer() abort
|
||||
if bufnr('#') == -1
|
||||
call SpaceVim#util#echoWarn('There is no previous buffer')
|
||||
else
|
||||
vsplit
|
||||
wincmd w
|
||||
e#
|
||||
endif
|
||||
if bufnr('#') == -1
|
||||
call SpaceVim#util#echoWarn('There is no previous buffer')
|
||||
else
|
||||
vsplit
|
||||
wincmd w
|
||||
e#
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,16 +1,16 @@
|
||||
function! SpaceVim#options#list() abort
|
||||
let list = []
|
||||
if has('patch-7.4.2010') && 0
|
||||
for var in getcompletion('g:spacevim_','var')
|
||||
call add(list, var . ' = ' . string(get(g:, var[2:] , '')))
|
||||
endfor
|
||||
else
|
||||
redraw
|
||||
for var in filter(map(s:execute('let g:'), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
|
||||
call add(list,'g:' . var . ' = ' . string(get(g:, var , '')))
|
||||
endfor
|
||||
endif
|
||||
return list
|
||||
let list = []
|
||||
if has('patch-7.4.2010') && 0
|
||||
for var in getcompletion('g:spacevim_','var')
|
||||
call add(list, var . ' = ' . string(get(g:, var[2:] , '')))
|
||||
endfor
|
||||
else
|
||||
redraw
|
||||
for var in filter(map(s:execute('let g:'), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
|
||||
call add(list,'g:' . var . ' = ' . string(get(g:, var , '')))
|
||||
endfor
|
||||
endif
|
||||
return list
|
||||
endfunction
|
||||
|
||||
function! s:execute(cmd) abort
|
||||
@ -23,3 +23,5 @@ function! s:execute(cmd) abort
|
||||
redir END
|
||||
return split(output, "\n")
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,64 +1,65 @@
|
||||
scriptencoding utf-8
|
||||
function! SpaceVim#plugins#load() abort
|
||||
if zvim#plug#enable_plug()
|
||||
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
|
||||
call zvim#plug#fetch()
|
||||
call s:load_plugins()
|
||||
call s:disable_plugins(g:spacevim_disabled_plugins)
|
||||
call zvim#plug#end()
|
||||
endif
|
||||
if zvim#plug#enable_plug()
|
||||
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
|
||||
call zvim#plug#fetch()
|
||||
call s:load_plugins()
|
||||
call s:disable_plugins(g:spacevim_disabled_plugins)
|
||||
call zvim#plug#end()
|
||||
endif
|
||||
|
||||
endfunction
|
||||
function! s:load_plugins() abort
|
||||
for group in g:spacevim_plugin_groups
|
||||
for plugin in s:getLayerPlugins(group)
|
||||
if len(plugin) == 2
|
||||
call zvim#plug#add(plugin[0], plugin[1])
|
||||
if zvim#plug#tap(split(plugin[0], '/')[-1]) && get(plugin[1], 'loadconf', 0 )
|
||||
call zvim#plug#defind_hooks(split(plugin[0], '/')[-1])
|
||||
if get(plugin[1], 'loadconf_before', 0 )
|
||||
call zvim#plug#loadPluginBefore(split(plugin[0], '/')[-1])
|
||||
endif
|
||||
endif
|
||||
else
|
||||
call zvim#plug#add(plugin[0])
|
||||
endif
|
||||
endfor
|
||||
call s:loadLayerConfig(group)
|
||||
endfor
|
||||
for plugin in g:spacevim_custom_plugins
|
||||
if len(plugin) == 2
|
||||
call zvim#plug#add(plugin[0], plugin[1])
|
||||
else
|
||||
call zvim#plug#add(plugin[0])
|
||||
for group in g:spacevim_plugin_groups
|
||||
for plugin in s:getLayerPlugins(group)
|
||||
if len(plugin) == 2
|
||||
call zvim#plug#add(plugin[0], plugin[1])
|
||||
if zvim#plug#tap(split(plugin[0], '/')[-1]) && get(plugin[1], 'loadconf', 0 )
|
||||
call zvim#plug#defind_hooks(split(plugin[0], '/')[-1])
|
||||
if get(plugin[1], 'loadconf_before', 0 )
|
||||
call zvim#plug#loadPluginBefore(split(plugin[0], '/')[-1])
|
||||
endif
|
||||
endif
|
||||
else
|
||||
call zvim#plug#add(plugin[0])
|
||||
endif
|
||||
endfor
|
||||
call s:loadLayerConfig(group)
|
||||
endfor
|
||||
for plugin in g:spacevim_custom_plugins
|
||||
if len(plugin) == 2
|
||||
call zvim#plug#add(plugin[0], plugin[1])
|
||||
else
|
||||
call zvim#plug#add(plugin[0])
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:getLayerPlugins(layer) abort
|
||||
let p = []
|
||||
try
|
||||
let p = SpaceVim#layers#{a:layer}#plugins()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
return p
|
||||
let p = []
|
||||
try
|
||||
let p = SpaceVim#layers#{a:layer}#plugins()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
return p
|
||||
endfunction
|
||||
|
||||
function! s:loadLayerConfig(layer) abort
|
||||
try
|
||||
call SpaceVim#layers#{a:layer}#config()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
try
|
||||
call SpaceVim#layers#{a:layer}#config()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:disable_plugins(plugin_list) abort
|
||||
for name in a:plugin_list
|
||||
call dein#disable(name)
|
||||
endfor
|
||||
for name in a:plugin_list
|
||||
call dein#disable(name)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#get(...) abort
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,13 +1,15 @@
|
||||
function! SpaceVim#util#globpath(path, expr) abort
|
||||
if has('patch-7.4.279')
|
||||
return globpath(a:path, a:expr, 1, 1)
|
||||
else
|
||||
return split(globpath(a:path, a:expr), '\n')
|
||||
endif
|
||||
if has('patch-7.4.279')
|
||||
return globpath(a:path, a:expr, 1, 1)
|
||||
else
|
||||
return split(globpath(a:path, a:expr), '\n')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#util#echoWarn(msg) abort
|
||||
echohl WarningMsg
|
||||
echo a:msg
|
||||
echohl None
|
||||
echohl WarningMsg
|
||||
echo a:msg
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,19 +1,22 @@
|
||||
" @vimlint(EVL103, 1, a:buffers)
|
||||
function! airline#extensions#tabline#formatters#spacevim#format(bufnr, buffers) abort
|
||||
let id = SpaceVim#api#messletters#get().bubble_num(a:bufnr, g:spacevim_buffer_index_type) . ' '
|
||||
let fn = fnamemodify(bufname(a:bufnr), ':t')
|
||||
if g:spacevim_enable_tabline_filetype_icon
|
||||
let icon = SpaceVim#api#import('file').fticon(fn)
|
||||
if !empty(icon)
|
||||
let fn = icon . ' ' . fn
|
||||
endif
|
||||
endif
|
||||
if empty(fn)
|
||||
return 'No Name'
|
||||
elseif !g:airline#extensions#tabline#buffer_idx_mode
|
||||
return id . fn
|
||||
else
|
||||
return fn
|
||||
let id = SpaceVim#api#messletters#get().bubble_num(a:bufnr, g:spacevim_buffer_index_type) . ' '
|
||||
let fn = fnamemodify(bufname(a:bufnr), ':t')
|
||||
if g:spacevim_enable_tabline_filetype_icon
|
||||
let icon = SpaceVim#api#import('file').fticon(fn)
|
||||
if !empty(icon)
|
||||
let fn = icon . ' ' . fn
|
||||
endif
|
||||
endif
|
||||
if empty(fn)
|
||||
return 'No Name'
|
||||
elseif !g:airline#extensions#tabline#buffer_idx_mode
|
||||
return id . fn
|
||||
else
|
||||
return fn
|
||||
endif
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:buffers)
|
||||
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -5,134 +5,134 @@ scriptencoding utf-8
|
||||
let s:fish = &shell =~# 'fish'
|
||||
|
||||
function! vimfiler#columns#gitstatus#define() abort
|
||||
return s:column
|
||||
return s:column
|
||||
endfunction"}}}
|
||||
|
||||
let s:column = {
|
||||
\ 'name' : 'gitstatus',
|
||||
\ 'description' : 'plugin for vimfiler that provides git status support',
|
||||
\ 'syntax' : 'vimfilerColumn__Git',
|
||||
\ }
|
||||
\ 'name' : 'gitstatus',
|
||||
\ 'description' : 'plugin for vimfiler that provides git status support',
|
||||
\ 'syntax' : 'vimfilerColumn__Git',
|
||||
\ }
|
||||
|
||||
" @vimlint(EVL103, 1, a:files)
|
||||
" @vimlint(EVL103, 1, a:context)
|
||||
function! s:column.length(files, context) abort
|
||||
return 3
|
||||
return 3
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:files)
|
||||
" @vimlint(EVL103, 0, a:context)
|
||||
|
||||
if !exists('g:VimFilerGitIndicatorMap')
|
||||
let g:VimFilerGitIndicatorMap = {
|
||||
\ 'Modified' : '✹',
|
||||
\ 'Staged' : '✚',
|
||||
\ 'Untracked' : '✭',
|
||||
\ 'Renamed' : '➜',
|
||||
\ 'Unmerged' : '═',
|
||||
\ 'Deleted' : '✖',
|
||||
\ 'Dirty' : '✗',
|
||||
\ 'Clean' : '✔︎',
|
||||
\ 'Ignored' : '☒',
|
||||
\ 'Unknown' : '?'
|
||||
\ }
|
||||
let g:VimFilerGitIndicatorMap = {
|
||||
\ 'Modified' : '✹',
|
||||
\ 'Staged' : '✚',
|
||||
\ 'Untracked' : '✭',
|
||||
\ 'Renamed' : '➜',
|
||||
\ 'Unmerged' : '═',
|
||||
\ 'Deleted' : '✖',
|
||||
\ 'Dirty' : '✗',
|
||||
\ 'Clean' : '✔︎',
|
||||
\ 'Ignored' : '☒',
|
||||
\ 'Unknown' : '?'
|
||||
\ }
|
||||
endif
|
||||
|
||||
" @vimlint(EVL103, 1, a:context)
|
||||
function! s:column.define_syntax(context) abort
|
||||
for name in keys(g:VimFilerGitIndicatorMap)
|
||||
exe 'syntax match vimfilerColumn__Git' . name
|
||||
\ . " '\[" . g:VimFilerGitIndicatorMap[name]
|
||||
\ . "\]' contained containedin=vimfilerColumn__Git"
|
||||
endfor
|
||||
highlight def link vimfilerColumn__GitModified Special
|
||||
highlight def link vimfilerColumn__GitStaged Function
|
||||
highlight def link vimfilerColumn__GitUnstaged Text
|
||||
highlight def link vimfilerColumn__GitRenamed Title
|
||||
highlight def link vimfilerColumn__GitUnmerged Label
|
||||
highlight def link vimfilerColumn__GitDeleted Text
|
||||
highlight def link vimfilerColumn__GitDirty Tag
|
||||
highlight def link vimfilerColumn__GitClean DiffAdd
|
||||
highlight def link vimfilerColumn__GitUnknown Text
|
||||
for name in keys(g:VimFilerGitIndicatorMap)
|
||||
exe 'syntax match vimfilerColumn__Git' . name
|
||||
\ . " '\[" . g:VimFilerGitIndicatorMap[name]
|
||||
\ . "\]' contained containedin=vimfilerColumn__Git"
|
||||
endfor
|
||||
highlight def link vimfilerColumn__GitModified Special
|
||||
highlight def link vimfilerColumn__GitStaged Function
|
||||
highlight def link vimfilerColumn__GitUnstaged Text
|
||||
highlight def link vimfilerColumn__GitRenamed Title
|
||||
highlight def link vimfilerColumn__GitUnmerged Label
|
||||
highlight def link vimfilerColumn__GitDeleted Text
|
||||
highlight def link vimfilerColumn__GitDirty Tag
|
||||
highlight def link vimfilerColumn__GitClean DiffAdd
|
||||
highlight def link vimfilerColumn__GitUnknown Text
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:context)
|
||||
|
||||
function! s:directory_of_file(file) abort
|
||||
return fnamemodify(a:file, ':h')
|
||||
return fnamemodify(a:file, ':h')
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:system(cmd, ...) abort
|
||||
silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1)
|
||||
return output
|
||||
silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1)
|
||||
return output
|
||||
endfunction
|
||||
|
||||
function! s:git_shellescape(arg) abort
|
||||
if a:arg =~# '^[A-Za-z0-9_/.-]\+$'
|
||||
return a:arg
|
||||
elseif &shell =~# 'cmd' || gitgutter#utility#using_xolox_shell()
|
||||
return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"'
|
||||
else
|
||||
return shellescape(a:arg)
|
||||
endif
|
||||
if a:arg =~# '^[A-Za-z0-9_/.-]\+$'
|
||||
return a:arg
|
||||
elseif &shell =~# 'cmd' || gitgutter#utility#using_xolox_shell()
|
||||
return '"' . substitute(substitute(a:arg, '"', '""', 'g'), '%', '"%"', 'g') . '"'
|
||||
else
|
||||
return shellescape(a:arg)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:cmd_in_directory_of_file(file, cmd) abort
|
||||
return 'cd '.s:git_shellescape(s:directory_of_file(a:file)) . (s:fish ? '; and ' : ' && ') . a:cmd
|
||||
return 'cd '.s:git_shellescape(s:directory_of_file(a:file)) . (s:fish ? '; and ' : ' && ') . a:cmd
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
function! s:git_state_to_name(symb) abort
|
||||
if a:symb ==# '?'
|
||||
return 'Untracked'
|
||||
elseif a:symb ==# ' '
|
||||
return 'Modified'
|
||||
elseif a:symb =~# '[MAC]'
|
||||
return 'Staged'
|
||||
elseif a:symb ==# 'R'
|
||||
return 'Renamed'
|
||||
elseif a:symb ==# 'U' || a:symb ==# 'A' || a:symb ==# 'D'
|
||||
return 'Unmerged'
|
||||
elseif a:symb ==# '!'
|
||||
return 'Ignored'
|
||||
else
|
||||
return 'Unknown'
|
||||
endif
|
||||
if a:symb ==# '?'
|
||||
return 'Untracked'
|
||||
elseif a:symb ==# ' '
|
||||
return 'Modified'
|
||||
elseif a:symb =~# '[MAC]'
|
||||
return 'Staged'
|
||||
elseif a:symb ==# 'R'
|
||||
return 'Renamed'
|
||||
elseif a:symb ==# 'U' || a:symb ==# 'A' || a:symb ==# 'D'
|
||||
return 'Unmerged'
|
||||
elseif a:symb ==# '!'
|
||||
return 'Ignored'
|
||||
else
|
||||
return 'Unknown'
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:git_state_to_symbol(s) abort
|
||||
let name = s:git_state_to_name(a:s)
|
||||
return g:VimFilerGitIndicatorMap[name]
|
||||
let name = s:git_state_to_name(a:s)
|
||||
return g:VimFilerGitIndicatorMap[name]
|
||||
endfunction
|
||||
|
||||
let g:wsd = []
|
||||
|
||||
" @vimlint(EVL103, 1, a:context)
|
||||
function! s:column.get(file, context) abort
|
||||
let cmd = 'git -c color.status=false status -s ' . fnamemodify(a:file.action__path, ':.')
|
||||
let output = systemlist(cmd)
|
||||
if v:shell_error
|
||||
return ' '
|
||||
endif
|
||||
if a:file.vimfiler__is_directory
|
||||
if !empty(output)
|
||||
return '[' . g:VimFilerGitIndicatorMap['Dirty'] . ']'
|
||||
else
|
||||
return ' '
|
||||
endif
|
||||
let cmd = 'git -c color.status=false status -s ' . fnamemodify(a:file.action__path, ':.')
|
||||
let output = systemlist(cmd)
|
||||
if v:shell_error
|
||||
return ' '
|
||||
endif
|
||||
if a:file.vimfiler__is_directory
|
||||
if !empty(output)
|
||||
return '[' . g:VimFilerGitIndicatorMap['Dirty'] . ']'
|
||||
else
|
||||
if !empty(output)
|
||||
let symb = split(output[0])[0]
|
||||
return '[' . g:VimFilerGitIndicatorMap[s:git_state_to_name(symb)] . ']'
|
||||
else
|
||||
return ' '
|
||||
endif
|
||||
return ' '
|
||||
endif
|
||||
else
|
||||
if !empty(output)
|
||||
let symb = split(output[0])[0]
|
||||
return '[' . g:VimFilerGitIndicatorMap[s:git_state_to_name(symb)] . ']'
|
||||
else
|
||||
return ' '
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:context)
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,40 +1,40 @@
|
||||
function! zvim#tab() abort
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
endif
|
||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
return "\<Plug>(neosnippet_expand)"
|
||||
elseif neosnippet#jumpable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() && !neosnippet#expandable()
|
||||
return "\<plug>(neosnippet_jump)"
|
||||
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
|
||||
return "\<plug>(neosnippet_expand_or_jump)"
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<tab>"
|
||||
endif
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
endif
|
||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||
return "\<Plug>(neosnippet_expand)"
|
||||
elseif neosnippet#jumpable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() && !neosnippet#expandable()
|
||||
return "\<plug>(neosnippet_jump)"
|
||||
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
|
||||
return "\<plug>(neosnippet_expand_or_jump)"
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<tab>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zvim#enter() abort
|
||||
if pumvisible()
|
||||
if getline('.')[col('.') - 2]==# '{'
|
||||
return "\<Enter>"
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
return "\<C-y>"
|
||||
else
|
||||
return "\<esc>a"
|
||||
endif
|
||||
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
||||
return "\<Enter>\<esc>ko"
|
||||
if pumvisible()
|
||||
if getline('.')[col('.') - 2]==# '{'
|
||||
return "\<Enter>"
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
return "\<C-y>"
|
||||
else
|
||||
return "\<Enter>"
|
||||
return "\<esc>a"
|
||||
endif
|
||||
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
||||
return "\<Enter>\<esc>ko"
|
||||
else
|
||||
return "\<Enter>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zvim#format() abort
|
||||
let save_cursor = getcurpos()
|
||||
normal! gg=G
|
||||
call setpos('.', save_cursor)
|
||||
let save_cursor = getcurpos()
|
||||
normal! gg=G
|
||||
call setpos('.', save_cursor)
|
||||
endfunction
|
||||
|
||||
function! zvim#gf() abort
|
||||
@ -58,10 +58,10 @@ function! zvim#gf() abort
|
||||
endfor
|
||||
endif
|
||||
if !empty(path)
|
||||
let line = s:search_line(path, matchstr(line[start :], '\k\+'))
|
||||
let col = start
|
||||
exe 'e ' . path
|
||||
call cursor(line, col)
|
||||
let line = s:search_line(path, matchstr(line[start :], '\k\+'))
|
||||
let col = start
|
||||
exe 'e ' . path
|
||||
call cursor(line, col)
|
||||
endif
|
||||
finally
|
||||
let &l:iskeyword = isk
|
||||
@ -105,3 +105,5 @@ function! s:search_line(path, term) abort "{{{
|
||||
endif
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -12,15 +12,15 @@ let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
|
||||
"let g:ctrlp_open_multiple_files = 'v'
|
||||
"if you have install ag, the g:ctrlp_custom_ignore will not work
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\v[\/]\.(git|hg|svn)$|target',
|
||||
\ 'file': '\v\.(exe|so|dll|ttf|png)$|\-rplugin\~',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
\ 'dir': '\v[\/]\.(git|hg|svn)$|target',
|
||||
\ 'file': '\v\.(exe|so|dll|ttf|png)$|\-rplugin\~',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
if executable('rg')
|
||||
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
|
||||
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg'))
|
||||
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
|
||||
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg'))
|
||||
elseif executable('ag')
|
||||
let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag'))
|
||||
let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag'))
|
||||
endif
|
||||
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
|
||||
"nnoremap <Leader>kk :CtrlPMixed<Cr>
|
||||
@ -48,7 +48,9 @@ nnoremap <Leader>pl :<c-u>CtrlPLauncher<cr>
|
||||
""}}}
|
||||
|
||||
augroup Fix_command_in_help_buffer
|
||||
au!
|
||||
autocmd FileType help exec 'nnoremap <buffer><silent><c-p> :<c-u>CtrlP ' . getcwd() .'<cr>'
|
||||
au FileType help exec "nnoremap <silent><buffer> q :q<CR>"
|
||||
au!
|
||||
autocmd FileType help exec 'nnoremap <buffer><silent><c-p> :<c-u>CtrlP ' . getcwd() .'<cr>'
|
||||
au FileType help exec "nnoremap <silent><buffer> q :q<CR>"
|
||||
augroup END
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,4 +1,6 @@
|
||||
let g:deoplete#sources#clang#libclang_path =
|
||||
\ get(g:, 'deoplete#sources#clang#libclang_path', '/usr/lib/libclang.so')
|
||||
\ get(g:, 'deoplete#sources#clang#libclang_path', '/usr/lib/libclang.so')
|
||||
let g:deoplete#sources#clang#clang_header =
|
||||
\ get(g:, 'deoplete#sources#clang#clang_header', '/usr/lib/clang/')
|
||||
\ get(g:, 'deoplete#sources#clang#clang_header', '/usr/lib/clang/')
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -13,17 +13,17 @@ let g:deoplete#omni_patterns = get(g:, 'deoplete#omni_patterns', {})
|
||||
|
||||
" java && jsp
|
||||
let g:deoplete#omni#input_patterns.java = [
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
let g:deoplete#omni#input_patterns.jsp = ['[^. \t0-9]\.\w*']
|
||||
if g:spacevim_enable_javacomplete2_py
|
||||
let g:deoplete#ignore_sources.java = ['omni']
|
||||
call deoplete#custom#set('javacomplete2', 'mark', '')
|
||||
let g:deoplete#ignore_sources.java = ['omni']
|
||||
call deoplete#custom#set('javacomplete2', 'mark', '')
|
||||
else
|
||||
let g:deoplete#ignore_sources.java = ['javacomplete2']
|
||||
call deoplete#custom#set('omni', 'mark', '')
|
||||
let g:deoplete#ignore_sources.java = ['javacomplete2']
|
||||
call deoplete#custom#set('omni', 'mark', '')
|
||||
endif
|
||||
|
||||
" go
|
||||
@ -33,20 +33,20 @@ call deoplete#custom#set('go', 'rank', 9999)
|
||||
|
||||
" perl
|
||||
let g:deoplete#omni#input_patterns.perl = [
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
|
||||
" javascript
|
||||
let g:deoplete#omni#input_patterns.javascript = ['[^. \t0-9]\.\w*']
|
||||
|
||||
" php
|
||||
let g:deoplete#omni#input_patterns.php = [
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
\'[^. \t0-9]\.\w*',
|
||||
\'[^. \t0-9]\->\w*',
|
||||
\'[^. \t0-9]\::\w*',
|
||||
\]
|
||||
let g:deoplete#ignore_sources.php = ['omni', 'around', 'member']
|
||||
call deoplete#custom#set('phpcd', 'mark', '')
|
||||
call deoplete#custom#set('phpcd', 'input_pattern', '\w*|[^. \t]->\w*|\w*::\w*')
|
||||
@ -68,3 +68,5 @@ let g:deoplete#ignore_sources._ = ['around']
|
||||
inoremap <expr><C-h> deoplete#mappings#smart_close_popup()."\<C-h>"
|
||||
inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>"
|
||||
set isfname-==
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,26 +1,28 @@
|
||||
let s:save_option = {}
|
||||
function! s:goyo_enter()
|
||||
let s:save_option['showmode'] = &showmode
|
||||
let s:save_option['showcmd'] = &showcmd
|
||||
let s:save_option['scrolloff'] = &scrolloff
|
||||
set noshowmode
|
||||
set noshowcmd
|
||||
set scrolloff=999
|
||||
if exists(':Limelight') == 2
|
||||
Limelight
|
||||
let s:save_option['limelight'] = 1
|
||||
endif
|
||||
let s:save_option['showmode'] = &showmode
|
||||
let s:save_option['showcmd'] = &showcmd
|
||||
let s:save_option['scrolloff'] = &scrolloff
|
||||
set noshowmode
|
||||
set noshowcmd
|
||||
set scrolloff=999
|
||||
if exists(':Limelight') == 2
|
||||
Limelight
|
||||
let s:save_option['limelight'] = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:goyo_leave()
|
||||
let &showmode = s:save_option['showmode']
|
||||
let &showcmd = s:save_option['showcmd']
|
||||
let &scrolloff = s:save_option['scrolloff']
|
||||
if get(s:save_option,'limelight', 0)
|
||||
execute 'Limelight!'
|
||||
endif
|
||||
let &showmode = s:save_option['showmode']
|
||||
let &showcmd = s:save_option['showcmd']
|
||||
let &scrolloff = s:save_option['scrolloff']
|
||||
if get(s:save_option,'limelight', 0)
|
||||
execute 'Limelight!'
|
||||
endif
|
||||
endfunction
|
||||
augroup goyo_map
|
||||
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
||||
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
||||
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
||||
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
||||
augroup END
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,19 +1,21 @@
|
||||
let g:java_getset_disable_map = 1
|
||||
let g:javagetset_setterTemplate =
|
||||
\ "/**\n" .
|
||||
\ " * Set %varname%.\n" .
|
||||
\ " *\n" .
|
||||
\ " * @param %varname% the value to set.\n" .
|
||||
\ " */\n" .
|
||||
\ "%modifiers% void %funcname%(%type% %varname%){\n" .
|
||||
\ " this.%varname% = %varname%;\n" .
|
||||
\ "}"
|
||||
\ "/**\n" .
|
||||
\ " * Set %varname%.\n" .
|
||||
\ " *\n" .
|
||||
\ " * @param %varname% the value to set.\n" .
|
||||
\ " */\n" .
|
||||
\ "%modifiers% void %funcname%(%type% %varname%){\n" .
|
||||
\ " this.%varname% = %varname%;\n" .
|
||||
\ "}"
|
||||
let g:javagetset_getterTemplate =
|
||||
\ "/**\n" .
|
||||
\ " * Get %varname%.\n" .
|
||||
\ " *\n" .
|
||||
\ " * @return %varname% as %type%.\n" .
|
||||
\ " */\n" .
|
||||
\ "%modifiers% %type% %funcname%(){\n" .
|
||||
\ " return %varname%;\n" .
|
||||
\ "}"
|
||||
\ "/**\n" .
|
||||
\ " * Get %varname%.\n" .
|
||||
\ " *\n" .
|
||||
\ " * @return %varname% as %type%.\n" .
|
||||
\ " */\n" .
|
||||
\ "%modifiers% %type% %funcname%(){\n" .
|
||||
\ " return %varname%;\n" .
|
||||
\ "}"
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -32,18 +32,18 @@ let g:neocomplcache_enable_auto_select = 0
|
||||
|
||||
let g:neocomplcache_enable_auto_delimiter = 1
|
||||
let g:neocomplcache_disable_auto_select_buffer_name_pattern =
|
||||
\ '\[Command Line\]'
|
||||
\ '\[Command Line\]'
|
||||
"let g:neocomplcache_disable_auto_complete = 0
|
||||
let g:neocomplcache_max_list = 100
|
||||
let g:neocomplcache_force_overwrite_completefunc = 1
|
||||
if !exists('g:neocomplcache_omni_patterns')
|
||||
let g:neocomplcache_omni_patterns = {}
|
||||
let g:neocomplcache_omni_patterns = {}
|
||||
endif
|
||||
if !exists('g:neocomplcache_omni_functions')
|
||||
let g:neocomplcache_omni_functions = {}
|
||||
let g:neocomplcache_omni_functions = {}
|
||||
endif
|
||||
if !exists('g:neocomplcache_force_omni_patterns')
|
||||
let g:neocomplcache_force_omni_patterns = {}
|
||||
let g:neocomplcache_force_omni_patterns = {}
|
||||
endif
|
||||
let g:neocomplcache_enable_auto_close_preview = 1
|
||||
" let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
|
||||
@ -54,31 +54,33 @@ let g:neocomplcache_force_omni_patterns.java = '[^. *\t]\.\w*\|\h\w*::'
|
||||
" For clang_complete.
|
||||
let g:neocomplcache_force_overwrite_completefunc = 1
|
||||
let g:neocomplcache_force_omni_patterns.c =
|
||||
\ '[^.[:digit:] *\t]\%(\.\|->\)'
|
||||
\ '[^.[:digit:] *\t]\%(\.\|->\)'
|
||||
let g:neocomplcache_force_omni_patterns.cpp =
|
||||
\ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
|
||||
\ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
|
||||
let g:clang_complete_auto = 0
|
||||
let g:clang_auto_select = 0
|
||||
let g:clang_use_library = 1
|
||||
|
||||
" Define keyword pattern.
|
||||
if !exists('g:neocomplcache_keyword_patterns')
|
||||
let g:neocomplcache_keyword_patterns = {}
|
||||
let g:neocomplcache_keyword_patterns = {}
|
||||
endif
|
||||
let g:neocomplcache_keyword_patterns['default'] = '[0-9a-zA-Z:#_]\+'
|
||||
let g:neocomplcache_keyword_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
|
||||
let g:neocomplete#enable_multibyte_completion = 1
|
||||
|
||||
let g:neocomplcache_vim_completefuncs = {
|
||||
\ 'Ref' : 'ref#complete',
|
||||
\ 'Unite' : 'unite#complete_source',
|
||||
\ 'VimShellExecute' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShellInteractive' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShellTerminal' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShell' : 'vimshell#complete',
|
||||
\ 'VimFiler' : 'vimfiler#complete',
|
||||
\ 'Vinarise' : 'vinarise#complete',
|
||||
\}
|
||||
\ 'Ref' : 'ref#complete',
|
||||
\ 'Unite' : 'unite#complete_source',
|
||||
\ 'VimShellExecute' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShellInteractive' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShellTerminal' :
|
||||
\ 'vimshell#vimshell_execute_complete',
|
||||
\ 'VimShell' : 'vimshell#complete',
|
||||
\ 'VimFiler' : 'vimfiler#complete',
|
||||
\ 'Vinarise' : 'vinarise#complete',
|
||||
\}
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -12,18 +12,18 @@ let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
|
||||
|
||||
" Define dictionary.
|
||||
let g:neocomplete#sources#dictionary#dictionaries = {
|
||||
\ 'default' : '',
|
||||
\ 'vimshell' : $CACHE.'/vimshell/command-history',
|
||||
\ 'java' : '~/.vim/dict/java.dict',
|
||||
\ 'ruby' : '~/.vim/dict/ruby.dict',
|
||||
\ 'scala' : '~/.vim/dict/scala.dict',
|
||||
\ }
|
||||
\ 'default' : '',
|
||||
\ 'vimshell' : $CACHE.'/vimshell/command-history',
|
||||
\ 'java' : '~/.vim/dict/java.dict',
|
||||
\ 'ruby' : '~/.vim/dict/ruby.dict',
|
||||
\ 'scala' : '~/.vim/dict/scala.dict',
|
||||
\ }
|
||||
|
||||
let g:neocomplete#enable_auto_delimiter = 1
|
||||
|
||||
" Define keyword.
|
||||
if !exists('g:neocomplete#keyword_patterns')
|
||||
let g:neocomplete#keyword_patterns = {}
|
||||
let g:neocomplete#keyword_patterns = {}
|
||||
endif
|
||||
let g:neocomplete#keyword_patterns._ = '\h\k*(\?'
|
||||
|
||||
@ -32,7 +32,7 @@ let g:neocomplete#keyword_patterns._ = '\h\k*(\?'
|
||||
let g:neocomplete#enable_auto_select = 0
|
||||
|
||||
if !exists('g:neocomplete#sources#omni#input_patterns')
|
||||
let g:neocomplete#sources#omni#input_patterns = {}
|
||||
let g:neocomplete#sources#omni#input_patterns = {}
|
||||
endif
|
||||
|
||||
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
|
||||
@ -45,3 +45,5 @@ inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
|
||||
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
|
||||
inoremap <expr><C-y> neocomplete#close_popup()
|
||||
inoremap <expr><C-e> neocomplete#cancel_popup()
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -3,10 +3,11 @@ let g:neomake_open_list = 2 " 1 open list and move cursor 2 open list without m
|
||||
let g:neomake_verbose = 0
|
||||
let g:neomake_java_javac_delete_output = 0
|
||||
let g:neomake_error_sign = {
|
||||
\ 'text': get(g:, 'spacevim_error_symbol', '✖'),
|
||||
\ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxRedSign' : 'error'),
|
||||
\ }
|
||||
\ 'text': get(g:, 'spacevim_error_symbol', '✖'),
|
||||
\ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxRedSign' : 'error'),
|
||||
\ }
|
||||
let g:neomake_warning_sign = {
|
||||
\ 'text': get(g:,'spacevim_warning_symbol', '➤'),
|
||||
\ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxYellowSign' : 'todo'),
|
||||
\ }
|
||||
\ 'text': get(g:,'spacevim_warning_symbol', '➤'),
|
||||
\ 'texthl': (g:spacevim_colorscheme ==# 'gruvbox' ? 'GruvboxYellowSign' : 'todo'),
|
||||
\ }
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,33 +1,35 @@
|
||||
let g:neosnippet#snippets_directory = get(g:,'neosnippet#snippets_directory', '')
|
||||
if empty(g:neosnippet#snippets_directory)
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')]
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')]
|
||||
elseif type(g:spacevim_force_global_config) == type('')
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + [g:neosnippet#snippets_directory]
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + [g:neosnippet#snippets_directory]
|
||||
elseif type(g:spacevim_force_global_config) == type([])
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + g:neosnippet#snippets_directory
|
||||
let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + g:neosnippet#snippets_directory
|
||||
endif
|
||||
|
||||
if g:spacevim_force_global_config == 0
|
||||
let g:neosnippet#snippets_directory = [getcwd() . '/.Spacevim.d/snippets'] + g:neosnippet#snippets_directory
|
||||
let g:neosnippet#snippets_directory = [getcwd() . '/.Spacevim.d/snippets'] + g:neosnippet#snippets_directory
|
||||
endif
|
||||
let g:neosnippet#enable_snipmate_compatibility=1
|
||||
let g:neosnippet#enable_complete_done = 1
|
||||
let g:neosnippet#completed_pairs= {}
|
||||
let g:neosnippet#completed_pairs.java = {'(' : ')'}
|
||||
if g:neosnippet#enable_complete_done
|
||||
let g:neopairs#enable = 0
|
||||
let g:neopairs#enable = 0
|
||||
endif
|
||||
augroup neosnippet_complete_done
|
||||
autocmd!
|
||||
autocmd CompleteDone * call s:my_complete_done()
|
||||
autocmd!
|
||||
autocmd CompleteDone * call s:my_complete_done()
|
||||
augroup END
|
||||
function! s:my_complete_done() abort "{{{
|
||||
if !empty(get(v:,'completed_item',''))
|
||||
let snippet = neosnippet#parser#_get_completed_snippet(v:completed_item,neosnippet#util#get_cur_text(), neosnippet#util#get_next_text())
|
||||
if snippet ==# ''
|
||||
return
|
||||
endif
|
||||
let [cur_text, col] = neosnippet#mappings#_pre_trigger()[0:1]
|
||||
call neosnippet#view#_insert(snippet, {}, cur_text, col)
|
||||
if !empty(get(v:,'completed_item',''))
|
||||
let snippet = neosnippet#parser#_get_completed_snippet(v:completed_item,neosnippet#util#get_cur_text(), neosnippet#util#get_next_text())
|
||||
if snippet ==# ''
|
||||
return
|
||||
endif
|
||||
let [cur_text, col] = neosnippet#mappings#_pre_trigger()[0:1]
|
||||
call neosnippet#view#_insert(snippet, {}, cur_text, col)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,6 +1,6 @@
|
||||
scriptencoding utf-8
|
||||
if !filereadable('pom.xml') && !filereadable('build.gradle') && isdirectory('bin')
|
||||
let g:syntastic_java_javac_options = '-d bin'
|
||||
let g:syntastic_java_javac_options = '-d bin'
|
||||
endif
|
||||
let g:syntastic_java_javac_config_file_enabled = 1
|
||||
let g:syntastic_java_javac_delete_output = 0
|
||||
@ -11,8 +11,10 @@ let g:syntastic_check_on_wq = 0
|
||||
let g:syntastic_error_symbol = get(g:, 'spacevim_error_symbol', '✖')
|
||||
let g:syntastic_warning_symbol = get(g:, 'spacevim_warning_symbol', '➤')
|
||||
let g:syntastic_vimlint_options = {
|
||||
\'EVL102': 1 ,
|
||||
\'EVL103': 1 ,
|
||||
\'EVL205': 1 ,
|
||||
\'EVL105': 1 ,
|
||||
\}
|
||||
\'EVL102': 1 ,
|
||||
\'EVL103': 1 ,
|
||||
\'EVL205': 1 ,
|
||||
\'EVL105': 1 ,
|
||||
\}
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,6 +1,6 @@
|
||||
scriptencoding utf-8
|
||||
if !executable('ctags')
|
||||
let g:Tlist_Ctags_Cmd = '/usr/bin/ctags' "设置ctags执行路径
|
||||
let g:Tlist_Ctags_Cmd = '/usr/bin/ctags' "设置ctags执行路径
|
||||
endif
|
||||
let g:Tlist_Auto_Update=1
|
||||
let g:Tlist_Auto_Open =0
|
||||
@ -9,3 +9,5 @@ let g:Tlist_Show_One_File=0
|
||||
let g:Tlist_File_Fold_Auto_Close=1
|
||||
let g:Tlist_Exit_OnlyWindow=1
|
||||
let g:Tlist_Show_Menu=1
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -5,5 +5,7 @@ nnoremap <leader>gg :execute 'Unite -auto-preview -start-insert -no-split gtags
|
||||
"nnoremap <leader>gp :execute 'Unite -auto-preview -start-insert -no-split gtags/completion'<CR>
|
||||
vnoremap <leader>gd <ESC>:execute 'Unite -auto-preview -start-insert -no-split gtags/def:'.GetVisualSelection()<CR>
|
||||
let g:unite_source_gtags_project_config = {
|
||||
\ '_': { 'treelize': 0 }
|
||||
\ }
|
||||
\ '_': { 'treelize': 0 }
|
||||
\ }
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -3,26 +3,26 @@ call unite#custom#source('codesearch', 'max_candidates', 30)
|
||||
call unite#filters#matcher_default#use(['matcher_fuzzy'])
|
||||
call unite#filters#sorter_default#use(['sorter_rank'])
|
||||
call unite#custom#profile('default', 'context', {
|
||||
\ 'safe': 0,
|
||||
\ 'start_insert': 1,
|
||||
\ 'ignorecase' : 1,
|
||||
\ 'short_source_names': 1,
|
||||
\ 'update_time': 200,
|
||||
\ 'direction': 'rightbelow',
|
||||
\ 'winwidth': 40,
|
||||
\ 'winheight': 15,
|
||||
\ 'max_candidates': 100,
|
||||
\ 'no_auto_resize': 1,
|
||||
\ 'vertical_preview': 1,
|
||||
\ 'cursor_line_time': '0.10',
|
||||
\ 'hide_icon': 0,
|
||||
\ 'candidate-icon': ' ',
|
||||
\ 'marked_icon': '✓',
|
||||
\ 'prompt' : '➭ '
|
||||
\ })
|
||||
\ 'safe': 0,
|
||||
\ 'start_insert': 1,
|
||||
\ 'ignorecase' : 1,
|
||||
\ 'short_source_names': 1,
|
||||
\ 'update_time': 200,
|
||||
\ 'direction': 'rightbelow',
|
||||
\ 'winwidth': 40,
|
||||
\ 'winheight': 15,
|
||||
\ 'max_candidates': 100,
|
||||
\ 'no_auto_resize': 1,
|
||||
\ 'vertical_preview': 1,
|
||||
\ 'cursor_line_time': '0.10',
|
||||
\ 'hide_icon': 0,
|
||||
\ 'candidate-icon': ' ',
|
||||
\ 'marked_icon': '✓',
|
||||
\ 'prompt' : '➭ '
|
||||
\ })
|
||||
call unite#custom#profile('source/neobundle/update', 'context', {
|
||||
\ 'start_insert' : 0,
|
||||
\ })
|
||||
\ 'start_insert' : 0,
|
||||
\ })
|
||||
let g:unite_source_codesearch_ignore_case = 1
|
||||
let g:unite_source_buffer_time_format = '(%m-%d-%Y %H:%M:%S) '
|
||||
let g:unite_source_file_mru_time_format = '(%m-%d-%Y %H:%M:%S) '
|
||||
@ -37,170 +37,170 @@ let g:unite_source_history_yank_enable=1
|
||||
let g:unite_split_rule = 'botright'
|
||||
let g:unite_winheight=25
|
||||
let g:unite_source_grep_default_opts = '-iRHn'
|
||||
\ . " --exclude='tags'"
|
||||
\ . " --exclude='cscope*'"
|
||||
\ . " --exclude='*.svn*'"
|
||||
\ . " --exclude='*.log*'"
|
||||
\ . " --exclude='*tmp*'"
|
||||
\ . " --exclude-dir='**/tmp'"
|
||||
\ . " --exclude-dir='CVS'"
|
||||
\ . " --exclude-dir='.svn'"
|
||||
\ . " --exclude-dir='.git'"
|
||||
\ . " --exclude-dir='node_modules'"
|
||||
\ . " --exclude='tags'"
|
||||
\ . " --exclude='cscope*'"
|
||||
\ . " --exclude='*.svn*'"
|
||||
\ . " --exclude='*.log*'"
|
||||
\ . " --exclude='*tmp*'"
|
||||
\ . " --exclude-dir='**/tmp'"
|
||||
\ . " --exclude-dir='CVS'"
|
||||
\ . " --exclude-dir='.svn'"
|
||||
\ . " --exclude-dir='.git'"
|
||||
\ . " --exclude-dir='node_modules'"
|
||||
let g:unite_launch_apps = [
|
||||
\ 'rake',
|
||||
\ 'make',
|
||||
\ 'git pull',
|
||||
\ 'git push']
|
||||
\ 'rake',
|
||||
\ 'make',
|
||||
\ 'git pull',
|
||||
\ 'git push']
|
||||
let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{})
|
||||
let g:unite_source_menu_menus.git = {
|
||||
\ 'description' : ' gestionar repositorios git
|
||||
\ ⌘ [espacio]g',
|
||||
\}
|
||||
\ 'description' : ' gestionar repositorios git
|
||||
\ ⌘ [espacio]g',
|
||||
\}
|
||||
let g:unite_source_menu_menus.git.command_candidates = [
|
||||
\['▷ tig ⌘ ,gt',
|
||||
\'normal ,gt'],
|
||||
\['▷ git status (Fugitive) ⌘ ,gs',
|
||||
\'Gstatus'],
|
||||
\['▷ git diff (Fugitive) ⌘ ,gd',
|
||||
\'Gdiff'],
|
||||
\['▷ git commit (Fugitive) ⌘ ,gc',
|
||||
\'Gcommit'],
|
||||
\['▷ git log (Fugitive) ⌘ ,gl',
|
||||
\'exe "silent Glog | Unite quickfix"'],
|
||||
\['▷ git blame (Fugitive) ⌘ ,gb',
|
||||
\'Gblame'],
|
||||
\['▷ git stage (Fugitive) ⌘ ,gw',
|
||||
\'Gwrite'],
|
||||
\['▷ git checkout (Fugitive) ⌘ ,go',
|
||||
\'Gread'],
|
||||
\['▷ git rm (Fugitive) ⌘ ,gr',
|
||||
\'Gremove'],
|
||||
\['▷ git mv (Fugitive) ⌘ ,gm',
|
||||
\'exe "Gmove " input("destino: ")'],
|
||||
\['▷ git push (Fugitive, salida por buffer) ⌘ ,gp',
|
||||
\'Git! push'],
|
||||
\['▷ git pull (Fugitive, salida por buffer) ⌘ ,gP',
|
||||
\'Git! pull'],
|
||||
\['▷ git prompt (Fugitive, salida por buffer) ⌘ ,gi',
|
||||
\'exe "Git! " input("comando git: ")'],
|
||||
\['▷ git cd (Fugitive)',
|
||||
\'Gcd'],
|
||||
\]
|
||||
\['▷ tig ⌘ ,gt',
|
||||
\'normal ,gt'],
|
||||
\['▷ git status (Fugitive) ⌘ ,gs',
|
||||
\'Gstatus'],
|
||||
\['▷ git diff (Fugitive) ⌘ ,gd',
|
||||
\'Gdiff'],
|
||||
\['▷ git commit (Fugitive) ⌘ ,gc',
|
||||
\'Gcommit'],
|
||||
\['▷ git log (Fugitive) ⌘ ,gl',
|
||||
\'exe "silent Glog | Unite quickfix"'],
|
||||
\['▷ git blame (Fugitive) ⌘ ,gb',
|
||||
\'Gblame'],
|
||||
\['▷ git stage (Fugitive) ⌘ ,gw',
|
||||
\'Gwrite'],
|
||||
\['▷ git checkout (Fugitive) ⌘ ,go',
|
||||
\'Gread'],
|
||||
\['▷ git rm (Fugitive) ⌘ ,gr',
|
||||
\'Gremove'],
|
||||
\['▷ git mv (Fugitive) ⌘ ,gm',
|
||||
\'exe "Gmove " input("destino: ")'],
|
||||
\['▷ git push (Fugitive, salida por buffer) ⌘ ,gp',
|
||||
\'Git! push'],
|
||||
\['▷ git pull (Fugitive, salida por buffer) ⌘ ,gP',
|
||||
\'Git! pull'],
|
||||
\['▷ git prompt (Fugitive, salida por buffer) ⌘ ,gi',
|
||||
\'exe "Git! " input("comando git: ")'],
|
||||
\['▷ git cd (Fugitive)',
|
||||
\'Gcd'],
|
||||
\]
|
||||
"===============================================================================
|
||||
" HTTP Status Code Definitions
|
||||
"===============================================================================
|
||||
let g:unite_source_menu_menus.StatusCodeDefinitions = {'description': 'HTTP status code definitions <leader>sc'}
|
||||
let g:unite_source_menu_menus.StatusCodeDefinitions.command_candidates = [
|
||||
\['➤ 100 Continue ', 'echo "Continue"'],
|
||||
\['➤ 101 Switching Protocols ', 'echo "Switching Protocols"'],
|
||||
\['➤ 200 OK ', 'echo "OK"'],
|
||||
\['➤ 201 Created ', 'echo "Created"'],
|
||||
\['➤ 202 Accepted ', 'echo "Accepted"'],
|
||||
\['➤ 203 Non-Authoritative Information ', 'echo "Non-Authoritative Information"'],
|
||||
\['➤ 204 No Content ', 'echo "No Content"'],
|
||||
\['➤ 205 Reset Content ', 'echo "Reset Content"'],
|
||||
\['➤ 206 Partial Content ', 'echo "Partial Content"'],
|
||||
\['➤ 300 Multiple Choices ', 'echo "Multiple Choices"'],
|
||||
\['➤ 301 Moved Permanently ', 'echo "Moved Permanently"'],
|
||||
\['➤ 302 Found ', 'echo "Found"'],
|
||||
\['➤ 303 See Other ', 'echo "See Other"'],
|
||||
\['➤ 304 Not Modified ', 'echo "Not Modified"'],
|
||||
\['➤ 305 Use Proxy ', 'echo "Use Proxy"'],
|
||||
\['➤ 307 Temporary Redirect ', 'echo "Temporary Redirect"'],
|
||||
\['➤ 400 Bad Request ', 'echo "Bad Request"'],
|
||||
\['➤ 401 Unauthorized ', 'echo "Unauthorized"'],
|
||||
\['➤ 402 Payment Required ', 'echo "Payment Required"'],
|
||||
\['➤ 403 Forbidden ', 'echo "Forbidden"'],
|
||||
\['➤ 404 Not Found ', 'echo "Not Found"'],
|
||||
\['➤ 405 Method Not Allowed ', 'echo "Method Not Allowed"'],
|
||||
\['➤ 406 Not Acceptable ', 'echo "Not Acceptable"'],
|
||||
\['➤ 407 Proxy Authentication Required ', 'echo "Proxy Authoritative Required"'],
|
||||
\['➤ 408 Request Timeout ', 'echo "Request Timeout"'],
|
||||
\['➤ 409 Conflict ', 'echo "Conflict"'],
|
||||
\['➤ 410 Gone ', 'echo "Gone"'],
|
||||
\['➤ 411 Length Required ', 'echo "Length Required"'],
|
||||
\['➤ 412 Precondition Failed ', 'echo "Precondition Failed"'],
|
||||
\['➤ 413 Request Entity Too Large ', 'echo "Request Entity Too Large"'],
|
||||
\['➤ 414 Request-URI Too Long ', 'echo "Request-URI Too Long"'],
|
||||
\['➤ 415 Unsupported Media Type ', 'echo "Unsupported Media Type"'],
|
||||
\['➤ 416 Requested Range Not Satisfiable ', 'echo "Requested Range Not Satisfiable"'],
|
||||
\['➤ 417 Expectation Failed ', 'echo "Expectation Failed"'],
|
||||
\['➤ 422 Unprocessable Entity ', 'echo "Unprocessable Entity"'],
|
||||
\['➤ 500 Internal Server Error ', 'echo "Internal Server Error"'],
|
||||
\['➤ 501 Not Implemented ', 'echo "Not Implemented"'],
|
||||
\['➤ 502 Bad Gateway ', 'echo "Bad Gateway"'],
|
||||
\['➤ 503 Service Unavailable ', 'echo "Service Unavailable"'],
|
||||
\['➤ 504 Gateway Timeout ', 'echo "Gateway Timeout"'],
|
||||
\['➤ 505 HTTP Version Not Supported ', 'echo "HTTP Version Not Supported"'],
|
||||
\]
|
||||
\['➤ 100 Continue ', 'echo "Continue"'],
|
||||
\['➤ 101 Switching Protocols ', 'echo "Switching Protocols"'],
|
||||
\['➤ 200 OK ', 'echo "OK"'],
|
||||
\['➤ 201 Created ', 'echo "Created"'],
|
||||
\['➤ 202 Accepted ', 'echo "Accepted"'],
|
||||
\['➤ 203 Non-Authoritative Information ', 'echo "Non-Authoritative Information"'],
|
||||
\['➤ 204 No Content ', 'echo "No Content"'],
|
||||
\['➤ 205 Reset Content ', 'echo "Reset Content"'],
|
||||
\['➤ 206 Partial Content ', 'echo "Partial Content"'],
|
||||
\['➤ 300 Multiple Choices ', 'echo "Multiple Choices"'],
|
||||
\['➤ 301 Moved Permanently ', 'echo "Moved Permanently"'],
|
||||
\['➤ 302 Found ', 'echo "Found"'],
|
||||
\['➤ 303 See Other ', 'echo "See Other"'],
|
||||
\['➤ 304 Not Modified ', 'echo "Not Modified"'],
|
||||
\['➤ 305 Use Proxy ', 'echo "Use Proxy"'],
|
||||
\['➤ 307 Temporary Redirect ', 'echo "Temporary Redirect"'],
|
||||
\['➤ 400 Bad Request ', 'echo "Bad Request"'],
|
||||
\['➤ 401 Unauthorized ', 'echo "Unauthorized"'],
|
||||
\['➤ 402 Payment Required ', 'echo "Payment Required"'],
|
||||
\['➤ 403 Forbidden ', 'echo "Forbidden"'],
|
||||
\['➤ 404 Not Found ', 'echo "Not Found"'],
|
||||
\['➤ 405 Method Not Allowed ', 'echo "Method Not Allowed"'],
|
||||
\['➤ 406 Not Acceptable ', 'echo "Not Acceptable"'],
|
||||
\['➤ 407 Proxy Authentication Required ', 'echo "Proxy Authoritative Required"'],
|
||||
\['➤ 408 Request Timeout ', 'echo "Request Timeout"'],
|
||||
\['➤ 409 Conflict ', 'echo "Conflict"'],
|
||||
\['➤ 410 Gone ', 'echo "Gone"'],
|
||||
\['➤ 411 Length Required ', 'echo "Length Required"'],
|
||||
\['➤ 412 Precondition Failed ', 'echo "Precondition Failed"'],
|
||||
\['➤ 413 Request Entity Too Large ', 'echo "Request Entity Too Large"'],
|
||||
\['➤ 414 Request-URI Too Long ', 'echo "Request-URI Too Long"'],
|
||||
\['➤ 415 Unsupported Media Type ', 'echo "Unsupported Media Type"'],
|
||||
\['➤ 416 Requested Range Not Satisfiable ', 'echo "Requested Range Not Satisfiable"'],
|
||||
\['➤ 417 Expectation Failed ', 'echo "Expectation Failed"'],
|
||||
\['➤ 422 Unprocessable Entity ', 'echo "Unprocessable Entity"'],
|
||||
\['➤ 500 Internal Server Error ', 'echo "Internal Server Error"'],
|
||||
\['➤ 501 Not Implemented ', 'echo "Not Implemented"'],
|
||||
\['➤ 502 Bad Gateway ', 'echo "Bad Gateway"'],
|
||||
\['➤ 503 Service Unavailable ', 'echo "Service Unavailable"'],
|
||||
\['➤ 504 Gateway Timeout ', 'echo "Gateway Timeout"'],
|
||||
\['➤ 505 HTTP Version Not Supported ', 'echo "HTTP Version Not Supported"'],
|
||||
\]
|
||||
nnoremap <silent><leader>sc :Unite -silent -winheight=17 -start-insert menu:StatusCodeDefinitions<CR>
|
||||
let g:unite_source_grep_max_candidates = 200
|
||||
if executable('hw')
|
||||
" Use hw (highway)
|
||||
" https://github.com/tkengo/highway
|
||||
let g:unite_source_grep_command = 'hw'
|
||||
let g:unite_source_grep_default_opts = '--no-group --no-color'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
" Use hw (highway)
|
||||
" https://github.com/tkengo/highway
|
||||
let g:unite_source_grep_command = 'hw'
|
||||
let g:unite_source_grep_default_opts = '--no-group --no-color'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
elseif executable('ag')
|
||||
" Use ag (the silver searcher)
|
||||
" https://github.com/ggreer/the_silver_searcher
|
||||
let g:unite_source_grep_command = 'ag'
|
||||
let g:unite_source_grep_default_opts =
|
||||
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
|
||||
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
" Use ag (the silver searcher)
|
||||
" https://github.com/ggreer/the_silver_searcher
|
||||
let g:unite_source_grep_command = 'ag'
|
||||
let g:unite_source_grep_default_opts =
|
||||
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
|
||||
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
elseif executable('pt')
|
||||
" Use pt (the platinum searcher)
|
||||
" https://github.com/monochromegane/the_platinum_searcher
|
||||
let g:unite_source_grep_command = 'pt'
|
||||
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
" Use pt (the platinum searcher)
|
||||
" https://github.com/monochromegane/the_platinum_searcher
|
||||
let g:unite_source_grep_command = 'pt'
|
||||
let g:unite_source_grep_default_opts = '--nogroup --nocolor'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
elseif executable('ack-grep')
|
||||
" Use ack
|
||||
" http://beyondgrep.com/
|
||||
let g:unite_source_grep_command = 'ack-grep'
|
||||
let g:unite_source_grep_default_opts =
|
||||
\ '-i --no-heading --no-color -k -H'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
" Use ack
|
||||
" http://beyondgrep.com/
|
||||
let g:unite_source_grep_command = 'ack-grep'
|
||||
let g:unite_source_grep_default_opts =
|
||||
\ '-i --no-heading --no-color -k -H'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
elseif executable('ack')
|
||||
let g:unite_source_grep_command = 'ack'
|
||||
let g:unite_source_grep_default_opts = '-i --no-heading --no-color -k -H'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
let g:unite_source_grep_command = 'ack'
|
||||
let g:unite_source_grep_default_opts = '-i --no-heading --no-color -k -H'
|
||||
let g:unite_source_grep_recursive_opt = ''
|
||||
elseif executable('jvgrep')
|
||||
" Use jvgrep
|
||||
" https://github.com/mattn/jvgrep
|
||||
let g:unite_source_grep_command = 'jvgrep'
|
||||
let g:unite_source_grep_default_opts = '-i --exclude ''\.(git|svn|hg|bzr)'''
|
||||
let g:unite_source_grep_recursive_opt = '-R'
|
||||
" Use jvgrep
|
||||
" https://github.com/mattn/jvgrep
|
||||
let g:unite_source_grep_command = 'jvgrep'
|
||||
let g:unite_source_grep_default_opts = '-i --exclude ''\.(git|svn|hg|bzr)'''
|
||||
let g:unite_source_grep_recursive_opt = '-R'
|
||||
elseif executable('beagrep')
|
||||
" Use beagrep
|
||||
" https://github.com/baohaojun/beagrep
|
||||
let g:unite_source_grep_command = 'beagrep'
|
||||
" Use beagrep
|
||||
" https://github.com/baohaojun/beagrep
|
||||
let g:unite_source_grep_command = 'beagrep'
|
||||
endif
|
||||
let g:unite_source_rec_async_command =
|
||||
\ ['ag', '--follow', '--nocolor', '--nogroup',
|
||||
\ '--hidden', '-g', '']
|
||||
\ ['ag', '--follow', '--nocolor', '--nogroup',
|
||||
\ '--hidden', '-g', '']
|
||||
nnoremap <silent><leader>ufa :<C-u>Unite -no-split -buffer-name=Mixed -start-insert file file_mru file_rec buffer<cr>
|
||||
nnoremap <silent><leader>ufr :<C-u>Unite -buffer-name=files file_rec/async:!<cr>
|
||||
nnoremap <silent><leader>ufg :<C-u>Unite -buffer-name=git-repo file_rec/git<cr>
|
||||
call unite#custom#profile('file_rec/async,file_rec/git', 'context', {
|
||||
\ 'start_insert' : 1,
|
||||
\ 'quit' : 1,
|
||||
\ 'split' : 1,
|
||||
\ 'keep_focus' : 1,
|
||||
\ 'winheight' : 20,
|
||||
\ })
|
||||
\ 'start_insert' : 1,
|
||||
\ 'quit' : 1,
|
||||
\ 'split' : 1,
|
||||
\ 'keep_focus' : 1,
|
||||
\ 'winheight' : 20,
|
||||
\ })
|
||||
call unite#custom#source('file_rec/async', 'ignore_globs',['*.png','.git/','*.ttf'])
|
||||
nnoremap <silent><leader>uf :<C-u>Unite -no-split -buffer-name=files -start-insert file<cr>
|
||||
nnoremap <silent><leader>ufm :<C-u>Unite -no-split -buffer-name=mru -start-insert file_mru<cr>
|
||||
nnoremap <silent><leader>ubf :<C-u>Unite -buffer-name=buffer buffer<cr>
|
||||
nnoremap <silent><leader>utb :<C-u>Unite -buffer-name=buffer_tab buffer_tab<cr>
|
||||
call unite#custom#profile('buffer,buffer_tab', 'context', {
|
||||
\ 'start_insert' : 0,
|
||||
\ 'quit' : 1,
|
||||
\ 'keep_focus' : 1,
|
||||
\ })
|
||||
\ 'start_insert' : 0,
|
||||
\ 'quit' : 1,
|
||||
\ 'keep_focus' : 1,
|
||||
\ })
|
||||
nnoremap <silent><leader>um :<C-u>Unite -start-insert mapping<CR>
|
||||
nnoremap <C-h> :<C-u>Unite -start-insert help<CR>
|
||||
nnoremap <silent> g<C-h> :<C-u>UniteWithCursorWord help<CR>
|
||||
@ -235,54 +235,56 @@ nnoremap <silent><Leader>ls :Unite -silent -ignorecase -winheight=17 -start-inse
|
||||
nnoremap <silent><Leader>lm :Unite -silent -ignorecase -winheight=17 -start-insert menu:MpvPlayer<CR>
|
||||
call zvim#util#loadMusics()
|
||||
augroup unite_buffer_feature
|
||||
autocmd FileType unite call s:unite_my_settings()
|
||||
autocmd FileType unite call s:unite_my_settings()
|
||||
augroup END
|
||||
function! s:unite_my_settings()
|
||||
" Overwrite settings.
|
||||
" Overwrite settings.
|
||||
|
||||
" Play nice with supertab
|
||||
let b:SuperTabDisabled=1
|
||||
" Enable navigation with control-j and control-k in insert mode
|
||||
imap <buffer> <C-n> <Plug>(unite_select_next_line)
|
||||
nmap <buffer> <C-n> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-p> <Plug>(unite_select_previous_line)
|
||||
nmap <buffer> <C-p> <Plug>(unite_select_previous_line)
|
||||
" Play nice with supertab
|
||||
let b:SuperTabDisabled=1
|
||||
" Enable navigation with control-j and control-k in insert mode
|
||||
imap <buffer> <C-n> <Plug>(unite_select_next_line)
|
||||
nmap <buffer> <C-n> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-p> <Plug>(unite_select_previous_line)
|
||||
nmap <buffer> <C-p> <Plug>(unite_select_previous_line)
|
||||
|
||||
|
||||
imap <buffer> jj <Plug>(unite_insert_leave)
|
||||
"imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
|
||||
imap <buffer> jj <Plug>(unite_insert_leave)
|
||||
"imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
|
||||
|
||||
imap <buffer><expr> j unite#smart_map('j', '')
|
||||
imap <buffer> <TAB> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
|
||||
imap <buffer> ' <Plug>(unite_quick_match_default_action)
|
||||
nmap <buffer> ' <Plug>(unite_quick_match_default_action)
|
||||
imap <buffer><expr> x
|
||||
\ unite#smart_map('x', "\<Plug>(unite_quick_match_choose_action)")
|
||||
nmap <buffer> x <Plug>(unite_quick_match_choose_action)
|
||||
nmap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
|
||||
imap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
|
||||
imap <buffer> <C-y> <Plug>(unite_narrowing_path)
|
||||
nmap <buffer> <C-y> <Plug>(unite_narrowing_path)
|
||||
nmap <buffer> <C-e> <Plug>(unite_toggle_auto_preview)
|
||||
imap <buffer> <C-e> <Plug>(unite_toggle_auto_preview)
|
||||
nmap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
|
||||
imap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
|
||||
nnoremap <silent><buffer><expr> l
|
||||
\ unite#smart_map('l', unite#do_action('default'))
|
||||
imap <buffer><expr> j unite#smart_map('j', '')
|
||||
imap <buffer> <TAB> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
|
||||
imap <buffer> ' <Plug>(unite_quick_match_default_action)
|
||||
nmap <buffer> ' <Plug>(unite_quick_match_default_action)
|
||||
imap <buffer><expr> x
|
||||
\ unite#smart_map('x', "\<Plug>(unite_quick_match_choose_action)")
|
||||
nmap <buffer> x <Plug>(unite_quick_match_choose_action)
|
||||
nmap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
|
||||
imap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
|
||||
imap <buffer> <C-y> <Plug>(unite_narrowing_path)
|
||||
nmap <buffer> <C-y> <Plug>(unite_narrowing_path)
|
||||
nmap <buffer> <C-e> <Plug>(unite_toggle_auto_preview)
|
||||
imap <buffer> <C-e> <Plug>(unite_toggle_auto_preview)
|
||||
nmap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
|
||||
imap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
|
||||
nnoremap <silent><buffer><expr> l
|
||||
\ unite#smart_map('l', unite#do_action('default'))
|
||||
|
||||
let unite = unite#get_current_unite()
|
||||
if unite.profile_name ==# 'search'
|
||||
nnoremap <silent><buffer><expr> r unite#do_action('replace')
|
||||
else
|
||||
nnoremap <silent><buffer><expr> r unite#do_action('rename')
|
||||
endif
|
||||
let unite = unite#get_current_unite()
|
||||
if unite.profile_name ==# 'search'
|
||||
nnoremap <silent><buffer><expr> r unite#do_action('replace')
|
||||
else
|
||||
nnoremap <silent><buffer><expr> r unite#do_action('rename')
|
||||
endif
|
||||
|
||||
nnoremap <silent><buffer><expr> cd unite#do_action('lcd')
|
||||
nnoremap <buffer><expr> S unite#mappings#set_current_filters(
|
||||
\ empty(unite#mappings#get_current_filters()) ?
|
||||
\ ['sorter_reverse'] : [])
|
||||
nnoremap <silent><buffer><expr> cd unite#do_action('lcd')
|
||||
nnoremap <buffer><expr> S unite#mappings#set_current_filters(
|
||||
\ empty(unite#mappings#get_current_filters()) ?
|
||||
\ ['sorter_reverse'] : [])
|
||||
|
||||
" Runs "split" action by <C-s>.
|
||||
imap <silent><buffer><expr> <C-s> unite#do_action('split')
|
||||
" Runs "split" action by <C-s>.
|
||||
imap <silent><buffer><expr> <C-s> unite#do_action('split')
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -5,30 +5,30 @@ let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tmuxline#enabled = 1
|
||||
let g:Powerline_sybols = 'unicode'
|
||||
if g:spacevim_buffer_index_type < 3
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {}
|
||||
for s:i in range(9)
|
||||
call extend(g:airline#extensions#tabline#buffer_idx_format,
|
||||
\ {s:i : SpaceVim#api#import('messletters').bubble_num(s:i,
|
||||
\ g:spacevim_buffer_index_type). ' '})
|
||||
endfor
|
||||
unlet s:i
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {}
|
||||
for s:i in range(9)
|
||||
call extend(g:airline#extensions#tabline#buffer_idx_format,
|
||||
\ {s:i : SpaceVim#api#import('messletters').bubble_num(s:i,
|
||||
\ g:spacevim_buffer_index_type). ' '})
|
||||
endfor
|
||||
unlet s:i
|
||||
elseif g:spacevim_buffer_index_type == 3
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
elseif g:spacevim_buffer_index_type == 4
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {
|
||||
\ '0': '0 ',
|
||||
\ '1': '1 ',
|
||||
\ '2': '2 ',
|
||||
\ '3': '3 ',
|
||||
\ '4': '4 ',
|
||||
\ '5': '5 ',
|
||||
\ '6': '6 ',
|
||||
\ '7': '7 ',
|
||||
\ '8': '8 ',
|
||||
\ '9': '9 '
|
||||
\}
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {
|
||||
\ '0': '0 ',
|
||||
\ '1': '1 ',
|
||||
\ '2': '2 ',
|
||||
\ '3': '3 ',
|
||||
\ '4': '4 ',
|
||||
\ '5': '5 ',
|
||||
\ '6': '6 ',
|
||||
\ '7': '7 ',
|
||||
\ '8': '8 ',
|
||||
\ '9': '9 '
|
||||
\}
|
||||
|
||||
endif
|
||||
let g:airline#extensions#tabline#formatter = 'spacevim'
|
||||
@ -50,7 +50,7 @@ nmap <leader>9 <Plug>AirlineSelectTab9
|
||||
nmap <leader>- <Plug>AirlineSelectPrevTab
|
||||
nmap <leader>+ <Plug>AirlineSelectNextTab
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
|
||||
" unicode symbols
|
||||
@ -65,14 +65,14 @@ let g:airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
" powerline symbols
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.maxlinenr= ''
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.maxlinenr= ''
|
||||
endif
|
||||
let g:airline#extensions#tabline#show_tab_nr = 1
|
||||
let g:airline#extensions#tabline#tab_nr_type= 2
|
||||
@ -80,6 +80,8 @@ let g:airline#extensions#tabline#show_tab_type = 1
|
||||
let g:airline#extensions#tabline#buffers_label = 'BUFFERS'
|
||||
let g:airline#extensions#tabline#tabs_label = 'TABS'
|
||||
if g:spacevim_enable_os_fileformat_icon
|
||||
let s:sys = SpaceVim#api#import('system')
|
||||
let g:airline_section_y = " %{&fenc . ' ' . SpaceVim#api#import('system').fileformat()} "
|
||||
let s:sys = SpaceVim#api#import('system')
|
||||
let g:airline_section_y = " %{&fenc . ' ' . SpaceVim#api#import('system').fileformat()} "
|
||||
endif
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,34 +1,36 @@
|
||||
let g:ref_source_webdict_sites = {
|
||||
\ 'je': {
|
||||
\ 'url': 'http://dictionary.infoseek.ne.jp/jeword/%s',
|
||||
\ },
|
||||
\ 'ej': {
|
||||
\ 'url': 'http://dictionary.infoseek.ne.jp/ejword/%s',
|
||||
\ },
|
||||
\ 'wiki': {
|
||||
\ 'url': 'http://ja.wikipedia.org/wiki/%s',
|
||||
\ },
|
||||
\ 'cn': {
|
||||
\ 'url': 'http://www.iciba.com/%s',
|
||||
\ },
|
||||
\ 'wikipedia:en':{'url': 'http://en.wikipedia.org/wiki/%s', },
|
||||
\ 'bing':{'url': 'http://cn.bing.com/search?q=%s', },
|
||||
\ }
|
||||
\ 'je': {
|
||||
\ 'url': 'http://dictionary.infoseek.ne.jp/jeword/%s',
|
||||
\ },
|
||||
\ 'ej': {
|
||||
\ 'url': 'http://dictionary.infoseek.ne.jp/ejword/%s',
|
||||
\ },
|
||||
\ 'wiki': {
|
||||
\ 'url': 'http://ja.wikipedia.org/wiki/%s',
|
||||
\ },
|
||||
\ 'cn': {
|
||||
\ 'url': 'http://www.iciba.com/%s',
|
||||
\ },
|
||||
\ 'wikipedia:en':{'url': 'http://en.wikipedia.org/wiki/%s', },
|
||||
\ 'bing':{'url': 'http://cn.bing.com/search?q=%s', },
|
||||
\ }
|
||||
let g:ref_source_webdict_sites.default = 'cn'
|
||||
"let g:ref_source_webdict_cmd='lynx -dump -nonumbers %s'
|
||||
"let g:ref_source_webdict_cmd='w3m -dump %s'
|
||||
"The filter on the output. Remove the first few lines
|
||||
function! g:ref_source_webdict_sites.je.filter(output)
|
||||
return join(split(a:output, "\n")[15 :], "\n")
|
||||
return join(split(a:output, "\n")[15 :], "\n")
|
||||
endfunction
|
||||
function! g:ref_source_webdict_sites.ej.filter(output)
|
||||
return join(split(a:output, "\n")[15 :], "\n")
|
||||
return join(split(a:output, "\n")[15 :], "\n")
|
||||
endfunction
|
||||
function! g:ref_source_webdict_sites.wiki.filter(output)
|
||||
return join(split(a:output, "\n")[17 :], "\n")
|
||||
return join(split(a:output, "\n")[17 :], "\n")
|
||||
endfunction
|
||||
nnoremap <Leader>rj :<C-u>Ref webdict je<Space>
|
||||
nnoremap <Leader>re :<C-u>Ref webdict ej<Space>
|
||||
nnoremap <Leader>rc :<C-u>Ref webdict cn<Space>
|
||||
nnoremap <Leader>rw :<C-u>Ref webdict wikipedia:en<Space>
|
||||
nnoremap <Leader>rb :<C-u>Ref webdict bing<Space>
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -1,32 +1,32 @@
|
||||
let g:startify_custom_header = get(g:, 'startify_custom_header', [
|
||||
\'',
|
||||
\'',
|
||||
\' /###### /## /##/## ',
|
||||
\' /##__ ## | ## | #|__/ ',
|
||||
\' | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### ',
|
||||
\' | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##',
|
||||
\' \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##',
|
||||
\' /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##',
|
||||
\' | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##',
|
||||
\' \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/',
|
||||
\' | ## ',
|
||||
\' | ## ',
|
||||
\' |__/ ',
|
||||
\' version : ' . g:spacevim_version . ' by : spacevim.org',
|
||||
\'',
|
||||
\ ])
|
||||
\'',
|
||||
\'',
|
||||
\' /###### /## /##/## ',
|
||||
\' /##__ ## | ## | #|__/ ',
|
||||
\' | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### ',
|
||||
\' | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##',
|
||||
\' \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##',
|
||||
\' /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##',
|
||||
\' | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##',
|
||||
\' \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/',
|
||||
\' | ## ',
|
||||
\' | ## ',
|
||||
\' |__/ ',
|
||||
\' version : ' . g:spacevim_version . ' by : spacevim.org',
|
||||
\'',
|
||||
\ ])
|
||||
let g:startify_session_dir = $HOME . '/.data/' . ( has('nvim') ? 'nvim' : 'vim' ) . '/session'
|
||||
let g:startify_files_number = 6
|
||||
let g:startify_list_order = [
|
||||
\ [' My most recently used files in the current directory:'],
|
||||
\ 'dir',
|
||||
\ [' My most recently used files:'],
|
||||
\ 'files',
|
||||
\ [' These are my sessions:'],
|
||||
\ 'sessions',
|
||||
\ [' These are my bookmarks:'],
|
||||
\ 'bookmarks',
|
||||
\ ]
|
||||
\ [' My most recently used files in the current directory:'],
|
||||
\ 'dir',
|
||||
\ [' My most recently used files:'],
|
||||
\ 'files',
|
||||
\ [' These are my sessions:'],
|
||||
\ 'sessions',
|
||||
\ [' These are my bookmarks:'],
|
||||
\ 'bookmarks',
|
||||
\ ]
|
||||
"let g:startify_bookmarks = [ {'c': '~/.vimrc'}, '~/.zshrc' ]
|
||||
let g:startify_update_oldfiles = 1
|
||||
let g:startify_disable_at_vimenter = 1
|
||||
@ -36,18 +36,20 @@ let g:startify_session_persistence = 1
|
||||
let g:startify_change_to_dir = 0
|
||||
"let g:startify_change_to_vcs_root = 0 " vim-rooter has same feature
|
||||
let g:startify_skiplist = [
|
||||
\ 'COMMIT_EDITMSG',
|
||||
\ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc',
|
||||
\ 'bundle/.*/doc',
|
||||
\ ]
|
||||
\ 'COMMIT_EDITMSG',
|
||||
\ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc',
|
||||
\ 'bundle/.*/doc',
|
||||
\ ]
|
||||
fu! <SID>startify_mapping()
|
||||
if getcwd() == $VIM || getcwd() == expand('~')
|
||||
nnoremap <silent><buffer> <c-p> :<c-u>CtrlP ~\DotFiles<cr>
|
||||
endif
|
||||
if getcwd() == $VIM || getcwd() == expand('~')
|
||||
nnoremap <silent><buffer> <c-p> :<c-u>CtrlP ~\DotFiles<cr>
|
||||
endif
|
||||
endf
|
||||
augroup startify_map
|
||||
au!
|
||||
autocmd FileType startify nnoremap <buffer><F2> <Nop>
|
||||
autocmd FileType startify call <SID>startify_mapping()
|
||||
autocmd FileType startify set scrolloff=0
|
||||
au!
|
||||
autocmd FileType startify nnoremap <buffer><F2> <Nop>
|
||||
autocmd FileType startify call <SID>startify_mapping()
|
||||
autocmd FileType startify set scrolloff=0
|
||||
augroup END
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -10,69 +10,71 @@ let g:vimfiler_readonly_file_icon = '*'
|
||||
let g:vimfiler_marked_file_icon = '√'
|
||||
"let g:vimfiler_preview_action = 'auto_preview'
|
||||
let g:vimfiler_ignore_pattern = [
|
||||
\ '^\.git$',
|
||||
\ '^\.DS_Store$',
|
||||
\ '^\.init\.vim-rplugin\~$',
|
||||
\ '^\.netrwhist$',
|
||||
\ '\.class$'
|
||||
\]
|
||||
\ '^\.git$',
|
||||
\ '^\.DS_Store$',
|
||||
\ '^\.init\.vim-rplugin\~$',
|
||||
\ '^\.netrwhist$',
|
||||
\ '\.class$'
|
||||
\]
|
||||
|
||||
if has('mac')
|
||||
let g:vimfiler_quick_look_command =
|
||||
\ '/Applications//Sublime\ Text.app/Contents/MacOS/Sublime\ Text'
|
||||
let g:vimfiler_quick_look_command =
|
||||
\ '/Applications//Sublime\ Text.app/Contents/MacOS/Sublime\ Text'
|
||||
else
|
||||
let g:vimfiler_quick_look_command = 'gloobus-preview'
|
||||
let g:vimfiler_quick_look_command = 'gloobus-preview'
|
||||
endif
|
||||
try
|
||||
call vimfiler#custom#profile('default', 'context', {
|
||||
\ 'explorer' : 1,
|
||||
\ 'winwidth' : g:spacevim_sidebar_width,
|
||||
\ 'winminwidth' : 30,
|
||||
\ 'toggle' : 1,
|
||||
\ 'auto_expand': 1,
|
||||
\ 'direction' : 'rightbelow',
|
||||
\ 'parent': 0,
|
||||
\ 'explorer_columns' : 'gitstatus',
|
||||
\ 'status' : 1,
|
||||
\ 'safe' : 0,
|
||||
\ 'split' : 1,
|
||||
\ 'hidden': 1,
|
||||
\ 'no_quit' : 1,
|
||||
\ 'force_hide' : 0,
|
||||
\ })
|
||||
call vimfiler#custom#profile('default', 'context', {
|
||||
\ 'explorer' : 1,
|
||||
\ 'winwidth' : g:spacevim_sidebar_width,
|
||||
\ 'winminwidth' : 30,
|
||||
\ 'toggle' : 1,
|
||||
\ 'auto_expand': 1,
|
||||
\ 'direction' : 'rightbelow',
|
||||
\ 'parent': 0,
|
||||
\ 'explorer_columns' : 'gitstatus',
|
||||
\ 'status' : 1,
|
||||
\ 'safe' : 0,
|
||||
\ 'split' : 1,
|
||||
\ 'hidden': 1,
|
||||
\ 'no_quit' : 1,
|
||||
\ 'force_hide' : 0,
|
||||
\ })
|
||||
catch
|
||||
endtry
|
||||
augroup vfinit
|
||||
au!
|
||||
autocmd FileType vimfiler call s:vimfilerinit()
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &filetype ==# 'vimfiler') |
|
||||
\ q | endif
|
||||
au!
|
||||
autocmd FileType vimfiler call s:vimfilerinit()
|
||||
autocmd BufEnter * if (winnr('$') == 1 && &filetype ==# 'vimfiler') |
|
||||
\ q | endif
|
||||
augroup END
|
||||
function! s:vimfilerinit()
|
||||
set nonumber
|
||||
set norelativenumber
|
||||
set nonumber
|
||||
set norelativenumber
|
||||
|
||||
silent! nunmap <buffer> <Space>
|
||||
silent! nunmap <buffer> <C-l>
|
||||
silent! nunmap <buffer> <C-j>
|
||||
silent! nunmap <buffer> E
|
||||
silent! nunmap <buffer> gr
|
||||
silent! nunmap <buffer> gf
|
||||
silent! nunmap <buffer> -
|
||||
silent! nunmap <buffer> s
|
||||
silent! nunmap <buffer> <Space>
|
||||
silent! nunmap <buffer> <C-l>
|
||||
silent! nunmap <buffer> <C-j>
|
||||
silent! nunmap <buffer> E
|
||||
silent! nunmap <buffer> gr
|
||||
silent! nunmap <buffer> gf
|
||||
silent! nunmap <buffer> -
|
||||
silent! nunmap <buffer> s
|
||||
|
||||
nnoremap <silent><buffer> gr :<C-u>Denite grep:<C-R>=<SID>selected()<CR> -buffer-name=grep<CR>
|
||||
nnoremap <silent><buffer> gf :<C-u>Denite file_rec:<C-R>=<SID>selected()<CR><CR>
|
||||
nnoremap <silent><buffer> gd :<C-u>call <SID>change_vim_current_dir()<CR>
|
||||
nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit')
|
||||
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
|
||||
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
|
||||
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
|
||||
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
|
||||
nmap <buffer> v <Plug>(vimfiler_quick_look)
|
||||
nmap <buffer> p <Plug>(vimfiler_preview_file)
|
||||
nmap <buffer> V <Plug>(vimfiler_clear_mark_all_lines)
|
||||
nmap <buffer> i <Plug>(vimfiler_switch_to_history_directory)
|
||||
nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window)
|
||||
nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen)
|
||||
nnoremap <silent><buffer> gr :<C-u>Denite grep:<C-R>=<SID>selected()<CR> -buffer-name=grep<CR>
|
||||
nnoremap <silent><buffer> gf :<C-u>Denite file_rec:<C-R>=<SID>selected()<CR><CR>
|
||||
nnoremap <silent><buffer> gd :<C-u>call <SID>change_vim_current_dir()<CR>
|
||||
nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit')
|
||||
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
|
||||
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
|
||||
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
|
||||
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
|
||||
nmap <buffer> v <Plug>(vimfiler_quick_look)
|
||||
nmap <buffer> p <Plug>(vimfiler_preview_file)
|
||||
nmap <buffer> V <Plug>(vimfiler_clear_mark_all_lines)
|
||||
nmap <buffer> i <Plug>(vimfiler_switch_to_history_directory)
|
||||
nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window)
|
||||
nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen)
|
||||
endf
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -24,22 +24,23 @@ CONTENTS *SpaceVim-contents*
|
||||
2. autocomplete..................................|SpaceVim-autocomplete|
|
||||
3. checkers....................................|SpaceVim-layer-checkers|
|
||||
4. colorscheme....................................|SpaceVim-colorscheme|
|
||||
5. exprfold....................................|SpaceVim-layer-exprfold|
|
||||
6. incsearch..................................|SpaceVim-layer-incsearch|
|
||||
7. indentmove................................|SpaceVim-layer-indentmove|
|
||||
8. lang#c........................................|SpaceVim-layer-lang-c|
|
||||
9. lang#elixir..............................|SpaceVim-layer-lang-elixir|
|
||||
10. lang#go.....................................|SpaceVim-layer-lang-go|
|
||||
11. lang#java.................................|SpaceVim-layer-lang-java|
|
||||
12. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
|
||||
13. lang#php...................................|SpaceVim-layer-lang-php|
|
||||
14. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
||||
15. lang#python.............................|SpaceVim-layer-lang-python|
|
||||
16. lang#rust.................................|SpaceVim-layer-lang-rust|
|
||||
17. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
18. operator...................................|SpaceVim-layer-operator|
|
||||
19. shell.........................................|SpaceVim-layer-shell|
|
||||
20. tmux...........................................|SpaceVim-layer-tmux|
|
||||
5. core#tabline............................|SpaceVim-layer-core-tabline|
|
||||
6. exprfold....................................|SpaceVim-layer-exprfold|
|
||||
7. incsearch..................................|SpaceVim-layer-incsearch|
|
||||
8. indentmove................................|SpaceVim-layer-indentmove|
|
||||
9. lang#c........................................|SpaceVim-layer-lang-c|
|
||||
10. lang#elixir.............................|SpaceVim-layer-lang-elixir|
|
||||
11. lang#go.....................................|SpaceVim-layer-lang-go|
|
||||
12. lang#java.................................|SpaceVim-layer-lang-java|
|
||||
13. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
|
||||
14. lang#php...................................|SpaceVim-layer-lang-php|
|
||||
15. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
||||
16. lang#python.............................|SpaceVim-layer-lang-python|
|
||||
17. lang#rust.................................|SpaceVim-layer-lang-rust|
|
||||
18. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
19. operator...................................|SpaceVim-layer-operator|
|
||||
20. shell.........................................|SpaceVim-layer-shell|
|
||||
21. tmux...........................................|SpaceVim-layer-tmux|
|
||||
5. FAQ........................................................|SpaceVim-faq|
|
||||
|
||||
==============================================================================
|
||||
@ -458,6 +459,11 @@ https://github.com/SpaceVim/SpaceVim/issues/209#issuecomment-280545818
|
||||
zellner
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
CORE#TABLINE *SpaceVim-layer-core-tabline*
|
||||
|
||||
This layer provides default tabline for SpaceVim
|
||||
|
||||
==============================================================================
|
||||
EXPRFOLD *SpaceVim-layer-exprfold*
|
||||
|
||||
|
@ -0,0 +1,227 @@
|
||||
---
|
||||
title: "Conventions"
|
||||
permalink: "/conventions"
|
||||
---
|
||||
|
||||
# Conventions
|
||||
|
||||
## Content
|
||||
- [viml coding style guild](#viml-coding-style-guide)
|
||||
|
||||
## Viml coding style guide
|
||||
### Portability
|
||||
Vim is highly configurable. Users can change many of the default settings, including the case sensitivity, the regular expression rules, the substitution rules, and more. In order for your vimscript to work for all users, follow these guidelines:
|
||||
|
||||
#### Strings
|
||||
**Prefer single quoted strings**
|
||||
|
||||
Double quoted strings are semantically different in vimscript, and you probably don't want them (they break regexes).
|
||||
|
||||
Use double quoted strings when you need an escape sequence (such as "\n") or if you know it doesn't matter and you need to embed single quotes.
|
||||
|
||||
#### Matching Strings
|
||||
**Use the =~# or =~? operator families over the =~ family.**
|
||||
|
||||
The matching behavior depends upon the user's ignorecase and smartcase settings and on whether you compare them with the =~, =~#, or =~? family of operators. Use the =~# and =~? operator families explicitly when comparing strings unless you explicitly need to honor the user's case sensitivity settings.
|
||||
|
||||
#### Regular Expressions
|
||||
**Prefix all regexes with one of \m, \v, \M, or \V.**
|
||||
|
||||
In addition to the case sensitivity settings, regex behavior depends upon the user's nomagic setting. To make regexes act like nomagic and noignorecase are set, prepend all regexes with one of \m, \v, \M, or \V.
|
||||
|
||||
You are welcome to use other magic levels (\v) and case sensitivities (\c) so long as they are intentional and explicit.
|
||||
|
||||
#### Dangerous commands
|
||||
**Avoid commands with unintended side effects.**
|
||||
|
||||
Avoid using :s[ubstitute] as it moves the cursor and prints error messages. Prefer functions (such as search()) better suited to scripts.
|
||||
|
||||
The meaning of the g flag depends upon the gdefault setting. If you do use :substitute you must save gdefault, set it to 0 or 1, perform the substitution, and then restore it.
|
||||
|
||||
For many vim commands, functions exist that do the same thing with fewer side effects. See :help functions() for a list of built-in functions.
|
||||
|
||||
#### Fragile commands
|
||||
**Avoid commands that rely on user settings.**
|
||||
|
||||
Always use normal! instead of normal. The latter depends upon the user's key mappings and could do anything.
|
||||
|
||||
Avoid :s[ubstitute], as its behavior depends upon a number of local settings.
|
||||
|
||||
The same applies to other commands not listed here.
|
||||
|
||||
#### Catching Exceptions
|
||||
**Match error codes, not error text.**
|
||||
|
||||
Error text may be locale dependant.
|
||||
|
||||
### General Guidelines
|
||||
#### Messaging
|
||||
**Message the user infrequently.**
|
||||
|
||||
Loud scripts are annoying. Message the user only when:
|
||||
|
||||
- A long-running process has kicked off.
|
||||
- An error has occurred.
|
||||
|
||||
#### Type checking
|
||||
**Use strict and explicit checks where possible.**
|
||||
|
||||
Vimscript has unsafe, unintuitive behavior when dealing with some types. For instance, 0 == 'foo' evaluates to true.
|
||||
|
||||
Use strict comparison operators where possible. When comparing against a string literal, use the is# operator. Otherwise, prefer maktaba#value#IsEqual or check type() explicitly.
|
||||
|
||||
Check variable types explicitly before using them. Use functions from maktaba#ensure, or check maktaba#value or type() and throw your own errors.
|
||||
|
||||
Use :unlet for variables that may change types, particularly those assigned inside loops.
|
||||
|
||||
#### Python
|
||||
**Use sparingly.**
|
||||
|
||||
Use python only when it provides critical functionality, for example when writing threaded code.
|
||||
|
||||
#### Other Languages
|
||||
**Use vimscript instead.**
|
||||
|
||||
Avoid using other scripting languages such as ruby and lua. We can not guarantee that the end user's vim has been compiled with support for non-vimscript languages.
|
||||
|
||||
#### Plugin layout
|
||||
**Organize functionality into modular plugins**
|
||||
|
||||
Group your functionality as a plugin, unified in one directory (or code repository) which shares your plugin's name (with a "vim-" prefix or ".vim" suffix if desired). It should be split into plugin/, autoload/, etc. subdirectories as necessary, and it should declare metadata in the addon-info.json format (see the VAM documentation for details).
|
||||
|
||||
#### Functions
|
||||
**In the autoload/ directory, defined with [!] and [abort].**
|
||||
|
||||
Autoloading allows functions to be loaded on demand, which makes startuptime faster and enforces function namespacing.
|
||||
|
||||
Script-local functions are welcome, but should also live in autoload/ and be called by autoloaded functions.
|
||||
|
||||
Non-library plugins should expose commands instead of functions. Command logic should be extracted into functions and autoloaded.
|
||||
|
||||
[!] allows developers to reload their functions without complaint.
|
||||
|
||||
[abort] forces the function to halt when it encounters an error.
|
||||
|
||||
#### Commands
|
||||
**In the plugin/commands.vim or under the ftplugin/ directory, defined without [!].**
|
||||
|
||||
General commands go in plugin/commands.vim. Filetype-specific commands go in ftplugin/.
|
||||
|
||||
Excluding [!] prevents your plugin from silently clobbering existing commands. Command conflicts should be resolved by the user.
|
||||
|
||||
#### Autocommands
|
||||
**Place them in plugin/autocmds.vim, within augroups.**
|
||||
|
||||
Place all autocommands in augroups.
|
||||
|
||||
The augroup name should be unique. It should either be, or be prefixed with, the plugin name.
|
||||
|
||||
Clear the augroup with autocmd! before defining new autocommands in the augroup. This makes your plugin re-entrable.
|
||||
|
||||
#### Mappings
|
||||
**Place them in plugin/mappings.vim, using maktaba#plugin#MapPrefix to get a prefix.**
|
||||
|
||||
All key mappings should be defined in plugin/mappings.vim.
|
||||
|
||||
Partial mappings (see :help using-<Plug>.) should be defined in plugin/plugs.vim.
|
||||
|
||||
**Always use the noremap family of commands.**
|
||||
|
||||
Your plugins generally shouldn't introduce mappings, but if they do, the map command respects the users existing mappings and could do anything.
|
||||
|
||||
#### Errors
|
||||
|
||||
When using catch, match the error code rather than the error text.
|
||||
|
||||
#### Settings
|
||||
**Change settings locally**
|
||||
|
||||
Use :setlocal and &l: instead of :set and & unless you have explicit reason to do otherwise.
|
||||
|
||||
### Style
|
||||
Follow google style conventions. When in doubt, treat vimscript style like python style.
|
||||
#### Whitespace
|
||||
**Similar to python.**
|
||||
|
||||
- Use two spaces for indents
|
||||
- Do not use tabs
|
||||
- Use spaces around operators
|
||||
|
||||
This does not apply to arguments to commands.
|
||||
|
||||
let s:variable = "concatenated " . "strings"
|
||||
command -range=% MyCommand
|
||||
|
||||
- Do not introduce trailing whitespace
|
||||
|
||||
You need not go out of your way to remove it.
|
||||
|
||||
Trailing whitespace is allowed in mappings which prep commands for user input, such as "noremap <leader>gf :grep -f ".
|
||||
|
||||
- Restrict lines to 80 columns wide
|
||||
- Indent continued lines by four spaces
|
||||
- Do not align arguments of commands
|
||||
|
||||
```diff
|
||||
+command -bang MyCommand call myplugin#foo()
|
||||
+command MyCommand2 call myplugin#bar()
|
||||
-command -bang MyCommand call myplugin#foo()
|
||||
-command MyCommand2 call myplugin#bar()
|
||||
```
|
||||
|
||||
#### Line Continuations
|
||||
- Prefer line continuations on semantic boundaries.
|
||||
|
||||
```diff
|
||||
+command SomeLongCommand
|
||||
+ \ call some#function()
|
||||
-command SomeLongCommand call
|
||||
- \ some#function()
|
||||
```
|
||||
|
||||
- Place one space after the backslash denoting a line continuation.
|
||||
|
||||
When continuing a multi-line command a pipe can be substituted for this space as necessary, as follows:
|
||||
|
||||
```viml
|
||||
autocommand BufEnter <buffer>
|
||||
\ if !empty(s:var)
|
||||
\| call some#function()
|
||||
\|else
|
||||
\| call some#function(s:var)
|
||||
\|endif
|
||||
```
|
||||
|
||||
- Do not continue multi-line commands when you can avoid it. Prefer function calls.
|
||||
|
||||
#### Naming
|
||||
In general, use plugin-names-like-this, FunctionNamesLikeThis, CommandNamesLikeThis, augroup_names_like_this, variable_names_like_this.
|
||||
|
||||
Always prefix variables with their scope.
|
||||
|
||||
- plugin-names-like-this
|
||||
Keep them short and sweet.
|
||||
- FunctionNamesLikeThis
|
||||
- Prefix script-local functions with s:
|
||||
- Autoloaded functions may not have a scope prefix.
|
||||
- Do not create global functions. Use autoloaded functions instead.
|
||||
- CommandNamesLikeThis
|
||||
Prefer succinct command names over common command prefixes.
|
||||
- variable_names_like_this
|
||||
Augroup names count as variables for naming purposes.
|
||||
- Prefix all variables with their scope.
|
||||
- Global variables with g:
|
||||
- Script-local variables with s:
|
||||
- Function arguments with a:
|
||||
- Function-local variables with l:
|
||||
- Vim-predefined variables with v:
|
||||
- Buffer-local variables with b:
|
||||
- g:, s:, and a: must always be used.
|
||||
- b: changes the variable semantics; use it when you want buffer-local semantics.
|
||||
- l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere.
|
||||
|
||||
|
||||
## Thanks:
|
||||
- link : https://google.github.io/styleguide/vimscriptguide.xml
|
||||
- link : https://google.github.io/styleguide/vimscriptfull.xml
|
||||
- link : https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt
|
@ -483,23 +483,55 @@ in the root of your project. `.SpaceVim.d/` will also be added into runtimepath.
|
||||
|
||||
here is an example config file for SpaceVim:
|
||||
|
||||
```viml
|
||||
" set the options of SpaceVim
|
||||
let g:spacevim_colorscheme = 'solarized'
|
||||
```vim
|
||||
" Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim
|
||||
" file for all possible options:
|
||||
let g:spacevim_default_indent = 3
|
||||
let g:spacevim_max_column = 80
|
||||
|
||||
" setting layers, load 'lang#java' layer.
|
||||
call SpaceVim#layers#load('lang#java')
|
||||
" Change the default directory where all miscellaneous persistent files go.
|
||||
" By default it is ~/.cache/vimfiles.
|
||||
let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles'
|
||||
|
||||
" add custom plugins.
|
||||
" set SpaceVim colorscheme
|
||||
let g:spacevim_colorscheme = 'jellybeans'
|
||||
|
||||
" Set plugin manager, you want to use, default is dein.vim
|
||||
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
|
||||
|
||||
" use space as `<Leader>`
|
||||
let mapleader = "\<space>"
|
||||
|
||||
" Set windows shortcut leader [Window], default is `s`
|
||||
let g:spacevim_windows_leader = 's'
|
||||
|
||||
" Set unite work flow shortcut leader [Unite], default is `f`
|
||||
let g:spacevim_unite_leader = 'f'
|
||||
|
||||
" By default, language specific plugins are not loaded. This can be changed
|
||||
" with the following, then the plugins for go development will be loaded.
|
||||
call SpaceVim#layers#load('lang#go')
|
||||
|
||||
" loaded ui layer
|
||||
call SpaceVim#layers#load('ui')
|
||||
|
||||
" If there is a particular plugin you don't like, you can define this
|
||||
" variable to disable them entirely:
|
||||
let g:spacevim_disabled_plugins=[
|
||||
\ ['junegunn/fzf.vim'],
|
||||
\ ]
|
||||
|
||||
" If you want to add some custom plugins, use these options:
|
||||
let g:spacevim_custom_plugins = [
|
||||
\ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
|
||||
\ ['wsdjeg/GitHub.vim'],
|
||||
\ ]
|
||||
\ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
|
||||
\ ['wsdjeg/GitHub.vim'],
|
||||
\ ]
|
||||
|
||||
" custom mappings:
|
||||
nnoremap <c-l> :Ydc<cr>
|
||||
" set the guifont
|
||||
let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'
|
||||
```
|
||||
|
||||
Comprehensive documentation is available for each layer by <kbd>:h SpaceVim</kbd>.
|
||||
|
||||
<!-- plublic links -->
|
||||
[dein.vim]: https://github.com/Shougo/dein.vim
|
||||
|
@ -0,0 +1 @@
|
||||
" vim:set et sw=2
|
@ -1,4 +1,6 @@
|
||||
if exists("g:GuiLoaded")
|
||||
exe 'Guifont! DejaVu Sans Mono for Powerline:h11:cANSI:qDRAFT'
|
||||
if exists('g:GuiLoaded')
|
||||
exe 'Guifont! DejaVu Sans Mono for Powerline:h11:cANSI:qDRAFT'
|
||||
endif
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user