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.

Beginner's questions about Vifm functionallity

0 votes
asked Jul 11 in vifm by anonymous
  • What's the rationale behind gj and gk? I know that gh and gl are used in lsview but I could not find any application of gj and gk.

  • Same thing with l and i. Both seem to do the same thing. Is there any difference between them?

  • I don't understand types of filters. Documentation describes three types, specifically manual, automatic and local but the semantics isn't clear for me. I suppose they relate to where I type filter command but I'm not sure.

  • How yank works internally? Does it create some file containing paths of yanked files for every register somewhere in home directory?

  • It might seem strange, but I have no idea what { and } are supposed to do. I've read descriptions of these in the documentation several times and even then they looked strange to me. I must be missing something apparently.

  • Do zj and zk work only in tree mode? Outside of it they simply don't work for me or perhaps they are one more thing I didn't get reading manual.

  • Same thing about [z and ]z. Inside tree view they seem useful, however outside they basically jump to the top and bottom of view, just like gg and G.

  • Is there a way to fold directories in tree view mode?

  • What abbreviations are used for? I could not find any information about them and information provided by documentation isn't clear for me.

  • What's the distinction between marks and bookmarks? As far as I can comprehend, marks operate on directories whereas bookmarks operate on files?

  • Does vifm support defining custom functions inside vifmrc? What's the state of plugin ecosystem in general? Seems like there is no way to write one at this moment.

1 Answer

0 votes
answered Jul 11 by xaizek
 
Best answer

What's the rationale behind gj and gk? I know that gh and gl are used in lsview but I could not find any application of gj and gk.

gj and gk are defined just for consistency and currently are equivalent to j and k respectively.

Same thing with l and i. Both seem to do the same thing. Is there any difference between them?

If you press l on an executable it might run it (depends on 'runexec' option), while i never runs element you pick and can be used to edit a script.

I don't understand types of filters. Documentation describes three types, specifically manual, automatic and local but the semantics isn't clear for me. I suppose they relate to where I type filter command but I'm not sure.

That's quite right. Manual is what you setup with :filter, automatic is populated by zf and local is an interactive filtering with =.

How yank works internally? Does it create some file containing paths of yanked files for every register somewhere in home directory?

The list of paths is kept in memory, but if you close vifm and 'vifminfo' option contains "registers", the list is saved in vifminfo file.

It might seem strange, but I have no idea what { and } are supposed to do. I've read descriptions of these in the documentation several times and even then they looked strange to me. I must be missing something apparently.

If you are on a file, } will move to next entry that is a directory.
If you are on a directory, } will move to next entry that is a file.
{ does the same in the opposite direction.

Referencing ( in corresponding docs might be confusing and could be improved.

Do zj and zk work only in tree mode? Outside of it they simply don't work for me or perhaps they are one more thing I didn't get reading manual.

They are similar to { and }, but navigate only to directories. To see zj and zk working you need to have some directories in file list.

Same thing about [z and ]z. Inside tree view they seem useful, however outside they basically jump to the top and bottom of view, just like gg and G.

When not in tree mode, all entries are on the same level, so they in fact become gg and G.

Is there a way to fold directories in tree view mode?

There isn't at the moment. You can use zd to exclude a directory completely.

What abbreviations are used for? I could not find any information about them and information provided by documentation isn't clear for me.

To do some sort of macro expansion on command-line. Like:
cabbrev findhere find -maxdepth 1 -name

then by typing "findhere" in command line mode you'll get that longer string and will be able to continue typing and see the full command that will be executed.

What's the distinction between marks and bookmarks? As far as I can comprehend, marks operate on directories whereas bookmarks operate on files?

Both can be used on files and directories. The difference is that marks are shorter and quicker to use (can be part of :ranges; can be used in a motion), but harder to remember and not convenient after number of things pass some threshold. Bookmarks aren't limited in their count, searchable and can have more explicit names.

Does vifm support defining custom functions inside vifmrc? What's the state of plugin ecosystem in general? Seems like there is no way to write one at this moment.

No, but the need for functions is present, because complicated mappings of :command definitions are hard to write and don't look nice.
I don't think there are any plugins out there. There are means for extending builtin functionality, but supporting some sort of plugins wasn't actually a goal so far.

commented Jul 11 by anonymous

Did you consider embedding another scripting language like Lua instead of using Vimscript?
Apart from the fact that it would require additional time to properly implement Vimscript, after all those years with Vim I can't think of any other language that's such hard to learn and full of edge cases. Additionally I don't think it's possible to create one-to-one copy of Vimscript inside Vifm which would bring another source of confusion for people already familiar with Vimscript.

I don't know if you are familiar with Lua, but it was designed as configuration language. It's very small thus easy to learn. Thanks to its syntax, it would be easy to create sort of DSL for configuring and scripting Vifm. No more weird escaping of multi line commands.

I did not read the source code of Vifm yet, but embedding Lua within shouldn't be hard I guess.

PS: https://github.com/martanne/vis here is a link to repo of a vim clone which uses Lua as a configuration language. You might look how it works in real code. A lot of functionality can be offloaded into plugins hence leaving C core less bloated with features.

commented Jul 11 by xaizek

Current configuration is necessarily based on Vimscript simply because it's nothing but a series of command-line commands, which are Vim-like (not exact copies, but that's not the purpose). Changing that, would made it harder to use and less Vim-like. I wouldn't consider vis a real Vim clone if my understanding that it doesn't have a proper command-line mode is correct. I'm also not sure there is that much to offload in vifm.

Copying Vimscript is just the most straightforward and familiar thing to do, but I'm trying to add only necessary stuff.

When thinking about any sort of real plugins, my conclusion was that Vim's approach of embedding language support isn't optimal. I'd prefer there to be a C API which would allow writing plugins for other languages like Lua. This way support of any language would be something external. I don't really see much possibilities for plugins though, hence it's unclear what such API should include.

commented Jul 12 by anonymous

More events we could hook into. Some ideas of plugins that come to my mind:

  • CVS integration (state indication of each file inside git repo)
  • Event for CWD change to write some kind of integration with outside environment (on every change, not when quitting Vifm)
  • Custom views (for example sorting /dev into categories like ttys, discs etc.)
  • Event for changing focus of active pane
  • Defining custom column types in viewcolumns, not just the sorting keys (that way we could try to implement CVS integration by providing custom column with git state of the file).
commented Jul 12 by xaizek

Thanks for the examples. With that and some others in mind it might be easier to imagine how it should be implemented and something to try it on.

Event for CWD change to write some kind of integration with outside environment

There is :autocmd, which might address some of it.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...