File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1717 // A default initial value to fill the create new file input path with.
1818 "default_initial" : " " ,
1919
20+ // When renaming a file it will we pre populated with the file existing filename.
21+ "autofill_path_the_existing" : false ,
22+
2023 // A boolean defining if cursor text should be used. Text bound by single or
2124 // double quotes or within a region will be used. If multiple cursors
2225 // are used, the earliest selection containing a region or existing
Original file line number Diff line number Diff line change 44
55ALIAS_SETTING = "alias"
66DEFAULT_INITIAL_SETTING = "default_initial"
7+ AUTOFILL_RENAME = "autofill_path_the_existing"
78USE_CURSOR_TEXT_SETTING = "use_cursor_text"
89SHOW_FILES_SETTING = "show_files"
910SHOW_PATH_SETTING = "show_path"
4546SETTINGS = [
4647 ALIAS_SETTING ,
4748 DEFAULT_INITIAL_SETTING ,
49+ AUTOFILL_RENAME ,
4850 USE_CURSOR_TEXT_SETTING ,
4951 SHOW_FILES_SETTING ,
5052 SHOW_PATH_SETTING ,
Original file line number Diff line number Diff line change @@ -123,6 +123,14 @@ def get_status_prefix(self):
123123 def get_default_root_setting (self ):
124124 return RENAME_FILE_DEFAULT_ROOT_SETTING
125125
126+ def generate_initial_path (self ):
127+ if self .settings .get ("autofill_path_the_existing" ):
128+ file_path = self .window .active_view ().file_name ()[1 :]
129+ base , _ = self .split_path (file_path )
130+ return file_path [len (base ):]
131+ else :
132+ return super (self .__class__ , self ).generate_initial_path ()
133+
126134
127135class AdvancedNewFileMoveAtCommand (sublime_plugin .WindowCommand ):
128136 def run (self , files ):
You can’t perform that action at this time.
0 commit comments