edit! third
let l:third = bufnr()
- execute ":buffer! " . l:second
+ exe $":buffer! {l:second}"
return [l:first, l:second, l:third]
endfunc
" Create a quickfix with at least 2 entries that are in the current 'winfixbuf' window.
func s:make_quickfix_windows()
let [l:current, _] = s:make_simple_quickfix()
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
split
let l:first_window = win_getid()
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfix_window = win_getid()
" Open the quickfix in a separate split and go to it
let l:index = 1 " quickfix indices start at 1
for l:entry in getqflist()
if l:entry["bufnr"] == a:buffer
- execute l:index . "cc"
+ exe $"{l:index} cc"
return
endif
let l:index += 1
endfor
- echoerr 'No quickfix entry matching "' . a:buffer . '" could be found.'
+ echoerr $'No quickfix entry matching {a:buffer} could be found.'
endfunc
" Fail to call :Next on a 'winfixbuf' window unless :Next! is used.
split
let l:nowinfixbuf_window = win_getid()
" Move to the 'winfixbuf' window now
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfixbuf_window = win_getid()
let l:expected_windows = s:get_windows_count()
argdo echo ''
call assert_notequal(l:current, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:first, bufnr())
call assert_equal(l:current_windows + 1, s:get_windows_count())
endfunc
let l:other = s:make_buffer_pairs()
let l:current = bufnr()
argglobal! other
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
call assert_fails("arglocal other", "E1513:")
call assert_equal(l:current, bufnr())
let l:other = s:make_buffer_pairs()
let l:current = bufnr()
- execute "buffer! " . l:other
+ exe $"buffer! {l:other}"
set modified
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
call assert_fails("bmodified", "E1513:")
call assert_equal(l:current, bufnr())
split
let l:nowinfixbuf_window = win_getid()
" Move to the 'winfixbuf' window now
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfixbuf_window = win_getid()
let l:current = bufnr()
call s:reset_all_buffers()
let [l:first, l:last] = s:make_buffers_list()
- execute "buffer! " . l:first
+ exe $"buffer! {l:first}"
let l:current = win_getid()
let l:current_windows = s:get_windows_count()
bufdo echo ''
call assert_notequal(l:current, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:first, bufnr())
call assert_equal(l:current_windows + 1, s:get_windows_count())
endfunc
let l:other = s:make_buffer_pairs()
let l:current = bufnr()
- call assert_fails("buffer " . l:other, "E1513:")
+ call assert_fails($"buffer {l:other}", "E1513:")
call assert_equal(l:current, bufnr())
- execute "buffer! " . l:other
+ exe $"buffer! {l:other}"
call assert_equal(l:other, bufnr())
endfunc
call s:make_buffer_pairs()
let l:current = bufnr()
- execute "buffer " . l:current
+ exe $"buffer {l:current}"
call assert_equal(l:current, bufnr())
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
call assert_equal(l:current, bufnr())
endfunc
let l:file_path = tempname()
call writefile(["Error - bad-thing-found"], l:file_path, 'D')
- execute "edit " . l:file_path
+ exe $"edit {l:file_path}"
let l:file_buffer = bufnr()
let l:current = bufnr()
set winfixbuf
- execute "buffer! " . l:file_buffer
+ exe $"buffer! {l:file_buffer}"
- execute 'caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")'
+ exe 'caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")'
call assert_equal(l:current, bufnr())
endfunc
let l:file_path = tempname()
call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path, 'D')
- execute "edit " . l:file_path
+ exe $"edit {l:file_path}"
let l:file_buffer = bufnr()
let l:current = bufnr()
set winfixbuf
- execute "buffer! " . l:file_buffer
+ exe $"buffer! {file_buffer}"
- call assert_fails("cbuffer " . l:file_buffer)
- call assert_equal(l:current, bufnr())
+ call assert_fails($"cbuffer {file_buffer}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
+ call assert_equal(current, bufnr())
- execute "cbuffer! " . l:file_buffer
+ exe $"cbuffer! {file_buffer}"
call assert_equal("first.unittest", expand("%:t"))
endfunc
call s:reset_all_buffers()
let [l:current, l:last] = s:make_simple_quickfix()
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
" Make a split window that is 'nowinfixbuf' but make it the second-to-last
" window so that :cdo will first try the 'winfixbuf' window, pass over it,
split
let l:nowinfixbuf_window = win_getid()
" Move to the 'winfixbuf' window now
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfixbuf_window = win_getid()
let l:expected_windows = s:get_windows_count()
call assert_equal(l:nowinfixbuf_window, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:current, bufnr())
call assert_equal(l:expected_windows, s:get_windows_count())
endfunc
call s:reset_all_buffers()
let [l:current_buffer, l:last] = s:make_simple_quickfix()
- execute "buffer! " . l:current_buffer
+ exe $"buffer! {l:current_buffer}"
let l:current_window = win_getid()
let l:current_windows = s:get_windows_count()
cdo echo ''
call assert_notequal(l:current_window, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:current_buffer, bufnr())
call assert_equal(l:current_windows + 1, s:get_windows_count())
endfunc
CheckFeature quickfix
call s:reset_all_buffers()
- let l:file = tempname()
- let l:entry = '["' . l:file . ':1:bar"]'
- let l:current = bufnr()
+ let file = tempname()
+ let entry = $'["{file}:1:bar"]'
+ let current = bufnr()
set winfixbuf
- call assert_fails("cexpr " . l:entry)
- call assert_equal(l:current, bufnr())
+ call assert_fails($"cexpr {entry}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
+ call assert_equal(current, bufnr())
- execute "cexpr! " . l:entry
- call assert_equal(fnamemodify(l:file, ":t"), expand("%:t"))
+ exe $"cexpr! {entry}"
+ call assert_equal(fnamemodify(file, ":t"), expand("%:t"))
endfunc
" Call :cfdo and choose the next available 'nowinfixbuf' window.
call s:reset_all_buffers()
let [l:current, l:last] = s:make_simple_quickfix()
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
" Make a split window that is 'nowinfixbuf' but make it the second-to-last
" window so that :cfdo will first try the 'winfixbuf' window, pass over it,
split
let l:nowinfixbuf_window = win_getid()
" Move to the 'winfixbuf' window now
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfixbuf_window = win_getid()
let l:expected_windows = s:get_windows_count()
call assert_equal(l:nowinfixbuf_window, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:current, bufnr())
call assert_equal(l:expected_windows, s:get_windows_count())
endfunc
call s:reset_all_buffers()
let [l:current_buffer, l:last] = s:make_simple_quickfix()
- execute "buffer! " . l:current_buffer
+ exe $"buffer! {l:current_buffer}"
let l:current_window = win_getid()
let l:current_windows = s:get_windows_count()
cfdo echo ''
call assert_notequal(l:current_window, win_getid())
call assert_equal(l:last, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:current_buffer, bufnr())
call assert_equal(l:current_windows + 1, s:get_windows_count())
endfunc
edit first.unittest
call append(0, ["some-search-term bad-thing-found"])
write
- let l:first = bufnr()
+ let first = bufnr()
edit! second.unittest
call append(0, ["some-search-term"])
write
- let l:file = tempname()
- call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file)
+ let file = tempname()
+ call writefile(["first.unittest:1:Error - bad-thing-found was detected"], file)
- let l:current = bufnr()
+ let current = bufnr()
set winfixbuf
- call assert_fails(":cfile " . l:file)
- call assert_equal(l:current, bufnr())
+ call assert_fails($":cfile {file}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
+ call assert_equal(current, bufnr())
- execute ":cfile! " . l:file
- call assert_equal(l:first, bufnr())
+ exe $":cfile! {file}"
+ call assert_equal(first, bufnr())
- call delete(l:file)
+ call delete(file)
call delete("first.unittest")
call delete("second.unittest")
endfunc
call s:reset_all_buffers()
let [l:current, _] = s:make_simple_quickfix()
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
let l:expected = s:get_windows_count()
call setline(1, l:file_name)
let l:current_windows = s:get_windows_count()
- execute "normal \<C-w>f"
+ exe "normal \<C-w>f"
call assert_equal(l:current_windows + 1, s:get_windows_count())
func Test_djump()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
+ let l:include_file = tempname() .. ".h"
call writefile(["min(1, 12);",
- \ '#include "' . l:include_file . '"'
+ \ $'#include "{l:include_file}"'
\ ],
\ "main.c")
call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file)
let l:file_on_disk = tempname()
let l:directory_on_disk1 = fnamemodify(l:file_on_disk, ":p:h")
let l:name = fnamemodify(l:file_on_disk, ":t")
- execute "edit " . l:file_on_disk
+ exe $"edit {l:file_on_disk}"
write!
- let l:directory_on_disk2 = l:directory_on_disk1 . "_something_else"
+ let l:directory_on_disk2 = l:directory_on_disk1 .. "_something_else"
if !isdirectory(l:directory_on_disk2)
call mkdir(l:directory_on_disk2)
endif
- execute "cd " . l:directory_on_disk2
- execute "edit " l:name
+ exe $"cd {l:directory_on_disk2}"
+ exe $"edit {l:name}"
let l:current = bufnr()
call assert_equal(l:current, bufnr())
set winfixbuf
- call assert_fails("edit " . l:file_on_disk, "E1513:")
+ call assert_fails($"edit {l:file_on_disk}", "E1513:")
call assert_equal(l:current, bufnr())
call delete(l:directory_on_disk1)
let l:file_on_disk = tempname()
let l:directory_on_disk1 = fnamemodify(l:file_on_disk, ":p:h")
let l:name = fnamemodify(l:file_on_disk, ":t")
- execute "edit " . l:file_on_disk
+ exe $"edit {l:file_on_disk}"
write!
- let l:directory_on_disk2 = l:directory_on_disk1 . "_something_else"
+ let l:directory_on_disk2 = l:directory_on_disk1 .. "_something_else"
if !isdirectory(l:directory_on_disk2)
call mkdir(l:directory_on_disk2)
endif
- execute "cd " . l:directory_on_disk2
- execute "edit " l:name
- execute "cd " . l:directory_on_disk1
- execute "edit " l:file_on_disk
- execute "cd " . l:directory_on_disk2
+ exe $"cd {l:directory_on_disk2}"
+ exe $"edit {l:name}"
+ exe $"cd {l:directory_on_disk1}"
+ exe $"edit {l:file_on_disk}"
+ exe $"cd {l:directory_on_disk2}"
let l:current = bufnr()
call assert_equal(l:current, bufnr())
set winfixbuf
- call assert_fails("edit " . l:name, "E1513:")
+ call assert_fails($"edit {l:name}", "E1513:")
call assert_equal(l:current, bufnr())
call delete(l:directory_on_disk1)
call writefile([], file, 'D')
let file = fnamemodify(file, ':p')
let current = bufnr()
- execute "edit " . file
+ exe $"edit {file}"
write!
call assert_equal(current, bufnr())
set winfixbuf
- execute "edit " file
+ exe $"edit {file}"
call assert_equal(current, bufnr())
set nowinfixbuf
let l:name = fnamemodify(l:file, ":p:t")
let l:original_path = &path
- execute "set path=" . l:directory
+ exe $"set path={l:directory}"
set winfixbuf
- call assert_fails("execute 'find " . l:name . "'", "E1513:")
+ call assert_fails($"exe 'find {l:name}'", "E1513:")
call assert_equal(l:current, bufnr())
- execute "find! " . l:name
+ exe $"find! {l:name}"
call assert_equal(l:file, expand("%:p"))
- execute "set path=" . l:original_path
+ exe $"set path={l:original_path}"
endfunc
" Fail :first but :first! is allowed
call assert_fails("silent! grep some-search-term *.unittest", "E1513:")
call assert_equal(l:current, bufnr())
- execute "edit! " . l:first
+ exe $"edit! {l:first}"
silent! grep! some-search-term *.unittest
call assert_notequal(l:first, bufnr())
func Test_ijump()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
+ let l:include_file = tempname() .. ".h"
call writefile([
- \ '#include "' . l:include_file . '"'
+ \ $'#include "{l:include_file}"'
\ ],
\ "main.c", 'D')
call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D')
let l:file_path = tempname()
call writefile(["Error - bad-thing-found"], l:file_path, 'D')
- execute "edit " . l:file_path
+ exe $"edit {l:file_path}"
let l:file_buffer = bufnr()
let l:current = bufnr()
set winfixbuf
- execute "buffer! " . l:file_buffer
+ exe $"buffer! {l:file_buffer}"
- execute 'laddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")'
+ exe 'laddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")'
call assert_equal(l:current, bufnr())
endfunc
let l:file_path = tempname()
call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path, 'D')
- execute "edit " . l:file_path
+ exe $"edit {l:file_path}"
let l:file_buffer = bufnr()
let l:current = bufnr()
set winfixbuf
- execute "buffer! " . l:file_buffer
+ exe $"buffer! {file_buffer}"
- call assert_fails("lbuffer " . l:file_buffer)
- call assert_equal(l:current, bufnr())
+ call assert_fails($"lbuffer {file_buffer}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
+ call assert_equal(current, bufnr())
- execute "lbuffer! " . l:file_buffer
+ exe $"lbuffer! {file_buffer}"
call assert_equal("first.unittest", expand("%:t"))
endfunc
let [l:first, l:middle, l:last] = s:make_simple_location_list()
lnext!
- call assert_fails('execute "ldo buffer ' . l:first . '"', "E1513:")
+ call assert_fails($'exe "ldo buffer {l:first}"', "E1513:")
call assert_equal(l:middle, bufnr())
- execute "ldo! buffer " . l:first
+ exe $"ldo! buffer {l:first}"
call assert_notequal(l:last, bufnr())
endfunc
CheckFeature quickfix
call s:reset_all_buffers()
- let l:file = tempname()
- let l:entry = '["' . l:file . ':1:bar"]'
- let l:current = bufnr()
+ let file = tempname()
+ let entry = $'["{file}:1:bar"]'
+ let current = bufnr()
set winfixbuf
- call assert_fails("lexpr " . l:entry)
- call assert_equal(l:current, bufnr())
+ call assert_fails($"lexpr {entry}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
+ call assert_equal(current, bufnr())
- execute "lexpr! " . l:entry
- call assert_equal(fnamemodify(l:file, ":t"), expand("%:t"))
+ exe $"lexpr! {entry}"
+ call assert_equal(fnamemodify(file, ":t"), expand("%:t"))
endfunc
" Fail :lfdo but :lfdo! is allowed
CheckFeature quickfix
call s:reset_all_buffers()
- let [l:first, l:middle, l:last] = s:make_simple_location_list()
+ let [first, middle, last] = s:make_simple_location_list()
lnext!
- call assert_fails('execute "lfdo buffer ' . l:first . '"', "E1513:")
- call assert_equal(l:middle, bufnr())
- execute "lfdo! buffer " . l:first
- call assert_notequal(l:last, bufnr())
+ call assert_fails('exe "lfdo buffer ' .. first .. '"', "E1513:")
+ call assert_equal(middle, bufnr())
+ exe $"lfdo! buffer {first}"
+ call assert_notequal(last, bufnr())
endfunc
" Fail :lfile but :lfile! is allowed
set winfixbuf
- call assert_fails(":lfile " . l:file)
+ call assert_fails($":lfile {l:file}", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
call assert_equal(l:current, bufnr())
- execute ":lfile! " . l:file
+ exe $":lfile! {l:file}"
call assert_equal(l:first, bufnr())
call delete("first.unittest")
let [l:first, l:middle, l:last] = s:make_simple_location_list()
lopen
lfirst!
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
normal j
call assert_fails(".ll", "E1513:")
- execute "normal \<C-w>k"
+ exe "normal \<C-w>k"
call assert_equal(l:first, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
.ll!
- execute "normal \<C-w>k"
+ exe "normal \<C-w>k"
call assert_equal(l:middle, bufnr())
endfunc
call writefile(["one", "two", "three"], "Xfile", 'D')
call writefile(["one"], "Xother", 'D')
edit Xother
- execute "normal \<C-]>"
+ exe "normal \<C-]>"
set winfixbuf
set winfixbuf
- call assert_fails('lua vim.command("buffer " .. ' . l:previous . ')')
+ call assert_fails($'lua vim.command("buffer " .. {l:previous})')
call assert_equal(l:current, bufnr())
- execute 'lua vim.command("buffer! " .. ' . l:previous . ')'
+ exe $'lua vim.command("buffer! " .. {l:previous})'
call assert_equal(l:previous, bufnr())
endfunc
buffer! winfix.unittest
- call assert_fails("lvimgrepadd /some-search-term/ *.unittest")
+ call assert_fails("lvimgrepadd /some-search-term/ *.unittest", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
call assert_equal(l:current, bufnr())
lvimgrepadd! /some-search-term/ *.unittest
let l:other = s:make_buffer_pairs()
let l:current = bufnr()
- execute "buffer! " . l:other
+ exe $"buffer! {l:other}"
normal mA
- execute "buffer! " . l:current
+ exe $"buffer! {l:current}"
normal mB
call assert_fails("normal `A", "E1513:")
call writefile(["one", "two", "three"], "Xfile", 'D')
call writefile(["one"], "Xother", 'D')
edit Xother
- execute "normal \<C-]>"
+ exe "normal \<C-]>"
set winfixbuf
call writefile(["one", "two", "three"], "Xfile", 'D')
call writefile(["one"], "Xother", 'D')
edit Xother
- execute "normal \<C-]>"
+ exe "normal \<C-]>"
set winfixbuf
call writefile(["one", "two", "three"], "Xfile", 'D')
call writefile(["one"], "Xother", 'D')
edit Xother
- execute "normal \<C-]>"
+ exe "normal \<C-]>"
set winfixbuf
" Go up another line
normal m`
normal k
- execute "normal \<C-o>"
+ exe "normal \<C-o>"
set winfixbuf
let l:line = getcurpos()[1]
- execute "normal 1\<C-i>"
+ exe "normal 1\<C-i>"
call assert_notequal(l:line, getcurpos()[1])
endfunc
set winfixbuf
- execute "normal \<C-o>"
+ exe "normal \<C-o>"
call assert_equal(l:current, bufnr())
endfunc
set winfixbuf
let l:current_windows = s:get_windows_count()
- execute "normal \<C-w>\<C-]>"
+ exe "normal \<C-w>\<C-]>"
call assert_equal(l:current_windows + 1, s:get_windows_count())
set tags&
set winfixbuf
let l:current_windows = s:get_windows_count()
- execute "normal \<C-w>g\<C-]>"
+ exe "normal \<C-w>g\<C-]>"
call assert_equal(l:current_windows + 1, s:get_windows_count())
set tags&
func Test_normal_square_bracket_left_ctrl_d()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
+ let l:include_file = tempname() .. ".h"
call writefile(["min(1, 12);",
- \ '#include "' . l:include_file . '"'
+ \ $'#include "{l:include_file}"'
\ ],
\ "main.c", 'D')
call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D')
set nowinfixbuf
- execute "normal [\<C-d>"
+ exe "normal [\<C-d>"
call assert_notequal(l:current, bufnr())
endfunc
func Test_normal_square_bracket_right_ctrl_d()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
+ let l:include_file = tempname() .. ".h"
call writefile(["min(1, 12);",
- \ '#include "' . l:include_file . '"'
+ \ $'#include "{l:include_file}"'
\ ],
\ "main.c", 'D')
call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D')
set nowinfixbuf
- execute "normal ]\<C-d>"
+ exe "normal ]\<C-d>"
call assert_notequal(l:current, bufnr())
endfunc
func Test_normal_square_bracket_left_ctrl_i()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
- call writefile(['#include "' . l:include_file . '"',
+ let l:include_file = tempname() .. ".h"
+ call writefile([$'#include "{l:include_file}"',
\ "min(1, 12);",
\ ],
\ "main.c", 'D')
set nowinfixbuf
- execute "normal [\<C-i>"
+ exe "normal [\<C-i>"
call assert_notequal(l:current, bufnr())
set define&
func Test_normal_square_bracket_right_ctrl_i()
call s:reset_all_buffers()
- let l:include_file = tempname() . ".h"
+ let l:include_file = tempname() .. ".h"
call writefile(["min(1, 12);",
- \ '#include "' . l:include_file . '"'
+ \ $'#include "{l:include_file}"'
\ ],
\ "main.c", 'D')
call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file, 'D')
set nowinfixbuf
- execute "normal ]\<C-i>"
+ exe "normal ]\<C-i>"
call assert_notequal(l:current, bufnr())
set define&
pedit other
- execute "normal \<C-w>w"
+ exe "normal \<C-w>w"
call assert_equal(l:other, bufnr())
endfunc
let l:other = s:make_buffer_pairs()
- exe 'pbuffer ' . l:other
+ exe $'pbuffer {l:other}'
- execute "normal \<C-w>w"
+ exe "normal \<C-w>w"
call assert_equal(l:other, bufnr())
endfunc
" Disallow <C-^> by default but allow it if the command does something else
nnoremap <C-^> :echo "hello!"
- execute "normal \<C-^>"
+ exe "normal \<C-^>"
call assert_equal(l:current, bufnr())
nunmap <C-^>
call s:reset_all_buffers()
split
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
set winfixbuf
edit Xother
tag thesame
- execute "normal \<C-^>"
+ exe "normal \<C-^>"
tnext!
set winfixbuf
split
let l:nowinfixbuf_window = win_getid()
" Move to the 'winfixbuf' window now
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
let l:winfixbuf_window = win_getid()
let l:expected_windows = s:get_windows_count()
call s:reset_all_buffers()
let [l:first, _] = s:make_buffers_list()
- execute "buffer! " . l:first
+ exe $"buffer! {l:first}"
let l:current = win_getid()
let l:current_windows = s:get_windows_count()
tabdo echo ''
call assert_notequal(l:current, win_getid())
call assert_equal(l:first, bufnr())
- execute "normal \<C-w>j"
+ exe "normal \<C-w>j"
call assert_equal(l:first, bufnr())
call assert_equal(l:current_windows + 1, s:get_windows_count())
endfunc
edit Xother
tag thesame
- execute "normal \<C-^>"
+ exe "normal \<C-^>"
set winfixbuf
edit Xother
tag thesame
- execute "normal \<C-^>"
+ exe "normal \<C-^>"
tnext!
set winfixbuf
buffer! winfix.unittest
- call assert_fails("vimgrep /some-search-term/ *.unittest")
+ call assert_fails("vimgrep /some-search-term/ *.unittest", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
call assert_equal(l:current, bufnr())
" Don't error and also do swap to the first match because ! was included
buffer! winfix.unittest
- call assert_fails("vimgrepadd /some-search-term/ *.unittest")
+ call assert_fails("vimgrepadd /some-search-term/ *.unittest", "E1513: Cannot switch buffer. 'winfixbuf' is enabled")
call assert_equal(l:current, bufnr())
vimgrepadd! /some-search-term/ *.unittest
windo echo ''
call assert_equal(l:current_window, win_getid())
- call assert_fails('execute "windo buffer ' . l:current_buffer . '"', "E1513:")
+ call assert_fails($'exe "windo buffer {l:current_buffer}"', "E1513:")
call assert_equal(l:current_window, win_getid())
- execute "windo buffer! " . l:current_buffer
+ exe $"windo buffer! {l:current_buffer}"
call assert_equal(l:current_window, win_getid())
endfunc
set switchbuf=uselast
split
copen
- execute winnr('#') 'quit'
+ exe winnr('#') 'quit'
call assert_equal(2, winnr('$'))
cnext " Would've triggered a null pointer member access