GithubHelp home page GithubHelp logo

templatek / cargo.el Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kwrooijen/cargo.el

0.0 0.0 0.0 156 KB

Emacs Minor Mode for Cargo, Rust's Package Manager.

License: GNU General Public License v3.0

Emacs Lisp 100.00%

cargo.el's Introduction

cargo.el

Cargo mode for Emacs. This package gives you a set of key combinations to perform Cargo tasks within your Rust projects.

NOTICE

Currently I'm not using Rust, nor will I in the (near) future. I've lost track of all the Rust / Cargo features available and can keep up-to-date with new ones. I won't be doing bug fixes but will keep reviewing / merging Pull requests.

Installation

This package can be installed through melpa:

M-x package-install cargo

Usage

Add cargo-minor-mode to your rust-mode-hook

(add-hook 'rust-mode-hook 'cargo-minor-mode)

You will now have the following key combinations at your disposal:

Keybinding Command
C-c C-c C-e cargo-process-bench
C-c C-c C-b cargo-process-build
C-c C-c C-l cargo-process-clean
C-c C-c C-d cargo-process-doc
C-c C-c C-v cargo-process-doc-open
C-c C-c C-n cargo-process-new
C-c C-c C-i cargo-process-init
C-c C-c C-r cargo-process-run
C-c C-c C-x cargo-process-run-example
C-c C-c C-s cargo-process-search
C-c C-c C-t cargo-process-test
C-c C-c C-u cargo-process-update
C-c C-c C-c cargo-process-repeat
C-c C-c C-f cargo-process-current-test
C-c C-c C-o cargo-process-current-file-tests
C-c C-c C-m cargo-process-fmt
C-c C-c C-k cargo-process-check
C-c C-c C-S-k cargo-process-clippy
C-c C-c C-a cargo-process-add
C-c C-c C-S-d cargo-process-rm
C-c C-c C-S-u cargo-process-upgrade
C-c C-c C-S-a cargo-process-audit

Before executing the task, Emacs will prompt you to save any modified buffers associated with the current Cargo project. Setting compilation-ask-about-save to nil makes Emacs save modified buffers without asking.

Variables

Commands can be adjusted by changing their command variable. Here's a list of commands and their default value.

(setq cargo-process--command-bench "bench")
(setq cargo-process--command-build "build")
(setq cargo-process--command-clean "clean")
(setq cargo-process--command-doc "doc")
(setq cargo-process--command-doc-open "doc --open")
(setq cargo-process--command-new "new")
(setq cargo-process--command-init "init")
(setq cargo-process--command-run "run")
(setq cargo-process--command-run-bin "run --bin")
(setq cargo-process--command-run-example "run --example")
(setq cargo-process--command-search "search")
(setq cargo-process--command-test "test")
(setq cargo-process--command-current-test "test")
(setq cargo-process--command-current-file-tests "test")
(setq cargo-process--command-update "update")
(setq cargo-process--command-fmt "fmt")
(setq cargo-process--command-check "check")
(setq cargo-process--command-clippy "clippy")
(setq cargo-process--command-add "add")
(setq cargo-process--command-rm "rm")
(setq cargo-process--command-upgrade "upgrade")
(setq cargo-process--command-audit "audit -f")

Advanced usage

If you invoke the prefix argument C-u before calling any of the functions, you may edit the Cargo command before it is run. This allows you to add flags like --release, for example.

Processes run via Cargo mode make use of compilation mode. This mode provides features like jumping to errors or killing runaway processes. By default, in compilation mode, C-c C-k is bound to the command kill-compilation.

Notes

In order to run cargo-process-fmt you need to have the rustfmt package installed.

rustup component add rustfmt-preview

In order to run cargo-process-check you need to have the cargo-check package installed.

cargo install cargo-check

In order to run cargo-process-clippy you need to have the clippy package installed.

cargo install clippy

In order to run cargo-process-{add,rm,upgrade} you need to have the cargo-edit package installed.

cargo install cargo-edit

For completion in cargo-process-add, configure cargo-process-favorite-crates.

In order to run cargo-process-audit you need to have the audit package installed.

cargo install cargo-audit

cargo.el's People

Contributors

clarkenciel avatar dalz avatar derickeddington avatar drrlvn avatar dushistov avatar f-fr avatar farva avatar higuoxing avatar hotpxl avatar jo-so avatar kwrooijen avatar matthewjberger avatar mookid avatar mrbliss avatar msherry avatar netromdk avatar nlamirault avatar philipbadams avatar r-darwish avatar ralexstokes avatar sebastiencs avatar shepmaster avatar smaximov avatar studer-l avatar syohex avatar topecongiro avatar tyoverby avatar yasushi avatar youngker avatar zhaojiangbin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.