{"id":295482,"date":"2025-01-10T04:07:53","date_gmt":"2025-01-09T20:07:53","guid":{"rendered":"https:\/\/lrxjmw.cn\/lzwlmsytsxwf.html"},"modified":"2025-01-10T04:07:53","modified_gmt":"2025-01-09T20:07:53","slug":"lzwlmsytsxwf","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lzwlmsytsxwf.html","title":{"rendered":"linux git\u4e2d\u6587\u4e71\u7801 \u4f7f\u7528tmux\u5b9e\u73b0\u65e0\u7f1d\u4f1a\u8bdd\u4fdd\u6301\uff1a\u63d0\u5347\u5f00\u53d1\u6548\u7387\u7684\u7ec8\u6781\u6307\u5357"},"content":{"rendered":"

\u6211\u7528tmux\u6709\u4e00\u6bb5\u65f6\u95f4\u4e86\uff0c\u5de5\u4f5c\u4e2d\u4f1a\u7528\u5230\u5b83\u7684\u300c\u4f1a\u8bdd\u4fdd\u6301\u300d\u8fd9\u4e00\u529f\u80fd\u3002\u5728\u300c\u8df3\u677f\u673a\u300d\u4e0a\u5efa\u4e00\u4e2atmux\u4f1a\u8bddlinux\u64cd\u4f5c\u7cfb\u7edf\u4ecb\u7ecd\uff0c\u4e4b\u540e\u6253\u5f00\u591a\u4e2atmuxwindow\uff0c\u5728\u6bcf\u4f4dwindow\u4e0bssh<\/a>\u8054\u63a5\u5230\u300c\u5f00\u53d1\u673a\u300d\uff0c\u8fd9\u662f\u5341\u5206\u666e\u904d\u7684\u5f00\u53d1\u65b9\u6cd5\u3002\u4e0a\u73ed\u65f6\u6211\u53ea\u8981\u6309bind-key+d\u8131\u79bb\u4f1a\u8bdd\uff0c\u7b14\u8bb0\u672c\u585e\u5b50\u4e00\u5408\u5c31\u53ef\u4ee5\u8d70\u4eba\uff0c\u5f53\u524d\u673a\u5668\u4e0a\u7684\u591a\u4e2assh\u8054\u63a5\u3001\u6253\u5f00\u7684\u6587\u6863\u3001\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u90fd\u6beb\u65e0\u300c\u8fdd\u548c\u611f\u300d\u5730\u540c\u6b65\u300c\u4e0b\u73ed\u300d\u3002<\/p>\n

\u7b2c\u4e8c\u5929\u4e0b\u73ed\uff0c\u6211\u8054\u63a5\u5230\u300c\u8df3\u677f\u673a\u300d\uff0c\u7b80\u5355\u5730\u6267\u884c2\u4e2a\u547d\u4ee4<\/a>\uff0c\u5c31\u53ef\u4ee5\u91cd\u65b0\u5feb\u901f\u6302\u8f7d\u5230\u4eca\u5929\u7684tmux\u4f1a\u8bdd\uff0c\u4e4b\u524d\u6784\u5efa\u7684\u591a\u4e2assh\u8054\u63a5\u3001\u6253\u5f00\u7684\u6587\u6863\u3001\u8fd0\u884c\u5730\u7a0b\u5e8f\uff0c\u53c8\u90fd\u6beb\u65e0\u300c\u8fdd\u548c\u611f\u300d\u5730\u540c\u6b65\u300c\u4e0a\u73ed\u300d\uff0c\u4fdd\u6301\u7740\u660e\u5929\u7684\u72b6\u6001\uff08\u5176\u5b9e\uff0c\u8fd0\u884c\u7740\u7684\u7a0b\u5e8f\u6ca1\u6709\u9000\u51fa\u7684\u610f\u601d\uff09\u3002\u6784\u5efatmux\u4f1a\u8bdd\u65f6\u6211\u5e76\u6ca1\u6709\u6307\u5b9a\u540d\u79f0\uff0c\u91cd\u65b0\u6302\u8f7d\u5230\u4f1a\u8bdd\u4e0a\u5341\u5206\u7b80\u5355\uff1a<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ tmux ls    \/\/ \u5217\u51fa\u5f53\u524d\u7684tmux\u4f1a\u8bdd\uff0c ls = list session\n0: 4 windows (created Wed Nov  6 18:37:38 2013) [181x50] (attached)\n[xiaojie.zhang1@FS67 ~]$ tmux attach -t 0    \/\/ \u6302\u8f7d\u5230\u7b2c\u4e00\u4e2a\u4f1a\u8bdd\uff0c -t 0\n<\/code><\/pre>\n<\/p>\n

\u4f46\u662f\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u78b0\u5230\u4e00\u4e2a\u5c4f\u5e55\u663e\u793a\u9519\u4e71\u7684\u95ee\u9898\uff0c\u5728ssh\u8fde\u4e0a\u300c\u5f00\u53d1\u673a\u300d\u540e\uff0c\u5728\u300c\u5f00\u53d1\u673a\u300d\u4e0a\u7528vim<\/a>\u6253\u5f00\u5305\u542b\u6709\u82f1\u6587\u7684\u4ee3\u7801\uff0c\u8fd8\u4f1a\u51fa\u73b0\uff1a<\/p>\n

\u4e07\u80fd\u7684google\u4f1a\u544a\u8bc9\u6211\u5728tmux\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a02\u4e2autf8\u7684\u9879\uff1a<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ grep utf8 ~\/.tmux.conf\nsetw -g utf8 on\nset -g status-utf8 on\n<\/code><\/pre>\n<\/p>\n

\u6dfb\u52a0\u4e86\u4ee5\u540e\u5c31\u51fa\u73b0\u4e86\u82f1\u6587\u300c\u4e71\u7801\u300d\u3002<\/p>\n

\u8fd92\u4e2a\u914d\u7f6e\u9879\u662f\u4e0d\u80fd\u89e3\u51b3\u95ee\u9898\u7684\uff0c\u4e71\u7801\u7684\u8bf1\u56e0\u6709\u591a\u4e2a\u7684\u597d\u5417\uff01\uff01\uff01\uff01<\/p>\n

\u7ec8\u7aef\u7684\u7f16\u7801vim\u7684\u7f16\u7801tmux\u7684\u7f16\u7801\u7cfb\u7edf\u7684locale<\/p>\n

\u5bf9\u4e8e\u7b2c1\u70b9\uff0c\u6211\u4f7f\u7528\u7684iterm2\uff0c\u4f7f\u7528\u7684\u5b57\u7b26\u7f16\u7801\u4e3aUnicode(UTF-8)\uff0c\u55ef\uff0c\u65e9\u5df2\u662futf8\u4e86\u3002<\/p>\n

\u5bf9\u4e8e\u7b2c2\u70b9\uff0c\u7528vim\u7684\u4eba\u90fd\u6653\u5f97\uff0cvim\u8bfb\u5199\u4e00\u4e2a\u6587\u4ef6\u65f6\uff0c\u4f7f\u7528\u8bbe\u7f6e\u9879fenc\u914d\u7f6e\u7684\u7f16\u7801linux\u547d\u4ee4tar\uff0c\u4f8b\u5982utf8\uff1b\u800cvim\u663e\u793a\u6587\u4ef6\u5185\u5bb9\uff0c\u4f7f\u7528\u7684\u662f\u53e6\u4e00\u4e2a\u8bbe\u7f6e\u9879tenc\u914d\u7f6e\u7684\u7f16\u7801\uff0c\u5047\u82e5\u8fd92\u4e2a\u914d\u7f6e\u7684\u7f16\u7801\u4e0d\u4e00\u81f4\uff0c\u5c31\u624d\u80fd\u770b\u89c1vim\u7684\u4e71\u7801\u3002\u6211\u5148\u786e\u8ba4vim\u6253\u5f00\u6587\u4ef6\u7684\u7f16\u7801\u548c\u5c55\u793a\u90fd\u7528\u5230utf8\u7f16\u7801\uff0c\u4e8c\u8005\u7f16\u7801\u4e00\u81f4\uff1a<\/p>\n

\n

:set fenc    \/\/ \u5728vim\u547d\u4ee4\u884c\u4e0b\n  fileencoding=utf-8    \/\/ vim\u547d\u4ee4\u884c\u4e0b\u7684\u8f93\u51fa\n:set tenc    \/\/ \u540c\u4e0a\n  termencoding=utf-8\n<\/code><\/pre>\n<\/p>\n

\u867d\u7136\uff0c\u4e0d\u7528tmux\uff0c\u4ece\u300c\u8df3\u677f\u673a\u300dssh\u8fde\u4e0a\u300c\u5f00\u53d1\u673a\u300dlinux git\u4e2d\u6587\u4e71\u7801<\/strong>\uff0c\u518d\u4f7f\u7528vim\u6253\u5f00\u4efb\u4f55\u6587\u672c\uff0c\u90fd\u662f\u4e0d\u4f1a\u4e71\u7801\u7684\uff08\u7531\u4e8evim\u914d\u7f6e\u4e86\u6b63\u786e\u7684\u7f16\u7801\u65b9\u6cd5\uff09\u3002<\/p>\n

\u5bf9\u4e8e\u7b2c3\u70b9\uff0ctmux\u6dfb\u52a0\u4e86utf8\u7684\u7f16\u7801\u4e5f\u6ca1\u6709\u7597\u6548\uff08\u867d\u7136\u8fd92\u4e2a\u662f\u8bbe\u7f6etmuxwindow\u7684\u597d\u5417\uff09\uff0ctmux\u7684\u663e\u793a\u7a76\u7adf\u662f\u6309\u7167\u90a3\u91cc\u7684\u914d\u7f6e\uff1f\uff1f<\/p>\n

\u5230\u4e86\u7b2c4\u70b9\uff0c\u786e\u8ba4\u662f\u7cfb\u7edf\u7684locale\u95ee\u9898\u4e86linux git\u4e2d\u6587\u4e71\u7801<\/strong>\uff0ctmux\u4f9d\u8d56\u4e8e\u8fd9\u79cd\u8bbe\u7f6e\u3002\u56e0\u4e3a\u6211\u662f\u5728\u300c\u8df3\u677f\u673a\u300d\u4e0a\u4f7f\u7528tmux\uff0ctmux\u4f1a\u4f7f\u7528\u5230\u300c\u8df3\u677f\u673a\u300d\u4e0a\u7684locale\u53c2\u6570\uff0c\u67e5\u770b\uff1a<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ locale\nLANG=en_US.en\nLC_CTYPE=\"C\"\nLC_NUMERIC=\"C\"\nLC_TIME=\"C\"\nLC_COLLATE=\"C\"\nLC_MONETARY=\"C\"\nLC_MESSAGES=\"C\"\nLC_PAPER=\"C\"\nLC_NAME=\"C\"\nLC_ADDRESS=\"C\"\nLC_TELEPHONE=\"C\"\nLC_MEASUREMENT=\"C\"\nLC_IDENTIFICATION=\"C\"\nLC_ALL=C\n<\/code><\/pre>\n<\/p>\n

\u679c\u7136\uff01\uff01\uff01\uff01\u4e8e\u662f\u518d\u68c0\u6d4b\u300c\u8df3\u677f\u673a\u300d\u4e0a\u662f\u5426\u65e9\u5df2\u5b89\u88c5zh_cn\u5b57\u7b26\u96c6:<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ locale -a | grep -i zh_cn\nzh_CN\nzh_CN.gb18030\nzh_CN.gb2312\nzh_CN.gbk\nzh_CN.utf8\n<\/code><\/pre>\n<\/p>\n

\u6ca1\u8ba9\u6211\u6cae\u4e27\uff0c\u6709zh_cn.utf8\uff0c\u6dfb\u52a0\u5230profile\u91cc\u5427:<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ grep -i utf ~\/.bash_profile\nexport LANG=\"zh_CN.UTF-8\"\nexport LC_ALL=\"zh_CN.UTF-8\"\n<\/code><\/pre>\n<\/p>\n

kill\u6389tmux\u5f53\u524d\u7684\u4f1a\u8bdd\uff0c\u91cd\u65b0\u767b\u5165\u300c\u8df3\u677f\u673a\u300d\uff0c\u65b0\u5efa\u4e00\u4e2atmux\u4f1a\u8bdd\uff0c\u518d\u5ea6\u786e\u8ba4tmux\u52a0\u8f7d\u5230\u65b0\u7684locale<\/p>\n

\n

[xiaojie.zhang1@FS67 ~]$ tmux    \/\/ \u65b0\u5efa\u4e00\u4e2atmux\u4f1a\u8bdd\u548c\u7a97\u53e3\n[xiaojie.zhang1@FS67 ~]$ locale    \/\/ \u8fdb\u5165tmux\u7684\u7a97\u53e3\uff0c\u518d\u786e\u8ba4\u4e00\u6b21locale\nLANG=zh_CN.UTF-8\nLC_CTYPE=\"zh_CN.UTF-8\"\nLC_NUMERIC=\"zh_CN.UTF-8\"\nLC_TIME=\"zh_CN.UTF-8\"\nLC_COLLATE=\"zh_CN.UTF-8\"\nLC_MONETARY=\"zh_CN.UTF-8\"\nLC_MESSAGES=\"zh_CN.UTF-8\"\nLC_PAPER=\"zh_CN.UTF-8\"\nLC_NAME=\"zh_CN.UTF-8\"\nLC_ADDRESS=\"zh_CN.UTF-8\"\nLC_TELEPHONE=\"zh_CN.UTF-8\"\nLC_MEASUREMENT=\"zh_CN.UTF-8\"\nLC_IDENTIFICATION=\"zh_CN.UTF-8\"\nLC_ALL=zh_CN.UTF-8\n<\/code><\/pre>\n<\/p>\n

tmux\u7528\u5230\u4e86utf8\u4e86\uff0c\u8fd9\u65f6\u518dssh\u8054\u63a5\u5230\u300c\u5f00\u53d1\u673a\u300d\uff0cvim\u6253\u5f00\u4e4b\u524d\u7684\u6587\u4ef6\uff0c\u4e71\u7801\u5df2\u6210\u65e7\u4e8b\uff0c\u5176\u5b9e\u4e5f\u4e0d\u4f1a\u663e\u793a\u9519\u4e71\u3002<\/p>\n

\u4e5f\u5c31\u662f\u8bf4\uff0c\u82e5\u8981\u300c\u4e71\u7801\u300d\u5df2\u6210\u65e7\u4e8b\uff0c\u987b\u89814\u4e2a\u5730\u65b9\u7684\u7f16\u7801\uff1a<\/p>\n

\u7ec8\u7aef\u4f7f\u7528utf8\u7f16\u7801\uff08\u4f8b\u5982\u6211\u4f7f\u7528iterm2\uff0citem2\u7684\u7ec8\u7aef\u5b57\u7b26\u96c6\u4e3aUnicode(UTF-8)\uff09<\/p>\n

\u4f7f\u7528tmux\u7684\u673a\u5668\u4e0a\uff08\u4f8b\u5982\u6211\u8fd9\u513f\u7684\u300c\u8df3\u677f\u673a\u300d\uff09\uff0c\u5176\u4e2a\u4ebaprofile\u7684locale\u4f7f\u7528utf8<\/p>\n

\n

 [xiaojie.zhang1@FS67 ~]$ grep -i utf ~\/.bash_profile\n export LANG=\"zh_CN.UTF-8\"\n

<\/p>\n export LC_ALL=\"zh_CN.UTF-8\"\n<\/code><\/pre>\n<\/p>\n

\u6bcf\u6b21\u767b\u5165\u5c31\u4f1aexport\u8fd92\u4e2a\u73af\u5883\u53d8\u91cf\uff0c\u56e0\u800c\u8bbe\u7f6elocale\u3002<\/p>\n

\u5f00\u53d1\u673a\u300d\u4e0avim\u8bbe\u7f6eutf8\u7f16\u7801\uff08linux)<\/p>\n

\n

 xiaojie.zhang1@log83 ~$ grep enc ~\/.vimrc\n set enc=utf8\n set fencs=utf8,gbk,gb2312,gb18030,cp936\n<\/code><\/pre>\n<\/p>\n

vim\u91cc\u867d\u7136\u6ca1\u5fc5\u8981\u8bbe\u7f6etenc\uff0c\u5b83\u4f1a\u4ecefencs\u5217\u8868\u4e2d\u9009\u4e00\u4e2a\u9002\u5b9c\u7684\u7f16\u7801\u65b9\u6cd5\u3002<\/p>\n

tmux\u5012\u662f\u53ef\u4ee5\u4e0d\u8bbe\u7f6eutf8<\/p>\n

\u63a8\u8350\u4e00\u4e2a\u8bb2\u89e3vim\u7f16\u7801\u65b9\u6cd5\u7684\u666e\u53cablog:VIM\u4e71\u7801\u7f18\u7531\u4e0e\u89e3\u51b3\u65b9\u6848<\/p>\n

\u2013EOF\u2013<\/p>\n

Categories:in_mac<\/p>\n

Tags:iterm<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ec8\u7aef\u7684\u7f16\u7801vim\u7684\u7f16\u7801tmux\u7684\u7f16\u7801\u7cfb\u7edf\u7684locale\u6211\u4f7f\u7528\u7684iterm2\uff0c\u4f7f\u7528\u7684\u5b57\u7b26\u7f16\u7801\u4e3aUnicode(UTF-8)\uff0c\u55ef\uff0c\u5df2\u7ecf\u662futf8\u4e86\u3002\u6211\u5148\u786e\u8ba4vim\u6253\u5f00\u6587\u4ef6\u7684\u7f16\u7801\u548c\u5c55\u793a\u90fd\u7528\u5230utf8\u7f16\u7801\uff0c\u4e24\u8005\u7f16\u7801\u4e00\u81f4\uff1a\u5f00\u53d1\u673a\u300d\u4e0avim\u8bbe\u7f6eutf8\u7f16\u7801\uff08linux)tmux\u5012\u662f\u53ef\u4ee5\u4e0d\u8bbe\u7f6eutf8<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[5522,440,5523,132,5521],"class_list":["post-295482","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-locale","tag-ssh","tag-tmux","tag-vim","tag-pmxscl"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=295482"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295482\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}