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