How can the cursor position in VIM be synchronized on multiple machines?












1















I know that vim can remember the cursor's position of a previous editing session. But this feature is not so helpful while I'm working on a C source file both at home and office using two machines. The file I'm editing is synchronized via iCloud Drive. So I suppose only the C file itself is being synchronized, but the 'hidden file' storing the cursor position for VIM is not.



Is there a way to synchronize the cursor's position in my case?










share|improve this question























  • Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

    – Ed Grimm
    Jan 27 at 2:57











  • Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

    – Lidan
    Jan 28 at 6:37


















1















I know that vim can remember the cursor's position of a previous editing session. But this feature is not so helpful while I'm working on a C source file both at home and office using two machines. The file I'm editing is synchronized via iCloud Drive. So I suppose only the C file itself is being synchronized, but the 'hidden file' storing the cursor position for VIM is not.



Is there a way to synchronize the cursor's position in my case?










share|improve this question























  • Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

    – Ed Grimm
    Jan 27 at 2:57











  • Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

    – Lidan
    Jan 28 at 6:37
















1












1








1








I know that vim can remember the cursor's position of a previous editing session. But this feature is not so helpful while I'm working on a C source file both at home and office using two machines. The file I'm editing is synchronized via iCloud Drive. So I suppose only the C file itself is being synchronized, but the 'hidden file' storing the cursor position for VIM is not.



Is there a way to synchronize the cursor's position in my case?










share|improve this question














I know that vim can remember the cursor's position of a previous editing session. But this feature is not so helpful while I'm working on a C source file both at home and office using two machines. The file I'm editing is synchronized via iCloud Drive. So I suppose only the C file itself is being synchronized, but the 'hidden file' storing the cursor position for VIM is not.



Is there a way to synchronize the cursor's position in my case?







vim sync cursor






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 27 at 2:20









LidanLidan

61




61













  • Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

    – Ed Grimm
    Jan 27 at 2:57











  • Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

    – Lidan
    Jan 28 at 6:37





















  • Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

    – Ed Grimm
    Jan 27 at 2:57











  • Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

    – Lidan
    Jan 28 at 6:37



















Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

– Ed Grimm
Jan 27 at 2:57





Short of copying your .viminfo file to a USB stick you carry with you or upload and download from your clound drive? That sounds tricky. Could you configure your .vimrc to store your .viminfo on your cloud drive? I've never used them, so I don't know how they work in practice.

– Ed Grimm
Jan 27 at 2:57













Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

– Lidan
Jan 28 at 6:37







Thanks for your answer! I just found "session-file" for vim which perfectly solves my problem. By typing a ":mksession" command in normal mode, a new file named "Session.vim" will be saved. It captures all the settings for the current session - even those for multiple files. When I work from the other computer, just typing "vim -S Session.vim" will do the trick!

– Lidan
Jan 28 at 6:37












1 Answer
1






active

oldest

votes


















0














Just to convert that guess of a comment into an official answer since it turned out to be right...



Configure your .vimrc to store your .viminfo on your cloud drive.



Or, as you noted, at the end of your session, run :mksession filename, specifying a path that would put it on your cloud drive. Then at the start of your next session, :source that file into vim.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398848%2fhow-can-the-cursor-position-in-vim-be-synchronized-on-multiple-machines%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Just to convert that guess of a comment into an official answer since it turned out to be right...



    Configure your .vimrc to store your .viminfo on your cloud drive.



    Or, as you noted, at the end of your session, run :mksession filename, specifying a path that would put it on your cloud drive. Then at the start of your next session, :source that file into vim.






    share|improve this answer




























      0














      Just to convert that guess of a comment into an official answer since it turned out to be right...



      Configure your .vimrc to store your .viminfo on your cloud drive.



      Or, as you noted, at the end of your session, run :mksession filename, specifying a path that would put it on your cloud drive. Then at the start of your next session, :source that file into vim.






      share|improve this answer


























        0












        0








        0







        Just to convert that guess of a comment into an official answer since it turned out to be right...



        Configure your .vimrc to store your .viminfo on your cloud drive.



        Or, as you noted, at the end of your session, run :mksession filename, specifying a path that would put it on your cloud drive. Then at the start of your next session, :source that file into vim.






        share|improve this answer













        Just to convert that guess of a comment into an official answer since it turned out to be right...



        Configure your .vimrc to store your .viminfo on your cloud drive.



        Or, as you noted, at the end of your session, run :mksession filename, specifying a path that would put it on your cloud drive. Then at the start of your next session, :source that file into vim.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 2 at 1:44









        Ed GrimmEd Grimm

        1266




        1266






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398848%2fhow-can-the-cursor-position-in-vim-be-synchronized-on-multiple-machines%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Mouse cursor on multiple screens with different PPI

            Agildo Ribeiro

            Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”