diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-30 02:06:48 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:33 -0400 |
| commit | 87334c00e0568226f0deeb6de90c759c8d1ec464 (patch) | |
| tree | b7a8f3ea7db9b13f773084521a00e088d87e556b /src/nvim/testdir | |
| parent | b8ddca6554c312026d2d8e480b0c0fb09a26a3f0 (diff) | |
| download | rneovim-87334c00e0568226f0deeb6de90c759c8d1ec464.tar.gz rneovim-87334c00e0568226f0deeb6de90c759c8d1ec464.tar.bz2 rneovim-87334c00e0568226f0deeb6de90c759c8d1ec464.zip | |
vim-patch:8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Problem: Cannot use :write when using a plugin with BufWriteCmd.
Solution: Reset BF_NOTEDITED after BufWriteCmd. (closes vim/vim#5807)
https://github.com/vim/vim/commit/0fff44152d06e6b662ad4bef172af07a041d2f3f
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index e03a0b7de3..954e5d875f 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1072,6 +1072,40 @@ func Test_Cmd_Autocmds() enew! endfunc +func s:ReadFile() + setl noswapfile nomodified + let filename = resolve(expand("<afile>:p")) + execute 'read' fnameescape(filename) + 1d_ + exe 'file' fnameescape(filename) + setl buftype=acwrite +endfunc + +func s:WriteFile() + let filename = resolve(expand("<afile>:p")) + setl buftype= + noautocmd execute 'write' fnameescape(filename) + setl buftype=acwrite + setl nomodified +endfunc + +func Test_BufReadCmd() + autocmd BufReadCmd *.test call s:ReadFile() + autocmd BufWriteCmd *.test call s:WriteFile() + + call writefile(['one', 'two', 'three'], 'Xcmd.test') + edit Xcmd.test + call assert_match('Xcmd.test" line 1 of 3', execute('file')) + normal! Gofour + write + call assert_equal(['one', 'two', 'three', 'four'], readfile('Xcmd.test')) + + bwipe! + call delete('Xcmd.test') + au! BufReadCmd + au! BufWriteCmd +endfunc + func SetChangeMarks(start, end) exe a:start. 'mark [' exe a:end. 'mark ]' |