Telegraph.nvim provides a way to send command conveniently and bind them to hotkeys.
I want to bind hotkeys to run shell commands with context about my current file, line, word, or working directory without parsing all of that each time I want to make a new binding.
I often want these commands sent to a tmux session that I can get to quickly. Doing this often requires the same couple of lines that is more than a single line.
Plug 'waylonwalker/Telegraph.nvim'
Man Page Searcher
" Using :term
nnoremap <leader><leader>m :Telegraph man
" Using a tmux popup
noremap <leader><leader>M :lua require'telegraph'.telegraph({how='tmux_popup', cmd='man '})<Left><Left><Left>
lookatme slides
" lookatme in a terminal
nnoremap <leader><leader>s :Telegraph pipx run --spec git+https://github.com/waylonwalker/lookatme lookatme {filepath} --live-reload --style gruvbox-dark<cr>
" lookatme in a tmux popup
nnoremap <leader><leader>S :lua require'telegraph'.telegraph({cmd='pipx run --spec git+https://github.com/waylonwalker/lookatme lookatme {filepath} --live-reload --style gruvbox-dark', how='tmux_popup'})<CR>
Determines how the command should be ran. How may be set to any of the following terms.
term
(default) runs command in the built in terminalsubprocess
runs the command in a lua subprocesstmux
runs command in a new tmux session and joins it.tmux_popup
runs command in a tmux popup window.tmux_popup_session
runs command in a tmux session and displays it in a popupsubprocess
runs command in a subprocess
Telegraph will replace the following variables enclosed in braces.
cword
- the current word under the cursorcWORD
- the current BIG Word under the cursorcline
- the current line under the cursorfilepath
- the filepath of the current filefilename
- the filename of the current filefile_extension
- the extension of the file (ex lua, py)file_basename
- the basename of the file (ie. filename without the extension)parent
- the parent directory of the current filecurrent_session_name
- name of the current tmux sessioncwd
- the current working directory
:Telegraph ls {parent}
:Telegraph cat {filename}
:Telegraph man {cword}
:Telegraph vd {cWORD}
visidata
telegraph-vd-cword-popup.mp4
lookatme popup
telegraph-lookatme-popup.mp4
open image url with feh
telegraph-open-image-with-feh.mp4
Open image url with chrome