navi/docs/widgets/howto/TMUX.md
alexis-opolka df8c0ff7b3 Update docs on widgets
Signed-off-by: alexis-opolka <53085471+alexis-opolka@users.noreply.github.com>
2025-04-30 22:14:03 +02:00

1.1 KiB

Tmux widget

You can use navi as a Tmux widget to reach your Vim commands, often used SQL queries, etc. in any command-line app even in SSH sessions.

Keybinding navi

To be able to open navi via prefix + C-g , you need to add the following lines to your Tmux configuration file.

bind-key -N "Open Navi (cheat sheets)" -T prefix C-g split-window \
  "$SHELL --login -i -c 'navi --print | head -n 1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'"

Example cheatsheet

Here is an example cheatsheet to use inside Tmux:

% 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>';