@@ -15,10 +15,6 @@ const execAsync = util.promisify(cp.exec);
1515 */
1616
1717export default function nvimGitRebaseTodo ( plugin : NvimPlugin ) : void {
18- const { nvim : vim } = plugin ;
19-
20- plugin . setOptions ( { dev : false } ) ;
21-
2218 /**
2319 * TODO make actually configurable
2420 */
@@ -38,6 +34,66 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
3834 rowLowerIfCloseToLeft : 0 ,
3935 } ;
4036
37+ /**
38+ *
39+ */
40+
41+ const { nvim : vim } = plugin ;
42+
43+ plugin . setOptions ( { dev : false } ) ;
44+
45+ const pattern = "git-rebase-todo" as const ;
46+ const commonOptions : AutocmdOptions = {
47+ sync : false , //
48+ pattern,
49+ eval : 'expand("<afile>")' , // i don't know what this does
50+ } ;
51+
52+ /**
53+ * :help events
54+ */
55+ plugin . registerAutocmd (
56+ "BufEnter" , //
57+ ( ) => drawLinesOfCommittishStat ( ) ,
58+ {
59+ ...commonOptions ,
60+ }
61+ ) ;
62+
63+ plugin . registerAutocmd (
64+ "BufLeave" , //
65+ ( ) => hideWindow ( ) ,
66+ {
67+ ...commonOptions ,
68+ }
69+ ) ;
70+
71+ plugin . registerAutocmd (
72+ "CursorMoved" , //
73+ ( ) => drawLinesOfCommittishStat ( ) ,
74+ {
75+ ...commonOptions ,
76+ }
77+ ) ;
78+
79+ /**
80+ * only needed when you create a new line,
81+ * otherwise could get rid...
82+ *
83+ * TODO OPTIMIZE
84+ */
85+ plugin . registerAutocmd (
86+ "CursorMovedI" , //
87+ ( ) => drawLinesOfCommittishStat ( ) ,
88+ {
89+ ...commonOptions ,
90+ }
91+ ) ;
92+
93+ /**
94+ *
95+ */
96+
4197 let gBuffer : Buffer ;
4298 let gWindow : Window ;
4399
@@ -398,56 +454,4 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
398454 height,
399455 } ) ;
400456 } ;
401-
402- /**
403- *
404- */
405-
406- const pattern = "git-rebase-todo" as const ;
407- const commonOptions : AutocmdOptions = {
408- sync : false , //
409- pattern,
410- eval : 'expand("<afile>")' , // i don't know what this does
411- } ;
412-
413- /**
414- * :help events
415- */
416- plugin . registerAutocmd (
417- "BufEnter" , //
418- ( ) => drawLinesOfCommittishStat ( ) ,
419- {
420- ...commonOptions ,
421- }
422- ) ;
423-
424- plugin . registerAutocmd (
425- "BufLeave" , //
426- ( ) => hideWindow ( ) ,
427- {
428- ...commonOptions ,
429- }
430- ) ;
431-
432- plugin . registerAutocmd (
433- "CursorMoved" , //
434- ( ) => drawLinesOfCommittishStat ( ) ,
435- {
436- ...commonOptions ,
437- }
438- ) ;
439-
440- /**
441- * only needed when you create a new line,
442- * otherwise could get rid...
443- *
444- * TODO OPTIMIZE
445- */
446- plugin . registerAutocmd (
447- "CursorMovedI" , //
448- ( ) => drawLinesOfCommittishStat ( ) ,
449- {
450- ...commonOptions ,
451- }
452- ) ;
453457}
0 commit comments