跳转到tmux内vim中的第一个非空字符

跳转到tmux内vim中的第一个非空字符,vim,tmux,Vim,Tmux,我的vimrc中有一个函数,用于跳转到行中的第一个非空字符: function! SmartHome() let s:col = col(".") normal! ^ if s:col == col(".") normal! 0 endif endfunction 这在tmux会话之外运行良好。 但是在tmux会话中,它只会跳到行中的第一个字符——这是错误的 我以这种方式映射了此函数: " smart home function nnoremap <silent&

我的vimrc中有一个函数,用于跳转到行中的第一个非空字符:

function! SmartHome()
  let s:col = col(".")
  normal! ^
  if s:col == col(".")
    normal! 0
  endif
endfunction
这在tmux会话之外运行良好。 但是在tmux会话中,它只会跳到行中的第一个字符——这是错误的

我以这种方式映射了此函数:

" smart home function
nnoremap <silent> <Home> :call SmartHome()<CR>
inoremap <silent> <Home> <C-O>:call SmartHome()<CR>
“智能家居功能
nnoremap:调用SmartHome()
inoremap:调用SmartHome()

如何解决此问题?

我可以通过从.bashrc文件中删除以下行来解决此问题

export TERM=xterm-256color
这是因为xterm和来自tmux的屏幕“like”协议不会为HOME键发送/期望相同的值:

$ tput -T screen khome | xxd
0000000: 1b5b 317e                                .[1~
$ tput -T xterm khome | xxd
0000000: 1b4f 48                                  .OH

这个功能有什么意义?你不能直接使用
^
?tmux推荐的
术语是
sceen-256color
。是的,我的tmux配置中有这个