aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2024-02-25 13:18:27 +0800
committerWe-unite <3205135446@qq.com>2024-02-25 13:18:27 +0800
commitafa8fcdfd84544356a052ea0673b04fd5018bd41 (patch)
treef00766746a9d339ff67533fdf1fd37c38a5e0e57
parent1a39aa514f86e7f71bd2c7c8251eb376665e109d (diff)
downloadPardon-afa8fcdfd84544356a052ea0673b04fd5018bd41.tar.gz
Pardon-afa8fcdfd84544356a052ea0673b04fd5018bd41.zip
Renew vimrc and md2html.sh
-rwxr-xr-xmypath/md2html.sh4
-rw-r--r--vim/vimrc43
-rw-r--r--vim/vimrcs/codecmd.vim162
-rw-r--r--vim/vimrcs/keybind.vim12
-rw-r--r--vim/vimrcs/match.vim12
-rw-r--r--vim/vimrcs/myset.vim38
-rw-r--r--vim/vimrcs/plugs.vim131
-rw-r--r--vim/vimrcs/statusline.vim81
8 files changed, 233 insertions, 250 deletions
diff --git a/mypath/md2html.sh b/mypath/md2html.sh
index ebebb9a..e71f1d3 100755
--- a/mypath/md2html.sh
+++ b/mypath/md2html.sh
@@ -26,6 +26,6 @@ rm $src
26 26
27sed -i '/<style/,/<\/style>/d' $dst 27sed -i '/<style/,/<\/style>/d' $dst
28sed -i 's/<body>/<body>\n<div class="pandoc">\n<div class="main">/' $dst 28sed -i 's/<body>/<body>\n<div class="pandoc">\n<div class="main">/' $dst
29sed -i 's/<\/body>/<script src="https:\/\/www.qin-juan-ge-zhu.top\/common\/js\/comment.js"><\/script>\n<\/div>\n<\/div>\n<\/body>/' $dst 29sed -i 's/<\/body>/<script src="https:\/\/test.qin-juan-ge-zhu.top\/common\/js\/comment.js"><\/script>\n<\/div>\n<\/div>\n<\/body>/' $dst
30sed -i 's/\t/ /g' $dst 30sed -i 's/\t/ /g' $dst
31sed -i 's/<\/head>/<link rel="stylesheet" href="https:\/\/www.qin-juan-ge-zhu.top\/common\/CSS\/pandoc.css">\n<script type="text\/javascript" src="https:\/\/www.qin-juan-ge-zhu.top\/common\/script4code.js"><\/script><\/head>/' $dst 31sed -i 's/<\/head>/<link rel="stylesheet" href="https:\/\/test.qin-juan-ge-zhu.top\/common\/CSS\/pandoc.css">\n<script type="text/javascript" src="https://test.qin-juan-ge-zhu.top/common/js/myhighlight.js"></script>\n<script type="text\/javascript" src="https:\/\/test.qin-juan-ge-zhu.top\/common\/script4code.js"><\/script><\/head>/' $dst
diff --git a/vim/vimrc b/vim/vimrc
index 0b19922..0ab3a91 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1,29 +1,14 @@
1" Vundle插件管理及插件内容 1set nocompatible " 关闭兼容模式
2if filereadable(expand("/etc/vim/vimrcs/plugs.vim")) 2
3 source /etc/vim/vimrcs/plugs.vim 3let vimrcs = {
4endif 4 \ "plugs": "Vundle插件管理及插件内容",
5 5 \ "statusline": "状态栏与标签页设置",
6" 自行设置 6 \ "codecmd": "代码设置",
7if filereadable(expand("/etc/vim/vimrcs/myset.vim")) 7 \ "keybind": "自己设的快捷键",
8 source /etc/vim/vimrcs/myset.vim 8 \ "match": "符号自动匹配",
9endif 9 \ "myset": "自行设置",
10 10 \ }
11" 符号自动匹配 11
12if filereadable(expand("/etc/vim/vimrcs/match.vim")) 12for vimrc in keys(vimrcs)
13 source /etc/vim/vimrcs/match.vim 13 execute "source /etc/vim/vimrcs/".vimrc.".vim"
14endif 14endfor
15
16" 状态栏与标签页设置
17if filereadable(expand("/etc/vim/vimrcs/statusline.vim"))
18 source /etc/vim/vimrcs/statusline.vim
19endif
20
21" 自己设的快捷键
22if filereadable(expand("/etc/vim/vimrcs/keybind.vim"))
23 source /etc/vim/vimrcs/keybind.vim
24endif
25
26" 代码设置
27if filereadable(expand("/etc/vim/vimrcs/codecmd.vim"))
28 source /etc/vim/vimrcs/codecmd.vim
29endif
diff --git a/vim/vimrcs/codecmd.vim b/vim/vimrcs/codecmd.vim
index 82b0bfe..cbe08bf 100644
--- a/vim/vimrcs/codecmd.vim
+++ b/vim/vimrcs/codecmd.vim
@@ -1,23 +1,17 @@
1set expandtab "设置tab键替换为tabstop规定的空格数 1set expandtab " 设置tab键替换为tabstop规定的空格数
2set tabstop=4 2set tabstop=4
3set shiftwidth=4 "设置tab的间隔 3set shiftwidth=4 " 设置tab的间隔
4set softtabstop=4 4set softtabstop=4
5autocmd FileType asm,nasm,vim set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab 5autocmd FileType asm,nasm,vim,sh,makefile set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
6 6
7set showmatch "在输入括号时光标会短暂地跳到与之相匹配的括号处 7set showmatch " 在输入括号时光标会短暂地跳到与之相匹配的括号处
8set wrap "设置自动折行 8set wrap " 设置自动折行
9set textwidth=500 "设置自动换行的长度 9set textwidth=500 " 设置自动换行的长度
10set lbr 10set lbr
11"set autoindent "设置自动缩进 11set foldmethod=syntax " 设置按语法折叠代码
12"set smartindent "设置智能缩进 12set nofoldenable " 在打开文件时不要折叠
13"set foldmethod=indent "设置按缩进折叠代码
14set foldmethod=syntax "设置按语法折叠代码
15"set foldlevel=99 "折叠层级
16"在打开文件时不要折叠
17set nofoldenable
18 13
19 14" 自动补全配置
20"自动补全配置
21autocmd FileType python set omnifunc=pythoncomplete#Complete 15autocmd FileType python set omnifunc=pythoncomplete#Complete
22autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS 16autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
23autocmd FileType html set omnifunc=htmlcomplete#CompleteTags 17autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
@@ -25,92 +19,92 @@ autocmd FileType css set omnifunc=csscomplete#CompleteCSS
25autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags 19autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
26autocmd FileType php set omnifunc=phpcomplete#CompletePHP 20autocmd FileType php set omnifunc=phpcomplete#CompletePHP
27autocmd FileType c set omnifunc=ccomplete#Complete 21autocmd FileType c set omnifunc=ccomplete#Complete
22
28" 要求格式化之后的代码不要移动光标,并且不要删除换行符和空行,保留原来的视图 23" 要求格式化之后的代码不要移动光标,并且不要删除换行符和空行,保留原来的视图
29autocmd BufReadPost,BufWritePre *.html,*.vim normal! g1G=G`"z<CR> 24autocmd BufReadPost,BufWritePre *.html,*.vim normal! g1G=G`"z<CR>
30" 在保存时自动使用clang-format格式化代码 25" 在保存时自动使用clang-format格式化代码
31augroup FormatAutocmd 26augroup FormatAutocmd
32 autocmd! 27 autocmd!
33 autocmd BufWritePre *.c,*.cpp :normal! ggVG 28 autocmd BufWritePre *.c,*.cpp,*.h :normal! ggVG
34 autocmd BufWritePre *.c,*.cpp :let save_cursor = getpos(".") 29 autocmd BufWritePre *.c,*.cpp,*.h :let save_cursor = getpos(".")
35 autocmd BufWritePre *.c,*.cpp :ClangFormat 30 autocmd BufWritePre *.c,*.cpp,*.h :ClangFormat
36 autocmd BufWritePost *.c,*.cpp :call setpos('.', save_cursor) 31 autocmd BufWritePost *.c,*.cpp,*.h :call setpos('.', save_cursor)
37augroup END 32augroup END
38" 定义ClangFormat命令 33" 定义ClangFormat命令
39command! -nargs=0 ClangFormat :silent %!clang-format -style="{IndentWidth: 4}" 34command! -nargs=0 ClangFormat :silent %!clang-format -style="{IndentWidth: 4}"
40" 映射gg=G到ClangFormat 35" 映射gg=G到ClangFormat
41autocmd FileType c,cpp nnoremap <buffer> gg=G :ClangFormat<CR> 36autocmd FileType c,h,cpp,hpp,cc nnoremap <buffer> gg=G :ClangFormat<CR>
37" cmake使用cmake-format格式化
38autocmd FileType cmake nnoremap <buffer> gg=G :silent !cmake-format % -i<CR><CR>L
42 39
43"新建.c,.h,.sh,.java文件,自动插入文件头 40" 新建.c/.cpp/.sh/.py文件,自动插入文件头
44autocmd BufNewFile *.cpp,*.[ch],*.sh exec ":call SetTitle()" 41autocmd BufNewFile *.cpp,*.[ch],*.sh exec ":call SetTitle()"
45func SetTitle() 42func SetTitle()
46 if &filetype == 'sh' 43 if &filetype == 'sh'
47 call setline(1,"#!/bin/bash") 44 call setline(1,"#!/bin/bash")
48 call append(line("."), "" ) 45 call append(line("."), "" )
49 call append(line(".")+1, "\##########################################################################" ) 46 call append(line(".")+1, "\##########################################################################" )
50 call append(line(".")+2, "\# File Name : ".expand("%")) 47 call append(line(".")+2, "\# File Name : ".expand("%"))
51 call append(line(".")+3, "\# Encoding : utf-8") 48 call append(line(".")+3, "\# Encoding : utf-8")
52 call append(line(".")+4, "\# Author : We-unite") 49 call append(line(".")+4, "\# Author : We-unite")
53 call append(line(".")+5, "\# Email : weunite1848@gmail.com") 50 call append(line(".")+5, "\# Email : weunite1848@gmail.com")
54 call append(line(".")+6, "\# Created Time : ".strftime("%Y-%m-%d",localtime())) 51 call append(line(".")+6, "\# Created Time : ".strftime("%Y-%m-%d %H:%M:%S",localtime()))
55 call append(line(".")+7, "\##########################################################################" ) 52 call append(line(".")+7, "\##########################################################################" )
56 call append(line(".")+8, "") 53 call append(line(".")+8, "")
57 elseif &filetype =='py' 54 elseif &filetype =='py'
58 call setline(1,"#!/usr/bin/env python") 55 call setline(1,"#!/usr/bin/env python")
59 call append(line("."), "" ) 56 call append(line("."), "" )
60 call append(line(".")+1, "\##########################################################################" ) 57 call append(line(".")+1, "\##########################################################################" )
61 call append(line(".")+2, "\# File Name : ".expand("%")) 58 call append(line(".")+2, "\# File Name : ".expand("%"))
62 call append(line(".")+3, "\# Encoding : utf-8") 59 call append(line(".")+3, "\# Encoding : utf-8")
63 call append(line(".")+4, "\# Author : We-unite") 60 call append(line(".")+4, "\# Author : We-unite")
64 call append(line(".")+5, "\# Email : weunite1848@gmail.com") 61 call append(line(".")+5, "\# Email : weunite1848@gmail.com")
65 call append(line(".")+6, "\# Created Time : ".strftime("%Y-%m-%d",localtime())) 62 call append(line(".")+6, "\# Created Time : ".strftime("%Y-%m-%d %H:%M:%S",localtime()))
66 call append(line(".")+7, "\##########################################################################" ) 63 call append(line(".")+7, "\##########################################################################" )
67 call append(line(".")+8, "") 64 call append(line(".")+8, "")
68 else 65 else
69 call setline(1, "/*************************************************************************") 66 call setline(1, "/*************************************************************************")
70 call append(line("."), " > File Name : ".expand("%")) 67 call append(line("."), " > File Name : ".expand("%"))
71 call append(line(".")+1, " > Encoding : utf-8") 68 call append(line(".")+1, " > Encoding : utf-8")
72 call append(line(".")+2, " > Author : We-unite") 69 call append(line(".")+2, " > Author : We-unite")
73 call append(line(".")+3, " > Email : weunite1848@gmail.com ") 70 call append(line(".")+3, " > Email : weunite1848@gmail.com ")
74 call append(line(".")+4, " > Created Time : ".strftime("%Y-%m-%d %H:%M:%S",localtime())) 71 call append(line(".")+4, " > Created Time : ".strftime("%Y-%m-%d %H:%M:%S",localtime()))
75 call append(line(".")+5, " ************************************************************************/") 72 call append(line(".")+5, " ************************************************************************/")
76 call append(line(".")+6, "") 73 call append(line(".")+6, "")
77 if &filetype == 'cpp' 74 if &filetype == 'cpp'
78 call append(line(".")+7, "#include <iostream>") 75 call append(line(".")+7, "#include <iostream>")
79 call append(line(".")+8, "using namespace std;") 76 call append(line(".")+8, "using namespace std;")
80 call append(line(".")+9, "") 77 call append(line(".")+9, "")
81 elseif &filetype == 'c' 78 elseif &filetype == 'c'
82 call append(line(".")+7, "#include <stdio.h>") 79 call append(line(".")+7, "#include <stdio.h>")
83 call append(line(".")+8, "#include <stdlib.h>") 80 call append(line(".")+8, "#include <stdlib.h>")
84 call append(line(".")+9, "") 81 call append(line(".")+9, "")
85 endif 82 endif
86 endif 83 endif
87 " 光标移动到文件末尾 84 " 光标移动到文件末尾
88 normal G 85 normal G
89endfunc 86endfunc
90 87
91"C,C++编译运行 88" C,C++编译运行
92map <leader>r :call CompileRunGcc()<CR> 89map <leader>r :call CompileRunGcc()<CR>
93func CompileRunGcc() 90func CompileRunGcc()
94 exec "w" 91 exec "w"
95 if &filetype == 'c' 92 if &filetype == 'c'
96 exec "!gcc -g -o %< %" 93 exec "!gcc -g -o %< %"
97 exec "! ./%<" 94 exec "! ./%<"
98 elseif &filetype == 'cpp' 95 elseif &filetype == 'cpp'
99 exec "!g++ -g -o %< %" 96 exec "!g++ -g -o %< %"
100 exec "! ./%<" 97 exec "! ./%<"
101 "elseif &filetype == 'java' 98 elseif &filetype == 'sh'
102 " exec "!javac %" 99 :!./%
103 " exec "!java %<" 100 elseif &filetype == 'python'
104 elseif &filetype == 'sh' 101 exec "!python %"
105 :!./% 102 endif
106 elseif &filetype == 'python'
107 exec "!python %"
108 endif
109endfunc 103endfunc
110 104
111"C,C++调试 105" C,C++调试
112map <leader>d :call RunGdb()<CR> 106map <leader>d :call RunGdb()<CR>
113func RunGdb() 107func RunGdb()
114 exec "w" 108 exec "w"
115 exec "!gdb ./%<" 109 exec "!gdb ./%<"
116endfunc 110endfunc
diff --git a/vim/vimrcs/keybind.vim b/vim/vimrcs/keybind.vim
index 270cd96..123c82d 100644
--- a/vim/vimrcs/keybind.vim
+++ b/vim/vimrcs/keybind.vim
@@ -6,11 +6,11 @@ map L $
6nmap <leader>c <c-w><c-o> "关闭除当前窗口的所有页面 6nmap <leader>c <c-w><c-o> "关闭除当前窗口的所有页面
7nmap <c-s> :w !sudo tee %<cr>L<cr> 7nmap <c-s> :w !sudo tee %<cr>L<cr>
8nmap <leader>p <c-x><c-f> "补全路径 8nmap <leader>p <c-x><c-f> "补全路径
9"nmap <C-tab> :tabn<CR> 9" nmap <C-tab> :tabn<CR>
10nmap <tab> :tabp<CR> 10nmap <tab> :tabp<CR>
11"nmap <alt-tab> :tabnew<CR> 11" nmap <alt-tab> :tabnew<CR>
12"map <space>= <buffer><esc>:vertical resize +5<cr> 12" map <space>= <buffer><esc>:vertical resize +5<cr>
13"map <space>- <esc>:vertical resize -5<cr> 13" map <space>- <esc>:vertical resize -5<cr>
14 14
15nnoremap <M-1> 1gt 15nnoremap <M-1> 1gt
16nnoremap <M-2> 2gt 16nnoremap <M-2> 2gt
@@ -23,12 +23,12 @@ nnoremap <M-8> 8gt
23nnoremap <M-9> 9gt 23nnoremap <M-9> 9gt
24nnoremap <M-0> :tablast<CR> 24nnoremap <M-0> :tablast<CR>
25 25
26"光标在页面间切换 26" 光标在页面间切换
27nnoremap <space>h <C-w><C-h> 27nnoremap <space>h <C-w><C-h>
28nnoremap <space>j <C-w><C-j> 28nnoremap <space>j <C-w><C-j>
29nnoremap <space>k <C-w><C-k> 29nnoremap <space>k <C-w><C-k>
30nnoremap <space>l <C-w><C-l> 30nnoremap <space>l <C-w><C-l>
31 31
32"复制粘贴 32" 复制粘贴
33vnoremap <C-y> "+y 33vnoremap <C-y> "+y
34nnoremap <C-p> "+p 34nnoremap <C-p> "+p
diff --git a/vim/vimrcs/match.vim b/vim/vimrcs/match.vim
index b01f35d..0b2c19b 100644
--- a/vim/vimrcs/match.vim
+++ b/vim/vimrcs/match.vim
@@ -1,4 +1,4 @@
1"各类符号自动匹配 1" 各类符号自动匹配
2inoremap { {<CR>}<ESC>O 2inoremap { {<CR>}<ESC>O
3" :inoremap { {}<ESC>i 3" :inoremap { {}<ESC>i
4" :inoremap } <c-r>=ClosePair('}')<CR> 4" :inoremap } <c-r>=ClosePair('}')<CR>
@@ -10,9 +10,9 @@ inoremap { {<CR>}<ESC>O
10:inoremap ' ''<ESC>i 10:inoremap ' ''<ESC>i
11 11
12function ClosePair(char) 12function ClosePair(char)
13 if getline('.')[col('.') - 1] == a:char 13 if getline('.')[col('.') - 1] == a:char
14 return "<Right>" 14 return "<Right>"
15 else 15 else
16 return a:char 16 return a:char
17 endif 17 endif
18endfunction 18endfunction
diff --git a/vim/vimrcs/myset.vim b/vim/vimrcs/myset.vim
index 1664ddb..45253d4 100644
--- a/vim/vimrcs/myset.vim
+++ b/vim/vimrcs/myset.vim
@@ -1,26 +1,26 @@
1"set guifont=Monospace 1" set guifont=Monospace
2set guifont=:b:h16 2set guifont=:b:h16
3set encoding=utf-8 3set encoding=utf-8
4set fileencoding=utf-8 4set fileencoding=utf-8
5set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1 5set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1
6set fileformat=unix 6set fileformat=unix
7set helplang=cn "帮助中文支持 7set helplang=cn " 帮助中文支持
8set mouse=a " 设置鼠标 8set mouse=a " 设置鼠标
9set noeb " 去掉输入错误的提示声音 9set noeb " 去掉输入错误的提示声音
10set confirm " 在处理未保存或只读文件的时候,弹出确认 10set confirm " 在处理未保存或只读文件的时候,弹出确认
11set langmenu=zh_CN.UTF-8 11set langmenu=zh_CN.UTF-8
12set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 12set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
13 13
14set rnu "设置相对行号 14set rnu " 设置相对行号
15set nu "设置绝对行号 15set nu " 设置绝对行号
16" Set cursor shape and color 16" Set cursor shape and color
17if &term =~ "xterm" 17if &term =~ "xterm"
18 " INSERT mode 18 " INSERT mode
19 let &t_SI = "\<Esc>[6 q" . "\<Esc>]12;blue\x7" 19 let &t_SI = "\<Esc>[6 q" . "\<Esc>]12;blue\x7"
20 " REPLACE mode 20 " REPLACE mode
21 let &t_SR = "\<Esc>[3 q" . "\<Esc>]12;black\x7" 21 let &t_SR = "\<Esc>[3 q" . "\<Esc>]12;black\x7"
22 " NORMAL mode 22 " NORMAL mode
23 let &t_EI = "\<Esc>[2 q" . "\<Esc>]12;green\x7" 23 let &t_EI = "\<Esc>[2 q" . "\<Esc>]12;green\x7"
24endif 24endif
25" 1 -> blinking block 闪烁的方块 25" 1 -> blinking block 闪烁的方块
26" 2 -> solid block 不闪烁的方块 26" 2 -> solid block 不闪烁的方块
@@ -32,8 +32,8 @@ endif
32syntax on 32syntax on
33set cul 33set cul
34set cuc 34set cuc
35hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white 35set list " 显示tab和空格
36colorscheme industry "设置颜色主 36set listchars=tab:>-,trail:- " 设置tab和空格的
37set list "tab和空格 37colorscheme industry " 颜色主题
38set listchars=tab:>-,trail:- "设置tab和空格的显示 38autocmd VimEnter * hi CursorLine cterm=NONE ctermbg=darkblue ctermfg=NONE guibg=darkblue guifg=NONE
39hi SpecialKey ctermfg=red guifg=red 39autocmd VimEnter * hi CursorColumn cterm=NONE ctermbg=darkblue ctermfg=NONE guibg=darkblue guifg=NONE
diff --git a/vim/vimrcs/plugs.vim b/vim/vimrcs/plugs.vim
index 4606f3d..d71b846 100644
--- a/vim/vimrcs/plugs.vim
+++ b/vim/vimrcs/plugs.vim
@@ -1,32 +1,33 @@
1" Vundle插件管理器配置 1" Vundle插件管理器配置
2set nocompatible "去除VIM一致性,必须 2set nocompatible " 去除VIM一致性,必须
3filetype off "必须 3filetype off " 必须
4 4
5"设置包括vundle和初始化相关的运行时路径" 5" 设置包括vundle和初始化相关的运行时路径"
6set rtp+=/home/player/useful/bundle/Vundle.vim 6set rtp+=/home/player/useful/bundle/Vundle.vim
7call vundle#begin('/home/player/useful/bundle') 7call vundle#begin('/home/player/useful/bundle')
8 8
9Plugin 'VundleVim/Vundle.vim' "启用vundle管理插件,必须 9Plugin 'VundleVim/Vundle.vim' " 启用vundle管理插件,必须
10Plugin 'Valloric/YouCompleteMe' "代码补全插件 10Plugin 'Valloric/YouCompleteMe' " 代码补全插件
11Plugin 'preservim/nerdtree' "文件目录树插件 11Plugin 'preservim/nerdtree' " 文件目录树插件
12Plugin 'Xuyuanp/nerdtree-git-plugin' "nerdtree git支持 12Plugin 'Xuyuanp/nerdtree-git-plugin' " nerdtree git支持
13Plugin 'skywind3000/vim-terminal-help' "vim-terminal-help插件 13Plugin 'skywind3000/vim-terminal-help' " vim-terminal-help插件
14Plugin 'scrooloose/syntastic' "语法检查插件 14Plugin 'scrooloose/syntastic' " 语法检查插件
15"Plugin 'Lokaltog/powerline',{'rtp':'powerline/bindings/vim/'} "状态栏信息插件 15Plugin 'github/copilot.vim' " GitHub Copilot插件
16Plugin 'github/copilot.vim' "GitHub Copilot插件 16Plugin 'voldikss/vim-translator' " 翻译插件
17Plugin 'voldikss/vim-translator' "翻译插件 17Plugin 'yegappan/taglist' " taglist插件
18Plugin 'yegappan/taglist' "taglist插件 18" Plugin 'Lokaltog/powerline',{'rtp':'powerline/bindings/vim/'} " 状态栏信息插件
19" Plugin 'neoclide/coc.nvim' " coc.nvim插件
19 20
20call vundle#end() 21call vundle#end()
21filetype plugin indent on "加载vim自带和插件相应的语法和文件类型相关脚本,必须 22filetype plugin indent on " 加载vim自带和插件相应的语法和文件类型相关脚本,必须
22 23
23" YouCompleteMe 24" YouCompleteMe
24let g:ycm_global_ycm_extra_conf='/home/player/useful/bundle/YouCompleteMe/.ycm_extra_conf.py' 25let g:ycm_global_ycm_extra_conf='/home/player/useful/bundle/YouCompleteMe/.ycm_extra_conf.py'
25let g:ycm_key_invoke_completion = '<C-c>' 26let g:ycm_key_invoke_completion = '<C-c>'
26let g:ycm_semantic_triggers = { 27let g:ycm_semantic_triggers = {
27 \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'], 28 \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
28 \ 'cs,lua,javascript': ['re!\w{2}'], 29 \ 'cs,lua,javascript': ['re!\w{2}'],
29 \ } 30 \ }
30highlight PMenu ctermfg=34 ctermbg=21 guifg=darkred guibg=darkblue 31highlight PMenu ctermfg=34 ctermbg=21 guifg=darkred guibg=darkblue
31highlight PMenuSel ctermfg=21 ctermbg=34 guifg=darkblue guibg=darkred 32highlight PMenuSel ctermfg=21 ctermbg=34 guifg=darkblue guibg=darkred
32let g:ycm_autoclose_preview_window_after_completion=1 33let g:ycm_autoclose_preview_window_after_completion=1
@@ -36,69 +37,71 @@ nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
36nnoremap <leader>gr :YcmCompleter GoToReferences<CR> 37nnoremap <leader>gr :YcmCompleter GoToReferences<CR>
37let g:ycm_min_num_of_chars_for_completion=3 38let g:ycm_min_num_of_chars_for_completion=3
38 39
39"NERDTree 40" NERDTree
40"autocmd vimenter * NERDTree "进入vim自动打开nerdtree 41" autocmd vimenter * NERDTree "进入vim自动打开nerdtree
41"当nerdtree为当前标签页剩余唯一窗口时自动关闭 42" 当nerdtree为当前标签页剩余唯一窗口时自动关闭
42autocmd bufenter * if(winnr('$') ==1 && exists('b:NERDTree') && b:NERDTree.isTabTree()) | quit | endif 43autocmd bufenter * if(winnr('$') ==1 && exists('b:NERDTree') && b:NERDTree.isTabTree()) | quit | endif
43"F2键开关文件目录树,注意shift+i切换是否显示隐藏文件 44" F2键开关文件目录树,注意shift+i切换是否显示隐藏文件
44nmap <F2> :NERDTreeToggle<CR> 45nmap <F2> :NERDTreeToggle<CR>
45nmap T :NERDTreeToggle<CR> 46nmap T :NERDTreeToggle<CR>
46let g:NERDTreeDirArrowExpandable = '+' 47let g:NERDTreeDirArrowExpandable = '+'
47let g:NERDTreeDirArrowCollapsible = '-' "修改树的显示图标 48let g:NERDTreeDirArrowCollapsible = '-' " 修改树的显示图标
48let g:NERDTreeWinPos='left' "窗口位置 49let g:NERDTreeWinPos='left' " 窗口位置
49let g:NERDTreeSize=10 "窗口尺寸 50let g:NERDTreeSize=10 " 窗口尺寸
50let g:NERDTreeShowLineNumbers=1 "窗口是否显示行号 51let g:NERDTreeShowLineNumbers=1 " 窗口是否显示行号
51let NERDTreeShowHidden=1 "显示隐藏文件 52let NERDTreeShowHidden=1 " 显示隐藏文件
52let NERDTreeIgnore = ['\.pyc$', '\.swp', '\.swo', '\.vscode', '__pycache__'] "过滤: 所有指定文件和文件夹不显示 53let NERDTreeIgnore = ['\.pyc$', '\.swp', '\.swo', '\.vscode', '__pycache__'] " 过滤: 所有指定文件和文件夹不显示
53autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif "在每个标签页打开相同的文件树 54autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif " 在每个标签页打开相同的文件树
54 55
55 56
56"nerdtree-git-plugin 57" nerdtree-git-plugin
57let g:NERDTreeGitStatusIndicatorMapCustom = { 58let g:NERDTreeGitStatusIndicatorMapCustom = {
58 \ 'Dirty' :'Dty', 59 \ 'Dirty' :'Dty',
59 \ 'Modified' :'M', 60 \ 'Modified' :'M',
60 \ 'Staged' :'Sta', 61 \ 'Staged' :'Sta',
61 \ 'Untracked' :'U', 62 \ 'Untracked' :'U',
62 \ 'Renamed' :'R', 63 \ 'Renamed' :'R',
63 \ 'Unmerged' :'Umg', 64 \ 'Unmerged' :'Umg',
64 \ 'Deleted' :'X', 65 \ 'Deleted' :'X',
65 \ 'Ignored' :'Ign', 66 \ 'Ignored' :'Ign',
66 \ 'Clean' :'Cl', 67 \ 'Clean' :'Cl',
67 \ 'Unknown' :'?', 68 \ 'Unknown' :'?',
68 \ } 69 \ }
69let g:NERDTreeGitStatusShowIgnored = 1 "a heavy feature may cost much more time. default: 0 70let g:NERDTreeGitStatusShowIgnored = 1 " a heavy feature may cost much more time. default: 0
70let g:NERDTreeGitStatusUntrackedFilesMode = 'all' "a heavy feature too. default: normal 71let g:NERDTreeGitStatusUntrackedFilesMode = 'all' " a heavy feature too. default: normal
71 72
72"vim-terminal-help 73" vim-terminal-help
73"set termwinsize=10*106 74" set termwinsize=10*106
74"let g:terminal_key = '' 75" let g:terminal_key = ''
75"设置光标在终端与编辑器间切换的快捷键 76" 设置光标在终端与编辑器间切换的快捷键
76 77
77"syntastic 78" syntastic
78"YouCompleteMe插件对该插件支持过于优秀,一般不再需要配置,故废弃 79" YouCompleteMe插件对该插件支持过于优秀,一般不再需要配置,故废弃
79let g:syntastic_python_checkers=['pylint'] 80let g:syntastic_python_checkers=['pylint']
80let g:syntastic_python_pylint_args=['--disable=C0111,R0903,C0301'] 81let g:syntastic_python_pylint_args=['--disable=C0111,R0903,C0301']
81"GNU as汇编语言语法检查,需要安装as86和ld86 82" GNU as汇编语言语法检查,需要安装as86和ld86
82let g:syntastic_asm_checkers=['as86'] 83let g:syntastic_asm_checkers=['as86']
83"" syntastic end 84" syntastic end
84 85
85" powerline 86" powerline
86let laststatus=2 87let laststatus=2
87let g:airlinr_powerline_fonts=1 "使用官方打过补丁的字体 88let g:airlinr_powerline_fonts=1 " 使用官方打过补丁的字体
88let g:Powerline_symbols='fancy' 89let g:Powerline_symbols='fancy'
89 90
90"vim-translator 91" vim-translator
91let g:translator_target_lang = 'zh' 92let g:translator_target_lang = 'zh'
92let g:translator_source_lang = 'auto' 93let g:translator_source_lang = 'auto'
93let g:translator_default_engines = ['youdao', 'bing', 'haici'] 94let g:translator_default_engines = ['google', 'youdao', 'bing', 'haici']
94let g:translator_history_enable = v:true 95let g:translator_history_enable = v:true
95let g:translator_window_type = 'popup' "可选值为 'popup' 和 'preview',默认为 'popup' 96let g:translator_window_type = 'popup' " 可选值为 'popup' 和 'preview',默认为 'popup'
96" Echo translation in the cmdline 97" Echo translation in the cmdline
97nmap <silent> <Leader>t <Plug>Translate 98nmap <silent> <Leader>t <Plug>Translate
98vmap <silent> <Leader>t <Plug>TranslateV 99vmap <silent> <Leader>t <Plug>TranslateV
99" Display translation in a window 100" Display translation in a window
100nmap <silent> <Leader>w <Plug>TranslateW 101nmap <silent> <Leader>w <Plug>TranslateW
101vmap <silent> <Leader>w <Plug>TranslateWV 102vmap <silent> <Leader>w <Plug>TranslateWV
103" Close the translation window
104nmap <silent> <Leader>c <Plug>TranslateC
102" Replace the text with translation 105" Replace the text with translation
103nmap <silent> <Leader>r <Plug>TranslateR 106nmap <silent> <Leader>r <Plug>TranslateR
104vmap <silent> <Leader>r <Plug>TranslateRV 107vmap <silent> <Leader>r <Plug>TranslateRV
@@ -106,17 +109,17 @@ vmap <silent> <Leader>r <Plug>TranslateRV
106nmap <silent> <Leader>x <Plug>TranslateX 109nmap <silent> <Leader>x <Plug>TranslateX
107 110
108 111
109"进行Taglist的设置 112" 进行Taglist的设置
110map <F3> :TlistToggle<CR> 113map <F3> :TlistToggle<CR>
111map <F3> :silent Tlist<CR> " 按下F3就可以呼出了 114map <F3> :silent Tlist<CR> " 按下F3就可以呼出了
112map <space>tl :silent Tlist<CR> " 按下F3就可以呼出了 115map <space>tl :silent Tlist<CR> " 按下<space>tl就可以呼出了
113let Tlist_Ctags_Cmd='/usr/local/bin/ctags' "因为我们放在环境变量里,所以可以直接执行 116let Tlist_Ctags_Cmd='/usr/local/bin/ctags' " 因为我们放在环境变量里,所以可以直接执行
114let Tlist_Use_Right_Window=1 "让窗口显示在右边,0的话就是显示在左边 117let Tlist_Use_Right_Window=1 " 让窗口显示在右边,0的话就是显示在左边
115let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表 118let Tlist_Show_One_File=0 " 让taglist可以同时展示多个文件的函数列表
116let Tlist_File_Fold_Auto_Close=0 "非当前文件列表折叠隐藏 119let Tlist_File_Fold_Auto_Close=0 " 非当前文件列表折叠隐藏
117let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动推出vim 120let Tlist_Exit_OnlyWindow=1 " 当taglist是最后一个分割窗口时,自动推出vim
118let Tlist_Process_File_Always=1 "是否一直处理tags.1:处理;0:不处理 121let Tlist_Process_File_Always=1 " 是否一直处理tags.1:处理;0:不处理
119let Tlist_Inc_Winwidth=1 "不是一直实时更新tags,因为没有必要 122let Tlist_Inc_Winwidth=1 " 不是一直实时更新tags,因为没有必要
120" 每隔多少秒更新一次tags,如果为0则不更新 123" 每隔多少秒更新一次tags,如果为0则不更新
121let Tlist_Update_Time=5 124let Tlist_Update_Time=5
122" 在每个标签页打开相同的函数列表 125" 在每个标签页打开相同的函数列表
diff --git a/vim/vimrcs/statusline.vim b/vim/vimrcs/statusline.vim
index 7bdee34..6bf42ed 100644
--- a/vim/vimrcs/statusline.vim
+++ b/vim/vimrcs/statusline.vim
@@ -1,64 +1,65 @@
1set guitablabel=%{ShortTabLabel()} 1set guitablabel=%{ShortTabLabel()}
2function ShortTabLabel () 2function ShortTabLabel ()
3 let bufnrlist = tabpagebuflist (v:lnum) 3 let bufnrlist = tabpagebuflist (v:lnum)
4 let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1]) 4 let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1])
5 let filename = fnamemodify (label, ':t') 5 let filename = fnamemodify (label, ':t')
6 return filename 6 return filename
7endfunction 7endfunction
8 8
9set tabline=%!MyTabLine() 9set tabline=%!MyTabLine()
10function MyTabLine() 10function MyTabLine()
11 let s = '' 11 let s = ''
12 for i in range(tabpagenr('$')) 12 for i in range(tabpagenr('$'))
13 " 选择高亮 13 " 选择高亮
14 if i + 1 == tabpagenr() 14 if i + 1 == tabpagenr()
15 let s .= '%#TabLineSel#' 15 let s .= '%#TabLineSel#'
16 else 16 else
17 let s .= '%#TabLine#' 17 let s .= '%#TabLine#'
18 endif 18 endif
19 " 设置标签页号 (用于鼠标点击) 19 " 设置标签页号 (用于鼠标点击)
20 let s .= '%' . (i + 1) . 'T' 20 let s .= '%' . (i + 1) . 'T'
21 " MyTabLabel() 提供完整路径标签 MyShortTabLabel 提供文件名标签 21 " MyTabLabel() 提供完整路径标签 MyShortTabLabel 提供文件名标签
22 let s .= ' %{MyShortTabLabel(' . (i + 1) . ')} ' 22 let s .= ' %{MyShortTabLabel(' . (i + 1) . ')} '
23 endfor 23 endfor
24 " 最后一个标签页之后用 TabLineFill 填充并复位标签页号 24 " 最后一个标签页之后用 TabLineFill 填充并复位标签页号
25 let s .= '%#TabLineFill#%T' 25 let s .= '%#TabLineFill#%T'
26 " 右对齐用于关闭当前标签页的标签 26 " 右对齐用于关闭当前标签页的标签
27 if tabpagenr('$') > 1 27 if tabpagenr('$') > 1
28 let s .= '%=%#TabLine#%999Xclose' 28 let s .= '%=%#TabLine#%999Xclose'
29 endif 29 endif
30 return s 30 return s
31endfunction 31endfunction
32
32" 文件名标签 33" 文件名标签
33function MyShortTabLabel(n) 34function MyShortTabLabel(n)
34 let buflist = tabpagebuflist(a:n) 35 let buflist = tabpagebuflist(a:n)
35 let label = bufname (buflist[tabpagewinnr (a:n) -1]) 36 let label = bufname (buflist[tabpagewinnr (a:n) -1])
36 let filename = fnamemodify (label, ':t') 37 let filename = fnamemodify (label, ':t')
37 return filename 38 return filename
38endfunction 39endfunction
39"完整路径标签 40" 完整路径标签
40function MyTabLabel(n) 41function MyTabLabel(n)
41 let buflist = tabpagebuflist(a:n) 42 let buflist = tabpagebuflist(a:n)
42 let winnr = tabpagewinnr(a:n) 43 let winnr = tabpagewinnr(a:n)
43 return bufname(buflist[winnr - 1]) 44 return bufname(buflist[winnr - 1])
44endfunction 45endfunction
45 46
46" 状态栏显示git分支函数 47" 状态栏显示git分支
47function! GitBranch() 48function! GitBranch()
48 " 获取当前所在分支名,注意不要保留开头的*和行末的空符号 49 " 获取当前所在分支名,注意不要保留开头的*和行末的空符号
49 let s:branch = system("git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \\(.*\\)/\\1/' | tr -d '\n' | tr -d ' '") 50 let s:branch = system("git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \\(.*\\)/\\1/' | tr -d '\n' | tr -d ' '")
50 return strlen(s:branch) ? 'b: '.s:branch.'> ' : '' 51 return strlen(s:branch) ? 'b: '.s:branch.'> ' : ''
51endfunction 52endfunction
52 53
53set laststatus=2 "显示状态栏(默认值为 1,无法显示状态栏) 54set laststatus=2 " 显示状态栏(默认值为 1,无法显示状态栏)
54set statusline=%f%m%r%h%w\ >\ %{GitBranch()}%=\ <\ %{&ff},\ %{&fenc}\ <\ %y\ <\ %l,%v\ <\ %p%%\ <\ lines=%L 55set statusline=%f%m%r%h%w\ >\ %{GitBranch()}%=\ <\ %{&ff},\ %{&fenc}\ <\ %y\ <\ %l,%v\ <\ %p%%\ <\ lines=%L
55 56
56function! CurDir() 57function! CurDir()
57 let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g") 58 let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
58 return curdir 59 return curdir
59endfunction 60endfunction
60 61
61"标签样式 62" 标签样式
62" TabLineFill tab pages line, where there are no labels 63" TabLineFill tab pages line, where there are no labels
63hi TabLineFill term=none 64hi TabLineFill term=none
64hi TabLineFill ctermfg=DarkGrey 65hi TabLineFill ctermfg=DarkGrey