Code in .vimrc which starts graphical Neovim on a filename when pressing gff% http://unix.stackexchange.com/q/277918/16920:nnoremap gff :silent! exec !gnvim  shellescape('<cfile>') <bar> redraw!<cr>SituationView: a list of files. Highlight some of them. Press gff. Wanted: get many gvims of multiple documents open. How do I loop over a list of files from a visual selection?
How do I loop over a list of files from a visual selection?
key bindings;visual mode
:vnoremap gff :<C-U>'<,'>g/^/silent! exec !gnvim  . shellescape('<cfile>') <bar> redraw!<cr>The mapping is for visual mode, and performs a global on all lines that match /^/...have a start. Then the rest is the same.Since exec is run synchronously you will only get one instance at a time and your current vim instance will block waiting for the first launched gnvim to end. To get multiple instances at once you'll need to ether use the OS's background process management ( & in unix systems), or use some sort of dispatching system like screen or tmux. See tpope's Dispatch plugin.So assuming you are on a Linux/BSD/OSX system:vnoremap gff :<C-U>'<,'>g/^/silent! exec !gnvim  . shellescape('<cfile>') .  & <bar> redraw!<cr>If you are on Windows you can use START /B program:vnoremap gff :<C-U>'<,'>g/^/silent! exec !START /B gnvim  . shellescape('<cfile>') <bar> redraw!<cr>To script this up using OS detection:if has(win32) || has(win64)  :vnoremap gff :<C-U>'<,'>g/^/silent! exec !START /B gnvim  . shellescape('<cfile>') <bar> redraw!<cr>else  :vnoremap gff :<C-U>'<,'>g/^/silent! exec !gnvim  . shellescape('<cfile>') .  & <bar> redraw!<cr>endif