Last active
December 17, 2015 08:39
-
-
Save BodhiHu/5581926 to your computer and use it in GitHub Desktop.
.vimrc for a smooth coding environment
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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just | |
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime | |
" you can find below. If you wish to change any of those settings, you should | |
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten | |
" everytime an upgrade of the vim packages is performed. It is recommended to | |
" make changes after sourcing debian.vim since it alters the value of the | |
" 'compatible' option. | |
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. | |
runtime! debian.vim | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Behaviour & Stylish | |
syntax on | |
" Jump to the last position when reopening a file | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
" Auto load indentation rules and plugins according to the detected filetype. | |
filetype off | |
filetype plugin on | |
filetype plugin indent on | |
" | |
set showcmd " Show (partial) command in status line. | |
set showmatch " Show matching brackets. | |
"set ignorecase " Do case insensitive matching | |
set smartcase " Do smart case matching | |
set incsearch " Incremental search | |
"set autowrite " Automatically save before commands like :next and :make | |
"set hidden " Hide buffers when they are abandoned | |
set mouse=a " Enable mouse usage (all modes) | |
set hlsearch | |
set nu | |
"set expandtab | |
"set textwidth=79 | |
"set tabstop=8 | |
" Omni completion | |
set omnifunc=syntaxcomplete#Complete | |
" Code folding | |
set nofoldenable | |
set foldmethod=manual | |
set foldnestmax=1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Source a global configuration file if available | |
if filereadable("/etc/vim/vimrc.local") | |
source /etc/vim/vimrc.local | |
endif | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Script varibles & functions | |
" plugin management | |
let s:python_mode_loaded = 0 | |
let s:cscope_loaded = 0 | |
function Plugin_load(ft) | |
if a:ft == "c" || a:ft == "cpp" | |
if s:cscope_loaded == 0 | |
cscope add cscope.out | |
nmap <Leader><C-w> :cs find s <C-R>=expand("<cword>")<CR><CR> | |
nmap <Leader><C-g> :cs find g <C-R>=expand("<cword>")<CR><CR> | |
nmap <Leader><C-d> :cs find d <C-R>=expand("<cword>")<CR><CR> | |
nmap <Leader><C-c> :cs find c <C-R>=expand("<cword>")<CR><CR> | |
nmap <Leader><C-t> :cs find t <C-R>=expand("<cword>")<CR><CR> | |
let s:cscope_loaded = 1 | |
endif | |
if s:python_mode_loaded == 1 "|| ... | |
"unload non-c plugins | |
"let ?loaded=0 | |
endif | |
else | |
if s:cscope_loaded == 1 | |
nunmap <Leader><C-s> | |
nunmap <Leader><C-g> | |
nunmap <Leader><C-d> | |
nunmap <Leader><C-c> | |
nunmap <Leader><C-t> | |
let s:cscope_loaded = 0 | |
endif | |
endif | |
endfunction | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Plugins | |
" ctags | |
set tags=tags | |
" Genutils | |
" Lookupfile tags file | |
let g:LookupFile_TagExpr = '"./filenametags"' | |
" Taglist fashion styles | |
let Tlist_Show_One_File = 1 | |
let Tlist_Exit_OnlyWindow = 1 | |
let Tlist_Use_Right_Window = 1 | |
map <silent> <F6> :TlistToggle<cr> | |
" Pathogen, manipulate 'runtimepath' easily | |
call pathogen#infect() | |
call pathogen#helptags() | |
" Vundle, the plugin manager | |
set nocompatible " be iMproved | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle required! | |
Bundle 'gmarik/vundle' | |
" repos | |
Bundle 'klen/python-mode' | |
Bundle 'tpope/vim-pathogen' | |
Bundle 'vim-scripts/lookupfile' | |
Bundle 'vim-scripts/taglist.vim' | |
Bundle 'vim-scripts/genutils' | |
" NOTE: comments after Bundle command are not allowed.. | |
" | |
" klen/python-mode | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" autocmds | |
au FileType * call Plugin_load(&filetype) | |
if filereadable("./vimrc.local") | |
source ./vimrc.local | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment