Added a short <prefix>-i for cheat sheet (cht.sh) lookup

This commit is contained in:
Sagi Dayan 2022-01-10 10:11:20 +02:00
parent 3d9a798812
commit f17255a377
Signed by: sagi
GPG key ID: FAB96BFC63B46458
7 changed files with 106 additions and 2 deletions

View file

@ -0,0 +1,20 @@
#!/bin/bash
########################################################
# DO NOT EDIT - WILL BE DISCARDED IN NEXT PLAYBOOK RUN #
########################################################
# Get docs fast
selected=`/bin/cat ~/.shellconfig/cheat/languages ~/.shellconfig/cheat/commands | fzf --header="Select a topic"`
if [[ -z $selected ]]; then
exit 0
fi
read -p "Enter Query: " query
if grep -qs "$selected" ~/.shellconfig/cheat/languages; then
query=`echo $query | tr ' ' '+'`
tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done"
else
tmux neww bash -c "curl -s cht.sh/$selected~$query | less"
fi

View file

@ -0,0 +1,35 @@
find
fzf
man
tldr
sed
awk
tr
cp
ls
grep
xargs
ps
mv
kill
lsof
less
head
tail
tar
rm
jq
cat
ssh
cargo
git
podman
docker
docker-compose
chmod
chown
make
kubectl
oc
ocp
systemctl

View file

@ -0,0 +1,15 @@
golang
nodejs
yaml
javascript
tmux
typescript
zsh
cpp
c
rust
python
bash
css
markdown
ansible

View file

@ -12,7 +12,6 @@ alias :Q=exit
alias ls='lsd'
alias f='printf "\033c"'
alias cat=bat
alias top=btm
alias t=tmux

View file

@ -33,6 +33,9 @@ bind-key j send-keys Down
# Easy config reload
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded."
# Lookup the cheat sheet <prefix>-i
bind-key i run-shell "tmux neww ~/.shellconfig/cheat.sh"
############################
# Themes
###########################

View file

@ -0,0 +1,8 @@
- hosts: localhost
vars:
# Theme options: monokai, gruvbox, nord, tomorrow-night
theme: tomorrow-night
# The running user
running_user: "{{ ansible_user_id }}"
roles:
- modern_unix_tools

View file

@ -70,6 +70,11 @@
path: ~/.shellconfig/autocomplete
state: directory
- name: Verifying shell cheat config folder
file:
path: ~/.shellconfig/cheat
state: directory
- name: Sync Common shell settings...
changed_when: false
copy:
@ -77,6 +82,14 @@
dest: ~/.shellconfig/common.sh
force: yes
- name: Sync Cheat script
changed_when: false
copy:
src: dotfiles/shellconfig/cheat.sh
dest: ~/.shellconfig/cheat.sh
force: yes
mode: u+rx,g-rx,o-rwx
- name: Copy shell aliases
copy:
src: dotfiles/shellconfig/aliases.sh
@ -95,7 +108,18 @@
dest: ~/.shellconfig/environment.sh
force: no
- name: Copy languages cheat sheet list
copy:
src: dotfiles/shellconfig/cheat/languages
dest: ~/.shellconfig/cheat/languages
force: yes
- name: Copy commands cheat sheet list
copy:
src: dotfiles/shellconfig/cheat/commands
dest: ~/.shellconfig/cheat/commands
force: yes
- name: Install modern UNIX tools
include_role:
name: modern_unix_tools