It just sets the encoding that will be used when saving next. If you want to reopen the current file with a different encoding, you can use the reopen command - see Default/Main.sublime-menu for an example.
Dev Build 2144
[quote=âbizooâ]
It doesnât work yet with Soda Theme (need update).
But it work for me with default theme (the cross is replaced with a big dot).
startup, version: 2144 windows x64 channel: dev[/quote]
To get the indicators working in Soda again you just need to add the following to your Global settings.
"highlight_modified_tabs": true
[quote=âbizooâ]API: Added view.encoding() and view.set_encoding()
API: Added view.line_endings() and view.set_line_endings()
yippee !!![/quote]
Thank You Jps!
API: Added view.encoding() and view.set_encoding()
API: Added view.line_endings() and view.set_line_endings()
Whatâs the list of encodings accepted by set_encoding() ?
I try to get an UTF-8 with BOM but didnât find how to spell itâŚ
And is there any plan to have default encoding by syntax ?
Actually, I use different encoding for different language:
-Delphi and PL/SQL files -> cp1252
-Python -> utf-8 BOM
-Almost anything else -> utf-8
Actually new files are âUndefinedâ and get an encoding when saved.
What I like is that the encoding used when the file is saved come from a settings in the Base File.sublime-settings (or the syntax specific one).
A warning message before saving if the encoding didnât take care of some of the char in the buffer would be nice.
Iâm pretty sure itâs easy to make a plugin that trap the on_pre_save event to do that work, but I just wonder if something is planned before doing it.
[quote=âjpsâ]
It just sets the encoding that will be used when saving next. If you want to reopen the current file with a different encoding, you can use the reopen command - see Default/Main.sublime-menu for an example.[/quote]
So itâs possible to call reopen from API ? Afaik itâs not exposed to public.
Commands can be executed via API in one of the following ways:
view.run_command('command_name_here')
window.run_command('command_name_here')
IIRC, since recently the window object dispatches view commands based on input focus, so you can run view/window commands from window plugins easily.
You can also pass args if needed:
window.run_command('command_name_here', {"arg1_here":"foo", "arg2_here":10)
So I guess this should work:
window.run_command('reopen')
The works for me, though:
view.run_command("reopen", {"encoding":"utf-16 le"})
I might have made up the part about command dispatching or just didnât get it right.
[quote=âguillermoooâ]The works for me, though:
view.run_command("reopen", {"encoding":"utf-16 le"})
I might have made up the part about command dispatching or just didnât get it right.[/quote]
You have right it works now, but I was trying to run it in on_load event and that was the problem (itâs working only via sublime.set_timeout in on_load).
Iâve now updated Soda Theme to support the new file state theme features.
Sidebar file items will now show a dirty indicator, and tabs will show a dirty state indicator if youâve got âhighlight_modified_tabsâ: true.
??? All he added was a dot by the fileâŚhow can that be ugly? I find it very useful. Before I had a hard time telling what wasnât saved, now I can easily tell. I think it looks fine, and more importantly, useful.
Id like the old way what shown an asterix after tab text, not the new one that replace (x) from close tab with a round..Anyway, it
s ok that works again on soda.
I see the new tab dirty indicators (very nice update, thanks), but Iâm not seeing the sidebar dirty indicator â is there a setting to turn that on?
Thanks for updating the soda theme but I really hope the dirty files change gets reverted. Itâs much harder to tell if files have changed now, especially if you have âshow_tab_close_buttonsâ set to true. Often the tab is much wider than the filename. Before I just had to take a peek at the filename to see if there was a dot behind it. Combining 2 functions (close/modified) into 1 is not a good idea in this case in my opinion. I went back to build 2143.
I donât use Tabs so I donât care about it, but for the sidebar the dirty indicator is way better now.
I donât want to be offensive, but i think it is actually a pretty good idea because you normally donât want to close a modified file or you do it intentionally.
Not offensive at all. Everyone has their preference . I understand what you are saying but it depends on how you work. I often have quite a few files open and need to run those from outside Sublime which means I need to save them but donât want to close them. So saving and closing are two very separate things in my case.
That said, am trying build 2144 again and am slowly starting to get used to it. Just have to look in a different place but itâs a hard habit to break. Might turn off the close buttons. Who knows, might even start to like it.
The Title Case command still doesnât work quite right. If you highlight multiple lines it misses the first character on every line but the first:
[quote]lorem ipsum dolor sit amet, consectetur
adipiscing elit. suspendisse vel lorem
non elit imperdiet porttitor. quisque
vel nunc dui. donec elementum laoreet
felis id eleifend. donec enim velit,
suscipit id volutpat ut, interdum.[/quote]
Gives you:
[quote]Lorem Ipsum Dolor Sit Amet, Consectetur
adipiscing Elit. Suspendisse Vel Lorem
non Elit Imperdiet Porttitor. Quisque
vel Nunc Dui. Donec Elementum Laoreet
felis Id Eleifend. Donec Enim Velit,
suscipit Id Volutpat Ut, Interdum.
[/quote]