diff --git a/ftdetect/nim.vim b/ftdetect/nim.vim index 632501e..560930f 100644 --- a/ftdetect/nim.vim +++ b/ftdetect/nim.vim @@ -2,3 +2,6 @@ if exists("s:loaded") finish endif let s:loaded = 1 + +au BufNewFile,BufRead *.nim setlocal filetype=nim +au BufNewFile,BufRead *.nims setlocal filetype=nims diff --git a/other/tests/vim/outline.py b/other/tests/vim/outline.py new file mode 100644 index 0000000..3b0a408 --- /dev/null +++ b/other/tests/vim/outline.py @@ -0,0 +1,16 @@ +from vimtest import cleanup, startNvim + + +nvim = startNvim() + + +def test_opening(): + cleanup(nvim) + nvim.command("e outline.nim") + nvim.current.buffer[:] = [ + "var x = 42", + "type Y = object", + " x, y: int"] + nvim.command(":NimOutline") + outlinewin = nvim.eval('bufwinnr("__nim_outline__")') + assert outlinewin > 0 diff --git a/other/tests/vim/smoke.py b/other/tests/vim/smoke.py index e8d810d..1a7f694 100644 --- a/other/tests/vim/smoke.py +++ b/other/tests/vim/smoke.py @@ -1,11 +1,11 @@ from vimtest import cleanup, startNvim -from time import sleep nvim = startNvim() def test_buffer(): cleanup(nvim) + nvim.command("norm ggdG") nvim.command("norm ihello world") assert nvim.current.buffer[:] == ["hello world"] diff --git a/other/tests/vim/vimtest.py b/other/tests/vim/vimtest.py index 030890c..bafac75 100644 --- a/other/tests/vim/vimtest.py +++ b/other/tests/vim/vimtest.py @@ -3,10 +3,10 @@ from neovim import attach def cleanup(nvim): nvim.command('bd!') + nvim.command('new') def startNvim(): nvim = attach("socket", path="/tmp/nvim") - nvim.command("PlugInstall") cleanup(nvim) return nvim diff --git a/other/travis.sh b/other/travis.sh index 5b7e6de..f562f41 100755 --- a/other/travis.sh +++ b/other/travis.sh @@ -66,15 +66,18 @@ echo -e "\nNimsuggest:" nimsuggest --version echo "================================================================================" -cd $current/other +cd $current/other curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim cp nvimcfg/init.vim ~/.config/nvim/ mkdir -p "$HOME/.config/nvim/undodir" mkdir -p "$HOME/.config/nvim/autoload" mkdir -p "$HOME/.config/nvim/view" -cat ~/.config/nvim/autoload/plug.vim +cd ~/.config/nvim +mkdir plugged +cd plugged +git clone https://github.com/baabelfish/nvim-nim tree ~/.config/nvim @@ -83,4 +86,5 @@ tree ~/.config/nvim echo "================================================================================" echo "Run vim tests" +cd $current/other ./run_tests.sh