我想重新定义:h
和:help
命令,以便它们默认垂直分割屏幕。由于两个原因,以下解决方案是不受欢迎的。
cnoremap h vert help
cabbrev h vert help
我只希望:*
命令发生替换。不幸的是,当我输入/h
时也会发生替换。我浏览了地图上的文档,但是我找不到只重新映射:*
命令而不是/*
命令的命令。
我只希望在命令以:h
开头时进行替换。如果我键入:ah
,命令将扩展为:avert help
。当我将命令一起管道时,这种行为可能是合乎需要的,但我不想在这里。
感谢您的帮助!
答案 0 :(得分:3)
我会使用cmdalias.vim - Create aliases for Vim commands插件,但您也可以通过巧妙的映射来解决这个问题:
:cnoreabbrev <expr> h getcmdtype() == ":" && getcmdline() == "h" ? "vert h" : "h"
答案 1 :(得分:2)
我想重新定义:h和:help命令,以便它们分开 默认情况下垂直显示屏幕。
在我的vimrc中,我有:
"====================
"Help in vertical split (right)
"====================
autocmd FileType help wincmd L
如果您希望左侧垂直拆分显示帮助,请使用H
代替L
答案 2 :(得分:1)
非常低技术的解决方案:
nnoremap <leader>h :vert help <-- there's a <space> here