textbringer-auto-revert 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 137a99232e6d6bd8f23d3e035cd68ace1382d4e1eb0e87380c0d9bc0f4d52c89
4
- data.tar.gz: 0bb993643ed5eb0d8c15013f6e78a0c768c507dcdfba95f72c6a22865c86bf08
3
+ metadata.gz: 510415dcb98e0c25dd5c0c53c05fc63700cb0657e1ebf61290de748e7bb33751
4
+ data.tar.gz: 7ee315ca74e6c87b029c5d04f23b1ae7f878c632469838b68687e7420d058bc6
5
5
  SHA512:
6
- metadata.gz: 92d0bdc9e312cb32c756ba91f04c0827f3242851bfa3d24bcf8346b13e30756e083834d82ec4476e1100b05b3b2bed277b160ec857a0698f944e695abbf3381a
7
- data.tar.gz: fc2050a3539f319f1bfeecb52667a06854467287ed4d03fa65469c67705f7c0926243d3043c7b3377e6b6c7052ec07d30fb5dbddffec247a6699796bd12bab4c
6
+ metadata.gz: 9ad2cc40e79a3f93e1e07b5dea10d4825b1cd04ab829d2f1eaf8bcf9cb054dc1385ee6a32fafbb7c3e7ceaa65ae1f3997308f434c654bc1142a02ef546311e18
7
+ data.tar.gz: b4dbc334617ec284146c7d810af63f3be130b20eeeb2e18f7f3e98b6090ad3fbe10b69592c28113950130ab32cb72ee8605c7033bc9f5351a936654462ea37f5
data/README.md CHANGED
@@ -18,20 +18,26 @@ bundle add textbringer-auto-revert
18
18
 
19
19
  ## Usage
20
20
 
21
+ **Auto-revert mode is enabled by default** when the plugin is loaded.
22
+
23
+ When a file is modified externally and the buffer has no unsaved changes, the buffer will automatically revert to the file's contents after any command execution.
24
+
21
25
  ### Commands
22
26
 
23
27
  | Command | Description |
24
28
  |---------|-------------|
25
- | `auto_revert_mode` | Toggle auto-revert mode for the current buffer |
26
- | `global_auto_revert_mode` | Toggle global auto-revert mode for all buffers |
29
+ | `global_auto_revert_mode` | Toggle global auto-revert mode on/off |
30
+
31
+ ### Disabling
27
32
 
28
- ### Example
33
+ To temporarily disable, run `M-x global_auto_revert_mode`.
29
34
 
30
- 1. Open a file in Textbringer (`C-x C-f`)
31
- 2. Enable global auto-revert mode: `M-x global_auto_revert_mode`
32
- 3. Edit the file externally (e.g., in another terminal)
33
- 4. Execute any command in Textbringer (e.g., `C-n`)
34
- 5. The buffer will automatically revert to the file's contents
35
+ To permanently disable, uninstall the gem or add to your Textbringer config:
36
+
37
+ ```ruby
38
+ Textbringer::GlobalAutoRevertMode.disable
39
+ Textbringer::GlobalAutoRevertMode.enabled = false
40
+ ```
35
41
 
36
42
  ### Configuration
37
43
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Textbringer
4
4
  module AutoRevert
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -30,4 +30,7 @@ module Textbringer
30
30
  end
31
31
  end
32
32
 
33
+ # Enable by default on plugin load
34
+ GlobalAutoRevertMode.enable
35
+ GlobalAutoRevertMode.enabled = true
33
36
  end
data/test/test_helper.rb CHANGED
@@ -83,6 +83,11 @@ module Textbringer
83
83
  end
84
84
 
85
85
  class GlobalMinorMode
86
+ class << self
87
+ attr_accessor :enabled
88
+ alias enabled? enabled
89
+ end
90
+
86
91
  def self.add_hook(name, hook)
87
92
  Textbringer.add_hook(name, hook)
88
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textbringer-auto-revert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yancya