Created
June 11, 2024 02:33
-
-
Save pocke/44cc6efcbb5621f1b6f2303ba18adb20 to your computer and use it in GitHub Desktop.
.vimrc example to open file on specified line with `fname:lineno` format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocmd BufReadCmd *:[0-9]\+ ++nested call s:edit_with_lnum(expand('<afile>')) | |
function! s:edit_with_lnum(path_with_lnum) abort | |
let lnum = matchstr(a:path_with_lnum, '\v[0-9]+$') | |
let path = matchstr(a:path_with_lnum, '\v^.+\ze:[0-9]+$') | |
exec 'e' path | |
exec lnum | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment