Portable builds of the GNU nano 9.2 text editor for Windows, compiled from the sources in this repository with minimal Windows-specific fixes.
License: GNU General Public License, version 3.0 (see COPYING in this
directory and in each build folder).
| Folder | Architecture | File |
|---|---|---|
nano-9.2-win64/ |
64-bit (x86_64) | nano.exe |
nano-9.2-win32/ |
32-bit (i686) | nano.exe |
Contents of each folder:
nano.exe — the editor itself (statically linked, stripped)
nano.bat — launcher: runs nano with HOME pointing at this folder
.nanorc — configuration (settings + syntax highlighting includes)
syntax/ — 44 syntax highlighting files (*.nanorc)
COPYING — full text of the GPL v3 license
No extra DLLs are required. The binaries are statically linked: ncurses
(wide-char, with the built-in Windows console driver win32con), the compiler
runtime, and all other dependencies are built into nano.exe.
nano.exe only uses system DLLs of Windows that ship with the OS:
api-ms-win-crt-*.dll(UCRT — built into Windows 10/11)KERNEL32.dll,USER32.dll,bcrypt.dll
So there is nothing else to copy next to the executable — that is the advantage of a static portable build.
- Windows 10 or Windows 11 (UCRT required, included in the system).
- The 32-bit version works on any x86/x64 Windows 10+; the 64-bit version requires x64.
Option 1 — via the launcher (recommended: enables syntax highlighting):
portable\nano-9.2-win64\nano.bat myfile.txt
Option 2 — directly:
portable\nano-9.2-win64\nano.exe myfile.txt
When run directly, nano takes its settings from %USERPROFILE%\.nanorc if it
exists. The nano.bat launcher instead sets HOME to the folder containing
nano.exe, so the local .nanorc and syntax/ are used.
File association: you can drag a file from Explorer onto nano.bat.
The full nano feature set: editing, cutbuffer, search/replace, syntax highlighting, built-in file browser (M-G), UTF-8 support, mouse, multiple buffers, history, macros, lock files, and more.
Notes for this build:
- UTF-8 — enabled (ncursesw with wide-char support).
- Formatter (M-F) — works: runs an external program via
spawnvp()(see the patch intext.c). - Speller/linter pipeline (
M-S) — disabled: they needfork()+pipes, which do not exist on native Windows. Interactive spell-checking of marked text through an external word editor works. - NLS (translations) — disabled (no libintl in this build).
All modifications were made under the GPL; the files remain GPL-compatible:
src/browser.c—read_the_list()rewritten as a single pass. Reason: gnulib on Windows replacesDIRwith an opaquestruct gl_modulebut does not provide a compatiblerewinddir(), so the old code did not compile.src/files.c— backup timestamps are taken fromst_atime/st_mtime(thest_atim/st_mtimfields do not exist on mingw).src/text.c— same forst_mtim; added a Windows implementation oftreat()using_spawnvp(_P_WAIT, …)(formatter and interactive spell-checker);#include <process.h>.src/utils.c—get_homedir(): ifHOMEis not set,USERPROFILEis used (the standard profile on Windows).
Additionally, patches were applied to ncurses 6.5 at build time (MIT license,
not shipped in the portable folders, only statically linked): disabling the
obsolete wcrtomb workaround for UCRT and fixing MKfallback.sh for empty
Windows command-line arguments.
Toolchain: llvm-mingw (clang/UCRT, includes busybox with sh and GNU
make) + ncurses 6.5 sources.
-
Build ncursesw (static) twice — for
x86_64-w64-mingw32andi686-w64-mingw32:../ncurses-6.5/configure --build=<triple> --host=<triple> \ --prefix=<prefix> --with-shared --with-normal \ --without-cxx --without-ada --without-manpage \ --without-tests --without-progs \ --enable-term-driver --enable-interop --enable-ext-mouse \ CC=<triple>-clang AR=<triple>-ar RANLIB=<triple>-ranlib make -j1 && make install
-
Configure nano (example for x64):
srcdir/configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 \ --disable-nls --enable-utf8 --enable-nanorc --enable-color \ --enable-multibuffer --enable-browser --enable-help \ --enable-comment --enable-extra --enable-formatter --disable-speller \ CC=x86_64-w64-mingw32-clang \ CPPFLAGS="-DNCURSES_STATIC -I<prefix>/include/ncursesw" \ LDFLAGS="-L<dir-with-libncursesw.a> -L<prefix>/lib" make -C lib && make -C src
Key points:
-DNCURSES_STATIC— otherwise the ncurses headers expect dllimport, while the library is static;- a directory containing only a copy of
libncursesw.alisted first inLDFLAGS(-L…) forces the linker to pick the static version instead of.dll.a; - the
docdirectory is skipped (nomakeinfo).
-
stripthe binary, place it intoportable/…, and add.nanorc,nano.bat,syntax/,COPYING.
Build quirks on a plain Windows system without MSYS2:
configurelooks forgrep/sed/awkwithout the.exeextension — so passGREP=grep SED=sed AWK=awkto configure;--build=…is required (config.guess does not recognize plain Windows);SHELLpoints to busyboxsh;- ncurses is built with
-j1(parallel builds misbehave on Windows).
GNU nano is licensed under the GNU General Public License, version 3.0 or
later — see COPYING. The modified nano sources are in this repository
(src/browser.c, src/files.c, src/text.c, src/utils.c).
ncurses 6.5 is licensed under the MIT license (statically linked into
nano.exe).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.