Introduce T for opening files in tabs

Closes #39.
This commit is contained in:
Marco Hinz 2013-08-22 19:14:34 +02:00
parent 519609d26e
commit 26638b30d4
2 changed files with 14 additions and 6 deletions

View file

@ -82,6 +82,7 @@ function! startify#insane_in_the_membrane() abort
nnoremap <buffer><silent> i :enew <bar> startinsert<cr>
nnoremap <buffer><silent> b :call <sid>set_mark('B')<cr>
nnoremap <buffer><silent> s :call <sid>set_mark('S')<cr>
nnoremap <buffer><silent> t :call <sid>set_mark('T')<cr>
nnoremap <buffer><silent> v :call <sid>set_mark('V')<cr>
nnoremap <buffer> <cr> :call <sid>open_buffers(expand('<cword>'))<cr>
nnoremap <buffer> <2-LeftMouse> :execute 'normal' matchstr(getline('.'), '\w\+')<cr>
@ -370,7 +371,7 @@ function! s:set_mark(type) abort
setlocal modifiable
" set markers
if id =~# '[BSV]'
if id =~# '[BSTV]'
" replace marker by old ID
execute 'normal! ci]'. remove(s:marked, line('.'))[0]
else
@ -406,6 +407,13 @@ function! s:open_buffers(cword) abort
else
execute 'vsplit' path
endif
" open in tab
elseif type == 'T'
if line2byte('$') == -1
execute 'edit' path
else
execute 'tabnew' path
endif
" open in current window
else
execute 'edit' path

View file

@ -53,10 +53,10 @@ Startify basically provides two things:
jumps into insert mode, 'q' quits.
Moreover, you can open several files at one go. Navigate to an entry and
hit either 'b' (open in same window), 's' (open in split) or 'v' (open in
vertical split). You can do that for multiple entries. You can also mix
them. The order of the selections will be remembered. Afterwards execute
these actions via <cr>.
hit either 'b' (open in same window), 's' (open in split), 'v' (open in
vertical split) or 't' (open in tab). You can do that for multiple entries.
You can also mix them. The order of the selections will be remembered.
Afterwards execute these actions via <cr>.
When the selection is finished, Startify will close automatically. You can
reopen the screen via :Startify.
@ -261,7 +261,7 @@ NOTE: There is no sanitizing going on, so you should know what you're doing!
Best practices:
- do not use 'e', 'i' or 'q' (they will be overwritten anyway)
- do not use 'b', 's', 'v' (used for opening several files at once)
- do not use 'b', 's', 't', 'v' (used for opening several files at once)
- do not use duplicates (previous mappings will be overwritten)
- do not uses empty strings (creates unreachable entries)
- you might want to keep 'j' and 'k' (for navigation)