Merge pull request #801 from bimlas/extend-docs

Extend docs
This commit is contained in:
Denis Isidoro 2022-11-15 17:25:33 -03:00 committed by GitHub
commit 0c82419934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View file

@ -49,6 +49,8 @@ There are multiple ways to use **navi**:
- pros: you have access to all possible subcommands and flags - pros: you have access to all possible subcommands and flags
- as a [shell widget](docs/installation.md#installing-the-shell-widget) for the terminal - as a [shell widget](docs/installation.md#installing-the-shell-widget) for the terminal
- pros: the shell history is correctly populated (i.e. with the actual command you ran instead of `navi`) and you can edit the command as you wish before executing it - pros: the shell history is correctly populated (i.e. with the actual command you ran instead of `navi`) and you can edit the command as you wish before executing it
- as a [Tmux widget](docs/tmux.md)
- pros: you can use your cheatsheets in any command-line app even in SSH sessions
- as [aliases](docs/aliases.md) - as [aliases](docs/aliases.md)
- as a [shell scripting tool](docs/shell_scripting.md) - as a [shell scripting tool](docs/shell_scripting.md)
- as an [Alfred workflow](docs/alfred.md) - as an [Alfred workflow](docs/alfred.md)
@ -66,6 +68,7 @@ You can also:
- [write your own cheatsheets](#cheatsheet-syntax) (and [share them](docs/cheatsheet_repositories.md#submitting-cheatsheets), if you want) - [write your own cheatsheets](#cheatsheet-syntax) (and [share them](docs/cheatsheet_repositories.md#submitting-cheatsheets), if you want)
- [use cheatsheets from other tools](docs/cheatsheet_repositories.md#using-cheatsheets-from-other-tools), such as [tldr](https://github.com/tldr-pages/tldr) and [cheat.sh](https://github.com/chubin/cheat.sh) - [use cheatsheets from other tools](docs/cheatsheet_repositories.md#using-cheatsheets-from-other-tools), such as [tldr](https://github.com/tldr-pages/tldr) and [cheat.sh](https://github.com/chubin/cheat.sh)
- [auto-update repositories](docs/cheatsheet_repositories.md#auto-updating-repositories) - [auto-update repositories](docs/cheatsheet_repositories.md#auto-updating-repositories)
- auto-export cheatsheets from your [TiddlyWiki](https://tiddlywiki.com/) notes using a [TiddlyWiki plugin](https://bimlas.gitlab.io/tw5-navi-cheatsheet/)
## Cheatsheet syntax ## Cheatsheet syntax

37
docs/tmux.md Normal file
View file

@ -0,0 +1,37 @@
## Tmux
You can use **navi** as a [Tmux](https://github.com/tmux/tmux/wiki) widget to reach your Vim commands, often used SQL queries, etc. in any command-line app even in SSH sessions.
Add these lines to your Tmux config file to access **navi** by pressing `prefix + C-g`.
```sh
bind-key -T prefix C-g split-window \
"$SHELL --login -i -c 'navi --print | head -c -1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'"
```
Example cheatsheet:
```sh
% vim
# Quit without save
qa!
# Delete a paragraph
normal dap
# Generate sequence of numbers
put =range(<start>, <stop>)
% postgresql
# Describe table columns in `psql` or `pgcli`
select
table_name,
column_name,
data_type
from
information_schema.columns
where
table_name = '<table>';
```