How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Moderators: sheep, Hacker, Stefan2, white
How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Every time I create a new txt file with "Shift+F4" hotkey, TC open it with notepad on default, but I want to open it with Gvim, how to do it?
Re: How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Notepad is hardcoded in TC.
I use NotepadReplacer to make my favorite editor (SynWrite / Syn2) the system default for any calls to notepad.
https://www.binaryfortress.com/NotepadReplacer/
I use NotepadReplacer to make my favorite editor (SynWrite / Syn2) the system default for any calls to notepad.
https://www.binaryfortress.com/NotepadReplacer/
Windows 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.958 (x64)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.958 (x64)
Re: How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Huh? No, it isn't. I've been using ConTEXT editor with Shift+F4 for over a decade now. The only place where TC uses a hardcoded editor is Settings > Change Settings File Directly which has been a discussion for many years.
@Joeyy:
See Options > Edit/View > Editor for F4, and set the editor you wish. The same editor will be used for Shift+F4 hotkey.
Regards
Dalai
Re: How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Hi Joeyy
there are several approach.
A:
change your default Editor in TC:
Menu Configuration > Options... > Edit/View > Editor for F4
Editor: TOOLs\NotePad2\notepad2.exe "%1"
((("TOOLs" is a sub folder in my TC folder)))
B:
1.) Create a user defined command in usercmd.ini
[em_F4_VBS] ;NewFile like Shift+F4
cmd="TOOLs\CMDs\CreateNewTextFile.vbs"
Param="%O.%E"
'2.) Assign a keyboard shortcut in wincmd.ini
[Shortcuts]
CS+F4=em_F4_VBS ;Ctrl+Shift+F4
'3.) Write a script, like this "CreateNewTextFile.vbs"
C:
Use external tools, like "putfile" from our member m^2
viewtopic.php?p=136366#p136366
Also there are some other tools for the "F4"-button to handle different extensions:
https://ghisler.ch/board/viewtopic.php?p=293272#p293272
HTH?
there are several approach.
A:
change your default Editor in TC:
Menu Configuration > Options... > Edit/View > Editor for F4
Editor: TOOLs\NotePad2\notepad2.exe "%1"
((("TOOLs" is a sub folder in my TC folder)))
B:
create a user defined command
Show
1.) Create a user defined command in usercmd.ini
[em_F4_VBS] ;NewFile like Shift+F4
cmd="TOOLs\CMDs\CreateNewTextFile.vbs"
Param="%O.%E"
'2.) Assign a keyboard shortcut in wincmd.ini
[Shortcuts]
CS+F4=em_F4_VBS ;Ctrl+Shift+F4
'3.) Write a script, like this "CreateNewTextFile.vbs"
Code: Select all
'On Error Resume Next
'If WScript.Arguments.Count = 0 Then WScript.Quit
strPara = "New Text file.txt"
SET ARGs = WScript.Arguments
IF args.count > 0 Then strPara = args(0)
strTimestamp = year(now) &"-"& right( "0" & month(now), 2) &"-"& right( "0" & day(now), 2)
strNewFileName = strTimestamp & "_" & strPara
NewFileName = InputBox("Enter file name to create new:","Total Commander",strNewFileName)
If NewFileName="" Then
WScript.Quit
Else
'//TRICK: use "?" sign in new file name to open the text file after creation:
IF (InStr(NewFileName,"?")) Then
bOpenTextFileAfterwards = TRUE
NewFileName = Replace(NewFileName,"?","")
End If
CreateObject("Scripting.FileSystemObject").CreateTextFile(NewFileName)
End If
IF (bOpenTextFileAfterwards) Then
SET WSO = WScript.CreateObject("WScript.Shell")
TCPath = WSO.ExpandEnvironmentStrings("%Commander_Path%")
'//WSO.Run strCommand [,intWindowStyle 0=Hide 1=Activate 2=minimize 3=maximize ...] [,bWaitTillFinish? True/defaultFalse]
WSO.run TCPath & "\TOOLs\NotePad2\notepad2.exe " & NewFileName
SET WSO = Nothing
End IF '(bOpenTextFileAfterwards)
C:
Use external tools, like "putfile" from our member m^2
viewtopic.php?p=136366#p136366
Also there are some other tools for the "F4"-button to handle different extensions:
https://ghisler.ch/board/viewtopic.php?p=293272#p293272
HTH?
Inofficial FAQs || WIKI (Deu/Eng) || TC Home (What's new? // FAQ // Download // Order // Addons // Tools // Plugins)
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.
Re: How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
Ops, sorry, I confused it with the Change setting issue.Dalai wrote: ↑2019-03-25, 15:05 UTCHuh? No, it isn't. I've been using ConTEXT editor with Shift+F4 for over a decade now. The only place where TC uses a hardcoded editor is Settings > Change Settings File Directly which has been a discussion for many years.
@Joeyy:
See Options > Edit/View > Editor for F4, and set the editor you wish. The same editor will be used for Shift+F4 hotkey.
Regards
Dalai
But in my case NodepadReplacer fixed that also.
Windows 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.958 (x64)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.958 (x64)
Re: How to open txt file with Gvim on default when "Shift+F4" creats new txt file?
@Dalai@Stefan2@Horst.Epp
Thanks!
Thanks!