robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
2dd5e472df
master
1" Last Modified: 2023-09-11 2 3" For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim 4 5let s: global_variable_list = [ 6 \'_rustfmt_autosave_because_of_config' , 7 \'ftplugin_rust_source_path' , 8 \'loaded_syntastic_rust_cargo_checker' , 9 \'loaded_syntastic_rust_filetype' , 10 \'loaded_syntastic_rust_rustc_checker' , 11 \'rust_bang_comment_leader' , 12 \'rust_cargo_avoid_whole_workspace' , 13 \'rust_clip_command' , 14 \'rust_conceal' , 15 \'rust_conceal_mod_path' , 16 \'rust_conceal_pub' , 17 \'rust_fold' , 18 \'rust_last_args' , 19 \'rust_last_rustc_args' , 20 \'rust_original_delimitMate_excluded_regions' , 21 \'rust_playpen_url' , 22 \'rust_prev_delimitMate_quotes' , 23 \'rust_recent_nearest_cargo_tol' , 24 \'rust_recent_root_cargo_toml' , 25 \'rust_recommended_style' , 26 \'rust_set_conceallevel' , 27 \'rust_set_conceallevel=1' , 28 \'rust_set_foldmethod' , 29 \'rust_set_foldmethod=1' , 30 \'rust_shortener_url' , 31 \'rustc_makeprg_no_percent' , 32 \'rustc_path' , 33 \'rustfmt_autosave' , 34 \'rustfmt_autosave_if_config_present' , 35 \'rustfmt_command' , 36 \'rustfmt_emit_files' , 37 \'rustfmt_fail_silently' , 38 \'rustfmt_options' , 39 \'syntastic_extra_filetypes' , 40 \'syntastic_rust_cargo_fname' , 41 \] 42 43function ! s: Echo ( message ) abort 44execute 'echo a:message' 45endfunction 46 47function ! s: EchoGlobalVariables () abort 48for l: key in s: global_variable_list 49if l: key !~# '^_' 50call s: Echo ( 'let g:' . l: key . ' = ' . string ( get ( g:, l: key , v: null ))) 51endif 52 53if has_key ( b:, l: key ) 54call s: Echo ( 'let b:' . l: key . ' = ' . string ( b:[ l: key ])) 55endif 56endfor 57endfunction 58 59function ! rust#debugging#Info () abort 60call cargo#Load () 61call rust#Load () 62call rustfmt#Load () 63call s: Echo ( 'rust.vim Global Variables:' ) 64call s: Echo ( '' ) 65call s: EchoGlobalVariables () 66 67silent let l: output = system ( g: rustfmt_command . ' --version' ) 68echo l: output 69 70let l: rustc = exists ( "g:rustc_path" ) ? g: rustc_path : "rustc" 71silent let l: output = system ( l: rustc . ' --version' ) 72echo l: output 73 74silent let l: output = system ( 'cargo --version' ) 75echo l: output 76 77version 78 79if exists ( ":SyntasticInfo" ) 80echo "----" 81echo "Info from Syntastic:" 82execute "SyntasticInfo" 83endif 84endfunction 85 86function ! rust#debugging#InfoToClipboard () abort 87redir @" 88silent call rust#debugging#Info () 89redir END 90 91call s: Echo ( 'RustInfo copied to your clipboard' ) 92endfunction 93 94function ! rust#debugging#InfoToFile ( filename ) abort 95let l: expanded_filename = expand ( a: filename ) 96 97redir => l:output 98silent call rust#debugging#Info () 99redir END 100 101call writefile ( split ( l: output , "\n" ), l: expanded_filename ) 102call s: Echo ( 'RustInfo written to ' . l: expanded_filename ) 103endfunction 104 105" vim: set et sw=4 sts=4 ts=8: