Skip to content

Commit

Permalink
add vader test
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Mar 15, 2023
1 parent 0ec7b87 commit b27c7d8
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 15 deletions.
4 changes: 1 addition & 3 deletions root/.vim/after/ftplugin/cpp.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
if exists('g:coc_global_extensions')
let g:coc_global_extensions += ['coc-clangd']
endif
call UpdateCocExtensions('coc-clangd')
4 changes: 1 addition & 3 deletions root/.vim/after/ftplugin/python.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
if exists('g:coc_global_extensions')
let g:coc_global_extensions += ['coc-pyright']
endif
call UpdateCocExtensions('coc-pyright')
4 changes: 1 addition & 3 deletions root/.vim/after/ftplugin/rust.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
if exists('g:coc_global_extensions')
let g:coc_global_extensions += ['coc-rust-analyzer']
endif
call UpdateCocExtensions('coc-rust-analyzer')
4 changes: 1 addition & 3 deletions root/.vim/after/ftplugin/tex.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
if exists('g:coc_global_extensions')
let g:coc_global_extensions += ['coc-vimtex']
endif
call UpdateCocExtensions('coc-vimtex')
3 changes: 2 additions & 1 deletion root/.vim/doc/mydoc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

===============================================================================

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

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

-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions root/.vim/doc/palette.cnx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*cd当前文件所在目录* :cd %:h
*搜索当前buffer的LSP-symbol-outline(nvim)* :Telescope lsp_document_symbols
*显示当前buffer的LSP-symbol-outline(nvim)* :SymbolsOutline
*搜索当前buffer的LSP-symbol-outline(vim)* :CocList outline
Expand Down
2 changes: 2 additions & 0 deletions root/.vim/doc/unused.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Awesome Plugins/Scripts~
=======================================================================================

*vim-test* https://github.com/vim-test/vim-test Vim多语言单元测试插件

*glepnir/dashboard-nvim* neovim's dashboard plugin
*mhinz/vim-startify* beautify dashboard, see >
git show v0.2.1:root/vimrc.d/startify.vim
Expand Down
8 changes: 7 additions & 1 deletion root/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ if s:has_vimrcd
source ~/vimrc.d/plugin.vim
endif

function UpdateCocExtensions(ext)
if exists('g:coc_global_extensions')
let g:coc_global_extensions = g:coc_initial_global_extensions + [a:ext]
endif
endfunction

if !exists("g:plugs") || !has_key(g:plugs, 'coc.nvim')
" https://zhuanlan.zhihu.com/p/106309525
if has("autocmd") && exists("+omnifunc")
Expand Down Expand Up @@ -342,7 +348,7 @@ endif
set laststatus=2
if !has('nvim') || g:nvim_compatibility_with_vim == 1
set statusline=%1*%F%m%r%h%w\
let git_branch = system("git rev-parse --abbrev-ref HEAD")
let git_branch = system("git rev-parse --abbrev-ref HEAD 2> /dev/null")
exe "set statusline +=" . git_branch
if exists("g:plugs") && has_key(g:plugs, 'coc.nvim')
function CocStatusLine()
Expand Down
3 changes: 2 additions & 1 deletion root/vimrc.d/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ augroup END
"
" clangd:
" 可以使用coc.nvim自带的支持(:CocConfig添加languageserver配置),也可以下载coc-clangd插件(clangd.enabled: true),两者不能同时使用
let g:coc_global_extensions = ['coc-ultisnips', 'coc-json']
let g:coc_initial_global_extensions = ['coc-ultisnips', 'coc-json']
let g:coc_global_extensions = g:coc_initial_global_extensions
let g:coc_filetype_map = {'tex': 'latex'}
let g:coc_data_home = '~/.vim/coc'
" Make <CR> auto-select the first completion item and notify coc.nvim t:
Expand Down
3 changes: 3 additions & 0 deletions root/vimrc.d/plugin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ endfunction
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')

" Test framework
Plug 'junegunn/vader.vim'

" Plug 'LunarWatcher/auto-pairs'
" let g:AutoPairsMapBS = 1

Expand Down
3 changes: 3 additions & 0 deletions run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
vim -c 'Vader! test/*' > /dev/null
nvim -c 'Vader! test/*' > /dev/null
15 changes: 15 additions & 0 deletions test/coc_extension.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Given cpp:
Execute:
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-clangd'], g:coc_global_extensions

Given rust:
Execute:
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-rust-analyzer'], g:coc_global_extensions

Given python:
Execute:
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-pyright'], g:coc_global_extensions

Given tex:
Execute:
AssertEqual ['coc-ultisnips', 'coc-json', 'coc-vimtex'], g:coc_global_extensions

0 comments on commit b27c7d8

Please sign in to comment.