Skip to content

Commit 148f571

Browse files
committed
feat: add split_term_default_shell option
1 parent 5c0e84a commit 148f571

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

plugin/split-term.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
let s:force_vertical = exists('g:split_term_vertical') ? 1 : 0
33
let s:map_keys = exists('g:disable_key_mappings') ? 0 : 1
4+
let s:default_shell = exists('g:split_term_default_shell') ? g:split_term_default_shell : 0
45

56
" utilities around neovim's :term
67

@@ -54,11 +55,21 @@ fun! s:openTerm(args, count, vertical)
5455
let direction = s:force_vertical ? 1 : a:vertical
5556

5657
call s:openBuffer(a:count, direction)
58+
59+
let prevShell = &shell
60+
if exists('g:split_term_default_shell')
61+
exe 'set shell =' . s:default_shell
62+
endif
63+
5764
exe 'terminal' a:args
5865
exe 'startinsert'
5966
if s:map_keys
6067
call s:defineMaps()
6168
endif
69+
70+
if exists('g:split_term_default_shell')
71+
exe 'set shell =' . prevShell
72+
endif
6273
endf
6374

6475
command! -count -nargs=* Term call s:openTerm(<q-args>, <count>, 0)

readme.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ buffer experience.
3838
Install this plugin using your favorite plugin manager, or manually by
3939
extracting the files in your `~/.vim` or `~/.config/nvim` directory.
4040

41-
Plug 'mklabs/split-term.vim'
41+
Plug 'vimlab/split-term.vim'
4242

4343
## Commands
4444

@@ -72,15 +72,27 @@ REPL.
7272

7373
## Configuration
7474

75-
- `g:split_term_vertical` - force the `:Term` command to always use a vertical
76-
buffer (using `:vnew`)
77-
78-
- `splitright/splitbelow` options can be used to configure the split buffer
75+
`splitright/splitbelow` options can be used to configure the split buffer
7976
orientation.
8077
- `set splitright` will put the new window right of the current one when using `:VTerm`
8178
- `set splitbelow` will put the new window below the current one when using `:Term`
8279

83-
- `g:disable_key_mappings` - disable key mappings of the plugin
80+
`g:split_term_default_shell` - enables shell configuration specific to
81+
split-term. It lets vim's `shell` configuration free to let other plugins
82+
that might need it (such as ale or neomake) and works nicely [with Windows
83+
Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).
84+
Example:
85+
86+
```vim
87+
let g:split_term_default_shell = "bash"
88+
```
89+
90+
`g:split_term_vertical` - force the `:Term` command to always use a vertical
91+
buffer (using `:vnew`)
92+
93+
`g:disable_key_mappings` - disable key mappings of the plugin
94+
95+
8496

8597
## Mappings
8698

0 commit comments

Comments
 (0)