summaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-10-27 20:42:07 -0400
committerJesse Luehrs <doy@tozt.net>2017-10-27 20:43:13 -0400
commit3839eb947fdb6c7bfeccbcd594db2a966ede6293 (patch)
tree8980eccadc9f412c447ad4462438cd3322a25369 /vim
parent4ebbac1a1686b06cd30907312fa7646c8ede7f71 (diff)
downloadconf-3839eb947fdb6c7bfeccbcd594db2a966ede6293.tar.gz
conf-3839eb947fdb6c7bfeccbcd594db2a966ede6293.zip
use ri and pydoc for K in ruby and python
Diffstat (limited to 'vim')
-rw-r--r--vim/ftplugin/perl.vim4
-rw-r--r--vim/ftplugin/python.vim9
-rw-r--r--vim/ftplugin/ruby.vim7
3 files changed, 18 insertions, 2 deletions
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
index 156ccff..8fb8575 100644
--- a/vim/ftplugin/perl.vim
+++ b/vim/ftplugin/perl.vim
@@ -2,10 +2,10 @@ let b:ale_linters = { 'perl': ['perlcritic'] }
" look up words in perldoc rather than man for K
function! s:perldoc(word)
- let perldoc_pager = $PERLDOC_PAGER
+ let l:perldoc_pager = $PERLDOC_PAGER
let $PERLDOC_PAGER = 'cat'
exe 'silent read! perldoc -f "' . a:word . '" 2>/dev/null || perldoc "' . a:word . '"'
- let $PERLDOC_PAGER = perldoc_pager
+ let $PERLDOC_PAGER = l:perldoc_pager
setlocal ft=man
endfunction
nnoremap <buffer> <silent>K :call Help(0, [':'], '<SID>perldoc')<CR>
diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim
new file mode 100644
index 0000000..6973956
--- /dev/null
+++ b/vim/ftplugin/python.vim
@@ -0,0 +1,9 @@
+" look up words in pydoc rather than man for K
+function! s:pydoc(word)
+ let l:pydoc_pager = $MANPAGER
+ let $MANPAGER = 'cat'
+ exe 'silent read! pydoc "' . a:word . '" 2>/dev/null'
+ let $MANPAGER = l:pydoc_pager
+endfunction
+nnoremap <buffer> <silent>K :call Help(0, [':'], '<SID>pydoc')<CR>
+vnoremap <buffer> <silent>K :call Help(1, [':'], '<SID>pydoc')<CR>
diff --git a/vim/ftplugin/ruby.vim b/vim/ftplugin/ruby.vim
index fa735f8..a7c536d 100644
--- a/vim/ftplugin/ruby.vim
+++ b/vim/ftplugin/ruby.vim
@@ -15,3 +15,10 @@ endfunction
if s:rubocop_in_bundler()
let b:ale_ruby_rubocop_executable = 'bundle'
endif
+
+" look up words in ri rather than man for K
+function! s:ri(word)
+ exe 'silent read! ri --no-pager "' . a:word . '" 2>/dev/null'
+endfunction
+nnoremap <buffer> <silent>K :call Help(0, [':'], '<SID>ri')<CR>
+vnoremap <buffer> <silent>K :call Help(1, [':'], '<SID>ri')<CR>