Skip to content

Instantly share code, notes, and snippets.

@Clcanny
Last active November 21, 2017 07:03
Show Gist options
  • Save Clcanny/df37a3141df7cd6fcfa68c2842cfb600 to your computer and use it in GitHub Desktop.
Save Clcanny/df37a3141df7cd6fcfa68c2842cfb600 to your computer and use it in GitHub Desktop.
Vim + C++
APT::Get::Assume-Yes "true";
APT::Get::force-yes "true";
APT::Get::allow-downgrades "true";
APT::Get::allow-remove-essential "true";
APT::Get::allow-change-held-packages "true";
FROM debian:latest
ADD sources.list /etc/apt/sources.list
ADD aptgetforceyes /etc/apt/apt.conf.d/aptgetforceyes
RUN apt-get update
RUN apt-get install git
ADD gitconfig ~/.gitconfig
RUN apt-get install zsh curl
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN apt-get install gcc g++ make valgrind cloc
RUN apt-get install ncurses-dev python-dev python3-dev
RUN cd /tmp && git clone https://github.com/vim/vim
RUN cd /tmp/vim \
&& ./configure \
--with-features=huge \
--enable-fontset \
--enable-multibyte \
--enable-pythoninterp \
--enable-rubyinterp \
--enable-perlinterp \
--enable-luainterp \
--enable-cscope \
--disable-gui \
--prefix /usr \
&& make \
&& make install \
&& rm -f -r /tmp/vim
RUN mkdir -p ~/.vim/bundle
RUN apt-get install build-essential clang cmake
RUN cd ~/.vim/bundle && git clone https://github.com/Valloric/YouCompleteMe.git
RUn cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive && ./install.py --clang-completer
RUN cd ~/.vim/bundle \
&& git clone https://github.com/VundleVim/Vundle.vim.git \
&& git clone https://github.com/rdnetto/YCM-Generator.git \
&& git clone https://github.com/scrooloose/nerdtree.git \
&& git clone https://github.com/vim-scripts/a.vim.git \
&& git clone https://github.com/easymotion/vim-easymotion.git \
&& git clone git://github.com/altercation/vim-colors-solarized.git \
&& git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs \
&& git clone git://github.com/nathanaelkane/vim-indent-guides.git \
&& git clone https://github.com/vim-airline/vim-airline.git \
&& git clone https://github.com/vim-airline/vim-airline-themes.git \
&& git clone git://github.com/jeffkreeftmeijer/vim-numbertoggle.git \
&& git clone git://github.com/tpope/vim-commentary.git \
&& git clone https://github.com/junegunn/goyo.vim.git
RUN mkdir -p ~/.vim/undo
ADD vimrc ~/.vimrc
FROM cppvim:latest
RUN apt-get update
RUN apt-get install g++ cmake wget
RUN wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz
RUN tar xf release-1.7.0.tar.gz
RUN cd googletest-release-1.7.0 && cmake -DBUILD_SHARED_LIBS=ON . && make
RUN cd googletest-release-1.7.0 && cp -a include/gtest /usr/include && cp -a libgtest_main.so libgtest.so /usr/lib/
RUN ldconfig -v | grep gtest
RUN rm -f -r release-1.7.0.tar.gz googletest-release-1.7.0
[credential]
helper = store
[user]
email = 837940593@qq.com
name = demons
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/a.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'easymotion/vim-easymotion'
Plugin 'jiangmiao/auto-pairs'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
Plugin 'tpope/vim-commentary'
Plugin 'goyo.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" for YCM
let g:ycm_always_populate_location_list = 1
let g:ycm_open_loclist_on_ycm_diags = 1
let g:ycm_min_num_of_chars_for_completion = 1
let g:ycm_min_num_identifier_candidate_chars = 0
let g:ycm_auto_trigger = 1
let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '>>'
let g:ycm_enable_diagnostic_signs = 1
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_echo_current_diagnostic = 1
let g:ycm_allow_changing_updatetime = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_collect_identifiers_from_tags_files = 0
let g:ycm_seed_identifiers_with_syntax = 0
let g:ycm_auto_start_csharp_server = 1
let g:ycm_auto_stop_csharp_server = 1
let g:ycm_csharp_server_port = 0
let g:ycm_autoclose_preview_window_after_insertion = 1
nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>
nnoremap <F2> :YcmGenerateConfig<CR>
" for NERDTree
autocmd vimenter * NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeWinSize=25
let NERDTreeWinPos="right"
autocmd VimEnter * wincmd p
map <F2> :NERDTreeToggle<CR>
" for easymotion
let mapleader=" "
" for altercation/vim-colors-solarized
syntax enable
set background=dark
colorscheme solarized
" for Indent GUides
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
" for airline
let g:airline#extensions#tabline#enabled = 1
" for numbertoggle
set nu
set shiftwidth=4
set softtabstop=4
set backspace=indent,eol,start
set ignorecase
" for Goyo
map <F3> :Goyo<CR>
let g:goyo_width=80
let g:goyoheight=120
let g:goyo_linenr=0
" fold
set foldmethod=syntax
set nofoldenable
" use Chinese
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
" save cursor postion
autocmd BufReadPost *
\ if line("'\"")>0&&line("'\"")<=line("$") |
\ exe "normal g'\"" |
\ endif
" undo after exit
if has('persistent_undo') "check if your vim version supports it
set undofile "turn on the feature
set undodir=$HOME/.vim/undo "directory where the undo files will be stored
endif
@Clcanny
Copy link
Author

Clcanny commented May 6, 2017

如果在iTerm2(Mac)下某些颜色难以看见,做如下操作:

Preference ->Profiles ->Minimum contrast(调高一些)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment