comparison mercurial/ui.py @ 52542:8986a3a8147a

ui: set the default editor on Windows to notepad.exe It's a pretty basic editor, and not one I'd expect anyone to want to continue using. But it exists on PATH (unlike `vi`), and allows `hg config -e` to open the user config file in order to bootstrap making changes, without fiddling with setting `HGEDITOR` in the environment. Otherwise, attempting this results in a cryptic error: C:\Users\Matt>hg config -e 'vi' is not recognized as an internal or external command, operable program or batch file. abort: edit failed: vi exited with status 1
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 17 Dec 2024 19:21:15 -0500
parents 22129ce9f86d
children cc918741a22a
comparison
equal deleted inserted replaced
52541:f33f37accb43 52542:8986a3a8147a
2091 # vi on darwin is POSIX compatible to a fault, and that includes 2091 # vi on darwin is POSIX compatible to a fault, and that includes
2092 # exiting non-zero if you make any mistake when running an ex 2092 # exiting non-zero if you make any mistake when running an ex
2093 # command. Proof: `vi -c ':unknown' -c ':qa'; echo $?` produces 1, 2093 # command. Proof: `vi -c ':unknown' -c ':qa'; echo $?` produces 1,
2094 # while s/vi/vim/ doesn't. 2094 # while s/vi/vim/ doesn't.
2095 editor = b'vim' 2095 editor = b'vim'
2096 elif pycompat.iswindows:
2097 # vi isn't installed by on Windows, while notepad.exe is.
2098 editor = b'notepad.exe'
2096 else: 2099 else:
2097 editor = b'vi' 2100 editor = b'vi'
2098 return encoding.environ.get(b"HGEDITOR") or self.config( 2101 return encoding.environ.get(b"HGEDITOR") or self.config(
2099 b"ui", b"editor", editor 2102 b"ui", b"editor", editor
2100 ) 2103 )