{"id":12559,"date":"2016-12-05T09:00:05","date_gmt":"2016-12-05T00:00:05","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=12559"},"modified":"2018-11-14T16:33:44","modified_gmt":"2018-11-14T07:33:44","slug":"vim-change-colorscheme-when-readonly","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2016\/12\/05\/vim-change-colorscheme-when-readonly\/","title":{"rendered":"Vim\u3067\u8aad\u307f\u53d6\u308a\u5c02\u7528\u3060\u3063\u305f\u3068\u304d\u306b\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30de\u3092\u5909\u3048\u308b"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u6cb3\u91ce\u3067\u3059\u3002 \u79c1\u306f\u666e\u6bb5\u306fVim\u3092\u4f7f\u7528\u3057\u3066\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u305f\u308a\u3001\u3053\u306e\u8a18\u4e8b\u3082\u66f8\u3044\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u3002 \u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30de\u3092\u5909\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u3001\u3071\u3063\u3068\u898b\u308f\u304b\u308a\u3084\u3059\u3044\u306e\u3067\u306f\uff1f\u3068\u601d\u3063\u305f\u306e\u3067\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n vimrc\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n autocmd\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3060\u5f8c\u306b \u901a\u5e38\u306f\u3001gruvbox<\/a> \u3092Dark\u3067\u4f7f\u7528\u3057\u3066\u3044\u3066\u3001\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u5834\u5408\u306b\u306f\u3001morning<\/a> \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u6700\u521d\u306f\u3001 \u898b\u305f\u76ee\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u7de8\u96c6\u3067\u304d\u308b\u3068\u304d \u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u3068\u304d\uff08\u4e8c\u91cd\u3067\u958b\u3044\u3066\u3044\u307e\u3059\uff09 \u3071\u3063\u3068\u898b\u3067\u300c\u3046\u3001\u3046\u308f\u3041\u30fc\u30fc\u30fc\u30fc\u300d\u3063\u3066\u6c17\u3065\u304f\u306e\u3067\u3001\u3059\u3050\u306b\u5bfe\u51e6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n \u7570\u306a\u308b\u30bf\u30d6\u3084\u5206\u5272\u3057\u305f\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u3057\u307e\u3046\u3068\u3001 \u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u3060\u3051\u914d\u8272\u304c\u5909\u3048\u3089\u308c\u308b\u3068\u5b09\u3057\u3044\u306e\u3067\u3059\u304c\u3001\u3067\u304d\u306a\u3044\u3088\u3046\u3067\u3059\u306d\u2026\u3002<\/p>\n `Vim8` \u3060\u3068\u3053\u3093\u306a\u8a2d\u5b9a\u3082\u3067\u304d\u307e\u3059\uff01<\/p>\n \u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u3053\u3093\u306b\u3061\u306f\u3001\u6cb3\u91ce\u3067\u3059\u3002 \u79c1\u306f\u666e\u6bb5\u306fVim\u3092\u4f7f\u7528\u3057\u3066\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u305f\u308a\u3001\u3053\u306e\u8a18\u4e8b\u3082\u66f8\u3044\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u3002
\n\u3053\u308c\u306f\u3001 TECHSCORE Advent Calendar 2016 TECHSCORE BLOG<\/a> \u306e5\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n
\n\u305f\u307e\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4e8c\u91cd\u306b\u958b\u3044\u305f\u6642\u3084\u3001\/etc\u914d\u4e0b\u306e\u6a29\u9650\u304c\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u305f\u6642\u3001
\n\u8aad\u307f\u53d6\u308a\u5c02\u7528\u3067\u3042\u308b\u3053\u3068\u306b\u6c17\u3065\u304b\u305a\u306b\u305d\u306e\u307e\u307e\u7de8\u96c6\u3092\u9032\u3081\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002
\n\u30b9\u30c6\u30fc\u30bf\u30b9\u30e9\u30a4\u30f3\u306b\u8aad\u307f\u53d6\u308a\u5c02\u7528\u304b\u3069\u3046\u304b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u306a\u304b\u306a\u304b\u6c17\u3065\u304d\u306b\u304f\u3044\u3067\u3059\u3002<\/p>\n\u8a2d\u5b9a<\/h2>\n
function UpdateColorScheme()\r\n if &readonly && &buftype ==# \"\"\r\n colorscheme morning\r\n endif\r\nendfunction\r\nautocmd BufReadPost,BufEnter * call UpdateColorScheme()\r\n<\/code><\/pre>\n
UpdateColorScheme<\/code> \u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002
\nUpdateColorScheme\u306e\u4e2d\u3067\u306f\u3001 readonly<\/code>,
buftype<\/code> \u3092\u78ba\u8a8d\u3057\u3066\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30de\u3092\u6c7a\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n
buftype \u306b\u3064\u3044\u3066<\/h3>\n
readonly<\/code> \u3060\u3051\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u30d8\u30eb\u30d7\u3092\u958b\u3044\u305f\u969b\u306b\u3082\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30de\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001
buftype<\/code> \u3082\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002
\n(\u793e\u5185\u306eVimmer\u306b\u6559\u3048\u3066\u3082\u3089\u3044\u307e\u3057\u305f\u3002)<\/p>\n\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8<\/h2>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n
\u4e0a\u624b\u304f\u52d5\u304b\u306a\u3044\u70b9<\/h2>\n
\n\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u306e\u914d\u8272\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n\u304a\u307e\u3051\uff1a\u76ee\u304c\u3001\u76ee\u304c\u3041\u301c<\/h2>\n
let s:ticktock = 0\r\nlet s:timer = 0\r\n\r\nfunction! s:Mega(...)\r\n execute 'colorscheme' (s:ticktock ? 'gruvbox' : 'morning')\r\n let s:ticktock = !s:ticktock\r\nendfunction\r\n\r\nfunction! s:Megaaaa()\r\n if &readonly && &buftype ==# '' && !s:timer\r\n let s:timer = timer_start(100, funcref('s:Mega'), {'repeat': -1})\r\n endif\r\nendfunction\r\n\r\nautocmd BufReadPost,BufEnter * call s:Megaaaa()\r\n<\/code><\/pre>\n
<\/a><\/p>\n
\n\u3053\u308c\u306f\u3001 TECHSCORE Advent Calendar 2016 TECHSCORE BLOG \u306e5\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n
\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[239,18],"tags":[141,105],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12559"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=12559"}],"version-history":[{"count":11,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12559\/revisions"}],"predecessor-version":[{"id":12589,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12559\/revisions\/12589"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=12559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=12559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=12559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}