@@ -522,6 +522,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
522
522
#[ derive( Clone , Debug , Eq , PartialEq ) ]
523
523
enum EditorKind {
524
524
Vscode ,
525
+ Vim ,
525
526
Emacs ,
526
527
Helix ,
527
528
}
@@ -532,7 +533,7 @@ impl EditorKind {
532
533
/// outdated vs. user-modified settings files.
533
534
fn hashes ( & self ) -> Vec < & str > {
534
535
match self {
535
- EditorKind :: Vscode => vec ! [
536
+ EditorKind :: Vscode | EditorKind :: Vim => vec ! [
536
537
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8" ,
537
538
"56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922" ,
538
539
"af1b5efe196aed007577899db9dae15d6dbc923d6fa42fa0934e68617ba9bbe0" ,
@@ -546,9 +547,9 @@ impl EditorKind {
546
547
"51068d4747a13732440d1a8b8f432603badb1864fa431d83d0fd4f8fa57039e0" ,
547
548
"d29af4d949bbe2371eac928a3c31cf9496b1701aa1c45f11cd6c759865ad5c45" ,
548
549
] ,
549
- EditorKind :: Helix => vec ! [
550
- "2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233"
551
- ]
550
+ EditorKind :: Helix => {
551
+ vec ! [ "2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233" ]
552
+ }
552
553
}
553
554
}
554
555
@@ -559,6 +560,7 @@ impl EditorKind {
559
560
fn settings_short_path ( & self ) -> PathBuf {
560
561
self . settings_folder ( ) . join ( match self {
561
562
EditorKind :: Vscode => "settings.json" ,
563
+ EditorKind :: Vim => "coc-settings.json" ,
562
564
EditorKind :: Emacs => ".dir-locals.el" ,
563
565
EditorKind :: Helix => "languages.toml" ,
564
566
} )
@@ -567,25 +569,24 @@ impl EditorKind {
567
569
fn settings_folder ( & self ) -> PathBuf {
568
570
match self {
569
571
EditorKind :: Vscode => PathBuf :: new ( ) . join ( ".vscode" ) ,
572
+ EditorKind :: Vim => PathBuf :: new ( ) . join ( ".vim" ) ,
570
573
EditorKind :: Emacs => PathBuf :: new ( ) ,
571
574
EditorKind :: Helix => PathBuf :: new ( ) . join ( ".helix" ) ,
572
575
}
573
576
}
574
577
575
578
fn settings_template ( & self ) -> & str {
576
579
match self {
577
- EditorKind :: Vscode => include_str ! ( "../../../../etc/rust_analyzer_settings.json" ) ,
580
+ EditorKind :: Vscode | EditorKind :: Vim => {
581
+ include_str ! ( "../../../../etc/rust_analyzer_settings.json" )
582
+ }
578
583
EditorKind :: Emacs => include_str ! ( "../../../../etc/rust_analyzer_eglot.el" ) ,
579
584
EditorKind :: Helix => include_str ! ( "../../../../etc/rust_analyzer_helix.toml" ) ,
580
585
}
581
586
}
582
587
583
- fn backup_extension ( & self ) -> & str {
584
- match self {
585
- EditorKind :: Vscode => "json.bak" ,
586
- EditorKind :: Emacs => "el.bak" ,
587
- EditorKind :: Helix => "toml.bak" ,
588
- }
588
+ fn backup_extension ( & self ) -> String {
589
+ format ! ( "{}.bak" , self . settings_short_path( ) . extension( ) . unwrap( ) . to_str( ) . unwrap( ) )
589
590
}
590
591
}
591
592
@@ -627,6 +628,7 @@ macro_rules! impl_editor_support {
627
628
}
628
629
629
630
impl_editor_support ! ( vscode, Vscode ) ;
631
+ impl_editor_support ! ( vim, Vim ) ;
630
632
impl_editor_support ! ( emacs, Emacs ) ;
631
633
impl_editor_support ! ( helix, Helix ) ;
632
634
0 commit comments