diff options
author | Chris <[email protected]> | 2020-08-07 21:25:39 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2020-08-07 21:25:39 -0400 |
commit | bf4c1d31045ad107f223b62edbab20a0f7a219d6 (patch) | |
tree | 9e60a7092af3ef162dd9932a62b5ea204c4c0d3a /plug-config | |
parent | 793766232b1cb812f021126064d99922a3dc8ba9 (diff) |
async task integration
Diffstat (limited to 'plug-config')
-rw-r--r-- | plug-config/asynctask.vim | 61 | ||||
-rw-r--r-- | plug-config/start-screen.vim | 6 |
2 files changed, 64 insertions, 3 deletions
diff --git a/plug-config/asynctask.vim b/plug-config/asynctask.vim index 4830e037..81d12fdb 100644 --- a/plug-config/asynctask.vim +++ b/plug-config/asynctask.vim @@ -1 +1,62 @@ let g:asyncrun_open = 6 +let g:asynctasks_term_pos = 'bottom' +" let g:asynctasks_term_pos = 'top' +" let g:asynctasks_term_pos = 'tab' +" let g:asynctasks_term_pos = 'external' +let g:asynctasks_extra_config = ['~/.config/nvim/utils/tasks.ini'] +" let current_tasks = asynctasks#list("") + +function! s:fzf_sink(what) + let p1 = stridx(a:what, '<') + if p1 >= 0 + let name = strpart(a:what, 0, p1) + let name = substitute(name, '^\s*\(.\{-}\)\s*$', '\1', '') + if name != '' + exec "AsyncTask ". fnameescape(name) + endif + endif +endfunction + +function! s:fzf_task() + let rows = asynctasks#source(&columns * 48 / 100) + let source = [] + for row in rows + let name = row[0] + let source += [name . ' ' . row[1] . ' : ' . row[2]] + endfor + let opts = { 'source': source, 'sink': function('s:fzf_sink'), + \ 'options': '+m --nth 1 --inline-info --tac' } + if exists('g:fzf_layout') + for key in keys(g:fzf_layout) + let opts[key] = deepcopy(g:fzf_layout[key]) + endfor + endif + call fzf#run(opts) +endfunction + +command! -nargs=0 AsyncTaskFzf call s:fzf_task() + +" Available Variables +" $(VIM_FILEPATH) # File name of current buffer with full path. +" $(VIM_FILENAME) # File name of current buffer without path. +" $(VIM_FILEDIR) # Full path of current buffer without the file name. +" $(VIM_FILEEXT) # File extension of current buffer. +" $(VIM_FILETYPE) # File type (value of &ft in vim) +" $(VIM_FILENOEXT) # File name of current buffer without path and extension. +" $(VIM_PATHNOEXT) # Current file name with full path but without extension. +" $(VIM_CWD) # Current directory (which :pwd returns). +" $(VIM_RELDIR) # File path relativize to current directory. +" $(VIM_RELNAME) # File name relativize to current directory. +" $(VIM_ROOT) # Project root directory. +" $(VIM_CWORD) # Word under cursor. +" $(VIM_CFILE) # File name under cursor. +" $(VIM_CLINE) # Cursor line number in current buffer +" $(VIM_GUI) # has('gui_runnin')? +" $(VIM_VERSION) # Value of v:version. +" $(VIM_COLUMNS) # Current screen width. +" $(VIM_LINES) # Current screen height. +" $(VIM_SVRNAME) # Value of v:servername. +" $(VIM_PRONAME) # Name of current project root directory +" $(VIM_DIRNAME) # Name of current directory +" $(VIM_INIFILE) # Full path name of current ini (.tasks) file. +" $(VIM_INIHOME) # Where the ini file locates. diff --git a/plug-config/start-screen.vim b/plug-config/start-screen.vim index 2e926721..28d7f649 100644 --- a/plug-config/start-screen.vim +++ b/plug-config/start-screen.vim @@ -1,9 +1,9 @@ let g:startify_custom_header = [ - \ ' _ __ _ __ ___ __ ___ ', + \ ' _ __ _ __ ___ __ ___', \ ' / |/ / __(_)_ _ / |/ /__ _____/ / |_ |', - \ ' / / |/ / / ` \ / /|_/ / _ `/ __/ _ \ / __/ ', - \ ' /_/|_/|___/_/_/_/_/ /_/ /_/\_,_/\__/_//_/ /____/ ', + \ ' / / |/ / / ` \ / /|_/ / _ `/ __/ _ \ / __/', + \ ' /_/|_/|___/_/_/_/_/ /_/ /_/\_,_/\__/_//_/ /____/', \] let g:startify_session_dir = '~/.config/nvim/session' |