Skip to content

Commit 99c746c

Browse files
Change some maps
- Change some maps. - Rename the output methods for running Bash. - Improve running scripts with ranges. - Add shell options and variables for BASH Version 4.4 and 5.0. - Update documentation. taken from WolfgangMehner/vim-plugins, revision WolfgangMehner/vim-plugins@a88f0b5
1 parent e1969c3 commit 99c746c

18 files changed

Lines changed: 757 additions & 527 deletions

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ _Please read the release notes below._
3030

3131
--------------------------------------------------------------------------------
3232

33-
README for bash-support.vim (Version 5.0alpha) / October 10 2017
33+
README for bash-support.vim (Version 5.0beta) / November 22 2020
3434
================================================================================
3535

3636
* INSTALLATION
@@ -46,7 +46,7 @@ script, starting a debugger can be done with a keystroke. There are many
4646
additional hints and options which can improve speed and comfort when writing
4747
shell scripts.
4848

49-
This plug-in can be used with Vim version 7.x.
49+
This plug-in can be used with Vim version 7.4+ and Neovim 0.2.1+.
5050

5151

5252
--------------------------------------------------------------------------------
@@ -89,12 +89,17 @@ structure which is needed below the local installation directory `$HOME/.vim/`
8989
This is the minimal content of the file `$HOME/.vimrc`. Create one if there
9090
is none or use the files in `$HOME/.vim/bash-support/rc` as a starting point.
9191

92-
(1.3) Set at least some personal details. Use the map `\ntw` inside a Bash buffer
92+
(1.3) Make the plug-in help accessible by typing the following command on the
93+
Vim command line:
94+
95+
:helptags $HOME/.vim/doc/
96+
97+
(1.4) Set at least some personal details. Use the map `\ntw` inside a Bash buffer
9398
or the menu entry:
9499

95100
Bash -> Snippets -> template setup wizard
96101

97-
It will help you set up the file _runtimepath_/templates/personal.templates .
102+
It will help you set up the file `_runtimepath_/templates/personal.templates`.
98103
The file is read by all plug-ins supporting this feature to get your personal
99104
details. Here is the minimal personalization (my settings as an example):
100105

@@ -108,11 +113,6 @@ structure which is needed below the local installation directory `$HOME/.vim/`
108113

109114
(Read more about the template system in the plug-in documentation.)
110115

111-
(1.4) Make the plug-in help accessible by typing the following command on the
112-
Vim command line:
113-
114-
:helptags $HOME/.vim/doc/
115-
116116
(1.5) Consider additional settings in the file `$HOME/.vimrc`. The files
117117
`customization.vimrc` and `customization.gvimrc` are replacements or extensions
118118
for your `.vimrc` and `.gvimrc`. You may want to use parts of them. The files
@@ -124,7 +124,7 @@ structure which is needed below the local installation directory `$HOME/.vim/`
124124

125125
The subdirectories in the zip archive `bash-support.zip` mirror the directory
126126
structure which is needed below the local installation directory
127-
`$HOME/vimfiles/` (find the value of $HOME with `:echo $HOME` from inside Vim).
127+
`$HOME/vimfiles/` (find the value of `$HOME` with `:echo $HOME` from inside Vim).
128128

129129
(2.0) Save the template files in `$HOME/vimfiles/bash-support/templates/Templates`
130130
if you have changed any of them.
@@ -146,12 +146,17 @@ structure which is needed below the local installation directory
146146
This is the minimal content of the file `$HOME/_vimrc`. Create one if there
147147
is none or use the files in `$HOME/vimfiles/bash-support/rc` as a starting point.
148148

149-
(2.3) Set at least some personal details. Use the map `\ntw` inside a Bash buffer
149+
(2.3) Make the plug-in help accessible by typing the following command on the
150+
Vim command line:
151+
152+
:helptags $HOME\vimfiles\doc\
153+
154+
(2.4) Set at least some personal details. Use the map `\ntw` inside a Bash buffer
150155
or the menu entry:
151156

152157
Bash -> Snippets -> template setup wizard
153158

154-
It will help you set up the file _runtimepath_/templates/personal.templates .
159+
It will help you set up the file `_runtimepath_/templates/personal.templates`.
155160
The file is read by all plug-ins supporting this feature to get your personal
156161
details. Here is the minimal personalization (my settings as an example):
157162

@@ -165,11 +170,6 @@ structure which is needed below the local installation directory
165170

166171
(Read more about the template system in the plug-in documentation.)
167172

168-
(2.4) Make the plug-in help accessible by typing the following command on the
169-
Vim command line:
170-
171-
:helptags $HOME\vimfiles\doc\
172-
173173
(2.5) Consider additional settings in the file `$HOME/_vimrc`. The files
174174
`customization.vimrc` and `customization.gvimrc` are replacements or extensions
175175
for your `_vimrc` and `_gvimrc`. You may want to use parts of them. The files
@@ -200,10 +200,11 @@ Any problems? See the TROUBLESHOOTING section at the end of the help file
200200
RELEASE NOTES
201201
================================================================================
202202

203-
RELEASE NOTES FOR VERSION 5.0alpha
203+
RELEASE NOTES FOR VERSION 5.0beta
204204
----------------------------------------------------------------------
205205
- Adapt for running under Neovim more smoothly.
206206
- Add command `:Bash [<args>]` to run the interpreter with arguments.
207+
- Add command `:BashCheck.` the run the syntax checker.
207208
- Add command `:BashDirectRun` to run executable scripts without `g:BASH_Executable`.
208209
- Add command `:BashOutputMethod` to set the output destination for `:Bash`.
209210
- Add command `:BashExecutable` to set the executable during runtime.
@@ -220,7 +221,7 @@ RELEASE NOTES FOR VERSION 5.0alpha
220221
- Remove the definition of the maps `CTRL+F9`, `SHIFT+F9`, and `ALT+F9`.
221222
Add them to your filetype plug-in if you want to use them.
222223
- Integration of BashDB moved into the toolbox.
223-
- Add shell options and variables for BASH Version 4.4.
224+
- Add shell options and variables for BASH Version 4.4 and 5.0.
224225
- Minor corrections and improvements.
225226

226227
Note: The filetype plug-in has been moved, and is thus not loaded automatically

