Setting static Codepage in Far3-Editor.
Setting static Codepage in Far3-Editor.
I would need to set for Far3-Editor any static Codepage, not only "Use ANSI code page by default".
"Autodetect code page" not working right.
I am editing files in Codepage=28592 (ISO 8859-2 Latin 2).
"Autodetect code page" not working right.
I am editing files in Codepage=28592 (ISO 8859-2 Latin 2).
- HaRT
- Moderator
- Posts: 10866
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 221 times
- Been thanked: 358 times
Re: Setting static Codepage in Far3-Editor.
Do you have this codepage installed in Windows?
You might with to choose it manually from the list available in the Editor by ShiftF8. If the list is short, try pressing CtrlH there to reveal all installed codepages.
You might with to choose it manually from the list available in the Editor by ShiftF8. If the list is short, try pressing CtrlH there to reveal all installed codepages.
Фар есть инструмент, а не нянька. © 2009 DrKnS
Re: Setting static Codepage in Far3-Editor.
Yes I have this Codepage in list.
I know, it is posible change Codepage manualy, but I am editing a lot of files every day with this Codepage, and it is very tiring for me change Codepage for every new file.
I know, it is posible change Codepage manualy, but I am editing a lot of files every day with this Codepage, and it is very tiring for me change Codepage for every new file.
- t-rex
- Страшный и ужасный
- Posts: 4910
- Joined: Tue 15 Mar, 2005 16:17
- Location: Tel-Aviv
- Has thanked: 1 time
- Been thanked: 8 times
- Contact:
Re: Setting static Codepage in Far3-Editor.
You can always record a macro that selects whatever you need.
Re: Setting static Codepage in Far3-Editor.
There is example for latest far3.
I suppose that 852 28592 is the first favorite codepage (F9 -> Options -> Codepages ... ).
Code: Select all
Macro {
area="Shell"; key="AltF4"; flags="DisableOutput"; description="Edit file with favorite CP";
action = function()
Keys('ShiftF4')
if Area.Dialog then
Keys('Tab CtrlDown Down Down Down Down Down Down Down Down Enter ShiftTab')
if not APanel.Folder then
Keys('ShiftHome'); print(APanel.Current); Keys('Enter') --Keys('Home ShiftEnd')
end
end
end
}
Last edited by 2useven10 on Tue 05 Feb, 2013 10:48, edited 1 time in total.
-
- Posts: 6840
- Joined: Thu 23 Mar, 2006 21:36
- Location: Israel
- Has thanked: 41 times
- Been thanked: 530 times
Re: Setting static Codepage in Far3-Editor.
Another suggestion:
Copy this code into a file with extension "lua", e.g. 28592.lua
Place this file into your %FARPROFILE%\Macros\scripts directory and restart Far.
Then, any time you press CtrlF8 in Editor, the codepage will be set to 28592.
Code: Select all
Macro {
description="Set 28592 codepage";
area="Editor"; key="CtrlF8"; flags="DisableOutput";
action=function()
Keys("ShiftF8 CtrlAltF 2 8 5 9 2")
if Menu.GetValue():match("^28592") then Keys("Enter")
else Keys("Esc")
end
end;
}
Place this file into your %FARPROFILE%\Macros\scripts directory and restart Far.
Then, any time you press CtrlF8 in Editor, the codepage will be set to 28592.
Re: Setting static Codepage in Far3-Editor.
Thank you, it is very nice. I'm not very experienced in writing macros.
My question is:
Is posible this macro write so, when I open all files "*.4gl" in Far-Editor,
automaticaly change Codepage to 28592 (without pressing any key)?
My question is:
Is posible this macro write so, when I open all files "*.4gl" in Far-Editor,
automaticaly change Codepage to 28592 (without pressing any key)?
- HaRT
- Moderator
- Posts: 10866
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 221 times
- Been thanked: 358 times
Re: Setting static Codepage in Far3-Editor.
Try the [ESC] plugin.Far3c wrote:Is posible this macro write so, when I open all files "*.4gl" in Far-Editor,
automaticaly change Codepage to 28592 (without pressing any key)?
Фар есть инструмент, а не нянька. © 2009 DrKnS
Re: Setting static Codepage in Far3-Editor.
I don't know what I am doing bad, but in my Far3 doesn't work this ESC-Plugin.
I would like ask again:
Is there any way to run Makto when I open the editor with some file automaticaly?
I would like ask again:
Is there any way to run Makto when I open the editor with some file automaticaly?
Re: Setting static Codepage in Far3-Editor.
1) ESC version in Downloads is not compatible with latest far (rebuild from sources can help).
2) Yes it is possible. I can't write such macro in couple of minutes. Maybe later if somebody else will not help...
2) Yes it is possible. I can't write such macro in couple of minutes. Maybe later if somebody else will not help...
Last edited by 2useven10 on Tue 05 Feb, 2013 19:39, edited 1 time in total.
Re: Setting static Codepage in Far3-Editor.
Example:
Code: Select all
Macro {
area="Shell"; key="F4"; flags="DisableOutput"; description="Edit CP-28592";
condition = function()
return not APanel.Folder and mf.fsplit(APanel.Current,8) == '.4gl'
end;
action = function()
Keys('ShiftF4'); print(APanel.Current); Keys('Tab CtrlDown')
if Menu.Select(28592,1) > 0 then Keys('Enter Enter') end
end;
}
Last edited by 2useven10 on Wed 06 Feb, 2013 11:18, edited 3 times in total.
Re: Setting static Codepage in Far3-Editor.
for next nightly build:[/s]
Code: Select all
Macro {
area="Shell"; key="F4"; flags="DisableOutput"; description="Edit CP-28592"; filemask="*.4gl";
action = function()
Keys('ShiftF4'); print(APanel.Current); Keys('Tab CtrlDown CtrlAltF 2 8 5 9 2')
Keys(Dlg.GetValue():match('^28592') and 'Enter Enter' or 'CtrlAltF Home')
end;
}
Last edited by 2useven10 on Tue 05 Feb, 2013 19:28, edited 1 time in total.
-
- Posts: 6840
- Joined: Thu 23 Mar, 2006 21:36
- Location: Israel
- Has thanked: 41 times
- Been thanked: 530 times
Re: Setting static Codepage in Far3-Editor.
No, it won't work. "filemask" field works (at the moment) only for Editor and Viewer areas, not for Shell.2useven10 wrote:for next nightly build:
Re: Setting static Codepage in Far3-Editor.
This version ESC compatible with latest Far3 build 3156.Far3c wrote:I don't know what I am doing bad, but in my Far3 doesn't work this ESC-Plugin.
I would like ask again:
Is there any way to run Makto when I open the editor with some file automaticaly?