Skip to content

Instantly share code, notes, and snippets.

@EAirPeter
Created January 20, 2019 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EAirPeter/b72b76c7a7b1ede241610c267331b9bb to your computer and use it in GitHub Desktop.
Save EAirPeter/b72b76c7a7b1ede241610c267331b9bb to your computer and use it in GitHub Desktop.
My .vimrc
set nocompatible
set encoding=utf-8
set fileencodings=utf-8,gbk,s-jis
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set backspace=indent,eol,start
set display=truncate
set guifont=consolas:h12
set history=200
set hlsearch
set incsearch
set ruler
set mouse=a
set nobackup
set noundofile
set number
set showcmd
set smartindent
set timeout
set timeoutlen=100
set wildmenu
colorscheme desert
filetype plugin indent on
syntax on
highlight LongLine ctermbg=red guibg=red
highlight ExtraWhitespace ctermbg=red guibg=red
"au BufWinEnter * let w:m0 = matchadd('LongLine', '\%>80v.\+', -1)
au BufWinEnter * let w:m1 = matchadd('ExtraWhitespace', '\s\+$', -1)
au InsertEnter * let w:m2 = matchadd('ExtraWhitespace', '\s\+\%#\@<!$', -1)
au InsertEnter * call matchdelete(w:m1)
au InsertLeave * let w:m1 = matchadd('ExtraWhitespace', '\s\+$', -1)
au InsertLeave * call matchdelete(w:m2)
augroup VimStartup
au!
au BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup end
let g:Gcc = "gcc"
let g:Gxx = "g++"
let g:Clang = "clang -Xclang -flto-visibility-public-std"
let g:Clang = g:Clang . " -D_CRT_SECURE_NO_WARNINGS"
let g:Clangxx = "clang++ -Xclang -flto-visibility-public-std"
let g:Clangxx = g:Clangxx . " -D_CRT_SECURE_NO_WARNINGS"
let g:CFlags = " -Wall -Wconversion -Wextra -Wformat -o %<.exe % -DVIOLOCAL"
let g:CxxFlags = " -Wall -Wconversion -Wextra -Wformat -o %<.exe % -DVIOLOCAL"
. " -ID:\\code\\algo\\include"
let g:CGcc = g:Gcc . g:CFlags
let g:CClang = g:Clang . g:CFlags
let g:CxxGcc = g:Gxx . g:CxxFlags
let g:CxxClang = g:Clangxx . g:CxxFlags
au FileType markdown map <F8> :execute "!%"<CR>
au FileType c map <F5> :execute "!gdb %<.exe"<CR>
au FileType c map <F8> :execute "!%<.exe"<CR>
au FileType c map <C-F8> :execute "!cppcp %"<CR>
au FileType c map <F7> :execute "!" . g:CClang . " -std=c11 -O2"<CR>
au FileType c map <C-F7> :execute "!" . g:CGcc . " -std=c11 -O0 -g"<CR>
au FileType c map <F9> :execute "!" . g:CClang . " -std=c99 -O2"<CR>
au FileType c map <C-F9> :execute "!" . g:CGcc . " -std=c99 -O0 -g"<CR>
au FileType cpp map <F5> :execute "!gdb %<.exe"<CR>
au FileType cpp map <F8> :execute "!%<.exe"<CR>
au FileType cpp map <C-F8> :execute "!cppcp %"<CR>
au FileType cpp map <F6> :execute "!" . g:CxxGcc . " -std=c++11 -O2"<CR>
au FileType cpp map <C-F6> :execute "!" . g:CxxGcc . " -std=c++11 -O0 -g"<CR>
au FileType cpp map <F7> :execute "!" . g:CxxClang . " -std=c++17 -O2"<CR>
au FileType cpp map <C-F7> :execute "!" . g:CxxGcc . " -std=c++17 -O0 -g"<CR>
au FileType cpp map <F9> :execute "!" . g:CxxClang . " -std=c++14 -O2"<CR>
au FileType cpp map <C-F9> :execute "!" . g:CxxGcc . " -std=c++14 -O0 -g"<CR>
au FileType cpp map <F11> :execute "!" . g:CxxGcc . " -std=c++98 -O2"<CR>
au FileType cpp map <C-F11> :execute "!" . g:CxxGcc . " -std=c++98 -O0 -g"<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment