diff --git a/src/browser.c b/src/browser.c
index fa11e4231bae7b34fec188660a93d6b0a1e1ba7c..b5cfa80fb476582347edf91563cc5402d390d32e 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -22,7 +22,6 @@
 #include "proto.h"
 
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
diff --git a/src/color.c b/src/color.c
index 4793974cfbd7b337631df1de607466ed0ff33a43..fe925866defe06affde619e7be0a117c546c3fe2 100644
--- a/src/color.c
+++ b/src/color.c
@@ -21,7 +21,6 @@
 
 #include "proto.h"
 
-#include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/src/cut.c b/src/cut.c
index b1b3fb586f869fd15135d6e2fbe0b738280a870f..8c141b947f2c271e1eee42d7ba83d7eb7bdb72a7 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -23,7 +23,6 @@
 #include "proto.h"
 
 #include <string.h>
-#include <stdio.h>
 
 static bool keep_cutbuffer = FALSE;
 	/* Should we keep the contents of the cutbuffer? */
diff --git a/src/files.c b/src/files.c
index d2a97182855d9d59ca19cfda5b9ac1ee6fbd837c..4ad0dc6c98baa521746aab0fa9ad4e9201f62e8b 100644
--- a/src/files.c
+++ b/src/files.c
@@ -21,13 +21,10 @@
 
 #include "proto.h"
 
-#include <stdarg.h>
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <ctype.h>
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
diff --git a/src/global.c b/src/global.c
index a399e548bf6e74339c353dbc3ad97dcfe3f86aec..dca4c653baa667b734be40330bd9ad1857a60197 100644
--- a/src/global.c
+++ b/src/global.c
@@ -24,7 +24,6 @@
 #include <ctype.h>
 #include <string.h>
 #include <strings.h>
-#include "assert.h"
 
 /* Global variables. */
 #ifndef NANO_TINY
diff --git a/src/help.c b/src/help.c
index 338fa30ed8fde5dd5050ba6983a89d6a9009e317..85ba6b514f30d7551748ecf9869c841c435c1c09 100644
--- a/src/help.c
+++ b/src/help.c
@@ -22,9 +22,7 @@
 
 #include "proto.h"
 
-#include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <errno.h>
 
 #ifdef ENABLE_HELP
diff --git a/src/move.c b/src/move.c
index 719aa2630d797138f9da8db4b721aecea477f2d9..85159a1f2bf17736c162e240331ef768df2c41d3 100644
--- a/src/move.c
+++ b/src/move.c
@@ -22,7 +22,6 @@
 #include "proto.h"
 
 #include <string.h>
-#include <ctype.h>
 
 /* Move to the first line of the file. */
 void do_first_line(void)
diff --git a/src/nano.c b/src/nano.c
index 8bfa6d75a9bc9682b6ad085c0295c7285a95a6a2..2266c54312cc81c479739126d2f928c8b6b1e494 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -22,14 +22,11 @@
 #include "proto.h"
 #include "revision.h"
 
-#include <stdio.h>
-#include <stdarg.h>
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
-#include <locale.h>
 #ifdef ENABLE_UTF8
 #include <langinfo.h>
 #endif
diff --git a/src/prompt.c b/src/prompt.c
index 280dc7ca76568046361549fa1467eff7868f04b9..ab2f4031aedd3aadf988f258138365cc750b2794 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -21,8 +21,6 @@
 
 #include "proto.h"
 
-#include <stdio.h>
-#include <stdarg.h>
 #include <string.h>
 
 static char *prompt = NULL;
diff --git a/src/rcfile.c b/src/rcfile.c
index 069c3e27dd2e70b2eb60c9dd3e2afcf26bd9da5d..beb1742076de064f6047e8bd61482d176307c314 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -23,9 +23,7 @@
 #include "proto.h"
 
 #include <glob.h>
-#include <stdarg.h>
 #include <string.h>
-#include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
 #include <ctype.h>
diff --git a/src/search.c b/src/search.c
index 4c7ec5c1754bcd8f141c8d01ace4fb858e0d4c57..9858ff2c3daac2841dcbf1d66130baf64f44d0cc 100644
--- a/src/search.c
+++ b/src/search.c
@@ -22,11 +22,9 @@
 #include "proto.h"
 
 #include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <errno.h>
+#ifdef DEBUG
 #include <time.h>
+#endif
 
 static bool came_full_circle = FALSE;
 	/* Have we reached the starting line again while searching? */
diff --git a/src/text.c b/src/text.c
index 2f05cd141728af58155998ed5b9addbbb844dc58..ef3c80b1f088203b3a2d9d7207aeb626b507db1b 100644
--- a/src/text.c
+++ b/src/text.c
@@ -24,8 +24,6 @@
 
 #include "proto.h"
 
-#include <stdio.h>
-#include <signal.h>
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/src/utils.c b/src/utils.c
index 8a5a1aac28d60dc80997e91348a90ee8b59d1a23..f3000e5cae8ab2dea8168fed9bd27aa83d419fec 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -22,12 +22,10 @@
 #include "proto.h"
 
 #include <string.h>
-#include <stdio.h>
 #include <unistd.h>
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
-#include <ctype.h>
 #include <errno.h>
 
 /* Return the user's home directory.  We use $HOME, and if that fails,
diff --git a/src/winio.c b/src/winio.c
index 9c5d1e2670a668fda977e69f0f34bb31f632b69f..4658127438b4166fcc0d34db6e8daf0f8492cedc 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -26,10 +26,7 @@
 #include <sys/ioctl.h>
 #endif
 
-#include <stdio.h>
-#include <stdarg.h>
 #include <string.h>
-#include <unistd.h>
 #include <ctype.h>
 
 #ifdef REVISION