mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
commit
76e216b24a
13 changed files with 162 additions and 24 deletions
23
README.md
23
README.md
|
@ -76,14 +76,28 @@ cd "$plugins_dir"
|
|||
git clone https://github.com/denisidoro/navi
|
||||
```
|
||||
|
||||
Then, add it to the oh-my-zsh plugin array:
|
||||
Then, add it to the oh-my-zsh plugin array to automatically enable the zsh widget:
|
||||
```sh
|
||||
plugins=(docker tmux fzf navi)
|
||||
```
|
||||
|
||||
Finally, you can use it as a [shell widget](#shell-widget).
|
||||
Lastly, reload your `zshrc` or spawn a new terminal to load navi. Once this is done, you should be able to use it
|
||||
as a [shell widget](#shell-widget) with no additional setup.
|
||||
|
||||
> Please note that when installing as an oh-my-zsh plugin, `navi` will not be available as a command. If you also want
|
||||
> to be able to run the command interactively, you will need to do one of the following:
|
||||
|
||||
- Install it to /usr/bin/local (via `sudo make install`)
|
||||
- Manually set your `PATH` so that navi can be found.
|
||||
|
||||
You can manually update your path by adding a line like this in your `.zshrc`:
|
||||
|
||||
```sh
|
||||
export PATH=$PATH:"$ZSH_CUSTOM/plugins/navi"
|
||||
```
|
||||
|
||||
And verify that it works by running `which navi` after reloading your configuration.
|
||||
|
||||
This method has the advantage of not requiring root to install and the disadvantage of not allowing you to invoke the script by calling `navi` (unless you add an alias to it or copy it to a folder in `$PATH`).
|
||||
|
||||
Upgrading
|
||||
---------
|
||||
|
@ -124,6 +138,9 @@ source "$(navi widget bash)"
|
|||
|
||||
# zsh
|
||||
source "$(navi widget zsh)"
|
||||
|
||||
# fish
|
||||
source (navi widget fish)
|
||||
```
|
||||
|
||||
By default, `Ctrl+G` is assigned to launching **navi**. If you want to change the keybinding, replace the argument of `bind` or `bindkey` in [the widget file](https://github.com/denisidoro/navi/search?q=filename%3Anavi.plugin.*&unscoped_q=filename%3Anavi.plugin.*).
|
||||
|
|
|
@ -24,4 +24,4 @@ $ device: adb devices --- --headers 1 --column 1
|
|||
# Start emulator
|
||||
"$ANDROID_HOME/tools/emulator" -avd <emulator> -netdelay none -netspeed full
|
||||
|
||||
$ emulator: "$ANDROID_HOME/tools/emulator" -list-avds
|
||||
$ emulator: "$ANDROID_HOME/tools/emulator" -list-avds
|
||||
|
|
|
@ -21,4 +21,4 @@ gzip -d <gz_file>
|
|||
$ path: ls
|
||||
$ tar_file: ls *.tar
|
||||
$ targz_file: ls *.tar.gz
|
||||
$ gz_file: ls *.gz
|
||||
$ gz_file: ls *.gz
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
crontab -l
|
||||
|
||||
# Edit cron job
|
||||
crontab -e
|
||||
crontab -e
|
||||
|
|
|
@ -36,5 +36,36 @@ docker exec -it <container_id> bash
|
|||
# Print the last lines of a container’s logs
|
||||
docker logs --tail 100 <container_id> | less
|
||||
|
||||
# Print the last lines of a container's logs and following its logs
|
||||
docker logs --tail 100 <container_id> -f
|
||||
|
||||
# Create new network
|
||||
docker network create <network_name>
|
||||
|
||||
$ image_id: docker images --- --headers 1 --column 3
|
||||
$ container_id: docker ps --- --headers 1 --column 1
|
||||
$ container_id: docker ps --- --headers 1 --column 1
|
||||
|
||||
|
||||
|
||||
% docker-compose, container
|
||||
|
||||
# Builds, (re)creates, starts, and attaches to containers for all services
|
||||
docker-compose up
|
||||
|
||||
# Builds, (re)creates, starts, and dettaches to containers for all services
|
||||
docker-compose up -d
|
||||
|
||||
# Builds, (re)creates, starts, and attaches to containers for a service
|
||||
docker-compose up -d <service_name>
|
||||
|
||||
# Builds, (re)creates, starts, and dettaches to containers for a service
|
||||
docker-compose up -d <service_name>
|
||||
|
||||
# Print the last lines of a service’s logs
|
||||
docker-compose logs --tail 100 <service_name> | less
|
||||
|
||||
# Print the last lines of a service's logs and following its logs
|
||||
docker-compose logs -f --tail 100 <service_name>
|
||||
|
||||
# Stops containers and removes containers, networks created by up
|
||||
docker-compose down
|
||||
|
|
|
@ -25,7 +25,6 @@ git remote rename <old_remote_name> <new_remote_name>
|
|||
git remote remove <remote_name>
|
||||
|
||||
# Checkout to branch
|
||||
# Change branch
|
||||
git checkout <branch>
|
||||
|
||||
# Displays the current status of a git repository
|
||||
|
@ -80,4 +79,19 @@ navi fn url::open 'https://github.com/pulls?&q=author:<user>+is:open+is:pr'
|
|||
git fetch origin pull/<pr_number>/head:pr/<pr_number> \
|
||||
&& git checkout pr/<pr_number>
|
||||
|
||||
# Add a new module
|
||||
git submodule add <repository> <path>
|
||||
|
||||
# Update module
|
||||
git submodule update --init
|
||||
|
||||
# Update module without init
|
||||
git submodule update
|
||||
|
||||
# Pull all submodules
|
||||
git submodule foreach git pull origin master
|
||||
|
||||
# Update all submodules
|
||||
git submodule update --init --recursive
|
||||
|
||||
$ branch: git branch | awk '{print $NF}'
|
||||
|
|
37
cheats/gpg.cheat
Normal file
37
cheats/gpg.cheat
Normal file
|
@ -0,0 +1,37 @@
|
|||
% gpg
|
||||
|
||||
# gpg version
|
||||
gpg --version
|
||||
|
||||
# gpg generate key
|
||||
gpg --gen-key
|
||||
|
||||
# list keys
|
||||
gpg --list-keys
|
||||
|
||||
# distribute public key to key server
|
||||
gpg --keyserver <key_server> --send-keys <public_key>
|
||||
|
||||
# export public key
|
||||
gpg --output <filename_gpg> --export <key_name>
|
||||
|
||||
# import public key
|
||||
gpg --import <filename_gpg>
|
||||
|
||||
# encrypt document
|
||||
gpg --output <output_filename_gpg> --encrypt --recipient <public_key> <input_filename>
|
||||
|
||||
# decrypt document
|
||||
gpg --output <filename> --decrypt <filename_gpg>
|
||||
|
||||
# make a signature
|
||||
gpg --output <filename_sig> --sign <filename>
|
||||
|
||||
# verify signature
|
||||
gpg --output <filename> <filename> --decrypt <filename_sig>
|
||||
|
||||
# clearsign documents
|
||||
gpg --clearsign <filename>
|
||||
|
||||
# detach signature
|
||||
gpg --output <filename_sig> --detach-sig <filename>
|
38
cheats/javascript.cheat
Normal file
38
cheats/javascript.cheat
Normal file
|
@ -0,0 +1,38 @@
|
|||
% npm, node, js
|
||||
|
||||
# initial new package
|
||||
npm init
|
||||
|
||||
# initial immediately a new package
|
||||
npm init -y
|
||||
|
||||
# install all dependencies packages
|
||||
npm install
|
||||
|
||||
# install all dev dependencies packages
|
||||
npm install --save-dev
|
||||
|
||||
# install a specified package
|
||||
npm install <package_name>
|
||||
|
||||
# install a specified dev package
|
||||
npm install <package_name> --save-dev
|
||||
|
||||
# install globally a specified package
|
||||
npm install <package_name> -g
|
||||
|
||||
|
||||
|
||||
% nvm, node, js
|
||||
|
||||
# install a specified version of node
|
||||
nvm install <version>
|
||||
|
||||
# list available versions
|
||||
nvm ls-remote
|
||||
|
||||
# use installed node's version
|
||||
nvm use <version>
|
||||
|
||||
# set a node's version as default
|
||||
nvm alias default <version>
|
|
@ -1,5 +1,14 @@
|
|||
% kubernetes, k8s
|
||||
|
||||
# Print all contexts
|
||||
kubectl config get-contexts
|
||||
|
||||
# Print current context of kubeconfig
|
||||
kubectl config current-context
|
||||
|
||||
# Set context of kubeconfig
|
||||
kubectl config use-context <context>
|
||||
|
||||
# Print resource documentation
|
||||
kubectl explain <resource>
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ curl -s "wttr.in/<location>" \
|
|||
|
||||
% qr code
|
||||
|
||||
# Create a QR code with the content
|
||||
# Create a QR code with some content
|
||||
echo <content> | curl -F-=\<- qrenco.de
|
|
@ -23,4 +23,4 @@ ifconfig \
|
|||
| grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' \
|
||||
| grep -Eo '([0-9]*\.){3}[0-9]*' \
|
||||
| grep -v '127.0.0.1' \
|
||||
| tail -n1
|
||||
| tail -n1
|
||||
|
|
2
navi
2
navi
|
@ -37,7 +37,7 @@ source "${NAVI_HOME}/src/main.sh"
|
|||
##? full docs
|
||||
##? Please refer to the README at https://github.com/denisidoro/navi
|
||||
|
||||
VERSION="0.13.0"
|
||||
VERSION="0.14.0"
|
||||
NAVI_ENV="${NAVI_ENV:-prod}"
|
||||
|
||||
opts::eval "$@"
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
function navi-widget -d 'Call navi'
|
||||
set -q NAVI_USE_FZF_ALL_INPUTS; or set -l NAVI_USE_FZF_ALL_INPUTS "true"
|
||||
function navi-widget -d "Show cheat sheets"
|
||||
begin
|
||||
navi --print | while read -l r; set result $result $r; end
|
||||
|
||||
if [ -n "$result" ]
|
||||
echo $result
|
||||
|
||||
# Remove last token from commandline.
|
||||
commandline -t ""
|
||||
end
|
||||
stty sane
|
||||
env NAVI_USE_FZF_ALL_INPUTS=true navi --print query (commandline) | perl -pe 'chomp if eof' | read -lz result
|
||||
and commandline -- $result
|
||||
end
|
||||
|
||||
# commandline -f repaint
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
bind \cg navi-widget
|
||||
|
||||
if bind -M insert > /dev/null 2>&1
|
||||
bind -M insert \cg navi-widget
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue