{"id":489,"date":"2025-12-16T11:47:29","date_gmt":"2025-12-16T03:47:29","guid":{"rendered":"https:\/\/blog.jason-lam.com\/?p=489"},"modified":"2025-12-16T11:47:29","modified_gmt":"2025-12-16T03:47:29","slug":"vim-%e5%82%bb%e7%93%9c%e7%ad%86%e8%a8%98","status":"publish","type":"post","link":"https:\/\/blog.jason-lam.com\/?p=489","title":{"rendered":"vim \u50bb\u74dc\u7b46\u8a18"},"content":{"rendered":"\n<p>\u5fc5\u8981\u77e5\u8b58\uff1a<br>1. \u4f60\u8981\u662f\u5df2\u7d93\u5b89\u88dd\u4e86vim? \u53ef\u4ee5\u901a\u77e5\u5728 shell\u4e2d\u8f38\u5165 command -v vim \u4f86\u67e5\u770b\u662f\u5426\u5df2\u7d93\u5b89\u88dd\u3002\u5982\u679c\u672a\u6709\u5b89\u88dd\uff0c\u5247\u9700\u8981\u624b\u6a5f\u5b89\u88dd(\u5408\u9069\u7248\u672c\u7684)vim\u3002<br>2. \u6aa2\u67e5\u81ea\u5df1\u6b63\u5728\u7528\u7684Linux\u767c\u884c\u7248\u672c\uff1acat \/etc\/os-release \u5f8c\uff0c\u9078\u64c7\u5408\u9069\u7684\u7248\u672c\u4f86\u5b89\u88dd\u3002<br>3. Debian\u7cfb\u7d71(\u5305\u62ecUbentu)\u5b89\u88dd\u65b9\u6cd5\u70ba apt install vim<\/p>\n\n\n\n<p>Normal Mode\u5e38\u7528\u6307\u4ee4<br>Shift A: \u9032\u5165\u7de8\u8f2f\u6a21\u5f0f\u4e26\u5c07cursor\u7f6e\u65bc\u884c\u672b<br>0 the beginning of the line<br>$ the end of line<br>Delete a character: x<br>Delete a entire row: dd<br>Undo:  u<\/p>\n\n\n\n<p>gg -&gt; to the very beginning of the file<br>G -&gt; to the very end of the file<br><\/p>\n\n\n\n<p>: \u9032\u5165Command Mode<br>! \u57f7\u884c linux\u6307\u4ee4<br>:q \u96e2\u958b\uff0c\u6240\u6709\u4fee\u6539\u5167\u5bb9\uff08\u5982\u6709\uff09\u4e0d\u5132\u5b58\u3002<br>:s \u5132\u5b58\u4fee\u6539\u5167\u5bb9\u4e26\u7d50\u675f\u7de8\u8f2f\u3002<br><\/p>\n\n\n\n<p>i \u9032\u5165\u7de8\u8f2f\u6a21\u5f0f Insert Mode<br><\/p>\n\n\n\n<p>Concept of buffers<br>bp<br>bn<br>enew<br><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe title=\"[Ubuntu][\u6559\u5b78] Linux\u57fa\u672c\u6307\u4ee4#08.  Vim\u6587\u5b57\u7de8\u8f2f\u5668\u7684\u57fa\u672c\u7de8\u8f2f2(whereis, which, \u8edf\u9023\u7d50\u6982\u5ff5, vim:  \u641c\u5c0b \u522a\u9664 \u6253\u958b\u6b04\u865f undo redo)\" width=\"1200\" height=\"900\" src=\"https:\/\/www.youtube.com\/embed\/zUSM1Drh6vU?start=4&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fc5\u8981\u77e5\u8b58\uff1a1. \u4f60\u8981\u662f\u5df2\u7d93\u5b89\u88dd\u4e86vim? \u53ef\u4ee5\u901a\u77e5\u5728 shell\u4e2d\u8f38\u5165 command -v vim \u4f86\u67e5\u770b\u662f\u5426\u5df2\u7d93\u5b89\u88dd\u3002\u5982\u679c\u672a\u6709\u5b89\u88dd\uff0c\u5247\u9700\u8981\u624b\u6a5f\u5b89\u88dd(\u5408\u9069\u7248\u672c\u7684)vim\u30022. \u6aa2\u67e5\u81ea\u5df1\u6b63\u5728\u7528\u7684Linux\u767c\u884c\u7248\u672c\uff1acat \/etc\/os-release \u5f8c\uff0c\u9078\u64c7\u5408\u9069\u7684\u7248\u672c\u4f86\u5b89\u88dd\u30023. Debian\u7cfb\u7d71(\u5305\u62ecUbentu)\u5b89\u88dd\u65b9\u6cd5\u70ba apt install vim Normal Mode\u5e38\u7528\u6307\u4ee4Shift A: \u9032\u5165\u7de8\u8f2f\u6a21\u5f0f\u4e26\u5c07cursor\u7f6e\u65bc\u884c\u672b0 the beginning of the line$ the end of lineDelete a character: xDelete a entire row: ddUndo: u gg -&gt; to the very beginning of the fileG -&gt; to the very end of the file : \u9032\u5165Command [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-489","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/posts\/489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=489"}],"version-history":[{"count":12,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/posts\/489\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=\/wp\/v2\/posts\/489\/revisions\/758"}],"wp:attachment":[{"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jason-lam.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}