vim9script # Simplified version of http://www.vim.org/scripts/script.php?script_id=2184 # that does not replace current window export def Goto() var file = bufname("%") if filereadable(file) | return | endif var names = matchlist(file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$') if empty(names) | return | endif var fileName = names[1] var lineNum = names[2] == "" ? "0" : names[2] var colNum = names[3] == "" ? "0" : names[3] if !filereadable(fileName) | return | endif var nr = bufnr("%") execute "keepalt edit +" .. lineNum .. " " .. fileName execute "normal! " .. colNum .. "|" execute "bdelete " .. nr enddef