autoload/mmtemplates/core.vim

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
" Organization:
1212
" Version: see variable g:Templates_Version below
1313
" Created: 30.08.2011
14-
" Revision: 14.04.2017
15-
" License: Copyright (c) 2012-2016, Wolfgang Mehner
14+
" Revision: 06.08.2020
15+
" License: Copyright (c) 2012-2020, Wolfgang Mehner
1616
" This program is free software; you can redistribute it and/or
1717
" modify it under the terms of the GNU General Public License as
1818
" published by the Free Software Foundation, version 2 of the
@@ -23,27 +23,27 @@
2323
" PURPOSE.
2424
" See the GNU General Public License version 2 for more details.
2525
"===============================================================================
26-
"
26+
2727
"-------------------------------------------------------------------------------
2828
" === Basic Checks === {{{1
2929
"-------------------------------------------------------------------------------
30-
"
30+
3131
" need at least 7.0
3232
if v:version < 700
3333
echohl WarningMsg
3434
echo 'The plugin templates.vim needs Vim version >= 7.'
3535
echohl None
3636
finish
3737
endif
38-
"
38+
3939
" prevent duplicate loading
4040
" need compatible
4141
if &cp || ( exists('g:Templates_Version') && g:Templates_Version != 'searching' && ! exists('g:Templates_DevelopmentOverwrite') )
4242
finish
4343
endif
44-
"
45-
let s:Templates_Version = '1.1alpha' " version number of this script; do not change
46-
"
44+
45+
let s:Templates_Version = '1.1beta' " version number of this script; do not change
46+
4747
"----------------------------------------------------------------------
4848
" --- Find Newest Version --- {{{2
4949
"----------------------------------------------------------------------
@@ -133,13 +133,13 @@ else
133133
endif
134134
" }}}2
135135
"-------------------------------------------------------------------------------
136-
"
136+
137137
let g:Templates_Version = s:Templates_Version " version number of this script; do not change
138-
"
138+
139139
"----------------------------------------------------------------------
140140
" === Modul Setup === {{{1
141141
"----------------------------------------------------------------------
142-
"
142+
143143
"-------------------------------------------------------------------------------
144144
" s:ApplyDefaultSetting : Write default setting to a global variable. {{{2
145145
"
@@ -152,13 +152,13 @@ let g:Templates_Version = s:Templates_Version " version number of this scrip
152152
" If g:<varname> does not exists, assign:
153153
" g:<varname> = value
154154
"-------------------------------------------------------------------------------
155-
"
155+
156156
function! s:ApplyDefaultSetting ( varname, value )
157-
if ! exists ( 'g:'.a:varname )
158-
let { 'g:'.a:varname } = a:value
157+
if ! exists( 'g:'.a:varname )
158+
let {'g:'.a:varname} = a:value
159159
endif
160-
endfunction " ---------- end of function s:ApplyDefaultSetting ----------
161-
"
160+
endfunction
161+
162162
"-------------------------------------------------------------------------------
163163
" s:GetGlobalSetting : Get a setting from a global variable. {{{2
164164
"
@@ -175,20 +175,20 @@ endfunction " ---------- end of function s:ApplyDefaultSetting ----------
175175
" g:<varname> == 0 -> s:<varname> = "no"
176176
" otherwise -> s:<varname> = "yes"
177177
"-------------------------------------------------------------------------------
178-
"
178+
179179
function! s:GetGlobalSetting ( varname, ... )
180-
if a:0 > 0 && a:1 == 'bin' && exists ( 'g:'.a:varname ) && type ( 0 ) == type ( { 'g:'.a:varname } )
181-
let { 's:'.a:varname } = { 'g:'.a:varname } == 0 ? 'no' : 'yes'
182-
elseif exists ( 'g:'.a:varname )
183-
let { 's:'.a:varname } = { 'g:'.a:varname }
180+
if a:0 > 0 && a:1 == 'bin' && exists( 'g:'.a:varname ) && type( 0 ) == type( {'g:'.a:varname} )
181+
let {'s:'.a:varname} = {'g:'.a:varname} == 0 ? 'no' : 'yes'
182+
elseif exists( 'g:'.a:varname )
183+
let {'s:'.a:varname} = {'g:'.a:varname}
184184
endif
185-
"
186-
let s:Templates_AllSettings[ a:varname ] = { 's:'.a:varname }
187-
endfunction " ---------- end of function s:GetGlobalSetting ----------
188-
"
185+
186+
let s:Templates_AllSettings[ a:varname ] = {'s:'.a:varname}
187+
endfunction
188+
189189
" }}}2
190190
"-------------------------------------------------------------------------------
191-
"
191+
192192
" platform specifics
193193
let s:MSWIN = has("win16") || has("win32") || has("win64") || has("win95")
194194
let s:UNIX = has("unix") || has("macunix") || has("win32unix")

autoload/mmtoolbox/bash/bashdb.vim

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"
99
" See help file bashdbintegration.txt .
1010
"
11-
" VIM Version: 7.0+
11+
" VIM Version: 7.3+
1212
" Author: Wolfgang Mehner, wolfgang-mehner@web.de
1313
" Organization:
1414
" Version: see variable g:BashDB_Version below
1515
" Created: 28.09.2017
16-
" Revision: -
17-
" License: Copyright (c) 2017-2017, Wolfgang Mehner
16+
" Revision: 19.04.2019
17+
" License: Copyright (c) 2017-2019, Wolfgang Mehner
1818
" This program is free software; you can redistribute it and/or
1919
" modify it under the terms of the GNU General Public License as
2020
" published by the Free Software Foundation, version 2 of the
@@ -257,8 +257,8 @@ function! s:ShellParseArgs ( line )
257257
let curr .= mlist[1]
258258
let line = mlist[2]
259259
else
260-
" otherwise parse up to next space
261-
let mlist = matchlist ( line, '^\(\S\+\)\(.*\)' )
260+
" otherwise parse up to next special char.: space, backslash, quote
261+
let mlist = matchlist ( line, '^\([^[:space:]\\''"]\+\)\(.*\)' )
262262
let curr .= mlist[1]
263263
let line = mlist[2]
264264
endif
@@ -395,7 +395,7 @@ if executable ( s:BashDB_DDD_Exec )
395395
let s:BashDB_DebuggerList += [ 'ddd' ]
396396
endif
397397
if has ( 'terminal' )
398-
let s:BashDB_DebuggerList += [ 'terminal' ]
398+
let s:BashDB_DebuggerList += [ 'terminal', 'integrated' ]
399399
endif
400400
call sort ( s:BashDB_DebuggerList )
401401

