# rust on vim: a beginner config

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][1].

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][2]. Developed by the rust-lang team, it seems to be a good choice. Since I use [vim-plug][3], I had nothing else to do that:

```vim
" 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][4]. 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.

[1]: https://www.rust-lang.org/static/pdfs/Rust-Tilde-Whitepaper.pdf
[2]: https://github.com/rust-lang/rust.vim
[3]: https://github.com/junegunn/vim-plug
[4]: https://github.com/junegunn/vim-plug#usage
