Просмотр исходного кода

Introduce T for opening files in tabs

Closes #39.
Marco Hinz 12 лет назад
Родитель
Сommit
26638b30d4
2 измененных файлов с 14 добавлено и 6 удалено
  1. 9 1
      autoload/startify.vim
  2. 5 5
      doc/startify.txt

+ 9 - 1
autoload/startify.vim

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

+ 5 - 5
doc/startify.txt

@@ -53,10 +53,10 @@ Startify basically provides two things:
    jumps into insert mode, 'q' quits.
    jumps into insert mode, 'q' quits.
 
 
    Moreover, you can open several files at one go. Navigate to an entry and
    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
    When the selection is finished, Startify will close automatically. You can
    reopen the screen via :Startify.
    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:
 Best practices:
 
 
 - do not use 'e', 'i' or 'q'  (they will be overwritten anyway)
 - 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 use duplicates  (previous mappings will be overwritten)
 - do not uses empty strings  (creates unreachable entries)
 - do not uses empty strings  (creates unreachable entries)
 - you might want to keep 'j' and 'k'  (for navigation)
 - you might want to keep 'j' and 'k'  (for navigation)