-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_vimrc
More file actions
176 lines (144 loc) · 4.92 KB
/
Copy pathpython_vimrc
File metadata and controls
176 lines (144 loc) · 4.92 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
set nocompatible " be iMproved, required
filetype off " required
" python pep8风格
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
autocmd FileType python set omnifunc=pythoncomplete#Complete
"折叠
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
"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'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
"" let Vundle manage Vundle, required
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
"折叠
Plugin 'tmhedberg/SimpylFold'
""文件树
Plugin 'scrooloose/nerdtree'
"缩进对齐
Plugin 'Yggdroot/indentLine'
"pep8 F7检查
Plugin 'nvie/vim-flake8'
" 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
" Put your non-Plugin stuff after this line
set laststatus=2 "显示状态栏
"set showtabline=2
"set noshowmode
set t_Co=256 "在windows中用xshell连接打开vim可以显示色彩
"
"airline
""安装字体后必须设置
"let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" tabline中当前buffer两端的分隔字符
let g:airline#extensions#tabline#left_sep = ' '
" tabline中未激活buffer两端的分隔字符
let g:airline#extensions#tabline#left_alt_sep = '|'
" tabline中buffer显示编号
let g:airline#extensions#tabline#buffer_nr_show = 1
"let g:airline#extensions#tabline#formatter = 'default'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" old vim-powerline symbols
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.branch = '⭠'
let g:airline_symbols.readonly = '⭤'
let g:airline_symbols.whitespace = 'Ξ'
let g:airline_symbols.paste = 'ρ'
"let g:airline_symbols.maxlinenr = '㏑'
"
"let g:airline_theme='bubblegum'
"let g:airline_theme='dark'
let g:airline_theme='deus'
"显示折叠后的方法说明
let g:SimpylFold_docstring_preview=1
"
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
"用fj替换esc键
inoremap fj <ESC>
" 简化窗口切换指令
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" 打开新窗口后自动切换到新窗口
set splitbelow
set splitright
"用F1显示或者隐藏对齐线
map <F1> :IndentLinesToggle<CR>
"快捷键文件树
map <F2> :NERDTreeToggle<CR>
"背景dark
set bg=dark
"将键盘上的F4功能键映射为添加作者信息的快捷键
map <F4> ms:call TitleDet()<cr>'s
function AddTitle()
call append(0,"# coding: utf-8")
call append(1,"# ----------------------------------------------")
call append(2,"# author : regan")
call append(3,"# email : x-regan@qq.com")
call append(4,"# create at : ".strftime("%Y-%m-%d %H:%M"))
call append(5,"# last modify : ".strftime("%Y-%m-%d %H:%M"))
call append(6,"# ----------------------------------------------")
call append(7,"")
echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endf
"更新最近修改时间和文件名
function UpdateTitle()
normal m'
execute '/# last modify\s*:/s@:.*$@\=strftime(": %Y-%m-%d %H:%M")@'
normal "
normal m
echohl WarningMsg | echo "Successful in updating the copy right."| echohl None
endfunction
"判断前10行代码里面,是否有Last modified这个单词,
"如果没有的话,代表没有添加过作者信息,需要新添加;
"如果有的话,那么只需要更新即可
function TitleDet()
let n=1
while n < 8
let line = getline(n)
if line =~'^\#\s*\S*last\smodify\S*.*$'
call UpdateTitle()
return
endif
let n = n + 1
endwhile
call AddTitle()
endfunction