diff options
author | Denis Isidoro <denisidoro@users.noreply.github.com> | 2019-10-14 15:45:07 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-14 15:45:07 -0300 |
commit | 76e216b24ae10a575a9dc03dbe0b8bfbd1d3089e (patch) | |
tree | 101d8d8829fa0616e64a5cf49b78b828f47b575a | |
parent | cc2e3f78323a86a9d8c319e5bc47bd180558c222 (diff) | |
parent | fcd486e16bf26f338be64765b6ff5ee750a68edd (diff) |
Merge pull request #128 from denisidoro/devv0.14.0
0.14.0
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | cheats/android.cheat | 2 | ||||
-rw-r--r-- | cheats/compression.cheat | 2 | ||||
-rw-r--r-- | cheats/crontab.cheat | 2 | ||||
-rw-r--r-- | cheats/docker.cheat | 33 | ||||
-rw-r--r-- | cheats/git.cheat | 16 | ||||
-rw-r--r-- | cheats/gpg.cheat | 37 | ||||
-rw-r--r-- | cheats/javascript.cheat | 38 | ||||
-rw-r--r-- | cheats/kubernetes.cheat | 9 | ||||
-rw-r--r-- | cheats/misc.cheat | 2 | ||||
-rw-r--r-- | cheats/network.cheat | 2 | ||||
-rwxr-xr-x | navi | 2 | ||||
-rw-r--r-- | navi.plugin.fish | 18 |
13 files changed, 162 insertions, 24 deletions
@@ -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.*). diff --git a/cheats/android.cheat b/cheats/android.cheat index 71e5116..fbc02f1 100644 --- a/cheats/android.cheat +++ b/cheats/android.cheat @@ -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
\ No newline at end of file +$ emulator: "$ANDROID_HOME/tools/emulator" -list-avds diff --git a/cheats/compression.cheat b/cheats/compression.cheat index d5b9c6e..248d01b 100644 --- a/cheats/compression.cheat +++ b/cheats/compression.cheat @@ -21,4 +21,4 @@ gzip -d <gz_file> $ path: ls $ tar_file: ls *.tar $ targz_file: ls *.tar.gz -$ gz_file: ls *.gz
\ No newline at end of file +$ gz_file: ls *.gz diff --git a/cheats/crontab.cheat b/cheats/crontab.cheat index 4598420..e7350b7 100644 --- a/cheats/crontab.cheat +++ b/cheats/crontab.cheat @@ -4,4 +4,4 @@ crontab -l # Edit cron job -crontab -e
\ No newline at end of file +crontab -e diff --git a/cheats/docker.cheat b/cheats/docker.cheat index 098b3a5..c0aa787 100644 --- a/cheats/docker.cheat +++ b/cheats/docker.cheat @@ -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
\ No newline at end of file +$ 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 diff --git a/cheats/git.cheat b/cheats/git.cheat index 85b7bbb..3708cc0 100644 --- a/cheats/git.cheat +++ b/cheats/git.cheat @@ -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}' diff --git a/cheats/gpg.cheat b/cheats/gpg.cheat new file mode 100644 index 0000000..fb88333 --- /dev/null +++ b/cheats/gpg.cheat @@ -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> diff --git a/cheats/javascript.cheat b/cheats/javascript.cheat new file mode 100644 index 0000000..34f3101 --- /dev/null +++ b/cheats/javascript.cheat @@ -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> diff --git a/cheats/kubernetes.cheat b/cheats/kubernetes.cheat index ef14432..06e9c70 100644 --- a/cheats/kubernetes.cheat +++ b/cheats/kubernetes.cheat @@ -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> diff --git a/cheats/misc.cheat b/cheats/misc.cheat index 10a0753..b756c83 100644 --- a/cheats/misc.cheat +++ b/cheats/misc.cheat @@ -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
\ No newline at end of file diff --git a/cheats/network.cheat b/cheats/network.cheat index 6918ef4..2d69ba3 100644 --- a/cheats/network.cheat +++ b/cheats/network.cheat @@ -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
\ No newline at end of file + | tail -n1 @@ -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 "$@" diff --git a/navi.plugin.fish b/navi.plugin.fish index ffae787..ddb6079 100644 --- a/navi.plugin.fish +++ b/navi.plugin.fish @@ -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 |