Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(This question is posted in vim_mac user group in Google, but I did not get a solution)

When pressing <K> on keyword, in terminal vim it will produce the man page correctly. However, in MacVim, it generates a warning:

WARNING: terminal is not fully functional 

The ANSI control sequence is then display and not correctly escaped. A screenshot can be found here.

Help needed, thanks!

share|improve this question

The ConqueTerm Vim plugin provides GUI-based instances of Vim with a fairly robust terminal emulation. It requires Vim 7.0+ (7.3+ for Windows) compiled with +python or +python3; MacVim satisfies these requirements.

Here is a function and binding that re-implements the functionality of the normal-mode K command using ConqueTerm (you can put it in your .vimrc):

:function! ConqueMan()
    let cmd = &keywordprg . ' '
    if cmd ==# 'man ' || cmd ==# 'man -s '
        if v:count > 0
            let cmd .= v:count . ' '
            let cmd = 'man '
    let cmd .= expand('<cword>')
    execute 'ConqueTermSplit' cmd
:map K :<C-U>call ConqueMan()<CR>
:ounmap K
share|improve this answer
Looks nice! Nevertheless it looks a bit weird under MacVim with a colorful output. – Ivan Z. G. Xiao Jun 1 '11 at 21:00
Perfect! and has insert mode too. – sunkencity Sep 18 '11 at 7:59

This can't be solved without a lot of programming because, as that thread states, MacVim creates its own "terminal" that does not conform to any terminfo entries, hence less cannot handle using it properly. You can try poking $TERM in MacVim via :set term=..., but I don't think that there's any value that would be appropriate for MacVim.

If you have some graphical man page viewer you could set it as keywordprg. See :h keywordprg for more details.

share|improve this answer
Hi, I did try setting the term, but still. It doesn't work. However setting keywordprg seems to be a reasonable workaround. After some search I cannot find a good alternative to man, though... – Ivan Z. G. Xiao May 29 '11 at 4:22

If you use Linux,you can try my script,just put it in the .vimrc file Before try it,you shold check if your vim support python run this command to check: vim --version | grep +python

"my K
function! KyMANit()
import os
import vim
import re
col=vim.current.window.cursor[1] #得到col 
cmd_line='gnome-terminal -e "man '  #you may replace the gnome-terminal with another terminal emulator.However in Ubuntu 10.04,it's perfect

for m in re.finditer(r"\w+",line):
    if m.start()<=col and m.end()>=col:'"'
map K :<C-U>call KyMANit()<CR>
ounmap K
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .