Menu

Rusty Vim

17th August 2024 - Development
Rusty Vim

Following on from my previous post about getting a simple hello world with Zig, I’ve decided to pile on the shenanigans by installing Rust and creating a simple app using NeoVim.

On Rocky 9.

In my previous foray with Zig I rubbed against the usual linux distro landscape fracture but at least zig has its own toolchain. With Rust, the whole gcc toolchain is required. Which, to the unitiated, can be a bit, well, opaque.

Install Rust

The GCC toolchain is required, so install using the redhat group install. There is a manual list of dependencies for Rust, but I have things to do for the rest of the week, so I’ll install the group instead.

As ever, you may need to install the “epel-release” Extended Packages for Enterprise Linux, Redhat package.

sudo dnf check-update
sudo dnf update
sudo dnf install epel-release
sudo yum groupinstall 'Development Tools'

Install using the rustup script

curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Then to confirm the installation

rustc --version

Install NeoVim

NeoVim (2014) is the next generation script editor, an extension of vim (1991), which in turn is a reimagining of Bill Joys vi, a clone of Stevies editor on the Atari ST (1987).

It has a plugin system which enables the use of Language Server Plugins (LSP) that allow syntax highlighting, ML based suggestions and linting for programming languages.

The key features of neovim are the rapid movement around text based content via key chords and key arrangement.

It also allows very specific configuration to allow individual developers to tailor the text editor to their specific requirements.

First Rust App

Start neovim

./nvim.appimage

Add the following code

fn main() {
    println!("Hello to the world of rust and neovim!");
}

Save the file using normal vim :saveas rusthello.rs command

Then quit neovim using :q! and compile the code

rustc rusthello.rs

And run the resulting application

./rusthello

Leave a Reply