Skip to content

Instantly share code, notes, and snippets.

@derkling
Created July 19, 2016 10:25
Show Gist options
  • Save derkling/043bcf1f62f1fa80faa8d01c50b35f21 to your computer and use it in GitHub Desktop.
Save derkling/043bcf1f62f1fa80faa8d01c50b35f21 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved
filetype off " required!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle Plugins Configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Available commands:
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Setup Vundle scripts manager
set runtimepath+=~/dotfiles/vim/bundle/vundle
call vundle#rc()
Bundle 'gmarik/vundle'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Reloads VIM configuration each time is updated
augroup myvimrc
au!
au BufWritePost .vimrc,vimrc.symlink so ~/.vimrc
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colorscheme (Solarized)
"Bundle 'altercation/vim-colors-solarized'
"set background=light
"set background=dark
"let g:solarized_termcolors=256
"let g:solarized_visibility="high"
"colorscheme solarized
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colorscheme (Molokai)
" Molokai is a Vim port of the monokai theme for TextMate originally created
" by Wimer Hazenberg.
Bundle 'vim-scripts/molokai'
colorscheme molokai
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Color and GUI Configuration
syntax on
set background=dark
set laststatus=2
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SnipMate
Bundle "msanders/snipmate.vim"
let g:snips_author = 'Patrick Bellasi'
ino <C-j> <C-r>=TriggerSnippet()<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" EasyMotion
Bundle 'Lokaltog/vim-easymotion'
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
let g:EasyMotion_smartcase = 1 " Case sensitivity
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sessions Management
Bundle "xolox/vim-misc.git"
Bundle "xolox/vim-session"
" Other interesting plugins from xolox:
" http://www.vim.org/scripts/script.php?script_id=4597
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PowerLine
" Bundle 'https://github.com/Lokaltog/vim-powerline'
" set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
" let g:Powerline_symbols = 'fancy' " Enable usage of FANCY symbols
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Airline
Bundle 'bling/vim-airline'
" let g:airline_theme='kalisi'
" let g:airline_theme='lucius'
" let g:airline_theme='molokai'
" let g:airline_theme='powerlineish'
let g:airline_theme='ubaryd'
let g:airline_left_sep=''
let g:airline_right_sep=''
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Powerline Fonts
" Bundle 'Lokaltog/powerline-fonts'
" let g:airline_powerline_fonts=1
" set guifont=Menlo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TMuxLine
Bundle 'edkolev/tmuxline.vim'
let g:airline#extensions#tmuxline#snapshot_file = '~/dotfiles/tmux/tmux-statusline-colors.conf'
let g:tmuxline_separators = {
\ 'left' : '',
\ 'left_alt': '>',
\ 'right' : '',
\ 'right_alt' : '<',
\ 'space' : ' '}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags SideBar
Bundle 'majutsushi/tagbar'
let g:airline#extensions#tagbar#enabled = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tComment
Bundle "tComment"
nnoremap // :TComment<CR>
vnoremap // :TComment<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Command-T
Bundle "wincent/Command-T"
" let g:CommandTMatchWindowAtTop=1 " show window at top
" set the PmenuSel color to be visible with black background
highlight PmenuSel ctermfg=black ctermbg=white
" Setup mappings for CommandT
nnoremap <silent> <leader>zx :CommandT<CR>
nnoremap <silent> <leader>zb :CommandTBuffer<CR>
nnoremap <silent> <leader>zm :CommandTMRU<CR>
nnoremap <silent> <leader>zt :CommandTTag<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" EasyGrep - Fast and Easy Find and Replace Across Multiple Files
" Default mappings:
" <Leader>vv - Grep for the word under the cursor, match all occurences,
" <Leader>vV - Grep for the word under the cursor, match whole word, like
" <Leader>va - Like vv, but add to existing list
" <Leader>vA - Like vV, but add to existing list
" <Leader>vr - Perform a global search search on the word under the cursor
" and prompt for a pattern with which to replace it.
" <Leader>vo - Select the files to search in and set grep options
Bundle 'dkprice/vim-easygrep'
noremap <leader>go <esc>:GrepOption<cr>
nnoremap go :GrepOption<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" QuickFix window management
noremap <leader>fo <esc>:copen<cr>
noremap <leader>fc <esc>:cclose<cr>
noremap <leader>fn <esc>:cnext<cr>
noremap <leader>fp <esc>:cprevious<cr>
nnoremap fo :copen<cr>
nnoremap fc :cclose<cr>
nnoremap fn :cnext<cr>
nnoremap fp :cprevious<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CScope
" Bundle "brookhong/cscope.vim"
"
" nnoremap <leader>fa :call CscopeFindInteractive(expand('<cword>'))<CR>
" nnoremap <leader>l :call ToggleLocationList()<CR>
"
" " s: Find this C symbol
" nnoremap <leader>fs :call CscopeFind('s', expand('<cword>'))<CR>
" " g: Find this definition
" nnoremap <leader>fg :call CscopeFind('g', expand('<cword>'))<CR>
" " d: Find functions called by this function
" nnoremap <leader>fd :call CscopeFind('d', expand('<cword>'))<CR>
" " c: Find functions calling this function
" nnoremap <leader>fc :call CscopeFind('c', expand('<cword>'))<CR>
" " t: Find this text string
" nnoremap <leader>ft :call CscopeFind('t', expand('<cword>'))<CR>
" " e: Find this egrep pattern
" nnoremap <leader>fe :call CscopeFind('e', expand('<cword>'))<CR>
" " f: Find this file
" nnoremap <leader>ff :call CscopeFind('f', expand('<cword>'))<CR>
" " i: Find files #including this file
" nnoremap <leader>fi :call CscopeFind('i', expand('<cword>'))<CR>
" a: Add cscope db
map <C-\>a :cs add .<CR>
" r: Refresh db
map <C-\>r :!cscope -Rb<CR>:cs reset<CR><CR>
" s: Find this C symbol
map <C-\>s :cs f s <cword><CR>
" g: Find this definition
map <C-\>g :cs f g <cword><CR>
" d: Find functions called by this function
map <C-\>d :cs f d <cword><CR>
" c: Find functions calling this function
map <C-\>c :cs f c <cword><CR>
" t: Find this text string
map <C-\>t :cs f t <cword><CR>
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one (vim 6 and up only)
"
" (Note: you may wish to put a 'set splitright' in your .vimrc
" if you prefer the new window on the right instead of the left
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Doxygen
Bundle "DoxygenToolkit.vim"
map <LocalLeader>d :Dox<CR>
map <LocalLeader>d :Dox<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTree
" https://github.com/jistr/vim-nerdtree-tabs/blob/master/README.md
Bundle "scrooloose/nerdtree"
Bundle "jistr/vim-nerdtree-tabs"
noremap <silent> <F12> :NERDTreeToggle<CR>
noremap! <silent> <F12> <ESC>:NERDTreeToggle<CR>
let g:NERDTreeDirArrows=0 " use ASCII chars
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntax and errors highlighter
" External language specific syntax checkers are required, look at:
" syntax_checkers/<filetype>/*.vim
Bundle 'scrooloose/syntastic'
let g:syntastic_c_compiler_options=' -std=gnu89 -Wno-variadic-macros'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ]
let g:airline#extensions#whitespace#checks = []
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight trailing whitespaces
" http://www.vim.org/scripts/script.php?script_id=3966
Bundle 'ShowTrailingWhitespace'
highlight ShowTrailingWhitespace ctermbg=Blue guibg=Blue
nnoremap <silent> <Leader>tw
\ :<C-u>call ShowTrailingWhitespace#Toggle(0) <Bar>
\ echo (ShowTrailingWhitespace#IsSet()
\ ? 'Show trailing whitespace'
\ : 'Not showing trailing whitespace'
\ )<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Delete trailing whitespaces
" http://www.vim.org/scripts/script.php?script_id=3967
Bundle 'DeleteTrailingWhitespace'
let g:DeleteTrailingWhitespace = 0
let g:DeleteTrailingWhitespace_Action = 'ask'
let g:DeleteTrailingWhitespace_ChoiceAffectsHighlighting = 1
nnoremap <Leader>dw :<C-u>%DeleteTrailingWhitespace<CR>
vnoremap <Leader>dw :DeleteTrailingWhitespace<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GIT Fugitive
Bundle 'tpope/vim-fugitive'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Show GIT diff in the 'gutter' (sign column)
Bundle 'airblade/vim-gitgutter'
nnoremap <Leader>tg :GitGutterToggle<CR>
nnoremap <Leader>tgh :GitGutterLineHighlightsToggle<CR>
nnoremap <Leader>dgs :GitGutterStageHunk<CR>
nnoremap <Leader>dgr :GitGutterRevertHunk<CR>
let g:airline#extensions#hunks#enabled = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Github GIST
" NeoBundle 'mattn/gist-vim', {'depends': 'mattn/webapi-vim'}
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_browser_command = 'chromium-browser %URL%'
let g:gist_post_private = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Python Code folding
Bundle 'tmhedberg/SimpylFold.git'
let g:SimpylFold_docstring_preview = 1
let g:SimpylFold_fold_docstring = 0
Bundle 'vim-scripts/indentpython.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MakeSetup
Bundle 'derkling/vim-makesetup'
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Documentation viewer
Bundle 'powerman/vim-plugin-viewdoc'
let g:viewdoc_open='new'
let g:viewdoc_only=1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LaTeX
Bundle "vim-latex/vim-latex.github.com.git"
autocmd BufEnter *.tex,*.bib source ~/dotfiles/vim/plugins/latex.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TaskPaper
Bundle "davidoc/taskpaper.vim"
autocmd BufEnter *.taskpaper set filetype=taskpaper
let g:task_paper_date_format = "%Y-%m-%d %H:%M:%S%z"
let g:task_paper_archive_project = "Completed"
let g:task_paper_styles = {
\ 'waiton': 'ctermfg=Yellow guifg=Yellow',
\ 'next': 'ctermbg=Red guibg=Red',
\ }
" Add function to setup custom commands
function! s:taskpaper_setup()
" URGENT: update task 'urgent' level
nnoremap <buffer> <silent> <Leader>tu
\ :<C-u>call taskpaper#toggle_tag('urgent')<CR>
" WAITON toggle the 'waiton' TAG
nnoremap <buffer> <silent> <Leader>tw
\ :<C-u>call taskpaper#toggle_tag('waiton', '')<CR>
endfunction
" Load custom commands for all taskpaper files
augroup vimrc-taskpaper
autocmd!
autocmd FileType taskpaper call s:taskpaper_setup()
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Global Configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This MUST be the last entry BEFORE the following custom configuration
filetype plugin indent plugin on
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Confiugrations which cause vim to behave a lot differently from regular Vi
set nocompatible " vim defaults, not vi!
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 autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set ttymouse=xterm2 " Enable mouse usage on screen terminal emulator
set mouse=a " Enable mouse usage (all modes) in terminals
set nobackup " Disable creation of backup (*.ext~) files
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set GVim configuration
if has("gui_running")
if has("gui_gtk2")
set guifont=Monospace\ 8 " Set 8pt font
set lines=75 columns=180 " Maximize window
endif
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Jump to the last position when reopening a file
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Incremental search with results highlight
set incsearch
set hlsearch
" Ctrl-L clears the highlight from the last search
noremap <C-l> :nohlsearch<CR><C-l>
noremap! <C-l> <ESC>:nohlsearch<CR><C-l>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Smart backspace
set backspace=start,indent,eol
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Better TAB completion for files (like the shell)
if has("wildmenu")
set wildmenu
set wildmode=longest,list
" Ignore stuff (for TAB autocompletion)
set wildignore+=*.a,*.o
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png
set wildignore+=.DS_Store,.git,.hg,.svn
set wildignore+=*~,*.swp,*.tmp
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" TAB and Shift-TAB in command mode cycle buffers
"nmap <Tab> :bn<CR>
"nmap <S-Tab> :bp<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Resize vsplit panes on VIM window resize events
autocmd VimResized * exe "normal! \<c-w>="
" Easier split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" More natural split opening
set splitbelow
set splitright
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Function KEYs Mapping
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F2 - Toggle auto-indenting for code paste
" pressing F2 in normal mode will invert the 'paste' option
nnoremap <F2> :set invpaste paste?<CR>
" press F2 when in insert mode, to toggle 'paste' on and off
set pastetoggle=<F2>
" enables displaying whether 'paste' is turned on in insert mode
set showmode
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F3 - Toggle text wrapping
noremap <F3> :set nowrap!<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F4 - Line numbering
:set number " display line numbers along the left side of a window
:set numberwidth=5 " change the width of the 'gutter' column used for numbering
:set cpoptions+=n " use the number column for the text of wrapped lines
:highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
" Use relative vs absolute line numbergin
nnoremap <C-n> :call NumberToggle()<cr>
autocmd BufLeave * :set number
autocmd BufEnter * :set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" Toggle line numbering
noremap <F4> :set nonumber!<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F5 - Remove thrailing whitespaces
noremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F6 - Highlight all instances of word under cursor, when idle.
function! AutoHighlightToggle()
let @/ = ''
if exists('#auto_highlight')
au! auto_highlight
augroup! auto_highlight
setl updatetime=4000
echo 'Highlight current word: off'
return 0
else
augroup auto_highlight
au!
au CursorHold * let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'
augroup end
setl updatetime=500
echo 'Highlight current word: ON'
return 1
endif
endfunction
nnoremap <F6> :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F7 - Spell Checking with multi-language support
let g:myLang=0
let g:myLangList=["nospell","en_us","en_gb","it"]
function! ToggleSpell()
let g:myLang=g:myLang+1
if g:myLang>=len(g:myLangList) | let g:myLang=0 | endif
if g:myLang==0
setlocal nospell
else
execute "setlocal spell spelllang=".get(g:myLangList, g:myLang)
endif
echo "spell checking language:" g:myLangList[g:myLang]
endfunction
nnoremap <silent> <F7> :call ToggleSpell()<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F8 - Toggle CTags bar
nnoremap <F8> :TagbarToggle<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Filetype Specific Configurations
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Makefiles
autocmd FileType make setlocal noexpandtab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" C/C++
autocmd BufRead *.c,*.h,*.cc,*.hh,*.cpp,*.hpp,*.S source ~/dotfiles/vim/plugins/c.vim
autocmd BufRead *.c,*.h,*.cc,*.hh,*.cpp,*.hpp,*.S normal zR
autocmd BufNewFile,BufRead *.dox set filetype=cpp.doxygen
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Python
" Use PEP8 indentation rules
autocmd BufNewFile,BufRead *.py set
\ tabstop=4
\ softtabstop=4
\ shiftwidth=4
\ textwidth=79
\ expandtab
\ autoindent
\ fileformat=unix
autocmd BufWinEnter *.py setlocal foldexpr=SimpylFold(v:lnum) foldmethod=expr
autocmd BufWinLeave *.py setlocal foldexpr< foldmethod<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment