Skip to content

Commit 73c20b2

Browse files
Fritz Mehnervim-scripts
authored andcommitted
Version 3.11
- Rendering of manuals (\hm) and Bash help (\hh). - Bugfix: \hb, \hm, \hh not working. - Minor internal improvements.
1 parent 80a5123 commit 73c20b2

File tree

5 files changed

+70
-59
lines changed

5 files changed

+70
-59
lines changed

README.bashsupport

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
README for bash-support.vim (Version 3.10) / May 31 2012
1+
README for bash-support.vim (Version 3.11) / December 01 2012
22

33
* INSTALLATION
44
* RELEASE NOTES
@@ -136,12 +136,11 @@ Look at the bashsupport help with
136136
+-----------------------------------------------+
137137

138138
=======================================================================================
139-
RELEASE NOTES FOR VERSION 3.10
139+
RELEASE NOTES FOR VERSION 3.11
140140
=======================================================================================
141-
- Resolve $HOME for linked home directories.
142-
- Wrong insertion for parameter substitution "match beginning; del longest
143-
part" (thanks to John Orr).
144-
- Other minor bugs fixed.
141+
- Rendering of manuals (\hm) and Bash help (\hh).
142+
- Bugfix: \hb, \hm, \hh not working.
143+
- Minor internal improvements.
145144

146145
=======================================================================================
147146
OLDER RELEASE NOTES : see file 'ChangeLog'

doc/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
=======================================================================================
2+
RELEASE NOTES FOR VERSION 3.10
3+
=======================================================================================
4+
- Resolve $HOME for linked home directories.
5+
- Wrong insertion for parameter substitution "match beginning; del longest
6+
part" (thanks to John Orr).
7+
- Other minor bugs fixed.
8+
19
=======================================================================================
210
RELEASE NOTES FOR VERSION 3.9
311
=======================================================================================

doc/bashsupport.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
*bashsupport.txt* Bash Support May 31 2012
1+
*bashsupport.txt* Bash Support December 01 2012
22

33
bash Support *bash-support* *bashsupport*
4-
Plugin version 3.10
4+
Plugin version 3.11
55
for Vim version 7.0 and above
66
Fritz Mehner <[email protected]>
77

@@ -645,7 +645,8 @@ The methods are "vim", "buffer" and "xterm".
645645
Item 'help (Bash builtins)'
646646
---------------------------
647647
Look up Bash help for the word under the cursor. If there is no word under the
648-
cursor you will be asked for the name of a builtin. The tab expansion is active.
648+
cursor you will be asked for the name of a builtin. The tab expansion can be
649+
used.
649650

650651
Item 'manual (utilities)'
651652
-------------------------
@@ -781,7 +782,7 @@ Legend: (i) insert mode, (n) normal mode, (v) visual mode
781782

782783
-- Run -------------------------------------------------
783784

784-
\rr update file, run script (n, i)
785+
[n]\rr update file, run script (n, i)
785786
\ra set script cmd. line arguments (n, i)
786787
\rba set Bash cmd. line arguments (n, i)
787788
\rc update file, check syntax (n, i)

ftplugin/sh.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Language : bash
44
" Plugin : bash-support.vim
55
" Maintainer : Fritz Mehner <[email protected]>
6-
" Revision : $Id: sh.vim,v 1.47 2011/12/24 12:23:49 mehner Exp $
6+
" Revision : $Id: sh.vim,v 1.48 2012/12/01 10:59:55 mehner Exp $
77
"
88
" -----------------------------------------------------------------
99
"
@@ -74,14 +74,14 @@ endif
7474
"
7575
" ---------- help ----------------------------------------------------
7676
"
77-
noremap <buffer> <silent> <LocalLeader>hb :call BASH_help('b')<CR>
78-
inoremap <buffer> <silent> <LocalLeader>hb <Esc>:call BASH_help('b')<CR>
77+
noremap <buffer> <silent> <LocalLeader>hb :call BASH_help('bash')<CR>
78+
inoremap <buffer> <silent> <LocalLeader>hb <Esc>:call BASH_help('bash')<CR>
7979
"
80-
noremap <buffer> <silent> <LocalLeader>hh :call BASH_help('h')<CR>
81-
inoremap <buffer> <silent> <LocalLeader>hh <Esc>:call BASH_help('h')<CR>
80+
noremap <buffer> <silent> <LocalLeader>hh :call BASH_help('help')<CR>
81+
inoremap <buffer> <silent> <LocalLeader>hh <Esc>:call BASH_help('help')<CR>
8282
"
83-
noremap <buffer> <silent> <LocalLeader>hm :call BASH_help('m')<CR>
84-
inoremap <buffer> <silent> <LocalLeader>hm <Esc>:call BASH_help('m')<CR>
83+
noremap <buffer> <silent> <LocalLeader>hm :call BASH_help('man')<CR>
84+
inoremap <buffer> <silent> <LocalLeader>hm <Esc>:call BASH_help('man')<CR>
8585
"
8686
noremap <buffer> <silent> <LocalLeader>hbs :call BASH_HelpBASHsupport()<CR>
8787
inoremap <buffer> <silent> <LocalLeader>hbs <Esc>:call BASH_HelpBASHsupport()<CR>
@@ -90,7 +90,7 @@ inoremap <buffer> <silent> <LocalLeader>hbs <Esc>:call BASH_HelpBASHsuppo
9090
"
9191
noremap <buffer> <silent> <LocalLeader>cl :call BASH_EndOfLineComment()<CR>
9292
inoremap <buffer> <silent> <LocalLeader>cl <Esc>:call BASH_EndOfLineComment()<CR>
93-
vnoremap <buffer> <silent> <LocalLeader>cl <Esc>:call BASH_MultiLineEndComments()<CR>a
93+
vnoremap <buffer> <silent> <LocalLeader>cl <Esc>:call BASH_MultiLineEndComments()<CR>A
9494
9595
noremap <buffer> <silent> <LocalLeader>cj :call BASH_AdjustLineEndComm()<CR>
9696
inoremap <buffer> <silent> <LocalLeader>cj <Esc>:call BASH_AdjustLineEndComm()<CR>

plugin/bash-support.vim

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
" warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
3030
" PURPOSE.
3131
" See the GNU General Public License version 2 for more details.
32-
" Revision: $Id: bash-support.vim,v 1.115 2012/05/31 10:52:34 mehner Exp $
32+
" Revision: $Id: bash-support.vim,v 1.118 2012/12/01 11:03:54 mehner Exp $
3333
"
3434
"------------------------------------------------------------------------------
3535
"
@@ -99,7 +99,7 @@ else
9999
end
100100
"
101101
let s:BASH_BASH = $SHELL
102-
let s:BASH_Man = 'man'
102+
let s:BASH_Man = '/usr/bin/man'
103103
let s:BASH_OutputGvim = 'vim'
104104
" ==============================================================================
105105
endif
@@ -268,7 +268,7 @@ function! BASH_InitMenu ()
268268
"-------------------------------------------------------------------------------
269269
exe " menu ".s:BASH_Root.'&Comments.end-of-&line\ comment<Tab>\\cl :call BASH_EndOfLineComment()<CR>'
270270
exe "imenu ".s:BASH_Root.'&Comments.end-of-&line\ comment<Tab>\\cl <Esc>:call BASH_EndOfLineComment()<CR>'
271-
exe "vmenu <silent> ".s:BASH_Root.'&Comments.end-of-&line\ comment<Tab>\\cl <Esc>:call BASH_MultiLineEndComments()<CR>A'
271+
exe "vmenu <silent> ".s:BASH_Root.'&Comments.end-of-&line\ comment<Tab>\\cl <Esc>:call BASH_MultiLineEndComments()<CR>A'
272272

273273
exe " menu <silent> ".s:BASH_Root.'&Comments.ad&just\ end-of-line\ com\.<Tab>\\cj :call BASH_AdjustLineEndComm()<CR>'
274274
exe "imenu <silent> ".s:BASH_Root.'&Comments.ad&just\ end-of-line\ com\.<Tab>\\cj <Esc>:call BASH_AdjustLineEndComm()<CR>'
@@ -896,10 +896,10 @@ function! BASH_InitMenu ()
896896
" ( the one in the current buffer ; other versions may exist elsewhere ! )
897897
"
898898

899-
exe " menu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \r<C-F9> :call BASH_Run("n")<CR>'
900-
exe "imenu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \r<C-F9> <C-C>:call BASH_Run("n")<CR>'
899+
exe " menu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \ <C-F9> :call BASH_Run("n")<CR>'
900+
exe "imenu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \ <C-F9> <C-C>:call BASH_Run("n")<CR>'
901901
if !s:MSWIN
902-
exe "vmenu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \r<C-F9> <C-C>:call BASH_Run("v")<CR>'
902+
exe "vmenu <silent> ".s:BASH_Root.'&Run.save\ +\ &run\ script<Tab>\\rr\ \ <C-F9> <C-C>:call BASH_Run("v")<CR>'
903903
endif
904904
"
905905
" set execution right only for the user ( may be user root ! )
@@ -916,8 +916,8 @@ function! BASH_InitMenu ()
916916
exe "imenu <silent> ".s:BASH_Root.'&Run.syntax\ check\ o&ptions<Tab>\\rco <C-C>:call BASH_SyntaxCheckOptionsLocal()<CR>'
917917
"
918918
if !s:MSWIN
919-
exe " menu <silent> ".s:BASH_Root.'&Run.start\ &debugger<Tab>\\rd\ \ \ \ <F9> :call BASH_Debugger()<CR>'
920-
exe "imenu <silent> ".s:BASH_Root.'&Run.start\ &debugger<Tab>\\rd\ \ \ \ <F9> <C-C>:call BASH_Debugger()<CR>'
919+
exe " menu <silent> ".s:BASH_Root.'&Run.start\ &debugger<Tab>\\rd\ \ <F9> :call BASH_Debugger()<CR>'
920+
exe "imenu <silent> ".s:BASH_Root.'&Run.start\ &debugger<Tab>\\rd\ \ <F9> <C-C>:call BASH_Debugger()<CR>'
921921
exe " menu <silent> ".s:BASH_Root.'&Run.make\ script\ &executable<Tab>\\re :call BASH_MakeScriptExecutable()<CR>'
922922
exe "imenu <silent> ".s:BASH_Root.'&Run.make\ script\ &executable<Tab>\\re <C-C>:call BASH_MakeScriptExecutable()<CR>'
923923
endif
@@ -971,14 +971,14 @@ function! BASH_InitMenu ()
971971
"----- menu help {{{2
972972
"===============================================================================================
973973
"
974-
exe " menu <silent> ".s:BASH_Root.'&Help.&Bash\ manual<Tab>\\hb :call BASH_help("b")<CR>'
975-
exe "imenu <silent> ".s:BASH_Root.'&Help.&Bash\ manual<Tab>\\hb <C-C>:call BASH_help("b")<CR>'
974+
exe " menu <silent> ".s:BASH_Root.'&Help.&Bash\ manual<Tab>\\hb :call BASH_help("bash")<CR>'
975+
exe "imenu <silent> ".s:BASH_Root.'&Help.&Bash\ manual<Tab>\\hb <C-C>:call BASH_help("bash")<CR>'
976976
"
977-
exe " menu <silent> ".s:BASH_Root.'&Help.&help\ (Bash\ builtins)<Tab>\\hh :call BASH_help("h")<CR>'
978-
exe "imenu <silent> ".s:BASH_Root.'&Help.&help\ (Bash\ builtins)<Tab>\\hh <C-C>:call BASH_help("h")<CR>'
977+
exe " menu <silent> ".s:BASH_Root.'&Help.&help\ (Bash\ builtins)<Tab>\\hh :call BASH_help("help")<CR>'
978+
exe "imenu <silent> ".s:BASH_Root.'&Help.&help\ (Bash\ builtins)<Tab>\\hh <C-C>:call BASH_help("help")<CR>'
979979
"
980-
exe " menu <silent> ".s:BASH_Root.'&Help.&manual\ (utilities)<Tab>\\hm :call BASH_help("m")<CR>'
981-
exe "imenu <silent> ".s:BASH_Root.'&Help.&manual\ (utilities)<Tab>\\hm <C-C>:call BASH_help("m")<CR>'
980+
exe " menu <silent> ".s:BASH_Root.'&Help.&manual\ (utilities)<Tab>\\hm :call BASH_help("man")<CR>'
981+
exe "imenu <silent> ".s:BASH_Root.'&Help.&manual\ (utilities)<Tab>\\hm <C-C>:call BASH_help("man")<CR>'
982982
"
983983
exe " menu <silent> ".s:BASH_Root.'&Help.bash-&support<Tab>\\hbs :call BASH_HelpBASHsupport()<CR>'
984984
exe "imenu <silent> ".s:BASH_Root.'&Help.bash-&support<Tab>\\hbs <C-C>:call BASH_HelpBASHsupport()<CR>'
@@ -1883,7 +1883,7 @@ endfunction " ---------- end of function Bash_SubstituteTag ----------
18831883
" Comments : vim modeline {{{1
18841884
"------------------------------------------------------------------------------
18851885
function! BASH_CommentVimModeline ()
1886-
put = '# vim: set tabstop='.&tabstop.' shiftwidth='.&shiftwidth.': '
1886+
put = '# vim: filetype=sh : tabstop='.&tabstop.' : shiftwidth='.&shiftwidth.' :'
18871887
endfunction " ---------- end of function BASH_CommentVimModeline ----------
18881888
"
18891889
"------------------------------------------------------------------------------
@@ -1968,15 +1968,15 @@ function! BASH_help( type )
19681968
let cuc = getline(".")[col(".") - 1] " character under the cursor
19691969
let item = expand("<cword>") " word under the cursor
19701970
if empty(item) || match( item, cuc ) == -1
1971-
if a:type == 'm'
1971+
if a:type == 'man'
19721972
let item=BASH_Input('[tab compl. on] name of command line utility : ', '', 'shellcmd' )
19731973
endif
1974-
if a:type == 'h'
1974+
if a:type == 'help'
19751975
let item=BASH_Input('[tab compl. on] name of bash builtin : ', '', 'customlist,BASH_BuiltinComplete' )
19761976
endif
19771977
endif
19781978

1979-
if empty(item) && a:type != 'b'
1979+
if empty(item) && a:type != 'bash'
19801980
return
19811981
endif
19821982
"------------------------------------------------------------------------------
@@ -1998,22 +1998,23 @@ function! BASH_help( type )
19981998
setlocal buftype=nofile
19991999
setlocal noswapfile
20002000
setlocal bufhidden=delete
2001-
setlocal filetype=sh " allows repeated use of <S-F1>
20022001
setlocal syntax=OFF
20032002
endif
20042003
setlocal modifiable
2004+
setlocal filetype=man
20052005
"
20062006
"-------------------------------------------------------------------------------
20072007
" read Bash help
20082008
"-------------------------------------------------------------------------------
2009-
if a:type == 'h'
2010-
silent exe ":%!help ".item
2009+
if a:type == 'help'
2010+
setlocal wrap
2011+
silent exe ":%!help -m ".item
20112012
endif
20122013
"
20132014
"-------------------------------------------------------------------------------
20142015
" open a manual (utilities)
20152016
"-------------------------------------------------------------------------------
2016-
if a:type == 'm'
2017+
if a:type == 'man'
20172018
"
20182019
" Is there more than one manual ?
20192020
"
@@ -2060,7 +2061,6 @@ function! BASH_help( type )
20602061
endif
20612062
endif
20622063

2063-
set filetype=man
20642064
silent exe ":%!".s:BASH_Man.' '.catalog.' '.item
20652065

20662066
if s:MSWIN
@@ -2072,18 +2072,12 @@ function! BASH_help( type )
20722072
"-------------------------------------------------------------------------------
20732073
" open the bash manual
20742074
"-------------------------------------------------------------------------------
2075-
if a:type == 'b'
2076-
silent exe ":%!man 1 bash"
2075+
if a:type == 'bash'
2076+
silent exe ":%!".s:BASH_Man.' 1 bash'
20772077

