Hacker News new | ask | show | jobs
by pizza 2524 days ago
byobu and tmux are god-tier

vim: use :!some_shell_command --with_arguments to run a shell command from within vim quickly

also :set hlsearch to allow search highlighting, and use :noh to disable the current highlight once you no longer need the text to be a different color

tmux: Prefix-[ to scroll up console text. use / to search down, and ? to search up (just like in vim)

tmux: Prefix-z to zoom current pane to full size of window

zsh: vi-mode plugin to quickly use vim shortcuts on terminal input text, history-substring-search plugin to quickly remember what finicky command I was using earlier

also shells in general: ctrl-s to pause text (eg if you want to pause log spam), ctrl-q to resume

ssh -XC for compressed x11 forwarding, to speed up x11 responsiveness

on remote server: python2 -m SimpleHTTPServer 8080 --bind localhost to quickly start a simple file/http server from the current directory that is NOT internet accessible (ie nobody steals your shit)

then on local computer: ssh -L 8080:localhost:8080 to tunnel to remote server's localhost server. then just type in localhost:8080 in firefox to access remote server's files

2 comments

vim: use :%!cmd to pipe the current buffer into a command, and replace the buffer with the output from the cmd

vim: use :w !cmd to pipe the current buffer into a command but display the output from the cmd to screen and discard it afterwards

vim: use :r !cmd to read the output from the command and insert it into the current buffer

All of the :! and :r and :w commands that deal with a shell can also be passed the filename for the current buffer with %, eg:

":r !md5sum %" will execute md5sum with the filename of the current file (if it is unsaved, it will use the on-disk version, obviously) then pull the output checksum into the current buffer at the cursor position

Emacs equivalents are (by default) mapped to M-! and M-| with/without prefix arguments (so C-u / M-<num> etc)
great list