Shougo / deol.nvim

Dark powered shell interface for Vim/NeoVim
MIT License
330 stars 16 forks source link

インサートモード移行時、カーソル位置を復元する機能 #2

Closed hrsh7th closed 7 years ago

hrsh7th commented 7 years ago

概要

要望

  autocmd! TermOpen term://* call MyTermOpenSetting()
  function! MyTermOpenSetting()
    tnoremap <buffer><Esc> <C-\><C-n>
    nnoremap <buffer><expr>i MyMoveCursor()
  endfunction
  function! MyMoveCursor()
    let pos = getcurpos()
    return "i\<End>" . repeat("\<Left>", strlen(getline(pos[1])) - pos[2] + 1)
  endfunction
Shougo commented 7 years ago

検討しておきます。

hrsh7th commented 7 years ago

使ってみましたが完璧でした。ありがとうございます。

Shougo commented 7 years ago

余談ですが、私の環境では <Home>, <End> がうまく動かず調整に苦労しました。