x-haui

vim - vi improved

vim is one of the most powerful editors around the world and my first choice when it's about editing or coding.

tips & tricks

.vimrc


"----------------coding-------------
" folding
set foldmethod=syntax
syn region cBlock start="{" end="}" transparent fold set foldcolumn=3
" all folds are open set foldlevel=100
" "set tabstop=4 "set expandtab "set shiftwidth=4 "set shiftround " syntax/indenting etc. syntax on set smartindent set nocopyindent filetype on filetype plugin on set shell=bash
"show matching braces set showmatch " "set/unset ai when pasting code set pastetoggle=<F12> " " Auto close braces imap { {<CR>}<Esc>O
imap ( ()<left> imap [ []<left> " everybody loves C-style comments... imap // /**/<left><left> " " abbreviations ia #i #include
" "------find & replace------ " ignore case set ic " smart search - case sensitive when first char is uppercase set smartcase " Jump to the current typed in search term set incsearch " "------misc------ " backspace may delete these items set backspace=indent,eol,start
" number of commands saved in history set history=100
" highlight searched term set hlsearch set modified " http://www.linux-fuer-blinde.de/programme/index.php set scroll=11
set backup " enable mouse-support set mouse=a
" confirmation dialogues set cf " keep buffers alive set hidden " status bar always visible "se laststatus=2 colorscheme peachpuff
" sets the title of the windows to "filename" set title " set line numbers set number " Show the line and column number of the cursor position, separated by a comma. set ruler " not vi-compatible set nocompatible set fileformat=unix



"---------macros---------- " map for normal/visual mode | map! for command/insert mode " some useful abbreviations to common mistyped commands cab W w | cab Q q | cab Wq wq | cab wQ wq | cab WQ wq " show/hide TagList map <F2> :TlistToggle <Enter>

" save file & Update Tlist in all modes map <F3> :w <Enter> :TlistUpdate <Enter>
map! <F3> <ESC> :w <Enter> :TlistUpdate <Enter>


" enables/disables hlsearch - see http://vim.wikia.com/wiki/VimTip93 map <F4> :set nohls!<CR>:set nohls?<CR> " Ctrl-a: compile current file "imap <C-a> <ESC> :w <Enter> :! gcc -ansi -pedantic -D_POSIX_SOURCE -Werror -Wall -o %:r % <Enter> "map <C-a> <ESC> :w <Enter> :! gcc -ansi -pedantic -D_POSIX_SOURCE -Werror -Wall -o %:r % <Enter> "map! <C-a> <ESC> :w <Enter> :! gcc -ansi -pedantic -D_POSIX_SOURCE -Werror -Wall -o %:r % <Enter> imap <C-a> <ESC> :w <Enter> :! gcc -Wall -lm -o %:r % <Enter>
map <C-a> <ESC> :w <Enter> :! gcc -Wall -lm -o %:r % <Enter>

" save & "make" the current file in all modes map <F5> :w <Enter> :make <Enter>
map! <F5> <ESC> :w <Enter> :make <Enter>

" save file in all modes map! <F6> <ESC> :w <Enter>
map <F6> :w <Enter>

" save & close file in all modes map! <F7> <ESC> :wq <Enter>
map <F7> :wq <Enter>

" show tabs, carriage returns etc. map <F8> :set nolist!<CR>:set nolist?<CR> map! <F8> <ESC> :set nolist!<CR>:set nolist?<CR> " toggle line numbers map <F11> :set nonu!<CR>:set nonu?<CR> map! <F11> <ESC> :set nonu!<CR>:set nonu?<CR> " toggle-word-plugin - 0<=>1 | true<=>false etc. nmap ,t :ToggleWord<CR> au BufNewFile,BufRead ~/.bash_aliases setf sh