vim - open file and goto line number using ::

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
19
down vote

favorite
7












Several tools such as grep, py.test, etc ... use the pattern <FileName>:<line number>: to point to errors. For example:



; grep -Hn Common setup.cfg
setup.cfg:11: Common


How can I modify vim and gvim so that I can invoke them like so:



gvim setup.cfg:11:


instead of



gvim setup.cfg +11


I know that I can write a small shell script that would parse things but I wonder if there is an easier way.










share|improve this question

















  • 2




    This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
    – Random832
    Oct 5 '12 at 12:48














up vote
19
down vote

favorite
7












Several tools such as grep, py.test, etc ... use the pattern <FileName>:<line number>: to point to errors. For example:



; grep -Hn Common setup.cfg
setup.cfg:11: Common


How can I modify vim and gvim so that I can invoke them like so:



gvim setup.cfg:11:


instead of



gvim setup.cfg +11


I know that I can write a small shell script that would parse things but I wonder if there is an easier way.










share|improve this question

















  • 2




    This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
    – Random832
    Oct 5 '12 at 12:48












up vote
19
down vote

favorite
7









up vote
19
down vote

favorite
7






7





Several tools such as grep, py.test, etc ... use the pattern <FileName>:<line number>: to point to errors. For example:



; grep -Hn Common setup.cfg
setup.cfg:11: Common


How can I modify vim and gvim so that I can invoke them like so:



gvim setup.cfg:11:


instead of



gvim setup.cfg +11


I know that I can write a small shell script that would parse things but I wonder if there is an easier way.










share|improve this question













Several tools such as grep, py.test, etc ... use the pattern <FileName>:<line number>: to point to errors. For example:



; grep -Hn Common setup.cfg
setup.cfg:11: Common


How can I modify vim and gvim so that I can invoke them like so:



gvim setup.cfg:11:


instead of



gvim setup.cfg +11


I know that I can write a small shell script that would parse things but I wonder if there is an easier way.







vim gvim






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 5 '12 at 7:14









Sardathrion

2,41542248




2,41542248







  • 2




    This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
    – Random832
    Oct 5 '12 at 12:48












  • 2




    This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
    – Random832
    Oct 5 '12 at 12:48







2




2




This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
– Random832
Oct 5 '12 at 12:48




This isn't exactly analogous, but vim does have a feature to load the output from grep or (for example) compiler errors from make, and navigate between them. See :help quickfix for more info.
– Random832
Oct 5 '12 at 12:48










4 Answers
4






active

oldest

votes

















up vote
13
down vote



accepted










You can use the file:line plugin available here, which does exactly what you want...






share|improve this answer
















  • 1




    It sure does and with the added bonus that you can use vundle to install it.
    – Sardathrion
    Jun 25 '15 at 6:53










  • The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
    – Lekensteyn
    Jul 16 '15 at 9:06

















up vote
9
down vote













There isn't a way, and I think a script is the only way.
The reason being, what if you had a file called setup.cfg:11 and wanted to edit it?



Here is a quick script that does what you want as a oneliner...



editline() vim $1%%:* +$1##*:; 





share|improve this answer






















  • Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
    – Sardathrion
    Oct 5 '12 at 7:44






  • 2




    You can edit a +11 file by saying vim ./+11
    – Julian
    Oct 5 '12 at 7:47

















up vote
2
down vote













With Vundle.vim, add this to your .vimrc:



Plugin 'bogado/file-line'





share|improve this answer






















  • @Sardathrion: Which issues do you have?
    – Dorian
    Oct 14 '16 at 0:13










  • I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
    – Sardathrion
    Oct 14 '16 at 6:50

















up vote
0
down vote













Alternatively you can use below syntax:



$ vim filename +line_num





share








New contributor




shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f49996%2fvim-open-file-and-goto-line-number-using-filenameline-nbr%23new-answer', 'question_page');

    );

    Post as a guest






























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    13
    down vote



    accepted










    You can use the file:line plugin available here, which does exactly what you want...






    share|improve this answer
















    • 1




      It sure does and with the added bonus that you can use vundle to install it.
      – Sardathrion
      Jun 25 '15 at 6:53










    • The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
      – Lekensteyn
      Jul 16 '15 at 9:06














    up vote
    13
    down vote



    accepted










    You can use the file:line plugin available here, which does exactly what you want...






    share|improve this answer
















    • 1




      It sure does and with the added bonus that you can use vundle to install it.
      – Sardathrion
      Jun 25 '15 at 6:53










    • The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
      – Lekensteyn
      Jul 16 '15 at 9:06












    up vote
    13
    down vote



    accepted







    up vote
    13
    down vote



    accepted






    You can use the file:line plugin available here, which does exactly what you want...






    share|improve this answer












    You can use the file:line plugin available here, which does exactly what you want...







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 6 '14 at 16:59









    mmigdol

    24623




    24623







    • 1




      It sure does and with the added bonus that you can use vundle to install it.
      – Sardathrion
      Jun 25 '15 at 6:53










    • The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
      – Lekensteyn
      Jul 16 '15 at 9:06












    • 1




      It sure does and with the added bonus that you can use vundle to install it.
      – Sardathrion
      Jun 25 '15 at 6:53










    • The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
      – Lekensteyn
      Jul 16 '15 at 9:06







    1




    1




    It sure does and with the added bonus that you can use vundle to install it.
    – Sardathrion
    Jun 25 '15 at 6:53




    It sure does and with the added bonus that you can use vundle to install it.
    – Sardathrion
    Jun 25 '15 at 6:53












    The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
    – Lekensteyn
    Jul 16 '15 at 9:06




    The references file-line plugin has some issues, including brokeness when tab pages are in use. vim-fetch does what file-line does, but better.
    – Lekensteyn
    Jul 16 '15 at 9:06












    up vote
    9
    down vote













    There isn't a way, and I think a script is the only way.
    The reason being, what if you had a file called setup.cfg:11 and wanted to edit it?



    Here is a quick script that does what you want as a oneliner...



    editline() vim $1%%:* +$1##*:; 





    share|improve this answer






















    • Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
      – Sardathrion
      Oct 5 '12 at 7:44






    • 2




      You can edit a +11 file by saying vim ./+11
      – Julian
      Oct 5 '12 at 7:47














    up vote
    9
    down vote













    There isn't a way, and I think a script is the only way.
    The reason being, what if you had a file called setup.cfg:11 and wanted to edit it?



    Here is a quick script that does what you want as a oneliner...



    editline() vim $1%%:* +$1##*:; 





    share|improve this answer






















    • Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
      – Sardathrion
      Oct 5 '12 at 7:44






    • 2




      You can edit a +11 file by saying vim ./+11
      – Julian
      Oct 5 '12 at 7:47












    up vote
    9
    down vote










    up vote
    9
    down vote









    There isn't a way, and I think a script is the only way.
    The reason being, what if you had a file called setup.cfg:11 and wanted to edit it?



    Here is a quick script that does what you want as a oneliner...



    editline() vim $1%%:* +$1##*:; 





    share|improve this answer














    There isn't a way, and I think a script is the only way.
    The reason being, what if you had a file called setup.cfg:11 and wanted to edit it?



    Here is a quick script that does what you want as a oneliner...



    editline() vim $1%%:* +$1##*:; 






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 5 '12 at 7:48

























    answered Oct 5 '12 at 7:38









    Julian

    64944




    64944











    • Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
      – Sardathrion
      Oct 5 '12 at 7:44






    • 2




      You can edit a +11 file by saying vim ./+11
      – Julian
      Oct 5 '12 at 7:47
















    • Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
      – Sardathrion
      Oct 5 '12 at 7:44






    • 2




      You can edit a +11 file by saying vim ./+11
      – Julian
      Oct 5 '12 at 7:47















    Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
    – Sardathrion
    Oct 5 '12 at 7:44




    Sorry this is not accurate: What if you had a file called +11? You can, of course, use -- for that.
    – Sardathrion
    Oct 5 '12 at 7:44




    2




    2




    You can edit a +11 file by saying vim ./+11
    – Julian
    Oct 5 '12 at 7:47




    You can edit a +11 file by saying vim ./+11
    – Julian
    Oct 5 '12 at 7:47










    up vote
    2
    down vote













    With Vundle.vim, add this to your .vimrc:



    Plugin 'bogado/file-line'





    share|improve this answer






















    • @Sardathrion: Which issues do you have?
      – Dorian
      Oct 14 '16 at 0:13










    • I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
      – Sardathrion
      Oct 14 '16 at 6:50














    up vote
    2
    down vote













    With Vundle.vim, add this to your .vimrc:



    Plugin 'bogado/file-line'





    share|improve this answer






















    • @Sardathrion: Which issues do you have?
      – Dorian
      Oct 14 '16 at 0:13










    • I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
      – Sardathrion
      Oct 14 '16 at 6:50












    up vote
    2
    down vote










    up vote
    2
    down vote









    With Vundle.vim, add this to your .vimrc:



    Plugin 'bogado/file-line'





    share|improve this answer














    With Vundle.vim, add this to your .vimrc:



    Plugin 'bogado/file-line'






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 17 at 10:17

























    answered Oct 12 '16 at 15:56









    Dorian

    1214




    1214











    • @Sardathrion: Which issues do you have?
      – Dorian
      Oct 14 '16 at 0:13










    • I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
      – Sardathrion
      Oct 14 '16 at 6:50
















    • @Sardathrion: Which issues do you have?
      – Dorian
      Oct 14 '16 at 0:13










    • I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
      – Sardathrion
      Oct 14 '16 at 6:50















    @Sardathrion: Which issues do you have?
    – Dorian
    Oct 14 '16 at 0:13




    @Sardathrion: Which issues do you have?
    – Dorian
    Oct 14 '16 at 0:13












    I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
    – Sardathrion
    Oct 14 '16 at 6:50




    I moved to neovim and there are lots of issues that mark other modules (or whatever neovim calls them) as incompatible.
    – Sardathrion
    Oct 14 '16 at 6:50










    up vote
    0
    down vote













    Alternatively you can use below syntax:



    $ vim filename +line_num





    share








    New contributor




    shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote













      Alternatively you can use below syntax:



      $ vim filename +line_num





      share








      New contributor




      shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



















        up vote
        0
        down vote










        up vote
        0
        down vote









        Alternatively you can use below syntax:



        $ vim filename +line_num





        share








        New contributor




        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        Alternatively you can use below syntax:



        $ vim filename +line_num






        share








        New contributor




        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share


        share






        New contributor




        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 6 mins ago









        shubham tambere

        1




        1




        New contributor




        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        shubham tambere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f49996%2fvim-open-file-and-goto-line-number-using-filenameline-nbr%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay