Skip to content

Commit 712b712

Browse files
committed
Fix buffer position
1 parent c4ab24a commit 712b712

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

autoload/executor.vim

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
" ===========================================================================
2-
" Description: Vim plugin that executes shell command with a buffer contents
3-
" or selection and redirects output to a new buffer
2+
" Description: Vim plugin that executes shell command and redirects output
3+
" to a new buffer
44
" Author: Alexander Skachko <[email protected]>
55
" Homepage: https://github.com/lucerion/vim-executor
66
" Version: 0.2
77
" Licence: BSD-3-Clause
88
" ===========================================================================
99

1010
let s:previous_buffer = ''
11+
let s:positions = ['top', 'bottom', 'left', 'right', 'tab']
12+
let s:default_position = 'bottom'
1113

1214
func! executor#exec(start_line, end_line, ...)
1315
if !exists('g:loaded_buffr')
@@ -42,7 +44,7 @@ func! s:open_buffer(buffer_name)
4244
endif
4345

4446
call buffr#open_or_create_buffer({
45-
\ 'position': 'bottom',
47+
\ 'position': s:buffer_position(),
4648
\ 'name': l:buffer_name
4749
\ })
4850
call s:set_buffer_defaults()
@@ -61,6 +63,14 @@ func! s:buffer_name(command)
6163
return l:name
6264
endfunc
6365

66+
func! s:buffer_position()
67+
if index(s:positions, g:executor_position) < 0
68+
return s:default_position
69+
else
70+
return g:executor_position
71+
endif
72+
endfunc
73+
6474
func! s:set_buffer_defaults()
6575
setlocal buftype=nofile
6676
setlocal bufhidden=wipe

autoload/executor/async.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" ===========================================================================
2-
" Description: Vim plugin that executes shell command with a buffer contents
3-
" or selection and redirects output to a new buffer
2+
" Description: Vim plugin that executes shell command and redirects output
3+
" to a new buffer
44
" Author: Alexander Skachko <[email protected]>
55
" Homepage: https://github.com/lucerion/vim-executor
66
" Version: 0.2

autoload/executor/default.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" ===========================================================================
2-
" Description: Vim plugin that executes shell command with a buffer contents
3-
" or selection and redirects output to a new buffer
2+
" Description: Vim plugin that executes shell command and redirects output
3+
" to a new buffer
44
" Author: Alexander Skachko <[email protected]>
55
" Homepage: https://github.com/lucerion/vim-executor
66
" Version: 0.2

plugin/executor.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" ===========================================================================
2-
" Description: Vim plugin that executes shell command with a buffer contents
3-
" or selection and redirects output to a new buffer
2+
" Description: Vim plugin that executes shell command and redirects output
3+
" to a new buffer
44
" Author: Alexander Skachko <[email protected]>
55
" Homepage: https://github.com/lucerion/vim-executor
66
" Version: 0.2

0 commit comments

Comments
 (0)