cocopon / vaffle.vim

:file_folder: Lightweight, window-based file manager for Vim
MIT License
284 stars 20 forks source link

Open file with default application #37

Closed K1DV5 closed 4 years ago

K1DV5 commented 4 years ago

This is an awesome plugin, I just have a little question. I wanted to create a mapping that would open the file or directory with the default application as if I double clicked it. For NERDTree, I had the execute_menuitem plugin. I think it can be done with the <Plug>(vaffle-fill-cmdline) and by typing silent !start (for Windows). Now my question is, how do I combine the <Plug> mapping and typing the !start in a single mapping?

cocopon commented 4 years ago

I don't know how to combine <Plug> with other commands but you can do it with vaffle#fill_cmdline() instead of <Plug>(vaffle-fill-cmdline) like this:

  function! s:customize_vaffle_mappings() abort
    nmap <buffer> <silent> x :<C-u>call vaffle#fill_cmdline() <Bar> call feedkeys('silent !start')<CR>
  endfunction

  augroup vimrc_vaffle
    autocmd!
    autocmd FileType vaffle call s:customize_vaffle_mappings()
  augroup END
K1DV5 commented 4 years ago

Thanks, closing.