From dd0521705dd9d534f7905594423b05953fbba545 Mon Sep 17 00:00:00 2001 From: Blubber Date: Wed, 26 Oct 2016 00:34:58 +0200 Subject: created branch to develop AsyncCmdProcessor for vim8+ --- vimrc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/vimrc b/vimrc index bc9a128..1d4507f 100644 --- a/vimrc +++ b/vimrc @@ -348,3 +348,41 @@ command! -nargs=* SCons call TriggerSCons() "endif "}}} +"{{{ Sandbox +let s:sandbox_enable = 1 +if s:sandbox_enable + function! StdOutCB(job, message) + endfunction + + function! JobExitCB(job, status) + "unlet g:stdout_buffer + "unlet g:stderr_buffer + "execute 'cbuffer ' . g:stderr_buffer + endfunction + + " TODO: need to debug why stdout_buffer/stdout_buffer are not shown + " and why output is not correctly written to these buffers?! + " when running AsyncCmdProcessor, line 1 of currently open buffer is overwritten + function! AsyncCmdProcessor(cmd) + let l:current_buffer = bufnr('') + " create & delete buffer for stdout + let g:stdout_buffer = bufnr('stdout_buffer', 1) + execute g:stdout_buffer . 'bufdo %d' + " create & delete buffer for stderr + let g:stderr_buffer = bufnr('stderr_buffer', 1) + execute g:stderr_buffer . 'bufdo %d' + + "execute 'sbuffer' . g:stdout_buffer + + " switch to current buffer + execute 'b ' . l:current_buffer + + let job = job_start(a:cmd, { 'out_io': 'buffer', + \ 'out_name': 'stdout_buffer', + \ 'out_cb': 'StdOutCB', + \ 'err_io': 'buffer', + \ 'err_name': 'stderr_buffer', + \ 'exit_cb': 'JobExitCB'}) + endfunction +endif +"}}} -- cgit v1.2.3 From 739cb983a0d853dcc61c1a0b04ec7ab63203a70f Mon Sep 17 00:00:00 2001 From: johannst Date: Wed, 2 Nov 2016 23:32:22 +0100 Subject: added command and keymap for AsyncCmdProcessor; improved buffer creation in AsynCmdProcessor --- vimrc | 66 ++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/vimrc b/vimrc index 1d4507f..ccc20fb 100644 --- a/vimrc +++ b/vimrc @@ -351,38 +351,60 @@ command! -nargs=* SCons call TriggerSCons() "{{{ Sandbox let s:sandbox_enable = 1 if s:sandbox_enable - function! StdOutCB(job, message) + function! s:StdOutCB(job, message) endfunction - function! JobExitCB(job, status) - "unlet g:stdout_buffer - "unlet g:stderr_buffer - "execute 'cbuffer ' . g:stderr_buffer + function! s:StdErrCB(job, message) endfunction - " TODO: need to debug why stdout_buffer/stdout_buffer are not shown - " and why output is not correctly written to these buffers?! - " when running AsyncCmdProcessor, line 1 of currently open buffer is overwritten - function! AsyncCmdProcessor(cmd) - let l:current_buffer = bufnr('') + function! s:JobExitCB(job, status) + "execute 'cbuffer! ' . g:stderr_buffer + execute "echom \'Job Exited!\'" + endfunction + + function! AsyncCmdProcessor(...) + let l:current_buffer = bufnr('%') + " create & delete buffer for stdout - let g:stdout_buffer = bufnr('stdout_buffer', 1) - execute g:stdout_buffer . 'bufdo %d' - " create & delete buffer for stderr - let g:stderr_buffer = bufnr('stderr_buffer', 1) - execute g:stderr_buffer . 'bufdo %d' + " TODO: create buffer on first call to stdout cb + let g:stdout_buffer = s:CreateLogBuffer('stdout_buffer') - "execute 'sbuffer' . g:stdout_buffer + " create & delete buffer for stderr + " TODO: create buffer on first call to stderr cb + let g:stderr_buffer = s:CreateLogBuffer('stderr_buffer') - " switch to current buffer execute 'b ' . l:current_buffer - let job = job_start(a:cmd, { 'out_io': 'buffer', - \ 'out_name': 'stdout_buffer', - \ 'out_cb': 'StdOutCB', + " concatenate command string + let l:cmd = '' + for arg in a:000 + let l:cmd = l:cmd. ' ' . arg + endfor + echom l:cmd + + let job = job_start(l:cmd, { + \ 'out_io': 'buffer', + \ 'out_buf': g:stdout_buffer, + \ 'out_cb': function('s:StdOutCB'), + \ 'out_msg': '0', \ 'err_io': 'buffer', - \ 'err_name': 'stderr_buffer', - \ 'exit_cb': 'JobExitCB'}) + \ 'err_buf': g:stderr_buffer, + \ 'err_cb': function('s:StdErrCB'), + \ 'err_msg': '0', + \ 'exit_cb': function('s:JobExitCB') + \}) + endfunction + + function! s:CreateLogBuffer(buffer_name) + let l:buffer_num = bufnr(a:buffer_name, 1) + execute 'b ' . l:buffer_num + execute '%d' + execute 'setlocal buflisted' + execute 'setlocal buftype=nofile' + return l:buffer_num endfunction + + command! -nargs=* Async call AsyncCmdProcessor() + nnoremap a :Async endif "}}} -- cgit v1.2.3 From 65dc8dcfeea1441d0f93b938227135c20ddcb5e3 Mon Sep 17 00:00:00 2001 From: johannst Date: Mon, 7 Nov 2016 00:13:22 +0100 Subject: vimrc refactored statusline and added entry for async job, improved AsyncCmdProcessor: mergered output buffers, catch empty cmd input --- vimrc | 73 +++++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/vimrc b/vimrc index ccc20fb..bc41df4 100644 --- a/vimrc +++ b/vimrc @@ -251,30 +251,15 @@ endfunction let &statusline='' let &statusline.='%{DynamicStatuslineHighlighting()}' let &statusline.='[%{g:ModeMap[mode()]}]' -let &statusline.=' ' -let &statusline.='%t' " file name -let &statusline.=' ' -let &statusline.='{%M%R%H}' " modified/read-only/help-page -let &statusline.=' ' -let &statusline.='[%{&ft}' "filetype -"let &statusline.='%{&ft!=""?&ft.",":""}' "filetype -"let &statusline.='%{&fenc!=""?&fenc.",":&enc.","}' " file encoding -"let &statusline.='%{&ff}' " file format -let &statusline.=']' - -let &statusline.='%=' " seperator between left and right alignment -let &statusline.=' ' -let &statusline.='[%b' " decimal ascii value of char under cursor -let &statusline.=':' -let &statusline.='0x%B]' " hexadecimal ascii value of char under cursor -let &statusline.=' ' -let &statusline.='[%l' " current line -let &statusline.='/' -let &statusline.='%L' " num of lines -let &statusline.=' -- ' -let &statusline.='%c]' " current column -let &statusline.=' ' -let &statusline.='(%p%%)' " current line in percent +let &statusline.=' %t' " file name +let &statusline.=' {%M%R%H}' " modified/read-only/help-page +let &statusline.=' [%{&ft}]' "filetype + +let &statusline.='%=' " seperator between left and right alignment +let &statusline.=' [A:%{GetAsyncJobStatus()}]' +let &statusline.=' [%b:0x%B]' " dec:hex ascii value of char under cursor +let &statusline.=' [%l/%L -- %c]' " current line/num of lines -- current columen +let &statusline.=' (%p%%)' " current line in percent "}}} "{{{ Indentation @@ -359,19 +344,26 @@ if s:sandbox_enable function! s:JobExitCB(job, status) "execute 'cbuffer! ' . g:stderr_buffer - execute "echom \'Job Exited!\'" + echom 'AsyncCmdProcessor: Job exited' + let s:async_job_running=0 endfunction - function! AsyncCmdProcessor(...) - let l:current_buffer = bufnr('%') + let s:async_job_running=0 + function! s:AsyncCmdProcessor(...) + if a:0 == 0 + echom 'AsyncCmdProcessor: no cmd specified' + return + endif + + if s:async_job_running == 1 + echom 'AsyncCmdProcessor: currently only one job at a time supported' + return + endif + let s:async_job_running=1 - " create & delete buffer for stdout - " TODO: create buffer on first call to stdout cb - let g:stdout_buffer = s:CreateLogBuffer('stdout_buffer') + let l:current_buffer = bufnr('%') - " create & delete buffer for stderr - " TODO: create buffer on first call to stderr cb - let g:stderr_buffer = s:CreateLogBuffer('stderr_buffer') + let s:async_buffer = s:CreateLogBuffer('async_buffer') execute 'b ' . l:current_buffer @@ -382,19 +374,26 @@ if s:sandbox_enable endfor echom l:cmd - let job = job_start(l:cmd, { + let s:async_job = job_start(l:cmd, { \ 'out_io': 'buffer', - \ 'out_buf': g:stdout_buffer, + \ 'out_buf': s:async_buffer, \ 'out_cb': function('s:StdOutCB'), \ 'out_msg': '0', \ 'err_io': 'buffer', - \ 'err_buf': g:stderr_buffer, + \ 'err_buf': s:async_buffer, \ 'err_cb': function('s:StdErrCB'), \ 'err_msg': '0', \ 'exit_cb': function('s:JobExitCB') \}) endfunction + function! GetAsyncJobStatus() + if exists('s:async_job') + return job_status(s:async_job) + endif + return '*' + endfunction + function! s:CreateLogBuffer(buffer_name) let l:buffer_num = bufnr(a:buffer_name, 1) execute 'b ' . l:buffer_num @@ -404,7 +403,7 @@ if s:sandbox_enable return l:buffer_num endfunction - command! -nargs=* Async call AsyncCmdProcessor() + command! -nargs=* Async call s:AsyncCmdProcessor() nnoremap a :Async endif "}}} -- cgit v1.2.3 From 9377f6b6cf8263290dbe4ad14b81ade1fc538f2e Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 10 Nov 2016 22:44:41 +0100 Subject: vimrc added function to kill async job --- vimrc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/vimrc b/vimrc index bc41df4..b57d314 100644 --- a/vimrc +++ b/vimrc @@ -345,21 +345,21 @@ if s:sandbox_enable function! s:JobExitCB(job, status) "execute 'cbuffer! ' . g:stderr_buffer echom 'AsyncCmdProcessor: Job exited' - let s:async_job_running=0 + let s:gAsyncJobRunning=0 endfunction - let s:async_job_running=0 + let s:gAsyncJobRunning=0 function! s:AsyncCmdProcessor(...) if a:0 == 0 echom 'AsyncCmdProcessor: no cmd specified' return endif - if s:async_job_running == 1 + if s:gAsyncJobRunning == 1 echom 'AsyncCmdProcessor: currently only one job at a time supported' return endif - let s:async_job_running=1 + let s:gAsyncJobRunning=1 let l:current_buffer = bufnr('%') @@ -374,7 +374,7 @@ if s:sandbox_enable endfor echom l:cmd - let s:async_job = job_start(l:cmd, { + let s:gAsyncJob = job_start(l:cmd, { \ 'out_io': 'buffer', \ 'out_buf': s:async_buffer, \ 'out_cb': function('s:StdOutCB'), @@ -387,23 +387,36 @@ if s:sandbox_enable \}) endfunction + " can not be script local because used in statusline function! GetAsyncJobStatus() - if exists('s:async_job') - return job_status(s:async_job) + if exists('s:gAsyncJob') + return job_status(s:gAsyncJob) endif return '*' endfunction + function! s:KillAsyncJob() + if exists('s:gAsyncJob') + let l:dudel = job_stop(s:gAsyncJob) + execute 'sleep 200ms' + if job_status(s:gAsyncJob) !=? 'dead' + echom 'Failed to kill AsyncJob' + endif + endif + endfunction + function! s:CreateLogBuffer(buffer_name) let l:buffer_num = bufnr(a:buffer_name, 1) execute 'b ' . l:buffer_num execute '%d' execute 'setlocal buflisted' execute 'setlocal buftype=nofile' + execute 'setlocal wrap' return l:buffer_num endfunction command! -nargs=* Async call s:AsyncCmdProcessor() nnoremap a :Async + nnoremap ak :call KillAsyncJob() endif "}}} -- cgit v1.2.3 From 83c5c4b7c0dbe8895ebabee28d3c70456b20dd09 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 13 Nov 2016 17:22:01 +0100 Subject: vimrc added functionality to open first filename found in current line in the output buffer of the AsyncCmdProcessor --- vimrc | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index b57d314..3b16936 100644 --- a/vimrc +++ b/vimrc @@ -178,7 +178,7 @@ set showmatch " show matching brackets. set matchtime=5 " how many tenths of a second to blink when matching brackets set matchpairs+=<:> " show matching <> as well -vnoremap r "hy:%s/h/h/gc +vnoremap r "hy:%s/h/h/gc "}}} "{{{ Buffer & Splits @@ -344,6 +344,7 @@ if s:sandbox_enable function! s:JobExitCB(job, status) "execute 'cbuffer! ' . g:stderr_buffer + "execute 'caddbuffer ' . s:async_buffer echom 'AsyncCmdProcessor: Job exited' let s:gAsyncJobRunning=0 endfunction @@ -405,6 +406,35 @@ if s:sandbox_enable endif endfunction + let s:fname_filters = [ '\(.\{-}\):\%(\(\d\+\)\%(:\(\d\+\):\)\?\)\?' ] + " matches current line(from beginning indep of cursor position) against fname_filters + " the first file name found from beginning of line is opened in window evaluated by 'wincmd w' + function! s:OpenFirstFNameMatch() + let l:line = getline('.') + + " TODO: experimenting with cutting line from cursor to end + "let l:cur_col_pos = getcurpos()[2] + "echo l:line[l:cur_col_pos-1:] + + let l:file_info = [] + let l:file_info = matchlist(line, s:fname_filters[0]) + + if !empty(l:file_info) + for path in split(&path, ',') " take first match from path + if ( empty(path) && !empty(glob(l:file_info[1])) ) || !empty(glob(path . '/' . l:file_info[1])) + let l:fname = l:file_info[1] + let l:lnum = l:file_info[2] == ''? '1' : l:file_info[2] + let l:cnum = l:file_info[3] == ''? '1' : l:file_info[3] + execute 'wincmd w' + execute 'open ' . l:fname + call cursor(l:lnum, l:cnum) + execute 'wincmd p' + break + endif + endfor + endif + endfunction + function! s:CreateLogBuffer(buffer_name) let l:buffer_num = bufnr(a:buffer_name, 1) execute 'b ' . l:buffer_num @@ -412,11 +442,14 @@ if s:sandbox_enable execute 'setlocal buflisted' execute 'setlocal buftype=nofile' execute 'setlocal wrap' + nnoremap :call OpenFirstFNameMatch() return l:buffer_num endfunction command! -nargs=* Async call s:AsyncCmdProcessor() nnoremap a :Async nnoremap ak :call KillAsyncJob() + + nnoremap fg :Async find . -type f -exec grep -nH {} + endif "}}} -- cgit v1.2.3 From 20dd4165c9ee1c1ffe123b93f2a95ee646a9e256 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 3 Dec 2016 12:41:27 +0100 Subject: vim colorscheme changes --- vim/colors/johannst.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/colors/johannst.vim b/vim/colors/johannst.vim index dd79be2..1275792 100755 --- a/vim/colors/johannst.vim +++ b/vim/colors/johannst.vim @@ -17,6 +17,7 @@ let g:colors_name = "johannst" hi Normal ctermfg=253 ctermbg=234 cterm=NONE hi Folded ctermfg=146 ctermbg=238 cterm=NONE +hi FoldColumn ctermfg=122 ctermbg=238 cterm=NONE hi Title ctermfg=230 ctermbg=NONE cterm=bold hi Todo ctermfg=232 ctermbg=222 cterm=NONE hi NonText ctermfg=247 ctermbg=236 cterm=NONE @@ -125,7 +126,6 @@ hi Conditional ctermfg=11 ctermbg=NONE cterm=NONE "hi WarningMsg "hi VisualNOS "hi ModeMsg -"hi FoldColumn "hi EnumerationName "hi MoreMsg "hi SpellCap -- cgit v1.2.3 From d715f84870a5d157ceb89935373dcd1370588ef7 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 3 Dec 2016 12:45:34 +0100 Subject: vimrc introduced VIMHOME variable --- vimrc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index 3b16936..25e9f63 100644 --- a/vimrc +++ b/vimrc @@ -8,13 +8,15 @@ let mapleader=";" nnoremap ev :edit ~/.vimrc nnoremap sv :source ~/.vimrc +let $VIMHOME='~/.vim' + "{{{ Plugin Management " to install plugins open vim and run :PluginInstall from within vim OR " vim +PluginInstall +qall from cmd line filetype off " necessary for vundle!!! -set runtimepath+=~/.vim/bundle/Vundle.vim +set runtimepath+=$VIMHOME/bundle/Vundle.vim call vundle#begin() @@ -58,7 +60,7 @@ if exists('s:airline_enable') endif if exists('s:tagbar_enable') - let g:tagbar_ctags_bin='~/.vim/bin/ctags' + let g:tagbar_ctags_bin=$VIMHOME . '/bin/ctags' if !empty(glob(g:tagbar_ctags_bin)) augroup aug:TagbarKeymaps autocmd! @@ -70,7 +72,7 @@ if exists('s:tagbar_enable') endif if exists('s:ctrlp_enable') - let g:ctrlp_buftag_ctags_bin='~/.vim/bin/ctags' + let g:ctrlp_buftag_ctags_bin=$VIMHOME . '/bin/ctags' let g:ctrlp_extensions = ['buffertag', 'line', 'changes', 'mixed'] endif @@ -79,7 +81,7 @@ if exists('s:buftabline_enable') endif if exists('s:omnicppcomplete_enable') - set tags+=~/.vim/tags/cpp_tags + set tags+=$VIMHOME/tags/cpp_tags let OmniCpp_NamespaceSearch = 1 let OmniCpp_GlobalScopeSearch = 1 let OmniCpp_ShowAccess = 1 -- cgit v1.2.3 From ff0460c1c171d0acc09fd4f1add4bad46a526c09 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 3 Dec 2016 13:02:32 +0100 Subject: vimrc added functionality to autodetect enabled plugns --- vimrc | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/vimrc b/vimrc index 25e9f63..0e84bba 100644 --- a/vimrc +++ b/vimrc @@ -22,23 +22,12 @@ call vundle#begin() Plugin 'VundleVim/Vundle.vim' -let s:bufexplorer_enable="-" Plugin 'jlanzarotta/bufexplorer' - -let s:buftabline_enable="-" Plugin 'ap/vim-buftabline' - -"let s:airline_enable="-" "Plugin 'vim-airline/vim-airline' "Plugin 'vim-airline/vim-airline-themes' - -let s:tagbar_enable="-" Plugin 'majutsushi/tagbar' - -let s:ctrlp_enable="-" -Plugin 'kien/ctrlp.vim' - -"let s:omnicppcomplete_enable="-" +Plugin 'ctrlpvim/ctrlp.vim' "Plugin 'vim-scripts/OmniCppComplete' call vundle#end() @@ -46,11 +35,26 @@ call vundle#end() "}}} "{{{ Plugin Config -if exists('s:bufexplorer_enable') - nnoremap be :call BufExplorer() +let s:gEnabledPlugins = [] +function! s:ParseVimrcForEnabledPlugins() + let l:vimrc = readfile($MYVIMRC, '', 100) + let l:i = 0 + while 1 + let l:i = match(l:vimrc, '^Plugin', l:i+1) + if l:i == -1 + break + endif + call add(s:gEnabledPlugins, split(l:vimrc[l:i], "'")[1]) + endwhile +endfunction +call s:ParseVimrcForEnabledPlugins() + +if index(s:gEnabledPlugins, 'jlanzarotta/bufexplorer')!=-1 + nnoremap be :call ToggleBufExplorer() + let g:bufExplorerDisableDefaultKeyMapping=1 endif -if exists('s:airline_enable') +if index(s:gEnabledPlugins, 'vim-airline/vim-airline')!=-1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#fnamemod = ':t' let g:airline_powerline_fonts = 1 @@ -59,7 +63,7 @@ if exists('s:airline_enable') endif endif -if exists('s:tagbar_enable') +if index(s:gEnabledPlugins, 'majutsushi/tagbar')!=-1 let g:tagbar_ctags_bin=$VIMHOME . '/bin/ctags' if !empty(glob(g:tagbar_ctags_bin)) augroup aug:TagbarKeymaps @@ -71,16 +75,16 @@ if exists('s:tagbar_enable') endif endif -if exists('s:ctrlp_enable') +if index(s:gEnabledPlugins, 'ctrlpvim/ctrlp.vim')!=-1 let g:ctrlp_buftag_ctags_bin=$VIMHOME . '/bin/ctags' let g:ctrlp_extensions = ['buffertag', 'line', 'changes', 'mixed'] endif -if exists('s:buftabline_enable') +if index(s:gEnabledPlugins, 'ap/vim-buftabline')!=-1 let g:buftabline_indicators = 1 endif -if exists('s:omnicppcomplete_enable') +if index(s:gEnabledPlugins, 'vim-scripts/OmniCppComplete')!=-1 set tags+=$VIMHOME/tags/cpp_tags let OmniCpp_NamespaceSearch = 1 let OmniCpp_GlobalScopeSearch = 1 -- cgit v1.2.3 From 29d8b60466a49009664ce93d5f0f9a36b87752ab Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 3 Dec 2016 13:29:19 +0100 Subject: added new keymaps for ctrlP and enabled caching; minor other changes in vimrc --- vimrc | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/vimrc b/vimrc index 0e84bba..0a77ce6 100644 --- a/vimrc +++ b/vimrc @@ -37,7 +37,7 @@ call vundle#end() let s:gEnabledPlugins = [] function! s:ParseVimrcForEnabledPlugins() - let l:vimrc = readfile($MYVIMRC, '', 100) + let l:vimrc = readfile($MYVIMRC) let l:i = 0 while 1 let l:i = match(l:vimrc, '^Plugin', l:i+1) @@ -77,7 +77,15 @@ endif if index(s:gEnabledPlugins, 'ctrlpvim/ctrlp.vim')!=-1 let g:ctrlp_buftag_ctags_bin=$VIMHOME . '/bin/ctags' - let g:ctrlp_extensions = ['buffertag', 'line', 'changes', 'mixed'] + let g:ctrlp_extensions = ['buffertag'] + let g:ctrlp_working_path_mode = 'a' + let g:ctrlp_use_caching = 1 + let g:ctrlp_clear_cache_on_exit = 1 + let g:ctrlp_cache_dir = $VIMHOME . '/cache/ctrlp' + + nnoremap t :CtrlPBufTagAll + nnoremap f :CtrlPCurFile + nnoremap b :CtrlPBuffer endif if index(s:gEnabledPlugins, 'ap/vim-buftabline')!=-1 @@ -145,10 +153,18 @@ vnoremap $ cnoremap cnoremap +cnoremap +cnoremap +cnoremap +cnoremap + "}}} "{{{ Folding +set foldlevel=0 +set foldcolumn=1 set foldmethod=marker +set foldmarker={{{,}}} augroup aug:FileTypeCommentString autocmd! @@ -184,6 +200,7 @@ set showmatch " show matching brackets. set matchtime=5 " how many tenths of a second to blink when matching brackets set matchpairs+=<:> " show matching <> as well +nnoremap n :noh vnoremap r "hy:%s/h/h/gc "}}} @@ -262,7 +279,9 @@ let &statusline.=' {%M%R%H}' " modified/read-only/help-page let &statusline.=' [%{&ft}]' "filetype let &statusline.='%=' " seperator between left and right alignment -let &statusline.=' [A:%{GetAsyncJobStatus()}]' +if v:version >= 800 + let &statusline.=' [A:%{GetAsyncJobStatus()}]' +endif let &statusline.=' [%b:0x%B]' " dec:hex ascii value of char under cursor let &statusline.=' [%l/%L -- %c]' " current line/num of lines -- current columen let &statusline.=' (%p%%)' " current line in percent @@ -338,13 +357,22 @@ command! -nargs=* SCons call TriggerSCons() " execute "set =\e[1;*D" "endif +"}}} +"{{{ Project Specific vimrc + +if !empty(glob('.local_vimrc')) + source .local_vimrc +endif + "}}} "{{{ Sandbox let s:sandbox_enable = 1 -if s:sandbox_enable +if s:sandbox_enable && v:version>=800 + " job_start was not working without CB function! s:StdOutCB(job, message) endfunction + " job_start was not working without CB function! s:StdErrCB(job, message) endfunction @@ -452,7 +480,7 @@ if s:sandbox_enable return l:buffer_num endfunction - command! -nargs=* Async call s:AsyncCmdProcessor() + command! -complete=file -nargs=* Async call s:AsyncCmdProcessor() nnoremap a :Async nnoremap ak :call KillAsyncJob() -- cgit v1.2.3 From 710b135cf7bd128d58723f9bc9d4a96675c132d0 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 3 Dec 2016 13:39:52 +0100 Subject: vimrc took async cmd processor from sandbox --- vimrc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/vimrc b/vimrc index 0a77ce6..f8adcf9 100644 --- a/vimrc +++ b/vimrc @@ -358,16 +358,16 @@ command! -nargs=* SCons call TriggerSCons() "endif "}}} -"{{{ Project Specific vimrc +"{{{ Project Specific vimrc if !empty(glob('.local_vimrc')) source .local_vimrc endif "}}} -"{{{ Sandbox -let s:sandbox_enable = 1 -if s:sandbox_enable && v:version>=800 +"{{{ Async Command Processor + +if v:version>=800 " job_start was not working without CB function! s:StdOutCB(job, message) endfunction @@ -397,9 +397,7 @@ if s:sandbox_enable && v:version>=800 let s:gAsyncJobRunning=1 let l:current_buffer = bufnr('%') - let s:async_buffer = s:CreateLogBuffer('async_buffer') - execute 'b ' . l:current_buffer " concatenate command string @@ -443,13 +441,10 @@ if s:sandbox_enable && v:version>=800 let s:fname_filters = [ '\(.\{-}\):\%(\(\d\+\)\%(:\(\d\+\):\)\?\)\?' ] " matches current line(from beginning indep of cursor position) against fname_filters " the first file name found from beginning of line is opened in window evaluated by 'wincmd w' - function! s:OpenFirstFNameMatch() + function! s:OpenFirstFileNameMatch() + " TODO: experimenting let l:line = getline('.') - " TODO: experimenting with cutting line from cursor to end - "let l:cur_col_pos = getcurpos()[2] - "echo l:line[l:cur_col_pos-1:] - let l:file_info = [] let l:file_info = matchlist(line, s:fname_filters[0]) @@ -476,14 +471,21 @@ if s:sandbox_enable && v:version>=800 execute 'setlocal buflisted' execute 'setlocal buftype=nofile' execute 'setlocal wrap' - nnoremap :call OpenFirstFNameMatch() + nnoremap :call OpenFirstFileNameMatch() return l:buffer_num endfunction command! -complete=file -nargs=* Async call s:AsyncCmdProcessor() nnoremap a :Async nnoremap ak :call KillAsyncJob() - nnoremap fg :Async find . -type f -exec grep -nH {} + endif + +"}}} +"{{{ Sandbox + +let s:sandbox_enable = 1 +if s:sandbox_enable +endif + "}}} -- cgit v1.2.3