{"id":17204036,"url":"https://github.com/ivanceras/rust-vim-setup","last_synced_at":"2026-03-06T03:32:43.986Z","repository":{"id":76197770,"uuid":"37472460","full_name":"ivanceras/rust-vim-setup","owner":"ivanceras","description":"Setting up vim to be used in rust development","archived":false,"fork":false,"pushed_at":"2020-07-02T23:52:25.000Z","size":3391,"stargazers_count":193,"open_issues_count":2,"forks_count":16,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-09-21T12:43:03.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanceras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-06-15T15:06:48.000Z","updated_at":"2025-01-11T09:27:03.000Z","dependencies_parsed_at":"2023-02-27T13:30:54.173Z","dependency_job_id":null,"html_url":"https://github.com/ivanceras/rust-vim-setup","commit_stats":{"total_commits":44,"total_committers":7,"mean_commits":6.285714285714286,"dds":"0.38636363636363635","last_synced_commit":"c01fa411a602a3bc48e45c3a6e96fd228d2e5242"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivanceras/rust-vim-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanceras%2Frust-vim-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanceras%2Frust-vim-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanceras%2Frust-vim-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanceras%2Frust-vim-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanceras","download_url":"https://codeload.github.com/ivanceras/rust-vim-setup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanceras%2Frust-vim-setup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30160894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T02:20:21.759Z","updated_at":"2026-03-06T03:32:43.967Z","avatar_url":"https://github.com/ivanceras.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Use VIM as your RUST IDE\n\n\n### Install vim first, if its not already\n\n```sh\n\nsudo apt-get install vim\n```\nIf `vi` worked in your command line, it is most likely the light version of `vi` which is installed by default in Ubuntu, and it lacks most functionality of the real `vi`.\n\n\nYou also need to install\n\n* `curl`\n* `git`\n* `CMake`\n* Python Headers\n* Development Tools\n\nI assume most of you have already installed it, if not then install it via\n\n```sh\n\nsudo apt-get install curl\nsudo apt-get install git\nsudo apt-get install build-essential cmake\nsudo apt-get install python-dev python3-dev\n```\n\n\n\n\n### Install pathogen plugin\n[Pathogen](https://github.com/tpope/vim-pathogen) is a vim plugin which allows you to easily install other plugins, by just adding files into the `~/.vim/bundle` (There are other alternatives, but pathogen is most commonly used)\n\n```sh\n\nmkdir -p ~/.vim/autoload ~/.vim/bundle\ncurl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim\n```\n* Add this to `~/.vimrc`\n\n```sh\nexecute pathogen#infect()\nsyntax on\nfiletype plugin indent on\n```\n\n\n\n\n### Install syntax highlighting for rust\n\n```sh\n\ncd ~/.vim/bundle\ngit clone https://github.com/rust-lang/rust.vim.git\n```\n\n\n\n### Install YouCompleteMe\n\n[YouCompleteMe](https://github.com/Valloric/YouCompleteMe) - a code-completion engine for Vim with support for C-family languages and [Rust](http://blog.jwilm.io/youcompleteme-rust)\n\n```sh\ncd ~/.vim/bundle\n\ngit clone https://github.com/Valloric/YouCompleteMe\n\ncd ~/.vim/bundle/YouCompleteMe\n\ngit submodule update --init --recursive\n\n./install.py --rust-completer\n\n```\n\n* Download source code of the rust version you are using, for example [master branch](https://github.com/rust-lang/rust/)\n* Extract the zip file and put in your Development folder ie. `~/Developer`\n* Checkout and build racer\n\n```sh\n\nmkdir -p ~/Developer/\ncd ~/Developer/\ngit clone --depth 1 --branch master https://github.com/rust-lang/rust rust-master\n\n```\nAdd this to your `.vimrc`\n\n```sh\nlet g:ycm_rust_src_path=\"/home/\u003cusername\u003e/Developer/rust-master/src/\"\n```\n\n\n\n### Install Vim number toggle\n\n[vim-numbertoggle](https://github.com/jeffkreeftmeijer/vim-numbertoggle) adds line numbers to the code you are editing.\nLine numbers can either show absolute position or position relative to your cursor location.\nThis will boost your productivity later, when you orchestrate vim commands such as moving 10 lines below the current cursor position: `10j`.\n\n\n\n```sh\n\ncd ~/.vim/bundle\ngit clone git://github.com/jeffkreeftmeijer/vim-numbertoggle.git\n```\n\n\n\n### Install `NERDtree` for displaying files in a tab\n[NERDTree](https://github.com/scrooloose/nerdtree) is a file manager, that most text editors have, such as `sublime`, `atom`, or `eclipse` where it lists the files in the directory you are editing from.\n\n```sh\n\ncd ~/.vim/bundle\ngit clone https://github.com/scrooloose/nerdtree.git\n```\n* Add this to `~/.vimrc`\n\n```\nautocmd VimEnter * NERDTree\nautocmd BufEnter * NERDTreeMirror\n\n\"CTRL-t to toggle tree view with CTRL-t\nnmap \u003csilent\u003e \u003cC-t\u003e :NERDTreeToggle\u003cCR\u003e\n\"Set F2 to put the cursor to the nerdtree\nnmap \u003csilent\u003e \u003cF2\u003e :NERDTreeFind\u003cCR\u003e\n```\n\n\n\n\n\n## Controls\n\n```sh\n\nCTRL-t  - Open/Close the files tab\nCTRL-n  - Toggle relative / absolute numbering\nCTRL-ww - Switch between the files tab and the main window\nF2      - Focus cursor to files tab\n\u003cEnter\u003e - Open the focused files/directory, duh!\nh,j,k,l - Navigate the cursor left, down, up, right respectively\ni       - Insert mode, you can start typing in your code.\n\u003cESC\u003e   - Back to default mode, where you can issue commands in vi\n:w      - Write/save the file, you are editing\n:wqa    - Save the file, then quit the editor closing vi including the files tab\n```\n## Some advance commands\n\n```sh\n\n:bp                 - Open previous file/buffer\n:bn                 - Open next file/buffer\n:b \u003cfilename-part\u003e  - Open the file you are looking for without typing the exact filename\n:vsp                - Vertically split the window\n:vsp \u003cfilename\u003e     - Open the file in vertical split\n:sp                 - Horizontal split\n:sp \u003cfilename\u003e      - Open the file in horizontal split\n\n```\n* You don't really have to quit the editor using `wq` whenever you want to build the project.\nA convenient way is to open a new tab in a terminal via `\u003cCTRL\u003e-\u003cSHIFT\u003e-t`\nand issue your command (`cargo build --release`) from there. That way, you don't lose the state of your editor,\ni.e. you can undo `u` or redo `\u003cCTRL\u003e-r` your code changes when needed\n\n## Compile without opening another tab\nAlternatively, you can compile your project without opening another terminal instance by issuing the command directly from `vim` using `:! \u003cexternal terminal command\u003e`\n\n```sh\n:! cargo run --release\n```\n\n\n\n## Try to `vi`ew some files\n\n```sh\n\nvi main.rs\n```\n\n\n* It should look something like this\n\n![](https://raw.githubusercontent.com/ivanceras/rust-vim-setup/master/rust-vim.png)\n\n\n\n## Enable mouse support\n\nIf you want to use the mouse to point and click files and move the cursor around, add this to your `~/.vimrc`\n\n```\n\n\"enable mouse support\nset mouse=a\n```\n\nAdditionally, you can use arrow keys to move the cursor around.\nHowever, if you are really serious about using `vi` and want to maximize your `vi` skills, you should minimize the use of the arrow keys or the mouse.\n\n![Using Mouse](https://raw.githubusercontent.com/ivanceras/rust-vim-setup/master/using-mouse.gif)\n\n## A helpful vim cheatsheet at\n* http://vim.rtorr.com/\n* [My Comprehensive List](https://github.com/ivanceras/rust-vim-setup/blob/master/VIM_Notes.md)\n\n\n## Automatically reload files when changed\n\nSometimes some of your files might get edited outside of your current `vi` session, such as other editors/code generators, dropbox sync, git pulls.\n\n* Add this to your `~/.vimrc` to refresh them automatically\n\n```\n\n\" check file change every 4 seconds ('CursorHold') and reload the buffer upon detecting change\nset autoread\nau CursorHold * checktime  \n```\n\n## Enable the global Clipboard in vim\nIn Linux distros, you have to install `vim-gtk` to gain clipboard functionality.\n\n[More information here.](http://stackoverflow.com/questions/3961859/how-to-copy-to-clipboard-using-vim)\n\n```sh\n\nsudo apt-get install vim-gtk\n\n```\nThen you can\n\nCopy to `+` register, which is the global/OS clipboard\n`\"+y`\n\nPaste from `+` register\n`\"+p`\n\n\nPasting is equivalent to `\u003cCTRL\u003e-\u003cSHIFT\u003e-v` in insert mode.\nIt is equivalent to pasting (`\u003cCTRL\u003e-v`) in terminal.\n\n\n\n## One step install for those who have never used vim before or people who want to do it automatically\n* This will replace your existing `~/.vimrc` and `.vim`, if you have one\n* Don't hold me responsible for breaking your vim configuration, your laundry machine or anything else that would make you angry.\n\n```sh\n\nsudo apt-get install curl\n\ncurl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh\n\n```\n\n## Update\n\n* Update it via (same as setup)\n\n```sh\n\ncurl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh\n\n```\n\n## Uninstall\n\n```sh\n\ncurl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/uninstall.sh | sh\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanceras%2Frust-vim-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanceras%2Frust-vim-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanceras%2Frust-vim-setup/lists"}