Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WaylonWalker/Telegraph.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

15 Commits

Repository files navigation

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 terminal
  • subprocess runs the command in a lua subprocess
  • tmux 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 popup
  • subprocess runs command in a subprocess

format strings

Telegraph will replace the following variables enclosed in braces.

  • cword - the current word under the cursor
  • cWORD - the current BIG Word under the cursor
  • cline - the current line under the cursor
  • filepath - the filepath of the current file
  • filename - the filename of the current file
  • file_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 file
  • current_session_name - name of the current tmux session
  • cwd - the current working directory
:Telegraph ls {parent}
:Telegraph cat {filename}
:Telegraph man {cword}
:Telegraph vd {cWORD}

Gallery

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

telegraph-open-image-url-chromeage.mp4

About

Send commands system commands in an elegant way

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /