Skip to content

Commit a48bc2d

Browse files
committed
add default_encoding supported
1 parent d9eb278 commit a48bc2d

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Custominsert.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def get_predefined_param(self,match):
4343
elif key=='arch':
4444
return sublime.arch()
4545
elif key=='encoding':
46-
return self.view.encoding()
46+
encoding = self.view.encoding()
47+
return encoding if 'Undefined' != encoding else self.settings.get('default_encoding')
4748
elif key=='ip':
4849
return get_local_ip()
4950
ipaddrlist=socket.gethostbyname_ex(socket.gethostname())

Custominsert.sublime-settings

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "0.0.1"/*default version*/
55
},
66
"content": "default content",
7+
"default_encoding":"UTF-8",
78
/*cursor|start*/
89
"position": "cursor",
910
"datetime_format": "%Y-%m-%d[%H:%M:%S]",

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ pre-defined vars
6363
- arch : 'x32' or 'x64'
6464
- ext : file ext(without '.',may be empty)
6565
- ip : IP address(may be 'localhost')
66-
- encoding : file encoding(may be Undefined)
66+
- encoding : file encoding(may be Undefined),you can use 'default_encoding' to override Undefined value
6767
- user : name of the user logged in
6868

6969
changelog
7070
===========
71+
- 2013-12-30:default_encoding supported
7172
- 2013-11-19:menus supported.
7273
- 2013-11-15:{{}} syntax supported;position custom define supported;multiple actions&position insert supported,more pre-defined supported.
7374
- 2013-11-14:{%%} syntax supported.

0 commit comments

Comments
 (0)