mhinz / mhinz/vim-startify

How can I open the recent file in the welcome page in a new tab without closing the welcome page?

Open
#556 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vim Script
Stars
5.4k
Forks
181
PR merge metrics
No merged PRs in 30d

Description

Dear author, hello! It is China's National Day now. I wonder if you have a day off. Thank you for your plugin, but I found a problem. It seems that it is not like tabnew , but can only open one file. So I modified the code a little bit.

~/.vim/plugged/vim-startify/autoload/startify.vim

```vimscript
" Function: #open_buffers {{{1
" modified by liuqin19980818 2024-10-01 begin
" function! startify#open_buffers(...) abort
" if exists('a:1') " used in mappings
" let entry = b:startify.entries[a:1]
" if !empty(s:batchmode) && entry.type == 'file'
" call startify#set_mark(s:batchmode, a:1)
" else
" call s:open_buffer(entry)
" endif
" return
" endif
"
" let marked = filter(copy(b:startify.entries), 'v:val.marked')
" if empty(marked) " open current entry
" call s:open_buffer(b:startify.entries[line('.')])
" return
" endif
"
" enew
" setlocal nobuflisted
"
" " Open all marked entries.
" for entry in sort(values(marked), 's:sort_by_tick')
" call s:open_buffer(entry)
" endfor
"
" wincmd =
"
" if exists('#User#StartifyAllBuffersOpened')
" doautocmd User StartifyAllBuffersOpened
" endif
" endfunction
function! startify#open_buffers(...) abort
if exists('a:1') " used in mappings
let entry = b:startify.entries[a:1]
if !empty(s:batchmode) && entry.type == 'file'
call startify#set_mark(s:batchmode, a:1)
else
" 使用 tabnew 打开缓冲区
execute 'tabnew ' . entry.path
endif
return
endif

let marked = filter(copy(b:startify.entries), 'v:val.marked')
if empty(marked) " open current entry
execute 'tabnew ' . b:startify.entries[line('.')].path
return
endif

" Open all marked entries in new tabs.
for entry in sort(values(marked), 's:sort_by_tick')
execute 'tabnew ' . entry.path
endfor

wincmd =

if exists('#User#StartifyAllBuffersOpened')
doautocmd User StartifyAllBuffersOpened
endif
endfunction
" modified by liuqin19980818 2024-10-01 end
```

I want to know if I can add a set of shortcut keys to open the newly opened file in a new tab so that I can use vim to edit multiple files at the same time.

Or you have already implemented it but I didn't find it in the documentation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in autoload/startify.vim at startify#open_buffers and reproduce opening a recent entry from the welcome page. Compare the current single-file behavior with the requested tab behavior, including marked entries and shortcut mappings; the work is done when multiple selected files can be opened in separate tabs without losing the intended welcome-page flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.