summaryrefslogtreecommitdiffstats
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/rust.vim36
-rw-r--r--ftplugin/tmux.vim5
2 files changed, 39 insertions, 2 deletions
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim
index e7c604ec..2023656e 100644
--- a/ftplugin/rust.vim
+++ b/ftplugin/rust.vim
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Description: Vim syntax file for Rust
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Maintainer: Kevin Ballard <kevin@sb.org>
-" Last Change: January 29, 2015
+" Last Change: June 08, 2016
if exists("b:did_ftplugin")
finish
@@ -14,6 +14,9 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
+augroup rust.vim
+autocmd!
+
" Variables {{{1
" The rust source code at present seems to typically omit a leader on /*!
@@ -56,7 +59,33 @@ if exists("g:loaded_delimitMate")
if exists("b:delimitMate_excluded_regions")
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
endif
- let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
+
+ 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.
+ autocmd User <buffer>
+ \ if expand('<afile>') ==# 'delimitMate_map' && match(
+ \ delimitMate#Get("excluded_regions"),
+ \ s:delimitMate_extra_excluded_regions) == -1
+ \| let b:delimitMate_excluded_regions =
+ \ delimitMate#Get("excluded_regions")
+ \ . s:delimitMate_extra_excluded_regions
+ \|endif
+
+ " 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).
+ autocmd User <buffer>
+ \ if expand('<afile>') ==# 'delimitMate_unmap'
+ \| let b:delimitMate_excluded_regions = substitute(
+ \ delimitMate#Get("excluded_regions"),
+ \ '\C\V' . s:delimitMate_extra_excluded_regions,
+ \ '', 'g')
+ \|endif
endif
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
@@ -161,10 +190,13 @@ let b:undo_ftplugin = "
\|ounmap <buffer> ]]
\|set matchpairs-=<:>
\|unlet b:match_skip
+ \|augroup! rust.vim
\"
" }}}1
+augroup END
+
let &cpo = s:save_cpo
unlet s:save_cpo
diff --git a/ftplugin/tmux.vim b/ftplugin/tmux.vim
new file mode 100644
index 00000000..fa2ae587
--- /dev/null
+++ b/ftplugin/tmux.vim
@@ -0,0 +1,5 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
+
+setlocal commentstring=#\ %s
+
+endif