Skip to content

Update vim section movement mappings to support hanging indents. #11492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/etc/vim/ftplugin/rust.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
" Vim syntax file
" Language: Rust
" Maintainer: Chris Morgan <[email protected]>
" Last Change: 2013 Jul 10
" Maintainer: William Ting <[email protected]>
" Last Change: 2014 Jan 12

if exists("b:did_ftplugin")
finish
Expand Down Expand Up @@ -42,4 +43,16 @@ if exists("g:loaded_delimitMate")
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
endif

let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< | if exists('b:rust_original_delimitMate_excluded_regions') | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions | unlet b:rust_original_delimitMate_excluded_regions | elseif exists('b:delimitMate_excluded_regions') | unlet b:delimitMate_excluded_regions | endif"
" Bind motion commands to support hanging indents
noremap <silent> <buffer> [[ ?{<CR>w99[{
noremap <silent> <buffer> ]] j0?{<CR>w99[{%/{<CR>

let b:undo_ftplugin = "
\ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<
\ | if exists('b:rust_original_delimitMate_excluded_regions')
\ | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions
\ | unlet b:rust_original_delimitMate_excluded_regions
\ | elseif exists('b:delimitMate_excluded_regions')
\ | unlet b:delimitMate_excluded_regions
\ | endif
\ | unmap <buffer> [[|unmap <buffer> ]]"