/usr/share/doc/devhelp/tools/devhelp.vim is in devhelp 3.14.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | " devhelp.vim: A Devhelp assistant and search plugin for VIM.
"
" Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
"
" To enable devhelp search:
" let g:devhelpSearch=1
"
" To enable devhelp assistant:
" let g:devhelpAssistant=1
"
" To change the update delay (e.g. to 150ms):
" set updatetime=150
"
" To change the search key (e.g. to F5):
" let g:devhelpSearchKey = '<F5>'
"
" To change the length (e.g. to 5 characters) before a word becomes
" relevant:
" let g:devhelpWordLength = 5
"
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation; either version 2 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
" General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program; if not, see <http://www.gnu.org/licenses/>.
" Devhelp plugin configuration. These variables may be set in .vimrc
" to override the defaults
if !exists ('g:devhelpSearchKey')
let g:devhelpSearchKey = '<F7>'
endif
if !exists ('g:devhelpWordLength')
let g:devhelpWordLength = 5
endif
" Variable for remembering the last assistant word
let s:lastWord = ''
function! GetCursorWord ()
" Try to get the word below the cursor
let s:word = expand ('<cword>')
" If that's empty, try to use the word before the cursor
if empty (s:word)
let s:before = getline ('.')[0 : getpos ('.')[2]-1]
let s:start = match (s:before, '\(\w*\)$')
let s:end = matchend (s:before, '\(\w*\)$')
let s:word = s:before[s:start : s:end]
end
return s:word
endfunction
function! DevhelpUpdate (flag)
try
" Get word below or before cursor
let s:word = GetCursorWord ()
if a:flag == 'a'
" Update Devhelp assistant window
if s:lastWord != s:word && strlen (s:word) > g:devhelpWordLength
" Update Devhelp
call system ('devhelp -a '.s:word.' &')
" Remember the word for next time
let s:lastWord = s:word
end
else
" Update devhelp search window. Since the user intentionally
" pressed the search key, the word is not checked for its
" length or whether it's new
call system ('devhelp -s '.s:word.' &')
end
catch
endtry
endfunction
function! DevhelpUpdateI (flag)
" Use normal update function
call DevhelpUpdate (a:flag)
if col ('.') == len (getline ('.'))
" Start appening if the cursor at the end of the line
startinsert!
else
" Otherwise move the cursor to the right and start inserting.
" This is required because <ESC> moves the cursor to the left
let s:pos = getpos ('.')
let s:pos[2] += 1
call setpos ('.', s:pos)
startinsert
endif
endfunction
if exists ('g:devhelpSearch') && g:devhelpSearch
" Update the main Devhelp window when the search key is pressed
exec 'nmap '.g:devhelpSearchKey.' :call DevhelpUpdate("s")<CR>'
exec 'imap '.g:devhelpSearchKey.' <ESC>:call DevhelpUpdateI("s")<CR>'
endif
if exists ('g:devhelpAssistant') && g:devhelpAssistant
" Update the assistant window if the user hasn't pressed a key for a
" while. See :help updatetime for how to change this delay
au! CursorHold * nested call DevhelpUpdate('a')
au! CursorHoldI * nested call DevhelpUpdate('a')
endif
|