Fix default ignore for vim temporary files

.swp files are created by vim to store editing state while a file is
open. However, it may also create .swo, .swn, etc files if .swp already
exists. Also, the temporary files are always hidden (start with ".").
Finally, vim temporarily creates .swpx files as well which are caught by
inotify.

This change fixes the *.swp pattern to only match hidden files and to
match the other vim temporary files.
This commit is contained in:
Bruce Guenter 2018-02-08 12:16:01 -06:00
parent b9822266db
commit c98bea3118
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ Skip loading of version control system (VCS) ignore files\. By default, watchexe
.
.TP
\fB\-\-no\-default\-ignore\fR
Skip default ignore statements\. By default, watchexec ignores common temporary files for you, for example \fB*\.swp\fR, \fB*\.pyc\fR, and \fB\.DS_Store\fR
Skip default ignore statements\. By default, watchexec ignores common temporary files for you, for example \fB.*\.swp\fR, \fB*\.pyc\fR, and \fB\.DS_Store\fR
.
.SH "ENVIRONMENT"
Processes started by watchexec have the \fB$WATCHEXEC_UPDATED_PATH\fR environment variable set to the path of the first modification observed\. In addition, the \fB$WATCHEXEC_COMMON_PATH\fR environment variable is set to the common path of all observed modifications\.

View File

@ -147,7 +147,8 @@ pub fn get_args() -> Args {
let mut ignores = vec![];
let default_ignores = vec![format!("**{}.DS_Store", MAIN_SEPARATOR),
String::from("*.pyc"),
String::from("*.swp"),
String::from(".*.sw?"),
String::from(".*.sw?x"),
format!("**{}.git{}**", MAIN_SEPARATOR, MAIN_SEPARATOR),
format!("**{}.hg{}**", MAIN_SEPARATOR, MAIN_SEPARATOR),
format!("**{}.svn{}**", MAIN_SEPARATOR, MAIN_SEPARATOR)];