{"id":167528,"date":"2020-10-14T21:07:33","date_gmt":"2020-10-14T13:07:33","guid":{"rendered":"http:\/\/4563.org\/?p=167528"},"modified":"2020-10-14T21:07:33","modified_gmt":"2020-10-14T13:07:33","slug":"%e8%af%b7%e6%95%99%ef%bc%8c%e4%b8%ba%e4%bb%80%e4%b9%88-vim-%e7%9a%84%e5%bc%ba%e5%88%b6%e4%bf%9d%e5%ad%98%e8%bf%99%e4%b9%88%e5%8e%89%e5%ae%b3%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=167528","title":{"rendered":"\u8bf7\u6559\uff0c\u4e3a\u4ec0\u4e48 vim \u7684\u5f3a\u5236\u4fdd\u5b58\u8fd9\u4e48\u5389\u5bb3\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\uff0c\u4e3a\u4ec0\u4e48 vim \u7684\u5f3a\u5236\u4fdd\u5b58\u8fd9\u4e48\u5389\u5bb3\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jzq526 <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u65e0\u610f\u4e2d\u53d1\u73b0\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u5728 centos7 \u548c debian \u7cfb\u7edf\u4e0a\u90fd\u51fa\u73b0\u4e86\uff0c\u5e94\u8be5\u4e0d\u662f\u53d1\u884c\u7248\u7684\u95ee\u9898\u3002 \u5148\u5728\u666e\u901a\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6 f1\uff1a<code>touch f1<\/code> \u67e5\u770b\u5176\u5c5e\u6027\uff1a<\/p>\n<pre><code>ls -l  -rw-r--r-- 1 vk vk  26 10 \u6708 13 11:37 f1  <\/code><\/pre>\n<p>\u7136\u540e\u4fee\u6539\u6587\u4ef6 f1 \u7684\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4\uff1a<\/p>\n<pre><code>sudo chown root:root f1  ls -l  -rw-r--r-- 1 root root   0 10 \u6708 13 11:36 f1  <\/code><\/pre>\n<p>\u5728 vk \u7528\u6237\u4e0b\u7f16\u8f91\uff1a<code>vim f1<\/code> \u5199\u5165\u4e00\u4e9b\u5185\u5bb9\u4e4b\u540e\uff0c\u76f4\u63a5 <code>\uff1aw<\/code>\u662f\u65e0\u6cd5\u4fdd\u5b58\u7684\uff0c\u63d0\u793a\u4e0d\u80fd\u5199\u5165\u53ea\u8bfb\u6587\u4ef6\u3002\u4f46\u53ef\u4ee5\u7528<code>:w!<\/code>\u4fdd\u5b58\uff0c\u4fdd\u5b58\u540e\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4\u5c31\u56de\u5230\u4e86 \u7528\u6237 vk \u548c \u7ec4 vk \u3002<\/p>\n<p>(\u4f46\u5728\u5176\u4ed6\u76ee\u5f55\u4e0b\u5c31\u4e0d\u884c\u4e86)<\/p>\n<p>vim \u7684\u5f3a\u5236\u4fdd\u5b58\u8fd9\u4e48\u5389\u5bb3\u5417\uff1f\u8fd8\u662f Linux \u5bf9\u4e3b\u76ee\u5f55\u6709\u4ec0\u4e48\u7279\u6b8a\u8bbe\u7f6e\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3715517\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : whenov <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             :w[rite]! [++opt] Like &#8220;:write&#8221;, but forcefully write when &#8216;readonly&#8217; is<br \/> set or there is another reason why writing was<br \/> refused.<br \/> Note: This may change the permission and ownership of<br \/> the file and break (symbolic) links. Add the &#8216;W&#8217; flag<br \/> to &#8216;cpoptions&#8217; to avoid this.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715518\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NeezerGu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4ee5\u524d\u4e5f\u4e0d\u77e5\u9053\uff0c\u4e0d\u8fc7\u6211\u5728 mac \u4e0b\u8bd5\u4e86\u4e0b\u3002 \u6362\u4e86\u4e2a\u601d\u8def\uff0c\u5728 chown \u5230 root \u4e4b\u540e\uff0c\u4e0d\u5e26 sudo \u76f4\u63a5 chown \u56de\u6765\u662f\u4e0d\u884c\u7684\uff0c\u4f46\u6211\u53ef\u4ee5\u5220\u9664\u5b83\uff0c\u76f8\u5bf9\u4e8e\u5176\u4ed6\u81ea\u5df1\u540d\u4e0b\u7684\u6587\u4ef6\uff0c\u53ea\u662f\u591a\u4e86\u4e2a\u662f\u5426\u786e\u5b9a\u800c\u5df2\u3002<\/p>\n<p>\u90a3\u4e48\uff0cvim \u81ea\u7136\u53ef\u4ee5\u8fdb\u884c\uff0c\u5148\u5220\u9664\u540e\u91cd\u65b0\u521b\u5efa\u5e76\u5199\u5165\u7684\u64cd\u4f5c\uff08\u5f53\u7136\u53ef\u80fd\u6709\u66f4\u597d\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u6211\u53ea\u662f\u63cf\u8ff0\u4e86\u8fd9\u5e76\u4e0d\u662f\u53ea\u6709 vim \u53ef\u4ee5\u5b9e\u73b0\uff09                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715519\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuboying <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             vim \u5e94\u8be5\u662f\u5220\u4e86\u8fd9\u4e2a\u6587\u4ef6\u91cd\u65b0\u5199\u4e86\u4e00\u4e2a\u3002\u8fd9\u4e2a\u6587\u4ef6\u666e\u901a\u7528\u6237\u662f\u53ef\u4ee5\u5220\u6389\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715520\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuboying <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xuboying \u60f3\u8981\u8bc1\u660e\u7684\u8bdd\u5e94\u8be5\u6709\u5f88\u591a\u529e\u6cd5\uff0c\u6bd4\u5982 ls -li \u770b\u6587\u4ef6\u7684\u5b9e\u4f53 node \u53f7\u662f\u5426\u53d1\u751f\u4e86\u53d8\u5316                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715521\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jzq526 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @NeezerGu \u5220\u9664\u6743\u9650\u5e94\u8be5\u662f\u6765\u81ea\u4e8e\u7528\u6237\u5bf9\u81ea\u5df1\u7684\u4e3b\u76ee\u5f55\u7684\u64cd\u4f5c\u6743\u9650\uff0c\u800c\u4e0d\u662f\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u7684\u64cd\u4f5c\u6743\u9650\u3002\u7528\u6237\u5bf9\u81ea\u5df1\u7684\u4e3b\u76ee\u5f55\u6709\u5b8c\u5168\u63a7\u5236\u6743\uff0c\u90a3\u4e48\u5bf9\u5176\u4e0b\u7684\u6587\u4ef6\u4e5f\u5c31\u53ef\u4ee5\u5220\u9664\uff0c\u8fd9\u662f\u6587\u4ef6\u6743\u9650\u4e0d\u80fd\u51b3\u5b9a\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715522\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NeezerGu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @jzq526 vim \u5c31\u5229\u7528\u8fd9\u4e2a\u6743\u9650\u5220\u9664\u518d\u91cd\u65b0\u521b\u5efa\u4e0d\u5c31\u597d\u4e86\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715523\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jzq526 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xuboying \u6211\u7528 stat \u547d\u4ee4\u67e5\u770b\u4e86 inode \u53f7\uff0c\u6ca1\u6709\u53d1\u751f\u53d8\u5316                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715524\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : VoldikSS <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u786e\u5b9e\u662f\u5220\u9664\u4e4b\u540e\u91cd\u65b0\u521b\u5efa\u4e86: https:\/\/github.com\/neovim\/neovim\/blob\/master\/src\/nvim\/fileio.c#L3165-L3167<\/p>\n<p>\u800c\u4e14\u7528 `stat` \u547d\u4ee4\u67e5\u770b\u65f6\uff0c\u6587\u4ef6\u7684\u521b\u5efa\u65f6\u95f4\u4e5f\u53d1\u751f\u4e86\u6539\u53d8                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3715525\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jzq526 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @VoldikSS \u6211\u521a\u624d\u8bd5\u4e86\u4e00\u4e0b\uff0c\u65f6\u95f4\u786e\u5b9e\u53d8\u4e86\u3002\u4f46\u6211\u53c8\u521b\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\uff0c\u6ca1\u6709\u6539\u53d8\u6240\u6709\u8005\u7b49\u5c5e\u6027\uff0c\u4fdd\u5b58\u540e\uff0c\u5b83\u7684\u65f6\u95f4\u4e5f\u53d8\u4e86\uff0c\u800c\u4e14\u662f\u4e09\u4e2a\u65f6\u95f4\u90fd\u53d8\u4e86\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e0d\u7ba1\u662f\u4e0d\u662f\u5f3a\u5236\u4fdd\u5b58\uff0c\u6587\u4ef6\u7684\u4e09\u4e2a\u65f6\u95f4\u5c5e\u6027\u90fd\u4f1a\u53d1\u751f\u6539\u53d8                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\uff0c\u4e3a\u4ec0\u4e48 vim \u7684\u5f3a\u5236\u4fdd\u5b58\u8fd9&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167528"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167528"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/167528\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167528"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}