Protect rust source files under ~/.rustup/toolchains/ with NeoVim

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • vim-readonly

    :eyes: Automatically set readonly option on specific files

  • _G.protect_rust_toolchain = function() -- protect rust source files under ~/.rustup/toolchains/ -- idea from https://github.com/Xvezda/vim-readonly/blob/master/plugin/readonly.vim -- and https://github.com/rust-lang/rustup/issues/2550 local rustup_toolchain_root = "" .. vim.fn.expand "~" .. "/.rustup/toolchains/" if string.match(vim.fn.expand "%:p", rustup_toolchain_root) ~= nil then vim.bo.readonly = true vim.bo.modifiable = false end end vim.api.nvim_command("autocmd BufReadPost *.rs lua protect_rust_toolchain()")

  • Rustup

    The Rust toolchain installer

  • _G.protect_rust_toolchain = function() -- protect rust source files under ~/.rustup/toolchains/ -- idea from https://github.com/Xvezda/vim-readonly/blob/master/plugin/readonly.vim -- and https://github.com/rust-lang/rustup/issues/2550 local rustup_toolchain_root = "" .. vim.fn.expand "~" .. "/.rustup/toolchains/" if string.match(vim.fn.expand "%:p", rustup_toolchain_root) ~= nil then vim.bo.readonly = true vim.bo.modifiable = false end end vim.api.nvim_command("autocmd BufReadPost *.rs lua protect_rust_toolchain()")

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • nvim-config

    following HEAD (nightly build) neovim lua config, for Linux only, clone it to `~/.config/nvim` (by ttys3)

  • and the commit of my config here: https://github.com/ttys3/nvim-config/commit/9b0f8b2fdf8d8392e55b147e259c261991e761e9

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts