I want to open the list of visual selection's files on new tabs such that the top-tab-bar is visible
Mapping based on the answer here about How do I loop over a list of files from a visual selection?
:nnoremap <Leader>gf :silent! exec "!nvim " shellescape('<cfile>') <bar> redraw!<cr>
where in the place of
!nvim, I have tried unsuccessfully
The main point of the question is to open a list of several files formatted like this:
/Users/masi/file1.txt /Users/masi/file2.txt /Users/masi/file3.txt
Where you select in visual mode (
v and cover for instance two lines) and press
<Leader>gf for the activation of the command which will open all the selected files in new tabs.
My Applicable .vimrc after statox and nobe4's answers
I think semantics can confuse them.
"" Mapleader is space now from \ let mapleader=" " "" Quick tabs - Go to tab by number noremap <leader>1 1gt noremap <leader>2 2gt noremap <leader>3 3gt noremap <leader>4 4gt noremap <leader>5 5gt noremap <leader>6 6gt noremap <leader>7 7gt noremap <leader>8 8gt noremap <leader>9 9gt noremap <leader>0 :tablast<CR> "" Go to last active tab au TabLeave * let g:lasttab = tabpagenr() nnoremap <C-Left> :tabprevious<CR> nnoremap <C-Right> :tabnext<CR> "" https://vi.stackexchange.com/a/7787/2923 function! OpenSelectionAsTabs() range let tabnr = tabpagenr() for line in range(a:firstline, a:lastline) "" to allow whitespaces in names https://vi.stackexchange.com/a/7865/2923 execute "tabedit " . fnameescape(getline(line)) execute "tabp" endfor endfunction nnoremap <leader>gf :'<,'>call OpenSelectionAsTabs()<CR> vnoremap <leader>gf :call OpenSelectionAsTabs()<CR>
How can you open a list of files into tabs with Tab-top-bar?