summaryrefslogtreecommitdiffstats
path: root/autoload/rust
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2018-10-08 19:00:59 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2018-10-08 19:00:59 +0200
commitfd74d8b2b170b540680a9bbf6c64990f8ebafd08 (patch)
treeb1fdef6203a78a21053d1b8e0666ab7a38c36df2 /autoload/rust
parent055f7710b65dfa2df52fc0b5be2486ae36ac5751 (diff)
downloadvim-polyglot-3.3.3.tar.gz
vim-polyglot-3.3.3.zip
Updatev3.3.3
Diffstat (limited to 'autoload/rust')
-rw-r--r--autoload/rust/debugging.vim1
-rw-r--r--autoload/rust/delimitmate.vim48
2 files changed, 49 insertions, 0 deletions
diff --git a/autoload/rust/debugging.vim b/autoload/rust/debugging.vim
index 352556d7..ff88e00c 100644
--- a/autoload/rust/debugging.vim
+++ b/autoload/rust/debugging.vim
@@ -18,6 +18,7 @@ let s:global_variable_list = [
\ 'rust_last_rustc_args',
\ 'rust_original_delimitMate_excluded_regions',
\ 'rust_playpen_url',
+ \ 'rust_prev_delimitMate_quotes',
\ 'rust_recent_nearest_cargo_tol',
\ 'rust_recent_root_cargo_toml',
\ 'rust_recommended_style',
diff --git a/autoload/rust/delimitmate.vim b/autoload/rust/delimitmate.vim
new file mode 100644
index 00000000..e99cc87d
--- /dev/null
+++ b/autoload/rust/delimitmate.vim
@@ -0,0 +1,48 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
+
+let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
+
+" For this buffer, when delimitMate issues the `User delimitMate_map`
+" event in the autocommand system, add the above-defined extra excluded
+" regions to delimitMate's state, if they have not already been added.
+function! rust#delimitmate#onMap() abort
+ if &filetype !=# 'rust'
+ return
+ endif
+
+ if get(b:, "delimitMate_quotes")
+ let b:rust_prev_delimitMate_quotes = b:delimitMate_quotes
+ endif
+ let b:delimitMate_quotes = "\" `"
+
+ if match(delimitMate#Get("excluded_regions"),
+ \ s:delimitMate_extra_excluded_regions) == -1
+ call delimitMate#Set("excluded_regions",
+ \delimitMate#Get("excluded_regions").s:delimitMate_extra_excluded_regions)
+ endif
+endfunction
+
+" For this buffer, when delimitMate issues the `User delimitMate_unmap`
+" event in the autocommand system, delete the above-defined extra excluded
+" regions from delimitMate's state (the deletion being idempotent and
+" having no effect if the extra excluded regions are not present in the
+" targeted part of delimitMate's state).
+function! rust#delimitmate#onUnmap() abort
+ if &filetype !=# 'rust'
+ return
+ endif
+
+ if get(b:, "rust_prev_delimitMate_quotes")
+ let b:delimitMate_quotes = b:rust_prev_delimitMate_quotes
+ endif
+
+ call delimitMate#Set("excluded_regions", substitute(
+ \ delimitMate#Get("excluded_regions"),
+ \ '\C\V' . s:delimitMate_extra_excluded_regions,
+ \ '', 'g'))
+endfunction
+
+" vim: set et sw=4 sts=4 ts=8:
+
+
+endif