diff --git a/autoload/util.vim b/autoload/util.vim index 0de9e9c..a44445e 100644 --- a/autoload/util.vim +++ b/autoload/util.vim @@ -290,16 +290,19 @@ function! util#goto_file() endfunction -call operator#user#define('nimrepl_send', 'NimReplSend') -function! NimReplSend(motion_wiseness) - let start = getpos("'[") - let stop = getpos("']") - let start_line = start[1] - let stop_line = stop[1] - let str = join(getline(start_line, stop_line), "\n") - echom str - call features#repl#send(str) -endfunction +try + call operator#user#define('nimrepl_send', 'NimReplSend') + function! NimReplSend(motion_wiseness) + let start = getpos("'[") + let stop = getpos("']") + let start_line = start[1] + let stop_line = stop[1] + let str = join(getline(start_line, stop_line), "\n") + echom str + call features#repl#send(str) + endfunction +catch +endtry let &cpo = s:save_cpo diff --git a/ftplugin/nim.vim b/ftplugin/nim.vim index 0b1f374..45b56c7 100644 --- a/ftplugin/nim.vim +++ b/ftplugin/nim.vim @@ -62,7 +62,7 @@ augroup END augroup nvim_nim_outline autocmd! FileWritePost *.nim call features#outline#run(1) - autocmd! VimResized,WinEnter * call features#outline#render() + autocmd! VimResized,WinEnter *.nim call features#outline#render() augroup END if g:nvim_nim_highlighter_enable diff --git a/other/rc.vim b/other/rc.vim index 5564f51..c55266c 100644 --- a/other/rc.vim +++ b/other/rc.vim @@ -1,5 +1,5 @@ filetype off set rtp+=./plugins/vader.vim -set rtp+=./plugins/nvim-nim +set rtp+=.. filetype plugin indent on syntax enable diff --git a/other/run_tests.sh b/other/run_tests.sh index 71c4d2a..ba9c17f 100755 --- a/other/run_tests.sh +++ b/other/run_tests.sh @@ -1,14 +1,19 @@ #!/bin/bash # Intall plugins -mkdir plugins -git clone https://github.com/baabelfish/vader.vim plugins/vader.vim -git clone https://github.com/baabelfish/nvim-nim plugins/nvim-nim +if [[ ! -d plugins ]]; then + mkdir plugins + git clone https://github.com/baabelfish/vader.vim plugins/vader.vim + # git clone https://github.com/baabelfish/nvim-nim plugins/nvim-nim +fi # Run tests -nvim -u rc.vim -c 'Vader! tests/**/*.vader' +nvim -c 'Vader! tests/**/*.vader' > /dev/null err=$? if [ "$err" != "0" ]; then cat report.log exit 1 +else + echo "" + echo "Great success!" fi diff --git a/other/tests/vim/smoke.vader b/other/tests/vim/smoke.vader index e5b364f..01ade70 100644 --- a/other/tests/vim/smoke.vader +++ b/other/tests/vim/smoke.vader @@ -1,9 +1,36 @@ -Do (file): - ifoo\ +Given nim: + echo "hello" -Expect (else): - foo +Do: + gg +Then: + AssertEqual "nim", &filetype + Assert exists(":NimDebug") > 0 + Assert exists(":NimDefinition") > 0 + Assert exists(":NimInfo") > 0 + Assert exists(":NimWeb") > 0 + Assert exists(":NimUsages") > 0 + Assert exists(":NimUsagesProject") > 0 + Assert exists(":NimRenameSymbol") > 0 + Assert exists(":NimRenameSymbolProject") > 0 + Assert exists(":NimDebug") > 0 + Assert exists(":NimOutline") > 0 + Assert exists(":NimOutlineUpdate") > 0 -Execute (something): - AssertEqual 1, 2 +Execute: + NimInfo + NimDebug + NimDefinition + NimUsages + NimUsagesProject + NimOutline + +Given cpp: + std::cout << "hello world" << std::endl; + +Do: + gg + +Then: + AssertEqual "cpp", &filetype diff --git a/other/testwatcher.sh b/other/testwatcher.sh new file mode 100755 index 0000000..f6e7104 --- /dev/null +++ b/other/testwatcher.sh @@ -0,0 +1,6 @@ +#!/bin/bash +while inotifywait -r -q -e close_write "../autoload" "." +do + ./run_tests.sh + sleep 1 +done diff --git a/other/travis.sh b/other/travis.sh index f562f41..a80fa98 100755 --- a/other/travis.sh +++ b/other/travis.sh @@ -81,9 +81,6 @@ git clone https://github.com/baabelfish/nvim-nim tree ~/.config/nvim -# echo "Run nim tests" -# nim c tests/nimsuggest/suggestions.nim - echo "================================================================================" echo "Run vim tests" cd $current/other