fix ycm and add more vimconfig to repo

This commit is contained in:
Felix Van der Jeugt 2014-12-21 22:57:35 +01:00
parent 019a37d58f
commit 1ccfead62b
4 changed files with 110 additions and 5 deletions

11
.gitignore vendored
View File

@ -1,7 +1,12 @@
# lol passwords in plain text # weechat
weechat/irc.conf weechat/irc.conf
# lol logs
weechat/logs/ weechat/logs/
weechat/weechat.log weechat/weechat.log
# vim
vim/bundle
vim/tmp
# other
*.pyc

85
vim/indent/haskell.vim Normal file
View File

@ -0,0 +1,85 @@
" Vim indent file
" Language: Haskell
" Author: motemen <motemen@gmail.com>
" Version: 0.1
" Last Change: 2007-07-25
"
" Modify g:haskell_indent_if and g:haskell_indent_case to
" change indentation for `if'(default 3) and `case'(default 5).
" Example (in .vimrc):
" > let g:haskell_indent_if = 2
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
if !exists('g:haskell_indent_if')
" if bool
" >>>then ...
" >>>else ...
let g:haskell_indent_if = 3
endif
if !exists('g:haskell_indent_case')
" case xs of
" >>>>>[] -> ...
" >>>>>(y:ys) -> ...
let g:haskell_indent_case = 5
endif
setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=!^F,o,O
function! GetHaskellIndent()
let line = substitute(getline(getpos('.')[1] - 1), '\t', repeat(' ', &tabstop), 'g')
if line =~ '[!#$%&*+./<=>?@\\^|~-]$\|\<do$'
return match(line, '\s*where \zs\|\S') + &shiftwidth
endif
if line =~ '{$'
return match(line, '\s*where \zs\|\S') + &shiftwidth
endif
if line =~ '^\(instance\|class\).*\&.*where$'
return &shiftwidth
endif
if line =~ ')$'
let pos = getpos('.')
normal k$
let paren_end = getpos('.')
normal %
let paren_begin = getpos('.')
call setpos('.', pos)
if paren_begin[1] != paren_end[1]
return paren_begin[2] - 1
endif
endif
if line !~ '\<else\>'
let s = match(line, '\<if\>.*\&.*\zs\<then\>')
if s > 0
return s
endif
let s = match(line, '\<if\>')
if s > 0
return s + g:haskell_indent_if
endif
endif
let s = match(line, '\<do\s\+\zs[^{]\|\<where\s\+\zs\w\|\<let\s\+\zs\S\|^\s*\zs|\s')
if s > 0
return s
endif
let s = match(line, '\<case\>')
if s > 0
return s + g:haskell_indent_case
endif
return match(line, '\S')
endfunction

View File

@ -15,12 +15,12 @@ Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim' Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline' Plugin 'bling/vim-airline'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdtree'
Plugin 'Shougo/vimproc.vim' Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/vimshell.vim' Plugin 'Shougo/vimshell.vim'
Plugin 'tpope/vim-markdown' Plugin 'tpope/vim-markdown'
Plugin 'altercation/vim-colors-solarized' Plugin 'altercation/vim-colors-solarized'
Plugin 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line " All of your Plugins must be added before the following line
call vundle#end() " required call vundle#end() " required
@ -44,7 +44,9 @@ noremap <C-o> :CtrlPBuffer<CR>
let g:airline_powerline_fonts=1 let g:airline_powerline_fonts=1
" Configuring YouCompleteMe " Configuring YouCompleteMe
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py' let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py'
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
" Configuring VimShell " Configuring VimShell
noremap <C-s> :VimShell -split<CR> noremap <C-s> :VimShell -split<CR>

13
vim/ycm_extra_conf.py Normal file
View File

@ -0,0 +1,13 @@
def FlagsForFile(filename, **kwargs):
c = filename.endswith('.c')
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-DNDEBUG',
'-std=c99' if c else '-std=c++11',
'-x', 'c' if c else 'c++',
'-isystem', '/usr/include',
]
return dict(flags=flags, do_cache=True)