1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-09-07 04:30:54 +02:00

Installation Instruction and Keybindings

This commit is contained in:
Ryan Greenup
2020-07-14 21:28:48 +10:00
parent 1381b5bb08
commit b52905958f
2 changed files with 45 additions and 12 deletions

View File

@@ -19,15 +19,36 @@ main() {
# *** Skim and Grep, the important stuff
SkimAndGrep () {
command -v xclip >/dev/null 2>&1 || { echo >&2 "I require xclip but it's not installed. Install it with something like pacman -S xclip Aborting."; exit 1; }
command -v rg >/dev/null 2>&1 || { echo >&2 "I require ripgrep, with the binary rg in the path, but it's not installed, install it with ~cargo install rg~. Aborting."; exit 1; }
command -v mdcat >/dev/null 2>&1 || { echo >&2 "I require mdcat but it's not installed. Install it with ~cargo install mdcat~ Aborting."; exit 1; }
command -v sk >/dev/null 2>&1 || { echo >&2 "I require skim, with the binary sk in the path, but it's not installed. Install it with ~cargo install skim~ Aborting."; exit 1; }
## If using fish, cleverness can be utilised to highlight matches.
## fish only, not zsh or bash
if [[ "$(basename $SHELL)" == "fish" ]]; then
ramtmp="$(mktemp -p /dev/shm/)"
sk -c "echo {} > "${ramtmp}" ; rg -t markdown -l --ignore-case (cat "${ramtmp}")" \
--preview "mdcat {} 2> /dev/null | \
rg -t markdown --colors 'match:bg:yellow' \
--no-line-number --ignore-case --pretty --context 20 (cat "${ramtmp}")" \
--bind 'ctrl-f:interactive,pgup:preview-page-up,pgdn:preview-page-down,ctrl-y:execute-silent(echo {} | xargs realpath | xclip -selection clipboard)'
--bind 'ctrl-f:interactive,pgup:preview-page-up,pgdn:preview-page-down,ctrl-w:execute-silent(echo {} | xargs realpath | xclip -selection clipboard),alt-w:execute-silent(echo {} | xclip -selection clipboard)'
## Add -i to make it interactive from the start
## C-q toggles interactive
## C-y Copies Full path to clipboard
exit 0
else
sk --ansi -c 'rg -l -t markdown --ignore-case "{}"' --preview "mdcat {}" \
--bind 'ctrl-f:interactive,pgup:preview-page-up,pgdn:preview-page-down,ctrl-w:execute-silent(echo {} | xargs realpath | xclip -selection clipboard),alt-w:execute-silent(echo {} | xclip -selection clipboard)'
fi
}
#
@@ -69,7 +90,8 @@ Help () {
echo -e " \e[1;91m \e[1m Binding \e[0m\e[0m \e[1;34m┊┊┊ \e[0m Description "
echo -e " ..............\e[1;34m┊┊┊\e[0m........................................... "
echo -e " \e[1;93m Ctrl - y \e[0m \e[1;34m ┊┊┊ \e[0m Copy the Full Path to the Clipboard"
echo -e " \e[1;93m Ctrl - w \e[0m \e[1;34m ┊┊┊ \e[0m Copy the Full Path to the Clipboard"
echo -e " \e[1;93m Alt - w \e[0m \e[1;34m ┊┊┊ \e[0m Copy the Relative Path to the Clipboard"
echo -e " \e[1;32m Ctrl - e \e[0m \e[1;34m ┊┊┊ \e[0m Copy the Relative path to the clipboard"
echo -e " \e[1;33m Ctrl - q \e[0m \e[1;34m ┊┊┊ \e[0m Toggle Searching with ripgrep"

View File

@@ -26,9 +26,17 @@ this is an attempt to wrap them into a single script and then have aliases to ma
## Installation
To install, satisfy [the dependencies](#Dependencies) and do something like this:
To install, satisfy [the dependencies](#Dependencies) and add `$HOME/bin` to the `$PATH` variable, something like this should be fairly shell agnostic:
``` bash
echo $PATH | grep "$HOME/bin" &> /dev/null && echo "$HOME/bin in path already" || ls "$HOME/bin" &> /dev/null && echo 'PATH="$PATH:$HOME/bin"' >> $HOME/.profile
```
then copy in the scripts, with [*stow*] something like this should be sensible:
```bash
exec bash
cd ~/DotFiles
if [[ -d ".git" ]]; then
@@ -99,7 +107,7 @@ It is assumed that:
- [sk](https://github.com/lotabout/skim)
- [rg](https://www.google.com/search?client=firefox-b-d&q=ripgrep+github)
- [perl](https://wiki.archlinux.org/index.php/Perl)
- [stow](https://www.google.com/search?client=firefox-b-d&q=gnu+stow)
- [*stow*]
- [python](https://www.python.org/download/releases/3.0/)
- [tmsu](https://aur.archlinux.org/packages/tmsu/)<sup>AUR</sup>
- [ranger](https://www.archlinux.org/packages/community/any/ranger/)
@@ -120,6 +128,7 @@ It is assumed that:
- [MkDocs Material Extensions](https://pypi.org/project/mkdocs-material-extensions/)
- [VNote](https://github.com/tamlok/vnote)
- [Pandoc](https://github.com/jgm/pandoc)
- [MarkText](https://github.com/marktext/marktext)
## Recommended Aliases
@@ -138,3 +147,5 @@ TODO
[shared_memory]: http://en.wikipedia.org/wiki/Shared_memory
[^wpdtmpfs]: [From Wikipedia][shared_memory] Recent 2.6 Linux kernel builds have started to offer /dev/shm as shared memory in the form of a ramdisk, more specifically as a world-writable directory that is stored in memory with a defined limit in /etc/default/tmpfs. /dev/shm support is completely optional within the kernel config file.
[*stow*]: https://www.google.com/search?client=firefox-b-d&q=gnu+stow