{"id":14,"date":"2015-05-01T14:42:19","date_gmt":"2015-05-01T06:42:19","guid":{"rendered":"http:\/\/zfframework.com\/blog\/?p=14"},"modified":"2019-08-26T15:24:51","modified_gmt":"2019-08-26T07:24:51","slug":"gvim-%e5%90%af%e5%8a%a8%e6%97%b6%e7%aa%97%e5%8f%a3%e8%87%aa%e5%8a%a8%e5%b1%85%e4%b8%ad","status":"publish","type":"post","link":"http:\/\/zsaber.com\/blog\/p\/14","title":{"rendered":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d"},"content":{"rendered":"<p>\u6700\u8fd1\u6298\u817e vim, \u9664\u4e86\u914d\u7f6e\u5de8\u9ebb\u70e6\u5916, \u53e6\u4e00\u4e2a\u5f88\u86cb\u75bc\u7684\u5c31\u662f\u7a97\u53e3\u4f4d\u7f6e\u95ee\u9898\u4e86, \u6298\u817e\u4e86\u534a\u5929\u65e0\u6cd5\u542f\u52a8\u65f6\u81ea\u52a8\u5c45\u4e2d, \u627e\u904d\u5404\u5730\u4e5f\u53ea\u6709\u4fdd\u5b58\u4e0a\u6b21\u4f4d\u7f6e, \u4e0b\u6b21\u542f\u52a8\u65f6\u6062\u590d\u7684\u65b9\u6cd5<br \/>\n\u5e9f\u8bdd\u4e0d\u591a\u8bf4, \u76f4\u63a5\u4e0a\u4ee3\u7801, \u4e22\u5230 vimrc \u4e2d\u5373\u53ef:<\/p>\n<pre><code class=\"language-vim\">function WindowCenterInScreen()\n    set lines=9999 columns=9999\n    let g:windowsSizeFixX = 58\n    let g:windowsSizeFixY = 118\n    let g:windowsScaleX = 7.75\n    let g:windowsScaleY = 17.0\n    let g:windowsPosOldX = getwinposx()\n    let g:windowsPosOldY = getwinposy()\n    let g:windowsScreenWidth = float2nr(winwidth(0) * g:windowsScaleX) + g:windowsPosOldX + g:windowsSizeFixX\n    let g:windowsScreenHeight = float2nr(winheight(0) * g:windowsScaleY) + g:windowsPosOldY + g:windowsSizeFixY\n    set lines=30 columns=108\n    let g:windowsSizeWidth = float2nr(winwidth(0) * g:windowsScaleX) + g:windowsSizeFixX\n    let g:windowsSizeHeight = float2nr(winheight(0) * g:windowsScaleY) + g:windowsSizeFixY\n    let g:windowsPosX = ((g:windowsScreenWidth - g:windowsSizeWidth) \/ 2)\n    let g:windowsPosY = ((g:windowsScreenHeight - g:windowsSizeHeight) \/ 2)\n    exec &#039;:winpos &#039; . g:windowsPosX . &#039; &#039; . g:windowsPosY\nendfunc\nau GUIEnter * call WindowCenterInScreen()<\/code><\/pre>\n<p>\u51e0\u4e2a magic number \u7684\u89e3\u91ca:<\/p>\n<ul>\n<li>\n<p><code>windowsSizeFixX\/Y<\/code><\/p>\n<p>\u7cfb\u7edf\u7a97\u53e3\u8fb9\u6846\u7684\u5927\u5c0f, \u50cf\u7d20\u4e3a\u5355\u4f4d<\/p>\n<\/li>\n<li>\n<p><code>windowsScaleX\/Y<\/code><\/p>\n<p>\u5355\u4e2a\u5b57\u7b26\u7684\u5e73\u5747\u5bbd\u9ad8, \u50cf\u7d20\u4e3a\u5355\u4f4d<\/p>\n<p>\u53ef\u4ee5\u628a\u7a97\u53e3\u6700\u5927\u5316, \u8ba1\u7b97\u4e00\u4e0b\u603b\u50cf\u7d20\u548c\u603b\u5b57\u7b26\u6570, \u9664\u6cd5\u4e00\u4e0b\u5c31\u597d\u4e86<\/p>\n<\/li>\n<\/ul>\n<p>\u5728\u76f8\u540c DPI \u7684\u5c4f\u5e55\u4e0b, \u65e0\u8bba\u4ec0\u4e48\u5206\u8fa8\u7387\u90fd\u80fd\u81ea\u52a8\u5c45\u4e2d<\/p>\n<p>\u4e0d\u540c DPI \u7684\u5c4f\u5e55\u4e0b, \u9700\u91cd\u65b0\u8ba1\u7b97\u90a3\u51e0\u4e2a magic number<\/p>\n<p>over<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u6298\u817e vim, \u9664\u4e86\u914d\u7f6e\u5de8\u9ebb\u70e6\u5916, \u53e6\u4e00\u4e2a\u5f88\u86cb\u75bc\u7684\u5c31\u662f\u7a97\u53e3\u4f4d\u7f6e\u95ee\u9898\u4e86, \u6298\u817e\u4e86\u534a\u5929\u65e0\u6cd5\u542f\u52a8\u65f6\u81ea\u52a8\u5c45\u4e2d, \u627e\u2026 <span class=\"read-more\"><a href=\"http:\/\/zsaber.com\/blog\/p\/14\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/zsaber.com\/blog\/p\/14\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"\u6700\u8fd1\u6298\u817e vim, \u9664\u4e86\u914d\u7f6e\u5de8\u9ebb\u70e6\u5916, \u53e6\u4e00\u4e2a\u5f88\u86cb\u75bc\u7684\u5c31\u662f\u7a97\u53e3\u4f4d\u7f6e\u95ee\u9898\u4e86, \u6298\u817e\u4e86\u534a\u5929\u65e0\u6cd5\u542f\u52a8\u65f6\u81ea\u52a8\u5c45\u4e2d, \u627e\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"http:\/\/zsaber.com\/blog\/p\/14\" \/>\n<meta property=\"og:site_name\" content=\"\u67d0Z\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-01T06:42:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-26T07:24:51+00:00\" \/>\n<meta name=\"author\" content=\"Z\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Z\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14#article\",\"isPartOf\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14\"},\"author\":{\"name\":\"Z\",\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"headline\":\"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d\",\"datePublished\":\"2015-05-01T06:42:19+00:00\",\"dateModified\":\"2019-08-26T07:24:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14\"},\"wordCount\":10,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"articleSection\":[\"vim\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/zsaber.com\/blog\/p\/14#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14\",\"url\":\"http:\/\/zsaber.com\/blog\/p\/14\",\"name\":\"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#website\"},\"datePublished\":\"2015-05-01T06:42:19+00:00\",\"dateModified\":\"2019-08-26T07:24:51+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/zsaber.com\/blog\/p\/14\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/14#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/zsaber.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/zsaber.com\/blog\/#website\",\"url\":\"http:\/\/zsaber.com\/blog\/\",\"name\":\"\u67d0Z\u7684\u535a\u5ba2\",\"description\":\"\u7b80\u4ecb\u53c8\u4e0d\u80fd\u5403\",\"publisher\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/zsaber.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\",\"name\":\"Z\",\"logo\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"\u67d0Z\",\"sameAs\":[\"http:\/\/ZFFramework.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/zsaber.com\/blog\/p\/14","og_locale":"zh_CN","og_type":"article","og_title":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2","og_description":"\u6700\u8fd1\u6298\u817e vim, \u9664\u4e86\u914d\u7f6e\u5de8\u9ebb\u70e6\u5916, \u53e6\u4e00\u4e2a\u5f88\u86cb\u75bc\u7684\u5c31\u662f\u7a97\u53e3\u4f4d\u7f6e\u95ee\u9898\u4e86, \u6298\u817e\u4e86\u534a\u5929\u65e0\u6cd5\u542f\u52a8\u65f6\u81ea\u52a8\u5c45\u4e2d, \u627e\u2026 Read More &raquo;","og_url":"http:\/\/zsaber.com\/blog\/p\/14","og_site_name":"\u67d0Z\u7684\u535a\u5ba2","article_published_time":"2015-05-01T06:42:19+00:00","article_modified_time":"2019-08-26T07:24:51+00:00","author":"Z","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"Z","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/zsaber.com\/blog\/p\/14#article","isPartOf":{"@id":"http:\/\/zsaber.com\/blog\/p\/14"},"author":{"name":"Z","@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"headline":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d","datePublished":"2015-05-01T06:42:19+00:00","dateModified":"2019-08-26T07:24:51+00:00","mainEntityOfPage":{"@id":"http:\/\/zsaber.com\/blog\/p\/14"},"wordCount":10,"commentCount":0,"publisher":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"articleSection":["vim"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/zsaber.com\/blog\/p\/14#respond"]}]},{"@type":"WebPage","@id":"http:\/\/zsaber.com\/blog\/p\/14","url":"http:\/\/zsaber.com\/blog\/p\/14","name":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d - \u67d0Z\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/zsaber.com\/blog\/#website"},"datePublished":"2015-05-01T06:42:19+00:00","dateModified":"2019-08-26T07:24:51+00:00","breadcrumb":{"@id":"http:\/\/zsaber.com\/blog\/p\/14#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/zsaber.com\/blog\/p\/14"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/zsaber.com\/blog\/p\/14#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/zsaber.com\/blog"},{"@type":"ListItem","position":2,"name":"gVim \u542f\u52a8\u65f6\u7a97\u53e3\u81ea\u52a8\u5c45\u4e2d"}]},{"@type":"WebSite","@id":"http:\/\/zsaber.com\/blog\/#website","url":"http:\/\/zsaber.com\/blog\/","name":"\u67d0Z\u7684\u535a\u5ba2","description":"\u7b80\u4ecb\u53c8\u4e0d\u80fd\u5403","publisher":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/zsaber.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f","name":"Z","logo":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/image\/"},"description":"\u67d0Z","sameAs":["http:\/\/ZFFramework.com"]}]}},"_links":{"self":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts\/14"}],"collection":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":0,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"wp:attachment":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}