Awesome
Telegraph.nvim provides a way to send command conveniently and bind them to hotkeys.
The Problem
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.
The other Problem
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.
Installation
Plug 'waylonwalker/Telegraph.nvim'
Example usage
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>
how
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
format strings
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}
Gallery
visidata
lookatme popup
open image url with feh
Open image url with chrome