]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(rust): Respect no_plugin_maps and no_rust_maps globals (#14221)
authorMyyPo <110892040+MyyPo@users.noreply.github.com>
Mon, 18 Mar 2024 18:38:09 +0000 (20:38 +0200)
committerGitHub <noreply@github.com>
Mon, 18 Mar 2024 18:38:09 +0000 (19:38 +0100)
Signed-off-by: myypo <nikirsmcgl@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/ftplugin/rust.vim

index 7f1a86ea95023d719de761f754f1d0c62893c76c..fb15b444d008c878ba9fdab1f6950e7e0d034e7f 100644 (file)
@@ -1,7 +1,7 @@
 " Language:     Rust
 " Description:  Vim ftplugin for Rust
 " Maintainer:   Chris Morgan <me@chrismorgan.info>
-" Last Change:  2023-09-11
+" Last Change:  2024-03-17
 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim
 
 if exists("b:did_ftplugin")
@@ -94,14 +94,15 @@ if has('conceal') && get(g:, 'rust_conceal', 0)
 endif
 
 " Motion Commands {{{1
-
-" Bind motion commands to support hanging indents
-nnoremap <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR>
-nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR>
-xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR>
-xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
-onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
-onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
+if !exists("g:no_plugin_maps") && !exists("g:no_rust_maps")
+    " Bind motion commands to support hanging indents
+    nnoremap <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR>
+    nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR>
+    xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR>
+    xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
+    onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
+    onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
+endif
 
 " Commands {{{1
 
@@ -176,12 +177,12 @@ let b:undo_ftplugin = "
                                 \|delcommand -buffer RustInfoToClipboard
                                 \|delcommand -buffer RustInfoToFile
                                 \|delcommand -buffer RustTest
-                                \|nunmap <buffer> [[
-                                \|nunmap <buffer> ]]
-                                \|xunmap <buffer> [[
-                                \|xunmap <buffer> ]]
-                                \|ounmap <buffer> [[
-                                \|ounmap <buffer> ]]
+                                \|silent! nunmap <buffer> [[
+                                \|silent! nunmap <buffer> ]]
+                                \|silent! xunmap <buffer> [[
+                                \|silent! xunmap <buffer> ]]
+                                \|silent! ounmap <buffer> [[
+                                \|silent! ounmap <buffer> ]]
                                 \|setlocal matchpairs-=<:>
                                 \|unlet b:match_skip
                                 \"