Archive for the 'Cheatsheet' Category

Notes on vim

May 19th, 2010 by papillon

f,F Find char, find char backwards
; Repeat last find
zL Scroll half a screenwidth to the left

Copy and paste
"ay Copy visual selection to register A
"ap Paste from register A

ma Set mark “a”
'a Go to mark “a”


/ Search forward
? Search backward

:vimgrep /my_search_term/ **/*.c Recursively search all .c files
:cnext Jump to next hit
:clist Show hits
:cc n
Jump to hit no. n:

%s whole file (range)
/g replace every instance

Tab / window management
Open one tab for each buffer in the buffer list
:tab ball

Enable tab-completion window:
:set wildmenu

Close (split) window:
Ctrl+W C

Previous / next tab:
Ctrl+PgDn / Ctrl+PgUp

Create / close tab:
Ctrl+Ins / Ctrl+Del
… via mappings created using the following line in .vimrc:
nmap <C-Insert> :tabnew<CR>
nmap <C-Delete> :tabclose<CR>

zo/O Open one/all folds under cursor
zc/C Close one/all folds under cursor
zR Open all folds

xterm 256 notes

Reindex help (after plugin installation):
:helptags C:\Program Files\Vim\vimfiles\doc

Add/remove CRLF
To remove all carriage-returns at end-of-line:

:set fileformats=
:e ++ff=dos filename
:setlocal ff=unix

To repair any lines where a CR is missing, (by adding it):
same as above, but omit the line with “:setlocal ff=unix”.

:set list Show whitespaces
:set nolist Stop showing whitespaces
:set expandtab Insert space characters whenever the tab key is pressed
:set tabstop=2 Each tab = 2 spaces
:retab Change all the existing tab characters to match the current tab settings (expandtab)

Working with Unicode

Notes on VirtualBox

June 26th, 2009 by papillon

List VMs
VBoxManage list vms

Disable time synchronisation
VBoxManage setextradata <vmname> “VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled” “1″