Created
January 17, 2011 14:47
-
-
Save rikusalminen/782917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call pathogen#runtime_append_all_bundles() | |
call pathogen#helptags() | |
set nocompatible | |
colorscheme desert | |
tab all | |
set mouse=a | |
set backspace=eol,indent,start | |
set hidden | |
set autowrite | |
set ruler | |
set number | |
set showcmd | |
set showmatch | |
set ts=4 | |
set sts=4 | |
set expandtab | |
set shiftwidth=4 | |
set autoindent | |
set smartindent | |
set smarttab | |
set cindent | |
set incsearch | |
set hlsearch | |
set ignorecase | |
set smartcase | |
syntax on | |
filetype plugin indent on | |
set completefunc=syntaxcomplete#Complete | |
" C Indentation | |
set cinoptions=(4 " Indent 4 spaces after a line ending in ( | |
set cinoptions+=g0 " C++ public: and private: without indentation (fixes inline member function braces) | |
" Tab navigation with Control (+Shift) Tab | |
nnoremap <C-S-Tab> :tabprevious<CR> | |
nnoremap <C-Tab> :tabnext<CR> | |
cnoremap <C-S-Tab> :tabprevious<CR> | |
cnoremap <C-Tab> :tabnext<CR> | |
inoremap <C-S-Tab> <C-o>:tabprevious<CR> | |
inoremap <C-Tab> <C-o>:tabnext<CR> | |
" Indent/deindent with Tab/S-Tab | |
nnoremap <Tab> >> | |
nnoremap <S-Tab> << | |
inoremap <S-Tab> <C-d> | |
vnoremap <Tab> >gv | |
vnoremap <S-Tab> <gv | |
" - and _ for / and ? to mimic the US keyb layout on a Finnish keyboard | |
noremap - / | |
noremap _ ? | |
" ö and ä for go to tag and go back | |
noremap ä <C-]> | |
noremap ö <C-t> | |
" F5 = make and open quickfix | |
noremap <silent> <F5> :make<CR>:botright cwindow<CR> | |
inoremap <silent> <F5> <Esc>:make<CR>:botright cwindow<CR> | |
" F2 = previous error, F3 = current error, F4 = next error | |
noremap <silent> <F2> :cprev<CR> | |
noremap <silent> <F3> :cc!<CR> | |
noremap <silent> <F4> :cnext<CR> | |
inoremap <silent> <F2> <C-o>:cprev<CR> | |
inoremap <silent> <F3> <C-o>:cc!<CR> | |
inoremap <silent> <F4> <C-o>:cnext<CR> | |
" Home like VC++ | |
inoremap <silent> <Home> <c-o>@=<SID>HomeLikeVCpp()<cr> | |
nnoremap <silent> <Home> @=<SID>HomeLikeVCpp()<cr> | |
vnoremap <silent> <Home> @=<SID>HomeLikeVCpp()<cr> | |
nnoremap <silent> 0 @=<SID>HomeLikeVCpp()<cr> | |
vnoremap <silent> 0 @=<SID>HomeLikeVCpp()<cr> | |
nnoremap <silent> + @=<SID>EndLikeVCpp()<cr> | |
vnoremap <silent> + @=<SID>EndLikeVCpp()<cr> | |
inoremap <silent> <End> <c-\><c-n>@=<SID>EndLikeVCpp()<cr>a | |
nnoremap <silent> <End> @=<SID>EndLikeVCpp()<cr> | |
vnoremap <silent> <End> @=<SID>EndLikeVCpp()<cr> | |
function! s:HomeLikeVCpp() | |
let ll = strpart(getline('.'), -1, col('.')) | |
if ll =~ '^\s\+$' | return '0' | |
else | return '^' | |
endif | |
endfunction | |
function! s:EndLikeVCpp() | |
let l = strpart(getline('.'), col('.')-1) | |
let ll = match(l, '^\S\s*$') | |
if getline('.') =~ '^\s*$' | |
if col('.') + (mode()!='v') == col('$') | return 'g_' | |
else | return '$' | |
endif | |
else | |
if ll >= 0 | return '$' | |
else | return 'g_' | |
endif | |
endif | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment