Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

(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

3 Answers 3

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 . ' '
        else
            let cmd = 'man '
        endif
    endif
    let cmd .= expand('<cword>')
    execute 'ConqueTermSplit' cmd
:endfunction
: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()
python<<EOF
import os
import vim
import re
col=vim.current.window.cursor[1] #得到col 
line=vim.current.line
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:
        cmd_line+=m.group()+'"'
        os.system(cmd_line)
EOF
endfunction
map K :<C-U>call KyMANit()<CR>
ounmap K
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.