20782078
if s:MSWIN
20792079
call s:bash_RemoveSpecialCharacters()
20802080
endif
2081-
2082-
if !empty(item)
2083-
" assign to the search pattern register "" :
2084-
let @/=item
2085-
echo "use n/N to search for '".item."'"
2086-
endif
20872081
endif
20882082

20892083
setlocal nomodifiable
@@ -2341,7 +2335,8 @@ endfunction " ---------- end of function BASH_BashCmdLineArguments ---------
23412335
let s:BASH_OutputBufferName = "Bash-Output"
23422336
let s:BASH_OutputBufferNumber = -1
23432337
"
2344-
function! BASH_Run ( mode )
2338+
function! BASH_Run ( mode ) range
2339+
23452340
silent exe ':cclose'
23462341
"
23472342
let l:arguments = exists("b:BASH_ScriptCmdLineArgs") ? " ".b:BASH_ScriptCmdLineArgs : ""
@@ -2351,7 +2346,12 @@ function! BASH_Run ( mode )
23512346
"
23522347
silent exe ":update"
23532348
"
2354-
if a:mode=="v"
2349+
if a:firstline != a:lastline
2350+
let tmpfile = tempname()
2351+
silent exe ':'.a:firstline.','.a:lastline.'write '.tmpfile
2352+
endif
2353+
"
2354+
if a:mode=="v"
23552355
let tmpfile = tempname()
23562356
silent exe ":'<,'>write ".tmpfile
23572357
endif
@@ -2366,8 +2366,7 @@ function! BASH_Run ( mode )
23662366
"
23672367
" ----- visual mode ----------
23682368
"
2369-
if a:mode=="v"
2370-
echomsg ":!".s:BASH_BASH.l:bashCmdLineArgs." < ".tmpfile." -s ".l:arguments
2369+
if ( a:mode=="v" ) || ( a:firstline != a:lastline )
23712370
exe ":!".s:BASH_BASH.l:bashCmdLineArgs." < ".tmpfile." -s ".l:arguments
23722371
call delete(tmpfile)
23732372
return
@@ -2442,7 +2441,7 @@ function! BASH_Run ( mode )
24422441
endif
24432442
endif
24442443
"
2445-
if a:mode=="v"
2444+
if ( a:mode=="v" ) || ( a:firstline != a:lastline )
24462445
silent exe ":%!".s:BASH_BASH.l:bashCmdLineArgs." < ".tmpfile." -s ".l:arguments
24472446
endif
24482447
setlocal nomodifiable
@@ -2469,11 +2468,15 @@ function! BASH_Run ( mode )
24692468
exe ':!'.s:BASH_BASH.l:bashCmdLineArgs.' "'.l:fullname.'" '.l:arguments
24702469
else
24712470
if a:mode=='n'
2472-
silent exe '!xterm -title '.l:fullnameesc.' '.s:BASH_XtermDefaults
2473-
\ .' -e '.s:BASH_Wrapper.' '.l:bashCmdLineArgs.l:fullnameesc.l:arguments.' &'
2474-
endif
2475-
"
2476-
if a:mode=="v"
2471+
if a:firstline != a:lastline
2472+
let titlestring = l:fullnameesc.'\ lines\ \ '.a:firstline.'\ -\ '.a:lastline
2473+
silent exe ':!xterm -title '.titlestring.' '.s:BASH_XtermDefaults
2474+
\ .' -e '.s:BASH_Wrapper.' '.l:bashCmdLineArgs.tmpfile.l:arguments.' &'
2475+
else
2476+
silent exe '!xterm -title '.l:fullnameesc.' '.s:BASH_XtermDefaults
2477+
\ .' -e '.s:BASH_Wrapper.' '.l:bashCmdLineArgs.l:fullnameesc.l:arguments.' &'
2478+
endif
2479+
elseif a:mode=="v"
24772480
let titlestring = l:fullnameesc.'\ lines\ \ '.line("'<").'\ -\ '.line("'>")
24782481
silent exe ':!xterm -title '.titlestring.' '.s:BASH_XtermDefaults
24792482
\ .' -e '.s:BASH_Wrapper.' '.l:bashCmdLineArgs.tmpfile.l:arguments.' &'

0 commit comments

Comments
 (0)