I have a filename and its line provided in this format, e.g.:


When I move on the filename and press gf I jump to that file, however the cursor stands on line number 1, instead of 20. How could i make gf respect the line number? I am using lervag/file-line plugin, which usually handles similar cases, e.g. when ./my_dir/my_filename.py:20: is provided as a command-line argument for Vim.


See :h gF:

[count]gF       Same as "gf", except if a number follows the file
            name, then the cursor is positioned on that line in
            the file. The file name and the number must be
            separated by a non-filename (see 'isfname') and
            non-numeric character.

So using gShift-f should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.