스크래치 버퍼가있는 추가 창을 사용하여 다음과 같은 내용을 표시 할 수 있습니다.
다음은 플러그인의 프로토 타입입니다. 그냥 :so
와 다음을 실행하거나
~/.vim/plugin
디렉토리
function! s:set_as_scratch_buffer()
setlocal noswapfile
setlocal nomodifiable
setlocal bufhidden=delete
setlocal buftype=nofile
setlocal nobuflisted
setlocal nonumber
setlocal nowrap
setlocal cursorline
endfunction
function! s:activate_window_by_buffer_name(name)
for i in range(1, winnr('$'))
let name = bufname(winbufnr(i))
let full_name = fnamemodify(bufname(winbufnr(i)), ':p')
if name == a:name || full_name == a:name
exec i.'wincmd w'
return 1
endif
endfor
return 0
endfunction
let s:help_window_name = 'HTML\ help'
function! s:show_help()
let current_name = fnamemodify(@%, ':p')
if ! s:activate_window_by_buffer_name(s:help_window_name)
exec 'top 5 split '.s:help_window_name
call s:set_as_scratch_buffer()
endif
setlocal modifiable
let help_lines = ['line1', 'line2']
call setline(1, help_lines)
setlocal nomodifiable
call s:activate_window_by_buffer_name(current_name)
endfunction
command! -nargs=0 HtmlHelp call s:show_help()
au! BufRead,BufNewFile *.html call s:show_help()
감사 내부에 일부 파일이 점을 넣어! 사실 그것은 아주 좋은 아이디어입니다. show_help() 함수를 사용하는 것 중 한 가지입니다. 이름을 'HTML 도움말'로 설정하는 동안 오류가 발생하며 vim은 하나의 파일 이름 만 필요하다고 불평합니다. 한 단어 만 사용하면 문제가 해결됩니다. 또한 도움말 창에서 다른 창과 상관없이 높이를 고정 시키려면 어떻게해야합니까? –
Vim이 창 높이를 고정시킬 수 있는지 확신 할 수 없습니다. 나는 버퍼 이름에서 '공간'을 벗어났다. 이 변형을 시도해 볼 수 있습니다. –