{"id":1578,"date":"2016-11-18T13:07:01","date_gmt":"2016-11-18T04:07:01","guid":{"rendered":"https:\/\/blog.ymyzk.com\/?p=1578"},"modified":"2016-11-18T13:07:01","modified_gmt":"2016-11-18T04:07:01","slug":"dein-vim-merlin-lazy-loading","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2016\/11\/dein-vim-merlin-lazy-loading\/","title":{"rendered":"dein.vim \u3092\u7528\u3044\u3066 Merlin \u3092\u9045\u5ef6\u8aad\u307f\u8fbc\u307f\u3059\u308b"},"content":{"rendered":"

Merlin<\/a> \u306f OCaml \u306e\u305f\u3081\u306e Vim \u3084 Emacs \u304b\u3089\u5229\u7528\u53ef\u80fd\u306a\u88dc\u5b8c\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059. \u30c7\u30d5\u30a9\u30eb\u30c8\u306e Vim \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u3067\u306f, Vim \u306e\u8d77\u52d5\u901f\u5ea6\u306b\u60aa\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u305f\u3081, \u30d7\u30e9\u30b0\u30a4\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u00a0dein.vim<\/a> \u3092\u7528\u3044\u3066\u9045\u5ef6\u8aad\u307f\u8fbc\u307f\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059.<\/p>\n

<\/p>\n

Merlin \u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n

Merlin \u306f OPAM \u3092\u4f7f\u3046\u3068\u7c21\u5358\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059.<\/p>\n

opam install merlin<\/code><\/pre>\n

Merlin \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3059\u308b\u3068, \u6b21\u306e\u3088\u3046\u306a Vim \u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u624b\u9806\u304c\u8868\u793a\u3055\u308c\u307e\u3059.<\/p>\n

Quick setup for VIM\r\n-------------------\r\nAppend this to your .vimrc to add merlin to vim's runtime-path:\r\nlet g:opamshare = substitute(system('opam config var share'),'\\n$','','''')\r\nexecute \"set rtp+=\" . g:opamshare . \"\/merlin\/vim\"\r\n\r\nAlso run the following line in vim to index the documentation:\r\n:execute \"helptags \" . g:opamshare . \"\/merlin\/vim\/doc\"<\/code><\/pre>\n

\u3053\u306e\u624b\u9806\u306b\u5f93\u3044, \u4ee5\u4e0b\u3092 .vimrc<\/code> \u7b49\u306b\u8ffd\u8a18\u3057\u307e\u3059.<\/p>\n

let g:opamshare = substitute(system('opam config var share'),'\\n$','','''')\r\nexecute \"set rtp+=\" . g:opamshare . \"\/merlin\/vim\"<\/code><\/pre>\n

\u6b21\u306b\u88dc\u5b8c\u7528\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u304b\u3089 Merlin \u3092\u4f7f\u3046\u305f\u3081\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059. \u3053\u3053\u3067\u306f neocomplete.vim<\/a> \u3092\u5229\u7528\u3057\u307e\u3059.<\/p>\n

if !exists('g:neocomplete#sources#omni#input_patterns')\r\n  let g:neocomplete#sources#omni#input_patterns = {}\r\nendif\r\nlet g:neocomplete#sources#omni#input_patterns.ocaml = '[^. *\\t]\\.\\w*\\|\\h\\w*|#'<\/code><\/pre>\n

\u3053\u3053\u307e\u3067\u306e\u8a2d\u5b9a\u304c\u7d42\u308f\u308b\u3068, neocomplete \u3092\u901a\u3058\u3066 Merlin \u306e\u88dc\u5b8c\u6a5f\u80fd\u3092\u5229\u7528\u3067\u304d\u307e\u3059.<\/p>\n

\"merlin-sample\"<\/a><\/p>\n

\u8d77\u52d5\u901f\u5ea6\u3078\u306e\u5f71\u97ff<\/h2>\n

execute \"set rtp+=\" . g:opamshare . \"\/merlin\/vim\"<\/code> \u306e\u3088\u3046\u306b\u3057\u3066 Vim \u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8aad\u307f\u8fbc\u3080\u3068, \u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u95a2\u308f\u3089\u305a\u3053\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u8aad\u307f\u8fbc\u307e\u308c\u308b\u305f\u3081, \u5c11\u306a\u304b\u3089\u305a\u8d77\u52d5\u901f\u5ea6\u306b\u5f71\u97ff\u304c\u3042\u308a\u307e\u3059.<\/p>\n

vim --startuptime<\/code> \u3092\u5229\u7528\u3057\u3066\u8d77\u52d5\u901f\u5ea6\u3092\u8a08\u6e2c\u3057\u305f\u3068\u3053\u308d, Merlin \u5c0e\u5165\u524d\u306e\u8d77\u52d5\u901f\u5ea6\u304c\u7d04100ms<\/strong>\u3060\u3063\u305f\u3068\u3053\u308d\u304c, Merlin \u5c0e\u5165\u5f8c\u306f\u7d04130ms<\/strong>\u3068\u306a\u3063\u3066\u3044\u307e\u3057\u305f. \u7d0430ms\u306f\u4f53\u611f\u3067\u304d\u308b\u7a0b\u5ea6\u306e\u9055\u3044\u304c\u3042\u308a\u307e\u3059.<\/p>\n

dein.vim \u3092\u4f7f\u3063\u305f\u8aad\u307f\u8fbc\u307f<\/h2>\n

dein#add<\/code> \u306f\u5f15\u6570\u3068\u3057\u3066, GitHub \u7b49\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3060\u3051\u3067\u306a\u304f, \u30ed\u30fc\u30ab\u30eb\u306e\u30d1\u30b9\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059. execute \"set rtp+=\" . g:opamshare . \"\/merlin\/vim\"<\/code> \u306e\u90e8\u5206\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3068, dein.vim \u3092\u901a\u3057\u3066 Merlin \u3092\u8aad\u307f\u8fbc\u3081\u307e\u3059.<\/p>\n

call dein#add(g:opamshare . \"\/merlin\/vim\")<\/code><\/pre>\n

\u3055\u3089\u306b, \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067, filetype \u304c OCaml \u3067 insert mode \u306b\u5165\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8aad\u307f\u8fbc\u3080\u3088\u3046\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059.<\/p>\n

call dein#add(g:opamshare . \"\/merlin\/vim\", {'lazy': 1, 'on_ft': 'ocaml', 'on_event': 'InsertEnter'})<\/code><\/pre>\n

\u9045\u5ef6\u8aad\u307f\u8fbc\u307f\u3092\u884c\u3046\u3053\u3068\u3067, Vim \u306e\u8d77\u52d5\u6642\u9593\u3092\u518d\u3073\u7d04100ms\u7a0b\u5ea6\u306b\u623b\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f.<\/p>\n

\u307e\u3068\u3081<\/h2>\n
    \n
  • dein#add<\/code>\u00a0\u306f\u30ed\u30fc\u30ab\u30eb\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b.<\/li>\n
  • \u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u63a8\u5968\u3057\u3066\u3044\u308b\u8a2d\u5b9a\u65b9\u6cd5\u3067\u306f\u306a\u304f dein.vim \u3092\u7528\u3044\u308b\u3053\u3068\u3067, \u9045\u5ef6\u8aad\u307f\u8fbc\u307f\u3084\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5229\u7528\u3057\u3066, \u8d77\u52d5\u901f\u5ea6\u306e\u9ad8\u901f\u5316\u3092\u5b9f\u73fe\u3067\u304d\u308b.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"

    Merlin \u306f OCaml \u306e\u305f\u3081\u306e Vim \u3084 Emacs \u304b\u3089\u5229\u7528\u53ef\u80fd\u306a\u88dc\u5b8c\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059. \u30c7\u30d5\u30a9\u30eb\u30c8\u306e Vim \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u3067\u306f, Vim \u306e\u8d77\u52d5\u901f\u5ea6\u306b\u60aa\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u305f\u3081, \u30d7\u30e9\u30b0\u30a4\u30f3\u30de\u30cd […]<\/p>\n","protected":false},"author":2,"featured_media":1586,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[88,20],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/1578"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=1578"}],"version-history":[{"count":10,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/1578\/revisions"}],"predecessor-version":[{"id":1590,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/1578\/revisions\/1590"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media\/1586"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}