Last active
June 4, 2018 15:05
-
-
Save silverweed/16a7889b3cbf75d9b099f46a8f3fa37c to your computer and use it in GitHub Desktop.
vimrc + clang-format
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
--- | |
Language: Cpp | |
AccessModifierOffset: -8 | |
AlignAfterOpenBracket: DontAlign | |
AlignConsecutiveAssignments: false | |
AlignConsecutiveDeclarations: false | |
AlignEscapedNewlines: Left | |
AlignOperands: true | |
AlignTrailingComments: true | |
AllowAllParametersOfDeclarationOnNextLine: false | |
AllowShortBlocksOnASingleLine: true | |
AllowShortCaseLabelsOnASingleLine: true | |
AllowShortFunctionsOnASingleLine: Empty | |
AllowShortIfStatementsOnASingleLine: true | |
AllowShortLoopsOnASingleLine: false | |
AlwaysBreakAfterReturnType: None | |
AlwaysBreakTemplateDeclarations: true | |
BinPackArguments: false | |
BinPackParameters: true | |
BreakBeforeBraces: Attach | |
BreakBeforeBinaryOperators: false | |
BreakBeforeInheritanceComma: true | |
BreakBeforeTernaryOperators: true | |
BreakConstructorInitializers: BeforeComma | |
BreakStringLiterals: false | |
ColumnLimit: 120 | |
CompactNamespaces: false | |
ConstructorInitializerAllOnOneLineOrOnePerLine: false | |
ConstructorInitializerIndentWidth: 8 | |
ContinuationIndentWidth: 8 | |
Cpp11BracedListStyle: false | |
DerivePointerAlignment: false | |
FixNamespaceComments: true | |
IncludeBlocks: Preserve | |
IndentCaseLabels: false | |
IndentPPDirectives: AfterHash | |
IndentWidth: 8 | |
IndentWrappedFunctionNames: true | |
KeepEmptyLinesAtTheStartOfBlocks: true | |
NamespaceIndentation: Inner | |
PointerAlignment: Left | |
SortIncludes: true | |
SortUsingDeclarations: true | |
SpaceAfterCStyleCast: false | |
SpaceAfterTemplateKeyword: true | |
SpaceBeforeAssignmentOperators: true | |
SpaceBeforeInheritanceColon: true | |
SpaceBeforeParens: ControlStatements | |
SpaceBeforeRangeBasedForLoopColon: true | |
SpaceInEmptyParentheses: false | |
SpacesBeforeTrailingComments: 3 | |
SpacesInAngles: false | |
SpacesInCStyleCastParentheses: false | |
SpacesInParentheses: false | |
SpacesInSquareBrackets: false | |
Standard: Cpp11 | |
TabWidth: 8 | |
UseTab: ForIndentation | |
--- |
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
"call pathogen#infect() | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Vundle plugins {{{ | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'JuliaEditorSupport/julia-vim' | |
Plugin 'beyondmarc/glsl.vim' | |
Plugin 'leafo/moonscript-vim' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'kchmck/vim-coffee-script' | |
Plugin 'rhysd/vim-crystal' | |
Plugin 'fatih/vim-go' | |
Plugin 'Valloric/YouCompleteMe' | |
" }}} | |
call vundle#end() | |
set t_Co=256 | |
syntax enable | |
filetype plugin indent on | |
set autoindent | |
set incsearch | |
set mouse=a | |
set wildmenu | |
set wildmode=longest,list | |
"set modeline | |
set clipboard=unnamedplus | |
set cryptmethod=blowfish2 | |
" Jump to prev line by pressing left arrow on line begin | |
set whichwrap+=<,>,h,l,[,] | |
set list | |
set listchars=tab:.\ ,trail:_ | |
colorscheme default | |
" Move lines up/down with Ctrl+arrows | |
nnoremap <c-Down> :m .+1<CR>== | |
nnoremap <c-Up> :m .-2<CR>== | |
inoremap <c-Down> <Esc>:m .+1<CR>==gi | |
inoremap <c-Up> <Esc>:m .-2<CR>==gi | |
" Highlight 80th col | |
let &colorcolumn="80,".join(range(120,999),",") | |
hi ColorColumn ctermbg=235 | |
hi Comment ctermfg=blue | |
" YouCompleteMe | |
let g:ycm_show_diagnostics_ui = 0 | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_autoclose_preview_window_after_insertion = 1 | |
let g:ycm_global_ycm_extra_conf = '~/.vim/ycm.py' | |
let g:ycm_confirm_extra_conf = 0 | |
set completeopt-=preview | |
set shortmess+=c | |
au FileType cs,c,cpp,js,go nnoremap gd :YcmCompleter GoToDeclaration<CR> | |
au FileType cs,c,cpp,js,go noremap gf :YcmCompleter GoToDefinition<CR> | |
au FileType cs,c,cpp,js,go noremap gi :YcmCompleter GoToImplementation<CR> | |
" Prevent auto-comment insertion | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
""" LANGUAGES | |
" Python settings | |
autocmd Filetype python setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab | |
" HTML/XML settings | |
autocmd Filetype xml,html setlocal tabstop=4 shiftwidth=4 expandtab | |
" Rust settings | |
let g:rust_recommended_style = 0 | |
" Go settings | |
let g:gofmt_command = "goimports" | |
let go_highlight_space_tab_error = 0 | |
let go_highlight_trailing_whitespace_error = 0 | |
autocmd FileType go autocmd BufWritePre <buffer> Fmt | |
hi link goDirective Include | |
hi link goDeclaration Identifier | |
hi link goDeclType Identifier | |
hi link goBuiltins Identifier | |
" Haskell settings | |
autocmd Filetype haskell setlocal expandtab | |
autocmd Filetype cabal setlocal expandtab | |
let hs_highlight_boolean = 1 | |
let hs_highlight_types = 1 | |
let hs_highlight_more_types = 1 | |
" Java settings | |
let java_highlight_functions="style" | |
let java_highlight_java_lang_ids=1 | |
hi link javaC_ javaType | |
" disable Ex mode | |
map Q <Nop> | |
" toggle wrap | |
map <silent> <leader>w :set wrap!<CR> | |
" buffer switching | |
set hidden | |
nnoremap <F5> :buffers<CR>:buffer<Space> | |
nnoremap <leader>b :buffers<CR>:buffer<Space> | |
nnoremap <leader>n :bn<CR> | |
nnoremap <leader>p :bp<CR> | |
" Enable the list of buffers | |
"let g:airline#extensions#tabline#enabled = 1 | |
" Show just the filename | |
"let g:airline#extensions#tabline#fnamemod = ':t' | |
" remove trailing whitespace on save | |
fun! StripTrailingWhitespace() | |
" Don't strip on these filetypes | |
if exists('b:noStripWS') | |
return | |
endif | |
%s/\s\+$//e|'' | |
endfun | |
autocmd BufWritePre * call StripTrailingWhitespace() | |
autocmd FileType markdown let b:noStripWS=1 | |
" clang format | |
function FormatFile() | |
let l:lines="all" | |
pyf /usr/share/clang/clang-format-7/clang-format.py | |
endfunction | |
map <leader>f :call FormatFile()<cr> | |
autocmd BufWritePre *.[ch]pp call FormatFile() |
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
call pathogen#infect() | |
set t_Co=256 | |
syntax enable | |
filetype plugin indent on | |
set autoindent | |
set incsearch | |
set mouse=a | |
set wildmenu | |
set wildmode=longest,list | |
"set modeline | |
set clipboard=unnamedplus | |
set cryptmethod=blowfish2 | |
" Jump to prev line by pressing left arrow on line begin | |
set whichwrap+=<,>,h,l,[,] | |
set list | |
set listchars=tab:\|\ ,trail:_ | |
" Move lines up/down with Ctrl+arrows | |
nnoremap <c-Down> :m .+1<CR>== | |
nnoremap <c-Up> :m .-2<CR>== | |
inoremap <c-Down> <Esc>:m .+1<CR>==gi | |
inoremap <c-Up> <Esc>:m .-2<CR>==gi | |
" Highlight 80th col | |
let &colorcolumn="80,".join(range(120,999),",") | |
hi ColorColumn ctermbg=232 | |
hi Comment ctermfg=blue | |
" YouCompleteMe | |
let g:ycm_show_diagnostics_ui = 0 | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_autoclose_preview_window_after_insertion = 1 | |
let g:ycm_global_ycm_extra_conf = '~/.vim/ycm.py' | |
let g:ycm_confirm_extra_conf = 0 | |
set completeopt-=preview | |
" Prevent auto-comment insertion | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
""" LANGUAGES | |
" Python settings | |
autocmd Filetype python setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab | |
" HTML/XML settings | |
autocmd Filetype xml,html setlocal tabstop=4 shiftwidth=4 expandtab | |
" Rust settings | |
let g:rust_recommended_style = 0 | |
" Go settings | |
let g:gofmt_command = "goimports" | |
let go_highlight_space_tab_error = 0 | |
let go_highlight_trailing_whitespace_error = 0 | |
autocmd FileType go autocmd BufWritePre <buffer> Fmt | |
hi link goDirective Include | |
hi link goDeclaration Identifier | |
hi link goDeclType Identifier | |
hi link goBuiltins Identifier | |
" Fortran settings | |
let fortran_free_source=1 | |
let fortran_have_tabs=1 | |
let fortran_more_precise=1 | |
let fortran_do_enddo=1 | |
" Haskell settings | |
autocmd Filetype haskell setlocal expandtab | |
autocmd Filetype cabal setlocal expandtab | |
let hs_highlight_boolean = 1 | |
let hs_highlight_types = 1 | |
let hs_highlight_more_types = 1 | |
" Java settings | |
let java_highlight_functions="style" | |
let java_highlight_java_lang_ids=1 | |
hi link javaC_ javaType | |
" Elm settings | |
let g:elm_format_autosave = 1 | |
autocmd Filetype elm setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment