Navi
To instal navi
1 on Linux you can use
$ bash <(curl -sL https://raw.githubusercontent.com/denisidoro/navi/master/scripts/install)
When installing navi
on Ubuntu 20 you will get the error
invalid preview window layout: up:2:nohidden
invalid preview window layout: up:2:nohidden
invalid preview window layout: up:2:nohidden
This is very likely due to the fact that the fzf
2 version is too old (perhaps 0.20).
To upgrade to the latest version of fzf
use:
$ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
$ ~/.fzf/install
Importing cheatsheets
You can import cheatsheets from any git repository that includes .cheat files:
$ navi repo add https://github.com/ruivieira/cheatsheets
External variables
It is possible to populate variables with external data in navi
.
To do so, specify how fzf
will extract the data.
For instance, the command
docker stop <container_id>
will stop the container <container_id>
, which we could extract from the output of
$ docker ps
We can then specify docker ps
and the input of docker stop
and instruct fzf
on the data’s format. For instance, here (line 2) we say that from the command of docker ps
we should extract the first column, delimited by spaces and remove the first line, since it is the header.
docker stop <container_id>
$ container_id: docker ps --- --column 1 --header-lines 1 --delimiter '\s\s+'