fichtefoll / filehistory Goto Github PK
View Code? Open in Web Editor NEWSublime Text plugin that keeps track of files which have been recently closed, as well as files that have been recently accessed.
License: MIT License
Sublime Text plugin that keeps track of files which have been recently closed, as well as files that have been recently accessed.
License: MIT License
Since you have one anyways, you might as well also add Settings - Default
and Settings - User
to your Main.sublime-menu
file.
I think this is a relict of the past since the only thing that happens with them currently is that both lists are joined in get_history
and that's it.
In the light of #28 it makes sense to combine both data file restructurings at the same time (for the same release.
@jbjornson, let me know what you think and I'll do it, or you do it yourself. Just let me take care of releasing.
ST has this in file open overlay (Ctrl P
). When you click right button, it opens the selected file without closing the overlay.
If it is possible, it would be good on this plugin, too.
Got a lot of these for the first two files in my list whenever I selected them:
Traceback (most recent call last):
File "C:\Users\Fichte\AppData\Roaming\Sublime Text 3\Packages\File History\file_history.py", line 733, in show_preview
if self.get_view_from_another_group(selected_entry):
File "C:\Users\Fichte\AppData\Roaming\Sublime Text 3\Packages\File History\file_history.py", line 721, in get_view_from_another_group
calling_group = FileHistory().calling_view_index[0]
IndexError: list index out of range
history entries (paths changed, but the unchanged paths exist):
{
"filename": "E:\\...1.md",
"group": 0,
"timestamp": 1413416087,
"index": 3
},
{
"filename": "E:\\...2.md",
"group": 1,
"timestamp": 1413416085,
"index": 0
},
I then opened them manually, closed them again and now it works. Prolly not reproducable but wanted to write this down
It'd be a nice enhancement if, just as some things can be excluded, I could list files I always want in the history. Thanks for the great plugin!
I'm thinking of removing the "obtained from gist" message since it does not really provide any useful information and instead want to add a licence, because having no licence is actually not "open source". Preferring MIT.
If I currently have file A.js
open, and then open the FileHistory list I will see files A.js
, B.js
, C.js
, etc. Now let's say I press down
two times. I will see in the quick preview C.js
(as expected). However, if I now press return
it will take me back to A.js
. Alternatively, if I press esc
I will remain in C.js
. So, currently I always try to press esc
but it's rather unintuitive and I often accidentally press return
to summarize...
doesn't work:
recent_active_files
-> down
-> down
-> return
works:
recent_active_files
-> down
-> down
-> esc
@FichteFoll Maybe something changed in ST Dev 3142, but FileHistory's Settings - Default
and Keybindings - Default
open a blank document unless curly brackets are applied on the variables in Main.sublime-menu
file. But this happens only with the default paths. Any path leading to the User
folder, opens correctly without curly brackets surrounding the variables.
I've seen this happen with other packages, as well.
It might be a bug in ST, let me know what you think and if I should file an issue in ST's core repo.
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "File History",
"children":
[
{
"caption": "Settings - Default",
"command": "open_file",
"args": {
"file": "${packages}/File History/FileHistory.sublime-settings"
}
},
{
"caption": "Settings - User",
"command": "open_file",
"args": {
"file": "${packages}/User/FileHistory.sublime-settings"
}
},
{ "caption": "-"},
{
"caption": "Key Bindings – Default",
"command": "open_file",
"args": {
"file": "${packages}/File History/Default (${platform}).sublime-keymap"
}
},
{
"caption": "Key Bindings – User",
"command": "open_file",
"args": {
"file": "${packages}/User/Default (${platform}).sublime-keymap"
}
}
]
}
]
}
]
}
]
^this
I guess you can imagine what this means, but basically dropbox creates many conflict files because the same files are updated on different machines potentially at the same time.
Not sure right now how to properly resolve this.
The timestamp feature looks great so far (didn't test, only reviewed code), but I'd probably love this to be relative too. It's just way quicker to understand (less information) and you won't care about the exact time anyway.
If I use the cleanup_file_history command it doesn't remove the dead files found in:
...\Sublime Text\Data\Local\Session.sublime_session
Would it be possible to remove the dead files from this file or would there be problems seeing as sublime text may need to be closed?
Setting "timestamp_relative": false
and calling the FileHistory panel, returns the following console error on ST Dev 3208:
Traceback (most recent call last):
File "/Users/soulitude/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1050, in run_
return self.run(**args)
File "/Users/soulitude/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 745, in run
AttributeError: 'OpenRecentlyClosedFileCommand' object has no attribute 'TIMESTAMP_FORMAT'
Package Control.package_control.file_not_found_error.FileNotFoundError: The file "c:\users\moonlight\appdata\local\temp\tmpt1jeq8\working\messages/1.5.0.md" could not be found
Look like 1.5.0.txt must be renamed to 1.5.0.md
It seems like disabling preview of files also disables the ability to use the quick panel shortcuts, like open file and delete entry.
I think you are making the assumption that no preview <=> ST2 (no on_highlight). That is not necessarily the case, as I may be on ST3, but disabled the preview (for which there is a setting in the plugin). In that case, it would be nice if I could still use the shortcuts.
When trying to delete the first item (Ctrl-Del on windows, for example), the item is actually deleted but stays in the menu till it is closed and reopened.
Can't say exactly when it stopped working, but I'm unable to execute any command the plugin offers.
Im currently using Sublime Text 3 (Build 3065) on Windows 64bit Enterprise.
Regardless of the command, the error is the same:
Traceback (most recent call last):
File "D:\Programme\Sublime Text 3\sublime_plugin.py", line 524, in run_
return self.run(**args)
File "file_history in D:\Programme\Sublime Text 3\Data\Installed Packages\File History.sublime-package", line 504, in run
File "file_history in D:\Programme\Sublime Text 3\Data\Installed Packages\File History.sublime-package", line 25, in instance
File "file_history in D:\Programme\Sublime Text 3\Data\Installed Packages\File History.sublime-package", line 33, in __init__
File "file_history in D:\Programme\Sublime Text 3\Data\Installed Packages\File History.sublime-package", line 153, in __load_history
File "./json/__init__.py", line 274, in load
File "./json/__init__.py", line 319, in loads
File "./json/decoder.py", line 352, in decode
File "./json/decoder.py", line 368, in raw_decode
ValueError: Expecting object: line 1 column 32949 (char 32948)
Any suggestion?
I often have redundant entries for the real and symlinked paths to a file. I recently added one of the paths to path_exclude_patterns
but then sometimes miss entries. This could easily be resolved by way of only storing paths normalized by pathlib.Path.absolute()
.
My files history is big so when I ask for the history Sublime Text free like for 20 seconds.
I like the history big, then I prefer to wait, but while waiting:
I have ST3 build 3047. I installed File History using Package Control. But when I run view.run_command("open_recently_closed_file"), nothing happens - no dialog box appears, and no errors appear in the console.
When I try to open the default key bindings file from the menu, it fails, and there is an error in the console:
Unable to open /C/Programs/Sublime/Data/Packages/File History/Default.sublime-keymap
This is on Windows.
When I use the current project popup menu and press the esc key instead of selecting a file it closes my current buffer.
Traceback (most recent call last):
File "./file_history.py", line 394, in open_file
File "./file_history.py", line 313, in open_history
File "./file_history.py", line 253, in __track_calling_view
Boost.Python.ArgumentError: Python argument types in
Window.get_view_index(Window, NoneType)
did not match C++ signature:
get_view_index(SP<edit_window::reference>, SP)
I already marked it in the source, but this is really an issue. The settings should be fetched dynamically when needed instead of only on load.
Also, I highly doubt we should pollute the user settings with all our default settings.
This snippet appears really often in the code and it's very lengthy and annoying. There are a few ways to get rid of this and I thing overriding __call__
is the easiest. But still, need to test this first.
Traceback (most recent call last):
File "./sublime_plugin.py", line 337, in run_
File "./file_history.py", line 367, in run
File "./file_history.py", line 25, in instance
File "./file_history.py", line 33, in init
File "./file_history.py", line 56, in __load_settings
AttributeError: 'module' object has no attribute 'find_resources'
With ST3 a new window.project_file_name()
method was implemented which returns the project's filepath. This seems to be exactly what we need so a migration from the hash of the project's folders onto the project file path should be implemented soon. It's just that this method is not supported in ST2 so we need to support both, hashes and the project filepath. This finally removes the issue of a reset history if the project's folders have been modified.
Furthermore, a window.set_project_data()
was added. While I think it could've been useful to us this it does not resample its main purpose which is not saving data but settings. And for showing a 'global' popup with all recently closed/accessed files we'd need the centralized file anyway so this method won't be of any use. It could serve as a "hash saving place" to resolve the problem with chaning folders mentioned above but with the other new method this is a non-issue.
Just leaving this here for discussion, eventually.
A useful feature would be to define path patterns which filehistory will ignore (e.g., no need for two entries for the same file using different symlink paths)!!!
Despite a check for transient views, after I scrolled through the entire popup list it appears that 18 files that I opened in different projects have also been added to the current one as opened
.
Need to look further into this.
I get the following error after trying to run File History: Open recently closed file ...
via the command command palette:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1034, in run_
return self.run(**args)
File "/Users/tobi/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 761, in run
File "/Users/tobi/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 799, in open_file
File "/Users/tobi/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 702, in get_history_by_index
IndexError: list index out of range
The key binding should check whether the caret is at the end of the input (following text: ^$
).
Furthermore, we should mention this feature in the status bar while the panel is active.
Hi FichteFoll,
Can you please have a quick look and make sure that everything is set up correctly so this change will be picked up by Package Control?
Thanks,
Josh
It shows an error:
Traceback (most recent call last):
File "file_history in /home/khs/.config/sublime-text-3/Installed Packages/File History.sublime-package", line 553, in timestamp_from_string
File "./_strptime.py", line 500, in _strptime_datetime
File "./_strptime.py", line 337, in _strptime
ValueError: time data '2014-09-19 @ 18:42:13' does not match format '%Y-%m-%d %H:%M:%S'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 526, in run_
return self.run()
File "file_history in /home/khs/.config/sublime-text-3/Installed Packages/File History.sublime-package", line 617, in run
File "file_history in /home/khs/.config/sublime-text-3/Installed Packages/File History.sublime-package", line 560, in approximate_age
File "file_history in /home/khs/.config/sublime-text-3/Installed Packages/File History.sublime-package", line 556, in timestamp_from_string
AttributeError: 'OpenRecentlyClosedFileCommand' object has no attribute 'debug'
After first installation, the recently opened files list is empty. It would be a good start, if it will import the already present recently files list from sublimetext itself on first installation (when the list of the plugin itself is empty).
startup, version: 3014 osx x64 channel: dev
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 506, in run_
return self.run(**args)
File "/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 236, in run
File "/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 105, in get_history
File "/Library/Application Support/Sublime Text 3/Installed Packages/File History.sublime-package/file_history.py", line 65, in get_current_project_hash
TypeError: Unicode-objects must be encoded before hashing
Since we now have yet another new (potential) setting we should definitely consider adding a settings file. Thus, moving this from the README.
I will see if I can take on this in the next weeks (holidays), but even though the task is not huge I have a lot of packages with a higher priority on my list. You are free to take this, @jbjornson.
Things we can cleanup as well:
"9de74ff27edf630ae04f18f4002bcc10"
global
, assuming the files still exist)I just ran the command but these entries still existed in my file.
Also, we should consider bumping unprettified JSON instead of the 4-space indented we do now. I doubt you'd edit the file manually (never did that in my years of continuous use) and if you would, you could always run it through a prettifier plugin or website.
The panel just closes.
cleanup_file_history doesn't clear the inputs in the FileHistory.json file ,ST 3 -OSX 10.9
i dont know if this would help or not but i use this settings
{ "keys": ["control+shift+o"], "command": "open_recently_closed_file", "args": {"show_quick_panel": true , "current_project_only": false} },
... and just add ability to go "backward" + "forward" ? I'm trying to get that feature since beginning of life, but nothing does it well :(
At some point, pressing the right
key with the file history list open used to open the currently highlighted history entry without closing the history list. Now, this does not seem to work if show_file_preview
is set to False
; it only works if it is set to True
.
I get the following error in the console:
Traceback (most recent call last):
File "E:\Sublime\sublime_plugin.py", line 775, in run_
return self.run(**args)
File "file_history in E:\Sublime\Data\Installed Packages\File History.sublime-package", line 773, in run
File "file_history in E:\Sublime\Data\Installed Packages\File History.sublime-package", line 492, in quick_open_preview
AttributeError: 'NoneType' object has no attribute 'file_name'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.