Crates.io | bmark |
lib.rs | bmark |
version | 0.1.5 |
source | src |
created_at | 2023-04-03 11:22:18.105217 |
updated_at | 2023-09-06 19:03:56.763125 |
description | Bookmarks cli for your local file system. |
homepage | https://BalderHolst.com/projects/bmark |
repository | https://github.com/BalderHolst/bmark |
max_upload_size | |
id | 829025 |
size | 45,615 |
Have you ever opened a terminal, just to spend the next few seconds navigating to the right folder? No more! Introducing bmark
, the local bookmark manager. Search through your local bookmarks with a dmenu-like fuzzy finder, and open a terminal right in that directory!
This tool has been tested on fedora linux and nixos, and should work on all linux distros. MacOs and Windows are currently not supported, but may be implemented in the future.
For this tool to work out of the box, you will need the following installed on your system:
Even though these programs are the default, they are not strictly required as they can be swapped out for similar ones using the configuration file.
From zero to bmark
.
Install cargo and the default programs.
sudo dnf install cargo rofi kitty neovim
Now install bmark
.
cargo install bmark
If you have not already, add the ~/.cargo/bin
folder to your $PATH
. This can be done by adding this line to your ~/.bashrc
or ~/.zshrc
:
PATH=$HOME/.cargo/bin:$PATH
You should now be able to run bmark
in your terminal!
To enable bmark's navigation aliases, you also need to source the aliases.sh file. The command for doing this can be automatically added to your shell config like this:
# For bash:
bmark config source-cmd >> ~/.bashrc && bash
# For zsh:
bmark config source-cmd >> ~/.zshrc && zsh
All done!
Get a quick overview by running with no arguments:
bmark
Output:
Optional arguments:
-h, --help print help message
-v, --verbose be verbose
Subcommands:
add add a bookmark to the current working directory
edit edit bookmarks in a text editor
list list all stored bookmarks
open open a new terminal in a bookmarked location
rm remove a bookmark with a given name
config commands for managing bmark configuration
update update shell aliases file
Add a bookmark to the current working directory. By default this bookmark will be named the same as to the current directory (ex: "foo/bar" -> "bar"), but you can specify a different name by providing it.
Edit the bookmarks.toml
file directly in your editor. The editor is determined by the editor_cmd
option (default is 'nvim').
List the current bookmarks in the terminal.
Launch dmenu-like program, search through bookmarks and open a terminal in the selected location. The terminal and dmenu-like program is determined by the user configuration (default is 'kitty' and 'rofi').
Remove a bookmark by its name.
Commands for managing configuration.
See configuration.
Update the aliases file (see aliases). This is done automatically whenever you alter your bookmarks file through. This command is only usefull if you manually open and the bookmarks.toml
file without using bmark edit
. The command for doing this can be generated like this:
bmark config source-cmd
bmark
automatically created a file called aliases.sh
in the data directory. This file defines shell aliases, that navigate to all your bookmarks.
If you you have a bookmark called "myMark" you can navigate to it like this:
_myMark
All the bookmark aliases are prefixed with '_' by default. This can be changed with the alias_prefix
option.
To enable this in your shell, you need to source the alias file from your shell configuration file (ex: .bashrc
for .zshrc
).
bmark
configuration is done using the configuration file. This file is located in the configuration directory (ex: ~/.config/bmark/config.toml
). To create a config file with the default values run the following command:
bmark config create
Edit the configuration file easily with this command:
bmark config edit
To show the current config, run this command:
bmark config show
Option | Default Value |
---|---|
data_dir | "~/.local/share/bmark" |
dmenu_cmd | "rofi -matching fuzzy -dmenu" |
editor_cmd | "nvim" |
terminal_cmd | "kitty --detach" |
alias_prefix | "_" |
show_paths | false |
display_sep | " : " |
The directory where the bookmarks.toml
and aliases.sh
file is stored.
The dmenu-like command is used for fuzzy-finding through bookmarks. This program should (like dmenu) take input from a pipe, and output the selected line to stdout. To check if a program is suitable for this you can run the following:
seq 20 | <dmenu_cmd>
This should give you a menu with the numbers from 1 to 20, when you pick one, it should be output in the terminal.
If your command works, you can make bmark use that by adding a like to the '~/.config/bmark/config.toml' file:
dmenu_cmd = "<dmenu_cmd>"
The default command is rofi -dmenu
.
If you want to use the actual dmenu instead of rofi, simply add this to your config .
dmenu_cmd = "dmenu"
(be sure to have rofi installed)
The editor command is run whenever you ask bmark to edit a file (ex: bmark edit
). This command should be able to be used like this:
<editor_cmd> <file>
For this a terminal based editor like neovim is recommended.
The terminal command is the command used for spawning terminal emulators at the desired locations. This command should be able to spawn a terminal in the root directory like this:
<terminal_cmd> /
If you are not using the kitty
terminal, you should probably change this.
The prefix in front of the bookmark name for generated aliases.
Whether or not, to show paths in the dmenu-like fuzzy finder. If false, the display_sep
has no effect.
The characters separating the bookmark names from their paths when listing or searching through your bookmarks.