Vim configuration for Rust.

Related tags

IDEs rust.vim
Overview

rust.vim

Description

This is a Vim plugin that provides Rust file detection, syntax highlighting, formatting, Syntastic integration, and more. It requires Vim 8 or higher for full functionality. Some things may not work on earlier versions.

Installation

For activating the full functionality, this plugin requires either the plugin manager or the .vimrc to have the following:

syntax enable
filetype plugin indent on

Most plugin managers don't do this automatically, so these statements are usually added by users in their vimrc right after the plugin manager load section.

Vim8 packages

git clone https://github.com/rust-lang/rust.vim ~/.vim/pack/plugins/start/rust.vim

Vundle

Plugin 'rust-lang/rust.vim'

Pathogen

git clone --depth=1 https://github.com/rust-lang/rust.vim.git ~/.vim/bundle/rust.vim

vim-plug

Plug 'rust-lang/rust.vim'

dein.vim

call dein#add('rust-lang/rust.vim')

NeoBundle

NeoBundle 'rust-lang/rust.vim'

Features

Error checking with Syntastic

rust.vim automatically registers cargo as a syntax checker with Syntastic, if nothing else is specified. See :help rust-syntastic for more details.

Source browsing with Tagbar

The installation of Tagbar along with Universal Ctags is recommended for a good Tagbar experience. For other kinds of setups, rust.vim tries to configure Tagbar to some degree.

Formatting with rustfmt

The :RustFmt command will format your code with rustfmt if installed. rustfmt can be installed via rustup component add rustfmt.

Placing let g:rustfmt_autosave = 1 in your ~/.vimrc will enable automatic running of :RustFmt when you save a buffer.

Do :help :RustFmt for further formatting help and customization options.

Playpen integration

Note: This feature requires webapi-vim to be installed.

The :RustPlay command will send the current selection, or if nothing is selected the current buffer, to the Rust playpen.

If you set g:rust_clip_command RustPlay will copy the url to the clipboard.

  • Mac:

    let g:rust_clip_command = 'pbcopy'
    
  • Linux:

    let g:rust_clip_command = 'xclip -selection clipboard'
    

Running a test under cursor

In a Cargo project, the :RustTest command will run the test that is under the cursor. This is useful when your project is big and running all of the tests takes a long time.

Help

Further help can be found in the documentation with :Helptags then :help rust.

Detailed help can be found in the documentation with :help rust. Helptags (:help helptags) need to be generated for this plugin in order to navigate the help. Most plugin managers will do this automatically, but check their documentation if that is not the case.

License

Like Rust, rust.vim is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.

