Skip to content

Commit

Permalink
feat: add split_term_default_shell option
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Sep 27, 2018
1 parent 5c0e84a commit 148f571
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
11 changes: 11 additions & 0 deletions plugin/split-term.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

let s:force_vertical = exists('g:split_term_vertical') ? 1 : 0
let s:map_keys = exists('g:disable_key_mappings') ? 0 : 1
let s:default_shell = exists('g:split_term_default_shell') ? g:split_term_default_shell : 0

" utilities around neovim's :term

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

call s:openBuffer(a:count, direction)

let prevShell = &shell
if exists('g:split_term_default_shell')
exe 'set shell =' . s:default_shell
endif

exe 'terminal' a:args
exe 'startinsert'
if s:map_keys
call s:defineMaps()
endif

if exists('g:split_term_default_shell')
exe 'set shell =' . prevShell
endif
endf

command! -count -nargs=* Term call s:openTerm(<q-args>, <count>, 0)
Expand Down
24 changes: 18 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ buffer experience.
Install this plugin using your favorite plugin manager, or manually by
extracting the files in your `~/.vim` or `~/.config/nvim` directory.

Plug 'mklabs/split-term.vim'
Plug 'vimlab/split-term.vim'

## Commands

Expand Down Expand Up @@ -72,15 +72,27 @@ REPL.

## Configuration

- `g:split_term_vertical` - force the `:Term` command to always use a vertical
buffer (using `:vnew`)

- `splitright/splitbelow` options can be used to configure the split buffer
`splitright/splitbelow` options can be used to configure the split buffer
orientation.
- `set splitright` will put the new window right of the current one when using `:VTerm`
- `set splitbelow` will put the new window below the current one when using `:Term`

- `g:disable_key_mappings` - disable key mappings of the plugin
`g:split_term_default_shell` - enables shell configuration specific to
split-term. It lets vim's `shell` configuration free to let other plugins
that might need it (such as ale or neomake) and works nicely [with Windows
Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).
Example:

```vim
let g:split_term_default_shell = "bash"
```

`g:split_term_vertical` - force the `:Term` command to always use a vertical
buffer (using `:vnew`)

`g:disable_key_mappings` - disable key mappings of the plugin



## Mappings

Expand Down

0 comments on commit 148f571

Please sign in to comment.