Skip to content

Commit

Permalink
laptop.sh: install Rust toolchain
Browse files Browse the repository at this point in the history
Configure Vim auto-formatting and run-from-file.
  • Loading branch information
croaky committed Aug 27, 2021
1 parent 1d08e74 commit 883bd15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions laptop.sh
Expand Up @@ -196,3 +196,13 @@ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

# Solana
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

# Rust
if ! command -v rustup &> /dev/null; then
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
fi

if ! command -v rustfmt &> /dev/null; then
rustup component add rustfmt
fi
5 changes: 5 additions & 0 deletions vim/ftplugin/rust.vim
@@ -0,0 +1,5 @@
" Auto-fix
let g:rustfmt_autosave = 1

" Run current file
nmap <buffer> <Leader>r :!clear && cargo run<CR>
4 changes: 4 additions & 0 deletions vim/vimrc
Expand Up @@ -92,6 +92,9 @@ call plug#begin('~/.vim/plugged')
" Go
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }

" Rust
Plug 'rust-lang/rust.vim'

" Ruby
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
Expand Down Expand Up @@ -125,6 +128,7 @@ let g:coc_global_extensions = [
\ 'coc-go',
\ 'coc-html',
\ 'coc-prettier',
\ 'coc-rls',
\ 'coc-svelte',
\ 'coc-tsserver'
\ ]
Expand Down

0 comments on commit 883bd15

Please sign in to comment.