Make new file Format configurable (shift + F4)

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
consistency
Junior Member
Junior Member
Posts: 24
Joined: 2006-03-18, 15:11 UTC

Make new file Format configurable (shift + F4)

Post by *consistency »

if i create a new file with shift + f4 the file will always created with ANSI and with Windows Line endings, which is quite outdated.

would be great having a way to configure it, like in notepad++

Image: http://i.imgur.com/R6fsAdb.png
macOS? Linux? als Desktop Ersatz?
nö da gibts keinen Totalcommander.
Clone? ich sagte _Totalcommander_
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Make new file Format configurable (shift + F4)

Post by *Stefan2 »

consistency wrote:...would be great having a way to configure it, ...
Till then you could us work around like:

REM 1.) create the "template.txt" with your settings and this batch:

Code: Select all

@ECHO OFF
SET myPath=%1
SET /P myName=Dateiname:

COPY "%Commander_Path%\ShellNew\template.txt" "%myPath%\%myName%"

REM Start "" path\to\my\editor.exe %myPath%\%myName%
Start "" notepad2.exe "%myPath%\%myName%"

REM 2.) create usercmd with the batch as command and "%P" as parameter
usercmd.ini
[em_e]
cmd=%Commander_Path%\ShiftF4Proxy.cmd
param="%P"

REM Tip: Try in TC command line: em_e


REM 3.) set Shift+F4 to execute that usercmd em_e
WINCMD.INI
[Shortcuts]
S+F4=em_e




Of course there are better (nicer) ways to implement this work around.

There can be found many example in the forum.

Without using the "Start" command this is also an example to create a new file without launching an editor after it.
I have such command as Shift+Ctrl+F4 for such cases. ( if I only would remember that more often :-( )
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Re: Make new file Format configurable (shift + F4)

Post by *milo1012 »

consistency wrote:if i create a new file with shift + f4 the file will always created with ANSI and with Windows Line endings, which is quite outdated.
No, it just creates an empty file.
It exclusively depends on your editor how things are treated, in case of an empty (zero byte) file.

You can select e.g. Notepad2 as the default editor:
Options -> Edit/View -> Editor for F4
and insert e.g.

Code: Select all

%COMMANDER_PATH%\tools\notepad2\Notepad2.exe /utf8 /crlf
This way empty/created files will always be treated as UTF-8 and CRLF,
and existing files will still be recognized and opened in their correct encoding (Unicode detection).
Use /lf switch for Unix line endings, and so on.
I'm sure that there are also similar command line switches for Notepad++.

While I agree that TC could (optionally) insert an Unicode BOM for newly created files,
pre-selecting the line endings is not a thing that makes sense, because you'd need to insert empty lines for that,
in order to make the editor recognize what endings should be used.
TC plugins: PCREsearch and RegXtract
User avatar
consistency
Junior Member
Junior Member
Posts: 24
Joined: 2006-03-18, 15:11 UTC

Post by *consistency »

forgot to write in english, here the english version:

thanks for the helpful infos.

i opened an issue for notepad++ https://github.com/notepad-plus-plus/notepad-plus-plus/issues/228

unfortunately notepad++ has no option for forcing formats via commandline switches.

i havn't tested the option to create a custom cmd script yet but i will test it in the near future.

thanks anyway.

orginal post:

Code: Select all

danke für die hilfreichen infos.

habe mal bei notepad++ ein issue geöffnet https://github.com/notepad-plus-plus/notepad-plus-plus/issues/228

leider hat notepad++ keine möglichkeit diese einstellungen über command line zu erzwingen.

die möglichkeit es über eine eigenes cmd script zu machen muss ich noch testen. auf jeden fall vielen dank.
Last edited by consistency on 2015-06-27, 12:00 UTC, edited 1 time in total.
macOS? Linux? als Desktop Ersatz?
nö da gibts keinen Totalcommander.
Clone? ich sagte _Totalcommander_
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Please speak English in 'TC suggestions (English)' forum.
Post Reply