From c98bea31189e4f9178f2790723187769507798d7 Mon Sep 17 00:00:00 2001 From: Bruce Guenter Date: Thu, 8 Feb 2018 12:16:01 -0600 Subject: [PATCH 1/3] 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. --- doc/watchexec.1 | 2 +- src/cli.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/watchexec.1 b/doc/watchexec.1 index 775edb5..d5e28f8 100644 --- a/doc/watchexec.1 +++ b/doc/watchexec.1 @@ -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\. diff --git a/src/cli.rs b/src/cli.rs index 837c945..a59a848 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -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)]; From 422546b1752ae58c52aa844c9fdc413991e4cd45 Mon Sep 17 00:00:00 2001 From: Bruce Guenter Date: Thu, 8 Feb 2018 12:21:06 -0600 Subject: [PATCH 2/3] Add Emacs temporary files to the default ignored list Emacs generates temporary backup files while editing named "#FILENAME#" and ".#FILENAME". Ignore these by default. --- src/cli.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index a59a848..f095db4 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -147,6 +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("#*#"), + String::from(".#*"), String::from(".*.sw?"), String::from(".*.sw?x"), format!("**{}.git{}**", MAIN_SEPARATOR, MAIN_SEPARATOR), From 1d8d6595e079f024360d74aad79681893d68bfea Mon Sep 17 00:00:00 2001 From: Bruce Guenter Date: Thu, 8 Feb 2018 12:39:43 -0600 Subject: [PATCH 3/3] Add .pyo to the Python temporary file ignore Python, when invoked with the -O option, writes compiled code to .pyo files instead of .pyc. Add this to the default ignores list. --- src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index f095db4..918cf3e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -146,7 +146,7 @@ pub fn get_args() -> Args { let mut ignores = vec![]; let default_ignores = vec![format!("**{}.DS_Store", MAIN_SEPARATOR), - String::from("*.pyc"), + String::from("*.py[co]"), String::from("#*#"), String::from(".#*"), String::from(".*.sw?"),