Oh-my-fish: Custom functions and completions

Created on 16 Mar 2016  路  6Comments  路  Source: oh-my-fish/oh-my-fish

How can I define custom completions and functions that get autoloaded? I added my completions and functions to $OMF_CONFIG/completions and $OMF_CONFIG/functions, but they wont get loaded. When I add autoload $OMF_CONFIG/completions/ to my init.fish it seems to work. But shouldn't it be the case that omf automatically scans the $OMG_CONFIG folder and loads/sources the files?

question

Most helpful comment

Add a function called fish_user_key_bindings. Unfortunately, fish doesn't support multiple key bindings functions, so you'll have to put 'em all in one for now. Once our next iteration on OMF's init script lands, we will support per-plugin key bindings as well.

All 6 comments

where to put custom key bindings?

Add a function called fish_user_key_bindings. Unfortunately, fish doesn't support multiple key bindings functions, so you'll have to put 'em all in one for now. Once our next iteration on OMF's init script lands, we will support per-plugin key bindings as well.

And yes, $OMF_CONFIG/completions and $OMF_CONFIG/functions should be autoloaded as well. It looks like it currently only autoloads functions, but again, next version handles both :)

Thanks i was wondering why my key bindings did not work. It seems that user key bindings are currently not working in vi-mode.

If you're using vi-mode, it is slightly different.
You need to put your bind calls in a fish_vi_key_bindings function.
Either (1) create this function in your config.fish,
or (2) source it from config.fish,
or (3) put it in a fish_vi_key_bindings.fish file, inside a directory that is autoloaded (e.g. ~/.config/fish/functions or $OMF_CONFIG/functions).

This appears to be resolved. In addition, $OMF_CONFIG/completions now works with the latest OMF version, and regular key bindings can now be placed in $OMF_CONFIG/key_bindings.fish.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edoarda picture edoarda  路  7Comments

onmyway133 picture onmyway133  路  7Comments

Joe23232 picture Joe23232  路  4Comments

adgai19 picture adgai19  路  3Comments

quenode picture quenode  路  6Comments