add vim-bash-completion to complete MakeCmd
This commit is contained in:
parent
e8995e8612
commit
8af54476a8
1
pack/plugins/opt/vim-bash-completion
Submodule
1
pack/plugins/opt/vim-bash-completion
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 5f8166213359dabdcb5e36d892c410fef14cacbf
|
@ -251,7 +251,7 @@ function! s:ProjectSet(project_type, project_base_dir)
|
|||||||
function! s:DeviceFirmwareUpdate()
|
function! s:DeviceFirmwareUpdate()
|
||||||
call s:Make('kill', 'bang')
|
call s:Make('kill', 'bang')
|
||||||
call s:Make('flash', 'bang')
|
call s:Make('flash', 'bang')
|
||||||
call s:Make('run', 'bang')
|
call s:Make('start', 'bang')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
command! DeviceDebug call s:DeviceDebug(0)
|
command! DeviceDebug call s:DeviceDebug(0)
|
||||||
@ -266,42 +266,6 @@ endfunction
|
|||||||
" ====
|
" ====
|
||||||
" Make
|
" Make
|
||||||
" ====
|
" ====
|
||||||
function! GetAllMakeCompletions(ArgLead, CmdLine, CursorPos)
|
|
||||||
let CmdList = split(a:CmdLine)
|
|
||||||
let tasks = []
|
|
||||||
let tasks += split(system(s:invoke.' --complete --'))
|
|
||||||
if len(CmdList) > 1
|
|
||||||
let last_task = CmdList[-1]
|
|
||||||
if a:ArgLead[0] == '-' || a:ArgLead == '' && last_task[0] == '-'
|
|
||||||
let last_task = CmdList[-2]
|
|
||||||
let last_opt = CmdList[-1]
|
|
||||||
elseif a:ArgLead != '' && a:ArgLead[0] != '-' && len(CmdList) > 2
|
|
||||||
let last_task = CmdList[-3]
|
|
||||||
let last_opt = CmdList[-2]
|
|
||||||
endif
|
|
||||||
" Expand option
|
|
||||||
if count(tasks, last_task) > 0
|
|
||||||
let tasks += split(system(s:invoke.' --complete -- '.last_task.' -'))
|
|
||||||
endif
|
|
||||||
if exists('last_opt')
|
|
||||||
" Expand values of option
|
|
||||||
let helptext = systemlist(s:invoke.' '.last_task.' --help')
|
|
||||||
let i = match(helptext, last_opt)
|
|
||||||
if i > 0
|
|
||||||
let values = []
|
|
||||||
call substitute(helptext[i], '"\([^"]\+\)"', '\=add(values, submatch(1))', 'g')
|
|
||||||
if len(values) > 0
|
|
||||||
let tasks += values
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if a:ArgLead != ''
|
|
||||||
" Filter option if started to type
|
|
||||||
call filter(tasks, 'v:val =~ "^'. a:ArgLead .'"')
|
|
||||||
endif
|
|
||||||
return tasks
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:Make(args, async_mode)
|
function! s:Make(args, async_mode)
|
||||||
call asyncrun#quickfix_toggle(10, 1)
|
call asyncrun#quickfix_toggle(10, 1)
|
||||||
@ -331,6 +295,19 @@ function! s:Make(args, async_mode)
|
|||||||
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -program=make @ '.l:args
|
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -program=make @ '.l:args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Tab-completion is done with plugin vim-bash-completion
|
||||||
|
let $BASH_COMPLETION_DIR = '/home/stefan/.invoke'
|
||||||
|
let invoke_completion_file = $BASH_COMPLETION_DIR.'/bash_completion'
|
||||||
|
if !filereadable(invoke_completion_file)
|
||||||
|
call system('invoke --print-completion-script bash > '.invoke_completion_file)
|
||||||
|
endif
|
||||||
|
function! GetAllMakeCompletions(ArgLead, CmdLine, CursorPos)
|
||||||
|
let l:words = split(a:CmdLine)
|
||||||
|
let l:words[0] = 'invoke'
|
||||||
|
let l:command = join(l:words)
|
||||||
|
return bash#complete(l:command)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:Call_and_log(cmd)
|
function! s:Call_and_log(cmd)
|
||||||
echom a:cmd
|
echom a:cmd
|
||||||
let r = system(a:cmd)
|
let r = system(a:cmd)
|
||||||
|
@ -51,6 +51,7 @@ packadd! tagbar
|
|||||||
packadd! tcomment
|
packadd! tcomment
|
||||||
packadd! termdebug
|
packadd! termdebug
|
||||||
packadd! vimagit
|
packadd! vimagit
|
||||||
|
packadd! vim-bash-completion
|
||||||
packadd! vim-clang-format
|
packadd! vim-clang-format
|
||||||
packadd! vim-textidote
|
packadd! vim-textidote
|
||||||
packadd! VisIncr
|
packadd! VisIncr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user