Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chxuan committed Apr 22, 2018
1 parent b8941df commit 5f21533
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 99 deletions.
119 changes: 43 additions & 76 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ set nocompatible
set noeb
" 告诉我们文件的哪一行被改变过
set report=0
" 可以在buffer的任何地方使用鼠标
" set mouse=a
set selection=exclusive
set selectmode=mouse,key

Expand Down Expand Up @@ -168,80 +166,48 @@ set encoding=utf8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 新建文件设置
" 插件列表
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufNewFile *.cpp,*.cc,*.c,*.hpp,*.h,*.sh,*.py exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"\#!/bin/bash")
call append(line("."), "")
elseif expand("%:e") == 'py'
call setline(1,"#!/usr/bin/env python")
call append(line("."),"# coding=utf-8")
call append(line(".")+1, "")
elseif expand("%:e") == 'cpp'
call setline(1,"#include <iostream>")
call append(line("."), "")
elseif expand("%:e") == 'cc'
call setline(1,"#include <iostream>")
call append(line("."), "")
elseif expand("%:e") == 'c'
call setline(1,"#include <stdio.h>")
call append(line("."), "")
elseif expand("%:e") == 'h'
call setline(1, "#pragma once")
elseif expand("%:e") == 'hpp'
call setline(1, "#pragma once")
endif
endfunc
autocmd BufNewFile * normal G

" Vundle
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" vundle 管理的插件列表必须位于vundle#begin()和vundle#end()之间
Plugin 'VundleVim/Vundle.vim'
Plugin 'L9'
Plugin 'chxuan/change-colorscheme'
Plugin 'Yggdroot/indentLine'
Plugin 'easymotion/vim-easymotion'
Plugin 'haya14busa/incsearch.vim'
Plugin 'wsdjeg/FlyGrep.vim'
Plugin 'iamcco/mathjax-support-for-mkdp'
Plugin 'iamcco/markdown-preview.vim'
Plugin 'jiangmiao/auto-pairs'
Plugin 'scrooloose/nerdtree'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'rkulla/pydiction'
Plugin 'Valloric/MatchTagAlways'
Plugin 'Valloric/YouCompleteMe'
Plugin 'docunext/closetag.vim'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-endwise'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-scripts/a.vim'
Plugin 'vim-scripts/DoxygenToolkit.vim'
Plugin 'vim-scripts/txt.vim'
Plugin 'ryanoasis/vim-devicons'
Plugin 'gorodinskiy/vim-coloresque'
Plugin 'will133/vim-dirdiff'
Plugin 'mhinz/vim-startify'
Plugin 'junegunn/vim-slash'

call vundle#end()
filetype plugin indent on
call plug#begin('~/.vim/plugged')

Plug 'vim-scripts/L9'
Plug 'chxuan/change-colorscheme'
Plug 'Yggdroot/indentLine'
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'wsdjeg/FlyGrep.vim'
Plug 'iamcco/mathjax-support-for-mkdp'
Plug 'iamcco/markdown-preview.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'scrooloose/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
Plug 'rkulla/pydiction'
Plug 'Valloric/MatchTagAlways'
Plug 'Valloric/YouCompleteMe'
Plug 'docunext/closetag.vim'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'majutsushi/tagbar'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-scripts/a.vim'
Plug 'vim-scripts/DoxygenToolkit.vim'
Plug 'vim-scripts/txt.vim'
Plug 'ryanoasis/vim-devicons'
Plug 'gorodinskiy/vim-coloresque'
Plug 'will133/vim-dirdiff'
Plug 'mhinz/vim-startify'
Plug 'junegunn/vim-slash'

call plug#end()

" load vim default plugin
runtime macros/matchit.vim
Expand Down Expand Up @@ -324,8 +290,9 @@ imap <Leader>t <ESC> :TagbarToggle<CR>
" colorscheme
set background=dark
let g:solarized_termcolors=256
let g:sorlized_termtrans=1
colorscheme solarized
"colorscheme monokai
" colorscheme monokai

" cpp_class_scope_highlight
let g:cpp_class_scope_highlight = 1
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ An automatic configuration program for vim

| 插件 | 说明 |
| ------- | ----- |
| [Vundle][4] | 基于Git仓库的插件管理软件 |
| [vim-plug][4] | 比[Vundle][54]下载更快的插件管理软件 |
| [YouCompleteMe][5] | 史上最强大的基于语义的自动补全插件,支持C/C++、C#、Python、PHP等语言 |
| [NerdTree][6] | 显示树型目录结构 |
| [Airline][8] | 可以取代[powerline][9]的状态栏美化插件 |
Expand Down Expand Up @@ -142,7 +142,7 @@ Q & A

- **`安装vimplus会经常失败,安装了几次都不成功!!!`**

vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/bundle/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。
vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/plugged/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。

- **`使用第三方库时怎么让ycm补全第三方库API?`**

Expand Down Expand Up @@ -215,7 +215,7 @@ Q & A
[1]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/vimplus-logo.png
[2]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/main.png
[3]: https://brew.sh/
[4]: https://github.com/VundleVim/Vundle.vim
[4]: https://github.com/junegunn/vim-plug
[5]: https://github.com/Valloric/YouCompleteMe
[6]: https://github.com/scrooloose/nerdtree
[8]: https://github.com/vim-airline/vim-airline
Expand Down Expand Up @@ -264,3 +264,4 @@ Q & A
[51]: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DejaVuSansMono
[52]: https://github.com/tiagofumo/vim-nerdtree-syntax-highlight
[53]: https://github.com/Xuyuanp/nerdtree-git-plugin
[54]: https://github.com/VundleVim/Vundle.vim
30 changes: 12 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ function compile_vim()
# 安装mac平台必要软件
function install_prepare_software_on_mac()
{
brew install vim gcc cmake ctags-exuberant
brew install vim gcc cmake ctags-exuberant curl
}

# 安装centos发行版必要软件
function install_prepare_software_on_centos()
{
sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel
sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel curl
}

# 安装ubuntu发行版必要软件
function install_prepare_software_on_ubuntu()
{
sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig
sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig curl
ubuntu_1604=`is_ubuntu1604`
echo ${ubuntu_1604}

Expand All @@ -89,30 +89,26 @@ function install_prepare_software_on_ubuntu()
# 安装archlinux发行版必要软件
function install_prepare_software_on_archlinux()
{
sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2
sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 curl
}

# 拷贝文件
function copy_files()
{
rm -rf ~/.vimrc
# cp .vimrc ~
ln -s ${PWD}/.vimrc ~

rm -rf ~/.vimrc.local
cp ${PWD}/.vimrc.local ~

rm -rf ~/.ycm_extra_conf.py
# cp .ycm_extra_conf.py ~
ln -s ${PWD}/.ycm_extra_conf.py ~

mkdir ~/.vim
rm -rf ~/.vim/plugin
# cp -R ./plugin ~/.vim
ln -s ${PWD}/plugin ~/.vim

rm -rf ~/.vim/colors
# cp -R ./colors ~/.vim
ln -s ${PWD}/colors ~/.vim
}

Expand Down Expand Up @@ -142,29 +138,29 @@ function install_fonts_on_linux()
cp ./fonts/10-powerline-symbols.conf ~/.config/fontconfig/conf.d
}

# 克隆插件管理软件Vundle
function clone_vundle()
# 下载插件管理软件vim-plug
function download_vim_plug()
{
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
}

# 安装vim插件
function install_vim_plugin()
{
vim -c "PluginInstall" -c "q" -c "q"
vim -c "PlugInstall" -c "q" -c "q"
}

# 在mac平台编译ycm插件
function compile_ycm_on_mac()
{
cd ~/.vim/bundle/YouCompleteMe
cd ~/.vim/plugged/YouCompleteMe
./install.py --clang-completer
}

# 在linux平台编译ycm插件
function compile_ycm_on_linux()
{
cd ~/.vim/bundle/YouCompleteMe
cd ~/.vim/plugged/YouCompleteMe
sudo ./install.py --clang-completer
}

Expand Down Expand Up @@ -195,10 +191,8 @@ function chown_dir()
current_user=${who_is%% *}
sudo chown -R ${current_user}:${current_user} ~/.vim
sudo chown -R ${current_user}:${current_user} ~/.cache
# sudo chown ${current_user}:${current_user} ~/.vimrc
sudo chown ${current_user}:${current_user} ~/.vimrc.local
sudo chown ${current_user}:${current_user} ~/.viminfo
# sudo chown ${current_user}:${current_user} ~/.ycm_extra_conf.py
}

# 在mac平台安装vimplus
Expand All @@ -207,7 +201,7 @@ function install_vimplus_on_mac()
install_prepare_software_on_mac
copy_files
install_fonts_on_mac
clone_vundle
download_vim_plug
install_vim_plugin
compile_ycm_on_mac
print_logo
Expand All @@ -217,7 +211,7 @@ function begin_install_vimplus()
{
copy_files
install_fonts_on_linux
clone_vundle
download_vim_plug
install_vim_plugin
compile_ycm_on_linux
chown_dir
Expand Down
2 changes: 0 additions & 2 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

sudo rm -rf ~/.vimrc.local
sudo rm -rf ~/.vimrc
sudo rm -rf ~/.vim

echo "Done!"
Expand Down

0 comments on commit 5f21533

Please sign in to comment.