-
Notifications
You must be signed in to change notification settings - Fork 1
/
_.vimrc
133 lines (122 loc) · 4.14 KB
/
_.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
set nocompatible "去掉vi的一致性
set number "显示行号
" 隐藏滚动条
set guioptions-=r
set guioptions-=L
set guioptions-=b
set showtabline=0 "隐藏顶部标签栏
set guifont=Consolas:h13 "设置字体
syntax on "开启语法高亮
syntax enable
let g:solarized_termcolors=256 "solarized主题设置在终端下的设置
" 设置背景色
set t_Co=256 " add export TERM=xterm-256color
" set termguicolors
if has('gui_running')
set background=light
else
set background=dark
endif
colorscheme solarized " 设置主题
" set nowrap "设置不折行
set fileformat=unix "设置以unix的格式保存文件
set cindent "设置C样式的缩进格式
set tabstop=4 "设置table长度
set shiftwidth=4 "同上
set showmatch "显示匹配的括号
set scrolloff=5 "距离顶部和底部5行
set laststatus=2 "命令行为两行
set fenc=utf-8 "文件编码
set backspace=2
set mouse=a "启用鼠标
set selection=exclusive
set selectmode=mouse,key
set matchtime=5
" set ignorecase "忽略大小写
set incsearch
set hlsearch "高亮搜索项
set noexpandtab "不允许扩展table
set whichwrap+=<,>,h,l
set autoread
set cursorline "突出显示当前行
" set cursorcolumn "突出显示当前列
set pastetoggle=<F9>
set smartindent
set foldenable
set foldmethod=syntax
let mapleader=","
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Lokaltog/vim-powerline'
Plugin 'scrooloose/nerdtree'
Plugin 'Yggdroot/indentLine'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tell-k/vim-autopep8'
Plugin 'scrooloose/nerdcommenter'
Plugin 'easymotion/vim-easymotion'
call vundle#end()
filetype plugin indent on
" NERDTree
" F2开启和关闭树"
map <C-n> :NERDTreeToggle<CR>
" autocmd vimenter * NERDTree
let NERDTreeChDirMode=1
let NERDTreeShowBookmarks=1
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
let NERDTreeWinSize=25
let NERDTreeWinPos='left'
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" indentLine
" 缩进指示线
let g:indentLine_char='┆'
let g:indentLine_enabled = 1
" auto-pairs
let g:AutoPairsFlyMode = 1
" nerdcommenter
" map <C-q> <leader>ci <CR>
let g:NERDSpaceDelims = 1
let g:NERDCommentEmptyLines = 1
" autopep8
let g:autopep8_disable_show_diff=1
" vim-easymotion
let g:EasyMotion_smartcase = 1
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
map <Leader><leader>h <Plug>(easymotion-linebackward)
map <Leader><Leader>j <Plug>(easymotion-j)
map <Leader><Leader>k <Plug>(easymotion-k)
map <Leader><leader>l <Plug>(easymotion-lineforward)
" 重复上一次操作, 类似repeat插件, 很强大
map <Leader><leader>. <Plug>(easymotion-repeat)
" YouCompleteMe
let g:ycm_server_python_interpreter='/home/wuxiaolong/tools/miniconda3/bin/python'
let g:ycm_path_to_python_interpreter='/home/wuxiaolong/tools/miniconda3/bin/python'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
" 打开vim时不再询问是否加载ycm_extra_conf.py配置"
let g:ycm_confirm_extra_conf=0
set completeopt=longest,menu
" 是否开启语义补全"
let g:ycm_seed_identifiers_with_syntax=1
" 是否在注释中也开启补全"
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
" 开始补全的字符数"
let g:ycm_min_num_of_chars_for_completion=2
" 补全后自动关机预览窗口
let g:ycm_autoclose_preview_window_after_completion=1
" 禁止缓存匹配项,每次都重新生成匹配项"
let g:ycm_cache_omnifunc=0
" 字符串中也开启补全
let g:ycm_complete_in_strings = 1
""离开插入模式后自动关闭预览窗口
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" 回车即选中当前项
" inoremap <expr> <CR> pumvisible() ? '<C-y>' : '\<CR>'
" 上下左右键行为
inoremap <expr> <Down> pumvisible() ? '\<C-n>' : '\<Down>'
inoremap <expr> <Up> pumvisible() ? '\<C-p>' : '\<Up>'
inoremap <expr> <PageDown> pumvisible() ? '\<PageDown>\<C-p>\<C-n>' : '\<PageDown>'
inoremap <expr> <PageUp> pumvisible() ? '\<PageUp>\<C-p>\<C-n>' : '\<PageUp>'