Skip to content

Instantly share code, notes, and snippets.

@Clcanny
Last active May 11, 2019 12:59
Show Gist options
  • Save Clcanny/c4d4b76abaffdb2d852e66f5096f933e to your computer and use it in GitHub Desktop.
Save Clcanny/c4d4b76abaffdb2d852e66f5096f933e to your computer and use it in GitHub Desktop.
Rust Development #Rust #Vim
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
FROM debian:stretch
MAINTAINER demons:837940593@qq.com
# reference: https://stackoverflow.com/questions/25019183/docker-java7-install-fail/25020555#25020555
ENV DEBIAN_FRONTEND noninteractive
ADD sources.list /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y curl wget
RUN apt-get install -y git
RUN apt-get install -y zsh
RUN sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN apt-get install -y build-essential
# reference: https://github.com/rust-lang/rustup.rs/issues/397
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN apt-get install -y vim
RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
ADD config /root/.cargo/config
RUN /bin/bash -c \
"source ~/.cargo/env &&\
rustup update &&\
rustup component add rustfmt clippy"
# ADD vimrc ~/.vimrc doesn't work.
ADD vimrc /root/.vimrc
# reference: https://github.com/junegunn/vim-plug/issues/730
# RUN vim +'PlugInstall --sync' +qall &> /dev/null
RUN echo "source ~/.cargo/env" >> ~/.zshrc
WORKDIR /root
CMD ["zsh"]
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
" Without this setting, you can't use arrow-up ... key in edit mode.
set nocompatible
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set backspace=indent,eol,start
let mapleader = ";"
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin("~/.vim/plugged")
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
Plug 'altercation/vim-colors-solarized'
set t_Co=16
let g:solarized_termcolors=256
syntax enable
set background=dark
Plug 'easymotion/vim-easymotion'
let g:EasyMotion_smartcase = 1
nmap <space><space>j <Plug>(easymotion-j)
nmap <space><space>k <Plug>(easymotion-k)
nmap <space><space>h <Plug>(easymotion-linebackward)
nmap <space><space>l <Plug>(easymotion-lineforward)
nmap <space><space>b <Plug>(easymotion-bd-w)
nmap <space><space>e <Plug>(easymotion-bd-e)
nmap <space><space>f <Plug>(easymotion-bd-f)
imap `f <c-\><c-o><Plug>(easymotion-bd-f)
imap `b <c-\><c-o><Plug>(easymotion-bd-w)
imap `e <c-\><c-o><Plug>(easymotion-bd-e)
Plug 'rust-lang/rust.vim'
let g:rustfmt_autosave = 1
Plug 'scrooloose/syntastic'
let g:syntastic_rust_checkers = ["rustc"]
let g:syntastic_aggregate_errors = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Initialize plugin system
call plug#end()
" reference: https://github.com/altercation/vim-colors-solarized/issues/104
" It appears as though colorscheme solarized
" must come somewhere after call vundle#end().
colorscheme solarized
" go to the beginning of the current line
" stronger H
nnoremap H _
" nop means no operation
nnoremap 0 <nop>
" go to the end of the current line
" stronger L $
nnoremap L g_
nnoremap $ <nop>
" exit insert mode
inoremap jk <esc>
" change/delete content in next parentheses
onoremap n( :<c-u>normal! f(vi(<cr>
" change/delete content in last parentheses
onoremap l( :<c-u>normal! F(vi(<cr>
" change/delete conttent in next double quotation marks
onoremap n" :<c-u>normal! f"vi"<cr>
" change/delete conttent in last double quotation marks
onoremap l" :<c-u>normal! F"vi"<cr>
set nu
" 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
" check if your vim version supports it
if has('persistent_undo')
" turn on the feature
set undofile
" directory where the undo files will be stored
set undodir=/home/admin/demonsruan/Software/install/vim/undo
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment