User: Password:
|
|
Subscribe / Log in / New account

Fish - filename transformation

Fish - filename transformation

Posted May 30, 2005 9:22 UTC (Mon) by liljencrantz (guest, #28458)
In reply to: Fish - filename transformation by pason.fazon
Parent article: Fish - The friendly interactive shell

This type of feature is the kind of thing that should be possible to do yourself with very little effort. There is a world of difference between something configurable and something extensible. While there are virtually no configuration options in fish, there is a rudimentary framework for extending the shell using simple shellscripts. As this framework improves, I hope people will start hacking shellscripts that extend fish and make it cooler.

You can already bind arbitrary shell commands to a keyboard shortcuts, and get the value of the token under the cursor. Writing a bit of shellscript to change from a relative to an absolute filename is pretty easy. The only part that is missing is changing the token under the cursor. You can currently only set or append to the commandline. I was already planning on adding support for changing the current token, in order to move more and more of the fish implementation into shellscript.

So in the near future, the following should do what you want:

1). Create a file called .fish_inputrc in your home directory containing the lines

$include /etc/fish_inputrc
"\M-a": evaluate-command make_absolute_path

2). Create a file called .fish in your home directory containing something like this:

function make_absolute_path
set result $PWD/(commandline --current-token)
commandline --current-token $result
end

Obviously, the relative to absolute convertion is in much need of improvement, but otherwise, that should work as soon as I add the required functionality to the commandline builtin.


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds