Skip to content

Commit b27c7d8

Browse files
committed
add vader test
1 parent 0ec7b87 commit b27c7d8

File tree

12 files changed

+39
-15
lines changed

12 files changed

+39
-15
lines changed

root/.vim/after/ftplugin/cpp.vim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
if exists('g:coc_global_extensions')
2-
let g:coc_global_extensions += ['coc-clangd']
3-
endif
1+
call UpdateCocExtensions('coc-clangd')

root/.vim/after/ftplugin/python.vim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
if exists('g:coc_global_extensions')
2-
let g:coc_global_extensions += ['coc-pyright']
3-
endif
1+
call UpdateCocExtensions('coc-pyright')

root/.vim/after/ftplugin/rust.vim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
if exists('g:coc_global_extensions')
2-
let g:coc_global_extensions += ['coc-rust-analyzer']
3-
endif
1+
call UpdateCocExtensions('coc-rust-analyzer')

root/.vim/after/ftplugin/tex.vim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
if exists('g:coc_global_extensions')
2-
let g:coc_global_extensions += ['coc-vimtex']
3-
endif
1+
call UpdateCocExtensions('coc-vimtex')

root/.vim/doc/mydoc.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
===============================================================================
66

7+
*Neovim和vim使用同样的插件* .config/nvim/init.vim中`let g:nvim_compatibility_with_vim = 1`
78
*fold*
89

910
https://vim.fandom.com/wiki/Folding
@@ -138,7 +139,7 @@ CTRL-SHIFT-V paste
138139
*git回退版本* git reset --soft 需要回退的commit hash
139140
*git先暂存自己的修改,再pull别人的提交* 1) git stash 2) git pull 3) git pop
140141
*git复制某一分支* git remote set-url
141-
*git合并commit* git reset
142+
*git合并commit* 方法1) git reset 方法2) git rebase -i HEAD~2
142143
*git从历史提交中永久删除文件* git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch root/.vim/doc/tags-cn' --prune-empty --tag-name-filter cat -- --all
143144

144145
-------------------------------------------------------------------------------

root/.vim/doc/palette.cnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*cd当前文件所在目录* :cd %:h
12
*搜索当前buffer的LSP-symbol-outline(nvim)* :Telescope lsp_document_symbols
23
*显示当前buffer的LSP-symbol-outline(nvim)* :SymbolsOutline
34
*搜索当前buffer的LSP-symbol-outline(vim)* :CocList outline

root/.vim/doc/unused.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Awesome Plugins/Scripts~
44
=======================================================================================
55

6+
*vim-test* https://github.com/vim-test/vim-test Vim多语言单元测试插件
7+
68
*glepnir/dashboard-nvim* neovim's dashboard plugin
79
*mhinz/vim-startify* beautify dashboard, see >
810
git show v0.2.1:root/vimrc.d/startify.vim

root/.vimrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ if s:has_vimrcd
314314
source ~/vimrc.d/plugin.vim
315315
endif
316316

317+
function UpdateCocExtensions(ext)
318+
if exists('g:coc_global_extensions')
319+
let g:coc_global_extensions = g:coc_initial_global_extensions + [a:ext]
320+
endif
321+
endfunction
322+
317323
if !exists("g:plugs") || !has_key(g:plugs, 'coc.nvim')
318324
" https://zhuanlan.zhihu.com/p/106309525
319325
if has("autocmd") && exists("+omnifunc")
@@ -342,7 +348,7 @@ endif
342348
set laststatus=2
343349
if !has('nvim') || g:nvim_compatibility_with_vim == 1
344350
set statusline=%1*%F%m%r%h%w\
345-
let git_branch = system("git rev-parse --abbrev-ref HEAD")
351+
let git_branch = system("git rev-parse --abbrev-ref HEAD 2> /dev/null")
346352
exe "set statusline +=" . git_branch
347353
if exists("g:plugs") && has_key(g:plugs, 'coc.nvim')
348354
function CocStatusLine()

root/vimrc.d/coc.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ augroup END
2424
"
2525
" clangd:
2626
" 可以使用coc.nvim自带的支持(:CocConfig添加languageserver配置),也可以下载coc-clangd插件(clangd.enabled: true),两者不能同时使用
27-
let g:coc_global_extensions = ['coc-ultisnips', 'coc-json']
27+
let g:coc_initial_global_extensions = ['coc-ultisnips', 'coc-json']
28+
let g:coc_global_extensions = g:coc_initial_global_extensions
2829
let g:coc_filetype_map = {'tex': 'latex'}
2930
let g:coc_data_home = '~/.vim/coc'
3031
" Make <CR> auto-select the first completion item and notify coc.nvim t:

root/vimrc.d/plugin.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ endfunction
1515
" - Avoid using standard Vim directory names like 'plugin'
1616
call plug#begin('~/.vim/plugged')
1717

18+
" Test framework
19+
Plug 'junegunn/vader.vim'
20+
1821
" Plug 'LunarWatcher/auto-pairs'
1922
" let g:AutoPairsMapBS = 1
2023

run_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
vim -c 'Vader! test/*' > /dev/null
3+
nvim -c 'Vader! test/*' > /dev/null

test/coc_extension.vader

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Given cpp:
2+
Execute:
3+
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-clangd'], g:coc_global_extensions
4+
5+
Given rust:
6+
Execute:
7+
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-rust-analyzer'], g:coc_global_extensions
8+
9+
Given python:
10+
Execute:
11+
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-pyright'], g:coc_global_extensions
12+
13+
Given tex:
14+
Execute:
15+
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-vimtex'], g:coc_global_extensions

0 commit comments

Comments
 (0)