@@ -649,6 +649,8 @@ function! s:Run ( args )
649649

650650
silent exe '!ddd --debugger '.s:BashDB_Executable.' '.script_name.script_args.' &'
651651
elseif s:BashDB_Debugger == 'terminal'
652+
call s:ImportantMsg ( 'not implemented yet' )
653+
elseif s:BashDB_Debugger == 'integrated'
652654
call s:StartInternal ( script_name.script_args )
653655
endif
654656
endfunction " ---------- end of function s:Run ----------
@@ -665,7 +667,9 @@ endfunction " ---------- end of function s:Run ----------
665667

666668
let s:debug_status = ''
667669
let s:debug_buf_ctrl = -1
670+
let s:debug_win_ctrl = -1
668671
let s:debug_buf_io = -1
672+
let s:debug_win_io = -1
669673

670674
let s:debug_buf_script = -1
671675
let s:debug_win_script = -1
@@ -684,28 +688,50 @@ function! s:StartInternal ( args )
684688
return s:WarningMsg ( 'debugger already running' )
685689
endif
686690

691+
" bashdb: uses --tty the other way around
692+
let is_bashdb = 0
693+
let name_pty = 'BashDB - I/O'
694+
let name_job = 'BashDB - CTRL'
695+
if s:BashDB_Executable =~? '\cbashdb'
696+
let is_bashdb = 1
697+
let name_pty = 'BashDB - CTRL'
698+
let name_job = 'BashDB - I/O'
699+
endif
700+
687701
" script buffer/window
688702
let s:debug_buf_script = bufnr( '%' )
689703
let s:debug_win_script = win_getid( winnr() )
690704

691-
" the BashDB control commands are run through this terminal
692-
let s:debug_buf_ctrl = term_start ( 'NONE', {
693-
\ 'term_name' : 'BashDB - CTRL',
705+
" only the script I/O appears here
706+
let s:debug_buf_io = term_start ( 'NONE', {
707+
\ 'term_name' : name_pty,
694708
\ } )
709+
let s:debug_win_io = win_getid( winnr() )
695710

696-
let tty = term_gettty ( s:debug_buf_ctrl )
711+
let tty = term_gettty ( s:debug_buf_io )
697712

698-
" start bashdb in another terminal, only the script I/O appears here
713+
" start in another terminal, the control commands are run through this terminal
699714
let arg_list = [ s:BashDB_Executable ]
700715
let arg_list += [ '--tty', tty, '-x', tty ]
701716
let arg_list += s:ShellParseArgs ( a:args )
702717

703-
belowright new
704-
let s:debug_buf_io = term_start ( arg_list, {
705-
\ 'term_name' : 'BashDB - I/O',
706-
\ 'curwin' : 1,
718+
" bashdb: switch order of windows (also see 'curwin' below)
719+
if is_bashdb
720+
belowright new
721+
endif
722+
723+
let s:debug_buf_ctrl = term_start ( arg_list, {
724+
\ 'term_name' : name_job,
725+
\ 'curwin' : is_bashdb,
707726
\ 'exit_cb' : function ( 's:EndInternal' ),
708727
\ } )
728+
let s:debug_win_ctrl = win_getid( winnr() )
729+
730+
" bashdb: switch the buffers
731+
if is_bashdb
732+
let [ s:debug_buf_io, s:debug_buf_ctrl ] = [ s:debug_buf_ctrl, s:debug_buf_io ]
733+
let [ s:debug_win_io, s:debug_win_ctrl ] = [ s:debug_win_ctrl, s:debug_win_io ]
734+
endif
709735

710736
" now we're cooking
711737
let s:debug_status = 'running'

0 commit comments

Comments
 (0)