@@ -522,6 +522,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
522522#[ derive( Clone , Debug , Eq , PartialEq ) ]
523523enum EditorKind {
524524 Vscode ,
525+ Vim ,
525526 Emacs ,
526527 Helix ,
527528}
@@ -532,7 +533,7 @@ impl EditorKind {
532533 /// outdated vs. user-modified settings files.
533534 fn hashes ( & self ) -> Vec < & str > {
534535 match self {
535- EditorKind :: Vscode => vec ! [
536+ EditorKind :: Vscode | EditorKind :: Vim => vec ! [
536537 "ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8" ,
537538 "56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922" ,
538539 "af1b5efe196aed007577899db9dae15d6dbc923d6fa42fa0934e68617ba9bbe0" ,
@@ -546,9 +547,9 @@ impl EditorKind {
546547 "51068d4747a13732440d1a8b8f432603badb1864fa431d83d0fd4f8fa57039e0" ,
547548 "d29af4d949bbe2371eac928a3c31cf9496b1701aa1c45f11cd6c759865ad5c45" ,
548549 ] ,
549- EditorKind :: Helix => vec ! [
550- "2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233"
551- ]
550+ EditorKind :: Helix => {
551+ vec ! [ "2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233" ]
552+ }
552553 }
553554 }
554555
@@ -559,6 +560,7 @@ impl EditorKind {
559560 fn settings_short_path ( & self ) -> PathBuf {
560561 self . settings_folder ( ) . join ( match self {
561562 EditorKind :: Vscode => "settings.json" ,
563+ EditorKind :: Vim => "coc-settings.json" ,
562564 EditorKind :: Emacs => ".dir-locals.el" ,
563565 EditorKind :: Helix => "languages.toml" ,
564566 } )
@@ -567,25 +569,24 @@ impl EditorKind {
567569 fn settings_folder ( & self ) -> PathBuf {
568570 match self {
569571 EditorKind :: Vscode => PathBuf :: new ( ) . join ( ".vscode" ) ,
572+ EditorKind :: Vim => PathBuf :: new ( ) . join ( ".vim" ) ,
570573 EditorKind :: Emacs => PathBuf :: new ( ) ,
571574 EditorKind :: Helix => PathBuf :: new ( ) . join ( ".helix" ) ,
572575 }
573576 }
574577
575578 fn settings_template ( & self ) -> & str {
576579 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+ }
578583 EditorKind :: Emacs => include_str ! ( "../../../../etc/rust_analyzer_eglot.el" ) ,
579584 EditorKind :: Helix => include_str ! ( "../../../../etc/rust_analyzer_helix.toml" ) ,
580585 }
581586 }
582587
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( ) )
589590 }
590591}
591592
@@ -627,6 +628,7 @@ macro_rules! impl_editor_support {
627628}
628629
629630impl_editor_support ! ( vscode, Vscode ) ;
631+ impl_editor_support ! ( vim, Vim ) ;
630632impl_editor_support ! ( emacs, Emacs ) ;
631633impl_editor_support ! ( helix, Helix ) ;
632634
0 commit comments