0

I tried to show the result of quickrun on a new tab page. I succeed in showing the result via a new tab page by the following vimrc. A function Unique_open_tab opens the result via a new tab page. (In fact, there are many buffers created by quickrun, thus I remove duplicated buffers in the function.)

The problem is that the title of the result tab page is changed when I stay on another tab page as following. In the following, I describe the problem more precisely. The first figure shows I am editing 'test.tex'. The second figure shows a window after running quickrun. Please see a new tab page is opened and its title is 'test.tex'. In fact, the result of the quickrun is written on the new tab page. The third figure shows a window after moving to the result tab page. In this case, the title of the result has been changed from 'test.tex' to '[quickrun output]'.

I think this problem can be caused by vim-airline because the problem does not occur when I disable the setting g:airline#extensions#tabline#enabled. I should remark that this problem occurs after updating vim-airline, but I don't know the version I previously used.

I want to keep the title of the result '[quickrun output]' when I stay on another tab page by using the tabline setting provided by vim-airline. Does anyone have any ideas on how to solve the problem?

source $VIMRUNTIME/defaults.vim

let s:dein_dir = expand('~/.cache/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'

if &runtimepath !~# '/dein.vim'
  if !isdirectory(s:dein_repo_dir)
    execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
  endif
  execute 'set runtimepath^=' . fnamemodify(s:dein_repo_dir, ':p')
endif

if dein#load_state(s:dein_dir)
  call dein#begin(s:dein_dir)
  call dein#add('Shougo/vimproc.vim', {'build' : 'make'})
  call dein#add('thinca/vim-quickrun')
  call dein#add('vim-airline/vim-airline')
  call dein#end()
  call dein#save_state()
endif

" Show the result of quickrun by opening a new tab
" and remove duplicated bufferes created by quickrun
command! -nargs=1 Uniqtab call Unique_open_tab(<f-args>)
function! Unique_open_tab(option)
    for i in range(1,tabpagenr('$'))
        let bufnrs=tabpagebuflist(i)
        let currentbuf=bufnrs[tabpagewinnr(i)-1]
        if "[quickrun output]" == bufname(currentbuf)
            execute "tabclose ".i
        endif
    endfor
    tabnew a:option
endfunction

if dein#tap('vim-quickrun')
  let g:quickrun_config = get(g:, 'quickrun_config', {})
  let g:quickrun_config._ = {
        \ 'runner'    : 'vimproc',
        \ 'runner/vimproc/updatetime' : 60,
        \ 'outputter' : 'buffered',
        \ 'outputter/buffered/target' : 'buffer',
        \ 'outputter/buffer/split'  : ':Uniqtab',
        \ 'outputter/buffer/close_on_empty' : 1,
        \ }
  let g:quickrun_config['tex'] = {
            \   'command' : 'latexmk',
            \   'cmdopt': '-pv',
            \   'hook/cd/directory': '%S:h',
            \   'exec': ['%c %o %s']
            \ }
endif


if dein#tap('vim-airline')
  let g:airline#extensions#tabline#enabled = 1
endif

syntax on

enter image description here

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.