Last active
September 29, 2015 18:37
-
-
Save Zeex/1647092 to your computer and use it in GitHub Desktop.
.vimrc
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
syntax on | |
filetype plugin on | |
filetype indent on | |
set nocompatible | |
set nobackup | |
set autochdir | |
set cursorline | |
set number | |
set ignorecase | |
set smartcase | |
set incsearch | |
set hlsearch | |
set ruler | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set colorcolumn=80 | |
set autoindent | |
set smartindent | |
set copyindent | |
set cindent | |
set preserveindent | |
set foldmethod=manual | |
set guioptions-=T | |
set guioptions-=m | |
if has('gui_win32') | |
set guioptions-=r | |
endif | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'Solarized' | |
Bundle 'aldmeris' | |
Bundle 'DetectIndent' | |
Bundle 'SingleCompile' | |
Bundle 'TagHighlight' | |
let g:Author=$USERNAME | |
Bundle 'comment.vim' | |
set background=dark | |
if has('gui_running') | |
colorscheme aldmeris | |
if has('gui_gtk2') | |
set columns=110 lines=37 | |
set guifont=DejaVu\ Sans\ Mono\ 11 | |
elseif has('gui_win32') | |
set columns=130 lines=35 | |
set guifont=Consolas:h12 | |
endif | |
endif | |
" Fix for backspace | |
set backspace=indent,eol,start | |
" One-button compile and run | |
nnoremap <F5> :make<CR> | |
nnoremap <F9> :SCCompile<CR> | |
nnoremap <F10> :SCCompileRun<CR> | |
if has("win32") | |
" On Windows we use MinGW's make | |
set makeprg=mingw32-make | |
endif | |
" Search for the visually selected sequence of characters | |
vnoremap g/ y/<C-R>"<CR> | |
" Automatically open, but do not go to (if there are errors) the quickfix / | |
" location list window, or close it when is has become empty. | |
" (doesn't seem to work...) | |
autocmd QuickFixCmdPost [^l]* nested cwindow | |
autocmd QuickFixCmdPost l* nested lwindow | |
" Automatically adjust quickfix window height | |
au FileType qf call AdjustWindowHeight(3, 10) | |
function! AdjustWindowHeight(minheight, maxheight) | |
exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _" | |
endfunction | |
" Detect indentation settings | |
autocmd BufReadPost * :DetectIndent | |
" Commands to quickly switch between popular indentation styles | |
command! -nargs=0 T4 :set noexpandtab | :set tabstop=4 | :set shiftwidth=4 | |
command! -nargs=0 T4s :set expandtab | :set tabstop=4 | :set shiftwidth=4 | |
command! -nargs=0 T2 :set noexpandtab | :set tabstop=2 | :set shiftwidth=2 | |
command! -nargs=0 T2s :set expandtab | :set tabstop=2 | :set shiftwidth=2 | |
command! -nargs=0 T8 :set noexpandtab | :set tabstop=8 | :set shiftwidth=8 | |
" Non-standard file extensions | |
autocmd BufRead,BufNewFile,BufWritePost *.gyp,*.gypi set filetype=python | |
autocmd BufRead,BufNewFile,BufWritePost *.h++ set filetype=cpp | |
autocmd BufRead,BufNewFile,BufWritePost *.sage set filetype=python | |
autocmd BufRead,BufNewFile,BufWritePost *.spyx,*.pyx set filetype=python.c | |
" Set search path for ctags database | |
" http://stackoverflow.com/a/741486/249230 | |
set tags=./tags;/ | |
" Fix curly brace error in C++11 lambdas | |
let c_no_curly_error = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment