How can I compile vim for my user only so set source path to /home/user/ ?

And how can I track changes with git.

Basically I want to build and compile vim from source, and store it on my github repo. Then other users can download the vim from github and use it.

  • 1
    Git isn't really a great way to distribute binaries (compiled code), since each change would not be well represented as a diff.
    – tommcdo
    Mar 29, 2018 at 4:18

1 Answer 1

  1. Google for vim to find their homepage. You find http://www.vim.org .
  2. Look on their homepage, where is their upstream source. If you have luck, they are on the github.
  3. On the "Download" section, they show many of their upstreams, first is the github one.
  4. They say, git clone https://github.com/vim/vim.git is the clone command what you want, however you want likely to register/login github1 (later I explain why).
  5. So go to their github page, https://github.com/vim/vim.git , which redirects to their project page, https://github.com/vim/vim . This is the official upstream. Many project has only a mirror on the github, typically you can't issue merge requests for them, and they may be late (sometimes even with years). This time, not this is the case.
  6. Fork the project by clicking the "Fork" button on the github. Now you have your cloned repository, in https://github.com/<yourusername>/vim.git .
  7. Clone this into your computer with the command git clone git@github.com:<yourusername>/vim.git. Do this into your home.
  8. Now you have the latest vim sources in your /home/user/vim directory.
  9. Compile this as they say, which is typically a ./configure command. However, you want to install it into your home, so you need also a --prefix=/home/<yourusername>/vim-dist or similar flag.
  10. Put also other flags, as ./configure --help explains. Selecting them may be a big work, but it worths its price.
  11. Add also the upstream repository to the remote repositories with the command git remote add upstream git@github.com:vim/vim.git, followed by a get fetch --all. In this scenario, you will working and commiting to your own repository, but you will be able to fetch newer commit (= changes) from the upstream.
  12. You may not surely work on their master branch, but it is very likely, because they don't use branches, only tags.
  13. So, after compiling git, install it with make install. The --prefix flag in your configuration step guarantees that this will install vim into your /home/<yourusername>/vim-dist directory.
  14. A well-working project should have to use a correct .gitignore, i.e. compilation-time generated temporary files (objects, for example) should exist as new source file, rather they should be ignored by the git. You can check this with a git status command. If you see new files in the compilation, then your first task is to fix their .gitignore and make a pull request from that.
  15. It is possible, that some of your libraries won't exist on the system, the configure script will explain, which ones. You will need to find and compile also them, if you don't have a root account to install packages system-wide.
  16. Tune your initfiles to use the vim in your installation path: either you can put /home/<yourusername>/vim-dist/bin into your PATH, or you can have a /home/<yourusername>/bin directory, which is already included into your PATH, and which contains wrapper script to anything what you are installing as a user.
  17. Sometimes it is useful to fetch the upstream changes with a git fetch --all, and merge them into your according branch(es), this time git merge remotes/upstream/master.
  18. If you make a change, it is practical to upload to the github with a git push.
  19. If you make an useful change, go to page of your fork, (https://github.com/<yourusername>/vim), and click create pull request. This advices your changes to the upstream developers, who may decide to include your commits into the upstream repository. It is a big glory, if it first time happens.

Good luck!

1Meanwhile, Github was bought by the Microsoft, and it is now a Microsoft division. Being likely an opensource enthusiast, it is up to you, how it will affect your free hosting choices. I personally moved to here.

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.