From 1ccfead62b93549812813438d2c2a6cb28ca4458 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Sun, 21 Dec 2014 22:57:35 +0100 Subject: [PATCH] fix ycm and add more vimconfig to repo --- .gitignore | 11 ++++-- vim/indent/haskell.vim | 85 ++++++++++++++++++++++++++++++++++++++++++ vimrc => vim/vimrc | 6 ++- vim/ycm_extra_conf.py | 13 +++++++ 4 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 vim/indent/haskell.vim rename vimrc => vim/vimrc (98%) create mode 100644 vim/ycm_extra_conf.py diff --git a/.gitignore b/.gitignore index ff2cd90..4d3adf9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,12 @@ -# lol passwords in plain text +# weechat weechat/irc.conf - -# lol logs weechat/logs/ weechat/weechat.log + +# vim +vim/bundle +vim/tmp + +# other +*.pyc diff --git a/vim/indent/haskell.vim b/vim/indent/haskell.vim new file mode 100644 index 0000000..dc7c649 --- /dev/null +++ b/vim/indent/haskell.vim @@ -0,0 +1,85 @@ +" Vim indent file +" Language: Haskell +" Author: motemen +" 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 =~ '[!#$%&*+./<=>?@\\^|~-]$\|\' + let s = match(line, '\.*\&.*\zs\') + if s > 0 + return s + endif + + let s = match(line, '\') + if s > 0 + return s + g:haskell_indent_if + endif + endif + + let s = match(line, '\ 0 + return s + endif + + let s = match(line, '\') + if s > 0 + return s + g:haskell_indent_case + endif + + return match(line, '\S') +endfunction diff --git a/vimrc b/vim/vimrc similarity index 98% rename from vimrc rename to vim/vimrc index 18c9f24..aeed7b9 100644 --- a/vimrc +++ b/vim/vimrc @@ -15,12 +15,12 @@ Plugin 'gmarik/Vundle.vim' Plugin 'tpope/vim-fugitive' Plugin 'kien/ctrlp.vim' Plugin 'bling/vim-airline' -Plugin 'Valloric/YouCompleteMe' Plugin 'scrooloose/nerdtree' Plugin 'Shougo/vimproc.vim' Plugin 'Shougo/vimshell.vim' Plugin 'tpope/vim-markdown' Plugin 'altercation/vim-colors-solarized' +Plugin 'Valloric/YouCompleteMe' " All of your Plugins must be added before the following line call vundle#end() " required @@ -44,7 +44,9 @@ noremap :CtrlPBuffer let g:airline_powerline_fonts=1 " 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 noremap :VimShell -split diff --git a/vim/ycm_extra_conf.py b/vim/ycm_extra_conf.py new file mode 100644 index 0000000..772a480 --- /dev/null +++ b/vim/ycm_extra_conf.py @@ -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)