Monthly Archives: July 2011
Commonly used Vim commands
:sav (save as)
c (change)
d (delete)
{ } (page up, down)
/ (search)
:wq (save, quit)
:%s/findme/replaceto/gc (replace within file, multiple occurence per line, confirmation)
v: Visual Mode
Shift+v : Line Visual Mode
Ctrl+v , then Shift+i : Column-wise Insert
:set autoindent
:set cindent
:set scrolloff=1000
:bufdo %s/from/replace/ge | w (search and replace, to all buffers)
(From command line) ctags -R .
Ctrl + ] = go to definition
Ctrl + T = go back to caller
:set tags=(the topmost ctags file desired)
—-.vimrc—-
syntax on "set autoindent "set cindent set smartindent filetype plugin on let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 "Set color scheme set t_Co=256 colorscheme desert256 "colorscheme gardener "Enable indent folding set foldenable set fdm=indent set tags=../tags
Heap Segmentation Fault – caused by declaration location/scope
Unexpected segmentation faults? Might be your variable declaration.
Here’s the point, declaring variables as global, is commonly known as “do you really need to?” .
Especially if it’s a dynamic sized data structure, like a C++ list.
Yeah I realized the hard way, the size grew out of static memory bounds and got into the heap.
Good old GDB to the rescue, those error messages might be a mystery at first, it’s still potentially a beacon of hope.