Con_HumiのDEV_LOG

開発メモやガジェットのことをつらつらと.

VimのNeoSnippetの設定

MBPでのメインエディタはMacVimを使おうと頑張っているCon_Humiです.

macvim-kaoriya - MacVim KaoriYa - Google Project Hosting

このエディタでPythonのコードを書こうと思っていて,

を使いたいなーと思っています.
Shougo/neocomplete.vim · GitHubShougo/neosnippet.vim · GitHub
連携できたらと思っているのですが,どうやらスニペットの展開がうまく出来ないので,
NeoSnippetの設定を見直しました.

" ------------------------------------------------------------
" NeoSnippetの設定
if neobundle#tap('neosnippet.vim')
    call neobundle#config({"autoload": {"insert": 1}})
    function! neobundle#tapped.hooks.on_source(bundle)
        " Plugin key-mappings.
        imap <C-k>     <Plug>(neosnippet_expand_or_jump)
        smap <C-k>     <Plug>(neosnippet_expand_or_jump)
        xmap <C-k>     <Plug>(neosnippet_expand_target)
        " SuperTab like snippets behavior.
        imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)": pumvisible() ? "\<C-n>" : "\<TAB>"
        smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)": "\<TAB>"
        " For snippet_complete marker.
        if has('conceal')
            set conceallevel=2 concealcursor=i
        endif
    endfunction
    call neobundle#untap()
endif
" ------------------------------------------------------------

NeoSnippetのGitHubで紹介されている設定をneobundle#tapと'neobundle#untap'で囲って
プラグインが読み込まれたタイミングで設定が有効になるようにしていた(のだと思う)のですが,
これが良くなかった模様.

" ------------------------------------------------------------
" NeoSnippetの設定
" Plugin key-mappings.
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)
xmap <C-k>     <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)": pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)": "\<TAB>"
" For snippet_complete marker.
if has('conceal')
    set conceallevel=2 concealcursor=i
endif
" End NeoSnippetの設定
" ------------------------------------------------------------

読み込みタイミングの指定をなくしたらすんなり動作しました.(なんでだ?)

記事を書いていてもあやふやな部分が多いのでもう少しNeoBundleとVimScriptの勉強をしないとですね.