Last updated about 2 weeks ago

(NEO)VIM

Redirect output of Ex commands to register

  1. :redir @a
  2. :__commands__
  3. :redir END
  4. "ap

Redirect output of telesope to quickfix: C-q

Run bash (or any shell) for buffer content

:%!bash

Convert textfile to pdf (via ps)

vim filename.txt -c "hardcopy > filename.ps | q"; pstopdf filename.ps

pstopdf may be names ps2pdf on other OSes

Alternative undo redo

:earlier __time__
:later __time__

where time = x(s|m|h|d) (s = second, m = minute, h = hour, day)

to go back and forth on state of buffer in time of x units

Remote editing (using ssh config)

:e scp://remote-host/~/path/to/file.ext

Assuming a Host for ‘remote-host’ is set in ~/.ssh/config

Delete other buffers except current

:% bd | e # | bd #

where

spaces are optional

Ex mode completion options

TAB cycles through options; Ctrl-a inputs all options.

Example: To delete all *.js files in buffer list

:bd js Ctrl-a

Can use :bwipeout to completely remove a buffer

Search and Replace (Using neovim telesope)

Check diff of files

nvim -d -R file_one file_two

Set filetype in a comment

# vi: ft=bash