rust on vim: a beginner config

·

2 min read

I recently started to learn rust.

Learning a new programming language is a good exercise to get an other point of view, an other way of thinking.

For two years now, I mainly write my programs in javascript by using nodejs. As you know, the lack off type checking is a black point if you like to have a "strict" structure. And javascript is a high-level and interpreted language: less memory efficient and all the debugging occurs at run-time but easy to learn and mainly used to create prototype. But if you want to deploy in production a program written in javascript, it can be really to handle. That's why I want to learn a statically-typed programming language with low memory usage.

The first thing I do is to configure my code editor (vim). Here is a vim config for rust (made by a beginner).


The first link I clicked on was rust.vim. Developed by the rust-lang team, it seems to be a good choice. Since I use vim-plug, I had nothing else to do that:

" plugins directory
call plug#begin('$HOME/.vim/plugged')
Plug 'rust-lang/rust.vim'
call plug#end()

vim-plug automatically executes filetype plugin indent on and syntax enable on its initialization. These two commands are required by rust.vim.

I do not know yet if it is a good choice to enable the formatting on save when we start to lean a new programming language. So I have skipped the option let g:rustfmt_autosave = 1.

Let's start this new journey.