mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:00:04 +08:00
fix vim script lint (#2519)
This commit is contained in:
parent
eede4cfbe3
commit
ec5b8d0a01
@ -1,8 +1,8 @@
|
||||
function! SpaceVim#dev#g#updatedoc()
|
||||
function! SpaceVim#dev#g#updatedoc() abort
|
||||
let keys = keys(g:_spacevim_mappings_g)
|
||||
let lines = []
|
||||
for key in keys
|
||||
if key == '`'
|
||||
if key ==# '`'
|
||||
let line = '`` g' . key . ' `` | ' . g:_spacevim_mappings_g[key][1]
|
||||
else
|
||||
let line = '`g' . key . '` | ' . g:_spacevim_mappings_g[key][1]
|
||||
|
@ -6,6 +6,7 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" 2017-08-05 v0.4.0 is released at https://github.com/SpaceVim/SpaceVim/pull/768
|
||||
" 2017-11-16 v0.5.0 is released at https://github.com/SpaceVim/SpaceVim/pull/966
|
||||
@ -112,7 +113,7 @@ endfunction
|
||||
|
||||
" this function is to generate markdown form pull request list
|
||||
function! SpaceVim#dev#releases#parser_prs(prs, ...) abort
|
||||
let is_cn = get(a:000, 0, '') == 'cn'
|
||||
let is_cn = get(a:000, 0, '') ==# 'cn'
|
||||
let g:is_cn = is_cn
|
||||
let md = []
|
||||
let adds = []
|
||||
|
@ -5,10 +5,10 @@ let s:port = '9995'
|
||||
let s:JSON = SpaceVim#api#import('data#json')
|
||||
let s:JOB = SpaceVim#api#import('job')
|
||||
|
||||
func! SpaceVim#dev#send_to_channel#setport(port)
|
||||
func! SpaceVim#dev#send_to_channel#setport(port) abort
|
||||
let s:port = a:port
|
||||
endf
|
||||
func! SpaceVim#dev#send_to_channel#send(t)
|
||||
func! SpaceVim#dev#send_to_channel#send(t) abort
|
||||
|
||||
if a:t ==# 'line'
|
||||
call s:sendline()
|
||||
@ -16,7 +16,7 @@ func! SpaceVim#dev#send_to_channel#send(t)
|
||||
|
||||
endf
|
||||
|
||||
func! s:send(msg)
|
||||
func! s:send(msg) abort
|
||||
let msg = {
|
||||
\ 'text' : a:msg,
|
||||
\ 'username' : s:username,
|
||||
|
@ -9,7 +9,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
|
||||
VIMLINT_LOG=`cat build_log`
|
||||
echo "$VIMLINT_LOG"
|
||||
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
|
||||
docker run -it --rm \
|
||||
docker run \
|
||||
-it --rm \
|
||||
-v $PWD/.ci:/.ci \
|
||||
-v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
|
||||
-v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
|
||||
|
@ -25,7 +25,7 @@ function! s:update_log(log, summary, new_log) abort
|
||||
|
||||
endfunction
|
||||
if !empty(s:log)
|
||||
if $LINT == 'vader'
|
||||
if $LINT ==# 'vader'
|
||||
let s:summary = $VIM . ' ' . $LINT . ' build log'
|
||||
else
|
||||
let s:summary = $LINT . ' build log'
|
||||
@ -50,7 +50,7 @@ if !empty(s:log)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if $LINT == 'vader'
|
||||
if $LINT ==# 'vader'
|
||||
let s:summary = $VIM . ' ' . $LINT . ' build log'
|
||||
else
|
||||
let s:summary = $LINT . ' build log'
|
||||
|
@ -7,7 +7,6 @@ set -ue -o pipefail
|
||||
export LC_ALL=C
|
||||
|
||||
docker pull spacevim/vims
|
||||
|
||||
git fetch origin master:master
|
||||
|
||||
if [ "${LINT#vimlint}" != "$LINT" ]; then
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
export TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}
|
||||
if [ "$LINT" = "vimlint" ]; then
|
||||
for file in $(git diff --name-only HEAD dev | grep .vim$);
|
||||
do
|
||||
|
@ -14,8 +14,11 @@ let s:COP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
" this is for vim command completion
|
||||
|
||||
" @vimlint(EVL103, 1, a:ArgLead)
|
||||
" @vimlint(EVL103, 1, a:CmdLine)
|
||||
" @vimlint(EVL103, 1, a:CursorPos)
|
||||
function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
|
||||
if a:CmdLine =~ '^\s\{0,\}\w\+$'
|
||||
if a:CmdLine =~? '^\s\{0,\}\w\+$'
|
||||
return s:COP.systemlist('compgen -c ' . a:CmdLine)
|
||||
endif
|
||||
let result = s:COP.systemlist([s:completer, a:CmdLine])
|
||||
@ -26,11 +29,11 @@ endfunction
|
||||
" this is for vim input()
|
||||
|
||||
function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
|
||||
if a:CmdLine =~ '^\s\{0,\}\w\+$'
|
||||
if a:CmdLine =~? '^\s\{0,\}\w\+$'
|
||||
return s:COP.systemlist('compgen -c ' . a:CmdLine)
|
||||
endif
|
||||
let result = s:COP.systemlist([s:completer, a:CmdLine])
|
||||
if a:ArgLead == ''
|
||||
if a:ArgLead ==# ''
|
||||
let result = map(result, 'a:CmdLine . v:val')
|
||||
else
|
||||
let leader = substitute(a:CmdLine, '[^ ]*$', '', 'g')
|
||||
@ -39,9 +42,12 @@ function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
|
||||
return result
|
||||
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:ArgLead)
|
||||
" @vimlint(EVL103, 0, a:CmdLine)
|
||||
" @vimlint(EVL103, 0, a:CursorPos)
|
||||
|
||||
|
||||
function! SpaceVim#api#bash#complete#get()
|
||||
function! SpaceVim#api#bash#complete#get() abort
|
||||
|
||||
return deepcopy(s:self)
|
||||
|
||||
|
@ -69,7 +69,7 @@ endfunction
|
||||
|
||||
function! s:self.str2nr(str) abort
|
||||
let nr = get(self._deps.swap(self._color_map), a:str, -1)
|
||||
if nr =~ 'fg\|bg\|NONE'
|
||||
if nr =~# 'fg\|bg\|NONE'
|
||||
return nr
|
||||
else
|
||||
return str2nr(nr)
|
||||
|
@ -60,7 +60,7 @@ function! s:pop(list) abort
|
||||
return remove(a:list, -1)
|
||||
endfunction
|
||||
|
||||
function! s:listpart(list, start, ...)
|
||||
function! s:listpart(list, start, ...) abort
|
||||
let idx = range(a:start, a:start + get(a:000, 0, 0))
|
||||
let rst = []
|
||||
for i in idx
|
||||
@ -140,7 +140,7 @@ function! s:has_index(list, index) abort
|
||||
return 0 <= a:index && a:index < len(a:list)
|
||||
endfunction
|
||||
|
||||
function! s:replace(list, begin, end, re_list)
|
||||
function! s:replace(list, begin, end, re_list) abort
|
||||
if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list)
|
||||
return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:]
|
||||
else
|
||||
|
@ -23,7 +23,7 @@ function! s:self.battery_status(v) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#unicode#icon#get()
|
||||
function! SpaceVim#api#unicode#icon#get() abort
|
||||
|
||||
return deepcopy(s:self)
|
||||
|
||||
|
@ -61,9 +61,9 @@ function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
|
||||
let msg = 'ArgLead: ' . a:ArgLead . ' CmdLine: ' . a:CmdLine . ' CursorPos: '
|
||||
\ . a:CursorPos . ' LastArgv: ' . last_argv
|
||||
call add(self._message, msg)
|
||||
if a:ArgLead == '' && index(keys(self.options), last_argv) == -1
|
||||
if a:ArgLead ==# '' && index(keys(self.options), last_argv) == -1
|
||||
return join(keys(self.options), "\n")
|
||||
elseif a:ArgLead == '' && index(keys(self.options), last_argv) != -1
|
||||
elseif a:ArgLead ==# '' && index(keys(self.options), last_argv) != -1
|
||||
return self._complete_opt(a:ArgLead, last_argv)
|
||||
elseif !empty(a:ArgLead) && len(argvs) >= 3
|
||||
\ && index(keys(self.options), argvs[-2]) != -1
|
||||
@ -85,9 +85,9 @@ function! s:self.completelist(ArgLead, CmdLine, CursorPos) abort
|
||||
let msg = 'ArgLead: ' . a:ArgLead . ' CmdLine: ' . a:CmdLine . ' CursorPos: '
|
||||
\ . a:CursorPos . ' LastArgv: ' . last_argv
|
||||
call add(self._message, msg)
|
||||
if a:ArgLead == '' && index(keys(self.options), last_argv) == -1
|
||||
if a:ArgLead ==# '' && index(keys(self.options), last_argv) == -1
|
||||
return keys(self.options)
|
||||
elseif a:ArgLead == '' && index(keys(self.options), last_argv) != -1
|
||||
elseif a:ArgLead ==# '' && index(keys(self.options), last_argv) != -1
|
||||
return self._complete_opt_list(a:ArgLead, last_argv)
|
||||
elseif !empty(a:ArgLead) && len(argvs) >= 3
|
||||
\ && index(keys(self.options), argvs[-2]) != -1
|
||||
@ -108,7 +108,7 @@ endfunction
|
||||
|
||||
|
||||
|
||||
function! SpaceVim#api#vim#command#get()
|
||||
function! SpaceVim#api#vim#command#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
||||
|
||||
|
@ -33,6 +33,6 @@ function! s:self.nr2name(nr) abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#api#vim#key#get()
|
||||
function! SpaceVim#api#vim#key#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
||||
|
@ -30,7 +30,7 @@ function! s:self.get_tree() abort
|
||||
endfunction
|
||||
|
||||
function! s:self.realTabBuffers(id) abort
|
||||
return filter(copy(tabpagebuflist(a:id)), 'buflisted(v:val) && getbufvar(v:val, "&buftype") == ""')
|
||||
return filter(copy(tabpagebuflist(a:id)), 'buflisted(v:val) && getbufvar(v:val, "&buftype") ==# ""')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#tab#get() abort
|
||||
|
@ -90,7 +90,7 @@ function! SpaceVim#issue#new() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#issue#reopen(id)
|
||||
function! SpaceVim#issue#reopen(id) abort
|
||||
let issue = {
|
||||
\ 'state' : 'open'
|
||||
\ }
|
||||
|
@ -83,14 +83,14 @@ let s:last_file = ''
|
||||
let s:update_interval = 30
|
||||
let s:gtm_plugin_status = ''
|
||||
|
||||
function! s:record()
|
||||
function! s:record() abort
|
||||
let fpath = expand('%:p')
|
||||
" record if file path has changed or last update is greater than update_interval
|
||||
if (s:last_file != fpath || localtime() - s:last_update > s:update_interval) && filereadable(fpath)
|
||||
let s:cmd = (s:enable_gtm_status == 1 ? 'gtm record --status' : 'gtm record')
|
||||
let output=system(s:cmd . ' ' . shellescape(fpath))
|
||||
if v:shell_error
|
||||
echoerr s:no_gtm_err
|
||||
echoerr 'failed to run ' . s:cmd . ' ' . shellescape(fpath)
|
||||
else
|
||||
let s:gtm_plugin_status = (s:enable_gtm_status ? substitute(output, '\n\+$', '', '') : '')
|
||||
endif
|
||||
|
@ -14,7 +14,7 @@ endfunction
|
||||
|
||||
let s:BASE64 = SpaceVim#api#import('data#base64')
|
||||
|
||||
function! SpaceVim#layers#chat#config()
|
||||
function! SpaceVim#layers#chat#config() abort
|
||||
let g:chatting_server_ip = s:BASE64.decode('NDUuNzYuMTAwLjQ5')
|
||||
let g:chatting_server_port = 8989
|
||||
if !exists('g:chatting_server_lib')
|
||||
|
@ -145,7 +145,7 @@ function! SpaceVim#layers#core#banner#config() abort
|
||||
\ [
|
||||
\ '',
|
||||
\ '',
|
||||
\ " ######### ######### ######### ######### ################## ",
|
||||
\ ' ######### ######### ######### ######### ################## ',
|
||||
\ " ###(_)### [`\'`\'] ##\\`.\'/## \':v:` ##/\\:/\\## |:+:| ##\':v:`## \\`.\'/ ##[`\'`\']###\\`~\'/## \\`.\'/ ",
|
||||
\ " ###| |### |::| ##(o:o)## (o:0) #/(o:o)\\# (o:o) ##(o:0)## (o:o) ###|::|####(o o)## (o:o) ",
|
||||
\ " ###|_|### |::| ###\\:/:\\# (:) ###(:)### (:) ###(:)### \\:/:\\ ###|::|#####\\ / \\# \\:/:\\ ",
|
||||
|
@ -113,7 +113,7 @@ function! s:winnr(...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#winnr(id)
|
||||
function! SpaceVim#layers#core#statusline#winnr(id) abort
|
||||
return s:MESSLETTERS.circled_num(a:id, g:spacevim_windows_index_type)
|
||||
endfunction
|
||||
|
||||
@ -217,7 +217,7 @@ endfunction
|
||||
|
||||
|
||||
if g:spacevim_enable_neomake
|
||||
function! s:syntax_checking()
|
||||
function! s:syntax_checking() abort
|
||||
if !exists('g:loaded_neomake')
|
||||
return ''
|
||||
endif
|
||||
@ -229,7 +229,7 @@ if g:spacevim_enable_neomake
|
||||
return l
|
||||
endfunction
|
||||
elseif g:spacevim_enable_ale
|
||||
function! s:syntax_checking()
|
||||
function! s:syntax_checking() abort
|
||||
if !exists('g:ale_enabled')
|
||||
return ''
|
||||
endif
|
||||
@ -241,7 +241,7 @@ elseif g:spacevim_enable_ale
|
||||
return l
|
||||
endfunction
|
||||
else
|
||||
function! s:syntax_checking()
|
||||
function! s:syntax_checking() abort
|
||||
if !exists(':SyntasticCheck')
|
||||
return ''
|
||||
endif
|
||||
@ -288,13 +288,13 @@ let s:registed_sections = {
|
||||
|
||||
|
||||
function! s:check_mode() abort
|
||||
if mode() == 'n'
|
||||
if mode() ==# 'n'
|
||||
return 'n'
|
||||
elseif mode() =='i'
|
||||
elseif mode() ==# 'i'
|
||||
return 'i'
|
||||
elseif mode() =~ 'v'
|
||||
elseif mode() =~# 'v'
|
||||
return 'v'
|
||||
elseif mode() =~ 'R'
|
||||
elseif mode() =~# 'R'
|
||||
return 'R'
|
||||
endif
|
||||
endfunction
|
||||
@ -317,7 +317,7 @@ endfunction
|
||||
function! SpaceVim#layers#core#statusline#_current_tag() abort
|
||||
let tag = ''
|
||||
try
|
||||
let tag =tagbar#currenttag("%s ", "")
|
||||
let tag =tagbar#currenttag('%s ', '')
|
||||
catch
|
||||
endtry
|
||||
return tag
|
||||
@ -371,7 +371,7 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
elseif &filetype ==# 'gina-commit'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Gina commit %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
elseif &filetype ==# 'diff' && bufname('%') =~ '^gina://'
|
||||
elseif &filetype ==# 'diff' && bufname('%') =~# '^gina://'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Gina diff %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
elseif &filetype ==# 'nerdtree'
|
||||
@ -479,7 +479,7 @@ endfunction
|
||||
|
||||
function! s:inactive() abort
|
||||
let l = '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#'
|
||||
let secs = [s:filename(), " " . &filetype, s:modes()]
|
||||
let secs = [s:filename(), ' ' . &filetype, s:modes()]
|
||||
let base = 10
|
||||
for sec in secs
|
||||
let len = s:STATUSLINE.len(sec)
|
||||
@ -572,7 +572,7 @@ function! SpaceVim#layers#core#statusline#toggle_section(name) abort
|
||||
let s:section_old_pos[a:name] = ['l', index(s:loaded_sections_l, a:name)]
|
||||
call remove(s:loaded_sections_l, index(s:loaded_sections_l, a:name))
|
||||
elseif has_key(s:section_old_pos, a:name)
|
||||
if s:section_old_pos[a:name][0] == 'r'
|
||||
if s:section_old_pos[a:name][0] ==# 'r'
|
||||
call insert(s:loaded_sections_r, a:name, s:section_old_pos[a:name][1])
|
||||
else
|
||||
call insert(s:loaded_sections_l, a:name, s:section_old_pos[a:name][1])
|
||||
@ -581,7 +581,7 @@ function! SpaceVim#layers#core#statusline#toggle_section(name) abort
|
||||
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#rsep()
|
||||
function! SpaceVim#layers#core#statusline#rsep() abort
|
||||
return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
|
||||
endfunction
|
||||
|
||||
@ -656,12 +656,12 @@ function! SpaceVim#layers#core#statusline#jump(i) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#mode(mode)
|
||||
function! SpaceVim#layers#core#statusline#mode(mode) abort
|
||||
let t = s:colors_template
|
||||
let iedit_mode = get(w:, 'spacevim_iedit_mode', '')
|
||||
let mode = get(w:, 'spacevim_statusline_mode', '')
|
||||
if mode != a:mode
|
||||
if a:mode == 'n'
|
||||
if a:mode ==# 'n'
|
||||
if !empty(iedit_mode)
|
||||
if iedit_mode ==# 'n'
|
||||
exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[8][3] . ' ctermfg=' . t[8][2] . ' guibg=' . t[8][1] . ' guifg=' . t[8][0]
|
||||
@ -673,11 +673,11 @@ function! SpaceVim#layers#core#statusline#mode(mode)
|
||||
else
|
||||
exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
endif
|
||||
elseif a:mode == 'i'
|
||||
elseif a:mode ==# 'i'
|
||||
exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
|
||||
elseif a:mode == 'R'
|
||||
elseif a:mode ==# 'R'
|
||||
exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0]
|
||||
elseif a:mode == 'v' || a:mode == 'V' || a:mode == '' || a:mode == 's' || a:mode == 'S' || a:mode == ''
|
||||
elseif a:mode ==# 'v' || a:mode ==# 'V' || a:mode ==# '' || a:mode ==# 's' || a:mode ==# 'S' || a:mode ==# ''
|
||||
exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0]
|
||||
endif
|
||||
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
|
||||
@ -686,9 +686,9 @@ function! SpaceVim#layers#core#statusline#mode(mode)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#mode_text(mode)
|
||||
function! SpaceVim#layers#core#statusline#mode_text(mode) abort
|
||||
let iedit_mode = get(w:, 'spacevim_iedit_mode', '')
|
||||
if a:mode == 'n'
|
||||
if a:mode ==# 'n'
|
||||
if !empty(iedit_mode)
|
||||
if iedit_mode ==# 'n'
|
||||
return 'IEDIT-NORMAL'
|
||||
@ -697,9 +697,9 @@ function! SpaceVim#layers#core#statusline#mode_text(mode)
|
||||
endif
|
||||
endif
|
||||
return 'NORMAL'
|
||||
elseif a:mode == 'i'
|
||||
elseif a:mode ==# 'i'
|
||||
return 'INSERT'
|
||||
elseif a:mode == 'R'
|
||||
elseif a:mode ==# 'R'
|
||||
return 'REPLACE'
|
||||
elseif a:mode ==# 'v'
|
||||
return 'VISUAL'
|
||||
@ -711,19 +711,19 @@ function! SpaceVim#layers#core#statusline#mode_text(mode)
|
||||
return 'COMMAND'
|
||||
elseif a:mode ==# 't'
|
||||
return 'TERMINAL'
|
||||
elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S'
|
||||
elseif a:mode ==# 'v' || a:mode ==# 'V' || a:mode ==# '^V' || a:mode ==# 's' || a:mode ==# 'S' || a:mode ==# '^S'
|
||||
return 'VISUAL'
|
||||
endif
|
||||
return ' '
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#denite_mode()
|
||||
function! SpaceVim#layers#core#statusline#denite_mode() abort
|
||||
let t = s:colors_template
|
||||
let dmode = split(denite#get_status_mode())[1]
|
||||
if get(w:, 'spacevim_statusline_mode', '') != dmode
|
||||
if dmode == 'NORMAL'
|
||||
if dmode ==# 'NORMAL'
|
||||
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
elseif dmode == 'INSERT'
|
||||
elseif dmode ==# 'INSERT'
|
||||
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
|
||||
endif
|
||||
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
|
||||
@ -732,13 +732,13 @@ function! SpaceVim#layers#core#statusline#denite_mode()
|
||||
return dmode
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#unite_mode()
|
||||
function! SpaceVim#layers#core#statusline#unite_mode() abort
|
||||
let t = s:colors_template
|
||||
let dmode = mode()
|
||||
if get(w:, 'spacevim_statusline_mode', '') != dmode
|
||||
if dmode == 'n'
|
||||
if dmode ==# 'n'
|
||||
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
elseif dmode == 'i'
|
||||
elseif dmode ==# 'i'
|
||||
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
|
||||
endif
|
||||
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
|
||||
@ -747,7 +747,7 @@ function! SpaceVim#layers#core#statusline#unite_mode()
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#register_sections(name, func)
|
||||
function! SpaceVim#layers#core#statusline#register_sections(name, func) abort
|
||||
|
||||
if has_key(s:registed_sections, a:name)
|
||||
call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!')
|
||||
|
@ -395,11 +395,11 @@ function! s:set_justification_to(align) abort
|
||||
endfor
|
||||
|
||||
if a:align ==# 'left'
|
||||
execute l:startlinenr . "," . l:endlinenr . ":left\<cr>"
|
||||
execute l:startlinenr . ',' . l:endlinenr . ":left\<cr>"
|
||||
elseif a:align ==# 'center'
|
||||
execute l:startlinenr . "," . l:endlinenr . ":center " . l:maxlength . "\<cr>"
|
||||
execute l:startlinenr . ',' . l:endlinenr . ':center ' . l:maxlength . "\<cr>"
|
||||
elseif a:align ==# 'right'
|
||||
execute l:startlinenr . "," . l:endlinenr . ":right " . l:maxlength . "\<cr>"
|
||||
execute l:startlinenr . ',' . l:endlinenr . ':right ' . l:maxlength . "\<cr>"
|
||||
endif
|
||||
|
||||
unlet l:startlinenr
|
||||
|
@ -151,7 +151,7 @@ endfunction
|
||||
command! FzfFiles call <SID>files()
|
||||
function! s:files() abort
|
||||
let s:source = 'files'
|
||||
call fzf#run(fzf#wrap("files", {'sink': 'e', 'options': '--reverse', 'down' : '40%'}))
|
||||
call fzf#run(fzf#wrap('files', {'sink': 'e', 'options': '--reverse', 'down' : '40%'}))
|
||||
endfunction
|
||||
|
||||
let s:source = ''
|
||||
@ -171,14 +171,11 @@ function! s:bufopen(e) abort
|
||||
let [linenr, col, file_text] = [list[1], list[2]+1, join(list[3:])]
|
||||
let lines = getbufline(file_text, linenr)
|
||||
let path = file_text
|
||||
let bufnr = bufnr(file_text)
|
||||
if empty(lines)
|
||||
if stridx(join(split(getline(linenr))), file_text) == 0
|
||||
let lines = [file_text]
|
||||
let path = bufname('%')
|
||||
let bufnr = bufnr('%')
|
||||
elseif filereadable(path)
|
||||
let bufnr = 0
|
||||
let lines = ['buffer unloaded']
|
||||
else
|
||||
" Skip.
|
||||
@ -194,7 +191,7 @@ function! s:jumps() abort
|
||||
function! s:jumplist() abort
|
||||
return split(s:CMP.execute('jumps'), '\n')[1:]
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("jumps", {
|
||||
call fzf#run(fzf#wrap('jumps', {
|
||||
\ 'source': reverse(<sid>jumplist()),
|
||||
\ 'sink': function('s:bufopen'),
|
||||
\ 'options': '+m',
|
||||
@ -213,7 +210,7 @@ function! s:message() abort
|
||||
function! s:messagelist() abort
|
||||
return split(s:CMP.execute('message'), '\n')
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("messages", {
|
||||
call fzf#run(fzf#wrap('messages', {
|
||||
\ 'source': reverse(<sid>messagelist()),
|
||||
\ 'sink': function('s:yankmessage'),
|
||||
\ 'options': '+m',
|
||||
@ -238,7 +235,7 @@ function! s:quickfix() abort
|
||||
function! s:quickfix_list() abort
|
||||
return map(getqflist(), 's:quickfix_to_grep(v:val)')
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("quickfix", {
|
||||
call fzf#run(fzf#wrap('quickfix', {
|
||||
\ 'source': reverse(<sid>quickfix_list()),
|
||||
\ 'sink': function('s:open_quickfix_item'),
|
||||
\ 'options': '--reverse',
|
||||
@ -262,7 +259,7 @@ function! s:location_list() abort
|
||||
function! s:get_location_list() abort
|
||||
return map(getloclist(0), 's:location_list_to_grep(v:val)')
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("location_list", {
|
||||
call fzf#run(fzf#wrap('location_list', {
|
||||
\ 'source': reverse(<sid>get_location_list()),
|
||||
\ 'sink': function('s:open_location_item'),
|
||||
\ 'options': '--reverse',
|
||||
@ -291,6 +288,7 @@ function! s:outline_source(tag_cmds) abort
|
||||
throw 'Save the file first'
|
||||
endif
|
||||
|
||||
let lines = []
|
||||
for cmd in a:tag_cmds
|
||||
let lines = split(system(cmd), "\n")
|
||||
if !v:shell_error
|
||||
@ -314,7 +312,6 @@ endfunction
|
||||
|
||||
function! s:outline(...) abort
|
||||
let s:source = 'outline'
|
||||
let args = copy(a:000)
|
||||
let tag_cmds = [
|
||||
\ printf('ctags -f - --sort=no --excmd=number --language-force=%s %s 2>/dev/null', &filetype, expand('%:S')),
|
||||
\ printf('ctags -f - --sort=no --excmd=number %s 2>/dev/null', expand('%:S'))]
|
||||
@ -337,7 +334,7 @@ function! s:register() abort
|
||||
function! s:registers_list() abort
|
||||
return split(s:CMP.execute('registers'), '\n')[1:]
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("registers", {
|
||||
call fzf#run(fzf#wrap('registers', {
|
||||
\ 'source': reverse(<sid>registers_list()),
|
||||
\ 'sink': function('s:yankregister'),
|
||||
\ 'options': '+m',
|
||||
@ -354,7 +351,7 @@ function! s:buffers() abort
|
||||
function! s:buffer_list() abort
|
||||
return split(s:CMP.execute('buffers'), '\n')
|
||||
endfunction
|
||||
call fzf#run(fzf#wrap("buffers", {
|
||||
call fzf#run(fzf#wrap('buffers', {
|
||||
\ 'source': reverse(<sid>buffer_list()),
|
||||
\ 'sink': function('s:open_buffer'),
|
||||
\ 'options': '+m',
|
||||
@ -364,7 +361,7 @@ endfunction
|
||||
|
||||
let s:ansi = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36}
|
||||
|
||||
function! s:get_color(attr, ...)
|
||||
function! s:get_color(attr, ...) abort
|
||||
let gui = has('termguicolors') && &termguicolors
|
||||
let fam = gui ? 'gui' : 'cterm'
|
||||
let pat = gui ? '^#[a-f0-9]\+' : '^[0-9]\+$'
|
||||
@ -376,15 +373,15 @@ function! s:get_color(attr, ...)
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
function! s:csi(color, fg)
|
||||
function! s:csi(color, fg) abort
|
||||
let prefix = a:fg ? '38;' : '48;'
|
||||
if a:color[0] == '#'
|
||||
if a:color[0] ==# '#'
|
||||
return prefix.'2;'.join(map([a:color[1:2], a:color[3:4], a:color[5:6]], 'str2nr(v:val, 16)'), ';')
|
||||
endif
|
||||
return prefix.'5;'.a:color
|
||||
endfunction
|
||||
|
||||
function! s:ansi(str, group, default, ...)
|
||||
function! s:ansi(str, group, default, ...) abort
|
||||
let fg = s:get_color('fg', a:group)
|
||||
let bg = s:get_color('bg', a:group)
|
||||
let color = s:csi(empty(fg) ? s:ansi[a:default] : fg, 1) .
|
||||
@ -392,12 +389,13 @@ function! s:ansi(str, group, default, ...)
|
||||
return printf("\x1b[%s%sm%s\x1b[m", color, a:0 ? ';1' : '', a:str)
|
||||
endfunction
|
||||
for s:color_name in keys(s:ansi)
|
||||
execute "function! s:".s:color_name."(str, ...)\n"
|
||||
execute 'function! s:'.s:color_name."(str, ...)\n"
|
||||
\ " return s:ansi(a:str, get(a:, 1, ''), '".s:color_name."')\n"
|
||||
\ "endfunction"
|
||||
\ 'endfunction'
|
||||
endfor
|
||||
function! s:helptag_sink(line)
|
||||
function! s:helptag_sink(line) abort
|
||||
let [tag, file, path] = split(a:line, "\t")[0:2]
|
||||
unlet file
|
||||
let rtp = fnamemodify(path, ':p:h:h')
|
||||
if stridx(&rtp, rtp) < 0
|
||||
execute 'set rtp+='. fnameescape(rtp)
|
||||
@ -405,7 +403,7 @@ function! s:helptag_sink(line)
|
||||
execute 'help' tag
|
||||
endfunction
|
||||
command! -nargs=? FzfHelpTags call <SID>helptags(<q-args>)
|
||||
function! s:helptags(...)
|
||||
function! s:helptags(...) abort
|
||||
let query = get(a:000, 0, '')
|
||||
if !executable('grep') || !executable('perl')
|
||||
call SpaceVim#logger#warn('FzfHelpTags command requires grep and perl')
|
||||
@ -417,9 +415,9 @@ function! s:helptags(...)
|
||||
silent! call delete(s:helptags_script)
|
||||
endif
|
||||
let s:helptags_script = tempname()
|
||||
call writefile(['/('.(s:SYS.isWindows ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('.s:green('%-40s', 'Label').'\t%s\t%s\n), $2, $3, $1)'], s:helptags_script)
|
||||
call writefile(['/('.(s:SYS.isWindows ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('. call('s:green', ['%-40s', 'Label']) . '\t%s\t%s\n), $2, $3, $1)'], s:helptags_script)
|
||||
let s:source = 'help'
|
||||
call fzf#run(fzf#wrap("helptags", {
|
||||
call fzf#run(fzf#wrap('helptags', {
|
||||
\ 'source': 'grep -H ".*" '.join(map(tags, 'shellescape(v:val)')).
|
||||
\ ' | perl -n '. shellescape(s:helptags_script).' | sort',
|
||||
\ 'sink': function('s:helptag_sink'),
|
||||
|
@ -15,7 +15,7 @@ function! SpaceVim#layers#lang#fsharp#plugins() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#lang#fsharp#config()
|
||||
function! SpaceVim#layers#lang#fsharp#config() abort
|
||||
call SpaceVim#plugins#repl#reg('fsharp', ['fsharpi', '--readline-'])
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings'))
|
||||
endfunction
|
||||
|
@ -117,46 +117,46 @@ function! SpaceVim#layers#lang#lisp#config() abort
|
||||
endfunction
|
||||
|
||||
|
||||
fu! s:lisp()
|
||||
fu! s:lisp() abort
|
||||
let g:_spacevim_mappings_space.l.c = {'name' : '+Connection Management'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'c'], "call VlimeConnectREPL()", 'Connect to Vlime server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 's'], "call VlimeSelectCurConnection()", 'Switch Vlime connections', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'd'], "call VlimeCloseCurConnection()", 'Disconnect', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'R'], "call VlimeRenameCurConnection()", 'Rename the current connection', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'c'], 'call VlimeConnectREPL()', 'Connect to Vlime server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 's'], 'call VlimeSelectCurConnection()', 'Switch Vlime connections', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'd'], 'call VlimeCloseCurConnection()', 'Disconnect', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'R'], 'call VlimeRenameCurConnection()', 'Rename the current connection', 1)
|
||||
|
||||
let g:_spacevim_mappings_space.l.r = {'name' : '+Server Management'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'r'], "call VlimeNewServer()", 'Run a new Vlime server and connect to it', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'v'], "call VlimeShowSelectedServer()", 'View the console output of a server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'R'], "call VlimeRenameSelectedServer()", 'Rename a server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'r'], 'call VlimeNewServer()', 'Run a new Vlime server and connect to it', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'v'], 'call VlimeShowSelectedServer()', 'View the console output of a server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'R'], 'call VlimeRenameSelectedServer()', 'Rename a server', 1)
|
||||
|
||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Sending Stuff To The REPL'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','s'], "call VlimeSendToREPL(vlime#ui#CurExprOrAtom())",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','s'], 'call VlimeSendToREPL(vlime#ui#CurExprOrAtom())',
|
||||
\ 'Send s-expr or atom under the cursor to REPL', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','e'], "call VlimeSendToREPL(vlime#ui#CurExpr())",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','e'], 'call VlimeSendToREPL(vlime#ui#CurExpr())',
|
||||
\ 'Send s-expr under the cursor to REPL', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','t'], "VlimeSendToREPL(vlime#ui#CurTopExpr())",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','t'], 'VlimeSendToREPL(vlime#ui#CurTopExpr())',
|
||||
\ 'Send to-level s-expr under the cursor to REPL', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','a'], "call VlimeSendToREPL(vlime#ui#CurAtom())",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','a'], 'call VlimeSendToREPL(vlime#ui#CurAtom())',
|
||||
\ 'Send atom under the cursor to REPL', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','i'], "call VlimeSendToREPL()",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s','i'], 'call VlimeSendToREPL()',
|
||||
\ 'Open vlime input buffer for REPL', 1)
|
||||
call SpaceVim#mapping#space#langSPC('vmap', ['l','s','v'], "call VlimeSendToREPL(vlime#ui#CurSelection())",
|
||||
call SpaceVim#mapping#space#langSPC('vmap', ['l','s','v'], 'call VlimeSendToREPL(vlime#ui#CurSelection())',
|
||||
\ 'Send the current selection to the REPL', 1)
|
||||
|
||||
let g:_spacevim_mappings_space.l.m = {'name' : '+Expanding Macros'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','m','l'], "call VlimeExpandMacro(vlime#ui#CurExpr(), v:false)",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','m','l'], 'call VlimeExpandMacro(vlime#ui#CurExpr(), v:false)',
|
||||
\ 'Expand the macro under the cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','m','a'], "call VlimeExpandMacro(vlime#ui#CurExpr(), v:true)",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','m','a'], 'call VlimeExpandMacro(vlime#ui#CurExpr(), v:true)',
|
||||
\ 'Expand the macro under the cursor and all nested macros', 1)
|
||||
|
||||
let g:_spacevim_mappings_space.l.o = {'name' : '+Compiling'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','o','e'], "call VlimeCompile(vlime#ui#CurExpr(v:true))",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','o','e'], 'call VlimeCompile(vlime#ui#CurExpr(v:true))',
|
||||
\ 'Compile the form under the cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','o','t'], "call VlimeCompile(vlime#ui#CurTopExpr(v:true))",
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','o','t'], 'call VlimeCompile(vlime#ui#CurTopExpr(v:true))',
|
||||
\ 'Compile the top-level form under the cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','o','f'], "call VlimeCompileFile(expand('%:p'))",
|
||||
\ 'Compile the current file', 1)
|
||||
call SpaceVim#mapping#space#langSPC('vmap', ['l','o','v'], "call VlimeCompile(vlime#ui#CurSelection(v:true))",
|
||||
call SpaceVim#mapping#space#langSPC('vmap', ['l','o','v'], 'call VlimeCompile(vlime#ui#CurSelection(v:true))',
|
||||
\ 'Compile the current selection', 1)
|
||||
|
||||
let g:_spacevim_mappings_space.l.x = {'name' : '+Cross references'}
|
||||
@ -220,23 +220,23 @@ fu! s:lisp()
|
||||
\ 'Prompt for the expression to inspect', 1)
|
||||
endf
|
||||
|
||||
fu! s:vlime_sldb()
|
||||
fu! s:vlime_sldb() abort
|
||||
endf
|
||||
fu! s:vlime_repl()
|
||||
fu! s:vlime_repl() abort
|
||||
endf
|
||||
fu! s:vlime_inspector()
|
||||
fu! s:vlime_inspector() abort
|
||||
endf
|
||||
fu! s:vlime_xref()
|
||||
fu! s:vlime_xref() abort
|
||||
endf
|
||||
fu! s:vlime_notes()
|
||||
fu! s:vlime_notes() abort
|
||||
endf
|
||||
fu! s:vlime_threads()
|
||||
fu! s:vlime_threads() abort
|
||||
endf
|
||||
fu! s:vlime_server()
|
||||
fu! s:vlime_server() abort
|
||||
endf
|
||||
fu! s:vlime_preview()
|
||||
fu! s:vlime_preview() abort
|
||||
endf
|
||||
fu! s:vlime_arglist()
|
||||
fu! s:vlime_arglist() abort
|
||||
endf
|
||||
fu! s:vlime_input()
|
||||
fu! s:vlime_input() abort
|
||||
endf
|
||||
|
@ -38,8 +38,8 @@ function! SpaceVim#layers#lang#markdown#config() abort
|
||||
let g:markdown_enable_insert_mode_leader_mappings = 0
|
||||
let g:markdown_enable_spell_checking = 0
|
||||
let g:markdown_quote_syntax_filetypes = {
|
||||
\ "vim" : {
|
||||
\ "start" : "\\%(vim\\|viml\\)",
|
||||
\ 'vim' : {
|
||||
\ 'start' : "\\%(vim\\|viml\\)",
|
||||
\},
|
||||
\}
|
||||
let remarkrc = s:generate_remarkrc()
|
||||
@ -71,8 +71,8 @@ function! s:mappings() abort
|
||||
let g:_spacevim_mappings_space = {}
|
||||
endif
|
||||
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','ft'], "Tabularize /|", 'Format table under cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','p'], "MarkdownPreview", 'Real-time markdown preview', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','ft'], 'Tabularize /|', 'Format table under cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','p'], 'MarkdownPreview', 'Real-time markdown preview', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','k'], '<plug>(markdown-insert-link)', 'add link url', 0, 1)
|
||||
endfunction
|
||||
|
||||
|
@ -17,7 +17,7 @@ function! SpaceVim#layers#lang#sh#plugins() abort
|
||||
return l:plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sh#config()
|
||||
function! SpaceVim#layers#lang#sh#config() abort
|
||||
" chrisbra/vim-zsh {{{
|
||||
let g:zsh_fold_enable = 1
|
||||
" }}}
|
||||
|
@ -19,12 +19,12 @@ function! SpaceVim#layers#lang#vim#plugins() abort
|
||||
call add(plugins,['tweekmonster/exception.vim', {'merged' : 0}])
|
||||
call add(plugins,['mhinz/vim-lookup', {'merged' : 0}])
|
||||
call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}])
|
||||
if g:spacevim_autocomplete_method == 'asyncomplete'
|
||||
if g:spacevim_autocomplete_method ==# 'asyncomplete'
|
||||
call add(plugins, ['prabirshrestha/asyncomplete-necovim.vim', {
|
||||
\ 'loadconf' : 1,
|
||||
\ 'merged' : 0,
|
||||
\ }])
|
||||
elseif g:spacevim_autocomplete_method == 'coc'
|
||||
elseif g:spacevim_autocomplete_method ==# 'coc'
|
||||
call add(plugins, ['neoclide/coc-neco', {'merged' : 0}])
|
||||
endif
|
||||
call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}])
|
||||
|
@ -9,7 +9,7 @@
|
||||
function! SpaceVim#layers#lsp#plugins() abort
|
||||
let plugins = []
|
||||
|
||||
if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_method") ==# 'coc'
|
||||
if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc'
|
||||
" nop
|
||||
elseif has('nvim')
|
||||
call add(plugins, ['autozimu/LanguageClient-neovim',
|
||||
|
@ -13,6 +13,6 @@ function! SpaceVim#layers#mail#plugins() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#mail#config()
|
||||
function! SpaceVim#layers#mail#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['a', 'm'], 'call mail#client#open()', 'Start mail client', 1)
|
||||
endfunction
|
||||
|
@ -175,7 +175,7 @@ function! s:open_default_shell(open_with_file_cwd) abort
|
||||
endif
|
||||
for open_terminal in s:open_terminals_buffers
|
||||
if bufexists(open_terminal)
|
||||
if getbufvar(open_terminal, "_spacevim_shell_cwd") ==# l:path
|
||||
if getbufvar(open_terminal, '_spacevim_shell_cwd') ==# l:path
|
||||
exe 'silent b' . open_terminal
|
||||
" clear the message
|
||||
if has('nvim')
|
||||
@ -213,8 +213,8 @@ function! s:open_default_shell(open_with_file_cwd) abort
|
||||
stopinsert
|
||||
startinsert
|
||||
endif
|
||||
let l:term_buf_nr = bufnr('%')
|
||||
call extend(s:shell_cached_br, {getcwd() : l:term_buf_nr})
|
||||
let s:term_buf_nr = bufnr('%')
|
||||
call extend(s:shell_cached_br, {getcwd() : s:term_buf_nr})
|
||||
else
|
||||
" handle vim terminal
|
||||
if s:SYSTEM.isWindows
|
||||
@ -222,9 +222,9 @@ function! s:open_default_shell(open_with_file_cwd) abort
|
||||
else
|
||||
let shell = empty($SHELL) ? 'bash' : $SHELL
|
||||
endif
|
||||
let l:term_buf_nr = term_start(shell, {'cwd': l:path, 'curwin' : 1, 'term_finish' : 'close'})
|
||||
let s:term_buf_nr = term_start(shell, {'cwd': l:path, 'curwin' : 1, 'term_finish' : 'close'})
|
||||
endif
|
||||
call add(s:open_terminals_buffers, l:term_buf_nr)
|
||||
call add(s:open_terminals_buffers, s:term_buf_nr)
|
||||
let b:_spacevim_shell = shell
|
||||
let b:_spacevim_shell_cwd = l:path
|
||||
|
||||
@ -247,7 +247,7 @@ function! s:open_default_shell(open_with_file_cwd) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#shell#close_terminal()
|
||||
function! SpaceVim#layers#shell#close_terminal() abort
|
||||
for terminal_bufnr in s:open_terminals_buffers
|
||||
if bufexists(terminal_bufnr)
|
||||
exe 'silent bd!' . terminal_bufnr
|
||||
|
@ -49,7 +49,7 @@ endfunction
|
||||
|
||||
function! MyTagfuncBack() abort
|
||||
if exists('s:MyTagfunc_flag')&&s:MyTagfunc_flag
|
||||
exe "normal! `H"
|
||||
exe 'normal! `H'
|
||||
let s:MyTagfunc_flag =0
|
||||
endif
|
||||
endfunction
|
||||
|
@ -9,7 +9,7 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_method") ==# 'coc'
|
||||
if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc'
|
||||
" use coc.nvim
|
||||
let s:coc_language_servers = {}
|
||||
let s:coc_language_servers_key_id_map = {}
|
||||
@ -30,7 +30,7 @@ if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_me
|
||||
" actually the same.
|
||||
" We need to keep an id to distinguish among conflicting keys.
|
||||
|
||||
if stridx(a:cmds[0], ".") >= 0
|
||||
if stridx(a:cmds[0], '.') >= 0
|
||||
let l:key = split(a:cmds[0], "\\.")[-1]
|
||||
else
|
||||
let l:key = a:cmds[0]
|
||||
@ -52,23 +52,26 @@ if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_me
|
||||
|
||||
let s:coc_language_servers_key_id_map[l:key] = s:coc_language_servers_key_id_map[l:key] + 1
|
||||
|
||||
augroup spacevim_lsp_layer
|
||||
autocmd!
|
||||
autocmd! User CocNvimInit :call coc#config("languageserver", s:coc_language_servers)
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#lsp#show_doc() abort
|
||||
call CocActionAsync("doHover")
|
||||
call CocActionAsync('doHover')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#lsp#go_to_def() abort
|
||||
call CocActionAsync("jumpDefinition")
|
||||
call CocActionAsync('jumpDefinition')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#lsp#rename() abort
|
||||
call CocActionAsync("rename")
|
||||
call CocActionAsync('rename')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#lsp#references() abort
|
||||
call CocActionAsync("jumpReferences")
|
||||
call CocActionAsync('jumpReferences')
|
||||
endfunction
|
||||
elseif has('nvim')
|
||||
" use LanguageClient-neovim
|
||||
@ -94,11 +97,11 @@ elseif has('nvim')
|
||||
else
|
||||
" use vim-lsp
|
||||
function! SpaceVim#lsp#reg_server(ft, cmds) abort
|
||||
exe "au User lsp_setup call lsp#register_server({"
|
||||
exe 'au User lsp_setup call lsp#register_server({'
|
||||
\ . "'name': 'LSP',"
|
||||
\ . "'cmd': {server_info -> " . string(a:cmds) . "},"
|
||||
\ . "'cmd': {server_info -> " . string(a:cmds) . '},'
|
||||
\ . "'whitelist': ['" . a:ft . "' ],"
|
||||
\ . "})"
|
||||
\ . '})'
|
||||
exe 'autocmd FileType ' . a:ft . ' setlocal omnifunc=lsp#complete'
|
||||
endfunction
|
||||
|
||||
|
@ -175,7 +175,7 @@ function! SpaceVim#mapping#close_current_buffer() abort
|
||||
endif
|
||||
endif
|
||||
|
||||
if &buftype == 'terminal'
|
||||
if &buftype ==# 'terminal'
|
||||
exe 'bd!'
|
||||
return
|
||||
endif
|
||||
@ -252,7 +252,7 @@ function! SpaceVim#mapping#menu(desc, key, cmd) abort
|
||||
\ a:cmd])
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#clear_saved_buffers()
|
||||
function! SpaceVim#mapping#clear_saved_buffers() abort
|
||||
call s:BUFFER.filter_do(
|
||||
\ {
|
||||
\ 'expr' : [
|
||||
|
@ -17,7 +17,7 @@ function! SpaceVim#mapping#g#init() abort
|
||||
|
||||
let g:_spacevim_mappings_g["'"] = ['call feedkeys("g' . "'" . '", "n")', 'jump to mark']
|
||||
nnoremap g' g'
|
||||
let g:_spacevim_mappings_g["`"] = ['call feedkeys("g' . "`" . '", "n")', 'jump to mark']
|
||||
let g:_spacevim_mappings_g['`'] = ['call feedkeys("g' . '`' . '", "n")', 'jump to mark']
|
||||
nnoremap g` g`
|
||||
|
||||
let g:_spacevim_mappings_g['+'] = ['call feedkeys("g+", "n")', 'newer text state']
|
||||
|
@ -14,11 +14,11 @@ scriptencoding utf-8
|
||||
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
function! SpaceVim#mapping#guide#has_configuration() "{{{
|
||||
function! SpaceVim#mapping#guide#has_configuration() abort "{{{
|
||||
return exists('s:desc_lookup')
|
||||
endfunction "}}}
|
||||
|
||||
function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) " {{{
|
||||
function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) abort " {{{
|
||||
let key = a:key ==? '<Space>' ? ' ' : a:key
|
||||
if !exists('s:desc_lookup')
|
||||
call s:create_cache()
|
||||
@ -31,11 +31,11 @@ function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) " {
|
||||
let s:desc_lookup[key] = a:dictname
|
||||
endif
|
||||
endfunction "}}}
|
||||
function! s:create_cache() " {{{
|
||||
function! s:create_cache() abort " {{{
|
||||
let s:desc_lookup = {}
|
||||
let s:cached_dicts = {}
|
||||
endfunction " }}}
|
||||
function! s:create_target_dict(key) " {{{
|
||||
function! s:create_target_dict(key) abort " {{{
|
||||
if has_key(s:desc_lookup, 'top')
|
||||
let toplevel = deepcopy({s:desc_lookup['top']})
|
||||
let tardict = s:toplevel ? toplevel : get(toplevel, a:key, {})
|
||||
@ -50,7 +50,7 @@ function! s:create_target_dict(key) " {{{
|
||||
endif
|
||||
return tardict
|
||||
endfunction " }}}
|
||||
function! s:merge(dict_t, dict_o) " {{{
|
||||
function! s:merge(dict_t, dict_o) abort " {{{
|
||||
let target = a:dict_t
|
||||
let other = a:dict_o
|
||||
for k in keys(target)
|
||||
@ -65,50 +65,50 @@ function! s:merge(dict_t, dict_o) " {{{
|
||||
let target[k.'m'] = target[k]
|
||||
endif
|
||||
let target[k] = other[k]
|
||||
if has_key(other, k."m") && type(other[k."m"]) == type({})
|
||||
call s:merge(target[k."m"], other[k."m"])
|
||||
if has_key(other, k.'m') && type(other[k.'m']) == type({})
|
||||
call s:merge(target[k.'m'], other[k.'m'])
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
call extend(target, other, "keep")
|
||||
call extend(target, other, 'keep')
|
||||
endfunction " }}}
|
||||
|
||||
" @vimlint(EVL103, 1, a:dictname)
|
||||
function! SpaceVim#mapping#guide#populate_dictionary(key, dictname) " {{{
|
||||
function! SpaceVim#mapping#guide#populate_dictionary(key, dictname) abort " {{{
|
||||
call s:start_parser(a:key, s:cached_dicts[a:key])
|
||||
endfunction " }}}
|
||||
" @vimlint(EVL103, 0, a:dictname)
|
||||
|
||||
function! SpaceVim#mapping#guide#parse_mappings() " {{{
|
||||
function! SpaceVim#mapping#guide#parse_mappings() abort " {{{
|
||||
for [k, v] in items(s:cached_dicts)
|
||||
call s:start_parser(k, v)
|
||||
endfor
|
||||
endfunction " }}}
|
||||
|
||||
|
||||
function! s:start_parser(key, dict) " {{{
|
||||
function! s:start_parser(key, dict) abort " {{{
|
||||
if a:key ==# '[KEYs]'
|
||||
return
|
||||
endif
|
||||
let key = a:key ==? ' ' ? "<Space>" : a:key
|
||||
let key = a:key ==? ' ' ? '<Space>' : a:key
|
||||
|
||||
0verbose let readmap = s:CMP.execute('map ' . key, 'silent')
|
||||
|
||||
let lines = split(readmap, "\n")
|
||||
let visual = s:vis == "gv" ? 1 : 0
|
||||
let visual = s:vis ==# 'gv' ? 1 : 0
|
||||
|
||||
for line in lines
|
||||
let mapd = maparg(split(line[3:])[0], line[0], 0, 1)
|
||||
if mapd.lhs == '\\'
|
||||
if mapd.lhs ==# '\\'
|
||||
echom string(mapd)
|
||||
let mapd.feedkeyargs = ""
|
||||
let mapd.feedkeyargs = ''
|
||||
elseif mapd.noremap == 1
|
||||
let mapd.feedkeyargs = "nt"
|
||||
let mapd.feedkeyargs = 'nt'
|
||||
else
|
||||
let mapd.feedkeyargs = "mt"
|
||||
let mapd.feedkeyargs = 'mt'
|
||||
endif
|
||||
if mapd.lhs =~ '<Plug>.*' || mapd.lhs =~ '<SNR>.*'
|
||||
if mapd.lhs =~# '<Plug>.*' || mapd.lhs =~# '<SNR>.*'
|
||||
continue
|
||||
endif
|
||||
let mapd.display = s:format_displaystring(mapd.rhs)
|
||||
@ -116,17 +116,17 @@ function! s:start_parser(key, dict) " {{{
|
||||
let mapd.lhs = substitute(mapd.lhs, '<Space>', ' ', 'g')
|
||||
let mapd.lhs = substitute(mapd.lhs, '<Tab>', '<C-I>', 'g')
|
||||
let mapd.rhs = substitute(mapd.rhs, '<SID>', '<SNR>'.mapd['sid'].'_', 'g')
|
||||
if mapd.lhs != '' && mapd.display !~# 'LeaderGuide.*'
|
||||
if mapd.lhs !=# '' && mapd.display !~# 'LeaderGuide.*'
|
||||
let mapd.lhs = s:string_to_keys(mapd.lhs)
|
||||
if (visual && match(mapd.mode, "[vx ]") >= 0) ||
|
||||
\ (!visual && match(mapd.mode, "[vx]") == -1)
|
||||
if (visual && match(mapd.mode, '[vx ]') >= 0) ||
|
||||
\ (!visual && match(mapd.mode, '[vx]') == -1)
|
||||
call s:add_map_to_dict(mapd, 0, a:dict)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfunction " }}}
|
||||
|
||||
function! s:add_map_to_dict(map, level, dict) " {{{
|
||||
function! s:add_map_to_dict(map, level, dict) abort " {{{
|
||||
if len(a:map.lhs) > a:level+1
|
||||
let curkey = a:map.lhs[a:level]
|
||||
let nlevel = a:level+1
|
||||
@ -142,7 +142,7 @@ function! s:add_map_to_dict(map, level, dict) " {{{
|
||||
endif
|
||||
elseif type(a:dict[curkey]) == type([]) && g:leaderGuide_flatten == 0
|
||||
let cmd = s:escape_mappings(a:map)
|
||||
let curkey = curkey."m"
|
||||
let curkey = curkey.'m'
|
||||
if !has_key(a:dict, curkey)
|
||||
let a:dict[curkey] = { 'name' : g:leaderGuide_default_group_name }
|
||||
endif
|
||||
@ -166,7 +166,7 @@ function! s:add_map_to_dict(map, level, dict) " {{{
|
||||
endif
|
||||
endfunction " }}}
|
||||
" @vimlint(EVL111, 1, Fun)
|
||||
function! s:format_displaystring(map) " {{{
|
||||
function! s:format_displaystring(map) abort " {{{
|
||||
let g:leaderGuide#displayname = a:map
|
||||
for Fun in g:leaderGuide_displayfunc
|
||||
call Fun()
|
||||
@ -176,7 +176,7 @@ function! s:format_displaystring(map) " {{{
|
||||
return display
|
||||
endfunction " }}}
|
||||
" @vimlint(EVL111, 0, Fun)
|
||||
function! s:flattenmap(dict, str) " {{{
|
||||
function! s:flattenmap(dict, str) abort " {{{
|
||||
let ret = {}
|
||||
for kv in keys(a:dict)
|
||||
if type(a:dict[kv]) == type([])
|
||||
@ -191,14 +191,14 @@ function! s:flattenmap(dict, str) " {{{
|
||||
endfunction " }}}
|
||||
|
||||
|
||||
function! s:escape_mappings(mapping) " {{{
|
||||
function! s:escape_mappings(mapping) abort " {{{
|
||||
let rstring = substitute(a:mapping.rhs, '\', '\\\\', 'g')
|
||||
let rstring = substitute(rstring, '<\([^<>]*\)>', '\\<\1>', 'g')
|
||||
let rstring = substitute(rstring, '"', '\\"', 'g')
|
||||
let rstring = 'call feedkeys("'.rstring.'", "'.a:mapping.feedkeyargs.'")'
|
||||
return rstring
|
||||
endfunction " }}}
|
||||
function! s:string_to_keys(input) " {{{
|
||||
function! s:string_to_keys(input) abort " {{{
|
||||
" Avoid special case: <>
|
||||
let retlist = []
|
||||
if match(a:input, '<.\+>') != -1
|
||||
@ -232,13 +232,13 @@ function! s:string_to_keys(input) " {{{
|
||||
endif
|
||||
return retlist
|
||||
endfunction " }}}
|
||||
function! s:escape_keys(inp) " {{{
|
||||
let ret = substitute(a:inp, "<", "<lt>", "")
|
||||
return substitute(ret, "|", "<Bar>", "")
|
||||
function! s:escape_keys(inp) abort " {{{
|
||||
let ret = substitute(a:inp, '<', '<lt>', '')
|
||||
return substitute(ret, '|', '<Bar>', '')
|
||||
endfunction " }}}
|
||||
|
||||
|
||||
function! s:calc_layout() " {{{
|
||||
function! s:calc_layout() abort " {{{
|
||||
let ret = {}
|
||||
let smap = filter(copy(s:lmap), 'v:key !=# "name"')
|
||||
let ret.n_items = len(smap)
|
||||
@ -260,7 +260,7 @@ function! s:calc_layout() " {{{
|
||||
endif
|
||||
return ret
|
||||
endfunction " }}}
|
||||
function! s:create_string(layout) " {{{
|
||||
function! s:create_string(layout) abort " {{{
|
||||
let l = a:layout
|
||||
let l.capacity = l.n_rows * l.n_cols
|
||||
let overcap = l.capacity - l.n_items
|
||||
@ -273,7 +273,7 @@ function! s:create_string(layout) " {{{
|
||||
let smap = sort(filter(keys(s:lmap), 'v:val !=# "name"'),'1')
|
||||
for k in smap
|
||||
let desc = type(s:lmap[k]) == type({}) ? s:lmap[k].name : s:lmap[k][1]
|
||||
let displaystring = "[". k ."] ".desc
|
||||
let displaystring = '['. k .'] '.desc
|
||||
let crow = get(rows, row, [])
|
||||
if empty(crow)
|
||||
call add(rows, crow)
|
||||
@ -301,7 +301,7 @@ function! s:create_string(layout) " {{{
|
||||
let col += 1
|
||||
endif
|
||||
endif
|
||||
silent execute "cnoremap <nowait> <buffer> ".substitute(k, "|", "<Bar>", ""). " " . s:escape_keys(k) ."<CR>"
|
||||
silent execute 'cnoremap <nowait> <buffer> '.substitute(k, '|', '<Bar>', ''). ' ' . s:escape_keys(k) .'<CR>'
|
||||
endfor
|
||||
let r = []
|
||||
let mlen = 0
|
||||
@ -330,7 +330,7 @@ function! s:highlight_cursor() abort
|
||||
\ }
|
||||
hi! def link SpaceVimGuideCursor Cursor
|
||||
call s:VIMH.hi(info)
|
||||
if s:vis == 'gv'
|
||||
if s:vis ==# 'gv'
|
||||
" [bufnum, lnum, col, off]
|
||||
let begin = getpos("'<")
|
||||
let end = getpos("'>")
|
||||
@ -358,7 +358,7 @@ function! s:remove_cursor_highlight() abort
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL102, 1, l:string)
|
||||
function! s:start_buffer() " {{{
|
||||
function! s:start_buffer() abort " {{{
|
||||
let s:winv = winsaveview()
|
||||
let s:winnr = winnr()
|
||||
let s:winres = winrestcmd()
|
||||
@ -379,14 +379,14 @@ function! s:start_buffer() " {{{
|
||||
silent 1put!=string
|
||||
normal! gg"_dd
|
||||
setlocal nomodifiable
|
||||
if empty(maparg("<c-c>", "c", 0, 1))
|
||||
if empty(maparg('<c-c>', 'c', 0, 1))
|
||||
execute 'cnoremap <nowait> <silent> <buffer> <c-c> <esc>'
|
||||
endif
|
||||
call s:wait_for_input()
|
||||
endfunction " }}}
|
||||
" @vimlint(EVL102, 0, l:string)
|
||||
|
||||
function! s:handle_input(input) " {{{
|
||||
function! s:handle_input(input) abort " {{{
|
||||
call s:winclose()
|
||||
if type(a:input) ==? type({})
|
||||
let s:lmap = a:input
|
||||
@ -403,20 +403,20 @@ function! s:handle_input(input) " {{{
|
||||
endtry
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! s:wait_for_input() " {{{
|
||||
function! s:wait_for_input() abort " {{{
|
||||
redraw!
|
||||
let inp = input("")
|
||||
let inp = input('')
|
||||
if inp ==? ''
|
||||
let s:prefix_key_inp = ''
|
||||
call s:winclose()
|
||||
doautocmd WinEnter
|
||||
elseif match(inp, "^<LGCMD>paging_help") == 0
|
||||
elseif match(inp, '^<LGCMD>paging_help') == 0
|
||||
let s:guide_help_mode = 1
|
||||
call s:updateStatusline()
|
||||
redraw!
|
||||
call s:submode_mappings()
|
||||
else
|
||||
if inp == ' '
|
||||
if inp ==# ' '
|
||||
let inp = '[SPC]'
|
||||
endif
|
||||
let fsel = get(s:lmap, inp)
|
||||
@ -430,7 +430,7 @@ function! s:wait_for_input() " {{{
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! s:winopen() " {{{
|
||||
function! s:winopen() abort " {{{
|
||||
if !exists('s:bufnr')
|
||||
let s:bufnr = -1
|
||||
endif
|
||||
@ -450,7 +450,10 @@ function! s:winopen() " {{{
|
||||
let splitcmd = g:leaderGuide_vertical ? ' 1vnew' : ' 1new'
|
||||
noautocmd execute pos.splitcmd
|
||||
let s:bufnr = bufnr('%')
|
||||
augroup guide_autocmd
|
||||
autocmd!
|
||||
autocmd WinLeave <buffer> call s:winclose()
|
||||
augroup END
|
||||
endif
|
||||
let s:gwin = winnr()
|
||||
setlocal filetype=leaderGuide
|
||||
@ -497,7 +500,7 @@ function! s:toggle_hide_cursor() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:winclose() " {{{
|
||||
function! s:winclose() abort " {{{
|
||||
call s:toggle_hide_cursor()
|
||||
noautocmd execute s:gwin.'wincmd w'
|
||||
if s:gwin == winnr()
|
||||
@ -510,27 +513,27 @@ function! s:winclose() " {{{
|
||||
endif
|
||||
call s:remove_cursor_highlight()
|
||||
endfunction " }}}
|
||||
function! s:page_down() " {{{
|
||||
call feedkeys("\<c-c>", "n")
|
||||
call feedkeys("\<c-f>", "x")
|
||||
function! s:page_down() abort " {{{
|
||||
call feedkeys("\<c-c>", 'n')
|
||||
call feedkeys("\<c-f>", 'x')
|
||||
redraw!
|
||||
call s:wait_for_input()
|
||||
endfunction " }}}
|
||||
function! s:page_undo() " {{{
|
||||
function! s:page_undo() abort " {{{
|
||||
call s:winclose()
|
||||
let s:guide_group = {}
|
||||
let s:prefix_key_inp = ''
|
||||
let s:lmap = s:lmap_undo
|
||||
call s:start_buffer()
|
||||
endfunction " }}}
|
||||
function! s:page_up() " {{{
|
||||
call feedkeys("\<c-c>", "n")
|
||||
call feedkeys("\<c-b>", "x")
|
||||
function! s:page_up() abort " {{{
|
||||
call feedkeys("\<c-c>", 'n')
|
||||
call feedkeys("\<c-b>", 'x')
|
||||
redraw!
|
||||
call s:wait_for_input()
|
||||
endfunction " }}}
|
||||
|
||||
function! s:handle_submode_mapping(cmd) " {{{
|
||||
function! s:handle_submode_mapping(cmd) abort " {{{
|
||||
let s:guide_help_mode = 0
|
||||
call s:updateStatusline()
|
||||
if a:cmd ==? '<LGCMD>page_down'
|
||||
@ -542,15 +545,15 @@ function! s:handle_submode_mapping(cmd) " {{{
|
||||
elseif a:cmd ==? '<LGCMD>win_close'
|
||||
call s:winclose()
|
||||
else
|
||||
call feedkeys("\<c-c>", "n")
|
||||
call feedkeys("\<c-c>", 'n')
|
||||
redraw!
|
||||
call s:wait_for_input()
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! s:submode_mappings() " {{{
|
||||
function! s:submode_mappings() abort " {{{
|
||||
let maplist = []
|
||||
for key in items(g:leaderGuide_submode_mappings)
|
||||
let map = maparg(key[0], "c", 0, 1)
|
||||
let map = maparg(key[0], 'c', 0, 1)
|
||||
if !empty(map)
|
||||
call add(maplist, map)
|
||||
endif
|
||||
@ -562,7 +565,7 @@ function! s:submode_mappings() " {{{
|
||||
endfor
|
||||
silent call s:handle_submode_mapping(inp)
|
||||
endfunction " }}}
|
||||
function! s:mapmaparg(maparg) " {{{
|
||||
function! s:mapmaparg(maparg) abort " {{{
|
||||
let noremap = a:maparg.noremap ? 'noremap' : 'map'
|
||||
let buffer = a:maparg.buffer ? '<buffer> ' : ''
|
||||
let silent = a:maparg.silent ? '<silent> ' : ''
|
||||
@ -572,7 +575,7 @@ function! s:mapmaparg(maparg) " {{{
|
||||
execute st
|
||||
endfunction " }}}
|
||||
|
||||
function! s:get_register() "{{{
|
||||
function! s:get_register() abort "{{{
|
||||
if match(&clipboard, 'unnamedplus') >= 0
|
||||
let clip = '+'
|
||||
elseif match(&clipboard, 'unnamed') >= 0
|
||||
@ -582,8 +585,8 @@ function! s:get_register() "{{{
|
||||
endif
|
||||
return clip
|
||||
endfunction "}}}
|
||||
function! SpaceVim#mapping#guide#start_by_prefix(vis, key) " {{{
|
||||
if a:key == ' ' && exists('b:spacevim_lang_specified_mappings')
|
||||
function! SpaceVim#mapping#guide#start_by_prefix(vis, key) abort " {{{
|
||||
if a:key ==# ' ' && exists('b:spacevim_lang_specified_mappings')
|
||||
let g:_spacevim_mappings_space.l = b:spacevim_lang_specified_mappings
|
||||
endif
|
||||
let s:guide_help_mode = 0
|
||||
@ -615,20 +618,20 @@ function! SpaceVim#mapping#guide#start_by_prefix(vis, key) " {{{
|
||||
|
||||
call s:start_buffer()
|
||||
endfunction " }}}
|
||||
function! SpaceVim#mapping#guide#start(vis, dict) " {{{
|
||||
function! SpaceVim#mapping#guide#start(vis, dict) abort " {{{
|
||||
let s:vis = a:vis ? 'gv' : 0
|
||||
let s:lmap = a:dict
|
||||
call s:start_buffer()
|
||||
endfunction " }}}
|
||||
|
||||
if !exists("g:leaderGuide_displayfunc")
|
||||
function! s:leaderGuide_display()
|
||||
if !exists('g:leaderGuide_displayfunc')
|
||||
function! s:leaderGuide_display() abort
|
||||
let g:leaderGuide#displayname = substitute(g:leaderGuide#displayname, '\c<cr>$', '', '')
|
||||
endfunction
|
||||
let g:leaderGuide_displayfunc = [function("s:leaderGuide_display")]
|
||||
let g:leaderGuide_displayfunc = [function('s:leaderGuide_display')]
|
||||
endif
|
||||
|
||||
if get(g:, 'mapleader', '\') == ' '
|
||||
if get(g:, 'mapleader', '\') ==# ' '
|
||||
call SpaceVim#mapping#guide#register_prefix_descriptions(' ',
|
||||
\ 'g:_spacevim_mappings')
|
||||
else
|
||||
|
@ -6,44 +6,44 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
" Color palette
|
||||
let s:gui00 = "#151515"
|
||||
let s:gui01 = "#262626"
|
||||
let s:gui02 = "#4f5b66"
|
||||
let s:gui03 = "#65737e"
|
||||
let s:gui04 = "#a7adba"
|
||||
let s:gui05 = "#c0c5ce"
|
||||
let s:gui06 = "#cdd3de"
|
||||
let s:gui07 = "#d8dee9"
|
||||
let s:gui08 = "#870000"
|
||||
let s:gui09 = "#f99157"
|
||||
let s:gui0A = "#fac863"
|
||||
let s:gui0B = "#437019"
|
||||
let s:gui0C = "#5fb3b3"
|
||||
let s:gui0D = "#0d61ac"
|
||||
let s:gui0E = "#c594c5"
|
||||
let s:gui0F = "#ab7967"
|
||||
let s:gui00 = '#151515'
|
||||
let s:gui01 = '#262626'
|
||||
let s:gui02 = '#4f5b66'
|
||||
let s:gui03 = '#65737e'
|
||||
let s:gui04 = '#a7adba'
|
||||
let s:gui05 = '#c0c5ce'
|
||||
let s:gui06 = '#cdd3de'
|
||||
let s:gui07 = '#d8dee9'
|
||||
let s:gui08 = '#870000'
|
||||
let s:gui09 = '#f99157'
|
||||
let s:gui0A = '#fac863'
|
||||
let s:gui0B = '#437019'
|
||||
let s:gui0C = '#5fb3b3'
|
||||
let s:gui0D = '#0d61ac'
|
||||
let s:gui0E = '#c594c5'
|
||||
let s:gui0F = '#ab7967'
|
||||
|
||||
let s:cterm00 = "233"
|
||||
let s:cterm01 = "235"
|
||||
let s:cterm02 = "59"
|
||||
let s:cterm03 = "66"
|
||||
let s:cterm04 = "145"
|
||||
let s:cterm05 = "152"
|
||||
let s:cterm06 = "188"
|
||||
let s:cterm07 = "189"
|
||||
let s:cterm08 = "88"
|
||||
let s:cterm09 = "209"
|
||||
let s:cterm0A = "221"
|
||||
let s:cterm0B = "22"
|
||||
let s:cterm0C = "73"
|
||||
let s:cterm0D = "25"
|
||||
let s:cterm0E = "176"
|
||||
let s:cterm0F = "137"
|
||||
let s:cterm00 = '233'
|
||||
let s:cterm01 = '235'
|
||||
let s:cterm02 = '59'
|
||||
let s:cterm03 = '66'
|
||||
let s:cterm04 = '145'
|
||||
let s:cterm05 = '152'
|
||||
let s:cterm06 = '188'
|
||||
let s:cterm07 = '189'
|
||||
let s:cterm08 = '88'
|
||||
let s:cterm09 = '209'
|
||||
let s:cterm0A = '221'
|
||||
let s:cterm0B = '22'
|
||||
let s:cterm0C = '73'
|
||||
let s:cterm0D = '25'
|
||||
let s:cterm0E = '176'
|
||||
let s:cterm0F = '137'
|
||||
|
||||
let s:guiWhite = "#ffffff"
|
||||
let s:guiGray = "#666666"
|
||||
let s:ctermWhite = "231"
|
||||
let s:ctermGray = "243"
|
||||
let s:guiWhite = '#ffffff'
|
||||
let s:guiGray = '#666666'
|
||||
let s:ctermWhite = '231'
|
||||
let s:ctermGray = '243'
|
||||
|
||||
|
||||
function! SpaceVim#mapping#guide#theme#jellybeans#palette() abort
|
||||
|
@ -24,23 +24,23 @@
|
||||
" group_v: window id in visual mode
|
||||
" group_r: window id in select mode
|
||||
|
||||
let s:gui_base03 = "#002b36"
|
||||
let s:gui_base02 = "#073642"
|
||||
let s:gui_base01 = "#586e75"
|
||||
let s:gui_base00 = "#657b83"
|
||||
let s:gui_base0 = "#839496"
|
||||
let s:gui_base1 = "#93a1a1"
|
||||
let s:gui_base2 = "#eee8d5"
|
||||
let s:gui_base3 = "#fdf6e3"
|
||||
let s:gui_yellow = "#b58900"
|
||||
let s:gui_orange = "#cb4b16"
|
||||
let s:gui_red = "#dc322f"
|
||||
let s:gui_magenta = "#d33682"
|
||||
let s:gui_violet = "#6c71c4"
|
||||
let s:gui_blue = "#268bd2"
|
||||
let s:gui_cyan = "#2aa198"
|
||||
let s:gui_base03 = '#002b36'
|
||||
let s:gui_base02 = '#073642'
|
||||
let s:gui_base01 = '#586e75'
|
||||
let s:gui_base00 = '#657b83'
|
||||
let s:gui_base0 = '#839496'
|
||||
let s:gui_base1 = '#93a1a1'
|
||||
let s:gui_base2 = '#eee8d5'
|
||||
let s:gui_base3 = '#fdf6e3'
|
||||
let s:gui_yellow = '#b58900'
|
||||
let s:gui_orange = '#cb4b16'
|
||||
let s:gui_red = '#dc322f'
|
||||
let s:gui_magenta = '#d33682'
|
||||
let s:gui_violet = '#6c71c4'
|
||||
let s:gui_blue = '#268bd2'
|
||||
let s:gui_cyan = '#2aa198'
|
||||
"let s:gui_green = "#859900" "original
|
||||
let s:gui_green = "#719e07" "experimental
|
||||
let s:gui_green = '#719e07' "experimental
|
||||
|
||||
let s:cterm_base03 = 8
|
||||
let s:cterm_base02 = 0
|
||||
|
@ -172,13 +172,13 @@ endfunction
|
||||
|
||||
|
||||
function! SpaceVim#mapping#leader#getName(key) abort
|
||||
if a:key == ' '
|
||||
if a:key ==# ' '
|
||||
return '[SPC]'
|
||||
elseif a:key == 'g'
|
||||
elseif a:key ==# 'g'
|
||||
return '[g]'
|
||||
elseif a:key == 'z'
|
||||
elseif a:key ==# 'z'
|
||||
return '[z]'
|
||||
elseif a:key == g:spacevim_windows_leader
|
||||
elseif a:key ==# g:spacevim_windows_leader
|
||||
return '[WIN]'
|
||||
elseif a:key ==# '\'
|
||||
return '<leader>'
|
||||
|
@ -28,7 +28,7 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||
endif
|
||||
endfunction
|
||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
||||
function! SpaceVim#mapping#tab#expandable()
|
||||
function! SpaceVim#mapping#tab#expandable() abort
|
||||
let snippet = UltiSnips#ExpandSnippetOrJump()
|
||||
if g:ulti_expand_or_jump_res > 0
|
||||
return snippet
|
||||
|
@ -20,13 +20,13 @@ let s:conf = '.project_alt.json'
|
||||
|
||||
let s:project_config = {}
|
||||
|
||||
function! SpaceVim#plugins#a#set_config_name(name)
|
||||
function! SpaceVim#plugins#a#set_config_name(name) abort
|
||||
|
||||
let s:conf = a:name
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#a#alt()
|
||||
function! SpaceVim#plugins#a#alt() abort
|
||||
let conf_file = s:FILE.unify_path(s:conf, ':p')
|
||||
let file = s:FILE.unify_path(bufname('%'), ':.')
|
||||
let alt = SpaceVim#plugins#a#get_alt(file, conf_file)
|
||||
@ -70,7 +70,7 @@ function! Log() abort
|
||||
return s:project_config
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#a#get_alt(file, root)
|
||||
function! SpaceVim#plugins#a#get_alt(file, root) abort
|
||||
if !has_key(s:project_config, a:root)
|
||||
let altconfa = s:JSON.json_decode(join(readfile(a:root), "\n"))
|
||||
let s:project_config[a:root] = {}
|
||||
@ -84,7 +84,7 @@ function! SpaceVim#plugins#a#get_alt(file, root)
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#a#get_root()
|
||||
function! SpaceVim#plugins#a#get_root() abort
|
||||
return s:FILE.unify_path(s:conf, ':p')
|
||||
endfunction
|
||||
|
||||
|
@ -15,7 +15,7 @@ endif
|
||||
|
||||
" complete input
|
||||
|
||||
function! SpaceVim#plugins#bashcomplete#complete(ArgLead, CmdLine, CursorPos)
|
||||
function! SpaceVim#plugins#bashcomplete#complete(ArgLead, CmdLine, CursorPos) abort
|
||||
return s:BASH_COMPLETE.complete_input(a:ArgLead, a:CmdLine, a:CursorPos)
|
||||
endfunction
|
||||
|
||||
|
@ -77,7 +77,7 @@ function! s:get_search_cmd(expr) abort
|
||||
let cmd += [a:expr] + [s:grep_files]
|
||||
elseif !empty(s:grep_dir)
|
||||
" grep dir is not a empty string
|
||||
if s:grep_exe == 'findstr'
|
||||
if s:grep_exe ==# 'findstr'
|
||||
let cmd += [s:grep_dir] + [a:expr] + ['%CD%\*']
|
||||
else
|
||||
let cmd += [a:expr] + [s:grep_dir]
|
||||
@ -87,7 +87,7 @@ function! s:get_search_cmd(expr) abort
|
||||
" current directory.
|
||||
let cmd += [a:expr]
|
||||
" in window, when using rg, ag, need to add '.' at the end.
|
||||
if s:SYS.isWindows && (s:grep_exe == 'rg' || s:grep_exe == 'ag' || s:grep_exe == 'pt' )
|
||||
if s:SYS.isWindows && (s:grep_exe ==# 'rg' || s:grep_exe ==# 'ag' || s:grep_exe ==# 'pt' )
|
||||
let cmd += ['.']
|
||||
endif
|
||||
let cmd += s:grep_ropt
|
||||
@ -449,6 +449,7 @@ function! Test() abort
|
||||
return s:previewd_bufnrs
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL103, 1, a:timer)
|
||||
function! s:preview_timer(timer) abort
|
||||
for id in filter(s:previewd_bufnrs, 'bufexists(v:val) && buflisted(v:val)')
|
||||
exe 'silent bd ' . id
|
||||
@ -466,6 +467,7 @@ function! s:preview_timer(timer) abort
|
||||
resize 18
|
||||
call s:MPT._build_prompt()
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:timer)
|
||||
|
||||
|
||||
function! s:preview() abort
|
||||
@ -580,6 +582,7 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
|
||||
let save_tve = &t_ve
|
||||
setlocal t_ve=
|
||||
let cursor_hi = {}
|
||||
if has('gui_running')
|
||||
let cursor_hi = s:HI.group2dict('Cursor')
|
||||
call s:HI.hide_in_normal('Cursor')
|
||||
@ -603,9 +606,9 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort
|
||||
let s:grep_dir = ''
|
||||
endif
|
||||
let s:grep_exe = get(a:agrv, 'cmd', s:grep_default_exe)
|
||||
if empty(s:grep_dir) && empty(s:grep_files) && s:grep_exe == 'findstr'
|
||||
if empty(s:grep_dir) && empty(s:grep_files) && s:grep_exe ==# 'findstr'
|
||||
let s:grep_files = '*.*'
|
||||
elseif s:grep_exe == 'findstr' && !empty(s:grep_dir)
|
||||
elseif s:grep_exe ==# 'findstr' && !empty(s:grep_dir)
|
||||
let s:grep_dir = '/D:' . s:grep_dir
|
||||
endif
|
||||
let s:grep_opt = get(a:agrv, 'opt', s:grep_default_opt)
|
||||
|
@ -9,10 +9,10 @@
|
||||
let s:KEY = SpaceVim#api#import('vim#key')
|
||||
let s:key_describ = {}
|
||||
|
||||
function! SpaceVim#plugins#help#describe_bindings()
|
||||
function! SpaceVim#plugins#help#describe_bindings() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#help#regist_root(dict)
|
||||
function! SpaceVim#plugins#help#regist_root(dict) abort
|
||||
let keys = keys(a:dict)
|
||||
if type(a:dict) == 4 && len(keys) == 1
|
||||
call extend(s:key_describ, a:dict)
|
||||
@ -20,7 +20,7 @@ function! SpaceVim#plugins#help#regist_root(dict)
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#help#describe_key()
|
||||
function! SpaceVim#plugins#help#describe_key() abort
|
||||
let defined = 1
|
||||
let root = s:key_describ
|
||||
let prompt = 'Describe key:'
|
||||
|
@ -70,7 +70,7 @@ endfunction
|
||||
" stack cursor pos stack
|
||||
" <
|
||||
" if only argv 1 is given, use selected word as pattern
|
||||
function! SpaceVim#plugins#iedit#start(...)
|
||||
function! SpaceVim#plugins#iedit#start(...) abort
|
||||
let save_tve = &t_ve
|
||||
let save_cl = &l:cursorline
|
||||
setlocal nocursorline
|
||||
@ -112,7 +112,7 @@ function! SpaceVim#plugins#iedit#start(...)
|
||||
endif
|
||||
call s:highlight_cursor()
|
||||
redrawstatus!
|
||||
while s:mode != ''
|
||||
while s:mode !=# ''
|
||||
redraw!
|
||||
let char = getchar()
|
||||
if s:mode ==# 'n' && char == 27
|
||||
@ -176,7 +176,7 @@ function! s:handle_normal(char) abort
|
||||
let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g')
|
||||
endfor
|
||||
redrawstatus!
|
||||
elseif a:char == "\<Left>" || a:char == 104
|
||||
elseif a:char ==# "\<Left>" || a:char == 104
|
||||
for i in range(len(s:cursor_stack))
|
||||
if !empty(s:cursor_stack[i].begin)
|
||||
let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end
|
||||
@ -184,19 +184,19 @@ function! s:handle_normal(char) abort
|
||||
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g')
|
||||
endif
|
||||
endfor
|
||||
elseif a:char == "\<Right>" || a:char == 108
|
||||
elseif a:char ==# "\<Right>" || a:char == 108
|
||||
for i in range(len(s:cursor_stack))
|
||||
let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor
|
||||
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.')
|
||||
let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g')
|
||||
endfor
|
||||
elseif a:char == 48 || a:char == "\<Home>" " 0 or <Home>
|
||||
elseif a:char == 48 || a:char ==# "\<Home>" " 0 or <Home>
|
||||
for i in range(len(s:cursor_stack))
|
||||
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '^.')
|
||||
let s:cursor_stack[i].end = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '^.', '', 'g')
|
||||
let s:cursor_stack[i].begin = ''
|
||||
endfor
|
||||
elseif a:char == 36 || a:char == "\<End>" " $ or <End>
|
||||
elseif a:char == 36 || a:char ==# "\<End>" " $ or <End>
|
||||
for i in range(len(s:cursor_stack))
|
||||
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '.$')
|
||||
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '.$', '', 'g')
|
||||
@ -290,11 +290,11 @@ function! s:handle_insert(char) abort
|
||||
let s:cursor_stack[i].cursor = ''
|
||||
let s:cursor_stack[i].end = ''
|
||||
endfor
|
||||
elseif a:char == "\<bs>"
|
||||
elseif a:char ==# "\<bs>"
|
||||
for i in range(len(s:cursor_stack))
|
||||
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g')
|
||||
endfor
|
||||
elseif a:char == "\<Left>"
|
||||
elseif a:char ==# "\<Left>"
|
||||
for i in range(len(s:cursor_stack))
|
||||
if !empty(s:cursor_stack[i].begin)
|
||||
let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end
|
||||
@ -302,7 +302,7 @@ function! s:handle_insert(char) abort
|
||||
let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g')
|
||||
endif
|
||||
endfor
|
||||
elseif a:char == "\<Right>"
|
||||
elseif a:char ==# "\<Right>"
|
||||
for i in range(len(s:cursor_stack))
|
||||
let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor
|
||||
let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.')
|
||||
|
@ -32,7 +32,7 @@ if !exists('Pmd_Cmd')
|
||||
endif
|
||||
|
||||
if !exists('Pmd_Rulesets')
|
||||
let g:Pmd_Rulesets = ["-R", "java-basic,java-design", "-property", "xsltFilename=my-own.xs"]
|
||||
let g:Pmd_Rulesets = ['-R', 'java-basic,java-design', '-property', 'xsltFilename=my-own.xs']
|
||||
endif
|
||||
|
||||
if !exists('Pmd_silent_stderr')
|
||||
@ -91,7 +91,7 @@ endfunction
|
||||
" @vimlint(EVL103, 0, a:data)
|
||||
" @vimlint(EVL103, 0, a:event)
|
||||
|
||||
function! SpaceVim#plugins#pmd#run(...)
|
||||
function! SpaceVim#plugins#pmd#run(...) abort
|
||||
let argv = g:Pmd_Cmd + a:000
|
||||
if index(a:000, '-R') == -1
|
||||
let argv += g:Pmd_Rulesets
|
||||
@ -112,13 +112,13 @@ function! SpaceVim#plugins#pmd#run(...)
|
||||
\ )
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#pmd#debug()
|
||||
function! SpaceVim#plugins#pmd#debug() abort
|
||||
call s:CMD.debug()
|
||||
call s:JOB.debug()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos)
|
||||
function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) abort
|
||||
return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos)
|
||||
endfunction
|
||||
|
||||
|
@ -149,10 +149,10 @@ function! s:find_root_directory() abort
|
||||
let dir = SpaceVim#util#findFileInParent(pattern, fd)
|
||||
endif
|
||||
let ftype = getftype(dir)
|
||||
if ftype == 'dir' || ftype == 'file'
|
||||
if ftype ==# 'dir' || ftype ==# 'file'
|
||||
let dir = fnamemodify(dir, ':p')
|
||||
if dir !=# expand('~/.SpaceVim.d/')
|
||||
call SpaceVim#logger#info(" (" . pattern . "):" . dir)
|
||||
call SpaceVim#logger#info(' (' . pattern . '):' . dir)
|
||||
call add(dirs, dir)
|
||||
endif
|
||||
endif
|
||||
|
@ -26,7 +26,7 @@ let s:qf_bufnr = -1
|
||||
" like setqflist()
|
||||
|
||||
|
||||
function! SpaceVim#plugins#quickfix#setqflist(list, ...)
|
||||
function! SpaceVim#plugins#quickfix#setqflist(list, ...) abort
|
||||
let action = get(a:000, 0, ' ')
|
||||
if action ==# 'a'
|
||||
call extend(s:qflist, a:list)
|
||||
@ -46,14 +46,14 @@ function! SpaceVim#plugins#quickfix#setqflist(list, ...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#quickfix#getqflist()
|
||||
function! SpaceVim#plugins#quickfix#getqflist() abort
|
||||
|
||||
return s:qflist
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#quickfix#next()
|
||||
function! SpaceVim#plugins#quickfix#next() abort
|
||||
|
||||
let s:qf_index += 1
|
||||
let file = get(s:filestack, s:qf_index, {})
|
||||
@ -66,7 +66,7 @@ function! SpaceVim#plugins#quickfix#next()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#quickfix#pre()
|
||||
function! SpaceVim#plugins#quickfix#pre() abort
|
||||
|
||||
let s:qf_index -= 1
|
||||
let file = get(s:filestack, s:qf_index, {})
|
||||
@ -79,7 +79,7 @@ function! SpaceVim#plugins#quickfix#pre()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#quickfix#enter()
|
||||
function! SpaceVim#plugins#quickfix#enter() abort
|
||||
let s:qf_index = line('.') - 1
|
||||
let file = get(s:filestack, s:qf_index, {})
|
||||
if !empty(file)
|
||||
@ -90,7 +90,7 @@ function! SpaceVim#plugins#quickfix#enter()
|
||||
endfunction
|
||||
|
||||
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
||||
function! SpaceVim#plugins#quickfix#openwin()
|
||||
function! SpaceVim#plugins#quickfix#openwin() abort
|
||||
call s:BUFFER.open({
|
||||
\ 'bufname' : '__quickfix__',
|
||||
\ 'cmd' : 'setl buftype=nofile bufhidden=wipe filetype=SpaceVimQuickFix nomodifiable nowrap nobuflisted',
|
||||
|
@ -255,14 +255,14 @@ let g:unite_source_menu_menus.RunnerLanguage = {'description':
|
||||
let g:unite_source_menu_menus.RunnerLanguage.command_candidates =
|
||||
\ get(g:unite_source_menu_menus.RunnerLanguage,'command_candidates', [])
|
||||
|
||||
function! SpaceVim#plugins#runner#select_language()
|
||||
function! SpaceVim#plugins#runner#select_language() abort
|
||||
" @todo use denite or unite to select language
|
||||
" and set the s:selected_language
|
||||
" the all language is keys(s:runners)
|
||||
Denite menu:RunnerLanguage
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#runner#set_language(lang)
|
||||
function! SpaceVim#plugins#runner#set_language(lang) abort
|
||||
" @todo use denite or unite to select language
|
||||
" and set the s:selected_language
|
||||
" the all language is keys(s:runners)
|
||||
|
@ -6,7 +6,7 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
func! SpaceVim#plugins#windisk#open()
|
||||
func! SpaceVim#plugins#windisk#open() abort
|
||||
let disks = s:get_disks()
|
||||
if !empty(disks)
|
||||
" 1. open plugin buffer
|
||||
@ -28,7 +28,7 @@ func! SpaceVim#plugins#windisk#open()
|
||||
endif
|
||||
endf
|
||||
|
||||
func! s:get_disks()
|
||||
func! s:get_disks() abort
|
||||
return map(filter(range(65, 97), "isdirectory(nr2char(v:val) . ':/')"), 'nr2char(v:val) . ":/"')
|
||||
endf
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
" This function should not be called twice!
|
||||
|
||||
let s:flag = 0
|
||||
function! SpaceVim#server#connect()
|
||||
function! SpaceVim#server#connect() abort
|
||||
if s:flag == 0
|
||||
if empty($SPACEVIM_SERVER_ADDRESS)
|
||||
let $SPACEVIM_SERVER_ADDRESS = fnamemodify('/tmp/' . (has('nvim') ? 'spacevim_nvim_' : 'spacevim_vim_') . 'server', ':p')
|
||||
@ -36,17 +36,17 @@ function! SpaceVim#server#connect()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#server#export_server()
|
||||
function! SpaceVim#server#export_server() abort
|
||||
if executable('export')
|
||||
call system('export $TEST_SPACEVIM="test"')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#server#terminate()
|
||||
function! SpaceVim#server#terminate() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#server#list()
|
||||
function! SpaceVim#server#list() abort
|
||||
if has('nvim')
|
||||
return join(serverlist(), "\n")
|
||||
else
|
||||
|
@ -1,6 +1,6 @@
|
||||
let s:debug_message = []
|
||||
function! zvim#debug#completion_debug(ArgLead, CmdLine, CursorPos) abort
|
||||
call add(s:debug_message, "arglead:[".a:ArgLead ."] cmdline:[" .a:CmdLine ."] cursorpos:[" .a:CursorPos ."]")
|
||||
call add(s:debug_message, 'arglead:['.a:ArgLead .'] cmdline:[' .a:CmdLine .'] cursorpos:[' .a:CursorPos .']')
|
||||
endfunction
|
||||
|
||||
function! zvim#debug#get_message() abort
|
||||
|
@ -7,9 +7,9 @@
|
||||
"=============================================================================
|
||||
|
||||
|
||||
if version > 580
|
||||
if v:version > 580
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
if exists('syntax_on')
|
||||
syntax reset
|
||||
endif
|
||||
endif
|
||||
@ -23,7 +23,7 @@ endif
|
||||
|
||||
let s:HIAPI = SpaceVim#api#import('vim#highlight')
|
||||
let s:COLOR = SpaceVim#api#import('color')
|
||||
let s:is_dark=(&background == 'dark')
|
||||
let s:is_dark=(&background ==# 'dark')
|
||||
|
||||
function! s:hi(items) abort
|
||||
for [item, fg, bg, cterm, gui] in a:items
|
||||
|
@ -61,19 +61,19 @@ function! BracketsFunc()
|
||||
endf
|
||||
function! XmlFileTypeInit()
|
||||
set omnifunc=xmlcomplete#CompleteTags
|
||||
if filereadable("AndroidManifest.xml")
|
||||
if filereadable('AndroidManifest.xml')
|
||||
set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic
|
||||
endif
|
||||
endf
|
||||
function! WSDAutoComplete(char)
|
||||
if(getline(".")=~?'^\s*.*\/\/')==0
|
||||
if(getline('.')=~?'^\s*.*\/\/')==0
|
||||
let line = getline('.')
|
||||
let col = col('.')
|
||||
if a:char == "."
|
||||
if a:char ==# '.'
|
||||
return a:char."\<c-x>\<c-o>\<c-p>"
|
||||
elseif line[col - 2] == " "||line[col -2] == "("||line[col - 2] == ","
|
||||
elseif line[col - 2] ==# ' ' ||line[col -2] ==# '(' ||line[col - 2] ==# ','
|
||||
return a:char."\<c-x>\<c-o>\<c-p>"
|
||||
elseif line[col - 3] == " "&&line[col - 2] =="@"
|
||||
elseif line[col - 3] ==# ' ' && line[col - 2] ==# '@'
|
||||
return a:char."\<c-x>\<c-o>\<c-p>"
|
||||
else
|
||||
return a:char
|
||||
@ -109,7 +109,7 @@ endf
|
||||
function! QuoteDelim(char)
|
||||
let line = getline('.')
|
||||
let col = col('.')
|
||||
if line[col - 2] == "\\"
|
||||
if line[col - 2] ==# "\\"
|
||||
"Inserting a quoted quotation mark into the string
|
||||
return a:char
|
||||
elseif line[col - 1] == a:char
|
||||
@ -129,23 +129,23 @@ function! JspFileTypeInit()
|
||||
endfunction
|
||||
|
||||
function! MyLeaderTabfunc() abort
|
||||
if g:spacevim_autocomplete_method == 'deoplete'
|
||||
if g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
if g:spacevim_enable_javacomplete2_py
|
||||
return deoplete#mappings#manual_complete(['javacomplete2'])
|
||||
else
|
||||
return deoplete#mappings#manual_complete(['omni'])
|
||||
endif
|
||||
elseif g:spacevim_autocomplete_method == 'neocomplete'
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'
|
||||
return neocomplete#start_manual_complete(['omni'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
func! Openpluginrepo()
|
||||
try
|
||||
exec "normal! ".'"ayi'."'"
|
||||
exec 'normal! '.'"ayi'."'"
|
||||
exec 'OpenBrowser https://github.com/'.@a
|
||||
catch
|
||||
echohl WarningMsg | echomsg "can not open the web of current plugin" | echohl None
|
||||
echohl WarningMsg | echomsg 'can not open the web of current plugin' | echohl None
|
||||
endtry
|
||||
endf
|
||||
func! Update_current_plugin()
|
||||
|
@ -10,7 +10,8 @@
|
||||
if has('vim_starting')
|
||||
" set default encoding to utf-8
|
||||
" Let Vim use utf-8 internally, because many scripts require this
|
||||
set encoding=utf-8
|
||||
exe 'set encoding=utf-8'
|
||||
scriptencoding utf-8
|
||||
if &compatible
|
||||
set nocompatible
|
||||
endif
|
||||
|
@ -1,6 +1,9 @@
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
|
||||
augroup asyncompelet_buffer
|
||||
autocmd!
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
|
||||
\ 'name': 'B',
|
||||
\ 'whitelist': ['*'],
|
||||
\ 'blacklist': ['go'],
|
||||
\ 'completor': function('asyncomplete#sources#buffer#completor'),
|
||||
\ }))
|
||||
augroup END
|
||||
|
@ -1,4 +1,6 @@
|
||||
autocmd User asyncomplete_setup call asyncomplete#register_source(
|
||||
augroup asyncomplete_clang
|
||||
autocmd!
|
||||
autocmd User asyncomplete_setup call asyncomplete#register_source(
|
||||
\ asyncomplete#sources#clang#get_source_options({
|
||||
\ 'config': {
|
||||
\ 'clang_path': get(g:, 'asyncomplete_clang_executable', 'clang'),
|
||||
@ -7,3 +9,4 @@ autocmd User asyncomplete_setup call asyncomplete#register_source(
|
||||
\ }
|
||||
\ }
|
||||
\ }))
|
||||
augroup END
|
||||
|
@ -1,5 +1,8 @@
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necovim#get_source_options({
|
||||
augroup asyncomplete_necovim
|
||||
autocmd!
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necovim#get_source_options({
|
||||
\ 'name': 'necovim',
|
||||
\ 'whitelist': ['vim'],
|
||||
\ 'completor': function('asyncomplete#sources#necovim#completor'),
|
||||
\ }))
|
||||
augroup END
|
||||
|
@ -1,6 +1,9 @@
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
|
||||
augroup asyncomplete_omni
|
||||
autocmd!
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
|
||||
\ 'name': 'omni',
|
||||
\ 'whitelist': ['*'],
|
||||
\ 'blacklist': ['html', 'c', 'cpp'],
|
||||
\ 'completor': function('asyncomplete#sources#omni#completor')
|
||||
\ }))
|
||||
augroup END
|
||||
|
@ -7,7 +7,7 @@ let g:javagetset_setterTemplate = get(g:, 'javagetset_setterTemplate',
|
||||
\ " */\n" .
|
||||
\ "%modifiers% void %funcname%(%type% %varname%){\n" .
|
||||
\ " this.%varname% = %varname%;\n" .
|
||||
\ "}")
|
||||
\ '}')
|
||||
let g:javagetset_getterTemplate = get(g:, 'javagetset_getterTemplate',
|
||||
\ "/**\n" .
|
||||
\ " * Get %varname%.\n" .
|
||||
@ -16,6 +16,6 @@ let g:javagetset_getterTemplate = get(g:, 'javagetset_getterTemplate',
|
||||
\ " */\n" .
|
||||
\ "%modifiers% %type% %funcname%(){\n" .
|
||||
\ " return %varname%;\n" .
|
||||
\ "}")
|
||||
\ '}')
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -5,7 +5,7 @@ let g:ale_sign_info = get(g:,'spacevim_info_symbol', '🛈')
|
||||
let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%severity%: %linter%: %s')
|
||||
let g:ale_lint_on_save = get(g:, 'spacevim_lint_on_save', 1)
|
||||
|
||||
if g:spacevim_colorscheme == 'gruvbox'
|
||||
if g:spacevim_colorscheme ==# 'gruvbox'
|
||||
highlight link ALEErrorSign GruvboxRedSign
|
||||
highlight link ALEWarningSign GruvboxYellowSign
|
||||
endif
|
||||
|
@ -6,7 +6,10 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
au BufRead,BufNewFile *.rs set filetype=rust
|
||||
au BufNewFile,BufRead *.sol setf solidity
|
||||
augroup spacevim_filetype_script
|
||||
autocmd!
|
||||
au BufRead,BufNewFile *.rs set filetype=rust
|
||||
au BufNewFile,BufRead *.sol setf solidity
|
||||
augroup END
|
||||
|
||||
" vim:set et sw=2
|
||||
|
@ -1,7 +1,7 @@
|
||||
if exists("b:current_syntax")
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
let b:current_syntax = "HelpDescribe"
|
||||
let b:current_syntax = 'HelpDescribe'
|
||||
syntax case ignore
|
||||
syn match FileName /\(Definition:\ \)\@<=.*/
|
||||
syn match KeyBindings /\[.*\]/
|
||||
|
@ -1,7 +1,7 @@
|
||||
if exists("b:current_syntax")
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
let b:current_syntax = "SpaceVimFindArgv"
|
||||
let b:current_syntax = 'SpaceVimFindArgv'
|
||||
syntax case ignore
|
||||
|
||||
syn match CMDFindArgvOpt /-[a-zA-Z]*\ /
|
||||
|
@ -1,7 +1,7 @@
|
||||
if exists("b:current_syntax")
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
let b:current_syntax = "SpaceVimQuickFix"
|
||||
let b:current_syntax = 'SpaceVimQuickFix'
|
||||
syntax case ignore
|
||||
syn match FileName /^[^ ]*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user