我是 Nano 編輯器的忠實粉絲,但我無法在 Windows 版本中使用語法突出顯示功能。 windows 下可以實現語法高亮嗎?
答案1
問題是沒有人告訴你原生 Windows API 版本奈,要求您在 中的 include 語句中使用POSIX
語法來反白顯示檔案的路徑。*.nanorc
.nanorc
編輯您的.nanorc
內容C:\Users\<username>\.nanorc
並確保導入行如下所示:
#include "C:\nano\nanorc\*.nanorc" # Windows paths does NOT work!
include "/nano/nanorc/*.nanorc" # This works!
答案2
詹姆斯·巴克斯特選擇的答案不正確。
為了nano
在 Cygwin 中啟用語法突出顯示,您需要創建,這是在載入語法突出顯示時查找的~/.nanorc
檔案。nano
在此文件中,您應該包含包含include
語法突出顯示文件路徑的任何語句,這些文件通常位於/usr/share/nano
.
我的內容~/.nanorc
:
include /usr/share/nano/asm.nanorc
include /usr/share/nano/autoconf.nanorc
include /usr/share/nano/awk.nanorc
include /usr/share/nano/c.nanorc
include /usr/share/nano/changelog.nanorc
include /usr/share/nano/cmake.nanorc
include /usr/share/nano/css.nanorc
include /usr/share/nano/debian.nanorc
include /usr/share/nano/default.nanorc
include /usr/share/nano/elisp.nanorc
include /usr/share/nano/fortran.nanorc
include /usr/share/nano/gentoo.nanorc
include /usr/share/nano/go.nanorc
include /usr/share/nano/groff.nanorc
include /usr/share/nano/guile.nanorc
include /usr/share/nano/html.nanorc
include /usr/share/nano/java.nanorc
include /usr/share/nano/javascript.nanorc
include /usr/share/nano/json.nanorc
include /usr/share/nano/lua.nanorc
include /usr/share/nano/makefile.nanorc
include /usr/share/nano/man.nanorc
include /usr/share/nano/mgp.nanorc
include /usr/share/nano/mutt.nanorc
include /usr/share/nano/nanorc.nanorc
include /usr/share/nano/nftables.nanorc
include /usr/share/nano/objc.nanorc
include /usr/share/nano/ocaml.nanorc
include /usr/share/nano/patch.nanorc
include /usr/share/nano/perl.nanorc
include /usr/share/nano/php.nanorc
include /usr/share/nano/po.nanorc
include /usr/share/nano/postgresql.nanorc
include /usr/share/nano/pov.nanorc
include /usr/share/nano/python.nanorc
include /usr/share/nano/ruby.nanorc
include /usr/share/nano/rust.nanorc
include /usr/share/nano/sh.nanorc
include /usr/share/nano/spec.nanorc
include /usr/share/nano/tcl.nanorc
include /usr/share/nano/tex.nanorc
include /usr/share/nano/texinfo.nanorc
include /usr/share/nano/xml.nanorc
最簡單的方法是用一句簡單的話:
ls -1 /usr/share/nano | sed 's@^@include /usr/share/nano/@' > ~/.nanorc
如果您/usr/share/nano
尚未包含任何.nanorc
文件,只需從 Git 儲存庫下載它們。