LoginSignup
0
0

More than 5 years have passed since last update.

tsuquyomiのCtrl-Tマッピングを変更する

Last updated at Posted at 2017-12-16

TsuquyomiでVim+TypeScriptの環境を触っていたときに、自分はCtrl+T:tabnewをマッピングしていたところがプラグインによってオーバーライドされてしまったのを変更したときのメモ。

後で読んだらREADMEにばっちり書いてあったけど、備忘録として。

デフォルトマッピングの無効化

let g:tsuquyomi_disable_default_mappings = 1 
map <buffer> <Nop> <Plug>(TsuquyomiGoBack)

とりあえず上を書いておけばCtrl+Tは取り戻せる。

そもそもプラグインのマッピングは再割当てできない?

そもそもvimrc側でプラグインによって割り当てられたマッピングは変更できないのだろうか。

Plugins are sourced after your vimrc so there's no way to override a plugin mapping in your vimrc if the plugin doesn't provide a way to do so.

このスレッドによると、そもそも設定ファイルの読み込まれる順番がvimrc→プラグインなので、vimrc側でやれることはないとのこと。なるほど。

余談

ちなみにプラグイン内部の実装で該当するのはこの部分

function! tsuquyomi#config#applyBufLocalDefaultMap()
  if(!exists('g:tsuquyomi_disable_default_mappings'))
    if !hasmapto('<Plug>(TsuquyomiDefinition)')
        map <buffer> <C-]> <Plug>(TsuquyomiDefinition)
    endif
    if !hasmapto('<Plug>(TsuquyomiSplitDefinition)')
        map <buffer> <C-W>] <Plug>(TsuquyomiSplitDefinition)
        map <buffer> <C-W><C-]> <Plug>(TsuquyomiSplitDefinition)
    endif
    if !hasmapto('<Plug>(TsuquyomiGoBack)')
        map <buffer> <C-t> <Plug>(TsuquyomiGoBack)
    endif
    if !hasmapto('<Plug>(TsuquyomiReferences)')
        map <buffer> <C-^> <Plug>(TsuquyomiReferences)
    endif
  endif
endfunction

思ったより読みやすかった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0