Comments
  • Add support for new error format

    Add support for new error format

    This adds basic support for the new rustc error format used in recent nightlies. It appears to be working, but it's possible I've missed some edge cases, so comments are welcome.

    Also, I'm not at all familiar with syntastic or how it works, so I haven't tested that part yet. If someone who uses that plugin could give this a try and let me know if it's broken, that would be great.

    opened by jpernst 34
  • vim shows whole file (with

    vim shows whole file (with "--- More ---" scrolling) when saving

    So, I have some weird issues when saving files using rust.vim. Whenever I changed a file and want to save it, vim displays the whole file in that scrollable mode (--- More --- at the bottom line, scrolling with arrow keys) and only when I scroll to the bottom, the file gets saved. This does not happen without rust.vim.

    I use pathogen and have nerdtree, youcompleteme, syntastic and rust.vim in my bundle folder.

    vim --version:

    $ vim --version
    VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 19 2016 22:56:19)
    Included patches: 1-1000
    Compiled by jan@jan-laptop
    Huge version with GTK2 GUI.  Features included (+) or not (-):
    +acl             +farsi           +mouse_netterm   +syntax
    +arabic          +file_in_path    +mouse_sgr       +tag_binary
    +autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
    +balloon_eval    +float           +mouse_urxvt     -tag_any_white
    +browse          +folding         +mouse_xterm     -tcl
    ++builtin_terms  -footer          +multi_byte      +terminfo
    +byte_offset     +fork()          +multi_lang      +termresponse
    +cindent         +gettext         -mzscheme        +textobjects
    +clientserver    -hangul_input    +netbeans_intg   +title
    +clipboard       +iconv           +path_extra      +toolbar
    +cmdline_compl   +insert_expand   -perl            +user_commands
    +cmdline_hist    +jumplist        +persistent_undo +vertsplit
    +cmdline_info    +keymap          +postscript      +virtualedit
    +comments        +langmap         +printer         +visual
    +conceal         +libcall         +profile         +visualextra
    +cryptv          +linebreak       +python          +viminfo
    +cscope          +lispindent      -python3         +vreplace
    +cursorbind      +listcmds        +quickfix        +wildignore
    +cursorshape     +localmap        +reltime         +wildmenu
    +dialog_con_gui  -lua             +rightleft       +windows
    +diff            +menu            -ruby            +writebackup
    +digraphs        +mksession       +scrollbind      +X11
    +dnd             +modify_fname    +signs           -xfontset
    -ebcdic          +mouse           +smartindent     +xim
    +emacs_tags      +mouseshape      -sniff           +xsmp_interact
    +eval            +mouse_dec       +startuptime     +xterm_clipboard
    +ex_extra        -mouse_gpm       +statusline      -xterm_save
    +extra_search    -mouse_jsbterm   -sun_workshop    +xpm
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
          user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
        user gvimrc file: "$HOME/.gvimrc"
    2nd user gvimrc file: "~/.vim/gvimrc"
        system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/usr/local/share/vim"
     f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
    Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
    Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lXt -lX11 -lSM -lICE  -lm -lncurses -lacl -L/usr/lib/python2.7/config -lpython2.7 -ldl -lutil -lm -Xlinker -export-dynamic 
    
    opened by Rukenshia 22
  • Improved syntastic linting

    Improved syntastic linting

    This PR builds on PR #72 .

    There's a new option to choose between fast lint (parse-only) or comprehensive (no-trans). You can change this at runtime too.

    Possible improvements include a buffer-local variable so that you can have different projects with different linting levels.

    opened by somini 20
  • RustFmt is slow with foldmethod=syntax

    RustFmt is slow with foldmethod=syntax

    Hi,

    when I run :RustFmt on a file under macOS Mojave it takes over three seconds for it to complete. Running the same on the command line completes instantly:

    $ time rustfmt src/main.rs
    rustfmt src/main.rs  0.03s user 0.01s system 90% cpu 0.045 total
    

    :RustInfo

    rust.vim Global Variables:
    let g:ftplugin_rust_source_path = v:null
    let g:loaded_syntastic_rust_cargo_checker = v:null
    let g:loaded_syntastic_rust_filetype = v:null
    let g:loaded_syntastic_rust_rustc_checker = v:null
    let g:rust_bang_comment_leader = v:null
    let g:rust_cargo_avoid_whole_workspace = v:null
    let g:rust_clip_command = v:null
    let g:rust_conceal = v:null
    let g:rust_conceal_mod_path = v:null
    let g:rust_conceal_pub = v:null
    let g:rust_fold = 1
    let g:rust_last_args = v:null
    let b:rust_last_args = []
    let g:rust_last_rustc_args = v:null
    let b:rust_last_rustc_args = []
    let g:rust_original_delimitMate_excluded_regions = v:null
    let g:rust_playpen_url = v:null
    let g:rust_prev_delimitMate_quotes = v:null
    let g:rust_recent_nearest_cargo_tol = v:null
    let g:rust_recent_root_cargo_toml = v:null
    let g:rust_recommended_style = v:null
    let g:rust_set_conceallevel = v:null
    let g:rust_set_conceallevel=1 = v:null
    let g:rust_set_foldmethod = v:null
    let b:rust_set_foldmethod = 1
    let g:rust_set_foldmethod=1 = v:null
    let g:rust_shortener_url = v:null
    let g:rustc_makeprg_no_percent = v:null
    let g:rustc_path = v:null
    let g:rustfmt_autosave = 0
    let g:rustfmt_autosave_because_of_config = v:null
    let g:rustfmt_autosave_if_config_present = v:null
    let g:rustfmt_command = 'rustfmt'
    let g:rustfmt_emit_files = 1
    let g:rustfmt_fail_silently = 0
    let g:rustfmt_options = ''
    let g:syntastic_extra_filetypes = ['rust']
    let g:syntastic_rust_cargo_fname = v:null
    rustfmt 1.0.0-stable (4a4e5081 2018-11-29)
    rustc 1.31.1 (b6c32da9b 2018-12-18)
    cargo 1.31.0 (339d9f9c8 2018-11-16)
    
    VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 29 2018 06:55:58)
    macOS version
    Included patches: 1-500
    Compiled by Homebrew
    Huge version without GUI.  Features included (+) or not (-):
    +acl               +channel           +cscope            +ex_extra          -hangul_input      +lispindent        -mouse_gpm         +netbeans_intg     +python3           -sun_workshop      +textobjects       +viminfo           -xsmp
    +arabic            +cindent           +cursorbind        +extra_search      +iconv             +listcmds          -mouse_jsbterm     +num64             +quickfix          +syntax            +timers            +vreplace          -xterm_clipboard
    +autocmd           -clientserver      +cursorshape       +farsi             +insert_expand     +localmap          +mouse_netterm     +packages          +reltime           +tag_binary        +title             +wildignore        -xterm_save
    +autochdir         +clipboard         +dialog_con        +file_in_path      +job               -lua               +mouse_sgr         +path_extra        +rightleft         +tag_old_static    -toolbar           +wildmenu
    -autoservername    +cmdline_compl     +diff              +find_in_path      +jumplist          +menu              -mouse_sysmouse    +perl              +ruby              -tag_any_white     +user_commands     +windows
    -balloon_eval      +cmdline_hist      +digraphs          +float             +keymap            +mksession         +mouse_urxvt       +persistent_undo   +scrollbind        -tcl               +vartabs           +writebackup
    +balloon_eval_term +cmdline_info      -dnd               +folding           +lambda            +modify_fname      +mouse_xterm       +postscript        +signs             +termguicolors     +vertsplit         -X11
    -browse            +comments          -ebcdic            -footer            +langmap           +mouse             +multi_byte        +printer           +smartindent       +terminal          +virtualedit       -xfontset
    ++builtin_terms    +conceal           +emacs_tags        +fork()            +libcall           -mouseshape        +multi_lang        +profile           +startuptime       +terminfo          +visual            -xim
    +byte_offset       +cryptv            +eval              -gettext           +linebreak         +mouse_dec         -mzscheme          -python            +statusline        +termresponse      +visualextra       -xpm
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
          user exrc file: "$HOME/.exrc"
           defaults file: "$VIMRUNTIME/defaults.vim"
      fall-back for $VIM: "/usr/local/share/vim"
    Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
    Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework AppKit   -mmacosx-version-min=10.14 -fstack
    -protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.
    7m -framework CoreFoundation  -lruby.2.5.3 -lobjc
    
    opened by abbec 19
  • Neomake - workspaces are broken

    Neomake - workspaces are broken

    I'm opening this issue just to get some visibility of people that are both Rust user and VimL-versed.

    https://github.com/neomake/neomake/issues/1916

    Let's say you have project a with a/b subcrate.

    If you cd a/b and vim, neomake stops working well, because rustc still displays error paths as b/src/lib.rs (relative to workspace root) while neomake/Vim would like them to be relative to current dir, so just src/lib/rs.

    All it takes to fix (I think) is fixing the path somewhere here: https://github.com/neomake/neomake/blob/master/autoload/neomake/makers/ft/rust.vim#L136 by stripping the prefix.

    But it's currently beyond me, how to do it right, and I don't have time to dedicate to figure it out.

    Please, someone take a look. :)

    opened by dpc 15
  • Can't find directory

    Can't find directory "src" in cdpath when use `:make build`

    • rust.vim version: I use vim-plug to install latest rust.vim master

    Steps to reproduce:

    1. Open a rust source file in src folder
    2. run :compiler cargo
    3. run :make build

    Expected vs. actual behavior: Expected: run cargo build and pop the location list for errors.

    Actual behavior:

    Error detected while processing BufEnter Auto commands for "*":
    E344: Can't find directory "src" in cdpath
    E472: Command failed
    

    Paste debugging info from the Rust Vim plugin via one of the following commands: :RustInfo, :RustInfoToClipboard, or :RustInfoToFile <filename>.

    rust.vim Global Variables:
    
    let g:ftplugin_rust_source_path = v:null
    let g:loaded_syntastic_rust_cargo_checker = v:null
    let g:loaded_syntastic_rust_filetype = v:null
    let g:loaded_syntastic_rust_rustc_checker = v:null
    let g:rust_bang_comment_leader = v:null
    let g:rust_cargo_avoid_whole_workspace = v:null
    let g:rust_clip_command = v:null
    let g:rust_conceal = v:null
    let g:rust_conceal_mod_path = v:null
    let g:rust_conceal_pub = v:null
    let g:rust_fold = v:null
    let g:rust_last_args = v:null
    let b:rust_last_args = []
    let g:rust_last_rustc_args = v:null
    let b:rust_last_rustc_args = []
    let g:rust_original_delimitMate_excluded_regions = v:null
    let g:rust_playpen_url = v:null
    let g:rust_recent_nearest_cargo_tol = v:null
    let g:rust_recent_root_cargo_toml = v:null
    let g:rust_recommended_style = v:null
    let g:rust_set_conceallevel = v:null
    let g:rust_set_conceallevel=1 = v:null
    let g:rust_set_foldmethod = v:null
    let g:rust_set_foldmethod=1 = v:null
    let g:rust_shortener_url = v:null
    let g:rustc_makeprg_no_percent = v:null
    let g:rustc_path = v:null
    let g:rustfmt_autosave = 0
    let g:rustfmt_autosave_because_of_config = v:null
    let g:rustfmt_autosave_if_config_present = v:null
    let g:rustfmt_command = 'rustfmt'
    let g:rustfmt_emit_files = 0
    let g:rustfmt_fail_silently = 0
    let g:rustfmt_options = ''
    let g:syntastic_extra_filetypes = ['rust']
    let g:syntastic_rust_cargo_fname = v:null
    error: toolchain 'stable-x86_64-apple-darwin' does not have the binary `rustfmt`
    
    rustc 1.27.0 (3eda71b00 2018-06-19)
    
    cargo 1.27.0 (1e95190e5 2018-05-27)
    
    
    NVIM v0.3.0
    Build type: Release
    LuaJIT 2.0.5
    Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180612-71518-1f95nfa/neovim-0.3.0/build/config -I/tmp/neovim-20180612-71518-1f95nfa/neovim-0.3.0/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180612-71518-1f95nfa/neovim-0.3.0/build/src/nvim/auto -I/tmp/neovim-20180612-71518-1f95nfa/neovim-0.3.0/build/include
    Compiled by [email protected]
    
    Features: +acl +iconv +jemalloc +tui 
    See ":help feature-compile"
    
       system vimrc file: "$VIM/sysinit.vim"
      fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.0/share/nvim"
    
    Run :checkhealth for more info
    
    opened by VMatrix1900 15
  • Add a cargo checker for syntastic

    Add a cargo checker for syntastic

    Hi there !

    As cargo check has been merged in cargo (see https://github.com/rust-lang/cargo/pull/3296), and the current rustc checker is facing some issues with external crates (see https://github.com/rust-lang/rust.vim/issues/130), I gave a try implementing a cargo checker for syntastic.

    And here is the result. Please note it is my first time writing a syntastic checker, and I'm relatively new to the rust ecosystem, consequently I might have made mistakes, so any feedback will be greatly appreciated !

    It currently works with cargo 0.16.0 nightly.

    Thanks !

    opened by jlevesy 14
  • syntastic is broken (unresolved imports)

    syntastic is broken (unresolved imports)

    hi, syntastic gives me wrong error messages. the code compiles fine with cargo though.

    I have my own crate with submodules. when in submodule1 I import some class from submodule2 with "use submodule2::MyClass"; syntastic launches rustc -Zno-trans src/submodule1.rs which results in unresolved imports (E0259). I asked on irc about that and they told me I should compile the whole crate using cargo and not just the single file.

    opened by wagnerf42 14
  • *.rs is recognized as hercules files

    *.rs is recognized as hercules files

    In vim's official filetype.vim, I found that in line 860:

    au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
    

    Maybe it is better to move ftdetect to after/ftdetect?

    opened by zhou13 14
  • Syntastic doesn't work

    Syntastic doesn't work

    I use Plug (Plug 'scrooloose/syntastic'), Syntastic is enabled but no response when I save a Rust file that contain many errors...

    I use Neovim (NVIM 0.1.5) on macOS.

    This is the output for :SyntasticInfo, for a Rust source code:

    Syntastic version: 3.7.0-224 (Vim 704, Neovim, Darwin)
    Info for filetype: rust
    Global mode: active
    Filetype rust is active
    The current file will be checked automatically
    Available checker: rustc
    Currently enabled checker: rustc
    

    Also, when I manually enter :SyntasticCheck, no output...

    Current Rust compiler: rustc 1.11.0 (9b21dcd6a 2016-08-15).

    If anyone have an idea about what's wrong here, please to comment! :-)
    Thanks

    opened by k0pernicus 13
  • Opening additional buffers causes error message

    Opening additional buffers causes error message

    Steps to reproduce:

    1. Open a rust buffer

    2. Open a second rust buffer See error message:

      Error detected while processing function delimitMate#Get..<SNR>74_get:                                                                  
      line    7:                                                                                                                              
      E716: Key not present in Dictionary: 3.excluded_regions                                                                                 
      E15: Invalid expression: s:options.3.excluded_regions
      
    3. Open a third buffer See error message:

      Error detected while processing function delimitMate#Get..<SNR>74_get:                                                                  
      line    7:                                                                                                                              
      E716: Key not present in Dictionary: 4.excluded_regions                                                                                 
      E15: Invalid expression: s:options.4.excluded_regions
      
    4. And so on...

    opened by euclio 13
  • Migrate from highfive to triagebot

    Migrate from highfive to triagebot

    This migrates this repository from using the highfive bot to using triagebot (aka rustbot).

    This is ready to merge now, feel free to merge to re-enable auto-assignment.

    opened by ehuss 1
  • Allow option to highlight operator `as` as keyword

    Allow option to highlight operator `as` as keyword

    While as is functionally an operator, it is often highlighted as if it were a keyword. This change gives the user the option to link rustOperatorKeyword to Keyword while preserving the current default behavior. This allows for as to be highlighted like a keyword separately from other operators.

    The documentation lists as as a keyword and consistently highlights it as such.

    https://doc.rust-lang.org/std/index.html#keywords https://doc.rust-lang.org/std/keyword.as.html

    opened by mweber15 3
  • Better errorformat

    Better errorformat

    Rust compiler output

    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    did not ignored due to errorformat was set \%Inote:\ %m first. So, change += to ^= solve this problem.

    And, more cargo test cmmand output error: test failed, to rerun pass ... should be ignored.

    I wish this change would apply to vim repository. In vim repository, compiler/cargo.vim is not up-to-date, so we cannot parse error correctly.

    opened by gen740 2
  • Vim crashes when saving files

    Vim crashes when saving files

    rust.vim version:

    I installed the plugin with Vundle. The current commit of the repository it cloned is: commit 4aa69b84c8a58fcec6b6dad6fe244b916b1cf830 (HEAD -> master, origin/master, origin/HEAD)

    Steps to reproduce:

    In terminal: vim hello.rs In vim: :w

    Expected vs. actual behavior:

    • Expected: save the file
    • Actual: editor exits with the following error message:
    [4]+  Stopped                 vim hellp.rs
    exit
    There are stopped jobs.
    

    Running ls -a reveals that there is still a file called .hellp.rs.swp

    Paste debugging info from the Rust Vim plugin via one of the following

    commands: :RustInfo, :RustInfoToClipboard, or :RustInfoToFile <filename>.

    Running any of the commands listed causes a crash similar to the one caused by saving the file.

    Contents of ~/.vimrc:

    set nocompatible              " be iMproved, required
    filetype off                  " required
    
    " set the runtime path to include Vundle and initialize
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    " alternatively, pass a path where Vundle should install plugins
    "call vundle#begin('~/some/path/here')
    
    " let Vundle manage Vundle, required
    Plugin 'VundleVim/Vundle.vim'
    Plugin 'https://github.com/scrooloose/nerdtree'
    Plugin 'https://github.com/jiangmiao/auto-pairs'
    Plugin 'https://github.com/vim-syntastic/syntastic'
    Plugin 'https://github.com/frazrepo/vim-rainbow'
    Plugin 'https://github.com/tpope/vim-surround'
    Plugin 'https://github.com/psf/black'
    Plugin 'https://github.com/Yggdroot/indentLine'
    Plugin 'https://github.com/pedrohdz/vim-yaml-folds'
    Plugin 'https://github.com/rust-lang/rust.vim'
    
    " All of your Plugins must be added before the following line
    call vundle#end()            " required
    filetype plugin indent on    " required
    " To ignore plugin indent changes, instead use:
    "filetype plugin on
    "
    " Brief help
    " :PluginList       - lists configured plugins
    " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
    " :PluginSearch foo - searches for foo; append `!` to refresh local cache
    " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
    "
    " see :h vundle for more details or wiki for FAQ
    " Put your non-Plugin stuff after this line
    :set nu
    :set expandtab
    :set shiftwidth=2
    :set tabstop=2
    :set list
    :set listchars=tab:>>
    :set smartindent
    :set autoindent
    :set shell=bash\ -i
    
    " Exit Vim if NERDTree is the only window remaining in the only tab.
    autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
    
    " Configure .sh files
    if &filetype ==# 'sh'
      setlocal noexpandtab
    endif
    
    " Configure python files
    let g:python_recommended_style=0
    
    " Configure rust files
    " Also tried calling this 'rs', and removing the section, and setting these manually, and setting them globally
    if &filetype ==# 'rust 
      syntax enable
      let g:rustfmt_autosave = 1
    endif
    
    " Activate rainbow
    let g:rainbow_active = 1
    
    " Configure syntastic
    set statusline+=%#warningmsg#
    set statusline+=%{SyntasticStatuslineFlag()}
    set statusline+=%*
    let g:syntastic_always_populate_loc_list = 1
    let g:syntastic_auto_loc_list = 1
    let g:syntastic_check_on_open = 1
    let g:syntastic_check_on_wq = 0
    
    opened by Ernaldis 0
  • Should not call `rustfmt --help` unconditionally

    Should not call `rustfmt --help` unconditionally

    • rust.vim version: Latest from git (4aa69b84c8a58fcec6b6dad6fe244b916b1cf830)

    Steps to reproduce:

    • Create a new Cargo project.
    • Create a file rust-toolchain containing:
    [toolchain]
    channel = "nightly-2022-06-30"
    components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
    
    • (This assumes you don't have that toolchain installed.)
    • Edit the source file.
    • ZZ

    Expected vs. actual behavior:

    I expected this to quickly save and exit. Instead, it hung with no visible output. I had to strace it to realize that it was running rustfmt --help, which was updating itself via rustup because of the rust-toolchain file.

    Please don't run rustfmt --help unless actually running rustfmt.

    Paste debugging info from the Rust Vim plugin via one of the following commands: :RustInfo, :RustInfoToClipboard, or :RustInfoToFile <filename>.

    rust.vim Global Variables:
    let g:ftplugin_rust_source_path = v:null
    let g:loaded_syntastic_rust_cargo_checker = v:null
    let g:loaded_syntastic_rust_filetype = v:null
    let g:loaded_syntastic_rust_rustc_checker = v:null
    let g:rust_bang_comment_leader = v:null
    let g:rust_cargo_avoid_whole_workspace = v:null
    let g:rust_clip_command = v:null
    let g:rust_conceal = v:null
    let g:rust_conceal_mod_path = v:null
    let g:rust_conceal_pub = v:null
    let g:rust_fold = v:null
    let g:rust_last_args = v:null
    let b:rust_last_args = []
    let g:rust_last_rustc_args = v:null
    let b:rust_last_rustc_args = []
    let g:rust_original_delimitMate_excluded_regions = v:null
    let g:rust_playpen_url = v:null
    let g:rust_prev_delimitMate_quotes = v:null
    let g:rust_recent_nearest_cargo_tol = v:null
    let g:rust_recent_root_cargo_toml = v:null
    let g:rust_recommended_style = v:null
    let g:rust_set_conceallevel = v:null
    let g:rust_set_conceallevel=1 = v:null
    let g:rust_set_foldmethod = v:null
    let g:rust_set_foldmethod=1 = v:null
    let g:rust_shortener_url = v:null
    let g:rustc_makeprg_no_percent = v:null
    let g:rustc_path = v:null
    let g:rustfmt_autosave = 0
    let g:rustfmt_autosave_if_config_present = v:null
    let g:rustfmt_command = 'rustfmt'
    let g:rustfmt_emit_files = 1
    let g:rustfmt_fail_silently = 0
    let g:rustfmt_options = ''
    let g:syntastic_extra_filetypes = ['rust']
    let g:syntastic_rust_cargo_fname = v:null
    rustfmt 1.4.38-stable (a8314ef 2022-06-27)
    rustc 1.62.0 (a8314ef7d 2022-06-27)
    cargo 1.62.0 (a748cf5a3 2022-06-08)
    
    NVIM v0.7.2
    Build type: Release
    LuaJIT 2.1.0-beta3
    Compiled by [email protected]
    
    Features: +acl +iconv +tui
    See ":help feature-compile"
    
       system vimrc file: "$VIM/sysinit.vim"
      fall-back for $VIM: "/usr/share/nvim"
    
    Run :checkhealth for more info
    
    opened by joshtriplett 0
Owner
The Rust Programming Language
The Rust Programming Language
Language Server Protocol (LSP) support for vim and neovim.

For legacy python implementation, see branch master. LanguageClient-neovim Language Server Protocol support for vim and neovim. More recordings at Upd

Junfeng Li 3.5k Dec 29, 2022
N vim win! Neovim UI designed for Sway/i3.

Nwin This is an experimental Neovim UI that creates a new OS window for each Neovim window, all backed by the same neovim server. This enables perform

Ghjuvan Lacambre 86 Dec 29, 2022
A vim profiling tool

vim-profiler ?? vim-profiler is a wrapper around the (n)vim --startuptime command, written in Rust. The binary is called vp and has only been tested o

Liam 35 Dec 14, 2022
Vim-fork focused on extensibility and usability

Documentation | Chat | Twitter Neovim is a project that seeks to aggressively refactor Vim in order to: Simplify maintenance and encourage contributio

Neovim 61k Jan 2, 2023
Convert VSCode themes to (Neo)Vim colorschemes

Djanho is a prototype which tries to convert VSCode themes to (Neo)Vim colorschemes. Features Handling of VSCode RGBA colors Out of the box conversion

Vinícius Müller 73 Jan 2, 2023
Apprentice-vscode - a port of @romainl’s excellent Apprentice Vim colour scheme to VS Code

Apprentice for VS Code apprentice-vscode is a port of @romainl’s excellent Apprentice Vim colour scheme to VS Code. The theme is available in two vari

Luna Razzaghipour 6 Dec 21, 2022
IDE tools for writing pest grammars, using the Language Server Protocol for Visual Studio Code, Vim and other editors

Pest IDE Tools IDE support for Pest, via the LSP. This repository contains an implementation of the Language Server Protocol in Rust, for the Pest par

pest 20 Apr 8, 2023
Emacs configuration for Rust

Table of Contents Introduction Installation Melpa Manual installation Feature guide Indentation Code formatting Running / testing / compiling code Cli

The Rust Programming Language 919 Jan 4, 2023
Rust IDE support for Atom, powered by the Rust Language Server (RLS)

IDE-Rust Rust language support for Atom-IDE, powered by rust-analyzer. Features Auto-completion Diagnostics (errors and warnings from rustc) Document

The Rust Programming Language 239 Dec 14, 2022
rust-analyzer is a modular compiler frontend for the Rust language

rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

null 11.2k Jan 8, 2023
Rust language support in Atom - LOOKING FOR MAINTAINER, see #144

Rust language support in Atom Adds syntax highlighting and snippets to Rust files in Atom. Install Install the package language-rust in Atom (Preferen

Andreas Neuhaus 118 Oct 11, 2022
Eclipse Corrosion - Rust edition in Eclipse IDE

Eclipse Corrosion Rust edition and debug in Eclipse IDE Corrosion is a Rust development plugin for the Eclipse IDE, providing a rich edition experienc

Eclipse Foundation 194 Dec 23, 2022
RustDT is an Eclipse based IDE for the Rust programming language:

Project website: http://rustdt.github.io/ As of 2017, RustDT is no longer actively maintained, see this blog post for more information. If you are int

null 351 Aug 20, 2022
Rust development environment for Emacs

Rustic Table of Contents Rustic Intro Installation straight Compilation Faces rustc errors Rustfmt edition 2018 LSP Server Client eglot lsp-mode lsp-e

null 612 Dec 30, 2022
Better Rust/Cargo support for Flycheck

flycheck-rust — Flycheck for Rust This Flycheck extension configures Flycheck automatically for the current Cargo project. Setup Install from MELPA or

Flycheck 112 Sep 21, 2022
NetBeans Rust plugin

Rust NetBeans Plugin A NetBeans plugin for Rust. Linux / OSX Windows Requirements NetBeans 8.2.x Java 8+ Rust Cargo Rustup Features So far, it include

drrb 52 Oct 10, 2022
Rust plugin for the IntelliJ Platform

Rust plugin for the IntelliJ Platform Build Status Check Stable Beta Nightly Installation & Usage Available installation options and features are desc

IntelliJ Rust 4.2k Jan 2, 2023
Rust IDE

This branch contains the development of a "new ride" that maintain a small impact on the ui library. This is for a few reasons. Can customize the colo

Gustav Jansson 171 Dec 24, 2022
An IDE for Rust

Introduction SolidOak is a simple IDE for Rust. See the website for binary releases. It has the following features: An embedded copy of Neovim as its

Zach Oakes 907 Dec 29, 2022