Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

What is a good way to execute “:file” (“display menu of programs set for the file type of the current file.”)? Any idea on a standard keyboard shortcut?

I have a directory tree with some files with which I do two things:
1. (on a single file) gvim -O ../known/%c ../unknown/%c ../unneeded/%c
2. (on one, several, or — by default — all files) cd .. && ./do.sh %f:p %m

  • For the first action, I gave the files an extension and made a filextype definition.
  • For the second action, I made a “command!”.

I hope to avoid having to add an extension or type an Ex command.

I added the second action to the filextype definition and added “nnoremap <cr> :file<cr>”. It’s usable, because I usually use l to switch between directories, but is obviously confusing.

by

Hm…

The "echo -n &&" workaround works only with a single file; with multiple files, Vim is started with the files open.

by

Maybe there are non-*.wdk files in selection?

by

.wdk is not used any more.

`
filetype ///home/user/Documents/wikidata/(known|unknown|unneeded)/.*//

\ {my Wikidata knowledge tool}
\ echo -n && cd .. && ./do.sh %f:p %m,

`

by

That was a bug with handling path regexps, fixed on latest master (d681808), thanks!

by

Thanks, it works in 0.8.1a.

1 Answer

0 votes
by

Solved for the first action:

autocmd DirEnter ~/Documents/wikidata/*/ nnoremap o :!gvim -O ../known/%c ../unknown/%c ../unneeded/%c<cr>

autocmd DirEnter !~/Documents/wikidata/*/ execute 'nnoremap o :!gvim --remote-tab-silent %f<cr>'

For the second action, I found “//path-regular-expression//[iI]”, so I could define a filetype for all files in those directories. But I can’t find out how to use that or path globs.

by

For the second action, I found “//path-regular-expression//[iI]”, so I could define a filetype for all files in those directories. But I can’t find out how to use that or path globs.

It's the same, just wrap the pattern with //, a couple of examples:

filextype ///home/xaizek/archive/articles/.*\.pdf// vim
execute 'filextype //'.$HOME.'/archive/articles/.*\.pdf// vim'
by

Thanks. So I tried it correctly at first, but couldn't notice because my command with "cd .. &&" (unlike nano %c) is affected by that Vim-running "interference" above.

...