spacevim/bundle/defx.nvim/autoload/defx.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

105 lines
3.0 KiB
VimL

"=============================================================================
" FILE: defx.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
function! defx#initialize() abort
return defx#init#_initialize()
endfunction
function! defx#start(paths, user_context) abort
let prev_winid = win_getid()
call defx#initialize()
let context = defx#init#_context(a:user_context)
let paths = map(a:paths, "[v:val[0], fnamemodify(v:val[1], ':p')]")
call defx#util#rpcrequest('_defx_start',
\ [paths, context], v:false)
if context['search'] !=# ''
call defx#call_action('search', [context['search']])
endif
if !context['focus']
" Restore the window
call win_gotoid(prev_winid)
endif
endfunction
function! defx#start_candidates(candidates, user_context) abort
call defx#initialize()
let context = defx#init#_context(a:user_context)
let listfile = tempname()
call writefile(a:candidates, listfile)
let paths = [['file/list', listfile]]
call defx#util#rpcrequest('_defx_start',
\ [paths, context], v:false)
if context['search'] !=# ''
call defx#call_action('search', [context['search']])
endif
endfunction
function! defx#do_action(action, ...) abort
if &l:filetype !=# 'defx'
return ''
endif
let args = defx#util#convert2list(get(a:000, 0, []))
return printf(":\<C-u>call defx#call_action(%s, %s)\<CR>",
\ string(a:action), string(args))
endfunction
function! defx#async_action(action, ...) abort
if &l:filetype !=# 'defx'
return ''
endif
let args = defx#util#convert2list(get(a:000, 0, []))
return printf(":\<C-u>call defx#call_async_action(%s, %s)\<CR>",
\ string(a:action), string(args))
endfunction
function! defx#call_action(action, ...) abort
if &l:filetype !=# 'defx'
return
endif
let context = defx#init#_context({})
let args = defx#util#convert2list(get(a:000, 0, []))
call defx#util#rpcrequest(
\ '_defx_do_action', [a:action, args, context], v:false)
endfunction
function! defx#call_async_action(action, ...) abort
if &l:filetype !=# 'defx'
return
endif
let context = defx#init#_context({})
let args = defx#util#convert2list(get(a:000, 0, []))
call defx#util#rpcrequest(
\ '_defx_async_action', [a:action, args, context], v:true)
endfunction
function! defx#redraw() abort
call defx#util#rpcrequest('_defx_redraw', [], v:false)
endfunction
function! defx#get_candidate() abort
if &l:filetype !=# 'defx'
return {}
endif
return defx#util#rpcrequest('_defx_get_candidate', [], v:false)
endfunction
function! defx#is_directory() abort
return get(defx#get_candidate(), 'is_directory', v:false)
endfunction
function! defx#is_opened_tree() abort
return get(defx#get_candidate(), 'is_opened_tree', v:false)
endfunction
function! defx#get_context() abort
if &l:filetype !=# 'defx'
return {}
endif
return defx#util#rpcrequest('_defx_get_context', [], v:false)
endfunction