Posts Tagged ‘cheatsheet’

vim cheatsheet

Thursday, September 18th, 2008

Extracting from a vimball

From http://vim.sourceforge.net/scripts/script.php?script_id=1502

Users of a vimball archive simply need to

:vim something.vba
:so %

and the contents of the vimball will be extracted and placed into the proper directories, no matter where the user opened up the vimball. Furthermore, the helptags command will be automatically and transparently used to make any doc/*.txt files’ contents available by the Vim help system.

Getting the filename of the currently edited file

From http://rayninfo.co.uk/vimtips.html:

:!echo %:p                        : full path & file name
:!echo %:p:h                      : full path only
:!echo %:t                        : filename only

Removing empty lines

From Vim Tip 72:

 :g/^$/d

Converting select text to lowercase

In visual mode, select text.  Then type the u key.


linux cheatsheet

Tuesday, March 11th, 2008

Search and Replace in Multiple Files

perl -pi -w -e 's/search/replace/g;' *.php

from How to do a search and replace over multiple files

ssh cheatsheat

Tuesday, February 26th, 2008

Port forwarding

from http://www.openssh.com/faq.html#2.11

$ ssh -f -L 1234:server.example.com:6667 server.example.com sleep 10

Backing up files over SSH

$ ssh remote_host "tar -zc -C /path/to/parent/directory -f - some_directory" | cat > some_directory-`datestr`.tar.gz

Backing up a postgres database over SSH

$ ssh remote_host "pg_dump --username=db_user db_name" | gzip  > db_name-`datestr`.sql.gz

IRSSI cheatsheet

Thursday, February 21st, 2008

Scroll Up/Down: Page Up/Page Down keys